summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/Game.cc
Unidiff
Diffstat (limited to 'noncore/games/kbill/Game.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kbill/Game.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/games/kbill/Game.cc b/noncore/games/kbill/Game.cc
index 624b50b..4cd5322 100644
--- a/noncore/games/kbill/Game.cc
+++ b/noncore/games/kbill/Game.cc
@@ -55,13 +55,13 @@ void Game::update_info() {
55 sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d", 55 sprintf (str, "Bill:%d/%d System:%d/%d/%d Level:%d Score:%d",
56 bill.on_screen, bill.off_screen, net.base, net.off, 56 bill.on_screen, bill.off_screen, net.base, net.off,
57 net.win, level, score); 57 net.win, level, score);
58 ui.draw_str(str, 5, scrheight-5); 58 ui.draw_str(str, 5, scrheight-5);
59 efficiency += ((100*net.base-10*net.win)/net.units); 59 efficiency += ((100*net.base-10*net.win)/net.units);
60} 60}
61 61
62void Game::update_score (int action) { 62void Game::update_score (int action) {
63 switch (action){ 63 switch (action){
64 case ENDLEVEL: score+=(level*efficiency/iteration); break; 64 case ENDLEVEL: score+=(level*efficiency/iteration); break;
65 default: score+=(action*action*BILLPOINTS); 65 default: score+=(action*action*BILLPOINTS);
66 } 66 }
67} 67}
@@ -69,13 +69,13 @@ void Game::update_score (int action) {
69void Game::warp_to_level (unsigned int lev) { 69void Game::warp_to_level (unsigned int lev) {
70 if (state==PLAYING) { 70 if (state==PLAYING) {
71 if (lev <= level) return; 71 if (lev <= level) return;
72 setup_level(lev); 72 setup_level(lev);
73 } 73 }
74 else { 74 else {
75 if (lev<=0) return; 75 if (lev <=0) return;
76 start(lev); 76 start(lev);
77 } 77 }
78} 78}
79 79
80void Game::button_press(int x, int y) { 80void Game::button_press(int x, int y) {
81 int i, counter=0, flag=0; 81 int i, counter=0, flag=0;
@@ -96,13 +96,13 @@ void Game::button_press(int x, int y) {
96 grabbed = i; 96 grabbed = i;
97 flag = 1; 97 flag = 1;
98 } 98 }
99 else if (bill.list[i].state != bill.list[i].STRAY && 99 else if (bill.list[i].state != bill.list[i].STRAY &&
100 bill.list[i].clicked(x, y)) 100 bill.list[i].clicked(x, y))
101 { 101 {
102 if (bill.list[i].state == bill.list[i].AT) 102 if (bill.list[i].state == bill.list[i].AT)
103 net.computers[bill.list[i].target_c].busy=0; 103 net.computers[bill.list[i].target_c].busy=0;
104 bill.list[i].index = -1; 104 bill.list[i].index = -1;
105 bill.list[i].cels = bill.dcels; 105 bill.list[i].cels = bill.dcels;
106 bill.list[i].x_offset = -2; 106 bill.list[i].x_offset = -2;
107 bill.list[i].y_offset = -15; 107 bill.list[i].y_offset = -15;
108 bill.list[i].state = bill.list[i].DYING; 108 bill.list[i].state = bill.list[i].DYING;
@@ -128,32 +128,32 @@ void Game::button_release(int x, int y) {
128 } 128 }
129 for (i=0; i<net.units; i++) 129 for (i=0; i<net.units; i++)
130 if (net.computers[i].oncomputer(x, y) 130 if (net.computers[i].oncomputer(x, y)
131 && 131 &&
132 net.computers[i].compatible (bill.list[grabbed].cargo) 132 net.computers[i].compatible (bill.list[grabbed].cargo)
133 && 133 &&
134 (net.computers[i].os == OS.WINGDOWS || 134 (net.computers[i].os == OS.WINGDOWS ||
135 net.computers[i].os == OS.OFF)) 135 net.computers[i].os == OS.OFF))
136 { 136 {
137 net.base++; 137 net.base++;
138 if (net.computers[i].os == OS.WINGDOWS) 138 if (net.computers[i].os == OS.WINGDOWS)
139 net.win--; 139 net.win--;
140 else 140 else
141 net.off--; 141 net.off--;
142 net.computers[i].os = bill.list[grabbed].cargo; 142 net.computers[i].os = bill.list[grabbed].cargo;
143 bill.list[grabbed].state = bill.list[grabbed].OFF; 143 bill.list[grabbed].state = bill.list[grabbed].OFF;
144 grabbed = EMPTY; 144 grabbed = EMPTY;
145 return; 145 return;
146 } 146 }
147 grabbed = EMPTY; 147 grabbed = EMPTY;
148 } 148}
149 149
150void Game::update() { 150void Game::update() {
151 switch (state) { 151 switch (state) {
152 case PLAYING: 152 case PLAYING:
153 ui.clear(); 153 ui.clear();
154 bucket.draw(); 154 bucket.draw();
155 net.update(); 155 net.update();
156 net.draw(); 156 net.draw();
157 bill.update(); 157 bill.update();
158 bill.draw(); 158 bill.draw();
159 update_info(); 159 update_info();