- turned LEFT/RIGHT defines into enum, turned BadGuyModes into enum
[supertux.git] / src / player.cpp
1 //  $Id$
2 //
3 //  SuperTux -  A Jump'n Run
4 //  Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 #include <math.h>
21
22 #include "gameloop.h"
23 #include "globals.h"
24 #include "player.h"
25 #include "defines.h"
26 #include "scene.h"
27 #include "tile.h"
28 #include "sprite.h"
29 #include "screen.h"
30
31 Surface* tux_life;
32 std::vector<Surface*> tux_right;
33 std::vector<Surface*> tux_left;
34 Surface* smalltux_jump_left;
35 Surface* smalltux_jump_right;
36 Surface* smalltux_stand_left;
37 Surface* smalltux_stand_right;
38
39 Sprite* bigtux_right;
40 Sprite* bigtux_left;
41 Sprite* bigtux_right_jump;
42 Sprite* bigtux_left_jump;
43 Sprite* ducktux_right;
44 Sprite* ducktux_left;
45 Surface* skidtux_right;
46 Surface* skidtux_left;
47 Surface* firetux_right[3];
48 Surface* firetux_left[3];
49 Surface* bigfiretux_right[3];
50 Surface* bigfiretux_left[3];
51 Surface* bigfiretux_right_jump;
52 Surface* bigfiretux_left_jump;
53 Surface* duckfiretux_right;
54 Surface* duckfiretux_left;
55 Surface* skidfiretux_right;
56 Surface* skidfiretux_left;
57 Surface* cape_right[2];
58 Surface* cape_left[2];
59 Surface* bigcape_right[2];
60 Surface* bigcape_left[2];
61
62 PlayerKeymap keymap;
63
64 PlayerKeymap::PlayerKeymap()
65 {
66   keymap.jump  = SDLK_UP;
67   keymap.duck  = SDLK_DOWN;
68   keymap.left  = SDLK_LEFT;
69   keymap.right = SDLK_RIGHT;
70   keymap.fire  = SDLK_LCTRL;
71 }
72
73 void player_input_init(player_input_type* pplayer_input)
74 {
75   pplayer_input->down = UP;
76   pplayer_input->fire = UP;
77   pplayer_input->left = UP;
78   pplayer_input->old_fire = UP;
79   pplayer_input->right = UP;
80   pplayer_input->up = UP;
81 }
82
83 void
84 Player::init()
85 {
86   Level* plevel = World::current()->get_level();
87
88   base.width = 32;
89   base.height = 32;
90
91   size = SMALL;
92   got_coffee = false;
93
94   base.x = plevel->start_pos_x;
95   base.y = plevel->start_pos_y;
96   base.xm = 0;
97   base.ym = 0;
98   previous_base = old_base = base;
99   dir = RIGHT;
100   duck = false;
101
102   dying   = DYING_NOT;
103   jumping = false;
104
105   frame_main = 0;
106   frame_ = 0;
107   
108   player_input_init(&input);
109
110   invincible_timer.init(true);
111   skidding_timer.init(true);
112   safe_timer.init(true);
113   frame_timer.init(true);
114
115   physic.reset();
116 }
117
118 int
119 Player::key_event(SDLKey key, int state)
120 {
121   if(key == keymap.right)
122     {
123       input.right = state;
124       return true;
125     }
126   else if(key == keymap.left)
127     {
128       input.left = state;
129       return true;
130     }
131   else if(key == keymap.jump)
132     {
133       input.up = state;
134       return true;
135     }
136   else if(key == keymap.duck)
137     {
138       input.down = state;
139       return true;
140     }
141   else if(key == keymap.fire)
142     {
143       input.fire = state;
144       return true;
145     }
146   else
147     return false;
148 }
149
150 void
151 Player::level_begin()
152 {
153   base.x  = 100;
154   base.y  = 170;
155   base.xm = 0;
156   base.ym = 0;
157   previous_base = old_base = base;
158   duck = false;
159
160   dying = DYING_NOT;
161
162   player_input_init(&input);
163
164   invincible_timer.init(true);
165   skidding_timer.init(true);
166   safe_timer.init(true);
167   frame_timer.init(true);
168
169   physic.reset();
170 }
171
172 void
173 Player::action(double frame_ratio)
174 {
175   bool jumped_in_solid = false;
176
177   /* --- HANDLE TUX! --- */
178
179   if(dying == DYING_NOT)
180     handle_input();
181
182   /* Move tux: */
183   previous_base = base;
184
185   physic.apply(frame_ratio, base.x, base.y);
186   if(dying == DYING_NOT) 
187     {
188       base_type target = base;
189
190       collision_swept_object_map(&old_base, &base);
191
192       // Don't accelerate Tux if he is running against a wall
193       if (target.x != base.x)
194         {
195           physic.set_velocity_x(0);
196         }
197
198       // special exception for cases where we're stuck under tiles after
199       // being ducked. In this case we drift out
200       if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y
201          && collision_object_map(&base)) {
202         base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1);
203         previous_base = old_base = base;
204       }
205       keep_in_bounds();
206     }
207
208   if (dying == DYING_NOT)
209     {
210       /* Land: */
211
212
213       if( !on_ground())
214         {
215           physic.enable_gravity(true);
216           if(under_solid())
217             {
218               // fall down
219               physic.set_velocity_y(0);
220               jumped_in_solid = true;
221             }
222         }
223       else
224         {
225           /* Land: */
226           if (physic.get_velocity_y() < 0)
227             {
228               base.y = (int)(((int)base.y / 32) * 32);
229               physic.set_velocity_y(0);
230             }
231
232           physic.enable_gravity(false);
233           /* Reset score multiplier (for multi-hits): */
234           player_status.score_multiplier = 1;
235         }
236
237       if(jumped_in_solid)
238         {
239           if (isbrick(base.x, base.y) ||
240               isfullbox(base.x, base.y))
241             {
242               World::current()->trygrabdistro(base.x, base.y - 32,BOUNCE);
243               World::current()->trybumpbadguy(base.x, base.y - 64);
244
245               World::current()->trybreakbrick(base.x, base.y, size == SMALL);
246
247               bumpbrick(base.x, base.y);
248               World::current()->tryemptybox(base.x, base.y, RIGHT);
249             }
250
251           if (isbrick(base.x+ 31, base.y) ||
252               isfullbox(base.x+ 31, base.y))
253             {
254               World::current()->trygrabdistro(base.x+ 31, base.y - 32,BOUNCE);
255               World::current()->trybumpbadguy(base.x+ 31, base.y - 64);
256
257               if(size == BIG)
258                 World::current()->trybreakbrick(base.x+ 31, base.y, size == SMALL);
259
260               bumpbrick(base.x+ 31, base.y);
261               World::current()->tryemptybox(base.x+ 31, base.y, LEFT);
262             }
263         }
264
265       grabdistros();
266
267       if (jumped_in_solid)
268         {
269           ++base.y;
270           ++old_base.y;
271           if(on_ground())
272             {
273               /* Make sure jumping is off. */
274               jumping = false;
275             }
276         }
277     }
278
279
280   /* ---- DONE HANDLING TUX! --- */
281
282   /* Handle invincibility timer: */
283   if (get_current_music() == HERRING_MUSIC && !invincible_timer.check())
284     {
285       /*
286         no, we are no more invincible
287         or we were not in invincible mode
288         but are we in hurry ?
289       */
290
291       // FIXME: Move this to gamesession
292       if (GameSession::current()->time_left.get_left() < TIME_WARNING)
293         {
294           /* yes, we are in hurry
295              stop the herring_song, prepare to play the correct
296              fast level_song !
297           */
298           set_current_music(HURRYUP_MUSIC);
299         }
300       else
301         {
302           set_current_music(LEVEL_MUSIC);
303         }
304
305       /* start playing it */
306       play_current_music();
307     }
308
309   // check some timers
310   skidding_timer.check();
311   invincible_timer.check();
312   safe_timer.check();
313 }
314
315 bool
316 Player::on_ground()
317 {
318   return ( issolid(base.x + base.width / 2, base.y + base.height) ||
319            issolid(base.x + 1, base.y + base.height) ||
320            issolid(base.x + base.width - 1, base.y + base.height)  );
321 }
322
323 bool
324 Player::under_solid()
325 {
326   return ( issolid(base.x + base.width / 2, base.y) ||
327            issolid(base.x + 1, base.y) ||
328            issolid(base.x + base.width - 1, base.y)  );
329 }
330
331 void
332 Player::handle_horizontal_input()
333 {
334   float vx = physic.get_velocity_x();
335   float vy = physic.get_velocity_y();
336   float ax = physic.get_acceleration_x();
337   float ay = physic.get_acceleration_y();
338
339   float dirsign = 0;
340   if(input.left == DOWN && input.right == UP && (!duck || physic.get_velocity_y() != 0)) {
341       dir = LEFT;
342       dirsign = -1;
343   } else if(input.left == UP && input.right == DOWN && (!duck || physic.get_velocity_y() != 0)) {
344       dir = RIGHT;
345       dirsign = 1;
346   }
347
348   if (input.fire == UP) {
349       ax = dirsign * WALK_ACCELERATION_X;
350       // limit speed
351       if(vx >= MAX_WALK_XM && dirsign > 0) {
352         vx = MAX_WALK_XM;
353         ax = 0;
354       } else if(vx <= -MAX_WALK_XM && dirsign < 0) {
355         vx = -MAX_WALK_XM;
356         ax = 0;
357       }
358   } else {
359       ax = dirsign * RUN_ACCELERATION_X;
360       // limit speed
361       if(vx >= MAX_RUN_XM && dirsign > 0) {
362         vx = MAX_RUN_XM;
363         ax = 0;
364       } else if(vx <= -MAX_RUN_XM && dirsign < 0) {
365         vx = -MAX_RUN_XM;
366         ax = 0;
367       }
368   }
369
370   // we can reach WALK_SPEED without any acceleration
371   if(dirsign != 0 && fabs(vx) < WALK_SPEED) {
372     vx = dirsign * WALK_SPEED;
373   }
374
375   // changing directions?
376   if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) {
377       if(fabs(vx)>SKID_XM && !skidding_timer.check()) {
378           skidding_timer.start(SKID_TIME);
379           play_sound(sounds[SND_SKID], SOUND_CENTER_SPEAKER);
380           ax *= 2.5;
381       } else {
382           ax *= 2;
383       }
384   }
385
386   // we get slower when not pressing any keys
387   if(dirsign == 0) {
388       if(fabs(vx) < WALK_SPEED) {
389           vx = 0;
390           ax = 0;
391       } else if(vx < 0) {
392           ax = WALK_ACCELERATION_X * 1.5;
393       } else {
394           ax = WALK_ACCELERATION_X * -1.5;
395       }
396   }
397
398   // if we're on ice slow down acceleration or deceleration
399   if (isice(base.x, base.y + base.height))
400   {
401     /* the acceleration/deceleration rate on ice is inversely proportional to
402      * the current velocity.
403      */
404
405     // increasing 1 will increase acceleration/deceleration rate
406     // decreasing 1 will decrease acceleration/deceleration rate
407     //  must stay above zero, though
408     if (ax != 0) ax *= 1 / fabs(vx);
409   }
410
411   physic.set_velocity(vx, vy);
412   physic.set_acceleration(ax, ay);
413 }
414
415 void
416 Player::handle_vertical_input()
417 {
418   if(input.up == DOWN)
419     {
420       if (on_ground())
421         {
422           // jump
423           if (physic.get_velocity_x() > MAX_WALK_XM)
424             physic.set_velocity_y(5.8);
425           else
426             physic.set_velocity_y(5.2);
427
428           --base.y;
429           jumping = true;
430           if (size == SMALL)
431             play_sound(sounds[SND_JUMP], SOUND_CENTER_SPEAKER);
432           else
433             play_sound(sounds[SND_BIGJUMP], SOUND_CENTER_SPEAKER);
434         }
435     }
436   else if(input.up == UP && jumping)
437     {
438       jumping = false;
439       if(physic.get_velocity_y() > 0) {
440         physic.set_velocity_y(0);
441       }
442     }
443 }
444
445 void
446 Player::handle_input()
447 {
448   /* Handle horizontal movement: */
449     handle_horizontal_input();
450
451   /* Jump/jumping? */
452
453   if ( input.up == DOWN || (input.up == UP && jumping))
454     {
455       handle_vertical_input();
456     }
457
458   /* Shoot! */
459
460   if (input.fire == DOWN && input.old_fire == UP && got_coffee)
461     {
462       World::current()->add_bullet(base.x, base.y, physic.get_velocity_x(), dir);
463     }
464
465   /* tux animations: */
466   if(!frame_timer.check())
467     {
468       frame_timer.start(25);
469       if (input.right == UP && input.left == UP)
470         {
471           frame_main = 1;
472           frame_ = 1;
473         }
474       else
475         {
476           if ((input.fire == DOWN && (global_frame_counter % 2) == 0) ||
477               (global_frame_counter % 4) == 0)
478             frame_main = (frame_main + 1) % 4;
479
480           frame_ = frame_main;
481
482           if (frame_ == 3)
483             frame_ = 1;
484         }
485     }
486
487   /* Duck! */
488   if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0)
489     {
490       duck = true;
491       base.height = 32;                             
492       base.y += 32;
493       // changing base size confuses collision otherwise
494       old_base = previous_base = base;
495     }
496   else if(input.down == UP && size == BIG && duck && physic.get_velocity_y() == 0)
497     {
498       duck = false;
499       base.y -= 32;
500       base.height = 64;
501       old_base = previous_base = base;
502     }
503 }
504
505 void
506 Player::grabdistros()
507 {
508   /* Grab distros: */
509   if (!dying)
510     {
511       World::current()->trygrabdistro(base.x, base.y, NO_BOUNCE);
512       World::current()->trygrabdistro(base.x+ 31, base.y, NO_BOUNCE);
513
514       World::current()->trygrabdistro(base.x, base.y + base.height, NO_BOUNCE);
515       World::current()->trygrabdistro(base.x+ 31, base.y + base.height, NO_BOUNCE);
516
517       if(size == BIG)
518         {
519           World::current()->trygrabdistro(base.x, base.y + base.height / 2, NO_BOUNCE);
520           World::current()->trygrabdistro(base.x+ 31, base.y + base.height / 2, NO_BOUNCE);
521         }
522
523     }
524
525   /* Enough distros for a One-up? */
526   if (player_status.distros >= DISTROS_LIFEUP)
527     {
528       player_status.distros = player_status.distros - DISTROS_LIFEUP;
529       if(player_status.lives < MAX_LIVES)
530         ++player_status.lives;
531       /*We want to hear the sound even, if MAX_LIVES is reached*/
532       play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER);
533     }
534 }
535
536 void
537 Player::draw()
538 {
539   if (!safe_timer.started() || (global_frame_counter % 2) == 0)
540     {
541       if (size == SMALL)
542         {
543           if (invincible_timer.started())
544             {
545               /* Draw cape: */
546
547               if (dir == RIGHT)
548                 cape_right[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
549               else
550                 cape_left[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
551             }
552
553
554           if (!got_coffee)
555             {
556               if (physic.get_velocity_y() != 0)
557                 {
558                   if (dir == RIGHT)
559                     smalltux_jump_right->draw( base.x - scroll_x, base.y - 10);
560                   else
561                     smalltux_jump_left->draw( base.x - scroll_x, base.y - 10);                   
562                 }
563               else
564                 {
565                   if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
566                     {
567                       if (dir == RIGHT)
568                         smalltux_stand_right->draw( base.x - scroll_x, base.y - 9);
569                       else
570                         smalltux_stand_left->draw( base.x - scroll_x, base.y - 9);
571                     }
572                   else // moving
573                     {
574                       if (dir == RIGHT)
575                         tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9);
576                       else
577                         tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9);
578                     }
579                 }
580             }
581           else
582             {
583               /* Tux got coffee! */
584
585               if (dir == RIGHT)
586                 {
587                   firetux_right[frame_]->draw( base.x- scroll_x, base.y);
588                 }
589               else
590                 {
591                   firetux_left[frame_]->draw( base.x- scroll_x, base.y);
592                 }
593             }
594         }
595       else
596         {
597           if (invincible_timer.started())
598             {
599               float capex = base.x + (base.width - bigcape_right[0]->w) / 2;
600               capex -= scroll_x;
601               float capey = base.y + (base.height - bigcape_right[0]->h) / 2;
602                 
603               /* Draw cape (just not in ducked mode since that looks silly): */
604               if (dir == RIGHT)
605                 bigcape_right[global_frame_counter % 2]->draw(capex, capey);
606               else
607                 bigcape_left[global_frame_counter % 2]->draw(capex, capey);
608             }
609
610           if (!got_coffee)
611             {
612               if (!duck)
613                 {
614                   if (!skidding_timer.started())
615                     {
616                       if (physic.get_velocity_y() == 0)
617                         {
618                           if (dir == RIGHT)
619                             bigtux_right->draw(base.x - scroll_x, base.y);
620                           else
621                             bigtux_left->draw(base.x - scroll_x, base.y);
622                         }
623                       else
624                         {
625                           if (dir == RIGHT)
626                             bigtux_right_jump->draw(base.x - scroll_x, base.y);
627                           else
628                             bigtux_left_jump->draw(base.x - scroll_x, base.y);
629                         }
630                     }
631                   else
632                     {
633                       if (dir == RIGHT)
634                         skidtux_right->draw(base.x - scroll_x - 8, base.y);
635                       else
636                         skidtux_left->draw(base.x - scroll_x - 8, base.y);
637                     }
638                 }
639               else
640                 {
641                   if (dir == RIGHT)
642                     ducktux_right->draw(base.x - scroll_x, base.y);
643                   else
644                     ducktux_left->draw(base.x - scroll_x, base.y);
645                 }
646             }
647           else
648             {
649               /* Tux has coffee! */
650               if (!duck)
651                 {
652                   if (!skidding_timer.started())
653                     {
654                       if (!jumping || physic.get_velocity_y() > 0)
655                         {
656                           if (dir == RIGHT)
657                             bigfiretux_right[frame_]->draw(base.x- scroll_x - 8, base.y);
658                           else
659                             bigfiretux_left[frame_]->draw(base.x- scroll_x - 8, base.y);
660                         }
661                       else
662                         {
663                           if (dir == RIGHT)
664                             bigfiretux_right_jump->draw(base.x- scroll_x - 8, base.y);
665                           else
666                             bigfiretux_left_jump->draw(base.x- scroll_x - 8, base.y);
667                         }
668                     }
669                   else
670                     {
671                       if (dir == RIGHT)
672                         skidfiretux_right->draw(base.x- scroll_x - 8, base.y);
673                       else
674                         skidfiretux_left->draw(base.x- scroll_x - 8, base.y);
675                     }
676                 }
677               else
678                 {
679                   if (dir == RIGHT)
680                     duckfiretux_right->draw( base.x- scroll_x - 8, base.y - 16);
681                   else
682                     duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16);
683                 }
684             }
685         }
686     }
687
688   if (debug_mode)
689     fillrect(base.x - scroll_x, base.y, 32, 32, 75,75,75, 150);
690 }
691
692 void
693 Player::collision(void* p_c_object, int c_object)
694 {
695   BadGuy* pbad_c = NULL;
696
697   switch (c_object)
698     {
699     case CO_BADGUY:
700       pbad_c = (BadGuy*) p_c_object;
701
702      /* Hurt player if he touches a badguy */
703       if (!pbad_c->dying && !dying &&
704           !safe_timer.started() &&
705           pbad_c->mode != BadGuy::HELD)
706         {
707           if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN)
708             {
709               pbad_c->mode = BadGuy::HELD;
710               pbad_c->base.y-=8;
711             }
712           else if (pbad_c->mode == BadGuy::FLAT)
713             {
714               // Don't get hurt if we're kicking a flat badguy!
715             }
716           else if (pbad_c->mode == BadGuy::KICK)
717             {
718               /* Hurt if you get hit by kicked laptop: */
719               if (!invincible_timer.started())
720                 {
721                   kill(SHRINK);
722                 }
723               else
724                 {
725                    pbad_c->dying = DYING_FALLING;
726                    play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
727                    World::current()->add_score(pbad_c->base.x - scroll_x,
728                                                pbad_c->base.y,
729                                                25 * player_status.score_multiplier);
730                 }
731             }
732           else
733             {
734               if (!invincible_timer.started())
735                 {
736                   kill(SHRINK);
737                 }
738               else
739                 {
740                   pbad_c->kill_me();
741                 }
742             }
743           player_status.score_multiplier++;
744         }
745       break;
746     default:
747       break;
748     }
749
750 }
751
752 /* Kill Player! */
753
754 void
755 Player::kill(int mode)
756 {
757   play_sound(sounds[SND_HURT], SOUND_CENTER_SPEAKER);
758
759   physic.set_velocity(0, physic.get_velocity_y());
760
761   if (mode == SHRINK && size == BIG)
762     {
763       if (got_coffee)
764         got_coffee = false;
765
766       size = SMALL;
767       base.height = 32;
768       duck = false;
769
770       safe_timer.start(TUX_SAFE_TIME);
771     }
772   else
773     {
774       physic.enable_gravity(true);
775       physic.set_acceleration(0, 0);
776       physic.set_velocity(0, 7);
777       dying = DYING_SQUISHED;
778     }
779 }
780
781 void
782 Player::is_dying()
783 {
784   remove_powerups();
785   dying = DYING_NOT;
786 }
787
788 bool Player::is_dead()
789 {
790   if(base.y > screen->h)
791     return true;
792   else
793     return false;
794 }
795
796 /* Remove Tux's power ups */
797 void
798 Player::remove_powerups()
799 {
800   got_coffee = false;
801   size = SMALL;
802   base.height = 32;
803 }
804
805 void
806 Player::keep_in_bounds()
807 {
808   Level* plevel = World::current()->get_level();
809
810   /* Keep tux in bounds: */
811   if (base.x < 0)
812     { // Lock Tux to the size of the level, so that he doesn't fall of
813       // on the left side
814       base.x = 0;
815     }
816   else if (base.x < scroll_x)
817     { 
818       base.x = scroll_x;
819     }
820
821   /* Keep in-bounds, vertically: */
822   if (base.y > screen->h)
823     {
824       kill(KILL);
825     }
826
827   int scroll_threshold = screen->w/2 - 80;
828   if (debug_mode)
829     {
830       scroll_x += screen->w/2;
831       // Backscrolling for debug mode
832       if (scroll_x < base.x - 80)
833         scroll_x = base.x - 80;
834       else if (scroll_x > base.x + 80)
835         scroll_x = base.x + 80;
836       scroll_x -= screen->w/2;
837
838       if(scroll_x < 0)
839         scroll_x = 0;
840     }
841   else
842     {
843       if (base.x > scroll_threshold + scroll_x
844           && scroll_x < ((World::current()->get_level()->width * 32) - screen->w))
845         {
846           // FIXME: Scrolling needs to be handled by a seperate View
847           // class, doing it as a player huck is ugly
848           
849           // Scroll the screen in past center:
850           scroll_x = base.x - scroll_threshold;
851           
852           // Lock the scrolling to the levelsize, so that we don't
853           // scroll over the right border
854           if (scroll_x > 32 * plevel->width - screen->w)
855             scroll_x = 32 * plevel->width - screen->w;
856         }
857     }
858 }
859
860 // EOF //
861