summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kpacman/score.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/kpacman/score.cpp b/noncore/games/kpacman/score.cpp
index b3ff3d9..e91771b 100644
--- a/noncore/games/kpacman/score.cpp
+++ b/noncore/games/kpacman/score.cpp
@@ -1,111 +1,111 @@
1 1
2#include "portable.h" 2#include "portable.h"
3 3
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <score.h> 5#include <score.h>
6#include <score.moc> 6#include <score.moc>
7 7
8#include <kaccel.h> 8#include <kaccel.h>
9#include <kapp.h> 9#include <kapp.h>
10#include <kconfig.h> 10#include <kconfig.h>
11#include <kstddirs.h> 11#include <kstddirs.h>
12#include <kmessagebox.h> 12#include <kmessagebox.h>
13#elif defined( QPE_PORT ) 13#elif defined( QPE_PORT )
14#include <qaccel.h> 14#include <qaccel.h>
15#include "config.h" 15#include <qpe/config.h>
16#include "score.h" 16#include "score.h"
17#endif 17#endif
18 18
19#include <stdlib.h> 19#include <stdlib.h>
20#include <ctype.h> 20#include <ctype.h>
21 21
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qdstream.h> 24#include <qdstream.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qtimer.h> 26#include <qtimer.h>
27#include <qfileinfo.h> 27#include <qfileinfo.h>
28 28
29#include "bitfont.h" 29#include "bitfont.h"
30 30
31Score::Score(QWidget *parent, const char *name, int Scheme, int Mode, Bitfont *font) : QWidget(parent, name) 31Score::Score(QWidget *parent, const char *name, int Scheme, int Mode, Bitfont *font) : QWidget(parent, name)
32{ 32{
33 setFocusPolicy(QWidget::StrongFocus); 33 setFocusPolicy(QWidget::StrongFocus);
34 34
35 paused = FALSE; 35 paused = FALSE;
36 36
37 lastScore = -1; 37 lastScore = -1;
38 lastPlayer = -1; 38 lastPlayer = -1;
39 39
40 cursorBlinkTimer = 0; 40 cursorBlinkTimer = 0;
41 cursorBlinkMS = -1; 41 cursorBlinkMS = -1;
42 cursor.x = -1; 42 cursor.x = -1;
43 cursor.y = -1; 43 cursor.y = -1;
44 cursor.on = FALSE; 44 cursor.on = FALSE;
45 cursor.chr = QChar('?'); 45 cursor.chr = QChar('?');
46 46
47 initKeys(); 47 initKeys();
48 48
49 scheme = Scheme; 49 scheme = Scheme;
50 mode = Mode; 50 mode = Mode;
51 confScheme(); 51 confScheme();
52 52
53 bitfont = font; 53 bitfont = font;
54 54
55 highscoreFile.setName(locateHighscoreFilePath().filePath()); 55 highscoreFile.setName(locateHighscoreFilePath().filePath());
56 read(); 56 read();
57 57
58 for (int p = 0; p < maxPlayer; p++) { 58 for (int p = 0; p < maxPlayer; p++) {
59 playerScore[p] = 0; 59 playerScore[p] = 0;
60 playerName[p] = getenv("LOGNAME"); 60 playerName[p] = getenv("LOGNAME");
61 if (playerName[p].length() < minPlayerNameLength) 61 if (playerName[p].length() < minPlayerNameLength)
62 playerName[p].setExpand(minPlayerNameLength-1, ' '); 62 playerName[p].setExpand(minPlayerNameLength-1, ' ');
63 63
64 for (uint i = 0; i < playerName[p].length(); i++) 64 for (uint i = 0; i < playerName[p].length(); i++)
65 if (playerName[p].at(i) < bitfont->firstChar() || 65 if (playerName[p].at(i) < bitfont->firstChar() ||
66 playerName[p].at(i) > bitfont->lastChar()) 66 playerName[p].at(i) > bitfont->lastChar())
67 playerName[p].at(i) = playerName[p].at(i).upper(); 67 playerName[p].at(i) = playerName[p].at(i).upper();
68 } 68 }
69} 69}
70 70
71Score::~Score() 71Score::~Score()
72{ 72{
73 // write(); 73 // write();
74} 74}
75 75
76void Score::paintEvent( QPaintEvent *e) 76void Score::paintEvent( QPaintEvent *e)
77{ 77{
78 if (rect(1, 0, tr(" 1UP ")).intersects(e->rect())) { 78 if (rect(1, 0, tr(" 1UP ")).intersects(e->rect())) {
79 QPixmap pix; 79 QPixmap pix;
80 QColor fg = BLACK; 80 QColor fg = BLACK;
81 if (cursor.on || paused || lastPlayer != 0) 81 if (cursor.on || paused || lastPlayer != 0)
82 fg = WHITE; 82 fg = WHITE;
83 pix = bitfont->text(tr(" 1UP "), fg, BLACK); 83 pix = bitfont->text(tr(" 1UP "), fg, BLACK);
84 bitBlt(this, x(1), y(0), &pix); 84 bitBlt(this, x(1), y(0), &pix);
85 } 85 }
86 86
87 if (rect(8, 0, tr(" HIGH SCORE ")).intersects(e->rect())) { 87 if (rect(8, 0, tr(" HIGH SCORE ")).intersects(e->rect())) {
88 QPixmap pix = bitfont->text(tr(" HIGH SCORE "), WHITE, BLACK); 88 QPixmap pix = bitfont->text(tr(" HIGH SCORE "), WHITE, BLACK);
89 bitBlt(this, x(8), y(0), &pix); 89 bitBlt(this, x(8), y(0), &pix);
90 } 90 }
91 91
92 if (maxPlayer > 1 && rect(21, 0, tr(" 2UP ")).intersects(e->rect())) { 92 if (maxPlayer > 1 && rect(21, 0, tr(" 2UP ")).intersects(e->rect())) {
93 QPixmap pix; 93 QPixmap pix;
94 QColor fg = BLACK; 94 QColor fg = BLACK;
95 if (cursor.on || paused || lastPlayer != 1) 95 if (cursor.on || paused || lastPlayer != 1)
96 fg = WHITE; 96 fg = WHITE;
97 pix = bitfont->text(tr(" 2UP "), fg, BLACK); 97 pix = bitfont->text(tr(" 2UP "), fg, BLACK);
98 bitBlt(this, x(21), y(0), &pix); 98 bitBlt(this, x(21), y(0), &pix);
99 } 99 }
100 100
101 QString s; 101 QString s;
102 102
103 s.sprintf("%6d0", playerScore[0]/10); 103 s.sprintf("%6d0", playerScore[0]/10);
104 if (rect(0, 1, s).intersects(e->rect())) { 104 if (rect(0, 1, s).intersects(e->rect())) {
105 QPixmap pix = bitfont->text(s, WHITE, BLACK); 105 QPixmap pix = bitfont->text(s, WHITE, BLACK);
106 bitBlt(this, x(0), y(1), &pix); 106 bitBlt(this, x(0), y(1), &pix);
107 } 107 }
108 108
109 s.sprintf("%8d0", HighScore/10); 109 s.sprintf("%8d0", HighScore/10);
110 if (rect(8, 1, s).intersects(e->rect())) { 110 if (rect(8, 1, s).intersects(e->rect())) {
111 QPixmap pix = bitfont->text(s, WHITE, BLACK); 111 QPixmap pix = bitfont->text(s, WHITE, BLACK);