summaryrefslogtreecommitdiff
path: root/noncore/games
Unidiff
Diffstat (limited to 'noncore/games') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/bounce/game.cpp17
-rw-r--r--noncore/games/kbill/Game.cc14
-rw-r--r--noncore/games/kbill/Game.h2
-rw-r--r--noncore/games/kbill/field.cpp2
-rw-r--r--noncore/games/kbill/inputbox.cpp10
-rw-r--r--noncore/games/kbill/kbill.h42
-rw-r--r--noncore/games/zsame/ZSameWidget.cpp12
7 files changed, 51 insertions, 48 deletions
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index bbd3d0b..5ef9f15 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -21,25 +21,25 @@
21 21
22/* OPIE */ 22/* OPIE */
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25using namespace Opie::Core; 25using namespace Opie::Core;
26 26
27/* QT */ 27/* QT */
28#include <qtimer.h> 28#include <qtimer.h>
29 29
30/* STD */ 30/* STD */
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#define TILE_SIZE 9 33#define TILE_SIZE 9
34 34
35#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2)) 35#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2))
36#define TILE_FREE (TILE_FIRST + 0) 36#define TILE_FREE (TILE_FIRST + 0)
37#define TILE_BORDER (TILE_FIRST + 1) 37#define TILE_BORDER (TILE_FIRST + 1)
38#define TILE_WALLEND (TILE_FIRST + 2) 38#define TILE_WALLEND (TILE_FIRST + 2)
39#define TILE_WALLUP (TILE_FIRST + 3) 39#define TILE_WALLUP (TILE_FIRST + 3)
40#define TILE_WALLDOWN (TILE_FIRST + 4) 40#define TILE_WALLDOWN (TILE_FIRST + 4)
41#define TILE_WALLLEFT (TILE_FIRST + 5) 41#define TILE_WALLLEFT (TILE_FIRST + 5)
42#define TILE_WALLRIGHT (TILE_FIRST + 6) 42#define TILE_WALLRIGHT (TILE_FIRST + 6)
43 43
44#define GAME_DELAY 15 44#define GAME_DELAY 15
45#define BALL_ANIM_DELAY 60 45#define BALL_ANIM_DELAY 60
@@ -58,25 +58,25 @@ void Arrow::update()
58{ 58{
59 if ( m_vertical ) 59 if ( m_vertical )
60 setFrame( 0 ); 60 setFrame( 0 );
61 else 61 else
62 setFrame( 1 ); 62 setFrame( 1 );
63} 63}
64 64
65void Arrow::changeDirection() 65void Arrow::changeDirection()
66{ 66{
67 m_vertical = ! m_vertical; 67 m_vertical = ! m_vertical;
68 update(); 68 update();
69} 69}
70 70
71 71
72Ball::Ball(QCanvasPixmapArray* array, QCanvas* canvas) 72Ball::Ball(QCanvasPixmapArray* array, QCanvas* canvas)
73 : QCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 ) 73 : QCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
74{ 74{
75} 75}
76 76
77void Ball::update() 77void Ball::update()
78{ 78{
79 m_animDelay--; 79 m_animDelay--;
80 if ( m_animDelay<=0 ) 80 if ( m_animDelay<=0 )
81 { 81 {
82 m_animDelay = MS2TICKS(BALL_ANIM_DELAY); 82 m_animDelay = MS2TICKS(BALL_ANIM_DELAY);
@@ -91,50 +91,50 @@ void Ball::update()
91void Ball::advance(int stage) 91void Ball::advance(int stage)
92{ 92{
93 bool reflectX = false; 93 bool reflectX = false;
94 bool reflectY = false; 94 bool reflectY = false;
95 95
96 // check for collisions 96 // check for collisions
97 if ( collide(xVelocity(), 0) ) reflectX = true; 97 if ( collide(xVelocity(), 0) ) reflectX = true;
98 if ( collide(0, yVelocity()) ) reflectY = true; 98 if ( collide(0, yVelocity()) ) reflectY = true;
99 if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true; 99 if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true;
100 100
101 // emit collision 101 // emit collision
102 QRect r = boundingRect(); 102 QRect r = boundingRect();
103 r.moveBy( xVelocity(), yVelocity() ); 103 r.moveBy( static_cast<int>(xVelocity()), static_cast<int>( yVelocity() ) );
104 JezzField* field = (JezzField *)canvas(); 104 JezzField* field = (JezzField *)canvas();
105 105
106 int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); 106 int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
107 int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); 107 int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
108 int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); 108 int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
109 int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); 109 int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
110 110
111 if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else 111 if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else
112 if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else 112 if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else
113 if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else 113 if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else
114 if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br ); 114 if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br );
115 115
116 // apply reflection 116 // apply reflection
117 if ( reflectX ) setXVelocity( -xVelocity() ); 117 if ( reflectX ) setXVelocity( -xVelocity() );
118 if ( reflectY ) setYVelocity( -yVelocity() ); 118 if ( reflectY ) setYVelocity( -yVelocity() );
119 119
120 // update field 120 // update field
121 update(); 121 update();
122 QCanvasSprite::advance( stage ); 122 QCanvasSprite::advance( stage );
123} 123}
124 124
125bool Ball::collide( double dx, double dy ) 125bool Ball::collide( double dx, double dy )
126{ 126{
127 QRect r = boundingRect(); 127 QRect r = boundingRect();
128 r.moveBy( dx, dy ); 128 r.moveBy( static_cast<int>( dx ), static_cast<int>( dy ) );
129 JezzField* field = (JezzField *)canvas(); 129 JezzField* field = (JezzField *)canvas();
130 130
131 int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); 131 int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
132 int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); 132 int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
133 int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); 133 int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
134 int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); 134 int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
135 135
136 return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE ); 136 return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE );
137} 137}
138 138
139/*************************************************************************/ 139/*************************************************************************/
140 140
@@ -290,25 +290,25 @@ void JezzView::changeCursor()
290 else 290 else
291 { 291 {
292 setCursor( sizeHorCursor ); 292 setCursor( sizeHorCursor );
293 } 293 }
294} 294}
295 295
296/*************************************************************************/ 296/*************************************************************************/
297 297
298JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name ) 298JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
299 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ), 299 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
300 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false ) 300 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
301{ 301{
302 QString path = QPEApplication::qpeDir()+"pics/bounce/"; 302 QString path = QPEApplication::qpeDir()+"pics/bounce/";
303 303
304 // load gfx 304 // load gfx
305 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 ); 305 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 );
306 for ( unsigned n=0; n < m_ballPixmaps->count(); n++ ) 306 for ( unsigned n=0; n < m_ballPixmaps->count(); n++ )
307 m_ballPixmaps->image(n)->setOffset( 0, 0 ); 307 m_ballPixmaps->image(n)->setOffset( 0, 0 );
308 308
309 m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 ); 309 m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 );
310 for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ ) 310 for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ )
311 m_arrowPixmaps->image(n)->setOffset( 0, 0 ); 311 m_arrowPixmaps->image(n)->setOffset( 0, 0 );
312 312
313 QPixmap tiles( path + "tiles.png" ); 313 QPixmap tiles( path + "tiles.png" );
314 314
@@ -338,25 +338,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
338 338
339 // create balls 339 // create balls
340 for ( int n=0; n<ballNum; n++ ) 340 for ( int n=0; n<ballNum; n++ )
341 { 341 {
342 Ball *ball = new Ball( m_ballPixmaps, m_field ); 342 Ball *ball = new Ball( m_ballPixmaps, m_field );
343 m_balls.append( ball ); 343 m_balls.append( ball );
344 ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 ); 344 ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 );
345 ball->setFrame( rand() % 25 ); 345 ball->setFrame( rand() % 25 );
346 ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ), 346 ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ),
347 4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) ); 347 4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) );
348 ball->show(); 348 ball->show();
349 } 349 }
350 350
351 // create arrow 351 // create arrow
352 arrow = new Arrow( m_arrowPixmaps, m_field ); 352 arrow = new Arrow( m_arrowPixmaps, m_field );
353 arrow->show(); 353 arrow->show();
354 354
355 // create text label 355 // create text label
356 m_text = new QCanvasText( m_field ); 356 m_text = new QCanvasText( m_field );
357 357
358 // create game clock 358 // create game clock
359 m_clock = new QTimer( this ); 359 m_clock = new QTimer( this );
360 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) ); 360 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
361 m_clock->start( GAME_DELAY ); 361 m_clock->start( GAME_DELAY );
362 362
@@ -365,25 +365,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
365} 365}
366 366
367JezzGame::~JezzGame() 367JezzGame::~JezzGame()
368{ 368{
369 m_balls.clear(); 369 m_balls.clear();
370 delete m_view; 370 delete m_view;
371 delete m_field; 371 delete m_field;
372 delete m_ballPixmaps; 372 delete m_ballPixmaps;
373} 373}
374 374
375void JezzGame::display( QString text, int size ) 375void JezzGame::display( QString text, int size )
376{ 376{
377 odebug << "This function \"display\" shouldn't be called!!!" << oendl; 377 odebug << "This function \"display\" shouldn't be called!!!" << oendl;
378 if ( !text.isEmpty() ) 378 if ( !text.isEmpty() )
379 { 379 {
380 QFont font( "Helvetica", size, QFont::Bold ); 380 QFont font( "Helvetica", size, QFont::Bold );
381 font.setStyleHint( QFont::Helvetica ); 381 font.setStyleHint( QFont::Helvetica );
382 m_text->setFont( font ); 382 m_text->setFont( font );
383 m_text->setText( text ); 383 m_text->setText( text );
384 384
385 QRect size = m_text->boundingRect(); 385 QRect size = m_text->boundingRect();
386 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, 386 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
387 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); 387 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
388 388
389 m_text->show(); 389 m_text->show();
@@ -404,25 +404,26 @@ void JezzGame::stop()
404} 404}
405 405
406 406
407void JezzGame::makeBlack() 407void JezzGame::makeBlack()
408{ 408{
409 // copy current field into buffer 409 // copy current field into buffer
410 for ( int y=0; y<FIELD_HEIGHT; y++ ) 410 for ( int y=0; y<FIELD_HEIGHT; y++ )
411 for ( int x=0; x<FIELD_WIDTH; x++ ) 411 for ( int x=0; x<FIELD_WIDTH; x++ )
412 m_buf[x][y] = m_field->tile( x, y ); 412 m_buf[x][y] = m_field->tile( x, y );
413 413
414 // fill areas that contains a ball 414 // fill areas that contains a ball
415 for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() ) 415 for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() )
416 fill( ball->x()/TILE_SIZE, ball->y()/TILE_SIZE ); 416 fill( static_cast<int>( ball->x()/TILE_SIZE ),
417 static_cast<int>( ball->y()/TILE_SIZE ) );
417 418
418 // areas still free can be blacked now 419 // areas still free can be blacked now
419 for ( int y=0; y<FIELD_HEIGHT; y++ ) 420 for ( int y=0; y<FIELD_HEIGHT; y++ )
420 for ( int x=0; x<FIELD_WIDTH; x++ ) 421 for ( int x=0; x<FIELD_WIDTH; x++ )
421 { 422 {
422 if ( m_buf[x][y]==TILE_FREE ) 423 if ( m_buf[x][y]==TILE_FREE )
423 m_field->setGameTile( x, y, true ); 424 m_field->setGameTile( x, y, true );
424 } 425 }
425 426
426 m_field->update(); 427 m_field->update();
427 m_view->repaint(); 428 m_view->repaint();
428 429
diff --git a/noncore/games/kbill/Game.cc b/noncore/games/kbill/Game.cc
index 624b50b..4cd5322 100644
--- a/noncore/games/kbill/Game.cc
+++ b/noncore/games/kbill/Game.cc
@@ -49,39 +49,39 @@ void Game::quit() {
49 49
50 exit(0); 50 exit(0);
51} 51}
52 52
53void Game::update_info() { 53void Game::update_info() {
54 static char str[80]; 54 static char str[80];
55 sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d", 55 sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d",
56 bill.on_screen, bill.off_screen, net.base, net.off, 56 bill.on_screen, bill.off_screen, net.base, net.off,
57 net.win, level, score); 57 net.win, level, score);
58 ui.draw_str(str, 5, scrheight-5); 58 ui.draw_str(str, 5, scrheight-5);
59 efficiency += ((100*net.base-10*net.win)/net.units); 59 efficiency += ((100*net.base-10*net.win)/net.units);
60} 60}
61 61
62void Game::update_score (int action) { 62void Game::update_score (int action) {
63 switch (action){ 63 switch (action){
64 case ENDLEVEL: score+=(level*efficiency/iteration); break; 64 case ENDLEVEL: score+=(level*efficiency/iteration); break;
65 default: score+=(action*action*BILLPOINTS); 65 default: score+=(action*action*BILLPOINTS);
66 } 66 }
67} 67}
68 68
69void Game::warp_to_level (unsigned int lev) { 69void Game::warp_to_level (unsigned int lev) {
70 if (state==PLAYING) { 70 if (state==PLAYING) {
71 if (lev <= level) return; 71 if (lev <= level) return;
72 setup_level(lev); 72 setup_level(lev);
73 } 73 }
74 else { 74 else {
75 if (lev<=0) return; 75 if (lev <=0) return;
76 start(lev); 76 start(lev);
77 } 77 }
78} 78}
79 79
80void Game::button_press(int x, int y) { 80void Game::button_press(int x, int y) {
81 int i, counter=0, flag=0; 81 int i, counter=0, flag=0;
82 if (state != PLAYING) return; 82 if (state != PLAYING) return;
83 ui.set_cursor(DOWNC); 83 ui.set_cursor(DOWNC);
84 if (bucket.clicked(x, y)) { 84 if (bucket.clicked(x, y)) {
85 ui.set_cursor(BUCKETC); 85 ui.set_cursor(BUCKETC);
86 grabbed = BUCKET; 86 grabbed = BUCKET;
87 } 87 }
@@ -90,25 +90,25 @@ void Game::button_press(int x, int y) {
90 || bill.list[i].state == bill.list[i].DYING) 90 || bill.list[i].state == bill.list[i].DYING)
91 continue; 91 continue;
92 if (bill.list[i].state == bill.list[i].STRAY && 92 if (bill.list[i].state == bill.list[i].STRAY &&
93 bill.list[i].clickedstray(x, y)) 93 bill.list[i].clickedstray(x, y))
94 { 94 {
95 ui.set_cursor (bill.list[i].cargo); 95 ui.set_cursor (bill.list[i].cargo);
96 grabbed = i; 96 grabbed = i;
97 flag = 1; 97 flag = 1;
98 } 98 }
99 else if (bill.list[i].state != bill.list[i].STRAY && 99 else if (bill.list[i].state != bill.list[i].STRAY &&
100 bill.list[i].clicked(x, y)) 100 bill.list[i].clicked(x, y))
101 { 101 {
102 if (bill.list[i].state == bill.list[i].AT) 102 if (bill.list[i].state == bill.list[i].AT)
103 net.computers[bill.list[i].target_c].busy=0; 103 net.computers[bill.list[i].target_c].busy=0;
104 bill.list[i].index = -1; 104 bill.list[i].index = -1;
105 bill.list[i].cels = bill.dcels; 105 bill.list[i].cels = bill.dcels;
106 bill.list[i].x_offset = -2; 106 bill.list[i].x_offset = -2;
107 bill.list[i].y_offset = -15; 107 bill.list[i].y_offset = -15;
108 bill.list[i].state = bill.list[i].DYING; 108 bill.list[i].state = bill.list[i].DYING;
109 counter++; 109 counter++;
110 } 110 }
111 } 111 }
112 if (counter) update_score(counter); 112 if (counter) update_score(counter);
113} 113}
114 114
@@ -122,44 +122,44 @@ void Game::button_release(int x, int y) {
122 for (i=0; i<net.ncables; i++) 122 for (i=0; i<net.ncables; i++)
123 if (net.cables[i].onspark(x, y)) { 123 if (net.cables[i].onspark(x, y)) {
124 net.cables[i].active=0; 124 net.cables[i].active=0;
125 net.cables[i].delay = spark.delay(level); 125 net.cables[i].delay = spark.delay(level);
126 } 126 }
127 return; 127 return;
128 } 128 }
129 for (i=0; i<net.units; i++) 129 for (i=0; i<net.units; i++)
130 if (net.computers[i].oncomputer(x, y) 130 if (net.computers[i].oncomputer(x, y)
131 && 131 &&
132 net.computers[i].compatible (bill.list[grabbed].cargo) 132 net.computers[i].compatible (bill.list[grabbed].cargo)
133 && 133 &&
134 (net.computers[i].os == OS.WINGDOWS || 134 (net.computers[i].os == OS.WINGDOWS ||
135 net.computers[i].os == OS.OFF)) 135 net.computers[i].os == OS.OFF))
136 { 136 {
137 net.base++; 137 net.base++;
138 if (net.computers[i].os == OS.WINGDOWS) 138 if (net.computers[i].os == OS.WINGDOWS)
139 net.win--; 139 net.win--;
140 else 140 else
141 net.off--; 141 net.off--;
142 net.computers[i].os = bill.list[grabbed].cargo; 142 net.computers[i].os = bill.list[grabbed].cargo;
143 bill.list[grabbed].state = bill.list[grabbed].OFF; 143 bill.list[grabbed].state = bill.list[grabbed].OFF;
144 grabbed = EMPTY; 144 grabbed = EMPTY;
145 return; 145 return;
146 } 146 }
147 grabbed = EMPTY; 147 grabbed = EMPTY;
148 } 148}
149 149
150void Game::update() { 150void Game::update() {
151 switch (state) { 151 switch (state) {
152 case PLAYING: 152 case PLAYING:
153 ui.clear(); 153 ui.clear();
154 bucket.draw(); 154 bucket.draw();
155 net.update(); 155 net.update();
156 net.draw(); 156 net.draw();
157 bill.update(); 157 bill.update();
158 bill.draw(); 158 bill.draw();
159 update_info(); 159 update_info();
160 if (!(bill.on_screen+bill.off_screen)) { 160 if (!(bill.on_screen+bill.off_screen)) {
161 update_score(ENDLEVEL); 161 update_score(ENDLEVEL);
162 state = BETWEEN; 162 state = BETWEEN;
163 } 163 }
164 if ((net.base+net.off)<=1) state = END; 164 if ((net.base+net.off)<=1) state = END;
165 break; 165 break;
diff --git a/noncore/games/kbill/Game.h b/noncore/games/kbill/Game.h
index 4473936..5c9c497 100644
--- a/noncore/games/kbill/Game.h
+++ b/noncore/games/kbill/Game.h
@@ -1,19 +1,19 @@
1#ifndef GAME_H 1#ifndef GAME_H
2#define GAME_H 2#define GAME_H
3 3
4#include "objects.h" 4#include "objects.h"
5 5
6class Game { 6class Game {
7 unsigned state; 7 int state;
8 int efficiency; 8 int efficiency;
9public: 9public:
10 unsigned score, level, iteration; 10 unsigned score, level, iteration;
11 Picture logo; 11 Picture logo;
12 int grabbed; 12 int grabbed;
13 13
14 static const unsigned short scrwidth = 240; 14 static const unsigned short scrwidth = 240;
15 static const unsigned short scrheight = 290; 15 static const unsigned short scrheight = 290;
16 16
17 static const int PLAYING = 1; 17 static const int PLAYING = 1;
18 static const int BETWEEN = 2; 18 static const int BETWEEN = 2;
19 static const int END = 3; 19 static const int END = 3;
diff --git a/noncore/games/kbill/field.cpp b/noncore/games/kbill/field.cpp
index a974ab2..0dd8d72 100644
--- a/noncore/games/kbill/field.cpp
+++ b/noncore/games/kbill/field.cpp
@@ -71,13 +71,13 @@ void Field::stopTimer() {
71void Field::startTimer() { 71void Field::startTimer() {
72 playing = true; 72 playing = true;
73 if (!timer->isActive()) 73 if (!timer->isActive())
74 timer->start(250, FALSE); 74 timer->start(250, FALSE);
75} 75}
76 76
77void Field::Timer(){ 77void Field::Timer(){
78 game.update(); 78 game.update();
79} 79}
80 80
81void Field::paintEvent(QPaintEvent *) { 81void Field::paintEvent(QPaintEvent *) {
82 bitBlt(this, 0, 0, pix); 82 bitBlt(this, 0, 0, pix);
83 } \ No newline at end of file 83}
diff --git a/noncore/games/kbill/inputbox.cpp b/noncore/games/kbill/inputbox.cpp
index 5087fbb..7aaebe7 100644
--- a/noncore/games/kbill/inputbox.cpp
+++ b/noncore/games/kbill/inputbox.cpp
@@ -7,41 +7,41 @@
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "inputbox.h" 18#include "inputbox.h"
19InputBox::InputBox(QWidget *parent, const char *name, const char *caption, const char *text) : QDialog(parent, name, TRUE) { 19InputBox::InputBox(QWidget *parent, const char *name, const char *, const char *) : QDialog(parent, name, TRUE) {
20 // setCaption(caption); 20 // setCaption(caption);
21// 21//
22 // question = new QLabel(this); 22 // question = new QLabel(this);
23 // question->setText(text); 23 // question->setText(text);
24 // question->setGeometry(10, 10, 240, 50); 24 // question->setGeometry(10, 10, 240, 50);
25// 25//
26 // input = new QLineEdit(this); 26 // input = new QLineEdit(this);
27// input->setGeometry(10, 60, 240, 30); 27// input->setGeometry(10, 60, 240, 30);
28 // input->setFocus(); 28 // input->setFocus();
29 // input->setMaxLength(19); 29 // input->setMaxLength(19);
30// 30//
31// ok = new QPushButton( "Ok", this ); 31// ok = new QPushButton( "Ok", this );
32// ok->setGeometry(10, 100, 100,30 ); 32// ok->setGeometry(10, 100, 100,30 );
33 // ok->setDefault(TRUE); 33 // ok->setDefault(TRUE);
34// connect( ok, SIGNAL(clicked()), SLOT(accept()) ); 34// connect( ok, SIGNAL(clicked()), SLOT(accept()) );
35// 35//
36// cancel = new QPushButton( "Cancel", this ); 36// cancel = new QPushButton( "Cancel", this );
37// cancel->setGeometry(150, 100, 100,30 ); 37// cancel->setGeometry(150, 100, 100,30 );
38// connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); 38// connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
39} 39}
40 40
41InputBox::~InputBox(){ 41InputBox::~InputBox(){
42 delete ok; 42 delete ok;
43 delete cancel; 43 delete cancel;
44 delete question; 44 delete question;
45 delete input; 45 delete input;
46} 46}
47 47
diff --git a/noncore/games/kbill/kbill.h b/noncore/games/kbill/kbill.h
index fbc0c6c..da1a111 100644
--- a/noncore/games/kbill/kbill.h
+++ b/noncore/games/kbill/kbill.h
@@ -19,36 +19,38 @@
19#define KBILL_H 19#define KBILL_H
20 20
21 21
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qpopupmenu.h> 25#include <qpopupmenu.h>
26 26
27#include "field.h" 27#include "field.h"
28 28
29class KBill : public QMainWindow 29class KBill : public QMainWindow
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 public: 32public:
33 KBill(); 33 KBill();
34 ~KBill(); 34 ~KBill();
35 Field* getField(); 35 Field* getField();
36 private: 36private:
37 QMenuBar *menu; 37 QMenuBar *menu;
38 QPopupMenu *file, *help; 38 QPopupMenu *file, *help;
39 Field *field; 39 Field *field;
40 int pauseid; 40 int pauseid;
41 protected slots: 41
42 void Quit(); 42protected slots:
43 void About(); 43 void Quit();
44 void NewGame(); 44 void About();
45 void Pause(); 45 void NewGame();
46 void WarpTo(); 46 void Pause();
47 void Story(); 47 void WarpTo();
48 void Rules(); 48 void Story();
49 void ViewHighScores(); 49 void Rules();
50 50 void ViewHighScores();
51 friend class UI; 51
52protected:
53 friend class UI;
52}; 54};
53 55
54#endif 56#endif
diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp
index 4fab0f6..04ad825 100644
--- a/noncore/games/zsame/ZSameWidget.cpp
+++ b/noncore/games/zsame/ZSameWidget.cpp
@@ -100,32 +100,32 @@ ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl )
100 100
101 sizeChanged(); 101 sizeChanged();
102 setCentralWidget(stone); 102 setCentralWidget(stone);
103 103
104 104
105 setScore(0); 105 setScore(0);
106} 106}
107 107
108ZSameWidget::~ZSameWidget() { 108ZSameWidget::~ZSameWidget() {
109 109
110} 110}
111 111
112void ZSameWidget::readProperties(Config *conf) { 112void ZSameWidget::readProperties(Config *) {
113/* 113/*
114 Q_ASSERT(conf); 114 Q_ASSERT(conf);
115 stone->readProperties(conf); 115 stone->readProperties(conf);
116*/ 116*/
117} 117}
118 118
119void ZSameWidget::saveProperties(Config *conf) { 119void ZSameWidget::saveProperties(Config *) {
120/* 120/*
121 Q_ASSERT(conf); 121 Q_ASSERT(conf);
122 stone->saveProperties(conf); 122 stone->saveProperties(conf);
123 conf->sync(); 123 conf->sync();
124*/ 124*/
125} 125}
126 126
127void ZSameWidget::sizeChanged() { 127void ZSameWidget::sizeChanged() {
128 //stone->setFixedSize(stone->sizeHint()); 128 //stone->setFixedSize(stone->sizeHint());
129} 129}
130 130
131void ZSameWidget::newGame(unsigned int board,int colors) { 131void ZSameWidget::newGame(unsigned int board,int colors) {
@@ -180,42 +180,42 @@ void ZSameWidget::m_showhs() {
180void ZSameWidget::m_quit() { 180void ZSameWidget::m_quit() {
181// Q_ASSERT(stone); 181// Q_ASSERT(stone);
182 stone->unmark(); 182 stone->unmark();
183 qApp->quit(); 183 qApp->quit();
184// delete this; 184// delete this;
185} 185}
186 186
187void ZSameWidget::m_tglboard() { 187void ZSameWidget::m_tglboard() {
188 //kdDebug() << "toggled" << endl; 188 //kdDebug() << "toggled" << endl;
189} 189}
190 190
191 191
192void ZSameWidget::setColors(int colors) { 192void ZSameWidget::setColors(int ) {
193 //status->changeItem(i18n("%1 Colors").arg(colors),1); 193 //status->changeItem(i18n("%1 Colors").arg(colors),1);
194} 194}
195 195
196void ZSameWidget::setBoard(int board) { 196void ZSameWidget::setBoard(int ) {
197 //status->changeItem(i18n("Board: %1").arg(board, 6), 2); 197 //status->changeItem(i18n("Board: %1").arg(board, 6), 2);
198} 198}
199 199
200void ZSameWidget::setMarked(int m) { 200void ZSameWidget::setMarked(int ) {
201// status->changeItem(i18n("Marked: %1").arg(m, 6),3); 201// status->changeItem(i18n("Marked: %1").arg(m, 6),3);
202} 202}
203 203
204void ZSameWidget::stonesRemoved(int,int) { 204void ZSameWidget::stonesRemoved(int,int) {
205 //KNotifyClient::event("stones removed", 205 //KNotifyClient::event("stones removed",
206 // i18n("%1 stones removed.").arg(stone->marked())); 206 // i18n("%1 stones removed.").arg(stone->marked()));
207} 207}
208 208
209void ZSameWidget::setScore(int score) { 209void ZSameWidget::setScore(int ) {
210// status->changeItem(i18n("Score: %1").arg(score, 6),4); 210// status->changeItem(i18n("Score: %1").arg(score, 6),4);
211// undo->setEnabled(stone->undoPossible()); 211// undo->setEnabled(stone->undoPossible());
212// restart->setEnabled(!stone->isOriginalBoard()); 212// restart->setEnabled(!stone->isOriginalBoard());
213} 213}
214 214
215void ZSameWidget::gameover() { 215void ZSameWidget::gameover() {
216// kdDebug() << "GameOver" << endl; 216// kdDebug() << "GameOver" << endl;
217 if (stone->hasBonus()) { 217 if (stone->hasBonus()) {
218 QMessageBox::information(this,i18n("Game won"), 218 QMessageBox::information(this,i18n("Game won"),
219 i18n("<qt>You even removed the last stone, great job! " 219 i18n("<qt>You even removed the last stone, great job! "
220 "This gave you a score of %1 in total.</qt>").arg(stone->score())); 220 "This gave you a score of %1 in total.</qt>").arg(stone->score()));
221 } else { 221 } else {