ac0e59b0eac3557597b0a38be8405186ee8a6091
[supertux.git] / src / badguy.cpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 //  Copyright (C) 2004 Matthias Braun <matze@braunis.de>
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU General Public License
10 //  as published by the Free Software Foundation; either version 2
11 //  of the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 //  GNU General Public License for more details.
17 // 
18 //  You should have received a copy of the GNU General Public License
19 //  along with this program; if not, write to the Free Software
20 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 //  02111-1307, USA.
22
23 #include <iostream>
24 #include <cmath>
25
26 #include "app/globals.h"
27 #include "defines.h"
28 #include "special/sprite_manager.h"
29 #include "utils/lispwriter.h"
30 #include "badguy.h"
31 #include "tile.h"
32 #include "resources.h"
33 #include "camera.h"
34 #include "level.h"
35 #include "sector.h"
36 #include "tilemap.h"
37 #include "statistics.h"
38
39 Sprite* img_mriceblock_flat_left;
40 Sprite* img_mriceblock_flat_right;
41 Sprite* img_mriceblock_falling_left;
42 Sprite* img_mriceblock_falling_right;
43 Sprite* img_mriceblock_left;
44 Sprite* img_mriceblock_right;
45 Sprite* img_jumpy_left_up;
46 Sprite* img_jumpy_left_down;
47 Sprite* img_jumpy_left_middle;
48 Sprite* img_jumpy_left_iced;
49 Sprite* img_mrbomb_left;
50 Sprite* img_mrbomb_right;
51 Sprite* img_mrbomb_iced_left;
52 Sprite* img_mrbomb_iced_right;
53 Sprite* img_mrbomb_ticking_left;
54 Sprite* img_mrbomb_ticking_right;
55 Sprite* img_mrbomb_explosion;
56 Sprite* img_stalactite;
57 Sprite* img_stalactite_broken;
58 Sprite* img_flame;
59 Sprite* img_fish;
60 Sprite* img_fish_down;
61 Sprite* img_fish_iced;
62 Sprite* img_fish_iced_down;
63 Sprite* img_flamefish;
64 Sprite* img_flamefish_down;
65 Sprite* img_bouncingsnowball_left;
66 Sprite* img_bouncingsnowball_right;
67 Sprite* img_bouncingsnowball_squished;
68 Sprite* img_flyingsnowball;
69 Sprite* img_flyingsnowball_squished;
70 Sprite* img_spiky_left;
71 Sprite* img_spiky_right;
72 Sprite* img_spiky_iced_left;
73 Sprite* img_spiky_iced_right;
74 Sprite* img_snowball_left;
75 Sprite* img_snowball_right;
76 Sprite* img_snowball_squished_left;
77 Sprite* img_snowball_squished_right;
78 Sprite* img_wingling_left;
79 Sprite* img_walkingtree_left;
80 Sprite* img_walkingtree_left_small;
81
82 #define BADGUY_WALK_SPEED .8f
83 #define WINGLING_FLY_SPEED 1.6f
84
85 BadGuyKind  badguykind_from_string(const std::string& str)
86 {
87   if (str == "money" || str == "jumpy") // was money in old maps
88     return BAD_JUMPY;
89   else if (str == "laptop" || str == "mriceblock") // was laptop in old maps
90     return BAD_MRICEBLOCK;
91   else if (str == "mrbomb")
92     return BAD_MRBOMB;
93   else if (str == "stalactite")
94     return BAD_STALACTITE;
95   else if (str == "flame")
96     return BAD_FLAME;
97   else if (str == "fish")
98     return BAD_FISH;
99   else if (str == "flamefish")
100     return BAD_FLAMEFISH;
101   else if (str == "bouncingsnowball")
102     return BAD_BOUNCINGSNOWBALL;
103   else if (str == "flyingsnowball")
104     return BAD_FLYINGSNOWBALL;
105   else if (str == "spiky")
106     return BAD_SPIKY;
107   else if (str == "snowball" || str == "bsod") // was bsod in old maps
108     return BAD_SNOWBALL;
109   else if (str == "wingling")
110     return BAD_WINGLING;
111   else if (str == "walkingtree")
112     return BAD_WALKINGTREE;
113   else
114     {
115       return BAD_INVALID;
116     }
117 }
118
119 std::string badguykind_to_string(BadGuyKind kind)
120 {
121   switch(kind)
122     {
123     case BAD_JUMPY:
124       return "jumpy";
125       break;
126     case BAD_MRICEBLOCK:
127       return "mriceblock";
128       break;
129     case BAD_MRBOMB:
130       return "mrbomb";
131       break;
132     case BAD_STALACTITE:
133       return "stalactite";
134       break;
135     case BAD_FLAME:
136       return "flame";
137       break;
138     case BAD_FISH:
139       return "fish";
140       break;
141     case BAD_FLAMEFISH:
142       return "flamefish";
143       break;
144     case BAD_BOUNCINGSNOWBALL:
145       return "bouncingsnowball";
146       break;
147     case BAD_FLYINGSNOWBALL:
148       return "flyingsnowball";
149       break;
150     case BAD_SPIKY:
151       return "spiky";
152       break;
153     case BAD_SNOWBALL:
154       return "snowball";
155       break;
156     case BAD_WINGLING:
157       return "wingling";
158       break;
159     case BAD_WALKINGTREE:
160       return "walkingtree";
161     default:
162       return "snowball";
163     }
164 }
165
166 BadGuy::BadGuy(BadGuyKind kind_, LispReader& lispreader)
167   : removable(false), squishcount(0)
168 {
169   lispreader.read_float("x", start_position.x);
170   lispreader.read_float("y", start_position.y);
171
172   kind     = kind_;
173
174   stay_on_platform = false;
175   lispreader.read_bool("stay-on-platform", stay_on_platform);
176
177   init();
178 }
179
180 BadGuy::BadGuy(BadGuyKind kind_, float x, float y)
181   : removable(false), squishcount(0)
182 {
183   start_position.x = x;
184   start_position.y = y;
185   stay_on_platform = false;
186
187   kind     = kind_;
188   
189   init();
190 }
191
192 BadGuy::~BadGuy()
193 {
194 }
195
196 void
197 BadGuy::init()
198 {
199   base.x = 0;
200   base.y = 0;
201   base.width  = 0;
202   base.height = 0;
203   
204   mode     = NORMAL;
205   dying    = DYING_NOT;
206   old_base = base;
207   dir      = LEFT;
208   seen     = false;
209   animation_offset = 0;
210   target.x = target.y = -1;
211   sprite_left = sprite_right = 0;
212   physic.reset();
213   frozen_timer.init(true);
214   timer.init(true);
215
216   // if we're in a solid tile at start correct that now
217   if(Sector::current()) {
218   if(kind != BAD_FLAME && kind != BAD_FISH && kind != BAD_FLAMEFISH && collision_object_map(base)) 
219     {
220       std::cout << "Warning: badguy started in wall: kind: " << badguykind_to_string(kind) 
221                 << " pos: (" << base.x << ", " << base.y << ")" << std::endl;
222       while(collision_object_map(base))
223         --base.y;
224     }
225
226   if(Sector::current()->camera) {
227     Vector scroll = Sector::current()->camera->get_translation();
228
229     if(start_position.x > scroll.x - X_OFFSCREEN_DISTANCE &&
230         start_position.x < scroll.x + screen->w + X_OFFSCREEN_DISTANCE &&
231         start_position.y > scroll.y - Y_OFFSCREEN_DISTANCE &&
232         start_position.y < scroll.y + screen->h + Y_OFFSCREEN_DISTANCE) {
233       activate(LEFT);
234     }
235   } } else {
236     if(start_position.x > 0 && start_position.x <= screen->w
237         && start_position.y > 0 && start_position.y <= screen->h)
238       activate(LEFT);
239   }
240 }
241
242 void
243 BadGuy::write(LispWriter& writer)
244 {
245   writer.start_list(badguykind_to_string(kind));
246
247   writer.write_float("x", base.x);
248   writer.write_float("y", base.y);
249   writer.write_bool("stay-on-platform", stay_on_platform);  
250
251   writer.end_list(badguykind_to_string(kind));
252 }
253
254 void
255 BadGuy::activate(Direction activation_dir)
256 {
257   mode     = NORMAL;
258   animation_offset = 0;
259   target.x = target.y = -1;
260   physic.reset();
261   frozen_timer.init(true);
262   timer.init(true);
263
264   dir = activation_dir;
265   float dirsign = activation_dir == LEFT ? -1 : 1;
266   
267   if(kind == BAD_MRBOMB) {
268     physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0);
269     set_sprite(img_mrbomb_left, img_mrbomb_right);
270   } else if (kind == BAD_MRICEBLOCK) {
271     physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0);
272     set_sprite(img_mriceblock_left, img_mriceblock_right);
273   } else if(kind == BAD_JUMPY) {
274     set_sprite(img_jumpy_left_up, img_jumpy_left_up);
275   } else if(kind == BAD_BOMB) {
276     set_sprite(img_mrbomb_ticking_left, img_mrbomb_ticking_right);
277     // hack so that the bomb doesn't hurt until it expldes...           
278     dying = DYING_SQUISHED;
279   } else if(kind == BAD_FLAME) {
280     angle = 0;
281     physic.enable_gravity(false);
282     set_sprite(img_flame, img_flame);
283   } else if(kind == BAD_BOUNCINGSNOWBALL) {
284     physic.set_velocity(dirsign * 1.3, 0);
285     set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right);
286   } else if(kind == BAD_STALACTITE) {
287     physic.enable_gravity(false);
288     set_sprite(img_stalactite, img_stalactite);
289   } else if(kind == BAD_FISH) {
290     set_sprite(img_fish, img_fish);
291     physic.enable_gravity(true);
292   } else if(kind == BAD_FLAMEFISH) {
293     set_sprite(img_flamefish, img_flamefish);
294     physic.enable_gravity(true);
295   } else if(kind == BAD_FLYINGSNOWBALL) {
296     set_sprite(img_flyingsnowball, img_flyingsnowball);
297     physic.enable_gravity(false);
298   } else if(kind == BAD_SPIKY) {
299     physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0);
300     set_sprite(img_spiky_left, img_spiky_right);
301   } else if(kind == BAD_SNOWBALL) {
302     physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0);
303     set_sprite(img_snowball_left, img_snowball_right);
304   } else if(kind == BAD_WINGLING) {
305     physic.set_velocity(dirsign * WINGLING_FLY_SPEED, 0);
306     physic.enable_gravity(false);
307     set_sprite(img_wingling_left, img_wingling_left);
308   } else if (kind == BAD_WALKINGTREE) {
309     // TODO: why isn't the height/width being set properly in set_sprite?
310     physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0);
311     mode = BGM_BIG;
312     set_sprite(img_walkingtree_left, img_walkingtree_left);
313     base.width = 66;
314     base.height = 66;
315   }
316
317   base.x = start_position.x;
318   base.y = start_position.y;  
319   old_base = base;
320   seen = true;
321 }
322
323 void
324 BadGuy::action_mriceblock(double elapsed_time)
325 {
326   Player& tux = *Sector::current()->player;
327
328   if(mode != HELD)
329     fall();
330   
331   /* Move left/right: */
332   if (mode != HELD)
333     {
334       // move
335       physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
336       if (dying != DYING_FALLING)
337         collision_swept_object_map(&old_base,&base);
338     }
339   else if (mode == HELD)
340     { /* FIXME: The pbad object shouldn't know about pplayer objects. */
341       /* If we're holding the iceblock */
342       dir = tux.dir;
343       if(tux.size == SMALL)
344         {
345         if(dir == RIGHT)
346           base.x = tux.base.x + 24;
347         else // dir == LEFT
348           base.x = tux.base.x - 12;
349         base.y = tux.base.y + tux.base.height/1.5 - base.height;
350         }
351       else // TUX == BIG
352         {
353         if(dir == RIGHT)
354           base.x = tux.base.x + 24;
355         else // dir == LEFT
356           base.x = tux.base.x - 4;
357         base.y = tux.base.y + tux.base.height/1.5 - base.height;
358         }
359
360       if(collision_object_map(base))
361         {
362           base.x = tux.base.x;
363           base.y = tux.base.y + tux.base.height/1.5 - base.height;
364         }
365
366       if(tux.input.fire != DOWN) /* SHOOT! */
367         {
368           if(dir == LEFT)
369             base.x = tux.base.x - base.width;
370           else
371             base.x = tux.base.x + tux.base.width;
372           old_base = base;
373
374           mode=KICK;
375           tux.kick_timer.start(KICKING_TIME);
376           set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
377           physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5);
378           SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos());
379         }
380     }
381
382   if (!dying)
383     {
384       int changed = dir;
385       check_horizontal_bump();
386       if(mode == KICK && changed != dir)
387         {
388           SoundManager::get()->play_sound(IDToSound(SND_RICOCHET), get_pos(), Sector::current()->player->get_pos());
389         }
390     }
391
392   /* Handle mode timer: */
393   if (mode == FLAT)
394     {
395       if(!timer.check())
396         {
397           mode = NORMAL;
398           set_sprite(img_mriceblock_left, img_mriceblock_right);
399           physic.set_velocity( (dir == LEFT) ? -.8 : .8, 0);
400         }
401     }
402 }
403
404 void
405 BadGuy::check_horizontal_bump(bool checkcliff)
406 {
407     float halfheight = base.height / 2;
408     if (dir == LEFT && issolid( base.x, base.y + halfheight))
409     {
410         if (kind == BAD_MRICEBLOCK && mode == KICK)
411             {
412             Sector::current()->trybreakbrick(Vector(base.x, base.y + halfheight), false);
413             Sector::current()->tryemptybox(Vector(base.x, base.y + halfheight), dir);
414             }
415             
416         dir = RIGHT;
417         physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
418         return;
419     }
420     if (dir == RIGHT && issolid( base.x + base.width, base.y + halfheight))
421     {
422         if (kind == BAD_MRICEBLOCK && mode == KICK)
423             {
424             Sector::current()->trybreakbrick(
425                 Vector(base.x + base.width, base.y + halfheight), false);
426             Sector::current()->tryemptybox(
427                 Vector(base.x + base.width, base.y + halfheight), dir);
428             }
429             
430         dir = LEFT;
431         physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
432         return;
433     }
434
435     // don't check for cliffs when we're falling
436     if(!checkcliff)
437         return;
438     if(!issolid(base.x + base.width/2, base.y + base.height))
439         return;
440     
441     if(dir == LEFT && !issolid(base.x, (int) base.y + base.height + halfheight))
442     {
443         dir = RIGHT;
444         physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
445         return;
446     }
447     if(dir == RIGHT && !issolid(base.x + base.width,
448                 (int) base.y + base.height + halfheight))
449     {
450         dir = LEFT;
451         physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
452         return;
453     }
454 }
455
456 void
457 BadGuy::fall()
458 {
459   /* Fall if we get off the ground: */
460   if (dying != DYING_FALLING)
461     {
462       if (!issolid(base.x+base.width/2, base.y + base.height))
463         {
464           // not solid below us? enable gravity
465           physic.enable_gravity(true);
466         }
467       else
468         {
469           /* Land: */
470           if (physic.get_velocity_y() < 0)
471             {
472               base.y = int((base.y + base.height)/32) * 32 - base.height;
473               physic.set_velocity_y(0);
474             }
475           // no gravity anymore please
476           physic.enable_gravity(false);
477
478           if (stay_on_platform && mode == NORMAL)
479             {
480               if (!issolid(base.x + ((dir == LEFT) ? 0 : base.width),
481                            base.y + base.height))
482                 {
483                   if (dir == LEFT)
484                   {
485                     dir = RIGHT;
486                     physic.set_velocity_x(fabsf(physic.get_velocity_x()));
487                   } 
488                   else
489                   {
490                     dir = LEFT;
491                     physic.set_velocity_x(-fabsf(physic.get_velocity_x()));
492                   }
493                 }
494             }
495         }
496     }
497   else
498     {
499       physic.enable_gravity(true);
500     }
501 }
502
503 void
504 BadGuy::action_jumpy(double elapsed_time)
505 {
506   if(frozen_timer.check())
507     {
508     set_sprite(img_jumpy_left_iced, img_jumpy_left_iced);
509     return;
510     }
511
512   const float vy = physic.get_velocity_y();
513
514   // XXX: These tests *should* use location from ground, not velocity
515   if (fabsf(vy) > 5.6f)
516     set_sprite(img_jumpy_left_down, img_jumpy_left_down);
517   else if (fabsf(vy) > 5.3f)
518     set_sprite(img_jumpy_left_middle, img_jumpy_left_middle);
519   else
520     set_sprite(img_jumpy_left_up, img_jumpy_left_up);
521
522   Player& tux = *Sector::current()->player;
523
524   static const float JUMPV = 6;
525     
526   fall();
527   // jump when on ground
528   if(dying == DYING_NOT && issolid(base.x, base.y+32))
529     {
530       physic.set_velocity_y(JUMPV);
531       physic.enable_gravity(true);
532
533       mode = JUMPY_JUMP;
534     }
535   else if(mode == JUMPY_JUMP)
536     {
537       mode = NORMAL;
538     }
539
540   // set direction based on tux
541   if(tux.base.x > base.x)
542     dir = RIGHT;
543   else
544     dir = LEFT;
545
546   // move
547   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
548   if(dying == DYING_NOT)
549     collision_swept_object_map(&old_base, &base);
550 }
551
552 void
553 BadGuy::action_mrbomb(double elapsed_time)
554 {
555   if(frozen_timer.check())
556     {
557     set_sprite(img_mrbomb_iced_left, img_mrbomb_iced_right);
558     return;
559     }
560
561   if (dying == DYING_NOT)
562     check_horizontal_bump(true);
563
564   fall();
565
566   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
567   if (dying != DYING_FALLING)
568     collision_swept_object_map(&old_base,&base); 
569 }
570
571 void
572 BadGuy::action_bomb(double elapsed_time)
573 {
574   static const int TICKINGTIME = 1000;
575   static const int EXPLODETIME = 1000;
576     
577   fall();
578
579   if(mode == NORMAL) {
580     mode = BOMB_TICKING;
581     timer.start(TICKINGTIME);
582   } else if(!timer.check()) {
583     if(mode == BOMB_TICKING) {
584       mode = BOMB_EXPLODE;
585       set_sprite(img_mrbomb_explosion, img_mrbomb_explosion);
586       dying = DYING_NOT; // now the bomb hurts
587       timer.start(EXPLODETIME);
588
589       SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), this, Sector::current()->player->get_pos());
590     } else if(mode == BOMB_EXPLODE) {
591       remove_me();
592       return;
593     }
594   }
595
596   // move
597   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);                 
598   collision_swept_object_map(&old_base,&base);
599 }
600
601 void
602 BadGuy::action_stalactite(double elapsed_time)
603 {
604   Player& tux = *Sector::current()->player;
605
606   static const int SHAKETIME = 800;
607   static const int RANGE = 40;
608     
609   if(mode == NORMAL) {
610     // start shaking when tux is below the stalactite and at least 40 pixels
611     // near
612     if(tux.base.x + 32 > base.x - RANGE && tux.base.x < base.x + 32 + RANGE
613             && tux.base.y + tux.base.height > base.y
614             && tux.dying == DYING_NOT) {
615       timer.start(SHAKETIME);
616       mode = STALACTITE_SHAKING;
617     }
618   } if(mode == STALACTITE_SHAKING) {
619     base.x = old_base.x + (rand() % 6) - 3; // TODO this could be done nicer...
620     if(!timer.check()) {
621       mode = STALACTITE_FALL;
622     }
623   } else if(mode == STALACTITE_FALL) {
624     fall();
625     /* Destroy if we collides with land */
626     if(issolid(base.x+base.width/2, base.y+base.height))
627     {
628       timer.start(2000);
629       dying = DYING_SQUISHED;
630       mode = FLAT;
631       set_sprite(img_stalactite_broken, img_stalactite_broken);
632     }
633   } else if(mode == FLAT) {
634     fall();
635   }
636
637   // move
638   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
639
640   if(dying == DYING_SQUISHED && !timer.check())
641     remove_me();
642 }
643
644 void
645 BadGuy::action_flame(double elapsed_time)
646 {
647     static const float radius = 100;
648     static const float speed = 0.02;
649     base.x = old_base.x + cos(angle) * radius;
650     base.y = old_base.y + sin(angle) * radius;
651
652     angle = fmodf(angle + elapsed_time * speed, 2*M_PI);
653 }
654
655 void
656 BadGuy::action_fish(double elapsed_time)
657 {
658   if(frozen_timer.check())
659     {
660     if(physic.get_velocity_y() < 0)
661       set_sprite(img_fish_iced_down, img_fish_iced_down);
662     else
663       set_sprite(img_fish_iced, img_fish_iced);
664
665     return;
666     }
667
668   static const float JUMPV = 6;
669   static const int WAITTIME = 1000;
670     
671   // go in wait mode when back in water
672   if(dying == DYING_NOT 
673       && gettile(base.x, base.y + base.height)
674       && gettile(base.x, base.y + base.height)->attributes & Tile::WATER
675       && physic.get_velocity_y() <= 0 && mode == NORMAL)
676     {
677       mode = FISH_WAIT;
678       set_sprite(0, 0);
679       physic.set_velocity(0, 0);
680       physic.enable_gravity(false);
681       timer.start(WAITTIME);
682     }
683   else if(mode == FISH_WAIT && !timer.check())
684     {
685       // jump again
686       if(kind == BAD_FISH)
687         set_sprite(img_fish, img_fish);
688       else // BAD_FLAMEFISH
689         set_sprite(img_flamefish, img_flamefish);
690       mode = NORMAL;
691       physic.set_velocity(0, JUMPV);
692       physic.enable_gravity(true);
693     }
694
695   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
696   if(dying == DYING_NOT)
697     collision_swept_object_map(&old_base, &base);
698
699   if(physic.get_velocity_y() < 0)
700     {
701       if(kind == BAD_FISH)
702         set_sprite(img_fish_down, img_fish_down);
703       else // BAD_FLAMEFISH
704         set_sprite(img_flamefish_down, img_flamefish_down);
705     }
706 }
707
708 void
709 BadGuy::action_bouncingsnowball(double elapsed_time)
710 {
711   static const float JUMPV = 4.5;
712     
713   fall();
714
715   // jump when on ground
716   if(dying == DYING_NOT && issolid(base.x, base.y+32))
717     {
718       physic.set_velocity_y(JUMPV);
719       physic.enable_gravity(true);
720     }                                                     
721   else
722     {
723       mode = NORMAL;
724     }
725
726   // check for right/left collisions
727   check_horizontal_bump();
728
729   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
730   if(dying == DYING_NOT)
731     collision_swept_object_map(&old_base, &base);
732
733   // Handle dying timer:
734   if (dying == DYING_SQUISHED && !timer.check())
735     remove_me();
736 }
737
738 void
739 BadGuy::action_flyingsnowball(double elapsed_time)
740 {
741   static const float FLYINGSPEED = 1;
742   static const int DIRCHANGETIME = 1000;
743     
744   // go into flyup mode if none specified yet
745   if(dying == DYING_NOT && mode == NORMAL) {
746     mode = FLY_UP;
747     physic.set_velocity_y(FLYINGSPEED);
748     timer.start(DIRCHANGETIME/2);
749   }
750
751   if(dying == DYING_NOT && !timer.check()) {
752     if(mode == FLY_UP) {
753       mode = FLY_DOWN;
754       physic.set_velocity_y(-FLYINGSPEED);
755     } else if(mode == FLY_DOWN) {
756       mode = FLY_UP;
757       physic.set_velocity_y(FLYINGSPEED);
758     }
759     timer.start(DIRCHANGETIME);
760   }
761
762   if(dying != DYING_NOT)
763     physic.enable_gravity(true);
764
765   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
766   if(dying == DYING_NOT || dying == DYING_SQUISHED)
767     collision_swept_object_map(&old_base, &base);
768
769   // Handle dying timer:
770   if (dying == DYING_SQUISHED && !timer.check())
771     remove_me();
772 }
773
774 void
775 BadGuy::action_spiky(double elapsed_time)
776 {
777   if(frozen_timer.check())
778     {
779     set_sprite(img_spiky_iced_left, img_spiky_iced_right);
780     return;
781     }
782
783   if (dying == DYING_NOT)
784     check_horizontal_bump();
785
786   fall();
787 #if 0
788   // jump when we're about to fall
789   if (physic.get_velocity_y() == 0 && 
790           !issolid(base.x+base.width/2, base.y + base.height)) {
791     physic.enable_gravity(true);
792     physic.set_velocity_y(2);
793   }
794 #endif
795
796   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
797   if (dying != DYING_FALLING)
798     collision_swept_object_map(&old_base,&base);   
799 }
800
801 void
802 BadGuy::action_snowball(double elapsed_time)
803 {
804   if (dying == DYING_NOT)
805     check_horizontal_bump();
806
807   fall();
808
809   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
810   if (dying != DYING_FALLING)
811     collision_swept_object_map(&old_base,&base);
812
813   // Handle dying timer:
814   if (dying == DYING_SQUISHED && !timer.check())
815     remove_me();                                  
816 }
817
818 void
819 BadGuy::action_wingling(double elapsed_time)
820 {
821   if (dying != DYING_NOT)
822     physic.enable_gravity(true);
823   else
824   {
825     Player& tux = *Sector::current()->player;
826     int dirsign = physic.get_velocity_x() < 0 ? -1 : 1;
827
828     if (fabsf(tux.base.x - base.x) < 150 && base.y < tux.base.y && tux.dying == DYING_NOT)
829     {
830       if (target.x < 0 && target.y < 0)
831       {
832         target.x = tux.base.x;
833         target.y = tux.base.y;
834         physic.set_velocity(dirsign * 1.5f, -2.25f);
835       }
836     }
837     else if (base.y >= target.y - 16)
838       physic.set_velocity(dirsign * WINGLING_FLY_SPEED, 0);
839   }
840
841   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
842
843
844   // Handle dying timer:
845   if (dying == DYING_SQUISHED && !timer.check())
846     remove_me();
847
848   // TODO: Winglings should be removed after flying off the screen
849 }
850
851 void
852 BadGuy::action_walkingtree(double elapsed_time)
853 {
854   if (dying == DYING_NOT)
855     check_horizontal_bump();
856
857   fall();
858
859   physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
860   if (dying != DYING_FALLING)
861     collision_swept_object_map(&old_base,&base);
862
863   // Handle dying timer:
864   if (dying == DYING_SQUISHED && !timer.check())
865     remove_me();
866 }
867
868 void
869 BadGuy::action(float elapsed_time)
870 {
871   float scroll_x = Sector::current()->camera->get_translation().x;
872   float scroll_y = Sector::current()->camera->get_translation().y;
873   
874   // BadGuy fall below the ground
875   if (base.y > Sector::current()->solids->get_height() * 32) {
876     remove_me();
877     return;
878   }
879
880   // Kill us if we landed on spikes
881   if (dying == DYING_NOT
882       && (kind != BAD_STALACTITE && kind != BAD_FLAME && kind != BAD_BOMB)
883       && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
884       ||  isspike(base.x, base.y + base.height)
885       ||  isspike(base.x + base.width, base.y + base.height)))
886       {
887          physic.set_velocity_y(3);
888          kill_me(0);
889       }
890
891   if(!seen) {
892     /* activate badguys if they're just inside the offscreen_distance around the
893      * screen. Don't activate them inside the screen, since that might have the
894      * effect of badguys suddenly popping up from nowhere
895      */
896     if (start_position.x > scroll_x - X_OFFSCREEN_DISTANCE &&
897         start_position.x < scroll_x - base.width)
898       activate(RIGHT);
899     else if(start_position.x > scroll_y - Y_OFFSCREEN_DISTANCE &&
900         start_position.y < scroll_y - base.height)
901       activate(LEFT);
902     else if(start_position.x > scroll_x + screen->w &&
903         start_position.x < scroll_x + screen->w + X_OFFSCREEN_DISTANCE)
904       activate(LEFT);
905     else if(start_position.y > scroll_y + screen->h &&
906         start_position.y < scroll_y + screen->h + Y_OFFSCREEN_DISTANCE)
907       activate(LEFT);
908   } else {
909     if(base.x + base.width < scroll_x - X_OFFSCREEN_DISTANCE*4
910       || base.x > scroll_x + screen->w + X_OFFSCREEN_DISTANCE*4
911       || base.y + base.height < scroll_y - Y_OFFSCREEN_DISTANCE*4
912       || base.y > scroll_y + screen->h + Y_OFFSCREEN_DISTANCE*4) {
913       seen = false;
914       if(dying != DYING_NOT)
915         remove_me();
916     }
917   }
918   
919   if(!seen)
920     return;
921   
922   switch (kind)
923     {
924     case BAD_MRICEBLOCK:
925       action_mriceblock(elapsed_time);
926       break;
927   
928     case BAD_JUMPY:
929       action_jumpy(elapsed_time);
930       break;
931
932     case BAD_MRBOMB:
933       action_mrbomb(elapsed_time);
934       break;
935     
936     case BAD_BOMB:
937       action_bomb(elapsed_time);
938       break;
939
940     case BAD_STALACTITE:
941       action_stalactite(elapsed_time);
942       break;
943
944     case BAD_FLAME:
945       action_flame(elapsed_time);
946       break;
947
948     case BAD_FISH:
949     case BAD_FLAMEFISH:
950       action_fish(elapsed_time);
951       break;
952
953     case BAD_BOUNCINGSNOWBALL:
954       action_bouncingsnowball(elapsed_time);
955       break;
956
957     case BAD_FLYINGSNOWBALL:
958       action_flyingsnowball(elapsed_time);
959       break;
960
961     case BAD_SPIKY:
962       action_spiky(elapsed_time);
963       break;
964
965     case BAD_SNOWBALL:
966       action_snowball(elapsed_time);
967       break;
968
969     case BAD_WINGLING:
970       action_wingling(elapsed_time);
971       break;
972
973     case BAD_WALKINGTREE:
974       action_walkingtree(elapsed_time);
975       break;
976
977     default:
978       break;
979     }
980 }
981
982 void
983 BadGuy::draw(DrawingContext& context)
984 {
985   Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right;
986   if(sprite == 0)
987     return;
988
989   if(dying == DYING_FALLING && physic.get_velocity_y() < 0)
990     sprite->draw(context, Vector(base.x, base.y), LAYER_FOREGROUNDTILES+1, VERTICAL_FLIP);
991   else
992     sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS);
993
994   if(debug_mode)
995     context.draw_filled_rect(Vector(base.x, base.y),
996         Vector(base.width, base.height), Color(75,0,75, 150), LAYER_OBJECTS+1);
997 }
998
999 void
1000 BadGuy::set_sprite(Sprite* left, Sprite* right) 
1001 {
1002   if (1)
1003     {
1004       base.width = 32;
1005       base.height = 32;
1006     }
1007   else
1008     {
1009       // FIXME: Using the image size for the physics and collision is
1010       // a bad idea, since images should always overlap there physical
1011       // representation
1012       if(left != 0) {
1013         if(base.width == 0 && base.height == 0) {
1014           base.width  = left->get_width();
1015           base.height = left->get_height();
1016         } else if(base.width != left->get_width() || base.height != left->get_height()) {
1017           base.x -= (left->get_width() - base.width) / 2;
1018           base.y -= left->get_height() - base.height;
1019           base.width = left->get_width();
1020           base.height = left->get_height();
1021           old_base = base;
1022         }
1023       } else {
1024         base.width = base.height = 0;
1025       }
1026     }
1027
1028   animation_offset = 0;
1029   sprite_left  = left;
1030   sprite_right = right;
1031 }
1032
1033 void
1034 BadGuy::bump()
1035 {
1036   // these can't be bumped
1037   if(kind == BAD_FLAME || kind == BAD_BOMB || kind == BAD_FISH
1038       || kind == BAD_FLAMEFISH || kind == BAD_FLYINGSNOWBALL)
1039     return;
1040
1041   physic.set_velocity_y(3);
1042   kill_me(25);
1043 }
1044
1045 void
1046 BadGuy::squish_me(Player* player)
1047 {
1048   player->bounce(this);
1049     
1050   Sector::current()->add_score(Vector(base.x, base.y),
1051                               25 * player_status.score_multiplier);
1052
1053   SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), Sector::current()->player->get_pos());
1054   player_status.score_multiplier++;
1055
1056   dying = DYING_SQUISHED;
1057   timer.start(2000);
1058   physic.set_velocity(0, 0);
1059 }
1060
1061 void
1062 BadGuy::squish(Player* player)
1063 {
1064   static const int MAX_ICEBLOCK_SQUICHES = 10;
1065     
1066   if(kind == BAD_MRBOMB) {
1067     // mrbomb transforms into a bomb now
1068     explode(false);
1069     
1070     player->bounce(this);
1071     Sector::current()->add_score(Vector(base.x, base.y),
1072                                 25 * player_status.score_multiplier);
1073     SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), Sector::current()->player->get_pos());
1074
1075     global_stats.add_points(BADGUYS_SQUISHED_STAT, 1);
1076     player_status.score_multiplier++;
1077     return;
1078
1079   } else if (kind == BAD_MRICEBLOCK) {
1080     if (mode == NORMAL || mode == KICK)
1081       {
1082         /* Flatten! */
1083         SoundManager::get()->play_sound(IDToSound(SND_STOMP), get_pos(), Sector::current()->player->get_pos());
1084         mode = FLAT;
1085         set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
1086         physic.set_velocity_x(0);
1087
1088         timer.start(4000);
1089       } else if (mode == FLAT) {
1090         /* Kick! */
1091         SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos());
1092
1093         if (player->base.x < base.x + (base.width/2)) {
1094           physic.set_velocity_x(5);
1095           dir = RIGHT;
1096         } else {
1097           physic.set_velocity_x(-5);
1098           dir = LEFT;
1099         }
1100
1101         mode = KICK;
1102         player->kick_timer.start(KICKING_TIME);
1103         set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
1104       }
1105
1106     player->bounce(this);
1107
1108     player_status.score_multiplier++;
1109
1110     // check for maximum number of squishes
1111     squishcount++;
1112     if(squishcount >= MAX_ICEBLOCK_SQUICHES) {
1113       kill_me(50);
1114       return;
1115     }
1116     
1117     return;
1118   } else if(kind == BAD_FISH || kind == BAD_FLAMEFISH) {
1119     // fish can only be killed when falling down
1120     if(physic.get_velocity_y() >= 0)
1121       return;
1122       
1123     player->bounce(this);
1124               
1125     Sector::current()->add_score(Vector(base.x, base.y),
1126                                 25 * player_status.score_multiplier);
1127
1128     global_stats.add_points(BADGUYS_SQUISHED_STAT, 1);
1129     player_status.score_multiplier++;
1130      
1131     // simply remove the fish...
1132     remove_me();
1133     return;
1134   } else if(kind == BAD_BOUNCINGSNOWBALL) {
1135     squish_me(player);
1136     set_sprite(img_bouncingsnowball_squished,img_bouncingsnowball_squished);
1137     return;
1138   } else if(kind == BAD_FLYINGSNOWBALL) {
1139     squish_me(player);
1140     set_sprite(img_flyingsnowball_squished,img_flyingsnowball_squished);
1141     return;
1142   } else if(kind == BAD_SNOWBALL) {
1143     squish_me(player);
1144     set_sprite(img_snowball_squished_left, img_snowball_squished_right);
1145     return;
1146   } else if(kind == BAD_WINGLING) {
1147     squish_me(player);
1148     set_sprite(img_wingling_left, img_wingling_left);
1149   } else if(kind == BAD_WALKINGTREE) {
1150     if (mode == BGM_BIG)
1151     {
1152       set_sprite(img_walkingtree_left_small, img_walkingtree_left_small);
1153       physic.set_velocity_x(physic.get_velocity_x() * 2.0f);
1154
1155       /* Move to the player's direction */
1156       if(dir != Sector::current()->player->dir)
1157         physic.set_velocity_x(-physic.get_velocity_x());
1158       dir = Sector::current()->player->dir;
1159
1160       // XXX magic number: 66 is BGM_BIG height
1161
1162       player->bounce(this);
1163       base.y += 66 - base.height;
1164
1165       global_stats.add_points(BADGUYS_SQUISHED_STAT, 1);
1166       Sector::current()->add_score(Vector(base.x, base.y),
1167                                 25 * player_status.score_multiplier);
1168       player_status.score_multiplier++;
1169
1170       mode = BGM_SMALL;
1171     }
1172     else
1173       squish_me(player);
1174   }
1175 }
1176
1177 void
1178 BadGuy::kill_me(int score)
1179 {
1180   if(kind == BAD_BOMB)
1181     return;
1182
1183   dying = DYING_FALLING;
1184   if(kind == BAD_MRICEBLOCK) {
1185     set_sprite(img_mriceblock_falling_left, img_mriceblock_falling_right);
1186     if(mode == HELD) {
1187       mode = NORMAL;
1188       Player& tux = *Sector::current()->player;
1189       tux.holding_something = false;
1190     }
1191   }
1192
1193   physic.enable_gravity(true);
1194
1195   /* Gain some points: */
1196   if (score != 0)
1197     Sector::current()->add_score(Vector(base.x, base.y),
1198                                 score * player_status.score_multiplier);
1199
1200   /* Play death sound: */
1201   SoundManager::get()->play_sound(IDToSound(SND_FALL), this, Sector::current()->player->get_pos());
1202 }
1203
1204 void
1205 BadGuy::explode(bool right_way)
1206 {
1207   BadGuy *badguy = Sector::current()->add_bad_guy(base.x, base.y, BAD_BOMB);
1208   if(right_way)
1209     {
1210     badguy->timer.start(0);
1211     badguy->mode = BOMB_TICKING;
1212     }
1213
1214   remove_me();
1215 }
1216
1217 void
1218 BadGuy::collision(const MovingObject&, int)
1219 {
1220   // later
1221 }
1222
1223 void
1224 BadGuy::collision(void *p_c_object, int c_object, CollisionType type)
1225 {
1226   BadGuy* pbad_c    = NULL;
1227   Bullet* pbullet_c = NULL;
1228
1229   if(type == COLLISION_BUMP) {
1230     bump();
1231     return;
1232   }
1233
1234   if(type == COLLISION_SQUISH) {
1235     Player* player = static_cast<Player*>(p_c_object);
1236     squish(player);
1237     return;
1238   }
1239
1240   /* COLLISION_NORMAL */
1241   switch (c_object)
1242     {
1243     case CO_BULLET:
1244       pbullet_c = (Bullet*) p_c_object;
1245
1246       if(pbullet_c->kind == FIRE_BULLET)
1247         {
1248         if (kind != BAD_BOMB && kind != BAD_STALACTITE && kind != BAD_FLAME
1249             && kind != BAD_FLAMEFISH)
1250           kill_me(10);
1251         }
1252       else if(pbullet_c->kind == ICE_BULLET)
1253         {
1254         if(kind == BAD_FLAME || kind == BAD_FLAMEFISH)
1255           kill_me(10);
1256         else
1257           frozen_timer.start(FROZEN_TIME);
1258         }
1259       break;
1260
1261     case CO_BADGUY:
1262       pbad_c = (BadGuy*) p_c_object;
1263
1264
1265       /* If we're a kicked mriceblock, kill [almost] any badguys we hit */
1266       if(kind == BAD_MRICEBLOCK && mode == KICK &&
1267          kind != BAD_FLAME && kind != BAD_BOMB && kind != BAD_STALACTITE)
1268         {
1269           pbad_c->kill_me(25);
1270         }
1271
1272       // a held mriceblock kills the enemy too but falls to ground then
1273       else if(kind == BAD_MRICEBLOCK && mode == HELD)
1274         {
1275           pbad_c->kill_me(25);
1276           kill_me(0);
1277         }
1278
1279       /* Kill badguys that run into exploding bomb */
1280       else if (kind == BAD_BOMB && dying == DYING_NOT)
1281       {
1282         if (pbad_c->kind == BAD_MRBOMB)
1283         {
1284           // mrbomb transforms into a bomb now
1285           pbad_c->explode(true);
1286           return;
1287         }
1288         else
1289         {
1290           pbad_c->kill_me(50);
1291         }
1292       }
1293
1294       /* Kill any badguys that get hit by stalactite */
1295       else if (kind == BAD_STALACTITE && dying == DYING_NOT)
1296       {
1297         if (pbad_c->kind == BAD_MRBOMB)
1298         {
1299           // mrbomb transforms into a bomb now
1300           pbad_c->explode(false);
1301           return;
1302         }
1303         else
1304           pbad_c->kill_me(50);
1305       }
1306
1307       /* When enemies run into eachother, make them change directions */
1308       else
1309       {
1310         // Wingling doesn't interact with other badguys
1311         if (pbad_c->kind == BAD_WINGLING || kind == BAD_WINGLING)
1312           break;
1313
1314         // Jumpy, fish, flame, stalactites, wingling are exceptions
1315         if (pbad_c->kind == BAD_JUMPY || pbad_c->kind == BAD_FLAME
1316             || pbad_c->kind == BAD_STALACTITE || pbad_c->kind == BAD_FISH
1317             || pbad_c->kind == BAD_FLAMEFISH)
1318           break;
1319
1320         // Bounce off of other badguy if we land on top of him
1321         if (base.y + base.height < pbad_c->base.y + pbad_c->base.height)
1322         {
1323           if (pbad_c->dir == LEFT)
1324           {
1325             dir = RIGHT;
1326             physic.set_velocity(fabsf(physic.get_velocity_x()), 2);
1327           }
1328           else if (pbad_c->dir == RIGHT)
1329           {
1330             dir = LEFT;
1331             physic.set_velocity(-fabsf(physic.get_velocity_x()), 2);
1332           }
1333
1334           break;
1335         }
1336         else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height)
1337           break;
1338
1339         if (pbad_c->kind != BAD_FLAME)
1340           {
1341             if (dir == LEFT)
1342             {
1343               dir = RIGHT;
1344               physic.set_velocity_x(fabsf(physic.get_velocity_x()));
1345
1346               // Put bad guys a part (or they get jammed)
1347               // only needed to do to one of them
1348               if (physic.get_velocity_x() != 0)
1349                 base.x = pbad_c->base.x + pbad_c->base.width + 1;
1350             }
1351             else if (dir == RIGHT)
1352             {
1353               dir = LEFT;
1354               physic.set_velocity_x(-fabsf(physic.get_velocity_x()));
1355             }
1356
1357           }
1358       }
1359       
1360       break;
1361
1362     case CO_PLAYER:
1363       Player* player = static_cast<Player*>(p_c_object);
1364       /* Get kicked if were flat */
1365       if (mode == FLAT && !dying)
1366       {
1367         SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos());
1368
1369         // Hit from left side
1370         if (player->base.x < base.x) {
1371           physic.set_velocity_x(5);
1372           dir = RIGHT;
1373         }
1374         // Hit from right side
1375         else {
1376           physic.set_velocity_x(-5);
1377           dir = LEFT;
1378         }
1379
1380         mode = KICK;
1381         player->kick_timer.start(KICKING_TIME);
1382         set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
1383       }
1384       break;
1385
1386     }
1387 }
1388
1389
1390 //---------------------------------------------------------------------------
1391
1392 void load_badguy_gfx()
1393 {
1394   img_mriceblock_flat_left = sprite_manager->load("mriceblock-flat-left");
1395   img_mriceblock_flat_right = sprite_manager->load("mriceblock-flat-right");
1396   img_mriceblock_falling_left = sprite_manager->load("mriceblock-falling-left");
1397   img_mriceblock_falling_right = sprite_manager->load("mriceblock-falling-right");
1398   img_mriceblock_left = sprite_manager->load("mriceblock-left");
1399   img_mriceblock_right = sprite_manager->load("mriceblock-right");
1400   img_jumpy_left_up = sprite_manager->load("jumpy-left-up");
1401   img_jumpy_left_down = sprite_manager->load("jumpy-left-down");
1402   img_jumpy_left_middle = sprite_manager->load("jumpy-left-middle");
1403   img_jumpy_left_iced = sprite_manager->load("jumpy-left-iced");
1404   img_mrbomb_left = sprite_manager->load("mrbomb-left");
1405   img_mrbomb_right = sprite_manager->load("mrbomb-right");
1406   img_mrbomb_iced_left = sprite_manager->load("mrbomb-iced-left");
1407   img_mrbomb_iced_right = sprite_manager->load("mrbomb-iced-right");
1408   img_mrbomb_ticking_left = sprite_manager->load("mrbomb-ticking-left");
1409   img_mrbomb_ticking_right = sprite_manager->load("mrbomb-ticking-right");
1410   img_mrbomb_explosion = sprite_manager->load("mrbomb-explosion");
1411   img_stalactite = sprite_manager->load("stalactite");
1412   img_stalactite_broken = sprite_manager->load("stalactite-broken");
1413   img_flame = sprite_manager->load("flame");
1414   img_fish = sprite_manager->load("fish");
1415   img_fish_down = sprite_manager->load("fish-down");
1416   img_fish_iced = sprite_manager->load("fish-iced");
1417   img_fish_iced_down = sprite_manager->load("fish-iced-down");
1418   img_flamefish = sprite_manager->load("flamefish");
1419   img_flamefish_down = sprite_manager->load("flamefish-down");
1420   img_bouncingsnowball_left = sprite_manager->load("bouncingsnowball-left");
1421   img_bouncingsnowball_right = sprite_manager->load("bouncingsnowball-right");
1422   img_bouncingsnowball_squished = sprite_manager->load("bouncingsnowball-squished");
1423   img_flyingsnowball = sprite_manager->load("flyingsnowball");
1424   img_flyingsnowball_squished = sprite_manager->load("flyingsnowball-squished");
1425   img_spiky_left = sprite_manager->load("spiky-left");
1426   img_spiky_right = sprite_manager->load("spiky-right");
1427   img_spiky_iced_left = sprite_manager->load("spiky-iced-left");
1428   img_spiky_iced_right = sprite_manager->load("spiky-iced-right");
1429   img_snowball_left = sprite_manager->load("snowball-left");
1430   img_snowball_right = sprite_manager->load("snowball-right");
1431   img_snowball_squished_left = sprite_manager->load("snowball-squished-left");
1432   img_snowball_squished_right = sprite_manager->load("snowball-squished-right");
1433   img_wingling_left = sprite_manager->load("wingling-left");
1434   img_walkingtree_left = sprite_manager->load("walkingtree-left");
1435   img_walkingtree_left_small = sprite_manager->load("walkingtree-left-small");
1436 }
1437
1438 void free_badguy_gfx()
1439 {
1440 }
1441
1442 // EOF //