converted player to new object system
[supertux.git] / src / world.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 Ingo Ruhnke <grumbel@gmx.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 <math.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include "globals.h"
28 #include "scene.h"
29 #include "screen.h"
30 #include "defines.h"
31 #include "world.h"
32 #include "level.h"
33 #include "tile.h"
34 #include "resources.h"
35 #include "gameobjs.h"
36 #include "viewport.h"
37 #include "display_manager.h"
38 #include "background.h"
39 #include "tilemap.h"
40
41 Surface* img_distro[4];
42
43 World* World::current_ = 0;
44
45 World::World(const std::string& filename)
46 {
47   // FIXME: Move this to action and draw and everywhere else where the
48   // world calls child functions
49   current_ = this;
50
51   level = new Level(filename);
52
53   tux = new Player(displaymanager);
54   gameobjects.push_back(tux);
55
56   set_defaults();
57
58   get_level()->load_gfx();
59   activate_bad_guys();
60   // add background
61   activate_particle_systems();
62   Background* bg = new Background(displaymanager);
63   if(level->img_bkgd) {
64     bg->set_image(level->img_bkgd, level->bkgd_speed);
65   } else {
66     bg->set_gradient(level->bkgd_top, level->bkgd_bottom);
67   }
68   gameobjects.push_back(bg);
69
70   // add tilemap
71   gameobjects.push_back(new TileMap(displaymanager, get_level()));
72   activate_objects();
73   get_level()->load_song();
74
75   apply_bonuses();
76
77   scrolling_timer.init(true);
78 }
79
80 World::World(const std::string& subset, int level_nr)
81 {
82   // FIXME: Move this to action and draw and everywhere else where the
83   // world calls child functions
84   current_ = this;
85
86   level = new Level(subset, level_nr);
87   tux->init();
88
89   set_defaults();
90
91   get_level()->load_gfx();
92   activate_bad_guys();
93   activate_objects();
94   activate_particle_systems();
95   Background* bg = new Background(displaymanager);
96   if(level->img_bkgd) {
97     bg->set_image(level->img_bkgd, level->bkgd_speed);
98   } else {
99     bg->set_gradient(level->bkgd_top, level->bkgd_bottom);
100   }
101   gameobjects.push_back(bg);
102   // add tilemap
103   gameobjects.push_back(new TileMap(displaymanager, get_level()));  
104   get_level()->load_song();
105
106   apply_bonuses();
107
108   scrolling_timer.init(true);
109 }
110
111 void
112 World::apply_bonuses()
113 {
114 #if 0
115   // Apply bonuses from former levels
116   switch (player_status.bonus)
117     {
118     case PlayerStatus::NO_BONUS:
119       break;
120
121     case PlayerStatus::FLOWER_BONUS:
122       tux->got_power = tux.FIRE_POWER;  // FIXME: add ice power to here
123       // fall through
124
125     case PlayerStatus::GROWUP_BONUS:
126       // FIXME: Move this to Player class
127       tux->size = BIG;
128       tux->base.height = 64;
129       tux->base.y -= 32;
130       break;
131     }
132 #endif
133 }
134
135 World::~World()
136 {
137   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
138     delete *i;
139
140   for (Trampolines::iterator i = trampolines.begin(); i != trampolines.end(); ++i)
141     delete *i;
142
143   for (std::vector<_GameObject*>::iterator i = gameobjects.begin();
144           i != gameobjects.end(); ++i) {
145     Drawable* drawable = dynamic_cast<Drawable*> (*i);
146     if(drawable)
147       displaymanager.remove_drawable(drawable);
148     delete *i;
149   }
150
151   delete level;
152 }
153
154 void
155 World::set_defaults()
156 {
157   // Set defaults: 
158   scroll_x = 0;
159
160   player_status.score_multiplier = 1;
161
162   counting_distros = false;
163   distro_counter = 0;
164
165   /* set current song/music */
166   currentmusic = LEVEL_MUSIC;
167 }
168
169 void
170 World::activate_bad_guys()
171 {
172   for (std::vector<BadGuyData>::iterator i = level->badguy_data.begin();
173        i != level->badguy_data.end();
174        ++i)
175     {
176       add_bad_guy(i->x, i->y, i->kind, i->stay_on_platform);
177     }
178 }
179
180 void
181 World::activate_objects()
182 {
183   for (std::vector< ObjectData<TrampolineData> >::iterator i = level->trampoline_data.begin();
184        i != level->trampoline_data.end();
185        ++i)
186   {
187     add_object<Trampoline, ObjectData<TrampolineData> >(*i);
188   }
189 }
190
191 void
192 World::activate_particle_systems()
193 {
194   if (level->particle_system == "clouds")
195     {
196       gameobjects.push_back(new CloudParticleSystem(displaymanager));
197     }
198   else if (level->particle_system == "snow")
199     {
200       gameobjects.push_back(new SnowParticleSystem(displaymanager));
201     }
202   else if (level->particle_system != "")
203     {
204       st_abort("unknown particle system specified in level", "");
205     }
206 }
207
208 void
209 World::draw()
210 {
211   /* Draw objects */
212   displaymanager.get_viewport().set_translation(Vector(scroll_x, scroll_y));
213   displaymanager.draw();
214   
215   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
216     (*i)->draw();
217
218   for (Trampolines::iterator i = trampolines.begin(); i != trampolines.end(); ++i)
219     (*i)->draw();
220
221   for (unsigned int i = 0; i < bullets.size(); ++i)
222     bullets[i].draw();
223
224   for (unsigned int i = 0; i < upgrades.size(); ++i)
225     upgrades[i].draw();
226 }
227
228 void
229 World::action(double frame_ratio)
230 {
231   tux->check_bounds(level->back_scrolling, (bool)level->hor_autoscroll_speed);
232   scrolling(frame_ratio);
233
234   for (unsigned int i = 0; i < bullets.size(); ++i)
235     bullets[i].action(frame_ratio);
236   
237   for (unsigned int i = 0; i < upgrades.size(); i++)
238     upgrades[i].action(frame_ratio);
239
240   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
241     (*i)->action(frame_ratio);
242
243   for (Trampolines::iterator i = trampolines.begin(); i != trampolines.end(); ++i)
244      (*i)->action(frame_ratio);
245
246   /* update objects (don't use iterators here, because the list might change
247    * during the iteration)
248    */
249   for(size_t i = 0; i < gameobjects.size(); ++i)
250     gameobjects[i]->action(frame_ratio);
251
252   /* Handle all possible collisions. */
253   collision_handler();
254   
255   // Cleanup marked badguys
256   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end();
257       /* ++i handled at end of the loop */) {
258     if ((*i)->is_removable()) {
259       delete *i;
260       i =  bad_guys.erase(i);
261     } else {
262       ++i;
263     }
264   }
265
266   for(std::vector<_GameObject*>::iterator i = gameobjects.begin();
267       i != gameobjects.end(); /* nothing */) {
268     if((*i)->is_valid() == false) {
269       Drawable* drawable = dynamic_cast<Drawable*> (*i);
270       if(drawable)
271         displaymanager.remove_drawable(drawable);
272       
273       delete *i;
274       i = gameobjects.erase(i);
275     } else {
276       ++i;
277     }
278   }
279 }
280
281 /* the space that it takes for the screen to start scrolling, regarding */
282 /* screen bounds (in pixels) */
283 // should be higher than screen->w/2 (400)
284 #define X_SPACE (500-16)
285 // should be less than screen->h/2 (300)
286 #define Y_SPACE 250
287
288 // the time it takes to move the camera (in ms)
289 #define CHANGE_DIR_SCROLL_SPEED 2000
290
291 /* This functions takes cares of the scrolling */
292 void World::scrolling(double frame_ratio)
293 {
294   /* Y-axis scrolling */
295
296   float tux_pos_y = tux->base.y + (tux->base.height/2);
297
298   if(level->height > VISIBLE_TILES_Y-1 && !tux->dying)
299     {
300     if (scroll_y < tux_pos_y - (screen->h - Y_SPACE))
301       scroll_y = tux_pos_y - (screen->h - Y_SPACE);
302     else if (scroll_y > tux_pos_y - Y_SPACE)
303       scroll_y = tux_pos_y - Y_SPACE;
304     }
305
306   // this code prevent the screen to scroll before the start or after the level's end
307   if(scroll_y > level->height * 32 - screen->h)
308     scroll_y = level->height * 32 - screen->h;
309   if(scroll_y < 0)
310     scroll_y = 0;
311
312   /* X-axis scrolling */
313
314   /* Auto scrolling */
315   if(level->hor_autoscroll_speed)
316   {
317     scroll_x += level->hor_autoscroll_speed * frame_ratio;
318     return;
319   }
320
321
322   /* Horizontal backscrolling */
323   float tux_pos_x = tux->base.x + (tux->base.width/2);
324
325   if(tux->old_dir != tux->dir && level->back_scrolling)
326     scrolling_timer.start(CHANGE_DIR_SCROLL_SPEED);
327
328   bool right = false;
329   bool left = false;
330   if (tux->physic.get_velocity_x() > 0)
331     right = true;
332   else if (tux->physic.get_velocity_x() < 0)
333     left = true;
334   else
335     {
336     if (tux->dir == RIGHT)
337       right = true;
338     else
339       left = true;
340     }
341
342   if(scrolling_timer.check())
343   {
344     float final_scroll_x;
345     float constant1;
346     float constant2;
347     if (right)
348       final_scroll_x = tux_pos_x - (screen->w - X_SPACE);
349     else
350       final_scroll_x = tux_pos_x - X_SPACE;
351
352     if((tux->physic.get_velocity_x() > 0 && tux->dir == RIGHT)
353         || (tux->physic.get_velocity_x() < 0 && tux->dir == LEFT))
354     {
355       constant1 = 1.0;
356       constant2 = .4;
357     }
358     else
359     {
360       constant1 = 0.;
361       constant2 = 0.;
362     }
363     
364     float number = 2.5/(frame_ratio * CHANGE_DIR_SCROLL_SPEED/1000)*exp((CHANGE_DIR_SCROLL_SPEED-scrolling_timer.get_left())/1400.);
365     if(left) number *= -1.;
366
367     scroll_x += number
368             + constant1 * tux->physic.get_velocity_x() * frame_ratio
369             + constant2 * tux->physic.get_acceleration_x() * frame_ratio * frame_ratio;
370
371     if ((right && final_scroll_x - scroll_x < 0) || (left && final_scroll_x - scroll_x > 0))
372       scroll_x = final_scroll_x;
373     
374   }
375   else
376   {
377     if (right && scroll_x < tux_pos_x - (screen->w - X_SPACE))
378       scroll_x = tux_pos_x - (screen->w - X_SPACE);
379     else if (left && scroll_x > tux_pos_x - X_SPACE && level->back_scrolling)
380       scroll_x = tux_pos_x - X_SPACE;
381   }
382
383   // this code prevent the screen to scroll before the start or after the level's end
384   if(scroll_x > level->width * 32 - screen->w)
385     scroll_x = level->width * 32 - screen->w;
386   if(scroll_x < 0)
387     scroll_x = 0;
388 }
389
390 void
391 World::collision_handler()
392 {
393   // CO_BULLET & CO_BADGUY check
394   for(unsigned int i = 0; i < bullets.size(); ++i)
395     {
396       for (BadGuys::iterator j = bad_guys.begin(); j != bad_guys.end(); ++j)
397         {
398           if((*j)->dying != DYING_NOT)
399             continue;
400           
401           if(rectcollision(bullets[i].base, (*j)->base))
402             {
403               // We have detected a collision and now call the
404               // collision functions of the collided objects.
405               // collide with bad_guy first, since bullet_collision will
406               // delete the bullet
407               (*j)->collision(&bullets[i], CO_BULLET);
408               bullets[i].collision(CO_BADGUY);
409               break; // bullet is invalid now, so break
410             }
411         }
412     }
413
414   /* CO_BADGUY & CO_BADGUY check */
415   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
416     {
417       if((*i)->dying != DYING_NOT)
418         continue;
419       
420       BadGuys::iterator j = i;
421       ++j;
422       for (; j != bad_guys.end(); ++j)
423         {
424           if(j == i || (*j)->dying != DYING_NOT)
425             continue;
426
427           if(rectcollision((*i)->base, (*j)->base))
428             {
429               // We have detected a collision and now call the
430               // collision functions of the collided objects.
431               (*j)->collision(*i, CO_BADGUY);
432               (*i)->collision(*j, CO_BADGUY);
433             }
434         }
435     }
436
437   if(tux->dying != DYING_NOT) return;
438     
439   // CO_BADGUY & CO_PLAYER check 
440   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
441     {
442       if((*i)->dying != DYING_NOT)
443         continue;
444       
445       if(rectcollision_offset((*i)->base, tux->base, 0, 0))
446         {
447           // We have detected a collision and now call the collision
448           // functions of the collided objects.
449           if (tux->previous_base.y < tux->base.y &&
450               tux->previous_base.y + tux->previous_base.height 
451               < (*i)->base.y + (*i)->base.height/2
452               && !tux->invincible_timer.started())
453             {
454               (*i)->collision(tux, CO_PLAYER, COLLISION_SQUISH);
455             }
456           else
457             {
458               tux->collision(*i, CO_BADGUY);
459               (*i)->collision(tux, CO_PLAYER, COLLISION_NORMAL);
460             }
461         }
462     }
463
464   // CO_UPGRADE & CO_PLAYER check
465   for(unsigned int i = 0; i < upgrades.size(); ++i)
466     {
467       if(rectcollision(upgrades[i].base, tux->base))
468         {
469           // We have detected a collision and now call the collision
470           // functions of the collided objects.
471           upgrades[i].collision(tux, CO_PLAYER, COLLISION_NORMAL);
472         }
473     }
474
475   // CO_TRAMPOLINE & (CO_PLAYER or CO_BADGUY)
476   for (Trampolines::iterator i = trampolines.begin(); i != trampolines.end(); ++i)
477   {
478     if (rectcollision((*i)->base, tux->base))
479     {
480       if (tux->previous_base.y < tux->base.y &&
481           tux->previous_base.y + tux->previous_base.height 
482           < (*i)->base.y + (*i)->base.height/2)
483       {
484         (*i)->collision(tux, CO_PLAYER, COLLISION_SQUISH);
485       }
486       else if (tux->previous_base.y <= tux->base.y)
487       {
488         tux->collision(*i, CO_TRAMPOLINE);
489         (*i)->collision(tux, CO_PLAYER, COLLISION_NORMAL);
490       }
491     }
492   }
493 }
494
495 void
496 World::add_score(const Vector& pos, int s)
497 {
498   player_status.score += s;
499
500   gameobjects.push_back(new FloatingScore(displaymanager, pos, s));
501 }
502
503 void
504 World::add_bouncy_distro(const Vector& pos)
505 {
506   gameobjects.push_back(new BouncyDistro(displaymanager, pos));
507 }
508
509 void
510 World::add_broken_brick(const Vector& pos, Tile* tile)
511 {
512   add_broken_brick_piece(pos, Vector(-1, -4), tile);
513   add_broken_brick_piece(pos + Vector(0, 16), Vector(-1.5, -3), tile);
514
515   add_broken_brick_piece(pos + Vector(16, 0), Vector(1, -4), tile);
516   add_broken_brick_piece(pos + Vector(16, 16), Vector(1.5, -3), tile);
517 }
518
519 void
520 World::add_broken_brick_piece(const Vector& pos, const Vector& movement,
521     Tile* tile)
522 {
523   gameobjects.push_back(new BrokenBrick(displaymanager, tile, pos, movement));
524 }
525
526 void
527 World::add_bouncy_brick(const Vector& pos)
528 {
529   gameobjects.push_back(new BouncyBrick(displaymanager, pos));
530 }
531
532 BadGuy*
533 World::add_bad_guy(float x, float y, BadGuyKind kind, bool stay_on_platform)
534 {
535   BadGuy* badguy = new BadGuy(x,y,kind, stay_on_platform);
536   bad_guys.push_back(badguy);
537   return badguy;
538 }
539
540 template<class T, class U>
541 T*
542 World::add_object(U data)
543 {
544   T* tobject = new T(data);
545
546   if (data.type == OBJ_TRAMPOLINE)
547     trampolines.push_back(tobject);
548
549   return tobject;
550 }
551
552 void
553 World::add_upgrade(float x, float y, Direction dir, UpgradeKind kind)
554 {
555   Upgrade new_upgrade;
556   new_upgrade.init(x,y,dir,kind);
557   upgrades.push_back(new_upgrade);
558 }
559
560 void 
561 World::add_bullet(float x, float y, float xm, Direction dir)
562 {
563   if(tux->got_power == Player::FIRE_POWER)
564     {
565     if(bullets.size() > MAX_FIRE_BULLETS-1)
566       return;
567     }
568   else if(tux->got_power == Player::ICE_POWER)
569     {
570     if(bullets.size() > MAX_ICE_BULLETS-1)
571       return;
572     }
573
574   Bullet new_bullet;
575   if(tux->got_power == Player::FIRE_POWER)
576     new_bullet.init(x,y,xm,dir, FIRE_BULLET);
577   else if(tux->got_power == Player::ICE_POWER)
578     new_bullet.init(x,y,xm,dir, ICE_BULLET);
579   bullets.push_back(new_bullet);
580   
581   play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER);
582 }
583
584 void
585 World::play_music(int musictype)
586 {
587   currentmusic = musictype;
588   switch(currentmusic) {
589     case HURRYUP_MUSIC:
590       music_manager->play_music(get_level()->get_level_music_fast());
591       break;
592     case LEVEL_MUSIC:
593       music_manager->play_music(get_level()->get_level_music());
594       break;
595     case HERRING_MUSIC:
596       music_manager->play_music(herring_song);
597       break;
598     default:
599       music_manager->halt_music();
600       break;
601   }
602 }
603
604 int
605 World::get_music_type()
606 {
607   return currentmusic;
608 }
609
610 /* Break a brick: */
611 bool
612 World::trybreakbrick(float x, float y, bool small)
613 {
614   Level* plevel = get_level();
615   
616   Tile* tile = gettile(x, y);
617   if (tile->brick)
618     {
619       if (tile->data > 0)
620         {
621           /* Get a distro from it: */
622           add_bouncy_distro(
623               Vector(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32));
624
625           // TODO: don't handle this in a global way but per-tile...
626           if (!counting_distros)
627             {
628               counting_distros = true;
629               distro_counter = 5;
630             }
631           else
632             {
633               distro_counter--;
634             }
635
636           if (distro_counter <= 0)
637             {
638               counting_distros = false;
639               plevel->change(x, y, TM_IA, tile->next_tile);
640             }
641
642           play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
643           player_status.score = player_status.score + SCORE_DISTRO;
644           player_status.distros++;
645           return true;
646         }
647       else if (!small)
648         {
649           /* Get rid of it: */
650           plevel->change(x, y, TM_IA, tile->next_tile);
651           
652           /* Replace it with broken bits: */
653           add_broken_brick(Vector(
654                                  ((int)(x + 1) / 32) * 32,
655                                  (int)(y / 32) * 32), tile);
656           
657           /* Get some score: */
658           play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
659           player_status.score = player_status.score + SCORE_BRICK;
660           
661           return true;
662         }
663     }
664
665   return false;
666 }
667
668 /* Empty a box: */
669 void
670 World::tryemptybox(float x, float y, Direction col_side)
671 {
672   Tile* tile = gettile(x,y);
673   if (!tile->fullbox)
674     return;
675
676   // according to the collision side, set the upgrade direction
677   if(col_side == LEFT)
678     col_side = RIGHT;
679   else
680     col_side = LEFT;
681
682   int posx = ((int)(x+1) / 32) * 32;
683   int posy = (int)(y/32) * 32 - 32;
684   switch(tile->data)
685     {
686     case 1: // Box with a distro!
687       add_bouncy_distro(Vector(posx, posy));
688       play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
689       player_status.score = player_status.score + SCORE_DISTRO;
690       player_status.distros++;
691       break;
692
693     case 2: // Add a fire flower upgrade!
694       if (tux->size == SMALL)     /* Tux is small, add mints! */
695         add_upgrade(posx, posy, col_side, UPGRADE_GROWUP);
696       else     /* Tux is big, add a fireflower: */
697         add_upgrade(posx, posy, col_side, UPGRADE_FIREFLOWER);
698       play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER);
699       break;
700     
701     case 5: // Add an ice flower upgrade!
702       if (tux->size == SMALL)     /* Tux is small, add mints! */
703         add_upgrade(posx, posy, col_side, UPGRADE_GROWUP);
704       else     /* Tux is big, add an iceflower: */
705         add_upgrade(posx, posy, col_side, UPGRADE_ICEFLOWER);
706       play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER);
707       break;
708
709     case 3: // Add a golden herring
710       add_upgrade(posx, posy, col_side, UPGRADE_HERRING);
711       break;
712
713     case 4: // Add a 1up extra
714       add_upgrade(posx, posy, col_side, UPGRADE_1UP);
715       break;
716     default:
717       break;
718     }
719
720   /* Empty the box: */
721   level->change(x, y, TM_IA, tile->next_tile);
722 }
723
724 /* Try to grab a distro: */
725 void
726 World::trygrabdistro(float x, float y, int bounciness)
727 {
728   Tile* tile = gettile(x, y);
729   if (tile && tile->distro)
730     {
731       level->change(x, y, TM_IA, tile->next_tile);
732       play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
733
734       if (bounciness == BOUNCE)
735         {
736           add_bouncy_distro(Vector(((int)(x + 1) / 32) * 32,
737                                   (int)(y / 32) * 32));
738         }
739
740       player_status.score = player_status.score + SCORE_DISTRO;
741       player_status.distros++;
742     }
743 }
744
745 /* Try to bump a bad guy from below: */
746 void
747 World::trybumpbadguy(float x, float y)
748 {
749   // Bad guys: 
750   for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
751     {
752       if ((*i)->base.x >= x - 32 && (*i)->base.x <= x + 32 &&
753           (*i)->base.y >= y - 16 && (*i)->base.y <= y + 16)
754         {
755           (*i)->collision(tux, CO_PLAYER, COLLISION_BUMP);
756         }
757     }
758
759   // Upgrades:
760   for (unsigned int i = 0; i < upgrades.size(); i++)
761     {
762       if (upgrades[i].base.height == 32 &&
763           upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 &&
764           upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16)
765         {
766           upgrades[i].collision(tux, CO_PLAYER, COLLISION_BUMP);
767         }
768     }
769 }
770
771 /* EOF */
772