summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/kbill/Bucket.cc16
-rw-r--r--noncore/games/kbill/Bucket.h17
-rw-r--r--noncore/games/kbill/Cable.cc94
-rw-r--r--noncore/games/kbill/Cable.h20
-rw-r--r--noncore/games/kbill/Computer.cc56
-rw-r--r--noncore/games/kbill/Computer.h22
-rw-r--r--noncore/games/kbill/Game.cc246
-rw-r--r--noncore/games/kbill/Game.h55
-rw-r--r--noncore/games/kbill/Horde.cc64
-rw-r--r--noncore/games/kbill/Horde.h27
-rw-r--r--noncore/games/kbill/Library.cc13
-rw-r--r--noncore/games/kbill/Library.h19
-rw-r--r--noncore/games/kbill/MCursor.cc69
-rw-r--r--noncore/games/kbill/MCursor.h37
-rw-r--r--noncore/games/kbill/Makefile533
-rw-r--r--noncore/games/kbill/Makefile.am59
-rw-r--r--noncore/games/kbill/Makefile.in427
-rw-r--r--noncore/games/kbill/Monster.cc226
-rw-r--r--noncore/games/kbill/Monster.h53
-rw-r--r--noncore/games/kbill/Network.cc49
-rw-r--r--noncore/games/kbill/Network.h27
-rw-r--r--noncore/games/kbill/Picture.cc72
-rw-r--r--noncore/games/kbill/Picture.h32
-rw-r--r--noncore/games/kbill/Scorelist.cc75
-rw-r--r--noncore/games/kbill/Scorelist.h16
-rw-r--r--noncore/games/kbill/Spark.cc13
-rw-r--r--noncore/games/kbill/Spark.h16
-rw-r--r--noncore/games/kbill/Strings.h58
-rw-r--r--noncore/games/kbill/UI.cpp175
-rw-r--r--noncore/games/kbill/UI.h73
-rw-r--r--noncore/games/kbill/field.cpp84
-rw-r--r--noncore/games/kbill/field.h48
-rw-r--r--noncore/games/kbill/inputbox.cpp51
-rw-r--r--noncore/games/kbill/inputbox.h39
-rw-r--r--noncore/games/kbill/kbill.cpp118
-rw-r--r--noncore/games/kbill/kbill.h54
-rw-r--r--noncore/games/kbill/kbill.pro13
-rw-r--r--noncore/games/kbill/kbill.xpm69
-rw-r--r--noncore/games/kbill/mini-kbill.xpm248
-rw-r--r--noncore/games/kbill/objects.h26
40 files changed, 3409 insertions, 0 deletions
diff --git a/noncore/games/kbill/Bucket.cc b/noncore/games/kbill/Bucket.cc
new file mode 100644
index 0000000..4b1d82a
--- a/dev/null
+++ b/noncore/games/kbill/Bucket.cc
@@ -0,0 +1,16 @@
+#include "objects.h"
+
+int Bucket::clicked (int x, int y) {
+ return (x > 0 && y > 0 && x < width && y < height);
+}
+
+void Bucket::draw() {
+ if (game.grabbed != game.BUCKET) ui.draw(picture, 0, 0);
+}
+
+void Bucket::load_pix() {
+ picture.load("bucket");
+ cursor.load("bucket", cursor.OWN_MASK);
+ width = picture.width;
+ height = picture.height;
+}
diff --git a/noncore/games/kbill/Bucket.h b/noncore/games/kbill/Bucket.h
new file mode 100644
index 0000000..d8a2144
--- a/dev/null
+++ b/noncore/games/kbill/Bucket.h
@@ -0,0 +1,17 @@
+#ifndef BUCKET_H
+#define BUCKET_H
+
+#include "Picture.h"
+#include "MCursor.h"
+
+class Bucket {
+public:
+ Picture picture;
+ MCursor cursor;
+ int width, height;
+ void draw();
+ int clicked(int x, int y);
+ void load_pix();
+};
+
+#endif
diff --git a/noncore/games/kbill/Cable.cc b/noncore/games/kbill/Cable.cc
new file mode 100644
index 0000000..6fdb3d1
--- a/dev/null
+++ b/noncore/games/kbill/Cable.cc
@@ -0,0 +1,94 @@
+#include "objects.h"
+
+void Cable::setup() {
+ c1 = game.RAND(0, net.units-1);
+ do {
+ c2 = game.RAND(0, net.units-1);
+ } while (c2 == c1);
+ active = index = 0;
+ delay = spark.delay(game.level);
+ x1 = net.computers[c1].x + net.width/3;
+ x2 = net.computers[c2].x + net.width/3;
+ y1 = net.computers[c1].y + net.height/2;
+ y2 = net.computers[c2].y + net.height/2;
+}
+
+void Cable::update () {
+ if (active) {
+ if ((net.computers[c1].os == OS.WINGDOWS) ==
+ (net.computers[c2].os == OS.WINGDOWS))
+ active=0;
+ else if (net.computers[c1].os == OS.WINGDOWS ||
+ net.computers[c2].os == OS.WINGDOWS)
+ {
+ int dir, xdist, ydist,c;
+ float sx, sy;
+ dir = (net.computers[c2].os == OS.WINGDOWS);
+ if (dir)
+ {xdist=x1-x; ydist=y1-y;}
+ else
+ {xdist=x2-x; ydist=y2-y;}
+ sx = xdist >= 0 ? 1.0 : -1.0;
+ sy = ydist >= 0 ? 1.0 : -1.0;
+ xdist = abs(xdist);
+ ydist = abs(ydist);
+ if (xdist==0 && ydist==0) {
+ if (dir==0) c=c2; else c=c1;
+ if (!net.computers[c].busy) {
+ if (net.computers[c].os == OS.OFF)
+ net.off--;
+ else
+ net.base--;
+ net.win++;
+ net.computers[c].os=OS.WINGDOWS;
+ }
+ active=0;
+ }
+ else if (game.MAX (xdist, ydist) < spark.speed) {
+ if (dir)
+ {x = x1; y = y1;}
+ else
+ {x = x2; y = y2;}
+ }
+ else {
+ fx+=(xdist*spark.speed*sx)/(xdist+ydist);
+ fy+=(ydist*spark.speed*sy)/(xdist+ydist);
+ x = (int)fx;
+ y = (int)fy;
+ }
+ index = 1 - index;
+ }
+ }
+ else {
+ if ((net.computers[c1].os == OS.WINGDOWS) ==
+ (net.computers[c2].os == OS.WINGDOWS))
+ delay = spark.delay(game.level);
+ else if (net.computers[c1].os == OS.WINGDOWS ||
+ net.computers[c2].os == OS.WINGDOWS)
+ {
+ if (delay>0) delay--;
+ else {
+ active = 1;
+ if (net.computers[c1].os == OS.WINGDOWS)
+ {fx=x=x1; fy=y=y1;}
+ else
+ {fx=x=x2; fy=y=y2;}
+ }
+ }
+ }
+}
+
+int Cable::onspark (int locx, int locy) {
+ if (!active) return 0;
+ return (abs(locx-x) < spark.width
+ && abs(locy-y) < spark.height);
+}
+
+void Cable::draw() {
+ int rx = x - spark.width/2;
+ int ry = y - spark.height/2;
+ ui.draw_line(x1,y1,x2,y2);
+ if (active)
+ ui.draw(spark.pictures[index], rx, ry);
+}
+
diff --git a/noncore/games/kbill/Cable.h b/noncore/games/kbill/Cable.h
new file mode 100644
index 0000000..bb6c31c
--- a/dev/null
+++ b/noncore/games/kbill/Cable.h
@@ -0,0 +1,20 @@
+#ifndef CABLE_H
+#define CABLE_H
+
+class Cable {
+public:
+ int c1, c2; /*computers connected */
+ int x1,y1,x2,y2; /*endpoints of line representing cable */
+ int x, y; /*current location of spark*/
+ float fx, fy; /*needed for line drawing*/
+ int delay; /*how much time until spark leaves*/
+ int active; /*is spark moving and from which end*/
+ int index;
+ void setup();
+ void draw();
+ void update();
+ int onspark (int locx, int locy);
+
+};
+
+#endif
diff --git a/noncore/games/kbill/Computer.cc b/noncore/games/kbill/Computer.cc
new file mode 100644
index 0000000..7bd4bd3
--- a/dev/null
+++ b/noncore/games/kbill/Computer.cc
@@ -0,0 +1,56 @@
+#include "objects.h"
+
+int Computer::setup(int i) {
+ int j, counter=0, flag;
+ do {
+ if (++counter>4000) return 0;
+ x = game.RAND(BORDER, game.scrwidth - BORDER - net.width);
+ y = game.RAND(BORDER, game.scrheight - BORDER - net.height);
+ flag=1;
+ /*checks for conflicting computer placement*/
+ for (j=0; j<i && flag; j++)
+ if (game.INTERSECT(x, y,
+ net.width-bill.list[0].XOFFSET+bill.width,
+ net.height, net.computers[j].x,
+ net.computers[j].y,
+ net.width-bill.list[0].XOFFSET+bill.width,
+ net.height))
+ flag=0;
+ } while (!flag);
+ type = game.RAND(1, net.NUM_SYS);
+ os = determineOS();
+ busy=0;
+ return 1;
+}
+
+int Computer::find_stray() {
+ int i;
+ for (i=0; i < bill.MAX_BILLS; i++) {
+ if (bill.list[i].state != bill.list[i].STRAY) continue;
+ if (game.INTERSECT(x, y, net.width, net.height, bill.list[i].x,
+ bill.list[i].y, OS.width, OS.height))
+ return i;
+ }
+ return -1;
+}
+
+int Computer::oncomputer (int locx, int locy) {
+ return (abs(locx-x) < net.width && abs(locy-y) < net.height);
+}
+
+int Computer::compatible (int system) {
+ return (type==system || (type>=PC && system>=OS.PC));
+}
+
+int Computer::determineOS() {
+ if (type<PC) return type;
+ else return game.RAND (OS.PC, OS.NUM_OS);
+}
+
+void Computer::draw() {
+ ui.draw(net.pictures[type], x, y);
+ if (os != OS.OFF)
+ ui.draw(OS.os[os], x + OFFSET, y + OFFSET);
+}
+
+
diff --git a/noncore/games/kbill/Computer.h b/noncore/games/kbill/Computer.h
new file mode 100644
index 0000000..7edcafb
--- a/dev/null
+++ b/noncore/games/kbill/Computer.h
@@ -0,0 +1,22 @@
+#ifndef COMPUTER_H
+#define COMPUTER_H
+
+class Computer { /*structure for Computers*/
+public:
+ int type; /*CPU type*/
+ int os; /*current OS*/
+ int x, y; /*location*/
+ int busy; /*is the computer being used?*/
+ int setup(int i);
+ void draw();
+ int find_stray();
+ int oncomputer (int locx, int locy);
+ int compatible(int system);
+ int determineOS();
+ static const int TOASTER = 0; /* computer 0 is a toaster */
+ static const int PC = 5; /* type>=PC means the computer is a PC*/
+ static const int OFFSET = 4; /* offset of screen from 0,0 */
+ static const int BORDER = 50; /* BORDER pixels free on all sides*/
+};
+
+#endif
diff --git a/noncore/games/kbill/Game.cc b/noncore/games/kbill/Game.cc
new file mode 100644
index 0000000..624b50b
--- a/dev/null
+++ b/noncore/games/kbill/Game.cc
@@ -0,0 +1,246 @@
+#include "objects.h"
+
+Horde bill;
+Network net;
+Library OS;
+Bucket bucket;
+Spark spark;
+//Scorelist scores;
+Game game;
+UI ui;
+
+int Game::RAND(int lb, int ub) {
+ return (rand()%(ub-lb+1) + lb);
+}
+
+int Game::MAX(int x, int y) {
+ return (x>y ? x : y);
+}
+
+int Game::MIN(int x, int y) {
+ return (x<y ? x : y);
+}
+
+int Game::INTERSECT(int x1, int y1, int w1, int h1, int x2, int y2, int w2,
+ int h2)
+{
+ return (((x2-x1<=w1 && x2-x1>=0) || (x1-x2<=w2 && x1-x2>=0))
+ && ((y2-y1<=h1 && y2-y1>=0) || (y1-y2<=h2 && y1-y2>=0)));
+}
+
+void Game::setup_level (unsigned int lev) {
+ level = lev;
+ bill.setup();
+ grabbed = EMPTY;
+ ui.set_cursor(DEFAULTC);
+ net.setup();
+ iteration = efficiency = 0;
+}
+
+void Game::start(unsigned int lev) {
+ state = PLAYING;
+ score = 0;
+ ui.restart_timer();
+ ui.set_pausebutton(true);
+ setup_level(lev);
+}
+
+void Game::quit() {
+
+ exit(0);
+}
+
+void Game::update_info() {
+ static char str[80];
+ sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d",
+ bill.on_screen, bill.off_screen, net.base, net.off,
+ net.win, level, score);
+ ui.draw_str(str, 5, scrheight-5);
+ efficiency += ((100*net.base-10*net.win)/net.units);
+}
+
+void Game::update_score (int action) {
+ switch (action){
+ case ENDLEVEL: score+=(level*efficiency/iteration); break;
+ default: score+=(action*action*BILLPOINTS);
+ }
+}
+
+void Game::warp_to_level (unsigned int lev) {
+ if (state==PLAYING) {
+ if (lev <= level) return;
+ setup_level(lev);
+ }
+ else {
+ if (lev<=0) return;
+ start(lev);
+ }
+}
+
+void Game::button_press(int x, int y) {
+ int i, counter=0, flag=0;
+ if (state != PLAYING) return;
+ ui.set_cursor(DOWNC);
+ if (bucket.clicked(x, y)) {
+ ui.set_cursor(BUCKETC);
+ grabbed = BUCKET;
+ }
+ for (i=0; i < bill.MAX_BILLS && !flag; i++) {
+ if (bill.list[i].state == bill.list[i].OFF
+ || bill.list[i].state == bill.list[i].DYING)
+ continue;
+ if (bill.list[i].state == bill.list[i].STRAY &&
+ bill.list[i].clickedstray(x, y))
+ {
+ ui.set_cursor (bill.list[i].cargo);
+ grabbed = i;
+ flag = 1;
+ }
+ else if (bill.list[i].state != bill.list[i].STRAY &&
+ bill.list[i].clicked(x, y))
+ {
+ if (bill.list[i].state == bill.list[i].AT)
+ net.computers[bill.list[i].target_c].busy=0;
+ bill.list[i].index = -1;
+ bill.list[i].cels = bill.dcels;
+ bill.list[i].x_offset = -2;
+ bill.list[i].y_offset = -15;
+ bill.list[i].state = bill.list[i].DYING;
+ counter++;
+ }
+ }
+ if (counter) update_score(counter);
+}
+
+void Game::button_release(int x, int y) {
+ int i;
+ ui.set_cursor (DEFAULTC);
+ if (state != PLAYING || grabbed == EMPTY)
+ return;
+ if (grabbed == BUCKET) {
+ grabbed = EMPTY;
+ for (i=0; i<net.ncables; i++)
+ if (net.cables[i].onspark(x, y)) {
+ net.cables[i].active=0;
+ net.cables[i].delay = spark.delay(level);
+ }
+ return;
+ }
+ for (i=0; i<net.units; i++)
+ if (net.computers[i].oncomputer(x, y)
+ &&
+ net.computers[i].compatible (bill.list[grabbed].cargo)
+ &&
+ (net.computers[i].os == OS.WINGDOWS ||
+ net.computers[i].os == OS.OFF))
+ {
+ net.base++;
+ if (net.computers[i].os == OS.WINGDOWS)
+ net.win--;
+ else
+ net.off--;
+ net.computers[i].os = bill.list[grabbed].cargo;
+ bill.list[grabbed].state = bill.list[grabbed].OFF;
+ grabbed = EMPTY;
+ return;
+ }
+ grabbed = EMPTY;
+}
+
+void Game::update() {
+ switch (state) {
+ case PLAYING:
+ ui.clear();
+ bucket.draw();
+ net.update();
+ net.draw();
+ bill.update();
+ bill.draw();
+ update_info();
+ if (!(bill.on_screen+bill.off_screen)) {
+ update_score(ENDLEVEL);
+ state = BETWEEN;
+ }
+ if ((net.base+net.off)<=1) state = END;
+ break;
+ case END:
+ ui.clear();
+ net.toasters();
+ net.draw();
+ ui.refresh();
+ ui.popup_dialog(ENDGAME);
+/* if (score > scores.score[9]) ui.popup_dialog(ENTERNAME);
+ scores.update();*/
+ ui.popup_dialog(HIGHSCORE);
+ ui.clear();
+ ui.draw_centered(logo);
+ ui.kill_timer();
+ ui.set_pausebutton (false);
+ state = WAITING;
+ break;
+ case BETWEEN:
+ ui.update_scorebox(level, score);
+ ui.popup_dialog (SCORE);
+ state = PLAYING;
+ setup_level(++level);
+ break;
+ }
+ ui.refresh();
+ iteration++;
+}
+
+void Game::main(int argc, char **argv) {
+ int c;
+ extern char *optarg;
+
+ level = 0;
+ ui.initialize(&argc, argv);
+ while (argv && argv[0] && (c = getopt(argc, argv, "l:L:")) != -1)
+ switch(c) {
+ case 'l':
+ case 'L': level = MAX (1, atoi(optarg)); break;
+ }
+ srand(time(NULL));
+ ui.make_mainwin();
+ ui.graph_init();
+ ui.clear();
+ logo.load("logo");
+ ui.draw_centered(logo);
+ ui.refresh();
+ ui.make_windows();
+// scores.read();
+// scores.update();
+
+ bill.load_pix();
+ OS.load_pix();
+ net.load_pix();
+ bucket.load_pix();
+ spark.load_pix();
+
+ ui.load_cursors();
+
+ state = WAITING;
+ if (level) start(level);
+ else ui.set_pausebutton(false);
+ ui.MainLoop();
+ exit(0);
+}
+
+int main(int argc, char **argv) {
+ if (argc>1 && !strcmp(argv[1], "-v")) {
+ printf ("XBill version 2.0\n\n");
+ exit(0);
+ }
+ if (argc>1 && !strcmp(argv[1], "-h")) {
+ printf ("XBill version 2.0\n");
+ printf ("Options:\n");
+ printf ("-l n, -L n\tStart at level n.\n");
+ printf ("-v\t\tPrint version number and exit.\n");
+ printf ("-h\t\tPrint help and exit.\n");
+ printf ("leaves the window.\n");
+ printf ("All standard X Intrinsics options are also ");
+ printf ("supported.\n\n");
+ exit(0);
+ }
+ game.main(argc, argv);
+}
diff --git a/noncore/games/kbill/Game.h b/noncore/games/kbill/Game.h
new file mode 100644
index 0000000..4473936
--- a/dev/null
+++ b/noncore/games/kbill/Game.h
@@ -0,0 +1,55 @@
+#ifndef GAME_H
+#define GAME_H
+
+#include "objects.h"
+
+class Game {
+ unsigned state;
+ int efficiency;
+public:
+ unsigned score, level, iteration;
+ Picture logo;
+ int grabbed;
+
+ static const unsigned short scrwidth = 240;
+ static const unsigned short scrheight = 290;
+
+ static const int PLAYING = 1;
+ static const int BETWEEN = 2;
+ static const int END = 3;
+ static const int WAITING = 4;
+
+ static const int DEFAULTC = 0; /* cursors */
+ static const int DOWNC = -1;
+ static const int BUCKETC = -2;
+
+ static const int ENDGAME = 200; /* dialog window IDs */
+ static const int ENTERNAME = 201;
+ static const int HIGHSCORE = 202;
+ static const int SCORE = 203;
+
+ static const int ENDLEVEL = -1; /* Codes for updating score */
+ static const int BILLPOINTS = 5;
+
+ static const int EMPTY = -2; /* Grabbed object */
+ static const int BUCKET = -1;
+
+ int RAND(int lb, int ub);
+ int MAX(int x, int y);
+ int MIN(int x, int y);
+ int INTERSECT(int x1, int y1, int w1, int h1, int x2, int y2, int w2,
+ int h2);
+
+ void setup_level (unsigned int lev);
+ void start(unsigned int lev);
+ void quit();
+ void update_info();
+ void update_score (int action);
+ void warp_to_level (unsigned int lev);
+ void button_press(int x, int y);
+ void button_release(int x, int y);
+ void update();
+ void main(int argc, char **argv);
+};
+
+#endif
diff --git a/noncore/games/kbill/Horde.cc b/noncore/games/kbill/Horde.cc
new file mode 100644
index 0000000..d908037
--- a/dev/null
+++ b/noncore/games/kbill/Horde.cc
@@ -0,0 +1,64 @@
+#include "objects.h"
+
+void Horde::setup() {
+ for (int i=0; i < MAX_BILLS; i++)
+ list[i].state = list[i].OFF;
+ off_screen = on (game.level);
+ on_screen = 0;
+}
+
+/* Launches Bills whenever called */
+void Horde::launch(int max){
+ int i, n;
+ if (!max || !off_screen) return;
+ n=game.RAND(1, game.MIN(max, off_screen));
+ for (i=0; n; n--) {
+ for (i++; i < MAX_BILLS; i++)
+ if (list[i].state == list[i].OFF) break;
+ if (i == MAX_BILLS) return;
+ list[i++].enter();
+ }
+}
+
+int Horde::on (unsigned int lev) {
+ return game.MIN(8+3*lev, MAX_BILLS);
+}
+
+int Horde::max_at_once (unsigned int lev) {
+ return game.MIN(2+lev/4, 12);
+}
+
+int Horde::between (unsigned int lev) {
+ return game.MAX(14-lev/3, 10);
+}
+
+void Horde::load_pix () {
+ int i;
+ for (i=0; i < WCELS-1; i++) {
+ lcels[i].load("billL", i);
+ rcels[i].load("billR", i);
+ }
+ lcels[WCELS-1] = lcels[1];
+ rcels[WCELS-1] = rcels[1];
+
+ for (i=0; i < DCELS; i++)
+ dcels[i].load("billD", i);
+ width=dcels[0].width;
+ height=dcels[0].height;
+
+ for (i=0; i < ACELS; i++)
+ acels[i].load("billA", i);
+}
+
+void Horde::update() {
+ int i;
+ if (!(game.iteration % between(game.level)))
+ launch(max_at_once(game.level));
+ for (i=0; i < MAX_BILLS; i++) list[i].update();
+}
+
+void Horde::draw() {
+ int i;
+ for (i=0; i < MAX_BILLS; i++) list[i].draw();
+}
+
diff --git a/noncore/games/kbill/Horde.h b/noncore/games/kbill/Horde.h
new file mode 100644
index 0000000..a54a620
--- a/dev/null
+++ b/noncore/games/kbill/Horde.h
@@ -0,0 +1,27 @@
+#ifndef HORDE_H
+#define HORDE_H
+
+#include "Monster.h"
+#include "Picture.h"
+
+class Horde { /*global structure of all bills*/
+public:
+ static const int MAX_BILLS = 100; /*max Bills per level*/
+ static const int WCELS = 4; /* # of bill walking animation frames*/
+ static const int DCELS = 5; /* # of bill dying animation frames*/
+ static const int ACELS = 13; /* # of bill switching OS frames*/
+ Monster list[MAX_BILLS]; /* list of monsters in all states*/
+ int width, height;
+ int on_screen, off_screen;
+ Picture lcels[WCELS], rcels[WCELS], acels[ACELS], dcels[DCELS];
+ void load_pix();
+ void setup();
+ void launch(int max);
+ int on(unsigned int lev);
+ int max_at_once(unsigned int lev);
+ int between(unsigned int lev);
+ void update();
+ void draw();
+};
+
+#endif
diff --git a/noncore/games/kbill/Library.cc b/noncore/games/kbill/Library.cc
new file mode 100644
index 0000000..bb1e548
--- a/dev/null
+++ b/noncore/games/kbill/Library.cc
@@ -0,0 +1,13 @@
+#include "objects.h"
+
+void Library::load_pix() {
+ int i;
+ char *name[] = {"wingdows", "apple", "next", "sgi", "sun", "os2",
+ "bsd", "linux", "redhat", "hurd"};
+ for (i=0; i <= NUM_OS; i++) {
+ os[i].load(name[i]);
+ if (i) cursor[i].load(name[i], cursor[i].OWN_MASK);
+ }
+ width = os[0].width;
+ height = os[0].height;
+}
diff --git a/noncore/games/kbill/Library.h b/noncore/games/kbill/Library.h
new file mode 100644
index 0000000..eda2fcf
--- a/dev/null
+++ b/noncore/games/kbill/Library.h
@@ -0,0 +1,19 @@
+#ifndef LIBRARY_H
+#define LIBRARY_H
+
+#include "Picture.h"
+#include "MCursor.h"
+
+class Library { /* global structure of all OSes */
+public:
+ static const int WINGDOWS = 0; /* OS 0 is wingdows */
+ static const int OFF = -1; /* OS -1 means the computer is off */
+ static const int PC = 5; /* OS >= PC means the OS is a PC OS */
+ static const int NUM_OS = 9; /* The number of OSes (not Wingdows) */
+ int width, height; /* size of OS picture*/
+ Picture os[NUM_OS+1]; /* array of OS pictures*/
+ MCursor cursor[NUM_OS+1]; /* array of OS cursors (drag/drop) */
+ void load_pix();
+};
+
+#endif
diff --git a/noncore/games/kbill/MCursor.cc b/noncore/games/kbill/MCursor.cc
new file mode 100644
index 0000000..30f7577
--- a/dev/null
+++ b/noncore/games/kbill/MCursor.cc
@@ -0,0 +1,69 @@
+/***************************************************************************
+ MCursor.cc - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "MCursor.h"
+#include "objects.h"
+
+#include <qcursor.h>
+#include <qbitmap.h>
+#include <qwidget.h>
+#include <qstring.h>
+#ifdef KDEVER
+#include <kapp.h>
+#include <kstandarddirs.h>
+#endif
+#include <iostream.h>
+#include <qpe/resource.h>
+MCursor::~MCursor() {
+ delete cursor;
+}
+
+void MCursor::load(const char *name, int masked) {
+
+ #ifdef KDEVER
+ QString file, mfile;
+ KStandardDirs dirs;
+
+
+ file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + ".xbm");
+
+ QBitmap bitmap, mask;
+ if (bitmap.load(file) == FALSE) {
+ cerr << "cannot open " << file << endl;
+ exit(1);
+ }
+ if (masked == SEP_MASK) {
+// mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name);
+ mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
+ if (mask.load(mfile) == FALSE) {
+ cerr << "cannot open " << file << endl;
+ exit(1);
+ }
+ }
+ else
+ mask = bitmap;
+ #endif
+
+ QBitmap bitmap, mask;
+ bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name));
+
+ if (masked == SEP_MASK)
+ mask = bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
+ else
+ mask = bitmap;
+ cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2);
+}
+
diff --git a/noncore/games/kbill/MCursor.h b/noncore/games/kbill/MCursor.h
new file mode 100644
index 0000000..5bf195e
--- a/dev/null
+++ b/noncore/games/kbill/MCursor.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ MCursor.h - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef MCURSOR_H
+#define MCURSOR_H
+
+/*#include <X11/Xlib.h>
+#include <X11/xpm.h>*/
+
+#include <qcursor.h>
+
+class MCursor {
+public:
+ ~MCursor();
+ static const int SEP_MASK = 0;
+ static const int OWN_MASK = 1;
+ void load(const char *name, int masked);
+private:
+ QCursor *cursor;
+
+ friend class UI;
+};
+
+#endif
diff --git a/noncore/games/kbill/Makefile b/noncore/games/kbill/Makefile
new file mode 100644
index 0000000..419aaaf
--- a/dev/null
+++ b/noncore/games/kbill/Makefile
@@ -0,0 +1,533 @@
+#############################################################################
+# Automatically generated from kbill/Makefile.in
+# Build options from
+#############################################################################
+
+# Compiling
+INTERFACE_DECL_PATH = .
+SYSCONF_CXX = g++
+SYSCONF_CC = gcc
+DASHCROSS =
+
+# Compiling with support libraries
+SYSCONF_CXXFLAGS_X11 =
+SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include
+SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include
+
+# Compiling YACC output
+SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
+
+# Linking with support libraries
+SYSCONF_RPATH_X11 =
+SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib
+SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib
+
+# Linking with support libraries
+# X11
+SYSCONF_LFLAGS_X11 =
+SYSCONF_LIBS_X11 =
+# Qt, Qt+OpenGL
+SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib
+SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX)
+SYSCONF_LIBS_QT_OPENGL =
+# OpenGL
+SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib
+SYSCONF_LIBS_OPENGL =
+# Yacc
+SYSCONF_LIBS_YACC =
+
+# Linking applications
+SYSCONF_LINK = gcc
+SYSCONF_LFLAGS =
+SYSCONF_LIBS =
+
+# Link flags for shared objects
+SYSCONF_LFLAGS_SHOBJ = -shared
+
+# Flags for threading
+SYSCONF_CFLAGS_THREAD = -D_REENTRANT
+SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT
+SYSCONF_LFLAGS_THREAD =
+SYSCONF_LIBS_THREAD = -lpthread
+
+# Meta-object compiler
+SYSCONF_MOC = $(QTDIR)/bin/moc
+
+# UI compiler
+SYSCONF_UIC = $(QTDIR)/bin/uic
+
+# Linking shared libraries
+# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
+# - Place target in $(DESTDIR) - which has a trailing /
+# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
+#
+SYSCONF_LINK_SHLIB = gcc
+SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH)
+SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
+ $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
+ $(OBJECTS) $(OBJMOC) $(LIBS) && \
+ mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
+ cd $(DESTDIR) && \
+ rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \
+ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
+ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \
+ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
+
+# Linking static libraries
+# - Build the $(TARGET) library, eg. lib$(TARGET).a
+# - Place target in $(DESTDIR) - which has a trailing /
+#
+SYSCONF_AR = ar cqs
+SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
+SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
+ $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
+# Compiling application source
+SYSCONF_CXXFLAGS = -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W
+SYSCONF_CFLAGS = -pipe -O2 -Wall -W
+# Default link type (static linking is still be used where required)
+SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED)
+SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED)
+# Compiling library source
+SYSCONF_CXXFLAGS_LIB = -fPIC
+SYSCONF_CFLAGS_LIB = -fPIC
+# Compiling shared-object source
+SYSCONF_CXXFLAGS_SHOBJ = -fPIC
+SYSCONF_CFLAGS_SHOBJ = -fPIC
+# Linking Qt
+SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
+# Linking Qt applications
+SYSCONF_LIBS_QTAPP =
+#############################################################################
+
+####### Compiler, tools and options
+
+CXX = $(SYSCONF_CXX) $(QT_CXX_MT)
+CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
+CC = $(SYSCONF_CC) $(QT_C_MT)
+CFLAGS = $(SYSCONF_CFLAGS)
+INCPATH = -I$(OPIEDIR)/include
+LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
+LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
+MOC = $(SYSCONF_MOC)
+UIC = $(SYSCONF_UIC)
+
+####### Target
+
+DESTDIR = $(OPIEDIR)/bin/
+VER_MAJ = 1
+VER_MIN = 0
+VER_PATCH = 0
+TARGET = zBill
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = kbill.h \
+ field.h \
+ Bucket.h \
+ Cable.h \
+ Computer.h \
+ Game.h \
+ Horde.h \
+ Library.h \
+ MCursor.h \
+ Monster.h \
+ Network.h \
+ Picture.h \
+ Spark.h \
+ Strings.h \
+ UI.h \
+ objects.h \
+ inputbox.h
+SOURCES = field.cpp \
+ Bucket.cc \
+ Cable.cc \
+ Computer.cc \
+ Game.cc \
+ Horde.cc \
+ Library.cc \
+ MCursor.cc \
+ Monster.cc \
+ Network.cc \
+ Picture.cc \
+ Spark.cc \
+ UI.cpp \
+ inputbox.cpp \
+ kbill.cpp
+OBJECTS = field.o \
+ Bucket.o \
+ Cable.o \
+ Computer.o \
+ Game.o \
+ Horde.o \
+ Library.o \
+ MCursor.o \
+ Monster.o \
+ Network.o \
+ Picture.o \
+ Spark.o \
+ UI.o \
+ inputbox.o \
+ kbill.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = moc_kbill.cpp \
+ moc_field.cpp \
+ moc_inputbox.cpp
+OBJMOC = moc_kbill.o \
+ moc_field.o \
+ moc_inputbox.o
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(DESTDIR)$(TARGET)
+
+$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake:
+ tmake kbill.pro
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
+ -rm -f *~ core
+ -rm -f allmoc.cpp
+
+####### Extension Modules
+
+listpromodules:
+ @echo
+
+listallmodules:
+ @echo
+
+listaddonpromodules:
+ @echo
+
+listaddonentmodules:
+ @echo
+
+
+REQUIRES=
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+
+####### Compile
+
+field.o: field.cpp \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Bucket.o: Bucket.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Cable.o: Cable.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Computer.o: Computer.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Game.o: Game.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Horde.o: Horde.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Library.o: Library.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+MCursor.o: MCursor.cc \
+ MCursor.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h \
+ $(OPIEDIR)/include/qpe/resource.h
+
+Monster.o: Monster.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Network.o: Network.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Picture.o: Picture.cc \
+ Picture.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h \
+ $(OPIEDIR)/include/qpe/resource.h
+
+Spark.o: Spark.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+UI.o: UI.cpp \
+ kbill.h \
+ field.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ Strings.h \
+ inputbox.h
+
+inputbox.o: inputbox.cpp \
+ inputbox.h
+
+kbill.o: kbill.cpp \
+ kbill.h \
+ field.h \
+ inputbox.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ Strings.h
+
+moc_kbill.o: moc_kbill.cpp \
+ kbill.h \
+ field.h
+
+moc_field.o: moc_field.cpp \
+ field.h
+
+moc_inputbox.o: moc_inputbox.cpp \
+ inputbox.h
+
+moc_kbill.cpp: kbill.h
+ $(MOC) kbill.h -o moc_kbill.cpp
+
+moc_field.cpp: field.h
+ $(MOC) field.h -o moc_field.cpp
+
+moc_inputbox.cpp: inputbox.h
+ $(MOC) inputbox.h -o moc_inputbox.cpp
+
+
+
+lupdate:
+ lupdate kbill.pro
+
+lrelease:
+ lrelease kbill.pro
+
diff --git a/noncore/games/kbill/Makefile.am b/noncore/games/kbill/Makefile.am
new file mode 100644
index 0000000..a09ea13
--- a/dev/null
+++ b/noncore/games/kbill/Makefile.am
@@ -0,0 +1,59 @@
+####### kdevelop will overwrite this part!!! (begin)##########
+bin_PROGRAMS = kbill
+kbill_SOURCES = inputbox.cpp UI.cc Spark.cc Scorelist.cc Picture.cc Network.cc Monster.cc MCursor.cc Library.cc Horde.cc Game.cc Computer.cc Cable.cc Bucket.cc field.cpp kbill.cpp
+kbill_LDADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET) $(LIB_KIO)
+
+
+SUBDIRS = docs bitmaps pixmaps
+
+EXTRA_DIST = kbill.cpp kbill.h kbill.kdelnk kbill.xpm mini-kbill.xpm field.cpp field.h Bucket.cc Bucket.h Cable.cc Cable.h Computer.cc Computer.h Game.cc Game.h Horde.cc Horde.h Library.cc Library.h MCursor.cc MCursor.h Monster.cc \ Monster.h Network.cc Network.h Picture.cc Picture.h Scorelist.cc Scorelist.h Spark.cc Spark.h \ Strings.h UI.cc objects.h inputbox.cpp inputbox.h
+
+install-data-local:
+ $(mkinstalldirs) $(kde_appsdir)/Games/
+ $(INSTALL_DATA) kbill.kdelnk $(kde_appsdir)/Games/kbill.kdelnk
+ $(mkinstalldirs) $(kde_icondir)/
+ $(INSTALL_DATA) kbill.xpm $(kde_icondir)/kbill.xpm
+ $(mkinstalldirs) $(kde_minidir)/
+ $(INSTALL_DATA) mini-kbill.xpm $(kde_minidir)/kbill.xpm
+ $(mkinstalldirs) $(kde_datadir)/kbill/
+ $(INSTALL_DATA) scores $(kde_datadir)/kbill/scores
+
+uninstall-local:
+ -rm -f $(kde_appsdir)/Games/kbill.kdelnk
+ -rm -f $(kde_icondir)/kbill.xpm
+ -rm -f $(kde_minidir)/kbill.xpm
+ -rm -f $(kde_datadir)/kbill/scores
+
+####### kdevelop will overwrite this part!!! (end)############
+# this 10 paths are KDE specific. Use them:
+# kde_htmldir Where your docs should go to. (contains lang subdirs)
+# kde_appsdir Where your application file (.kdelnk) should go to.
+# kde_icondir Where your icon should go to.
+# kde_minidir Where your mini icon should go to.
+# kde_datadir Where you install application data. (Use a subdir)
+# kde_locale Where translation files should go to.(contains lang subdirs)
+# kde_cgidir Where cgi-bin executables should go to.
+# kde_confdir Where config files should go to.
+# kde_mimedir Where mimetypes should go to.
+# kde_toolbardir Where general toolbar icons should go to.
+# kde_wallpaperdir Where general wallpapers should go to.
+
+# set the include path for X, qt and KDE
+INCLUDES= $(all_includes)
+# claim, which subdirectories you want to install
+# you can add here more. This one gets installed
+bin_PROGRAMS = kbill
+
+kbill_METASOURCES = USE_AUTOMOC
+
+# the library search path.
+kbill_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+# them while "make clean", use CLEANFILES
+DISTCLEANFILES = $(kbill_METASOURCES)
+
+# make messages.po. Move this one to ../po/ and "make merge" in po
+# the -x is for skipping messages already translated in kdelibs
+messages:
+ $(XGETTEXT) -C -ki18n -x $(KDEDIR)/include/kde.pot `find . -name \*.h -o -name \*.cpp -o -name \*.cc` -o ../po/kbill.pot
+
diff --git a/noncore/games/kbill/Makefile.in b/noncore/games/kbill/Makefile.in
new file mode 100644
index 0000000..281db16
--- a/dev/null
+++ b/noncore/games/kbill/Makefile.in
@@ -0,0 +1,427 @@
+#############################################################################
+
+####### Compiler, tools and options
+
+CXX = $(SYSCONF_CXX) $(QT_CXX_MT)
+CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
+CC = $(SYSCONF_CC) $(QT_C_MT)
+CFLAGS = $(SYSCONF_CFLAGS)
+INCPATH = -I$(OPIEDIR)/include
+LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
+LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
+MOC = $(SYSCONF_MOC)
+UIC = $(SYSCONF_UIC)
+
+####### Target
+
+DESTDIR = $(OPIEDIR)/bin/
+VER_MAJ = 1
+VER_MIN = 0
+VER_PATCH = 0
+TARGET = zBill
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = kbill.h \
+ field.h \
+ Bucket.h \
+ Cable.h \
+ Computer.h \
+ Game.h \
+ Horde.h \
+ Library.h \
+ MCursor.h \
+ Monster.h \
+ Network.h \
+ Picture.h \
+ Spark.h \
+ Strings.h \
+ UI.h \
+ objects.h \
+ inputbox.h
+SOURCES = field.cpp \
+ Bucket.cc \
+ Cable.cc \
+ Computer.cc \
+ Game.cc \
+ Horde.cc \
+ Library.cc \
+ MCursor.cc \
+ Monster.cc \
+ Network.cc \
+ Picture.cc \
+ Spark.cc \
+ UI.cpp \
+ inputbox.cpp \
+ kbill.cpp
+OBJECTS = field.o \
+ Bucket.o \
+ Cable.o \
+ Computer.o \
+ Game.o \
+ Horde.o \
+ Library.o \
+ MCursor.o \
+ Monster.o \
+ Network.o \
+ Picture.o \
+ Spark.o \
+ UI.o \
+ inputbox.o \
+ kbill.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = moc_kbill.cpp \
+ moc_field.cpp \
+ moc_inputbox.cpp
+OBJMOC = moc_kbill.o \
+ moc_field.o \
+ moc_inputbox.o
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(DESTDIR)$(TARGET)
+
+$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake:
+ tmake kbill.pro
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
+ -rm -f *~ core
+ -rm -f allmoc.cpp
+
+####### Extension Modules
+
+listpromodules:
+ @echo
+
+listallmodules:
+ @echo
+
+listaddonpromodules:
+ @echo
+
+listaddonentmodules:
+ @echo
+
+
+REQUIRES=
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+
+####### Compile
+
+field.o: field.cpp \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Bucket.o: Bucket.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Cable.o: Cable.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Computer.o: Computer.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Game.o: Game.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Horde.o: Horde.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Library.o: Library.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+MCursor.o: MCursor.cc \
+ MCursor.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h \
+ $(OPIEDIR)/include/qpe/resource.h
+
+Monster.o: Monster.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Network.o: Network.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+Picture.o: Picture.cc \
+ Picture.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h \
+ $(OPIEDIR)/include/qpe/resource.h
+
+Spark.o: Spark.cc \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ field.h \
+ kbill.h
+
+UI.o: UI.cpp \
+ kbill.h \
+ field.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ Strings.h \
+ inputbox.h
+
+inputbox.o: inputbox.cpp \
+ inputbox.h
+
+kbill.o: kbill.cpp \
+ kbill.h \
+ field.h \
+ inputbox.h \
+ objects.h \
+ Horde.h \
+ Monster.h \
+ Picture.h \
+ Network.h \
+ Computer.h \
+ Cable.h \
+ Library.h \
+ MCursor.h \
+ Bucket.h \
+ Spark.h \
+ Game.h \
+ UI.h \
+ $(OPIEDIR)/include/qpe/qpeapplication.h \
+ Strings.h
+
+moc_kbill.o: moc_kbill.cpp \
+ kbill.h \
+ field.h
+
+moc_field.o: moc_field.cpp \
+ field.h
+
+moc_inputbox.o: moc_inputbox.cpp \
+ inputbox.h
+
+moc_kbill.cpp: kbill.h
+ $(MOC) kbill.h -o moc_kbill.cpp
+
+moc_field.cpp: field.h
+ $(MOC) field.h -o moc_field.cpp
+
+moc_inputbox.cpp: inputbox.h
+ $(MOC) inputbox.h -o moc_inputbox.cpp
+
+
diff --git a/noncore/games/kbill/Monster.cc b/noncore/games/kbill/Monster.cc
new file mode 100644
index 0000000..72bf39b
--- a/dev/null
+++ b/noncore/games/kbill/Monster.cc
@@ -0,0 +1,226 @@
+#include "objects.h"
+
+void Monster::get_border() {
+ int i=game.RAND(0,3);
+ if (i%2==0) target_x=game.RAND(0, game.scrwidth-bill.width);
+ else target_y=game.RAND(0, game.scrheight-bill.height);
+ switch (i) {
+ case 0: target_y=-bill.height-16; break;
+ case 1: target_x=game.scrwidth+1; break;
+ case 2: target_y=game.scrwidth+1; break;
+ case 3: target_x=-bill.width-2; break;
+ }
+}
+
+/* Adds a bill to the in state*/
+void Monster::enter(){
+ state = IN;
+ get_border();
+ x = target_x; y=target_y;
+ index = 0;
+ cels = bill.lcels;
+ cargo = OS.WINGDOWS;
+ x_offset = -2;
+ y_offset = -15;
+ target_c = game.RAND(0, net.units-1);
+ target_x = net.computers[target_c].x+net.width-XOFFSET;
+ target_y = net.computers[target_c].y+YOFFSET;
+ bill.on_screen++; bill.off_screen--;
+}
+
+/* Moves bill toward his target - returns whether or not he moved */
+int Monster::move (int mode) {
+ int xdist = target_x - x;
+ int ydist = target_y - y;
+ int step = step_size(game.level);
+ int dx, dy;
+ int signx = xdist >= 0 ? 1 : -1;
+ int signy = ydist >= 0 ? 1 : -1;
+ xdist = abs(xdist);
+ ydist = abs(ydist);
+ if (!xdist && !ydist) return 0;
+ else if (xdist<step && ydist<step) {
+ x = target_x;
+ y = target_y;
+ }
+ else {
+ dx = (xdist*step*signx)/(xdist+ydist);
+ dy = (ydist*step*signy)/(xdist+ydist);
+ switch(mode) {
+ case SLOW: break;
+ case FAST: dx = 5*dx/4; dy = 5*dy/4; break;
+ }
+ x+=dx;
+ y+=dy;
+ if (dx<0)
+ cels = bill.lcels;
+ else if (dx>0)
+ cels = bill.rcels;
+ }
+ return 1;
+}
+
+void Monster::draw() {
+ switch (state) {
+ case IN:
+ case OUT:
+ case DYING: draw_std(); break;
+ case AT: draw_at(); break;
+ case STRAY: draw_stray(); break;
+ default: break;
+ }
+}
+
+/* Update Bill's position */
+void Monster::update_in() {
+ int moved = move(SLOW);
+ if (!moved && (net.computers[target_c].os != OS.WINGDOWS)
+ && !(net.computers[target_c].busy))
+ {
+ net.computers[target_c].busy=1;
+ cels = bill.acels;
+ index=0;
+ state = AT;
+ return;
+ }
+ else if (!moved) {
+ int i;
+ do {
+ i=game.RAND(0, net.units-1);
+ } while (i == target_c);
+ target_c = i;
+ target_x = net.computers[target_c].x + net.width-XOFFSET;
+ target_y = net.computers[target_c].y + YOFFSET;
+ }
+ index++;
+ index%=bill.WCELS;
+ y_offset+=(8*(index%2)-4);
+}
+
+/* Update Bill standing at a computer */
+void Monster::update_at() {
+ int sys;
+ if (index==0 && net.computers[target_c].os == OS.OFF) {
+ index=6;
+ sys = net.computers[target_c].find_stray();
+ if (sys<0) cargo = -1;
+ else {
+ cargo = bill.list[sys].cargo;
+ bill.list[sys].state = OFF;
+ }
+ }
+ else index++;
+ if (index == 13) {
+ y_offset = -15;
+ x_offset = -2;
+ get_border();
+ index = 0;
+ cels = bill.lcels;
+ state = OUT;
+ net.computers[target_c].busy=0;
+ return;
+ }
+ y_offset = bill.height - OS.height;
+ switch (index) {
+ case 1 :
+ case 2 : x -= 8; x_offset +=8; break;
+ case 3 : x -= 10; x_offset +=10; break;
+ case 4 : x += 3; x_offset -=3; break;
+ case 5 : x += 2; x_offset -=2; break;
+ case 6 :
+ if (net.computers[target_c].os != OS.OFF) {
+ net.base--; net.off++;
+ cargo = net.computers[target_c].os;
+ }
+ else {
+ x-=21; x_offset+=21;
+ }
+ net.computers[target_c].os = OS.OFF;
+ y_offset = -15;
+ x += 20;
+ x_offset -=20;
+ break;
+ case 7 : sy = y_offset; sx = -2; break;
+ case 8 : sy = -15; sx = -2; break;
+ case 9 : sy = -7; sx = -7; x -= 8; x_offset +=8; break;
+ case 10 : sy = 0; sx = -7; x -= 15; x_offset +=15; break;
+ case 11 : sy = 0; sx = -7;
+ net.computers[target_c].os = OS.WINGDOWS;
+ net.off--; net.win++;
+ break;
+ case 12 : x += 11; x_offset -=11;
+ }
+}
+
+/* Updates Bill fleeing with his ill gotten gain */
+void Monster::update_out() {
+ if (game.INTERSECT(x, y, bill.width, bill.height, 0, 0, game.scrwidth,
+ game.scrheight))
+ {
+ move(FAST);
+ index++;
+ index%=bill.WCELS;
+ y_offset+=(8*(index%2)-4);
+ }
+ else {
+ state = OFF;
+ bill.on_screen--; bill.off_screen++;
+ }
+}
+
+
+/* Updates Bill who is dying */
+void Monster::update_dying() {
+ if (index < bill.DCELS-1){
+ y_offset += (index*GRAVITY);
+ index++;
+ }
+ else {
+ y+=y_offset;
+ if (cargo<0 || cargo == OS.WINGDOWS) state = OFF;
+ else state = STRAY;
+ bill.on_screen--;
+ }
+}
+
+void Monster::update() {
+ switch (state) {
+ case IN: update_in(); break;
+ case AT: update_at(); break;
+ case OUT: update_out(); break;
+ case DYING: update_dying(); break;
+ default: break;
+ }
+}
+
+int Monster::clicked(int locx, int locy) {
+ return (locx>x && locx<x+bill.width && locy>y && locy<y+bill.height);
+}
+
+int Monster::clickedstray(int locx, int locy) {
+ return (locx>x && locx<x+OS.width && locy>y && locy<y+OS.height);
+}
+
+int Monster::step_size(unsigned int lev) {
+ return game.MIN(14+lev, 18);
+}
+
+void Monster::draw_std() {
+ if (cargo>=0)
+ ui.draw(OS.os[cargo], x + x_offset, y + y_offset);
+ ui.draw(cels[index], x, y);
+}
+
+void Monster::draw_at() {
+ if (index>6 && index<12)
+ ui.draw(OS.os[0], x + sx, y + sy);
+ if (cargo>=0)
+ ui.draw(OS.os[cargo], x + x_offset, y + y_offset);
+ ui.draw(cels[index], net.computers[target_c].x,
+ net.computers[target_c].y);
+}
+
+void Monster::draw_stray() {
+ if (game.grabbed==-1 || x != bill.list[game.grabbed].x)
+ ui.draw(OS.os[cargo], x, y);
+}
diff --git a/noncore/games/kbill/Monster.h b/noncore/games/kbill/Monster.h
new file mode 100644
index 0000000..84a8961
--- a/dev/null
+++ b/noncore/games/kbill/Monster.h
@@ -0,0 +1,53 @@
+#ifndef BILL_H
+#define BILL_H
+
+#include "Picture.h"
+
+class Monster { /*structure for Bills*/
+public:
+ int state; /*what is it doing?*/
+ int index; /*index to animation frame*/
+ Picture *cels; /*pointer to array of animation frames*/
+ int x, y; /*location*/
+ int target_x; /*target x position*/
+ int target_y; /*target y position*/
+ int target_c; /*target computer*/
+ int cargo; /*which OS carried*/
+ int x_offset; /*accounts for width differences*/
+ int y_offset; /*'bounce' factor for OS carried*/
+ int sx, sy; /*used for drawing extra OS during switch*/
+
+ static const int SLOW = 0; /* speeds of moving bills */
+ static const int FAST = 1;
+
+ static const int OFF = 0; /* Bill's states */
+ static const int IN = 1;
+ static const int AT = 2;
+ static const int OUT = 3;
+ static const int DYING = 4;
+ static const int STRAY = 5;
+
+ static const int GRAVITY = 3; /*speed at which os drops*/
+
+ static const int XOFFSET = 20; /*offset from right of computer*/
+ static const int YOFFSET = 3; /*offset from top of computer*/
+
+ void get_border();
+ void enter();
+ int move(int mode);
+ void draw();
+ void draw_std();
+ void draw_at();
+ void draw_stray();
+ void update();
+ void update_in();
+ void update_at();
+ void update_out();
+ void update_dying();
+ int clicked(int locx, int locy);
+ int clickedstray(int locx, int locy);
+ int step_size(unsigned int lev);
+
+};
+
+#endif
diff --git a/noncore/games/kbill/Network.cc b/noncore/games/kbill/Network.cc
new file mode 100644
index 0000000..d163b16
--- a/dev/null
+++ b/noncore/games/kbill/Network.cc
@@ -0,0 +1,49 @@
+#include "objects.h"
+
+/*sets up network for each level*/
+void Network::setup() {
+ int i;
+ units = on (game.level);
+ for (i=0; i<units; i++)
+ if (!net.computers[i].setup(i)) {
+ units = i-1;
+ break;
+ }
+ base = units;
+ off = win = 0;
+ ncables = game.MIN(game.level, units/2);
+ for (i=0; i<ncables; i++) cables[i].setup();
+}
+
+/*redraws the computers at their location with the proper image*/
+void Network::draw () {
+ int i;
+ for (i=0; i<ncables; i++) cables[i].draw();
+ for (i=0; i<units; i++) computers[i].draw();
+}
+
+void Network::update () {
+ for (int i=0; i<ncables; i++) cables[i].update();
+}
+
+void Network::toasters () {
+ for (int i=0; i<units; i++) {
+ computers[i].type = computers[i].TOASTER;
+ computers[i].os = OS.OFF;
+ }
+ ncables=0;
+}
+
+int Network::on(int lev) {
+ return game.MIN(8+lev, MAX_COMPUTERS);
+}
+
+void Network::load_pix () {
+ int i;
+ char *name[] = {"toaster", "maccpu", "nextcpu", "sgicpu", "suncpu",
+ "os2cpu", "bsdcpu"};
+ for (i=0; i <= NUM_SYS; i++)
+ pictures[i].load(name[i]);
+ width = pictures[0].width;
+ height = pictures[0].height;
+}
diff --git a/noncore/games/kbill/Network.h b/noncore/games/kbill/Network.h
new file mode 100644
index 0000000..03ff148
--- a/dev/null
+++ b/noncore/games/kbill/Network.h
@@ -0,0 +1,27 @@
+#ifndef NETWORK_H
+#define NETWORK_H
+
+#include "Computer.h"
+#include "Cable.h"
+
+class Network { /*structure for global network of computers*/
+public:
+ static const int MAX_COMPUTERS = 20; /* max computers on screen */
+ static const int NUM_SYS = 6; /* number of computer types */
+ Picture pictures[NUM_SYS+1]; /* array of cpu pictures */
+ int width, height; /* size of cpu picture */
+ int units; /* number of cpus in network */
+ int win, base, off; /* number in each state */
+ Computer computers[MAX_COMPUTERS]; /* array of cpu info */
+ Cable cables[MAX_COMPUTERS];
+ int ncables;
+ void setup();
+ void load_pix();
+ void draw();
+ void update();
+ void toasters();
+ int on(int lev);
+
+};
+
+#endif
diff --git a/noncore/games/kbill/Picture.cc b/noncore/games/kbill/Picture.cc
new file mode 100644
index 0000000..79e19ba
--- a/dev/null
+++ b/noncore/games/kbill/Picture.cc
@@ -0,0 +1,72 @@
+/***************************************************************************
+ Picture.cc - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "Picture.h"
+#include "objects.h"
+
+#include <iostream.h>
+
+#include <qstring.h>
+#include <qpe/resource.h>
+#ifdef KDEVER
+#include <kapp.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+#endif
+void Picture::load(const char *name, int index) {
+ //QString dir = KApplication::kde_datadir(), file;
+// QString dir = locate("data",""),file;
+// dir += "/kbill/";
+// if (index>=0)
+// file.sprintf ("%spixmaps/%s_%d.xpm", (const char *)dir, name, index);
+// else
+// file.sprintf("%spixmaps/%s.xpm", (const char *)dir, name);
+#ifdef KDEVER
+ KStandardDirs dirs;
+ QString file;
+
+ if (index>=0) {
+ //kdDebug() << "Here";
+ QString sindex;
+ sindex.setNum(index);
+ // kdDebug() << "kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm";
+ file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm");
+ } else {
+ file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + ".xpm");
+ }
+ kdDebug() << file << endl;
+ pix = new QPixmap();
+ if (pix->load(file) == FALSE)
+ cerr << "cannot open " << file << endl;
+ width = pix->width();
+ height = pix->height();
+#endif
+QString sindex;
+pix = new QPixmap();
+sindex.setNum(index);
+if (index>=0)
+pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex));
+else
+pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name)));
+
+ width = pix->width();
+ height = pix->height();
+
+}
+
+QPixmap* Picture::getPixmap() {
+ return pix;
+}
diff --git a/noncore/games/kbill/Picture.h b/noncore/games/kbill/Picture.h
new file mode 100644
index 0000000..c423251
--- a/dev/null
+++ b/noncore/games/kbill/Picture.h
@@ -0,0 +1,32 @@
+/***************************************************************************
+ Picture.h - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef PICTURE_H
+#define PICTURE_H
+
+#include <qpixmap.h>
+
+class Picture {
+public: int width, height;
+ void load(const char *name, int index=-1);
+ QPixmap* getPixmap();
+private:
+ QPixmap *pix;
+
+ friend class UI;
+};
+
+#endif
diff --git a/noncore/games/kbill/Scorelist.cc b/noncore/games/kbill/Scorelist.cc
new file mode 100644
index 0000000..8825373
--- a/dev/null
+++ b/noncore/games/kbill/Scorelist.cc
@@ -0,0 +1,75 @@
+#include <qstring.h>
+#ifdef KDEVER
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#endif
+#include "objects.h"
+
+FILE *Scorelist::open_file(char *mode) {
+// QString file;
+// file.sprintf("%s/kbill/scores", (const char *)locate("data",""));
+// //kdDebug() << locate("data","") << endl;
+// return fopen (file, mode);
+}
+
+void Scorelist::read() {
+// FILE *scorefile = open_file("r");
+// int i;
+// if (scorefile) {
+// for (i=0; i<10; i++) {
+// fgets (name[i], 21, scorefile);
+// fscanf (scorefile, "%d%d\n", &(level[i]), &(score[i]));
+// }
+// fclose(scorefile);
+// }
+// else
+// for (i=0; i<10; i++) {
+// strcpy(name[i], "me");
+// level[i] = score[i] = 0;
+// }
+}
+
+void Scorelist::write() {
+// int i, j;
+// FILE *scorefile = open_file("w");
+// if (!scorefile) return;
+// for (i=0; i<10; i++) {
+// fputs(name[i], scorefile);
+// for (j=strlen(name[i]); j<25; j++)
+// fputc(' ', scorefile);
+// fprintf (scorefile, " %d %d\n", level[i], score[i]);
+// }
+// fclose(scorefile);
+}
+
+/* Add new high score to list */
+void Scorelist::recalc (char *str) {
+// int i;
+// if (score[9] >= game.score) return;
+// for (i=9; i>0; i--) {
+// if (score[i-1] < game.score) {
+// strcpy (name[i], name[i-1]);
+// level[i] = level[i-1];
+// score[i] = score[i-1];
+// }
+// else break;
+// }
+// strcpy (name[i], str);
+// level[i] = game.level;
+// score[i] = game.score;
+}
+
+void Scorelist::update() {
+// char str[500], temp[40];
+// int i, j;
+// strcpy (str,"High Scores:\n\n");
+// strcat (str, "Name Level Score\n");
+// for (i=0; i<10; i++) {
+// strcat (str, name[i]);
+// for (j=strlen(name[i]); j<21; j++) strcat (str, " ");
+// sprintf (temp, "%5d %7d\n", level[i], score[i]);
+// strcat (str, temp);
+// }
+// ui.update_hsbox(str);
+}
+
diff --git a/noncore/games/kbill/Scorelist.h b/noncore/games/kbill/Scorelist.h
new file mode 100644
index 0000000..0c8b0dd
--- a/dev/null
+++ b/noncore/games/kbill/Scorelist.h
@@ -0,0 +1,16 @@
+#ifndef SCORELIST_H
+#define SCORELIST_H
+
+class Scorelist {
+public:
+ char name[10][21];
+ unsigned level[10];
+ unsigned score[10];
+ FILE *open_file(char *mode);
+ void read();
+ void write();
+ void recalc(char *str);
+ void update();
+};
+
+#endif
diff --git a/noncore/games/kbill/Spark.cc b/noncore/games/kbill/Spark.cc
new file mode 100644
index 0000000..74c42fa
--- a/dev/null
+++ b/noncore/games/kbill/Spark.cc
@@ -0,0 +1,13 @@
+#include "objects.h"
+
+int Spark::delay(unsigned int lev) {
+ return game.MAX (20-lev, 0);
+}
+
+void Spark::load_pix() {
+ int i;
+ for (i=0; i<2; i++)
+ pictures[i].load("spark", i);
+ width = pictures[0].width;
+ height = pictures[0].height;
+}
diff --git a/noncore/games/kbill/Spark.h b/noncore/games/kbill/Spark.h
new file mode 100644
index 0000000..4fbe6c8
--- a/dev/null
+++ b/noncore/games/kbill/Spark.h
@@ -0,0 +1,16 @@
+#ifndef SPARK_H
+#define SPARK_H
+
+#include "Picture.h"
+
+class Spark {
+public:
+ Picture pictures[2];
+ int width, height;
+ void draw();
+ void load_pix();
+ static const int speed = 5;
+ int delay(unsigned int lev);
+};
+
+#endif
diff --git a/noncore/games/kbill/Strings.h b/noncore/games/kbill/Strings.h
new file mode 100644
index 0000000..45509d1
--- a/dev/null
+++ b/noncore/games/kbill/Strings.h
@@ -0,0 +1,58 @@
+#ifndef STRINGS_H
+#define STRINGS_H
+
+#define storystr \
+" The Story:\n\
+\n\
+Yet again, the fate of the world rests\n\
+in your hands! An evil computer hacker,\n\
+known only by his handle 'Bill', has\n\
+created the ultimate computer virus. A\n\
+virus so powerful that it has the power\n\
+to transmute an ordinary computer into\n\
+a toaster oven. (oooh!) 'Bill' has\n\
+cloned himself into a billion-jillion\n\
+micro-Bills. Their sole purpose is to\n\
+deliver the nefarious virus, which has\n\
+been cleverly diguised as a popular\n\
+operating system.\n\
+\n\
+As System Administrator/Exterminator,\n\
+your job is to keep Bill from succeeding\n\
+at his task."
+
+#define rulesstr \
+" The Rules:\n\
+\n\
+kBill has been painstakingly designed and\n\
+researched in order to make it as easy to use\n\
+for the whole family as it is for little Sally.\n\
+Years - nay - days of beta testing and \n\
+consulting with the cheapest of human interface\n\
+designers have resulted in a game that is easy\n\
+to use, yet nothing at all like a Macintosh.\n\
+\n\
+I. Whack the Bills (click)\n\
+II. Restart the computer (click)\n\
+III. Pick up stolen OSes & return(drag)\n\
+ them to their respective computers\n\
+IV. Drag the bucket to extinguish sparks\n\
+V. Scoring is based on total uptime,\n\
+ with bonuses for killing Bills.\n\
+\n\
+As for the rest, you can probably figure\n\
+it out. We did, so it can't be too hard."
+
+#define endgamestr \
+"Module kBill has caused a\n\
+segmentation fault at memory\n\
+address 097E:F1A0. Core dumped.\n\
+We apologize for the inconvenience."
+
+#define warpstr "Warp to level?"
+#define quitstr "Quit Game?"
+#define newgamestr "New Game?"
+#define pausestr "Game paused.\n Press OK to continue."
+#define enternamestr "You earned a high score.\nEnter your name:"
+
+#endif
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp
new file mode 100644
index 0000000..fac731a
--- a/dev/null
+++ b/noncore/games/kbill/UI.cpp
@@ -0,0 +1,175 @@
+/***************************************************************************
+ UI.cc - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "kbill.h"
+#include "objects.h"
+#include "Strings.h"
+#ifdef KDEVER
+#include <kapplication.h>
+#endif
+#include <qpixmap.h>
+#include <qmessagebox.h>
+#include <qnamespace.h>
+
+#include "inputbox.h"
+
+/**************************/
+/* Timer control routines */
+/**************************/
+
+UI::~UI() {
+ paint.end();
+ delete pix;
+}
+
+void UI::restart_timer() {
+ field->startTimer();
+}
+
+void UI::kill_timer() {
+ field->stopTimer();
+}
+
+/*******************/
+/* Window routines */
+/*******************/
+
+void UI::initialize(int *argc, char **argv) {
+ #ifdef KDEVER
+ app = new KApplication(*argc, argv, "kbill");
+ #endif
+ app = new QPEApplication(*argc, argv);
+}
+
+void UI::graph_init() {
+ pix = new QPixmap(Game::scrwidth, Game::scrheight);
+ paint.begin(pix, field);
+ paint.setPen(QPen(Qt::black, 3));
+}
+
+void UI::make_mainwin() {
+ main = new KBill();
+ app->showMainWidget(main,true);
+ main->showMaximized();
+ field = main->getField();
+}
+
+void UI::popup_dialog (int dialog) {
+ kill_timer();
+ switch (dialog) {
+ case Game::ENDGAME:
+ QMessageBox::message(("Endgame"), (endgamestr));
+ break;
+ case Game::HIGHSCORE:
+ // QMessageBox::message(("HighScore"), highscorestr);
+ break;
+ case Game::ENTERNAME: {
+ InputBox b(main, 0, ("Enter Name"), (enternamestr));
+ bool state = b.exec() == 2;
+ char str[20], *nl;
+ strcpy(str, b.getText());
+ if (!str[0] || state)
+ strcpy(str, "Anonymous");
+ else if ((nl = strchr(str, '\n')))
+ *nl = '\0';
+ if (strlen(str) > 20)
+ str[20] = 0; /* truncate string if too long */
+// scores.recalc(str);
+ }
+ break;
+ case Game::SCORE:
+ QMessageBox::message(("Score"), scorestr);
+ break;
+ }
+ restart_timer();
+}
+
+/*********************/
+/* Graphics routines */
+/*********************/
+
+void UI::set_cursor(int cursor) {
+ QCursor *cur;
+ switch (cursor) {
+ case Game::BUCKETC:
+ cur = bucket.cursor.cursor;
+ break;
+ case Game::DOWNC:
+ cur = downcursor.cursor;
+ break;
+ case Game::DEFAULTC:
+ cur = defaultcursor.cursor;
+ break;
+ default:
+ cur = OS.cursor[cursor].cursor;
+ }
+ field->setCursor(*cur);
+}
+
+void UI::load_cursors() {
+ defaultcursor.load("hand_up", MCursor::SEP_MASK);
+ field->setCursor(*defaultcursor.cursor);
+ downcursor.load("hand_down", MCursor::SEP_MASK);
+}
+
+void UI::clear() {
+ paint.eraseRect(0, 0, field->width(), field->height());
+}
+
+void UI::refresh() {
+ paint.flush();
+ field->setPixmap(pix);
+ field->repaint(FALSE);
+}
+
+void UI::draw (Picture pict, int x, int y) {
+ paint.drawPixmap(x, y, *pict.pix);
+}
+
+void UI::draw_centered (Picture pict) {
+ draw(pict, (field->width() - pict.width) / 2, (field->height() - pict.height) / 2);
+}
+
+void UI::draw_line(int x1, int y1, int x2, int y2) {
+ paint.drawLine(x1, y1, x2, y2);
+
+}
+
+void UI::draw_str(char *str, int x, int y) {
+ paint.drawText(x, y, str);
+}
+
+
+/******************/
+/* Other routines */
+/******************/
+
+void UI::set_pausebutton (int action) {
+ main->file->setItemEnabled(main->pauseid, action);
+}
+
+
+int UI::MainLoop() {
+ return app->exec();
+}
+
+void UI::update_hsbox(char *str) {
+ highscorestr = str;
+}
+
+void UI::update_scorebox(int level, int score) {
+ scorestr.sprintf ("%s %d:\n%s: %d", ("After Level"), level, ("Your score"), score);
+}
diff --git a/noncore/games/kbill/UI.h b/noncore/games/kbill/UI.h
new file mode 100644
index 0000000..8eaf6fd
--- a/dev/null
+++ b/noncore/games/kbill/UI.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ UI.h - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef UI_H
+#define UI_H
+
+#include <qpe/qpeapplication.h>
+#include <qobject.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qstring.h>
+
+#include "Picture.h"
+#include "MCursor.h"
+
+#include "field.h"
+#include "kbill.h"
+
+class UI {
+public:
+ ~UI();
+ void restart_timer();
+ void kill_timer();
+
+ void initialize(int *argc, char **argv);
+ void make_mainwin();
+ void make_windows() {};
+ void popup_dialog (int dialog);
+
+ void set_cursor (int cursor);
+ void load_cursors();
+ void graph_init();
+ void clear();
+ void refresh();
+ void draw (Picture picture, int x, int y);
+ void draw_centered (Picture picture);
+ void draw_line (int x1, int y1, int x2, int y2);
+ void draw_str (char *str, int x, int y);
+
+ void set_pausebutton (int action);
+ int MainLoop();
+
+ void update_scorebox(int level, int score);
+ void update_hsbox(char *str);
+private:
+ MCursor defaultcursor, downcursor;
+
+ QPEApplication *app;
+ QTimer* timer;
+
+ Field* field;
+ KBill* main;
+
+ QPixmap *pix;
+ QPainter paint;
+
+ QString scorestr, highscorestr;
+};
+
+#endif
diff --git a/noncore/games/kbill/field.cpp b/noncore/games/kbill/field.cpp
new file mode 100644
index 0000000..a1b3560
--- a/dev/null
+++ b/noncore/games/kbill/field.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ field.cpp - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qpainter.h>
+
+#include "objects.h"
+
+#include "field.h"
+
+Field::Field(QWidget *parent, const char *name ) : QWidget(parent,name) {
+ setFixedSize(game.scrwidth, game.scrheight);
+ setBackgroundColor(white);
+ timer = new QTimer(this);
+
+ playing = false;
+
+ connect(timer, SIGNAL(timeout()), SLOT(Timer()));
+}
+
+Field::~Field(){
+ delete timer;
+}
+
+void Field::setPixmap(QPixmap *pix) {
+ this->pix = pix;
+}
+
+// --------------------------------------------------------
+
+void Field::mousePressEvent(QMouseEvent *e){
+ game.button_press(e->x(), e->y());
+}
+
+void Field::mouseReleaseEvent(QMouseEvent *e){
+ game.button_release(e->x(), e->y());
+}
+
+void Field::enterEvent(QEvent *) {
+ if (playing && !timer->isActive()) {
+ playing = true;
+ timer->start(250, FALSE);
+ }
+}
+
+void Field::leaveEvent(QEvent *) {
+ if (timer->isActive() && playing) {
+ playing = true;
+ timer->stop();
+ }
+}
+
+void Field::stopTimer() {
+ playing = false;
+ if (timer->isActive())
+ timer->stop();
+}
+
+void Field::startTimer() {
+ playing = true;
+ if (!timer->isActive())
+ timer->start(250, FALSE);
+}
+
+void Field::Timer(){
+ game.update();
+}
+
+void Field::paintEvent(QPaintEvent *) {
+ bitBlt(this, 0, 0, pix);
+} \ No newline at end of file
diff --git a/noncore/games/kbill/field.h b/noncore/games/kbill/field.h
new file mode 100644
index 0000000..9f355ed
--- a/dev/null
+++ b/noncore/games/kbill/field.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ field.h - description
+ -------------------
+ begin : Thu Dec 30 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FIELD_H
+#define FIELD_H
+
+#include <qwidget.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qtimer.h>
+
+class Field : public QWidget {
+ Q_OBJECT
+public:
+ Field(QWidget *parent=0, const char *name=0);
+ ~Field();
+ void stopTimer();
+ void startTimer();
+ void setPixmap(QPixmap *pix);
+protected:
+ void mouseReleaseEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e);
+ void enterEvent(QEvent *);
+ void leaveEvent(QEvent *);
+ void paintEvent(QPaintEvent *);
+public slots:
+ void Timer();
+private:
+ QTimer* timer;
+ QPixmap *pix;
+ bool playing;
+};
+
+#endif
diff --git a/noncore/games/kbill/inputbox.cpp b/noncore/games/kbill/inputbox.cpp
new file mode 100644
index 0000000..b191ea8
--- a/dev/null
+++ b/noncore/games/kbill/inputbox.cpp
@@ -0,0 +1,51 @@
+/***************************************************************************
+ inputbox.cpp - description
+ -------------------
+ begin : Sat Jan 1 2000
+ copyright : (C) 2000 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "inputbox.h"
+#include <qdialog.h>
+InputBox::InputBox(QWidget *parent, const char *name, const char *caption, const char *text) : QDialog(parent, name, TRUE) {
+// setCaption(caption);
+//
+// question = new QLabel(this);
+// question->setText(text);
+// question->setGeometry(10, 10, 240, 50);
+//
+// input = new QLineEdit(this);
+// input->setGeometry(10, 60, 240, 30);
+// input->setFocus();
+// input->setMaxLength(19);
+//
+// ok = new QPushButton( "Ok", this );
+// ok->setGeometry(10, 100, 100,30 );
+// ok->setDefault(TRUE);
+// connect( ok, SIGNAL(clicked()), SLOT(accept()) );
+//
+// cancel = new QPushButton( "Cancel", this );
+// cancel->setGeometry(150, 100, 100,30 );
+// connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
+}
+
+InputBox::~InputBox(){
+ delete ok;
+ delete cancel;
+ delete question;
+ delete input;
+}
+
+QString InputBox::getText() const{
+ return input->text();
+}
diff --git a/noncore/games/kbill/inputbox.h b/noncore/games/kbill/inputbox.h
new file mode 100644
index 0000000..0a64048
--- a/dev/null
+++ b/noncore/games/kbill/inputbox.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ inputbox.h - description
+ -------------------
+ begin : Sat Jan 1 2000
+ copyright : (C) 2000 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef INPUTBOX_H
+#define INPUTBOX_H
+
+#include <qdialog.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+
+#include <qstring.h>
+#include <qlineedit.h>
+class InputBox : public QDialog {
+ Q_OBJECT
+public:
+ InputBox(QWidget *parent=0, const char *name=0, const char *caption = 0, const char *text=0);
+ ~InputBox();
+ QString getText() const;
+private:
+ QPushButton *ok, *cancel;
+ QLabel *question;
+ QLineEdit *input;
+};
+
+#endif
diff --git a/noncore/games/kbill/kbill.cpp b/noncore/games/kbill/kbill.cpp
new file mode 100644
index 0000000..568df95
--- a/dev/null
+++ b/noncore/games/kbill/kbill.cpp
@@ -0,0 +1,118 @@
+/***************************************************************************
+ kbill.cpp - description
+ -------------------
+ begin : Thu Dec 30 16:55:55 CET 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qmessagebox.h>
+#include <qmenubar.h>
+#include "kbill.h"
+#include "inputbox.h"
+
+#include "objects.h"
+#include "Strings.h"
+
+KBill::KBill() : QMainWindow() {
+ setCaption("kBill");
+ file = new QPopupMenu();
+ file->insertItem(("New game"), this, SLOT(NewGame()));
+ pauseid = file->insertItem(("Pause game"), this, SLOT(Pause()));
+ //these are dissabled until I fix them
+ //file->insertItem(("Warp to level..."), this, SLOT(WarpTo()));
+ //file->insertItem(("View high scores"), this, SLOT(ViewHighScores()));
+ file->insertItem(("Quit game"), this, SLOT(Quit()));
+
+ help = new QPopupMenu();
+ help->insertItem(("Story of kBill"), this, SLOT(Story()));
+ help->insertItem(("Rules"), this, SLOT(Rules()));
+
+
+ menu = new QMenuBar(this);
+ menu->insertItem(("&File"), file);
+ menu->insertSeparator();
+ menu->insertItem(("&Help"), help);
+
+ field = new Field(this);
+ //setView(field);
+ //setMainWidget(field);
+ //setMenu(menu);
+}
+
+KBill::~KBill() {
+}
+
+Field* KBill::getField() {
+ return field;
+}
+
+// -----------------------------------------------------------------------
+
+void KBill::Quit() {
+ field->stopTimer();
+ qApp->quit();
+
+}
+
+void KBill::About(){
+// field->stopTimer();
+// AboutBox about(this);
+// about.exec();
+// field->startTimer();
+}
+
+void KBill::NewGame() {
+ field->stopTimer();
+// if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1)
+ game.start(1);
+// else
+ field->startTimer();
+}
+
+void KBill::Pause() {
+ field->stopTimer();
+ QMessageBox::message(("Pause Game"), (pausestr), 0);
+ field->startTimer();
+}
+
+void KBill::WarpTo() {
+/* field->stopTimer();
+ InputBox b(this, 0, "Warp To Level", warpstr);
+ bool status = b.exec() == 1;
+ field->startTimer();
+ if (status) {
+ bool ok;
+ int level = b.getText().toUInt(&ok);
+ if (ok) {
+ field->startTimer();
+ game.warp_to_level(level);
+ return;
+ }
+ }*/
+}
+
+void KBill::ViewHighScores() {
+ //ui.popup_dialog(Game::HIGHSCORE);
+}
+
+void KBill::Story() {
+ field->stopTimer();
+ QMessageBox::message( ("Story"), (storystr), 0);
+ field->startTimer();
+}
+
+void KBill::Rules() {
+ field->stopTimer();
+ QMessageBox::message(("Rules"), (rulesstr), 0);
+ field->startTimer();
+}
diff --git a/noncore/games/kbill/kbill.h b/noncore/games/kbill/kbill.h
new file mode 100644
index 0000000..fbc0c6c
--- a/dev/null
+++ b/noncore/games/kbill/kbill.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ kbill.h - description
+ -------------------
+ begin : Thu Dec 30 16:55:55 CET 1999
+ copyright : (C) 1999 by Jurrien Loonstra
+ email : j.h.loonstra@st.hanze.nl
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KBILL_H
+#define KBILL_H
+
+
+
+#include <qmainwindow.h>
+#include <qwidget.h>
+#include <qpopupmenu.h>
+
+#include "field.h"
+
+class KBill : public QMainWindow
+{
+ Q_OBJECT
+ public:
+ KBill();
+ ~KBill();
+ Field* getField();
+ private:
+ QMenuBar *menu;
+ QPopupMenu *file, *help;
+ Field *field;
+ int pauseid;
+ protected slots:
+ void Quit();
+ void About();
+ void NewGame();
+ void Pause();
+ void WarpTo();
+ void Story();
+ void Rules();
+ void ViewHighScores();
+
+ friend class UI;
+};
+
+#endif
diff --git a/noncore/games/kbill/kbill.pro b/noncore/games/kbill/kbill.pro
new file mode 100644
index 0000000..2091dd0
--- a/dev/null
+++ b/noncore/games/kbill/kbill.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+CONFIG = qt warn_on release
+DESTDIR = $(OPIEDIR)/bin
+HEADERS = kbill.h field.h Bucket.h Cable.h Computer.h Game.h Horde.h \
+Library.h MCursor.h Monster.h Network.h Picture.h Spark.h Strings.h \
+UI.h objects.h inputbox.h
+SOURCES = field.cpp Bucket.cc Cable.cc Computer.cc Game.cc Horde.cc \
+Library.cc MCursor.cc Monster.cc Network.cc Picture.cc \
+Spark.cc UI.cpp inputbox.cpp kbill.cpp
+TARGET = kbill
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe
diff --git a/noncore/games/kbill/kbill.xpm b/noncore/games/kbill/kbill.xpm
new file mode 100644
index 0000000..1a17dd8
--- a/dev/null
+++ b/noncore/games/kbill/kbill.xpm
@@ -0,0 +1,69 @@
+/* XPM */
+static char* icon_xpm[] = {
+"50 50 16 1",
+"_ c #ffffff",
+"` c #ffff94",
+"a c #f7ffff",
+"b c #f7f7de",
+"c c #debd5a",
+"d c #deb552",
+"e c #adcee7",
+"f c #8ca573",
+"g c #6bb5ef",
+"h c #634263",
+"i c #523152",
+"j c #42b5ef",
+"k c #313963",
+"l c #0073b5",
+"m c #004a8c",
+"n c #000000",
+"__________________________________________________",
+"__________________________gegg____________________",
+"____________gjlllllggellllllllllljg_______________",
+"_____jlllllllllllgaeaaaaagggjjjljllll_____________",
+"____ljjljjgaejjjgaeaaaaaealjgjjgljjjlll___________",
+"___lljjjjgaejjjgaea_beeeehgljjjljjjjjgeel_________",
+"___lljjljaejjjgaeaabbb`bcdiigejjjjjjjeaaall_______",
+"__glejllagljjgaeaabbb`bcdddiilkjjjjjjaaaaella_____",
+"__glgjgagllllaea__bb`bcddddddlcijijjgaa_agjl______",
+"__lljgagllljagaa_bb`bcdddddddlfdidijeaaeeljl______",
+"__ljgaellllaeaa_eb`bcddddddddlfiddij_eaagjjjl_____",
+"__lgaejjljagaa_`b`bcdddddddddlfddddf_aaajjjjjl____",
+"__lggjjjgagaaaeb`bcddddddddddlfddddbeaaejjjjjl____",
+"__llljjgaeaaaeb`bcdddddddddddlfdddd_faajjjjjjl____",
+"__ljllgaaaaage`bcdddddddnnnndlfddd`__aajjjjjjl____",
+"__ljjlaaaaageebcnnnndddn____nlfdddb`bagjjjjjjl____",
+"__ljgaeaaaeagecn____ndn_____nlfddc_`aejjjjjjjl____",
+"__lgaeeaaeaeelkn____ndn______kknn`e_ejjjjjjjjl____",
+"__laeaaaeaeallln_____nn______kgbiafbgljjjjjjjl____",
+"__leeaagaeajjkin_____nn______kg_hagajmljjjjjjl____",
+"__eeaaeeeajjjiin_____n_n_____kmiee_eijmljjjjjl____",
+"__eaaeaeejjjji_nn___n_bn____ngli_h__iljmljjjjl____",
+"__gaeeealjjjjib_bnnn_b_bnnnn_klf___iimjjmljjjl____",
+"__jgeeajlljjjiiii``ibib_b_b_ielab_bimmmjjmljjl____",
+"__jegaljjljjjjji```i_bib_b_i`ela___immmmjjmljl____",
+"__leellljlljjjjji```i_b_b_i``eleeeiimmmmmjjmjj____",
+"__galllljjlljjjjk````i_b_ii`_elb_fijmmmmmmljeg____",
+"__llllllljlljjjjlk``i`iii``_bagb_ijjjmmmmmmlaj____",
+"__llllllljjljjjjlli`i`i``h_b__g_ejjjjjjmmmmggl____",
+"__llllllljjlljjjjli`i`i`h_b__bebgljjjjjjmmmamg____",
+"__ljlllllljjljjjjji``ii`bb__b_aammljjjjjjmlele____",
+"__lljlllllljlljjjji``ihbb__b__gfmmmljjjjjjelgg____",
+"__ljjlllllljjljjjji```bf__b__bjkmmmmljjjjgameg____",
+"__ljjjlllllljlljjji``_f__b__bbmkmmmmmljjjeeeaa____",
+"__lljjllllllljlljji`_b__b___b`mimmmmmmljjaeaag____",
+"__lljjjlllllljlljjgbeaaee__fiimmlmmmmmmmeeeaam____",
+"__lljjjjlllllljljgaea_b___b```mkjmmmmmmmagaaam____",
+"__lljjjjlllllljljbeaab__a`````mkijmmmmmmelaaemj___",
+"__lljjjjjlllllljbeaab__bhiii`imkijjlmmmelggejle___",
+"__gljjjjjlllllgaeaaebbb`ijjiiikiijjjlmmamaejgl____",
+"__eljjjjjjllllaaaa__bfiilliiiikmjjllmmggmeejlj____",
+"__aeejgjjjllleeaa__bfiiillkkmmlmmlllllajeeejme____",
+"__ajljjjllllegaaaaagliilllmlllljlmljjgejaelmljjjj_",
+"___ajmlllllaeaaaaaejjjjjlmlllllljlmllelmgljjljjjje",
+"_jlljlmmmmeeaaaaeellllllmmljjlllllllmglljjjjjljjge",
+"jjjjjjllllmllmmmmmmmmmmllllmmmmmmlllljjjjjjjjljge_",
+"__gljljjjjjjjjjjjjllllljjllllllljjljjjjjjjjjjljg__",
+"___jlljjjjjjjjjjjjjjjjjjjlljjjjjjjljjjjjjjjg______",
+"___________gjjjggjggjjjjjjlljjjjjjj_______________",
+"_________________________ggljjg___________________"};
diff --git a/noncore/games/kbill/mini-kbill.xpm b/noncore/games/kbill/mini-kbill.xpm
new file mode 100644
index 0000000..8554383
--- a/dev/null
+++ b/noncore/games/kbill/mini-kbill.xpm
@@ -0,0 +1,248 @@
+/* XPM */
+static char*xbill[]={
+"16 16 229 2",
+".G c #648b97",
+"bB c #83cbf2",
+"## c #eaebcd",
+"be c #4ea5d7",
+".h c #89c1e4",
+"aV c #5c5c6b",
+"#c c #63b5e1",
+"#y c #fcfcfc",
+"bx c #bde5f9",
+"bH c #c0e5f9",
+"b# c #0965a4",
+"#m c #5f7987",
+"ai c #327ab2",
+"aP c #0376b7",
+"bG c #addcf4",
+"#Y c #c9bf89",
+"bE c #49b5ed",
+".J c #f0fafc",
+"#p c #4ab5ed",
+"#K c #a69c99",
+"bh c #2897d4",
+"a8 c #79a5bb",
+"#O c #f0f3ec",
+"a6 c #b9daee",
+"bw c #add6ed",
+"aS c #eaf1e6",
+"#H c #39ace8",
+".p c #e9f4f5",
+"bm c #066bac",
+"#2 c #afbcc4",
+".E c #e6cb76",
+"aQ c #3d99cf",
+"#. c #e0ba58",
+"#N c #709bb3",
+"#D c #40b3ed",
+"#8 c #087bbc",
+"aA c #1588c8",
+".9 c #709178",
+".K c #50a4d5",
+"aB c #5eb1e1",
+".A c #399cd3",
+"#3 c #2e71a8",
+".k c #5ab0de",
+".Y c #3eaee9",
+".w c #e8f3f8",
+"by c #a4d9f7",
+".Q c #e8f5f3",
+"bz c #83cdf4",
+"aK c #a4c6de",
+"bA c #88cdf4",
+"a4 c #2c9cd9",
+"aj c #81b7dd",
+"#L c #cbc7bf",
+".0 c #a5cee6",
+"#n c #b0a171",
+"az c #178ac9",
+".# c #fcfefe",
+"bv c #9ed0f2",
+"aZ c #87bfe5",
+"#g c #c2def0",
+".g c #8dc2e3",
+".q c #d7e8ed",
+".i c #edf6fc",
+"aC c #e3eee9",
+"#9 c #0578b9",
+".3 c #d9eefa",
+".z c #65b2df",
+"a5 c #298cc4",
+"#F c #aed2ed",
+".S c #e6cb77",
+"al c #0073b5",
+"aa c #3483b9",
+"a9 c #2d6497",
+"ah c #349eda",
+"bc c #6db1dc",
+"bF c #7dcaf1",
+"#d c #a8d0e7",
+"ae c #e2eff2",
+"a7 c #f4fcfe",
+"bt c #41b3ee",
+"aw c #bdddf3",
+"#u c #465270",
+"#e c #a5d5f1",
+".5 c #beab69",
+"aI c #2971a9",
+"av c #87c0e3",
+"#S c #62b4e0",
+"#J c #ada779",
+"an c #2194d2",
+".n c #3ca5df",
+"au c #0b65a6",
+"bn c #107aba",
+"aT c #b2afae",
+".o c #a2d0ed",
+"#B c #8cadca",
+".2 c #b6e0f7",
+"#h c #547d90",
+"aW c #3f73a4",
+"b. c #105a95",
+"#b c #42b5ef",
+"aR c #d1e9f1",
+"aG c #185a95",
+".y c #3d9fd8",
+"a1 c #fdfeff",
+"ax c #a3cde4",
+"#o c #c6e0db",
+"aN c #30a3df",
+"bg c #81c7ee",
+"af c #5da0ca",
+"aY c #3f7fb3",
+"#E c #c5e6f9",
+"aX c #0f6faf",
+".X c #cce9f7",
+"aO c #38abe7",
+"#G c #57addc",
+"aD c #ecf3f4",
+".x c #cce5f6",
+"#t c #70c6f1",
+".R c #f2f4ca",
+"a. c #2699d7",
+"bd c #64acd9",
+".O c #3ea0d6",
+"#x c #a6a6a4",
+".7 c #bb9b4f",
+"#q c #cce3f0",
+"#v c #cacaca",
+".s c #47b2ec",
+"#j c #a59b82",
+".L c #f0f7fb",
+".c c #afd7ed",
+"bu c #2da0dc",
+"#5 c #1471b0",
+"ag c #3bade8",
+"as c #aac6cf",
+"#a c #94d4f5",
+"bC c #7fccf3",
+".e c #d1e7f7",
+"aH c #004a8c",
+".v c #aed2e9",
+"ap c #e6e19b",
+"#r c #d8eaf5",
+".u c #359fd9",
+".l c #2b9bd8",
+".H c #5097c0",
+"ac c #b4a585",
+".U c #79977c",
+"ba c #0f74b4",
+"#7 c #a4cde5",
+"#0 c #c8be9a",
+"aU c #667383",
+"bk c #73b1d8",
+".V c #c19a52",
+".a c #f5f9fc",
+".b c #edf5fb",
+"aM c #b9d9ee",
+"ao c #4594c8",
+".4 c #d6e5d5",
+"bD c #2691d0",
+"#Q c #1d7bb9",
+".D c #f8f7c9",
+".M c #a6cfe6",
+"#w c #b4b4b4",
+".d c #a7cfe6",
+"aF c #7a8d85",
+".W c #b0c5c7",
+"bI c #f5fbfd",
+"a2 c #f6fbfd",
+".1 c #2b98d5",
+".I c #66bded",
+".N c #83c5ef",
+"#i c #cac9c8",
+"am c #1386c5",
+"#l c #fafafa",
+"#U c #3791c5",
+"br c #1b86c5",
+"#C c #1d86c5",
+"bp c #066cad",
+"ar c #fcfcf5",
+"bi c #1379b9",
+"aq c #d8daca",
+".Z c #92cae8",
+"#W c #1b8ecd",
+"#A c #abaabd",
+".P c #84c2e6",
+".8 c #9f8a5a",
+"ab c #bdb07b",
+".j c #fbfdfe",
+".6 c #cca64b",
+"ay c #2fa2de",
+"#z c #6184a8",
+".T c #deb552",
+"#k c #a9a6a0",
+".r c #5f9ccb",
+"#R c #1f88c6",
+"a3 c #55adde",
+"#X c #8aa592",
+"#1 c #a5cddb",
+"#4 c #014c8e",
+"ak c #2a9dda",
+".t c #2d9dda",
+"bb c #1a83c2",
+".f c #afd3e8",
+"ad c #efece6",
+"#Z c #c3b8b6",
+"aL c #feffff",
+"Qt c #ffffff",
+".B c #a2d4f1",
+"aJ c #c0dff1",
+"#6 c #97d0f0",
+"bo c #0871b2",
+"#P c #566489",
+"bs c #35a4df",
+"#s c #bcdbf0",
+"#V c #1386c6",
+".F c #b79154",
+".m c #72b7e1",
+"at c #114c83",
+"#f c #e3f2f9",
+"bq c #0e79ba",
+"#M c #9b9794",
+"bf c #b1dff7",
+"#T c #b3d6ec",
+"a# c #39ace7",
+"#I c #6a85a6",
+".C c #f1f8f5",
+"bl c #4c95c7",
+"a0 c #62aedc",
+"bj c #4b9dcf",
+"aE c #f0f2cc",
+"Qt.#.a.b.c.d.e.f.g.h.c.iQtQtQtQt",
+".j.k.l.m.n.o.p.q.r.s.t.u.v.wQtQt",
+".x.y.z.A.B.C.D.E.F.G.H.I.J.K.LQt",
+".M.N.O.P.Q.R.S.T.T.U.V.W.X.Y.ZQt",
+".0.1.2.3.4.5.6.7.8.9#.###a#b#cQt",
+"#d#e#f#g#h#i#j#k#l#m#n#o#p#b#cQt",
+"#q#r#s#t#u#v#w#x#y#z#A#B#C#D#cQt",
+"#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#SQt",
+"#T#U#V#W#b#X#Y#Z#0#1#2#3#4#5#6Qt",
+"#7#8#9a.a#aaabacadaeafagahaiajQt",
+".0akalamanaoapaqarasatauagavawQt",
+"axayazalaAaBaCaDaEaFaGaHaIaJaKaL",
+"aMaNaOaPaQaRaSaTaUaVaWaXaYaZa0a1",
+"a2a3a4a5a6a7a8a9b.b#babbbcbdbebf",
+"bgbhbibjbkblbmbnbobpbqbrbsbtbubv",
+".jbwbxbybzbAbBbCbDbEbFbGbxbHbIa1"};
diff --git a/noncore/games/kbill/objects.h b/noncore/games/kbill/objects.h
new file mode 100644
index 0000000..2184ce7
--- a/dev/null
+++ b/noncore/games/kbill/objects.h
@@ -0,0 +1,26 @@
+#ifndef OBJECTS_H
+#define OBJECTS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "Horde.h"
+#include "Network.h"
+#include "Library.h"
+#include "Bucket.h"
+#include "Spark.h"
+#include "Game.h"
+#include "UI.h"
+
+extern Horde bill;
+extern Network net;
+extern Library OS;
+extern Bucket bucket;
+extern Spark spark;
+extern Game game;
+extern UI ui;
+
+#endif