summaryrefslogtreecommitdiffstats
path: root/kpacman/referee.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kpacman/referee.cpp')
-rw-r--r--kpacman/referee.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/kpacman/referee.cpp b/kpacman/referee.cpp
index 55f03f8..bc8660b 100644
--- a/kpacman/referee.cpp
+++ b/kpacman/referee.cpp
@@ -4,13 +4,13 @@
#include <referee.h>
-#include <qdatetm.h>
+#include <ntqdatetm.h>
#include <stdlib.h>
-#include <qtimer.h>
-#include <qevent.h>
-#include <qcolor.h>
-#include <qkeycode.h>
-#include <qfileinfo.h>
+#include <ntqtimer.h>
+#include <ntqevent.h>
+#include <ntqcolor.h>
+#include <ntqkeycode.h>
+#include <ntqfileinfo.h>
#include <kaccel.h>
#include "board.h"
@@ -19,15 +19,15 @@
#include "fruit.h"
#include "painter.h"
-Referee::Referee( QWidget *parent, const char *name, int Scheme, int Mode, Bitfont *font)
- : QWidget( parent, name )
+Referee::Referee( TQWidget *parent, const char *name, int Scheme, int Mode, Bitfont *font)
+ : TQWidget( parent, name )
{
gameState.resize(12);
gameTimer = 0;
energizerTimer = 0;
focusedPause = false;
- setFocusPolicy(QWidget::StrongFocus);
+ setFocusPolicy(TQWidget::StrongFocus);
initKeys();
@@ -44,23 +44,23 @@ Referee::Referee( QWidget *parent, const char *name, int Scheme, int Mode, Bitfo
fruit = new Fruit(board);
- monsters = new QList<Monster>;
+ monsters = new TQList<Monster>;
monsters->setAutoDelete(TRUE);
- monsterRect = new QList<QRect>;
+ monsterRect = new TQList<TQRect>;
monsterRect->setAutoDelete(TRUE);
- energizers = new QList<Energizer>;
+ energizers = new TQList<Energizer>;
energizers->setAutoDelete(TRUE);
- energizerRect = new QList<QRect>;
+ energizerRect = new TQList<TQRect>;
energizerRect->setAutoDelete(TRUE);
pacmanRect.setRect(0, 0, 0, 0);
fruitRect.setRect(0, 0, 0, 0);
- QTime midnight( 0, 0, 0 );
- srand( midnight.secsTo(QTime::currentTime()) );
+ TQTime midnight( 0, 0, 0 );
+ srand( midnight.secsTo(TQTime::currentTime()) );
lifes = 0;
points = 0;
@@ -71,15 +71,15 @@ Referee::Referee( QWidget *parent, const char *name, int Scheme, int Mode, Bitfo
intro();
}
-void Referee::paintEvent( QPaintEvent *e)
+void Referee::paintEvent( TQPaintEvent *e)
{
if (gameState.testBit(HallOfFame))
return;
- QRect rect = e->rect();
+ TQRect rect = e->rect();
if (!rect.isEmpty()) {
- QPixmap p = pix->levelPix();
+ TQPixmap p = pix->levelPix();
bitBlt(this, rect.x(), rect.y(),
&p, rect.x(), rect.y(), rect.width(), rect.height());
}
@@ -159,12 +159,12 @@ void Referee::paintEvent( QPaintEvent *e)
pix->draw((BoardWidth*BoardHeight)/2-BoardWidth, Widget, i18n("PAUSED"), RED, BLACK);
}
-void Referee::timerEvent( QTimerEvent *e )
+void Referee::timerEvent( TQTimerEvent *e )
{
if (gameState.testBit(HallOfFame))
return;
- QRect lastRect;
+ TQRect lastRect;
int lastPix;
bool moved = FALSE;
int eated = 0;
@@ -407,24 +407,24 @@ void Referee::repaintFigures()
void Referee::initKeys()
{
- QString up("Up");
+ TQString up("Up");
up = kapp->config()->readEntry("upKey", (const char*) up);
UpKey = KAccel::stringToKey(up);
- QString down("Down");
+ TQString down("Down");
down = kapp->config()->readEntry("downKey", (const char*) down);
DownKey = KAccel::stringToKey(down);
- QString left("Left");
+ TQString left("Left");
left = kapp->config()->readEntry("leftKey", (const char*) left);
LeftKey = KAccel::stringToKey(left);
- QString right("Right");
+ TQString right("Right");
right = kapp->config()->readEntry("rightKey", (const char*) right);
RightKey = KAccel::stringToKey(right);
}
-void Referee::fillArray(QArray<int> &array, QString values, int max)
+void Referee::fillArray(TQArray<int> &array, TQString values, int max)
{
if (max < 0)
max = values.contains(',')+1;
@@ -432,7 +432,7 @@ void Referee::fillArray(QArray<int> &array, QString values, int max)
array.resize(max);
int last = 0;
bool ok;
- QString value;
+ TQString value;
for (uint i = 0; i < array.size(); i++) {
if (values.find(',') < 0 && values.length() > 0) {
@@ -451,13 +451,13 @@ void Referee::fillArray(QArray<int> &array, QString values, int max)
}
}
-void Referee::fillStrList(QStrList &list, QString values, int max)
+void Referee::fillStrList(TQStrList &list, TQString values, int max)
{
if (!list.isEmpty())
list.clear();
- QString last = "";
- QString value;
+ TQString last = "";
+ TQString value;
for (uint i = 0; i < (uint) max; i++) {
if (values.find(',') < 0 && values.length() > 0) {
@@ -477,14 +477,14 @@ void Referee::fillStrList(QStrList &list, QString values, int max)
void Referee::fillMapName()
{
- QStrList list = mapName;
+ TQStrList list = mapName;
if (!mapName.isEmpty())
mapName.clear();
- QString map;
+ TQString map;
- QFileInfo fileInfo;
+ TQFileInfo fileInfo;
for (uint i = 0; i < list.count(); i++) {
map = list.at(i);
@@ -610,8 +610,8 @@ void Referee::confScoring(bool defGroup)
void Referee::confScheme()
{
- QString oldgroup = kapp->config()->group();
- QString newgroup;
+ TQString oldgroup = kapp->config()->group();
+ TQString newgroup;
// if not set, read mode and scheme from the configfile
if (mode == -1 && scheme == -1) {
@@ -701,7 +701,7 @@ void Referee::setScheme(int Scheme, int Mode, Bitfont *font)
repaint();
}
-void Referee::keyPressEvent( QKeyEvent *k )
+void Referee::keyPressEvent( TQKeyEvent *k )
{
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame) ||
gameState.testBit(Demonstration) || gameState.testBit(Dying) ||
@@ -770,13 +770,13 @@ void Referee::eaten()
pix->rect(pacman->position(), MonsterScorePix, monstersEaten-1)));
if (--timerCount > 0)
- QTimer::singleShot( monsterScoreDurMS, this, SLOT(eaten()));
+ TQTimer::singleShot( monsterScoreDurMS, this, SLOT(eaten()));
else {
for (Monster *m = monsters->first(); m != 0; m = monsters->next())
if (m && m->direction() == X && !gameState.testBit(Introducing))
m->setDirection(N);
if (monstersEaten != 4 || !gameState.testBit(Introducing))
- QTimer::singleShot( monsterScoreDurMS, this, SLOT(start()));
+ TQTimer::singleShot( monsterScoreDurMS, this, SLOT(start()));
}
}
@@ -869,43 +869,43 @@ void Referee::introMonster(int id)
void Referee::introPaint(int t)
{
- QString pts;
+ TQString pts;
switch (t) {
- case 0 : repaint(pix->draw(16, 6, RoomPix, i18n("CHARACTER"), WHITE, QColor(), AlignLeft), FALSE);
- repaint(pix->draw(36, 6, RoomPix, i18n("/"), WHITE, QColor(), AlignLeft), FALSE);
- repaint(pix->draw(40, 6, RoomPix, i18n("NICKNAME"), WHITE, QColor(), AlignLeft), FALSE);
+ case 0 : repaint(pix->draw(16, 6, RoomPix, i18n("CHARACTER"), WHITE, TQColor(), AlignLeft), FALSE);
+ repaint(pix->draw(36, 6, RoomPix, i18n("/"), WHITE, TQColor(), AlignLeft), FALSE);
+ repaint(pix->draw(40, 6, RoomPix, i18n("NICKNAME"), WHITE, TQColor(), AlignLeft), FALSE);
break;
case 1 : introMonster(0);
break;
- case 2 : repaint(pix->draw(16, 10, RoomPix, i18n("-SHADOW"), RED, QColor(), AlignLeft), FALSE);
+ case 2 : repaint(pix->draw(16, 10, RoomPix, i18n("-SHADOW"), RED, TQColor(), AlignLeft), FALSE);
break;
- case 3 : repaint(pix->draw(38, 10, RoomPix, i18n("\"BLINKY\""), RED, QColor(), AlignLeft), FALSE);
+ case 3 : repaint(pix->draw(38, 10, RoomPix, i18n("\"BLINKY\""), RED, TQColor(), AlignLeft), FALSE);
break;
case 4 : introMonster(1);
break;
- case 5 : repaint(pix->draw(16, 16, RoomPix, i18n("-SPEEDY"), PINK, QColor(), AlignLeft), FALSE);
+ case 5 : repaint(pix->draw(16, 16, RoomPix, i18n("-SPEEDY"), PINK, TQColor(), AlignLeft), FALSE);
break;
- case 6 : repaint(pix->draw(38, 16, RoomPix, i18n("\"PINKY\""), PINK, QColor(), AlignLeft), FALSE);
+ case 6 : repaint(pix->draw(38, 16, RoomPix, i18n("\"PINKY\""), PINK, TQColor(), AlignLeft), FALSE);
break;
case 7 : introMonster(2);
break;
- case 8 : repaint(pix->draw(16, 22, RoomPix, i18n("-BASHFUL"), CYAN, QColor(), AlignLeft), FALSE);
+ case 8 : repaint(pix->draw(16, 22, RoomPix, i18n("-BASHFUL"), CYAN, TQColor(), AlignLeft), FALSE);
break;
- case 9 : repaint(pix->draw(38, 22, RoomPix, i18n("\"INKY\""), CYAN, QColor(), AlignLeft), FALSE);
+ case 9 : repaint(pix->draw(38, 22, RoomPix, i18n("\"INKY\""), CYAN, TQColor(), AlignLeft), FALSE);
break;
case 10 : introMonster(3);
break;
- case 11 : repaint(pix->draw(16, 28, RoomPix, i18n("-POKEY"), ORANGE, QColor(), AlignLeft), FALSE);
+ case 11 : repaint(pix->draw(16, 28, RoomPix, i18n("-POKEY"), ORANGE, TQColor(), AlignLeft), FALSE);
break;
- case 12 : repaint(pix->draw(38, 28, RoomPix, i18n("\"CLYDE\""), ORANGE, QColor(), AlignLeft), FALSE);
+ case 12 : repaint(pix->draw(38, 28, RoomPix, i18n("\"CLYDE\""), ORANGE, TQColor(), AlignLeft), FALSE);
break;
case 13 : pts.sprintf("%d", pointScore);
- repaint(pix->draw(28, 44, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE);
- repaint(pix->draw(31, 44, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE);
+ repaint(pix->draw(28, 44, RoomPix, pts.data(), WHITE, TQColor(), AlignRight), FALSE);
+ repaint(pix->draw(31, 44, RoomPix, "\x1C\x1D\x1E", WHITE, TQColor(), AlignLeft), FALSE);
pts.sprintf("%d", energizerScore);
- repaint(pix->draw(28, 48, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE);
- repaint(pix->draw(31, 48, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE);
+ repaint(pix->draw(28, 48, RoomPix, pts.data(), WHITE, TQColor(), AlignRight), FALSE);
+ repaint(pix->draw(31, 48, RoomPix, "\x1C\x1D\x1E", WHITE, TQColor(), AlignLeft), FALSE);
break;
case 14 : // "@ 1980 MIDWAY MFG.CO."
repaint(pix->draw(30, 58, RoomPix, "� 1998-2003 J.TH�NNISSEN", PINK), FALSE);
@@ -918,14 +918,14 @@ void Referee::introPlay()
if (!gameState.testBit(Introducing) || gameState.testBit(Ready))
return;
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(introPlay()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(introPlay()));
return;
}
if (!gameState.testBit(Init)) {
if (monstersEaten == 4) {
stop();
- QTimer::singleShot(introPostAnimationMS, this, SLOT(demo()));
+ TQTimer::singleShot(introPostAnimationMS, this, SLOT(demo()));
}
if (pacman->direction() == W) {
int id = -1;
@@ -984,7 +984,7 @@ void Referee::introPlay()
}
if (timerCount++ < 15)
- QTimer::singleShot(introAnimationMS, this, SLOT(introPlay()));
+ TQTimer::singleShot(introAnimationMS, this, SLOT(introPlay()));
}
void Referee::demo()
@@ -993,7 +993,7 @@ void Referee::demo()
return;
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(demo()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(demo()));
return;
}
@@ -1020,7 +1020,7 @@ void Referee::demo()
repaint();
timerCount = 0;
- QTimer::singleShot(playerDurMS, this, SLOT(start()));
+ TQTimer::singleShot(playerDurMS, this, SLOT(start()));
}
void Referee::play()
@@ -1061,13 +1061,13 @@ void Referee::play()
repaint(pix->rect(board->position(fruithome), i18n("READY!")), FALSE);
timerCount = 0;
- QTimer::singleShot(playerDurMS, this, SLOT(ready()));
+ TQTimer::singleShot(playerDurMS, this, SLOT(ready()));
}
void Referee::ready()
{
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(ready()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(ready()));
return;
}
@@ -1077,7 +1077,7 @@ void Referee::ready()
gameState.clearBit(Init);
repaint(pix->rect(board->position(monsterhome, 0), i18n("PLAYER ONE")), FALSE);
repaintFigures();
- QTimer::singleShot(playerDurMS, this, SLOT(ready()));
+ TQTimer::singleShot(playerDurMS, this, SLOT(ready()));
return;
}
@@ -1089,7 +1089,7 @@ void Referee::ready()
gameState.setBit(Ready);
gameState.clearBit(Init);
repaint(pix->rect(board->position(fruithome), i18n("READY!")), FALSE);
- QTimer::singleShot(readyDurMS, this, SLOT(ready()));
+ TQTimer::singleShot(readyDurMS, this, SLOT(ready()));
}
}
@@ -1104,7 +1104,7 @@ void Referee::levelUp()
repaint(pix->rect(pacman->position(), PacmanPix));
timerCount = 0;
- QTimer::singleShot(levelUpPreAnimationMS, this, SLOT(levelUpPlay()));
+ TQTimer::singleShot(levelUpPreAnimationMS, this, SLOT(levelUpPlay()));
}
void Referee::levelUpPlay()
@@ -1113,7 +1113,7 @@ void Referee::levelUpPlay()
return;
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(levelUpPlay()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(levelUpPlay()));
return;
}
@@ -1128,7 +1128,7 @@ void Referee::levelUpPlay()
}
if (timerCount++ < 2) {
- QTimer::singleShot(levelUpAnimationMS, this, SLOT(levelUpPlay()));
+ TQTimer::singleShot(levelUpAnimationMS, this, SLOT(levelUpPlay()));
return;
}
@@ -1162,7 +1162,7 @@ void Referee::start()
return;
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(start()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(start()));
return;
}
@@ -1212,11 +1212,11 @@ void Referee::killed()
for (Monster *m = monsters->first(); m != 0; m = monsters->next())
if (m)
m->setDirection(X);
- QTimer::singleShot(dyingPreAnimationMS, this, SLOT(killed()));
+ TQTimer::singleShot(dyingPreAnimationMS, this, SLOT(killed()));
} else {
stop();
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(killed()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(killed()));
return;
}
@@ -1234,16 +1234,16 @@ void Referee::killedPlay()
if (!gameState.testBit(Dying) || gameState.testBit(Ready))
return;
if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) {
- QTimer::singleShot(afterPauseMS, this, SLOT(killedPlay()));
+ TQTimer::singleShot(afterPauseMS, this, SLOT(killedPlay()));
return;
}
if (timerCount <= pix->maxPixmaps(DyingPix)) {
repaint(pix->rect(pacman->position(), PacmanPix), FALSE);
if (timerCount >= pix->maxPixmaps(DyingPix)-1 || timerCount == 0)
- QTimer::singleShot(dyingPostAnimationMS, this, SLOT(killedPlay()));
+ TQTimer::singleShot(dyingPostAnimationMS, this, SLOT(killedPlay()));
else
- QTimer::singleShot(dyingAnimationMS, this, SLOT(killedPlay()));
+ TQTimer::singleShot(dyingAnimationMS, this, SLOT(killedPlay()));
timerCount++;
} else {
gameState.clearBit(Dying);
@@ -1256,7 +1256,7 @@ void Referee::killedPlay()
repaint(pix->rect(board->position(energizer, e), EnergizerPix), FALSE);
}
repaint(pix->rect(board->position(fruithome), i18n("GAME OVER")), FALSE);
- QTimer::singleShot(gameOverDurMS, this, SLOT(hallOfFame()));
+ TQTimer::singleShot(gameOverDurMS, this, SLOT(hallOfFame()));
} else {
gameState.clearBit(Init);
initPacman();
@@ -1311,7 +1311,7 @@ void Referee::initMonsters()
for (int id = 0; id < (gameState.testBit(Introducing) ? 4 : board->monsters()); id++) {
Monster *m = new Monster(board, id);
monsters->append(m);
- QRect *r = new QRect();
+ TQRect *r = new TQRect();
monsterRect->append(r);
if (!gameState.testBit(Introducing)) {
m->setFreedom(board->position(prisonexit));
@@ -1343,7 +1343,7 @@ void Referee::initEnergizers()
for (int id = 0; id < (gameState.testBit(Introducing) ? 2 : board->energizers()); id++) {
Energizer *e = new Energizer(board);
energizers->append(e);
- QRect *r = new QRect();
+ TQRect *r = new TQRect();
energizerRect->append(r);
if (!gameState.testBit(Introducing)) {
e->setPosition(board->position(energizer, id));
@@ -1370,7 +1370,7 @@ void Referee::setFocusInContinue(bool FocusInContinue)
focusInContinue = FocusInContinue;
}
-void Referee::focusInEvent(QFocusEvent *)
+void Referee::focusInEvent(TQFocusEvent *)
{
if (focusInContinue && focusedPause &&
gameState.testBit(Paused) && gameState.testBit(Playing)) {
@@ -1380,7 +1380,7 @@ void Referee::focusInEvent(QFocusEvent *)
}
}
-void Referee::focusOutEvent(QFocusEvent *)
+void Referee::focusOutEvent(TQFocusEvent *)
{
if (focusOutPause && !focusedPause &&
!gameState.testBit(Paused) && gameState.testBit(Playing)) {