|
|
|
@ -39,9 +39,9 @@
|
|
|
|
|
#include <klocale.h>
|
|
|
|
|
#include <kconfigdialog.h>
|
|
|
|
|
|
|
|
|
|
#include <qdesktopwidget.h>
|
|
|
|
|
#include <qpainter.h>
|
|
|
|
|
#include <qbrush.h>
|
|
|
|
|
#include <ntqdesktopwidget.h>
|
|
|
|
|
#include <ntqpainter.h>
|
|
|
|
|
#include <ntqbrush.h>
|
|
|
|
|
|
|
|
|
|
#include "screen.h"
|
|
|
|
|
#include "frame.h"
|
|
|
|
@ -68,7 +68,7 @@ AASaver::AASaver( WId id ): KScreenSaver(id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString AASaver::randColor(QString color_mask)
|
|
|
|
|
TQString AASaver::randColor(TQString color_mask)
|
|
|
|
|
{
|
|
|
|
|
char colors[] = {'c','C','r','R','y','Y','b','B','g','G','m','M'};
|
|
|
|
|
for (int i = 1; i <= 9; ++i)
|
|
|
|
@ -81,7 +81,7 @@ QString AASaver::randColor(QString color_mask)
|
|
|
|
|
|
|
|
|
|
void AASaver::addCastle()
|
|
|
|
|
{
|
|
|
|
|
QString castle_image =
|
|
|
|
|
TQString castle_image =
|
|
|
|
|
" T~~\n"
|
|
|
|
|
" |\n"
|
|
|
|
|
" /^\\\n"
|
|
|
|
@ -97,7 +97,7 @@ void AASaver::addCastle()
|
|
|
|
|
" |_______|__|_|_|_|__|_______|\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString castle_mask =
|
|
|
|
|
TQString castle_mask =
|
|
|
|
|
" RR\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" yyy\n"
|
|
|
|
@ -122,7 +122,7 @@ void AASaver::addCastle()
|
|
|
|
|
|
|
|
|
|
void AASaver::addEnvironment()
|
|
|
|
|
{
|
|
|
|
|
QString water_line_segment[] = {
|
|
|
|
|
TQString water_line_segment[] = {
|
|
|
|
|
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
|
|
|
|
|
"^^^^ ^^^ ^^^ ^^^ ^^^^ ",
|
|
|
|
|
"^^^^ ^^^^ ^^^ ^^ ",
|
|
|
|
@ -135,13 +135,13 @@ void AASaver::addEnvironment()
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < ARRAY_SIZE(water_line_segment); ++i) {
|
|
|
|
|
//do the tiling
|
|
|
|
|
QString out;
|
|
|
|
|
TQString out;
|
|
|
|
|
for (int r = 0; r < segment_repeat; ++r)
|
|
|
|
|
out += water_line_segment[i];
|
|
|
|
|
|
|
|
|
|
//create a sprite.
|
|
|
|
|
Sprite* s = new Sprite(screen, 0, i + 5, 22);
|
|
|
|
|
s->addFrame(Frame(out, QString::null, 0x149494));
|
|
|
|
|
s->addFrame(Frame(out, TQString::null, 0x149494));
|
|
|
|
|
screen->addSprite(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -197,7 +197,7 @@ public:
|
|
|
|
|
|
|
|
|
|
void AASaver::addSeaweed(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString seaweed_image[] = {"", ""};
|
|
|
|
|
TQString seaweed_image[] = {"", ""};
|
|
|
|
|
int height = intRand(5) + 3;
|
|
|
|
|
for (int i = 1; i <= height; ++i)
|
|
|
|
|
{
|
|
|
|
@ -212,8 +212,8 @@ void AASaver::addSeaweed(Screen* screen)
|
|
|
|
|
|
|
|
|
|
Seaweed* s = new Seaweed(screen, x, y,
|
|
|
|
|
intRand(4*60000) + (8*60000)); // seaweed lives for 8 to 12 minutes
|
|
|
|
|
s->addFrame(Frame(seaweed_image[0], QString::null, 0x18AF18));
|
|
|
|
|
s->addFrame(Frame(seaweed_image[1], QString::null, 0x18AF18));
|
|
|
|
|
s->addFrame(Frame(seaweed_image[0], TQString::null, 0x18AF18));
|
|
|
|
|
s->addFrame(Frame(seaweed_image[1], TQString::null, 0x18AF18));
|
|
|
|
|
s->setFrameDelay(intRand(50) + 250);
|
|
|
|
|
screen->addSprite(s);
|
|
|
|
|
}
|
|
|
|
@ -239,9 +239,9 @@ public:
|
|
|
|
|
AirBubble(Screen *screen, int x, int y, int z) :
|
|
|
|
|
Sprite(screen, x, y, z), m_startY(y)
|
|
|
|
|
{
|
|
|
|
|
addFrame(Frame(".", QString(), 0x18B2B2));
|
|
|
|
|
addFrame(Frame("o", QString(), 0x18B2B2));
|
|
|
|
|
addFrame(Frame("O", QString(), 0x18B2B2));
|
|
|
|
|
addFrame(Frame(".", TQString(), 0x18B2B2));
|
|
|
|
|
addFrame(Frame("o", TQString(), 0x18B2B2));
|
|
|
|
|
addFrame(Frame("O", TQString(), 0x18B2B2));
|
|
|
|
|
|
|
|
|
|
setFrameDelay(100);
|
|
|
|
|
}
|
|
|
|
@ -423,12 +423,12 @@ public:
|
|
|
|
|
if(isKilled())
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if(QABS(realX() - m_lastBubbleRelease) >= m_spacesPerBubble)
|
|
|
|
|
if(TQABS(realX() - m_lastBubbleRelease) >= m_spacesPerBubble)
|
|
|
|
|
{
|
|
|
|
|
m_lastBubbleRelease = realX();
|
|
|
|
|
|
|
|
|
|
int bubbleX = m_x;
|
|
|
|
|
QRect geometry = geom();
|
|
|
|
|
TQRect geometry = geom();
|
|
|
|
|
|
|
|
|
|
if(m_direct > 0) // Moving right
|
|
|
|
|
bubbleX += geometry.width();
|
|
|
|
@ -446,7 +446,7 @@ void AASaver::addAllFish()
|
|
|
|
|
// many we'd be dealing with in full screen, and then scale the user's
|
|
|
|
|
// number down to adjust so that we look about the same in a window as we
|
|
|
|
|
// do fullscreen. TODO: Xinerama issues?
|
|
|
|
|
QRect fullScreenGeometry = kapp->desktop()->screenGeometry();
|
|
|
|
|
TQRect fullScreenGeometry = kapp->desktop()->screenGeometry();
|
|
|
|
|
|
|
|
|
|
int full_width = fullScreenGeometry.width() / screen->cellWidth();
|
|
|
|
|
int full_height = fullScreenGeometry.height() / screen->cellHeight() - 9;
|
|
|
|
@ -463,7 +463,7 @@ void AASaver::addAllFish()
|
|
|
|
|
|
|
|
|
|
Sprite *AASaver::newFish(Screen *screen)
|
|
|
|
|
{
|
|
|
|
|
QString fish_image[] = {
|
|
|
|
|
TQString fish_image[] = {
|
|
|
|
|
" \\\n"
|
|
|
|
|
" ...\\..,\n"
|
|
|
|
|
"\\" "??" "/' \\\n" // trigraphs suck
|
|
|
|
@ -656,7 +656,7 @@ Sprite *AASaver::newFish(Screen *screen)
|
|
|
|
|
double speed = doubleRand(2) + 0.25;
|
|
|
|
|
int depth = 3 + intRand(18);
|
|
|
|
|
|
|
|
|
|
QString color_mask = fish_image[fish_index+1];
|
|
|
|
|
TQString color_mask = fish_image[fish_index+1];
|
|
|
|
|
color_mask.replace('4', 'W');
|
|
|
|
|
|
|
|
|
|
color_mask = randColor(color_mask);
|
|
|
|
@ -702,10 +702,10 @@ public:
|
|
|
|
|
* @param center The point to center the splat around.
|
|
|
|
|
* @param depth The depth to create the splat at.
|
|
|
|
|
*/
|
|
|
|
|
Splat(Screen *screen, QPoint center, int depth) :
|
|
|
|
|
Splat(Screen *screen, TQPoint center, int depth) :
|
|
|
|
|
Sprite(screen, 0, 0, depth, 450 /* frame Delay */)
|
|
|
|
|
{
|
|
|
|
|
QString splats[] = {
|
|
|
|
|
TQString splats[] = {
|
|
|
|
|
"\n"
|
|
|
|
|
" .\n"
|
|
|
|
|
" ***\n"
|
|
|
|
@ -733,9 +733,9 @@ public:
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for(unsigned i = 0; i < ARRAY_SIZE(splats); ++i)
|
|
|
|
|
addFrame(Frame(splats[i], QString(), 0xB21818, ' '));
|
|
|
|
|
addFrame(Frame(splats[i], TQString(), 0xB21818, ' '));
|
|
|
|
|
|
|
|
|
|
QRect r(center, QSize(9, 5));
|
|
|
|
|
TQRect r(center, TQSize(9, 5));
|
|
|
|
|
r.moveCenter(center);
|
|
|
|
|
m_x = r.x();
|
|
|
|
|
m_y = r.y();
|
|
|
|
@ -766,7 +766,7 @@ public:
|
|
|
|
|
if(m_direct > 0) // Moving to right.
|
|
|
|
|
m_realX = -10;
|
|
|
|
|
|
|
|
|
|
addFrame(Frame("????????", QString(), 0));
|
|
|
|
|
addFrame(Frame("????????", TQString(), 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Returns true since we can collide.
|
|
|
|
@ -794,7 +794,7 @@ public:
|
|
|
|
|
|
|
|
|
|
void AASaver::addShark(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString shark_image[] = {
|
|
|
|
|
TQString shark_image[] = {
|
|
|
|
|
" __\n"
|
|
|
|
|
" ( `\\\n"
|
|
|
|
|
" ,??????????????????????????" ") `\\\n" // trigraphs suck
|
|
|
|
@ -842,7 +842,7 @@ void AASaver::addShark(Screen* screen)
|
|
|
|
|
|
|
|
|
|
int shark_num = intRand(ARRAY_SIZE(shark_image)/2);
|
|
|
|
|
int shark_index = shark_num * 2;
|
|
|
|
|
QString color_mask = randColor(shark_image[shark_index+1]);
|
|
|
|
|
TQString color_mask = randColor(shark_image[shark_index+1]);
|
|
|
|
|
Frame sharkFrame(shark_image[shark_index], color_mask, 0x18B2B2);
|
|
|
|
|
|
|
|
|
|
int x = -53;
|
|
|
|
@ -867,7 +867,7 @@ void AASaver::addBubble(Screen *screen, int x, int y, int z)
|
|
|
|
|
|
|
|
|
|
void AASaver::addShip(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString ship_image[] = {
|
|
|
|
|
TQString ship_image[] = {
|
|
|
|
|
" | | |\n"
|
|
|
|
|
" )_) )_) )_)\n"
|
|
|
|
|
" )___))___))___)\\\n"
|
|
|
|
@ -912,7 +912,7 @@ void AASaver::addShip(Screen* screen)
|
|
|
|
|
|
|
|
|
|
void AASaver::addWhale(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString whale_image[] = {
|
|
|
|
|
TQString whale_image[] = {
|
|
|
|
|
" .-----:\n"
|
|
|
|
|
" .' `.\n"
|
|
|
|
|
",????/ (o) \\\n"
|
|
|
|
@ -940,7 +940,7 @@ void AASaver::addWhale(Screen* screen)
|
|
|
|
|
"BBBB BBBBB"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QString spouty[] = {
|
|
|
|
|
TQString spouty[] = {
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" :",
|
|
|
|
@ -980,30 +980,30 @@ void AASaver::addWhale(Screen* screen)
|
|
|
|
|
dir = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString mask = whale_image[2 * whale_num + 1];
|
|
|
|
|
TQString mask = whale_image[2 * whale_num + 1];
|
|
|
|
|
|
|
|
|
|
RandomMovingSprite *whale = new RandomMovingSprite(screen, dir, 1.0, x, 0, 2);
|
|
|
|
|
whale->setFrameDelay(80);
|
|
|
|
|
whale->setFrameTime(40);
|
|
|
|
|
|
|
|
|
|
// We have to add some frames now. The first five will have no water spout.
|
|
|
|
|
QString blankWhaleFrame = QString("\n\n\n") + whale_image[2 * whale_num];
|
|
|
|
|
TQString blankWhaleFrame = TQString("\n\n\n") + whale_image[2 * whale_num];
|
|
|
|
|
|
|
|
|
|
for(unsigned i = 0; i < 5; ++i)
|
|
|
|
|
whale->addFrame(Frame(blankWhaleFrame, mask, 0xFFFFFF));
|
|
|
|
|
|
|
|
|
|
// Now add frames for the animated water spout.
|
|
|
|
|
QString whaleFrame = whale_image[2 * whale_num];
|
|
|
|
|
TQString whaleFrame = whale_image[2 * whale_num];
|
|
|
|
|
for (unsigned i = 0; i < ARRAY_SIZE(spouty); ++i)
|
|
|
|
|
{
|
|
|
|
|
QStringList spoutLines = QStringList::split("\n", spouty[i], true);
|
|
|
|
|
QString spout;
|
|
|
|
|
QString padding;
|
|
|
|
|
TQStringList spoutLines = TQStringList::split("\n", spouty[i], true);
|
|
|
|
|
TQString spout;
|
|
|
|
|
TQString padding;
|
|
|
|
|
|
|
|
|
|
padding.fill(' ', spout_align);
|
|
|
|
|
|
|
|
|
|
// Move spout over an appropriate distance to line up right.
|
|
|
|
|
for(QStringList::ConstIterator it = spoutLines.begin(); it != spoutLines.end(); ++it)
|
|
|
|
|
for(TQStringList::ConstIterator it = spoutLines.begin(); it != spoutLines.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
spout += padding;
|
|
|
|
|
spout += *it;
|
|
|
|
@ -1019,7 +1019,7 @@ void AASaver::addWhale(Screen* screen)
|
|
|
|
|
|
|
|
|
|
void AASaver::addBigFish(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString big_fish_image[] = {
|
|
|
|
|
TQString big_fish_image[] = {
|
|
|
|
|
" ______\n"
|
|
|
|
|
"`\"\"-. `````-----.....__\n"
|
|
|
|
|
" `. . . `-.\n"
|
|
|
|
@ -1093,7 +1093,7 @@ void AASaver::addBigFish(Screen* screen)
|
|
|
|
|
dir = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString colors = randColor(big_fish_image[2 * big_fish_num + 1]);
|
|
|
|
|
TQString colors = randColor(big_fish_image[2 * big_fish_num + 1]);
|
|
|
|
|
RandomMovingSprite *bigFish = new RandomMovingSprite(screen, dir, 3.0, x, y, 2);
|
|
|
|
|
bigFish->addFrame(Frame(big_fish_image[2 * big_fish_num], colors, 0xFFFF54));
|
|
|
|
|
|
|
|
|
@ -1102,7 +1102,7 @@ void AASaver::addBigFish(Screen* screen)
|
|
|
|
|
|
|
|
|
|
void AASaver::addNessie(Screen* screen)
|
|
|
|
|
{
|
|
|
|
|
QString nessie_image[] = {
|
|
|
|
|
TQString nessie_image[] = {
|
|
|
|
|
" ____\n"
|
|
|
|
|
" __??????????????????????????????????????????/ o \\\n"
|
|
|
|
|
" / \\????????_?????????????????????_???????/ ____ >\n"
|
|
|
|
@ -1152,7 +1152,7 @@ void AASaver::addNessie(Screen* screen)
|
|
|
|
|
" | |????/ \\?????| |????| || |???| |?????/ /"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QString nessie_mask[] = {
|
|
|
|
|
TQString nessie_mask[] = {
|
|
|
|
|
"\n"
|
|
|
|
|
" W\n"
|
|
|
|
|
"\n"
|
|
|
|
@ -1220,7 +1220,7 @@ void AASaver::addRandom(Screen* screen)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AASaver::paintEvent(QPaintEvent* pe)
|
|
|
|
|
void AASaver::paintEvent(TQPaintEvent* pe)
|
|
|
|
|
{
|
|
|
|
|
screen->paint(pe->region());
|
|
|
|
|
}
|
|
|
|
@ -1237,7 +1237,7 @@ extern "C"
|
|
|
|
|
return new AASaver( id );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KDE_EXPORT QDialog *kss_setup()
|
|
|
|
|
KDE_EXPORT TQDialog *kss_setup()
|
|
|
|
|
{
|
|
|
|
|
KConfigDialog *dialog = KConfigDialog::exists("settings");
|
|
|
|
|
if(dialog)
|
|
|
|
|