Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
Stefan `Sec` Zehl 2011-08-03 21:59:04 +02:00
commit 5a33df1fc9
3 changed files with 76 additions and 32 deletions

View File

@ -77,6 +77,7 @@ void ram(void) {
screen_intro(); screen_intro();
game.rokets = 3; game.rokets = 3;
game.level = 1; game.level = 1;
game.score = 0;
init_game(); init_game();
screen_level(); screen_level();
while (game.rokets>=0) { while (game.rokets>=0) {
@ -162,7 +163,6 @@ void init_game(void) {
game.killed = 0; game.killed = 0;
game.step = false; game.step = false;
game.ufo = DISABLED; game.ufo = DISABLED;
game.score = 0;
init_enemy(); init_enemy();
for (int col=0; col<ENEMY_COLUMNS; col++){ for (int col=0; col<ENEMY_COLUMNS; col++){

View File

@ -5,7 +5,6 @@
#include "lcd/render.h" #include "lcd/render.h"
#include "lcd/display.h" #include "lcd/display.h"
#include "lcd/allfonts.h" #include "lcd/allfonts.h"
#include "usetable.h" #include "usetable.h"
#define FIXSIZE 25 #define FIXSIZE 25
@ -38,7 +37,8 @@ void ram(void) {
struct mb { struct mb {
long rmin, rmax, imin, imax; long rmin, rmax, imin, imax;
bool dirty, dup, ddown, dleft, dright; bool dirty, dup, ddown, dleft, dright, clickmark;
int presscount, presslimitzin, presslimitzout, zoomlevel, maxzoomin, maxzoomout;
} mandel; } mandel;
void mandelInit() { void mandelInit() {
@ -50,12 +50,19 @@ void mandelInit() {
mandel.rmax = fixpt(1); mandel.rmax = fixpt(1);
mandel.imin = fixpt(-2); mandel.imin = fixpt(-2);
mandel.imax = fixpt(2); mandel.imax = fixpt(2);
mandel.presscount = 0;
mandel.presslimitzin = 40;
mandel.presslimitzout = 30;
mandel.zoomlevel = 0;
mandel.maxzoomin = 65;
mandel.maxzoomout = -12;
mandel.dirty = true; mandel.dirty = true;
mandel.dup = false; mandel.dup = false;
mandel.ddown = false; mandel.ddown = false;
mandel.dleft = false; mandel.dleft = false;
mandel.dright = false; mandel.dright = false;
mandel.clickmark = false;
} }
void mandelMove() { void mandelMove() {
@ -67,7 +74,7 @@ void mandelMove() {
char key = getInputRaw(); char key = getInputRaw();
if (key == BTN_LEFT) { if (key == BTN_LEFT) {
mandel.imax -=is; mandel.imax -=is;
mandel.imin -=is; mandel.imin -=is;
mandel.dleft = true; mandel.dleft = true;
@ -79,23 +86,41 @@ void mandelMove() {
mandel.rmax += rs; mandel.rmax += rs;
mandel.rmin += rs; mandel.rmin += rs;
mandel.ddown = true; mandel.ddown = true;
} else if (key == BTN_UP) { } else if (key == BTN_UP) {
mandel.rmax -= rs; mandel.rmax -= rs;
mandel.rmin -= rs; mandel.rmin -= rs;
mandel.dup = true; mandel.dup = true;
} else if (key == (BTN_ENTER + BTN_UP)) { } else if (key == BTN_ENTER) {
if (mandel.presscount < mandel.presslimitzin) {
mandel.presscount = mandel.presscount + 1;
}
} else if (key == BTN_NONE) {
if(mandel.presscount > 0 ) {
mandel.presscount = mandel.presscount - 1;
mandel.clickmark = true;
}
if (mandel.presscount == 0 ) {
mandel.clickmark = false;
}
}
if (mandel.presscount > mandel.presslimitzout && mandel.clickmark && key == BTN_ENTER && mandel.zoomlevel >= mandel.maxzoomout) {
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/10;
mandel.dirty = true;
delayms(10);
mandel.zoomlevel = mandel.zoomlevel - 1 ;
}
else if (mandel.presscount == mandel.presslimitzin && key == BTN_ENTER && mandel.zoomlevel <= mandel.maxzoomin ) {
mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/10; mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/10; mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/10; mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/10; mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/10;
mandel.dirty = true; mandel.dirty = true;
} else if (key == (BTN_ENTER + BTN_DOWN)) { delayms(10);
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/10; mandel.zoomlevel = mandel.zoomlevel + 1 ;
mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/10; }
mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/10;
mandel.dirty = true;
}
} }
void mandelPixel(int x, int y) { void mandelPixel(int x, int y) {

View File

@ -36,7 +36,8 @@ void ram(void) {
struct mb { struct mb {
long rmin, rmax, imin, imax; long rmin, rmax, imin, imax;
bool dirty, dup, ddown, dleft, dright; bool dirty, dup, ddown, dleft, dright, clickmark;
int count, limitZIn, limitZOut;
} mandel; } mandel;
void mandelInit() { void mandelInit() {
@ -48,12 +49,16 @@ void mandelInit() {
mandel.rmax = fixpt(1); mandel.rmax = fixpt(1);
mandel.imin = fixpt(-2); mandel.imin = fixpt(-2);
mandel.imax = fixpt(2); mandel.imax = fixpt(2);
mandel.count = 0;
mandel.limitZIn = 40;
mandel.limitZOut = 30;
mandel.dirty = true; mandel.dirty = true;
mandel.dup = false; mandel.dup = false;
mandel.ddown = false; mandel.ddown = false;
mandel.dleft = false; mandel.dleft = false;
mandel.dright = false; mandel.dright = false;
mandel.clickmark = false;
} }
void mandelMove() { void mandelMove() {
@ -65,7 +70,7 @@ void mandelMove() {
char key = getInputRaw(); char key = getInputRaw();
if (key == BTN_LEFT) { if (key == BTN_LEFT) {
mandel.imax -=is; mandel.imax -=is;
mandel.imin -=is; mandel.imin -=is;
mandel.dleft = true; mandel.dleft = true;
@ -77,23 +82,37 @@ void mandelMove() {
mandel.rmax += rs; mandel.rmax += rs;
mandel.rmin += rs; mandel.rmin += rs;
mandel.ddown = true; mandel.ddown = true;
} else if (key == BTN_UP) { } else if (key == BTN_UP) {
mandel.rmax -= rs; mandel.rmax -= rs;
mandel.rmin -= rs; mandel.rmin -= rs;
mandel.dup = true; mandel.dup = true;
} else if (key == (BTN_ENTER + BTN_UP)) { } else if (key == BTN_ENTER) {
mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/10; if (mandel.count < mandel.limitZIn) {
mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/10; mandel.count = mandel.count + 1;
mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/10; }
mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/10; } else if (key == BTN_NONE) {
mandel.dirty = true; if(mandel.count > 0 ) {
} else if (key == (BTN_ENTER + BTN_DOWN)) { mandel.count = mandel.count - 1;
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/10; mandel.clickmark = true;
}
if (mandel.count == 0 ) {
mandel.clickmark = false;
}
}
if (mandel.count > mandel.limitZOut && mandel.clickmark && key == BTN_ENTER) {
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/10; mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/10; mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/10; mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/10;
mandel.dirty = true; mandel.dirty = true;
} }
if (mandel.count == mandel.limitZIn && key == BTN_ENTER) {
mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/10;
mandel.dirty = true;
}
} }
void mandelPixel(int x, int y) { void mandelPixel(int x, int y) {