1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
|
/*
* Copyright (C) 2000 Stefan Schimanski <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdlib.h>
#include <tqtimer.h>
#include <kstandarddirs.h>
#include <tdeapplication.h>
#include <kdebug.h>
#include <tqimage.h>
#include <tdeglobalsettings.h>
#include "game.h"
#define TILE_SIZE 16
#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2))
#define TILE_FREE (TILE_FIRST + 0)
#define TILE_BORDER (TILE_FIRST + 1)
#define TILE_WALLEND (TILE_FIRST + 2)
#define TILE_WALLUP (TILE_FIRST + 3)
#define TILE_WALLDOWN (TILE_FIRST + 4)
#define TILE_WALLLEFT (TILE_FIRST + 5)
#define TILE_WALLRIGHT (TILE_FIRST + 6)
#define GAME_DELAY 15
#define BALL_ANIM_DELAY 60
#define WALL_DELAY 100
#if HAVE_ARTS
SimpleSoundServer *JezzGame::m_artsServer = 0;
#endif
TQString JezzGame::m_soundPath;
bool JezzGame::m_sound = true;
#define MS2TICKS( ms ) ((ms)/GAME_DELAY)
Ball::Ball(TQCanvasPixmapArray* array, TQCanvas* canvas)
: TQCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
{
}
void Ball::update()
{
// set pixmap frame
m_animDelay--;
if ( m_animDelay<=0 )
{
m_animDelay = MS2TICKS(BALL_ANIM_DELAY);
int frameNum = frame();
frameNum++;
if ( frameNum>=frameCount() )
frameNum = 0;
setFrame( frameNum );
}
}
void Ball::advance(int stage)
{
bool reflectX = false;
bool reflectY = false;
m_soundDelay++;
// ball already on a wall? (should normally never happen)
// commented out to stop bug which causes balls to
// sometimes stop when clicked on
// if ( collide(0, 0) ) setVelocity( 0, 0 );
// check for collisions
if ( collide(xVelocity(), 0) ) reflectX = true;
if ( collide(0, yVelocity()) ) reflectY = true;
if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true;
// emit collision
TQRect r = boundingRect();
r.moveBy( xVelocity(), yVelocity() );
JezzField* field = (JezzField *)canvas();
int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else
if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else
if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else
if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br );
// apply reflection
if ( reflectX ) setXVelocity( -xVelocity() );
if ( reflectY ) setYVelocity( -yVelocity() );
// play collision sound
if ( reflectX || reflectY )
{
if ( m_soundDelay>50 ) JezzGame::playSound( "reflect.au" );
m_soundDelay = 0;
}
// update field
update();
TQCanvasSprite::advance( stage );
}
bool Ball::collide( double dx, double dy )
{
TQRect r = boundingRect();
r.moveBy( dx, dy );
JezzField* field = (JezzField *)canvas();
int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE );
}
/*************************************************************************/
Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, TQObject *parent, const char *name )
: TQObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true )
{
//kdDebug(12008) << "Wall::Wall" << endl;
// setup position and direction
m_dx = 0;
m_dy = 0;
switch ( m_dir )
{
case Up: m_dy = -1; break;
case Down: m_dy = 1; break;
case Left: m_dx = -1; break;
case Right: m_dx = 1; break;
}
m_x = m_startX;
m_y = m_startY;
m_field->setTile( m_x, m_y, m_tile );
}
void Wall::finish()
{
m_active = false;
}
bool Wall::isFree( int x, int y )
{
if ( m_field->tile(x, y)==TILE_FREE )
{
// check whether there is a ball at the moment
TQCanvasItemList cols = m_field->collisions( TQRect(x*TILE_SIZE, y*TILE_SIZE,
TILE_SIZE, TILE_SIZE) );
if ( cols.count()==0 )
return true;
}
return false;
}
void Wall::update()
{
}
void Wall::advance()
{
update();
// move wall
if ( m_active )
{
m_delay--;
if ( m_delay<=0 )
{
m_delay = MS2TICKS(WALL_DELAY);
// set previous tile
m_field->setTile( m_x, m_y, m_tile );
// check whether next place is still free
if ( isFree(m_x+m_dx, m_y+m_dy) )
{
// move ball
m_x += m_dx;
m_y += m_dy;
// set tile
m_field->setTile( m_x, m_y, TILE_WALLEND );
} else
{
finish();
emit finished( this, m_field->tile( m_x+m_dx, m_y+m_dy ) );
}
}
}
}
void Wall::fill( bool black )
{
if ( m_dx )
{
for ( int x=m_startX ; x!=m_x; x+=m_dx )
if ( m_field->tile(x, m_startY)==m_tile )
m_field->setGameTile( x, m_startY, black );
m_field->setGameTile( m_x, m_startY, black );
} else
{
for ( int y=m_startY ; y!=m_y; y+=m_dy )
if ( m_field->tile(m_startX, y)==m_tile )
m_field->setGameTile( m_startX, y, black );
m_field->setGameTile( m_startX, m_y, black );
}
}
/*************************************************************************/
JezzField::JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* parent, const char* name )
: TQCanvas( parent, name ), m_tiles( tiles )
{
setPixmaps( tiles, background );
}
void JezzField::setGameTile( int x, int y, bool black )
{
if ( m_background )
setTile( x, y, black ? ((x-1)+(y-1)*(FIELD_WIDTH-2)) : TILE_FREE );
else
setTile( x, y, black ? TILE_BORDER : TILE_FREE );
}
void JezzField::setBackground( const TQPixmap &background )
{
// copy current field into buffer
int backup[FIELD_WIDTH][FIELD_HEIGHT];
for ( int y=0; y<FIELD_HEIGHT; y++ )
for ( int x=0; x<FIELD_WIDTH; x++ )
backup[x][y] = tile( x, y );
setPixmaps( m_tiles, background );
// restore tiles
for ( int x=0; x<FIELD_WIDTH; x++ )
setTile( x, 0, TILE_BORDER );
for ( int y=1; y<FIELD_HEIGHT-1; y++ ) {
setTile( 0, y, TILE_BORDER );
for ( int x=1; x<FIELD_WIDTH-1; x++ ) {
int tile = backup[x][y];
if ( m_background ) {
if ( tile==TILE_BORDER || tile<TILE_FIRST )
tile = (x-1)+(y-1)*(FIELD_WIDTH-2);
} else {
if ( tile<TILE_FIRST )
tile = TILE_BORDER;
}
setTile( x, y, tile );
}
setTile( FIELD_WIDTH-1, y, TILE_BORDER );
}
for ( int x=0; x<FIELD_WIDTH; x++ )
setTile( x, FIELD_HEIGHT-1, TILE_BORDER );
}
void JezzField::setPixmaps( const TQPixmap &tiles, const TQPixmap &background )
{
// create new tiles
TQPixmap allTiles( TILE_SIZE*(FIELD_WIDTH-2), TILE_SIZE*(FIELD_HEIGHT-1) );
if ( background.width()==0 || background.height()==0 ) {
m_background = false;
} else {
// handle background
m_background = true;
TQImage img = background.convertToImage();
TQPixmap scalledBackground( img.smoothScale( TILE_SIZE*(FIELD_WIDTH-2),
TILE_SIZE*(FIELD_HEIGHT-2) ) );
bitBlt( &allTiles, 0, 0, &scalledBackground, 0, 0, scalledBackground.width(), scalledBackground.height() );
}
// handle default tiles
bitBlt( &allTiles, 0, TILE_SIZE*(FIELD_HEIGHT-2),
&tiles, 0, 0, tiles.width(), tiles.height() );
// load tiles into canvas
setTiles( allTiles, FIELD_WIDTH, FIELD_HEIGHT, TILE_SIZE, TILE_SIZE );
}
/*************************************************************************/
JezzView::JezzView(TQCanvas* viewing, TQWidget* parent, const char* name, WFlags f)
: TQCanvasView( viewing, parent, name, f ), m_vertical( false )
{
setResizePolicy( AutoOne );
setHScrollBarMode( AlwaysOff );
setVScrollBarMode( AlwaysOff );
setCursor( sizeHorCursor );
}
void JezzView::viewportMouseReleaseEvent( TQMouseEvent *ev )
{
if ( ev->button() & Qt::RightButton )
{
m_vertical = !m_vertical;
if ( m_vertical ) setCursor( sizeVerCursor ); else setCursor( sizeHorCursor );
}
if ( ev->button() & Qt::LeftButton )
{
emit buildWall( ev->x()/TILE_SIZE, ev->y()/TILE_SIZE, m_vertical );
}
}
/*************************************************************************/
JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent, const char *name )
: TQWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
{
TQString path = kapp->dirs()->findResourceDir( "data", "kbounce/pics/ball0000.png" ) + "kbounce/pics/";
// load gfx
m_ballPixmaps = new TQCanvasPixmapArray( path + "ball%1.png", 25 );
for ( unsigned n=0; n<m_ballPixmaps->count(); n++ )
m_ballPixmaps->image(n)->setOffset( 0, 0 );
TQPixmap tiles( path + "tiles.png" );
// setup arts
#if HAVE_ARTS
m_artsServer = new SimpleSoundServer;
*m_artsServer = Arts::Reference("global:Arts_SimpleSoundServer");
if ( m_artsServer->isNull() )
kdDebug(12008) << "Can't connect to aRts sound server" << endl;
#endif
m_soundPath = kapp->dirs()->findResourceDir( "data", "kbounce/sounds/death.au" ) +
"kbounce/sounds/";
// create field
m_field = new JezzField( tiles, background, TQT_TQOBJECT(this), "m_field" );
m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT );
for ( int x=0; x<FIELD_WIDTH; x++ )
m_field->setTile( x, 0, TILE_BORDER );
for ( int y=1; y<FIELD_HEIGHT-1; y++ )
{
m_field->setTile( 0, y, TILE_BORDER );
for ( int x=1; x<FIELD_WIDTH-1; x++ )
m_field->setTile( x, y, TILE_FREE );
m_field->setTile( FIELD_WIDTH-1, y, TILE_BORDER );
}
for ( int x=0; x<FIELD_WIDTH; x++ )
m_field->setTile( x, FIELD_HEIGHT-1, TILE_BORDER );
connect( m_field, TQT_SIGNAL(ballCollision(Ball *, int, int, int)), this, TQT_SLOT(ballCollision(Ball *, int, int, int)) );
// create view
m_view = new JezzView( m_field, this, "m_view" );
m_view->move( 0, 0 );
m_view->adjustSize();
connect( m_view, TQT_SIGNAL(buildWall(int, int, bool)), this, TQT_SLOT(buildWall(int, int, bool)) );
// create balls
for ( int n=0; n<ballNum; n++ )
{
Ball *ball = new Ball( m_ballPixmaps, m_field );
m_balls.append( ball );
ball->setVelocity( ((kapp->random() & 1)*2-1)*2, ((kapp->random() & 1)*2-1)*2 );
ball->setFrame( kapp->random() % 25 );
ball->move( 4*TILE_SIZE + kapp->random() % ( (FIELD_WIDTH-8)*TILE_SIZE ),
4*TILE_SIZE + kapp->random() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) );
ball->show();
}
// create text label
m_text = new TQCanvasText( m_field );
// create game clock
m_clock = new TQTimer( this );
connect( m_clock, TQT_SIGNAL(timeout()), this, TQT_SLOT(tick()) );
m_clock->start( GAME_DELAY );
// setup geometry
setFixedSize( m_view->size() );
}
JezzGame::~JezzGame()
{
m_balls.clear();
delete m_view;
delete m_field;
delete m_ballPixmaps;
#if HAVE_ARTS
delete m_artsServer;
#endif
}
void JezzGame::display( const TQString &text, int size )
{
tqDebug("This function \"display\" shouldn't be called!!!");
if ( !text.isEmpty() )
{
//kdDebug(12008) << "text = " << text << endl;
TQFont font = TDEGlobalSettings::generalFont();
font.setBold(true);
font.setPointSize(size);
m_text->setFont( font );
m_text->setText( text );
TQRect size = m_text->boundingRect();
m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
m_text->show();
} else
{
m_text->hide();
}
}
void JezzGame::playSound( const TQString &name )
{
#if HAVE_ARTS
if( !m_artsServer->isNull() && m_sound)
{
TQString path = m_soundPath + name;
m_artsServer->play( path.latin1() );
}
#else
return;
#endif
}
void JezzGame::setBackground( const TQPixmap &background )
{
m_field->setBackground( background );
}
void JezzGame::setSound( bool sound )
{
m_sound = sound;
}
void JezzGame::start()
{
m_running = true;
}
void JezzGame::stop()
{
m_running = false;
}
void JezzGame::makeBlack()
{
// copy current field into buffer
for ( int y=0; y<FIELD_HEIGHT; y++ )
for ( int x=0; x<FIELD_WIDTH; x++ )
m_buf[x][y] = m_field->tile( x, y );
// fill areas that contains a ball
for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() )
fill( ball->x()/TILE_SIZE, ball->y()/TILE_SIZE );
// areas still free can be blacked now
for ( int y=0; y<FIELD_HEIGHT; y++ )
for ( int x=0; x<FIELD_WIDTH; x++ )
{
if ( m_buf[x][y]==TILE_FREE )
m_field->setGameTile( x, y, true );
}
m_field->update();
m_view->repaint();
// count percent value of occupied area
int p = percent();
if ( p!=m_percent )
{
m_percent = p;
emit newPercent( m_percent );
}
}
int JezzGame::percent()
{
int notFree = 0;
for ( int y=1; y<FIELD_HEIGHT-1; y++ )
for ( int x=1; x<FIELD_WIDTH-1; x++ )
{
if ( m_field->tile(x,y)!=TILE_FREE )
notFree++;
}
return 100 * notFree / ( (FIELD_WIDTH-2) * (FIELD_HEIGHT-2) );
}
void JezzGame::fill( int x, int y )
{
if ( m_buf[x][y]!=TILE_FREE) return;
// go left
int _x=x;
for ( ; m_buf[_x][y]==TILE_FREE; _x-- )
m_buf[_x][y] = TILE_BORDER;
int stopx = _x;
// fill above
for ( _x=x; _x>stopx; _x-- )
if ( m_buf[_x][y-1]==TILE_FREE ) fill( _x, y-1 );
// fill below
for ( _x=x; _x>stopx; _x-- )
if ( m_buf[_x][y+1]==TILE_FREE ) fill( _x, y+1 );
// go right
for ( _x=x+1; m_buf[_x][y]==TILE_FREE; _x++ )
m_buf[_x][y] = TILE_BORDER;
stopx = _x;
// fill above
for ( _x=x+1; _x<stopx; _x++ )
if ( m_buf[_x][y-1]==TILE_FREE ) fill( _x, y-1 );
// fill below;
for ( _x=x+1; _x<stopx; _x++ )
if ( m_buf[_x][y+1]==TILE_FREE ) fill( _x, y+1 );
}
void JezzGame::ballCollision( Ball */*ball*/, int /*x*/, int /*y*/, int tile )
{
if ( tile!=TILE_BORDER && tile>TILE_FREE && tile!=TILE_WALLEND )
{
kdDebug(12008) << "Collision" << endl;
// play explosion sound
playSound( "death.au" );
// stop walls
if ( (tile==TILE_WALLUP || tile==TILE_WALLLEFT) && m_wall1 )
{
kdDebug(12008) << "up or left" << endl;
m_wall1->finish();
m_wall1->fill( false );
delete m_wall1;
m_wall1 = 0;
}
if ( (tile==TILE_WALLDOWN || tile==TILE_WALLRIGHT) && m_wall2 )
{
kdDebug(12008) << "down or right" << endl;
m_wall2->finish();
m_wall2->fill( false );
delete m_wall2;
m_wall2 = 0;
}
// update view
m_field->update();
m_view->repaint();
// send death msg
emit died();
}
}
void JezzGame::buildWall( int x, int y, bool vertical )
{
if ( !m_running ) return;
kdDebug(12008) << "JezzGame::buildWall( x=" << x << " y=" << y << " vertical=" << vertical << " )" << endl;
if ( m_field->tile(x, y)==TILE_FREE )
{
playSound( "wallstart.au" );
// check whether there is a ball at the moment
TQCanvasItemList cols = m_field->collisions( TQRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) );
if ( cols.count()>0 )
{
kdDebug(12008) << "Direct collision" << endl;
emit ballCollision( (Ball*)cols.first(), x, y, TILE_WALLUP );
return;
}
// start walls
if ( !m_wall1 )
{
m_wall1 = new Wall( m_field, x, y,
vertical? Wall::Up : Wall::Left,
vertical? TILE_WALLUP : TILE_WALLLEFT,
TQT_TQOBJECT(this), "m_wall1" );
connect( m_wall1, TQT_SIGNAL(finished(Wall *, int)),
this, TQT_SLOT(wallFinished(Wall *, int)) ); }
if ( !m_wall2 )
{
m_wall2 = new Wall( m_field, x, y,
vertical? Wall::Down: Wall::Right,
vertical? TILE_WALLDOWN : TILE_WALLRIGHT,
TQT_TQOBJECT(this), "m_wall2" );
connect( m_wall2, TQT_SIGNAL(finished(Wall *, int)),
this, TQT_SLOT(wallFinished(Wall *, int)) );
}
}
}
void JezzGame::wallFinished( Wall *wall, int tile )
{
//kdDebug(12008) << "wallFinished" << endl;
playSound( "wallend.au" );
if ( tile==TILE_WALLEND )
{
if ( m_wall1 )
{
m_wall1->fill( false );
delete m_wall1;
m_wall1 = 0;
}
if ( m_wall2 )
{
m_wall2->fill( false );
delete m_wall2;
m_wall2 = 0;
}
} else
{
if ( m_wall1==wall && m_wall1 )
{
m_wall1->fill( true );
delete m_wall1;
m_wall1 = 0;
}
if ( m_wall2==wall && m_wall2 )
{
m_wall2->fill( true );
delete m_wall2;
m_wall2 = 0;
}
}
m_field->update();
m_view->repaint();
makeBlack();
}
void JezzGame::tick()
{
if ( m_running )
{
if ( m_field ) m_field->advance();
if ( m_wall1 ) m_wall1->advance();
if ( m_wall2 ) m_wall2->advance();
} else
{
for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() )
ball->update();
if ( m_field ) m_field->update();
if ( m_wall1 ) m_wall1->update();
if ( m_wall2 ) m_wall2->update();
}
//kapp->syncX();
}
#include "game.moc"
|