summaryrefslogtreecommitdiff
path: root/noncore/games/parashoot
Unidiff
Diffstat (limited to 'noncore/games/parashoot') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/parashoot/base.cpp5
-rw-r--r--noncore/games/parashoot/bullet.cpp5
-rw-r--r--noncore/games/parashoot/cannon.cpp5
-rw-r--r--noncore/games/parashoot/helicopter.cpp4
-rw-r--r--noncore/games/parashoot/interface.cpp10
-rw-r--r--noncore/games/parashoot/man.cpp7
6 files changed, 18 insertions, 18 deletions
diff --git a/noncore/games/parashoot/base.cpp b/noncore/games/parashoot/base.cpp
index 5f3c79d..f232536 100644
--- a/noncore/games/parashoot/base.cpp
+++ b/noncore/games/parashoot/base.cpp
@@ -1,58 +1,57 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "codes.h" 20#include "codes.h"
21#include "base.h" 21#include "base.h"
22 22
23#include <qtopia/resource.h> 23#include <opie2/oresource.h>
24
25 24
26int damage; 25int damage;
27 26
28Base::Base(QCanvas* canvas) : 27Base::Base(QCanvas* canvas) :
29 QCanvasSprite(0, canvas), 28 QCanvasSprite(0, canvas),
30 kaboom("landmine"), 29 kaboom("landmine"),
31 ohdear("crmble01") 30 ohdear("crmble01")
32{ 31{
33 basearray = new QCanvasPixmapArray(); 32 basearray = new QCanvasPixmapArray();
34 QString b0 = Resource::findPixmap("parashoot/b0001"); 33 QString b0 = Opie::Core::OResource::findPixmap("parashoot/b0001");
35 b0.replace(QRegExp("0001"),"%1"); 34 b0.replace(QRegExp("0001"),"%1");
36 basearray->readPixmaps(b0, 4); 35 basearray->readPixmaps(b0, 4);
37 setSequence(basearray); 36 setSequence(basearray);
38 setFrame(0); 37 setFrame(0);
39 move(2, canvas->height()-50); 38 move(2, canvas->height()-50);
40 setZ(10); 39 setZ(10);
41 show(); 40 show();
42 damage = 0; 41 damage = 0;
43} 42}
44 43
45void Base::damageBase() 44void Base::damageBase()
46{ 45{
47 damage++; 46 damage++;
48 47
49 switch(damage) { 48 switch(damage) {
50 case 1: setFrame(1); ohdear.play(); break; 49 case 1: setFrame(1); ohdear.play(); break;
51 case 2: setFrame(2); ohdear.play(); break; 50 case 2: setFrame(2); ohdear.play(); break;
52 case 3: setFrame(3); kaboom.play(); break; 51 case 3: setFrame(3); kaboom.play(); break;
53 } 52 }
54 show(); 53 show();
55} 54}
56 55
57bool Base::baseDestroyed() 56bool Base::baseDestroyed()
58{ 57{
diff --git a/noncore/games/parashoot/bullet.cpp b/noncore/games/parashoot/bullet.cpp
index 584f564..1f02251 100644
--- a/noncore/games/parashoot/bullet.cpp
+++ b/noncore/games/parashoot/bullet.cpp
@@ -2,61 +2,62 @@
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "codes.h" 21#include "codes.h"
22#include "bullet.h" 22#include "bullet.h"
23#include "man.h" 23#include "man.h"
24#include "helicopter.h" 24#include "helicopter.h"
25 25
26#include <qpe/resource.h> 26#include <opie2/oresource.h>
27
27#include <qpe/qmath.h> 28#include <qpe/qmath.h>
28 29
29 30
30int limit; 31int limit;
31int shotcount; 32int shotcount;
32int nobullets; 33int nobullets;
33 34
34Bullet::Bullet(QCanvas* canvas, double angle, int cannonx, int cannony) : 35Bullet::Bullet(QCanvas* canvas, double angle, int cannonx, int cannony) :
35 QCanvasSprite(0, canvas), 36 QCanvasSprite(0, canvas),
36 bang("collide01") 37 bang("collide01")
37{ 38{
38 QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Resource::findPixmap("parashoot/bullet")); 39 QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Opie::Core::OResource::findPixmap("parashoot/bullet"));
39 setSequence(bulletarray); 40 setSequence(bulletarray);
40 if (nobullets < limit) { 41 if (nobullets < limit) {
41 nobullets++; 42 nobullets++;
42 move(cannonx, cannony); 43 move(cannonx, cannony);
43 dy = 0; 44 dy = 0;
44 dx = 0; 45 dx = 0;
45 show(); 46 show();
46 setXY(angle); 47 setXY(angle);
47 setVelocity(-dx, -dy); 48 setVelocity(-dx, -dy);
48 bang.play(); 49 bang.play();
49 } else 50 } else
50 return; 51 return;
51} 52}
52 53
53void Bullet::setXY(double angle) 54void Bullet::setXY(double angle)
54{ 55{
55 double ang = angle; 56 double ang = angle;
56 if ( (y() < 0) || (x() < 0) || (y() > canvas()->height()) || 57 if ( (y() < 0) || (x() < 0) || (y() > canvas()->height()) ||
57 (x() > canvas()->width()) ) 58 (x() > canvas()->width()) )
58 delete this; 59 delete this;
59 else { 60 else {
60 double radians = 0; 61 double radians = 0;
61 radians = ang * 3.14159265/180; 62 radians = ang * 3.14159265/180;
62 dx = (qCos(radians)) *7; 63 dx = (qCos(radians)) *7;
diff --git a/noncore/games/parashoot/cannon.cpp b/noncore/games/parashoot/cannon.cpp
index 330d850..2f4c353 100644
--- a/noncore/games/parashoot/cannon.cpp
+++ b/noncore/games/parashoot/cannon.cpp
@@ -1,59 +1,58 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qtopia/resource.h> 21#include <opie2/oresource.h>
22
23 22
24#include "codes.h" 23#include "codes.h"
25#include "cannon.h" 24#include "cannon.h"
26 25
27Cannon::Cannon(QCanvas* canvas) : 26Cannon::Cannon(QCanvas* canvas) :
28 QCanvasSprite(0, canvas) 27 QCanvasSprite(0, canvas)
29{ 28{
30shotsfired=0; 29shotsfired=0;
31 index = 8; 30 index = 8;
32 cannonx = 0; 31 cannonx = 0;
33 cannony = 0; 32 cannony = 0;
34 cannonarray = new QCanvasPixmapArray(); 33 cannonarray = new QCanvasPixmapArray();
35 QString c0 = Resource::findPixmap("parashoot/can0001"); 34 QString c0 = Opie::Core::OResource::findPixmap("parashoot/can0001");
36 c0.replace(QRegExp("0001"),"%1"); 35 c0.replace(QRegExp("0001"),"%1");
37 cannonarray->readPixmaps(c0,17); 36 cannonarray->readPixmaps(c0,17);
38 setSequence(cannonarray); 37 setSequence(cannonarray);
39 setFrame(index); 38 setFrame(index);
40 39
41 reposition(); 40 reposition();
42 41
43 movedir = NoDir; 42 movedir = NoDir;
44 moveDelay = 0; 43 moveDelay = 0;
45 setAnimated(TRUE); 44 setAnimated(TRUE);
46 show(); 45 show();
47} 46}
48 47
49void Cannon::advance(int stage) 48void Cannon::advance(int stage)
50{ 49{
51 if ( stage == 1 && moveDelay-- == 0 ) { 50 if ( stage == 1 && moveDelay-- == 0 ) {
52 if (movedir == Left) { 51 if (movedir == Left) {
53 if (index > 0) { 52 if (index > 0) {
54 setFrame(index-1); 53 setFrame(index-1);
55 index--; 54 index--;
56 } 55 }
57 } 56 }
58 if (movedir == Right) { 57 if (movedir == Right) {
59 if (index < 16) { 58 if (index < 16) {
diff --git a/noncore/games/parashoot/helicopter.cpp b/noncore/games/parashoot/helicopter.cpp
index 7d91cd1..42adc34 100644
--- a/noncore/games/parashoot/helicopter.cpp
+++ b/noncore/games/parashoot/helicopter.cpp
@@ -1,61 +1,61 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "helicopter.h" 21#include "helicopter.h"
22#include "man.h" 22#include "man.h"
23#include "codes.h" 23#include "codes.h"
24 24
25#include <qtopia/resource.h> 25#include <opie2/oresource.h>
26 26
27 27
28static QList<Helicopter> all; 28static QList<Helicopter> all;
29 29
30Helicopter::Helicopter(QCanvas* canvas) : 30Helicopter::Helicopter(QCanvas* canvas) :
31 QCanvasSprite(0, canvas), 31 QCanvasSprite(0, canvas),
32 chikachika("aland01") 32 chikachika("aland01")
33{ 33{
34 all.append(this); 34 all.append(this);
35 hits = 0; 35 hits = 0;
36 QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray(); 36 QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray();
37 QString h0 = Resource::findPixmap("parashoot/helicopter0001"); 37 QString h0 = Opie::Core::OResource::findPixmap("parashoot/helicopter0001");
38 h0.replace(QRegExp("0001"),"%1"); 38 h0.replace(QRegExp("0001"),"%1");
39 helicopterarray->readPixmaps(h0,4 ); 39 helicopterarray->readPixmaps(h0,4 );
40 40
41 setSequence(helicopterarray); 41 setSequence(helicopterarray);
42 setAnimated(true); 42 setAnimated(true);
43 move(canvas->width(), 5); 43 move(canvas->width(), 5);
44 setVelocity(-2, 0); 44 setVelocity(-2, 0);
45 chikachika.playLoop(); 45 chikachika.playLoop();
46 show(); 46 show();
47} 47}
48 48
49Helicopter::~Helicopter() 49Helicopter::~Helicopter()
50{ 50{
51 all.remove(this); 51 all.remove(this);
52} 52}
53 53
54int fr = 0; 54int fr = 0;
55 55
56void Helicopter::advance(int phase) 56void Helicopter::advance(int phase)
57{ 57{
58 QCanvasSprite::advance(phase); 58 QCanvasSprite::advance(phase);
59 if (phase == 0) { 59 if (phase == 0) {
60 if (frame() == 3) { 60 if (frame() == 3) {
61 delete this; 61 delete this;
diff --git a/noncore/games/parashoot/interface.cpp b/noncore/games/parashoot/interface.cpp
index 5c9b0ef..8ec7032 100644
--- a/noncore/games/parashoot/interface.cpp
+++ b/noncore/games/parashoot/interface.cpp
@@ -1,106 +1,108 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "interface.h" 21#include "interface.h"
22#include "man.h" 22#include "man.h"
23 23
24#include <opie2/oresource.h>
25
24#include <qtopia/qpeapplication.h> 26#include <qtopia/qpeapplication.h>
25#include <qtopia/resource.h>
26 27
27#include <qtoolbar.h> 28#include <qtoolbar.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29 30
30ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : 31ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) :
31 QMainWindow(parent,name,f), 32 QMainWindow(parent,name,f),
32 canvas( 232, 258 ), 33 canvas( 232, 258 ),
33 cannon(NULL), 34 cannon(NULL),
34 base(NULL), 35 base(NULL),
35 gamestopped( true ), 36 gamestopped( true ),
36 waitover( false ), 37 waitover( false ),
37 fanfare("level_up"), 38 fanfare("level_up"),
38 score(0) 39 score(0)
39{ 40{
40 QPEApplication::grabKeyboard(); 41 QPEApplication::grabKeyboard();
41 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); 42 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
42 43
43 updatespeed = 80; 44 updatespeed = 80;
44 canvas.setAdvancePeriod(80); 45 canvas.setAdvancePeriod(80);
45 46
46 pb = new QCanvasView(&canvas, this); 47 pb = new QCanvasView(&canvas, this);
47 pb->setFocus(); 48 pb->setFocus();
48 49
49 setToolBarsMovable( FALSE ); 50 setToolBarsMovable( FALSE );
50 51
51 QToolBar* toolbar = new QToolBar(this); 52 QToolBar* toolbar = new QToolBar(this);
52 toolbar->setHorizontalStretchable( TRUE ); 53 toolbar->setHorizontalStretchable( TRUE );
53 54
54 setCaption( tr("ParaShoot") ); 55 setCaption( tr("ParaShoot") );
55 new QToolButton( Resource::loadIconSet("new"), tr("New Game"), 0, 56 QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
56 this, SLOT(newGame()), toolbar, "New Game"); 57 tr("New Game"), 0, this, SLOT(newGame()), toolbar, "New Game");
58 btn->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
57 59
58 levelscore = new QLabel(toolbar); 60 levelscore = new QLabel(toolbar);
59 levelscore->setBackgroundMode( PaletteButton ); 61 levelscore->setBackgroundMode( PaletteButton );
60 levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); 62 levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs );
61 toolbar->setStretchableWidget( levelscore ); 63 toolbar->setStretchableWidget( levelscore );
62 showScore(0,0); 64 showScore(0,0);
63 65
64 setCentralWidget(pb); 66 setCentralWidget(pb);
65 67
66 autoDropTimer = new QTimer(this); 68 autoDropTimer = new QTimer(this);
67 connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) ); 69 connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) );
68 70
69 pauseTimer = new QTimer(this); 71 pauseTimer = new QTimer(this);
70 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); 72 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
71 73
72 setFocusPolicy(StrongFocus); 74 setFocusPolicy(StrongFocus);
73} 75}
74 76
75 77
76void ParaShoot::resizeEvent(QResizeEvent *) 78void ParaShoot::resizeEvent(QResizeEvent *)
77{ 79{
78 QSize s = centralWidget()->size(); 80 QSize s = centralWidget()->size();
79 int fw = style().defaultFrameWidth(); 81 int fw = style().defaultFrameWidth();
80 canvas.resize( s.width() - fw - 2, s.height() - fw - 2); 82 canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
81 83
82 QImage bgimage = Resource::loadImage("parashoot/sky"); 84 QImage bgimage = Opie::Core::OResource::loadImage("parashoot/sky");
83 QPixmap bgpixmap; 85 QPixmap bgpixmap;
84 86
85 bgpixmap.convertFromImage(bgimage.smoothScale(canvas.width(), 87 bgpixmap.convertFromImage(bgimage.smoothScale(canvas.width(),
86 canvas.height()), QPixmap::Auto); 88 canvas.height()), QPixmap::Auto);
87 canvas.setBackgroundPixmap(bgpixmap); 89 canvas.setBackgroundPixmap(bgpixmap);
88 90
89 if (base) { 91 if (base) {
90 base->reposition(); 92 base->reposition();
91 } 93 }
92 94
93 if (cannon) { 95 if (cannon) {
94 cannon->reposition(); 96 cannon->reposition();
95 } 97 }
96} 98}
97 99
98void ParaShoot::focusOutEvent (QFocusEvent *) 100void ParaShoot::focusOutEvent (QFocusEvent *)
99{ 101{
100 if (!gamestopped) 102 if (!gamestopped)
101 canvas.setAdvancePeriod(-1); 103 canvas.setAdvancePeriod(-1);
102} 104}
103 105
104void ParaShoot::focusInEvent (QFocusEvent *) 106void ParaShoot::focusInEvent (QFocusEvent *)
105{ 107{
106 if (!gamestopped) 108 if (!gamestopped)
diff --git a/noncore/games/parashoot/man.cpp b/noncore/games/parashoot/man.cpp
index 0a151b0..080615e 100644
--- a/noncore/games/parashoot/man.cpp
+++ b/noncore/games/parashoot/man.cpp
@@ -1,74 +1,73 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "codes.h" 21#include "codes.h"
22#include "man.h" 22#include "man.h"
23#include "base.h" 23#include "base.h"
24 24
25#include <qtopia/resource.h> 25#include <opie2/oresource.h>
26
27 26
28int mancount; 27int mancount;
29 28
30Man::Man(QCanvas* canvas) : 29Man::Man(QCanvas* canvas) :
31 QCanvasSprite(0, canvas), 30 QCanvasSprite(0, canvas),
32 splat("lose") // No tr 31 splat("lose") // No tr
33{ 32{
34 manarray = new QCanvasPixmapArray(); 33 manarray = new QCanvasPixmapArray();
35 QString m0 = Resource::findPixmap("parashoot/man0001"); 34 QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001");
36 m0.replace(QRegExp("0001"),"%1"); 35 m0.replace(QRegExp("0001"),"%1");
37 manarray->readPixmaps(m0, 7); 36 manarray->readPixmaps(m0, 7);
38 setSequence(manarray); 37 setSequence(manarray);
39 setAnimated(true); 38 setAnimated(true);
40 mancount++; 39 mancount++;
41 dead = false; 40 dead = false;
42 start(); 41 start();
43} 42}
44 43
45Man::Man(QCanvas* canvas, int x, int y) : 44Man::Man(QCanvas* canvas, int x, int y) :
46 QCanvasSprite(0, canvas), 45 QCanvasSprite(0, canvas),
47 splat("bang") // No tr 46 splat("bang") // No tr
48{ 47{
49 manarray = new QCanvasPixmapArray(); 48 manarray = new QCanvasPixmapArray();
50 QString m0 = Resource::findPixmap("parashoot/man0001"); 49 QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001");
51 m0.replace(QString("0001"),"%1"); 50 m0.replace(QString("0001"),"%1");
52 manarray->readPixmaps(m0, 7); 51 manarray->readPixmaps(m0, 7);
53 setSequence(manarray); 52 setSequence(manarray);
54 move(x, y); 53 move(x, y);
55 setFrame(5); 54 setFrame(5);
56 setZ(300); 55 setZ(300);
57 show(); 56 show();
58 57
59 static bool first_time = TRUE; 58 static bool first_time = TRUE;
60 if (first_time) { 59 if (first_time) {
61 first_time = FALSE; 60 first_time = FALSE;
62 QTime midnight(0, 0, 0); 61 QTime midnight(0, 0, 0);
63 srand(midnight.secsTo(QTime::currentTime()) ); 62 srand(midnight.secsTo(QTime::currentTime()) );
64 } 63 }
65 int yfallspeed = 0; 64 int yfallspeed = 0;
66 yfallspeed = (rand() % 3) + 1; 65 yfallspeed = (rand() % 3) + 1;
67 setVelocity(0, yfallspeed); 66 setVelocity(0, yfallspeed);
68 67
69 mancount++; 68 mancount++;
70 dead = false; 69 dead = false;
71} 70}
72int f = 0; 71int f = 0;
73 72
74void Man::advance(int phase) 73void Man::advance(int phase)