summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/decorations/flat/flat.cpp4
-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
8 files changed, 53 insertions, 50 deletions
diff --git a/noncore/decorations/flat/flat.cpp b/noncore/decorations/flat/flat.cpp
index a2f12be..9a670cc 100644
--- a/noncore/decorations/flat/flat.cpp
+++ b/noncore/decorations/flat/flat.cpp
@@ -277,25 +277,25 @@ void FlatDecoration::drawArea( Area a, QPainter *p, const WindowData *wd ) const
break;
case TitleText:
p->drawText( r.left()+3+metric(HelpWidth,wd), r.top()-th,
r.width()-metric(HelpWidth,wd)-metric(CloseWidth,wd), th,
Qt::AlignVCenter, wd->caption );
break;
default:
FlatDecoration::drawArea( a, p, wd );
break;
}
}
-void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int w, int h, QWSButton::State state ) const
+void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const
{
QColor c;
const QColorGroup &cg = wd->palette.active();
if ( wd->flags & WindowDecorationInterface::WindowData::Active )
c = cg.color(QColorGroup::HighlightedText);
else
c = cg.color(QColorGroup::Foreground);
bool r = (state & QWSButton::MouseOver) && (state & QWSButton::Clicked);
int th = metric(TitleHeight, wd);
QString key( "%1-%2-%3-%4" );
key = key.arg(b).arg(th).arg(c.name()).arg(r ? "1" : "0");
@@ -312,25 +312,25 @@ void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, in
case Help:
tmp = QImage( help_xpm );
break;
case Maximize:
tmp = QImage( maximize_xpm );
break;
}
colorize( tmp, c, r );
img = new QImage( scaleButton(tmp,th) );
FlatDecoration *that = (FlatDecoration *)this;
that->buttonCache.insert( key, img, 1 );
}
-
+
p->drawImage( x, y, *img );
}
QRegion FlatDecoration::mask( const WindowData *wd ) const
{
return WindowDecorationInterface::mask( wd );
}
QString FlatDecoration::name() const
{
return qApp->translate( "Decoration", "Flat" );
}
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 @@
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
using namespace Opie::Core;
/* QT */
#include <qtimer.h>
/* STD */
#include <stdlib.h>
-#define TILE_SIZE 9
+#define TILE_SIZE 9
#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
@@ -58,25 +58,25 @@ void Arrow::update()
{
if ( m_vertical )
setFrame( 0 );
else
setFrame( 1 );
}
void Arrow::changeDirection()
{
m_vertical = ! m_vertical;
update();
}
-
+
Ball::Ball(QCanvasPixmapArray* array, QCanvas* canvas)
: QCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
{
}
void Ball::update()
{
m_animDelay--;
if ( m_animDelay<=0 )
{
m_animDelay = MS2TICKS(BALL_ANIM_DELAY);
@@ -91,50 +91,50 @@ void Ball::update()
void Ball::advance(int stage)
{
bool reflectX = false;
bool reflectY = false;
// 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
QRect r = boundingRect();
- r.moveBy( xVelocity(), yVelocity() );
+ r.moveBy( static_cast<int>(xVelocity()), static_cast<int>( 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() );
// update field
update();
QCanvasSprite::advance( stage );
}
bool Ball::collide( double dx, double dy )
{
QRect r = boundingRect();
- r.moveBy( dx, dy );
+ r.moveBy( static_cast<int>( dx ), static_cast<int>( 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 );
}
/*************************************************************************/
@@ -290,25 +290,25 @@ void JezzView::changeCursor()
else
{
setCursor( sizeHorCursor );
}
}
/*************************************************************************/
JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
: QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
{
- QString path = QPEApplication::qpeDir()+"pics/bounce/";
+ QString path = QPEApplication::qpeDir()+"pics/bounce/";
// load gfx
m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 );
for ( unsigned n=0; n < m_ballPixmaps->count(); n++ )
m_ballPixmaps->image(n)->setOffset( 0, 0 );
m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 );
for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ )
m_arrowPixmaps->image(n)->setOffset( 0, 0 );
QPixmap tiles( path + "tiles.png" );
@@ -338,25 +338,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
// create balls
for ( int n=0; n<ballNum; n++ )
{
Ball *ball = new Ball( m_ballPixmaps, m_field );
m_balls.append( ball );
ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 );
ball->setFrame( rand() % 25 );
ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ),
4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) );
ball->show();
}
-
+
// create arrow
arrow = new Arrow( m_arrowPixmaps, m_field );
arrow->show();
// create text label
m_text = new QCanvasText( m_field );
// create game clock
m_clock = new QTimer( this );
connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
m_clock->start( GAME_DELAY );
@@ -365,25 +365,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
}
JezzGame::~JezzGame()
{
m_balls.clear();
delete m_view;
delete m_field;
delete m_ballPixmaps;
}
void JezzGame::display( QString text, int size )
{
- odebug << "This function \"display\" shouldn't be called!!!" << oendl;
+ odebug << "This function \"display\" shouldn't be called!!!" << oendl;
if ( !text.isEmpty() )
{
QFont font( "Helvetica", size, QFont::Bold );
font.setStyleHint( QFont::Helvetica );
m_text->setFont( font );
m_text->setText( text );
QRect size = m_text->boundingRect();
m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
m_text->show();
@@ -404,25 +404,26 @@ void JezzGame::stop()
}
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 );
+ fill( static_cast<int>( ball->x()/TILE_SIZE ),
+ static_cast<int>( 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();
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() {
exit(0);
}
void Game::update_info() {
static char str[80];
sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d",
bill.on_screen, bill.off_screen, net.base, net.off,
net.win, level, score);
ui.draw_str(str, 5, scrheight-5);
efficiency += ((100*net.base-10*net.win)/net.units);
}
-
+
void Game::update_score (int action) {
switch (action){
case ENDLEVEL: score+=(level*efficiency/iteration); break;
default: score+=(action*action*BILLPOINTS);
}
}
void Game::warp_to_level (unsigned int lev) {
if (state==PLAYING) {
if (lev <= level) return;
setup_level(lev);
}
else {
- if (lev<=0) return;
+ if (lev <=0) return;
start(lev);
}
}
void Game::button_press(int x, int y) {
int i, counter=0, flag=0;
if (state != PLAYING) return;
ui.set_cursor(DOWNC);
if (bucket.clicked(x, y)) {
ui.set_cursor(BUCKETC);
grabbed = BUCKET;
}
@@ -90,25 +90,25 @@ void Game::button_press(int x, int y) {
|| bill.list[i].state == bill.list[i].DYING)
continue;
if (bill.list[i].state == bill.list[i].STRAY &&
bill.list[i].clickedstray(x, y))
{
ui.set_cursor (bill.list[i].cargo);
grabbed = i;
flag = 1;
}
else if (bill.list[i].state != bill.list[i].STRAY &&
bill.list[i].clicked(x, y))
{
- if (bill.list[i].state == bill.list[i].AT)
+ if (bill.list[i].state == bill.list[i].AT)
net.computers[bill.list[i].target_c].busy=0;
bill.list[i].index = -1;
bill.list[i].cels = bill.dcels;
bill.list[i].x_offset = -2;
bill.list[i].y_offset = -15;
bill.list[i].state = bill.list[i].DYING;
counter++;
}
}
if (counter) update_score(counter);
}
@@ -122,44 +122,44 @@ void Game::button_release(int x, int y) {
for (i=0; i<net.ncables; i++)
if (net.cables[i].onspark(x, y)) {
net.cables[i].active=0;
net.cables[i].delay = spark.delay(level);
}
return;
}
for (i=0; i<net.units; i++)
if (net.computers[i].oncomputer(x, y)
&&
net.computers[i].compatible (bill.list[grabbed].cargo)
&&
- (net.computers[i].os == OS.WINGDOWS ||
+ (net.computers[i].os == OS.WINGDOWS ||
net.computers[i].os == OS.OFF))
{
- net.base++;
+ net.base++;
if (net.computers[i].os == OS.WINGDOWS)
net.win--;
else
net.off--;
net.computers[i].os = bill.list[grabbed].cargo;
bill.list[grabbed].state = bill.list[grabbed].OFF;
grabbed = EMPTY;
return;
}
grabbed = EMPTY;
-}
+}
void Game::update() {
switch (state) {
case PLAYING:
- ui.clear();
+ ui.clear();
bucket.draw();
net.update();
net.draw();
bill.update();
bill.draw();
update_info();
if (!(bill.on_screen+bill.off_screen)) {
update_score(ENDLEVEL);
state = BETWEEN;
}
if ((net.base+net.off)<=1) state = END;
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 @@
#ifndef GAME_H
#define GAME_H
#include "objects.h"
class Game {
- unsigned state;
+ int state;
int efficiency;
public:
unsigned score, level, iteration;
Picture logo;
int grabbed;
static const unsigned short scrwidth = 240;
static const unsigned short scrheight = 290;
static const int PLAYING = 1;
static const int BETWEEN = 2;
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() {
void Field::startTimer() {
playing = true;
if (!timer->isActive())
timer->start(250, FALSE);
}
void Field::Timer(){
game.update();
}
void Field::paintEvent(QPaintEvent *) {
bitBlt(this, 0, 0, pix);
-} \ No newline at end of file
+}
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 @@
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "inputbox.h"
-InputBox::InputBox(QWidget *parent, const char *name, const char *caption, const char *text) : QDialog(parent, name, TRUE) {
+InputBox::InputBox(QWidget *parent, const char *name, const char *, const char *) : QDialog(parent, name, TRUE) {
// setCaption(caption);
-//
+//
// question = new QLabel(this);
// question->setText(text);
// question->setGeometry(10, 10, 240, 50);
-//
+//
// input = new QLineEdit(this);
// input->setGeometry(10, 60, 240, 30);
// input->setFocus();
// input->setMaxLength(19);
-//
+//
// ok = new QPushButton( "Ok", this );
// ok->setGeometry(10, 100, 100,30 );
// ok->setDefault(TRUE);
// connect( ok, SIGNAL(clicked()), SLOT(accept()) );
-//
+//
// cancel = new QPushButton( "Cancel", this );
// cancel->setGeometry(150, 100, 100,30 );
// connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
}
InputBox::~InputBox(){
delete ok;
delete cancel;
delete question;
delete input;
}
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 @@
#define KBILL_H
#include <qmainwindow.h>
#include <qwidget.h>
#include <qpopupmenu.h>
#include "field.h"
class KBill : public QMainWindow
{
- Q_OBJECT
- public:
+ Q_OBJECT
+public:
KBill();
- ~KBill();
- Field* getField();
- private:
- QMenuBar *menu;
- QPopupMenu *file, *help;
- Field *field;
- int pauseid;
- protected slots:
- void Quit();
- void About();
- void NewGame();
- void Pause();
- void WarpTo();
- void Story();
- void Rules();
- void ViewHighScores();
-
- friend class UI;
+ ~KBill();
+ Field* getField();
+private:
+ QMenuBar *menu;
+ QPopupMenu *file, *help;
+ Field *field;
+ int pauseid;
+
+protected slots:
+ void Quit();
+ void About();
+ void NewGame();
+ void Pause();
+ void WarpTo();
+ void Story();
+ void Rules();
+ void ViewHighScores();
+
+protected:
+ friend class UI;
};
#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 )
sizeChanged();
setCentralWidget(stone);
setScore(0);
}
ZSameWidget::~ZSameWidget() {
}
-void ZSameWidget::readProperties(Config *conf) {
+void ZSameWidget::readProperties(Config *) {
/*
Q_ASSERT(conf);
stone->readProperties(conf);
*/
}
-void ZSameWidget::saveProperties(Config *conf) {
+void ZSameWidget::saveProperties(Config *) {
/*
Q_ASSERT(conf);
stone->saveProperties(conf);
conf->sync();
*/
}
void ZSameWidget::sizeChanged() {
// stone->setFixedSize(stone->sizeHint());
}
void ZSameWidget::newGame(unsigned int board,int colors) {
@@ -180,42 +180,42 @@ void ZSameWidget::m_showhs() {
void ZSameWidget::m_quit() {
// Q_ASSERT(stone);
stone->unmark();
qApp->quit();
// delete this;
}
void ZSameWidget::m_tglboard() {
// kdDebug() << "toggled" << endl;
}
-void ZSameWidget::setColors(int colors) {
+void ZSameWidget::setColors(int ) {
// status->changeItem(i18n("%1 Colors").arg(colors),1);
}
-void ZSameWidget::setBoard(int board) {
+void ZSameWidget::setBoard(int ) {
// status->changeItem(i18n("Board: %1").arg(board, 6), 2);
}
-void ZSameWidget::setMarked(int m) {
+void ZSameWidget::setMarked(int ) {
// status->changeItem(i18n("Marked: %1").arg(m, 6),3);
}
void ZSameWidget::stonesRemoved(int,int) {
// KNotifyClient::event("stones removed",
// i18n("%1 stones removed.").arg(stone->marked()));
}
-void ZSameWidget::setScore(int score) {
+void ZSameWidget::setScore(int ) {
// status->changeItem(i18n("Score: %1").arg(score, 6),4);
// undo->setEnabled(stone->undoPossible());
// restart->setEnabled(!stone->isOriginalBoard());
}
void ZSameWidget::gameover() {
// kdDebug() << "GameOver" << endl;
if (stone->hasBonus()) {
QMessageBox::information(this,i18n("Game won"),
i18n("<qt>You even removed the last stone, great job! "
"This gave you a score of %1 in total.</qt>").arg(stone->score()));
} else {