-rw-r--r-- | noncore/games/kpacman/referee.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/noncore/games/kpacman/referee.cpp b/noncore/games/kpacman/referee.cpp index 81f331b..6d8f3fb 100644 --- a/noncore/games/kpacman/referee.cpp +++ b/noncore/games/kpacman/referee.cpp @@ -665,145 +665,131 @@ void Referee::confScheme() confLevels(FALSE); } RESTORE_CONFIG_GROUP( cfg, oldgroup ); confMisc(); confTiming(); confScoring(); if (mode != -1) { newgroup.sprintf("Mode %d", mode); cfg->setGroup(newgroup); confMisc(FALSE); confTiming(FALSE); confScoring(FALSE); } if (scheme != -1) { newgroup.sprintf("Scheme %d", scheme); cfg->setGroup(newgroup); confMisc(FALSE); confTiming(FALSE); confScoring(FALSE); } fillMapName(); RESTORE_CONFIG_GROUP( cfg, oldgroup ); APP_CONFIG_END( cfg ); } void Referee::setScheme(int Scheme, int Mode, Bitfont *font) { mode = Mode; scheme = Scheme; confScheme(); pix->setScheme(scheme, mode, font); pacman->setMaxPixmaps(pix->maxPixmaps(PacmanPix)); fruit->setMaxPixmaps(pix->maxPixmaps(FruitPix)); for (Monster *m = monsters->first(); m != 0; m = monsters->next()) if (m) m->setMaxPixmaps(pix->maxPixmaps(MonsterPix), pix->maxPixmaps(EyesPix)); for (Energizer *e = energizers->first(); e != 0; e = energizers->next()) if (e) e->setMaxPixmaps(pix->maxPixmaps(EnergizerPix)); if (gameState.testBit(Introducing)) for (int i = 0; i < (gameState.testBit(Init) ? timerCount : 15); i++) introPaint(i); setFixedSize(pix->levelPix().size()); repaint(); } void Referee::keyPressEvent( QKeyEvent *k ) { uint key = k->key(); -#ifdef QWS - // "OK" => new game - if ( key == Key_F33 || key == Key_F2 || key == Key_Enter ) - play(); - else if ( !gameState.testBit(Playing) && - ( key == Key_Up || - key == Key_Down || - key == Key_Right || - key == Key_Left )) + + if ( !gameState.testBit(Playing) && ( key == Key_Up || key == Key_Down || key == Key_Left || key == Key_Right ) ) play(); - // "Space" => pause - //else if ( key == Key_Space || key == Key_F3 ) - // pause(); - // "Menu" => hall of fame - //else if ( key == Key_F11 || key == Key_F4 ) - // toggleHallOfFame(); -#endif if (gameState.testBit(Paused) || gameState.testBit(HallOfFame) || gameState.testBit(Demonstration) || gameState.testBit(Dying) || gameState.testBit(Ready) || gameState.testBit(LevelDone) || !gameState.testBit(Playing)) return; if (key == UpKey) pacman->setDirection(N); else if (key == DownKey) pacman->setDirection(S); else if (key == RightKey) pacman->setDirection(E); else if (key == LeftKey) pacman->setDirection(W); #ifdef CHEATS else if (key == Key_L) { printf("levelUp()\n"); levelUp(); } else if (key == Key_F) { printf("fruit->move(TRUE)\n"); fruit->move(TRUE); repaint(FALSE); } else if (key == Key_E) { printf("setLifes(++lifes)\n"); emit setLifes(++lifes); } #endif else { k->ignore(); return; } k->accept(); } void Referee::score(int p) { if (!gameState.testBit(Playing)) return; if ((points += p) < 0) points = 0; emit setPoints(points); if (points >= nextExtraLifeScore) { emit setLifes(++lifes); if (extraLifeScoreIndex < (int) extraLifeScore.size()-1) extraLifeScoreIndex++; if (extraLifeScore[extraLifeScoreIndex] < 0) nextExtraLifeScore = extraLifeScore[extraLifeScoreIndex] * -1; else nextExtraLifeScore += extraLifeScore[extraLifeScoreIndex]; } } void Referee::eaten() { if (gameState.testBit(Ready)) return; stop(); if (monstersEaten < 4) monstersEaten++; gameState.setBit(Scoring); score(monsterScore[monstersEaten-1]); repaint(pix->rect(pix->rect(pacman->position(), MonsterPix), |