// C Source File // Created 4/11/2003; 5:46:25 PM #define USE_TI89 // Compile for TI-89 #define USE_TI92PLUS // Compile for TI-92 Plus #define USE_V200 // Compile for V200 #define ENABLE_ERROR_RETURN // Enable Returning Errors to AMS #define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization #define MIN_AMS 205 // Compile for AMS 2.05 or higher #define SAVE_SCREEN // Save/Restore LCD Contents #include // Include All Header Files //global variables unsigned short highscore[] = {0,0,0,0,0,0,0,0}; //char *virtual = 0; // create a buffer char *str1, *str2, *str3, *str4, *str5, *str6, *str7, *str8, *str9, *str0, *title; //static variables static int rotation; static int difficulty = 200; static int shift = 1; static int diameter = 1; //funtion prototypes void draw(unsigned long *[], unsigned short *[], unsigned char *[], unsigned char *[], unsigned char *[], unsigned char *[], unsigned char *[], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int [], int, int, int, int, int, int, int [], int, int, int); void invertscreen(void); void drawship(int, int); void drawshipshot(int, int, int); void drawenemy(int, int, int, int); void drawenemyshot(int, int, int); void game(int, int); void drawshield(int *, int *, int); void plotshot(int, int, int); void movealgrithmn1(int *, int *, int *, int *, int *, int *, int *); void movealgrithm1(int *, int *, int *, int *, int *, int *, int *, int); void movealgrithm2(int *, int *, int *, int *, int *, int *); void movealgrithm3(int *, int *, int *, int *, int *, int *); void movealgrithm4(int *, int *, int *, int *, int *, int *); void movealgrithm5(int *, int *, int *, int *, int *, int *); void movealgrithm6(int *, int *, int *, int *, int *, int *); void movealgrithm7(int *, int *, int *, int *, int *, int *); void movealgrithm10(int *, int *, int *, int *, int *, int *, int); void movealgrithm20(int *, int *, int *, int *, int *, int *); void calibrateshot(int *, int *, int, int, int, int, int *); void titlescreen(int *, int *); void deathexplosion(int, int, int *); void DrawLineFast(short, short, short, short); //void togglecurrentweapon(int currentweapon, int newweapon); void drawbox(int, int, int, int, int); void menu(int, int, int, int (*)[], int *, ...); void gamemenu(int *, int *, int *); //defined functions //I got this from the help file void DrawLineFast(short x1, short y1, short x2, short y2) { short x = x1, y = y1; short dx = abs (x2 - x1), dy = abs (y2 - y1); short ystep = (y1 < y2) ? 1 : -1, pystep = 30 * ystep; short mov = dx ? 0 : -1; unsigned char *ptr = (char*)LCD_MEM + 30 * y + (x >> 3); short mask = 1 << (~x & 7); if (x1 < x2) while (x != x2 || y != y2) { *ptr |= mask; if (mov < 0) y += ystep, ptr += pystep, mov += dx; else { mov -= dy; if (++x & 7) mask >>= 1; else ptr++, mask = 0x80; } } else while (x != x2 || y != y2) { *ptr |= mask; if (mov < 0) y += ystep, ptr += pystep, mov += dx; else { mov -= dy; if (x-- & 7) mask <<= 1; else ptr--, mask = 1; } } } void movebackground(int (*bx)[], int (*by)[], int (*btype)[], int (*btemp)[]) { int i; for(i=0; i<20; i++) { (*btemp)[i] = (*btemp)[i] + 1; if((*btemp)[i] == 3) { (*btemp)[i] = 0; (*by)[i] = (*by)[i] + 1; } if((*by)[i] == LCD_HEIGHT-8) { (*by)[i] = -(random(120)); (*bx)[i] = random(LCD_WIDTH-30) + 3; (*btype)[i] = random(5); } /*else { if((*btype)[i] == 1 && (*by)[i] > 0) Sprite8 ((*bx)[i], (*by)[i], 8, star, LCD_MEM, A_NORMAL); else if((*by)[i] > 0) Sprite8 ((*bx)[i], (*by)[i], 2, point, LCD_MEM, A_NORMAL); }*/ } } void createshot(int (*shotflags)[], int (*shotx)[], int (*shoty)[], int (*shotshiftx)[], int (*shotshifty)[], int *leftrightflag, int xcood, int ycood, int *shotfired, int (*shottemp)[], int (*weaponflags)[], int weapontype, int (*enx)[], int (*eny)[], int (*entype)[], int (*goodies)[], int *shotfiredd, int *shotfiredu, int *shotfireda, int (*gigabombarray)[], int (*laserarray)[]) { if((_keytest (RR_2ND) && *shotfired == 0)) { int i,t; for(i=0; i<11; i++) { if((*shotflags)[i] == 0) { (*shotflags)[i] = weapontype; if(*leftrightflag == 1) (*shotx)[i] = xcood - 4; if(*leftrightflag == 2) (*shotx)[i] = xcood + 11; if(*leftrightflag == 1) *leftrightflag = 2; else *leftrightflag = 1; (*shoty)[i] = ycood + 2; int l = random(20); for(t=l; t<20; t++) { if((*entype)[t] > 0 && (*shotflags)[i] == 6) {l = (*enx)[t]; l = t; (*shotshifty)[i] = -2; calibrateshot(&(*shotshiftx)[i], &(*shotshifty)[i], (*shotflags)[i], (*enx)[l], xcood, ycood, &(*shottemp)[i]); break;} else {(*shotshiftx)[i] = 0; (*shotshifty)[i] = -2;} } if((*shotflags)[i] == 3) calibrateshot(&(*shotshiftx)[i], &(*shotshifty)[i], (*shotflags)[i], (*enx)[l], xcood, ycood, &(*shottemp)[i]); int t,u; t = (*shotx)[i]; u = (*shoty)[i]; //plotshot(t,u,(*shotflags)[i]); *shotfired = 1; break; } } } if((_keytest (RR_ALPHA) || _keytest (RR_CATALOG)) && (*goodies)[1] > 0 && *shotfireda == 0) { int i; for(i=0; i<11; i++) { if((*shotflags)[i] == 0) { (*shotflags)[i] = 100; (*shotx)[i] = xcood + 4; (*shoty)[i] = ycood - 7; (*shotshiftx)[i] = 0; (*shotshifty)[i] = -1; (*goodies)[1] = (*goodies)[1] - 1; //plotshot((*shotx)[i], (*shoty)[i], (*shotflags)[i]); *shotfireda = 1; break; } } } if((_keytest (RR_SHIFT)) && (*weaponflags)[6] == 1 && *shotfiredu == 0 && (*laserarray)[4] < 1) { int i; int l = random(21); for(i=0; i<20; i++) { if((*entype)[i] > 0 && ((*entype)[i] < 10 || (*entype)[i] > 19) && ((*enx)[i] > 1 && (*enx)[i] < LCD_WIDTH-8) && (*eny)[i] > 0 && (*eny)[i] < LCD_HEIGHT-8) { (*laserarray)[0] = xcood + 8; (*laserarray)[1] = ycood; (*laserarray)[2] = (*enx)[i] + 2; (*laserarray)[3] = (*eny)[i] + 2; (*shotx)[11] = (*enx)[i] + 2; (*shoty)[11] = (*eny)[i] + 2; //DrawLine((*laserarray)[0], (*laserarray)[1], (*laserarray)[2], (*laserarray)[3], A_NORMAL); //plotshot((*laserarray)[2], (*laserarray)[3], 15); (*laserarray)[4] = 5; *shotfiredu = 1; (*shotflags)[11] = 15; break; } } if((*shotflags)[11] == 0) { for(i=0; i 0 && ((*entype)[i] < 10 || (*entype)[i] > 19) && ((*enx)[i] > 1 && (*enx)[i] < LCD_WIDTH-8) && (*eny)[i] > 0 && (*eny)[i] < LCD_HEIGHT-8) { (*laserarray)[0] = xcood + 8; (*laserarray)[1] = ycood; (*laserarray)[2] = (*enx)[i] + 2; (*laserarray)[3] = (*eny)[i] + 2; (*shotx)[11] = (*enx)[i] + 2; (*shoty)[11] = (*eny)[i] + 2; //DrawLine((*laserarray)[0], (*laserarray)[1], (*laserarray)[2], (*laserarray)[3], A_NORMAL); //plotshot((*laserarray)[2], (*laserarray)[3], 15); (*laserarray)[4] = 5; *shotfiredu = 1; (*shotflags)[11] = 15; break; } } } } if((_keytest (RR_DIAMOND) || _keytest (RR_MODE)) && *shotfiredd == 0 && (*goodies)[2] > 0 && (*shotflags)[12] < 1) { (*shotflags)[12] = 20; (*shotx)[12] = xcood + 4; (*shoty)[12] = ycood - 7; (*shotshiftx)[12] = 0; (*shotshifty)[12] = -1; (*goodies)[2] = (*goodies)[2] - 1; //plotshot((*shotx)[12], (*shoty)[12], (*shotflags)[12]); *shotfiredd = 1; (*gigabombarray)[0] = (*shotx)[12]; (*gigabombarray)[1] = (*shoty)[12]; (*gigabombarray)[2] = -1; (*gigabombarray)[3] = -1; (*gigabombarray)[4] = -1; (*gigabombarray)[5] = 40; } } void calibrateshot(int *shotshiftx, int *shotshifty, int type, int enx, int xcoord, int ycoord, int *shottemp) { *shotshiftx = 0; *shotshifty = -1; if(type == 6) { if(enx <= xcoord + 8) *shotshiftx = -2; if(enx > xcoord + 8) *shotshiftx = 2; *shottemp = enx; } if(type == 3) { int t = random(4); if(t == 0) *shotshiftx = -1; if(t == 3) *shotshiftx = 1; } } void moveshots(int (*shotflags)[], int (*shotx)[], int (*shoty)[], int (*shotshiftx)[], int (*shotshifty)[], int weapontype, int (*shottemp)[], int (*laserarray)[], int (*gigabombarray)[]) { int i; for(i=0; i<13; i++) { if((*shotflags)[i] > 0 && ((*shotflags)[i] < 10 || (*shotflags)[i] > 16)) { //plotshot((*shotx)[i],(*shoty)[i],(*shotflags)[i]); (*shotx)[i] = (*shotx)[i] + (*shotshiftx)[i]; (*shoty)[i] = (*shoty)[i] + (*shotshifty)[i]; if(((*shotflags)[i] == 6 && ((*shottemp)[i] == (*shotx)[i] || (*shottemp)[i] == (*shotx)[i] - 1 || (*shottemp)[i] == (*shotx)[i] + 1)) || ((*shotx)[i] <= 3 || (*shotx)[i] >= LCD_WIDTH-8)) { (*shotshiftx)[i] = 0; (*shotshifty)[i] = -2; } if((*shotx)[i] <= 0 || (*shotx)[i] >= LCD_WIDTH-4 || (*shoty)[i] <= 0 || (*shoty)[i] >= LCD_HEIGHT-4) (*shotflags)[i] = 0; //else plotshot((*shotx)[i],(*shoty)[i],(*shotflags)[i]); } if((*shotflags)[i] == 15) { (*laserarray)[4] = (*laserarray)[4] - 1; if((*laserarray)[4] < 1) { //DrawLine((*laserarray)[0], (*laserarray)[1], (*laserarray)[2], (*laserarray)[3], A_NORMAL); //plotshot((*laserarray)[2], (*laserarray)[3], 15); (*shotflags)[11] = 0; } } if((*shotflags)[i] == 21) { //DrawClipEllipse((*gigabombarray)[0], (*gigabombarray)[1], (*gigabombarray)[2], (*gigabombarray)[3], &(SCR_RECT){{0,0,159,99}}, A_NORMAL); (*gigabombarray)[2] = (*gigabombarray)[2] + 1; (*gigabombarray)[3] = (*gigabombarray)[3] + 1; (*gigabombarray)[4] = (*gigabombarray)[4] + 1; (*gigabombarray)[5] = (*gigabombarray)[5] - 1; if((*gigabombarray)[5] == 0) (*shotflags)[12] = 0; //else DrawClipEllipse((*gigabombarray)[0], (*gigabombarray)[1], (*gigabombarray)[2], (*gigabombarray)[3], &(SCR_RECT){{0,0,159,99}}, A_NORMAL); } } } void moveenemyshots(int (*enshotflags)[], int (*enshotx)[], int (*enshoty)[], int (*enshotshiftx)[], int (*enshotshifty)[], int (*enx)[], int (*eny)[], int (*entype)[], int shipx, int shipy, int level) { int r = random(8); int t = random(21); int i = 0; if(((*entype)[t] > 0 && ((*entype)[t] < 10 || ((*entype)[t] >= 20))) && (*eny)[t] > 0 && (*eny)[t] < LCD_WIDTH-8 && r == 2) { for(i=0; i<21; i++) { if((*enshotflags)[i] == 0 && (*enshotflags)[i] < 3) { (*enshotx)[i] = (*enx)[t] + 3; (*enshoty)[i] = (*eny)[t] + 3; (*enshotflags)[i] = 1; if((*entype)[t] >= 100) (*enshotflags)[i] = 2; //drawenemyshot((*enshotx)[i], (*enshoty)[i], (*enshotflags)[i]); (*enshotshiftx)[i] = 0; if((*eny)[i] > shipy) (*enshotshifty)[i] = -1; else (*enshotshifty)[i] = 1; if(level >= 8 || level == 6) { if((*enx)[i] < shipx - 16) (*enshotshiftx)[i] = 1; if((*enx)[i] > shipx + 24) (*enshotshiftx)[i] = -1; } break; } } } for(i=0; i<21; i++) { if((*enshotflags)[i] != 0 && (*enshotflags)[i] < 3) { //drawenemyshot((*enshotx)[i], (*enshoty)[i], (*enshotflags)[i]); (*enshotx)[i] = (*enshotx)[i] + (*enshotshiftx)[i]; (*enshoty)[i] = (*enshoty)[i] + (*enshotshifty)[i]; if((*enshotx)[i] <= -1 || (*enshotx)[i] >= LCD_WIDTH || (*enshoty)[i] >= LCD_HEIGHT-8 || (*enshoty)[i] <= 0) (*enshotflags)[i] = 0; //else drawenemyshot((*enshotx)[i], (*enshoty)[i], (*enshotflags)[i]); } if((*enshotflags)[i] >= 3) { //drawenemy((*enshotx)[i], (*enshoty)[i], (*enshotflags)[i], rotation); (*enshotflags)[i] = (*enshotflags)[i] + 1; //drawenemy((*enshotx)[i], (*enshoty)[i], (*enshotflags)[i], rotation); if((*enshotflags)[i] > 14) (*enshotflags)[i] = 0; } } } void moveenemies(int (*entype)[], int (*enx)[], int (*eny)[], int (*enmove)[], int (*enshiftx)[], int (*enshifty)[], int (*enceiling)[], int (*entemp)[], int (*enshield)[]) { int i; int t = 0; int trotation = rotation; for(i=0; i<21; i++) { if((*entype)[i] > 0) t = t + 1; } for(i=0; i<21; i++) { trotation = rotation; if((*entype)[i] > 18 && (*entype)[i] < 20) (*entype)[i] = 0; //if((*eny)[i] > 0 && (*eny)[i] < 100) drawenemy((*enx)[i],(*eny)[i],(*entype)[i], trotation); trotation = trotation + 1; if(trotation == 5) trotation = 1; if((*enmove)[i] == -1 && (*entype)[i] == -1001) movealgrithmn1(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i], &(*entype)[i]); if((*enmove)[i] == -1 && (*entype)[i] == -1002) movealgrithmn1(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i], &(*entype)[i]); if((*enmove)[i] == 1 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm1(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i], &(*enmove)[i], 100); if((*enmove)[i] == 2 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm2(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 3 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm3(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 4 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm4(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 5 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm5(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 6 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm6(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 7 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm1(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i], &(*enmove)[i], t); if((*enmove)[i] == 8 && ((*entype)[i] < 10 || (*entype)[i] >= 20)) movealgrithm7(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*enmove)[i] == 10 && ((*entype)[i] == 100 || (*entype)[i] == 5000)) movealgrithm10(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i], (*entype)[i]); if((*enmove)[i] == 20 && (*entype)[i] >= 1000) movealgrithm20(&(*enx)[i], &(*eny)[i], &(*enshiftx)[i], &(*enshifty)[i], &(*enceiling)[i], &(*entemp)[i]); if((*entype)[i] == 5000) //only snork can do this { int u = random(6); if(u == 4) { int j; for(j=5; j<15; j++) { if((*entype)[j] == 0) { if(j >= 5 && j < 10) { (*entype)[j] = 20; (*enx)[j] = (*enx)[20] + 12; (*eny)[j] = (*eny)[20] + 14; (*enceiling)[j] = 30; (*enmove)[j] = 1; (*enshiftx)[j] = 0; (*enshifty)[j] = 1; (*entemp)[j] = 0; (*enshield)[j] = 10; } if(j >= 10 && j < 15) { (*entype)[j] = 20; (*enx)[j] = (*enx)[20] + 12; (*eny)[j] = (*eny)[20] + 14; (*enceiling)[j] = 50; (*enmove)[j] = 1; (*enshiftx)[j] = 0; (*enshifty)[j] = 1; (*entemp)[j] = 0; (*enshield)[j] = 10; } //drawenemy((*enx)[j],(*eny)[j],(*entype)[j], trotation); break; } } } } if((*entype)[i] >= 10 && (*entype)[i] <= 19) { //drawenemy((*enx)[i], (*eny)[i], (*entype)[i], trotation); (*entemp)[i] = (*entemp)[i] + 1; if((*entemp)[i] == 3) { (*entemp)[i] = 0; (*entype)[i] = (*entype)[i] + 1; if((*entype)[i] >= 18) { int t = random(20); if(t >= 5) { if(t == 5) (*entype)[i] = -1001; if(t == 7) (*entype)[i] = -1002; (*enmove)[i] = -1; (*enshield)[i] = 2; } else (*entype)[i] = 0; } //else drawenemy((*enx)[i], (*eny)[i], (*entype)[i], rotation); } } //if((*eny)[i] > 0 && (*eny)[i] < 98) drawenemy((*enx)[i],(*eny)[i],(*entype)[i], trotation); } rotation = rotation + 1; if(rotation == 5) rotation = 1; } void exchangeblows(int (*entype)[], int (*enx)[], int (*eny)[], int (*shotflags)[], int (*shotx)[], int (*shoty)[], int (*enshield)[], int xcood, int ycood, int (*entemp)[], int *shield, int *true, int (*enshotflags)[], int (*enshotx)[], int (*enshoty)[], int (*shotpower)[], int weapontype, int *dinero, int (*goodies)[], int (*laserarray)[], int (*gigabombarray)[], int (*shotshiftx)[], int (*shotshifty)[], int *lives, int invert, int *deathflag) { int i,j; int enwidth; int enheight = 8; int shotwidth = 0; int shotheight = 0; int offset = 0; int t,u,v,n,power; for(j=0; j<21; j++) { enwidth = 8; if((*entype)[j] >= 1000 && (*entype)[20] <= 4000) enwidth = 16; if((*entype)[j] == 5000) enwidth = 32; if((*entype)[j] == 100) enwidth = 16; for(i=0; i<13; i++) { shotwidth = 0; offset = 4; shotheight = 4; int doom = 0; if((*shotflags)[i] == 5) {shotwidth = 8; offset = 0;} if((*shotflags)[i] == 6) {shotheight = 0;} if((*shotflags)[i] == 21) {shotwidth = 8; shotheight = 8;} if((*shotflags)[i] == 100) {shotwidth = 0; shotheight = 0; offset = 0;} if((*shotflags)[i] == 21 && (*shotx)[i] - (*gigabombarray)[4] < (*enx)[j] && (*shotx)[i] + (*gigabombarray)[4] + shotwidth > (*enx)[j] && (*shoty)[i] - (*gigabombarray)[4] < (*eny)[j] && (*shoty)[i] + (*gigabombarray)[4] + shotheight > (*eny)[j] && (*eny)[j] > 0 && (*enx)[j] > 1 && (*enx)[j] < 152 && (*entype)[j] > 0 && (*entype)[j] < 1000) doom = 1; if(((((*shotflags)[i] > 0 && (*shotflags)[i] < 100) && (((*entype)[j] > 0 || ((*entype)[j] < -1000 && (*shotflags)[i] < 4)) && ((*entype)[j] < 10 || ((*entype)[j] >= 20 && (*entype)[i] < 101))) && ((*shotx)[i] + offset + shotwidth >= (*enx)[j]) && ((*shotx)[i] + offset <= (*enx)[j] + enwidth) && ((*shoty)[i] + shotheight >= (*eny)[j]) && ((*shoty)[i] + shotheight <= (*eny)[j] + enheight) && ((*eny)[j] > 0 && (*eny)[j] < LCD_HEIGHT-7 && (*enx)[j] > 0 && (*enx)[j] < LCD_WIDTH-7) && ((*shotx)[i] > 0 && (*shotx)[i] < LCD_WIDTH-7 && (*shoty)[i] > 0 && (*shoty)[i] < LCD_HEIGHT-8))) || doom == 1) { if((*shotflags)[i] == 20) { (*gigabombarray)[0] = (*shotx)[i]; (*gigabombarray)[1] = (*shoty)[i]; (*gigabombarray)[2] = 1; (*gigabombarray)[3] = 1; (*gigabombarray)[4] = 1; (*shotshiftx)[i] = 0; (*shotshifty)[i] = 0; //plotshot((*shotx)[i], (*shoty)[i], (*shotflags)[i]); (*shotflags)[i] = 21; //DrawClipEllipse((*gigabombarray)[0], (*gigabombarray)[1], (*gigabombarray)[2], (*gigabombarray)[3], &(SCR_RECT){{0,0,159,99}}, A_NORMAL); } if((*shotflags)[i] != 15 && (*enshield)[j] > 0) (*enshield)[j] = (*enshield)[j] - (*shotflags)[i]; else { if((*enshield)[j] > 0) (*enshield)[j] = (*enshield)[j] - 1; } //if((*shotflags)[i] != 100 && (*shotflags)[i] != 15) plotshot((*shotx)[i], (*shoty)[i], (*shotflags)[i]); if((*shotflags)[i] != 100 && (*shotflags)[i] != 15 && (*shotflags)[i] != 21) (*shotflags)[i] = 0; if((*enshield)[j] < 1 && ((*entype)[j] < 10 || (*entype)[j] > 18)) { //drawenemy((*enx)[j], (*eny)[j], (*entype)[j], rotation); (*entype)[j] = 10; (*entemp)[j] = 0; (*enx)[j] = (*enx)[j] + 4; (*eny)[j] = (*eny)[j] + 4; } } doom = 0; if(((*enshotflags)[j] != 0 && (*enshotflags)[j] < 3) && ((*enshotx)[j] > xcood - 1 && (*enshotx)[j] < xcood + 16 && (*enshoty)[j] > ycood && (*enshoty)[j] < ycood + 16) && *deathflag == 0) { power = 1; if((*entype)[j] == 100) power = 2; t = *shield; u = (*goodies)[0]; drawshield(&t, &u, power); *shield = t; (*goodies)[0] = u; //drawenemyshot((*enshotx)[j], (*enshoty)[j], (*enshotflags)[j]); (*enshotflags)[j] = 10; //drawenemy((*enshotx)[j], (*enshoty)[j], (*enshotflags)[j], rotation); if(*shield < 0) { *lives = *lives - 1; if(*lives == -1) *true = 0; else { n = 0; *deathflag = 1; //drawship (xcood, ycood); //DrawClipEllipse(xcood, ycood, 1, 1, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); drawshield(&n, 0, -20); *shield = n; } } } if(((*enshotflags)[j] != 0 && (*enshotflags)[j] < 3) && ((*enshotx)[j] >= (*shotx)[i] && (*enshotx)[j] <= (*shotx)[i] + shotwidth && (*enshoty)[j] >= (*shoty)[i] && (*enshoty)[j] <= (*shoty)[i] + 4 && (*shotflags)[i] == 5)) { //drawenemyshot((*enshotx)[j], (*enshoty)[j], (*enshotflags)[j]); (*enshotflags)[j] = 10; //drawenemy((*enshotx)[j], (*enshoty)[j], (*enshotflags)[j], rotation); } if((*enx)[j] > xcood - 1 - enwidth && (*enx)[j] < xcood + 16 && (*eny)[j] > ycood - enheight && (*eny)[j] < ycood + 16 && (((*entype)[j] > 0 && (*entype)[j] < 10) || ((*entype)[j] >= 20 && (*entype)[i] < 101)) && *deathflag == 0) { t = *shield; u = (*goodies)[0]; v = (*enshield)[j]; drawshield(&t, &u, v); *shield = t; (*goodies)[0] = u; (*enshield)[j] = 0; //drawenemy((*enx)[j], (*eny)[j], (*entype)[j], rotation); (*entype)[j] = 10; (*enx)[j] = (*enx)[j] + 4; (*eny)[j] = (*eny)[j] + 4; (*entemp)[j] = 0; if(*shield < 0) { *lives = *lives - 1; if(*lives == -1) *true = 0; else { n = 0; *deathflag = 1; //drawship(xcood, ycood); //DrawClipEllipse(xcood, ycood, 1, 1, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); drawshield(&n, 0, -20); *shield = n; } } } if((*enx)[j] > xcood - 1 - enwidth && (*enx)[j] < xcood + 16 && (*eny)[j] > ycood - enheight && (*eny)[j] < ycood + 16 && (*entype)[j] == -1001) { t = *shield; u = (*goodies)[0]; v = -1; if(t < 21) drawshield(&t, &u, v); *shield = t; (*goodies)[0] = u; //drawenemy((*enx)[j], (*eny)[j], (*entype)[j], rotation); (*entype)[j] = 0; } if((*enx)[j] > xcood - 1 - enwidth && (*enx)[j] < xcood + 16 && (*eny)[j] > ycood - enheight && (*eny)[j] < ycood + 16 && (*entype)[j] == -1002) { //drawenemy((*enx)[j], (*eny)[j], (*entype)[j], rotation); (*entype)[j] = 0; if(*dinero < INT_MAX) { *dinero = *dinero + 100; } } } } } /*void shop(int *dinero, int (*weaponflags)[], int *shield, int (*goodies)[]) { clrscr(); int loop = 1; int pointery = 30; unsigned delay = 0; FontSetSys(F_6x8); printf_xy(0,0,"Spazian Shopping Bay"); printf_xy(0,9,"Credits:"); printf_xy(70,9,"%d",*dinero); FontSetSys(F_4x6); printf_xy(10,30,"Shield + 1 100"); printf_xy(10,37,"Weapon 2 300"); printf_xy(10,44,"Gigablast 5 for 700"); printf_xy(10,51,"Weapon 3 1000"); printf_xy(10,58,"Gigabomb 5 for 1200"); printf_xy(10,65,"Weapon 4 1400"); printf_xy(10,72,"Extra Shields 1600"); printf_xy(10,79,"Weapon 5 2000"); printf_xy(10,86,"Weapon 6 2500"); printf_xy(10,93,"Laser Turret 4000"); printf_xy(0,pointery,">"); int selection = 0; while(loop == 1) { delay = delay + 1; if(delay == 16000) { delay = 0; if(_keytest (RR_UP) && pointery > 30) { printf_xy(0,pointery," "); pointery = pointery - 7; printf_xy(0,pointery,">"); } if(_keytest (RR_DOWN) && pointery < 93) { printf_xy(0,pointery," "); pointery = pointery + 7; printf_xy(0,pointery,">"); } if(_keytest (RR_ENTER)) selection = pointery; if(selection != 0) { if(selection == 30 && *dinero >= 100 && *shield < 20) { *shield = *shield + 1; *dinero = *dinero - 100; } if(selection == 37 && *dinero >= 300 && (*weaponflags)[1] == 0) { *dinero = *dinero - 300; (*weaponflags)[1] = 1; } if(selection == 44 && *dinero >= 700 && (*goodies)[1] < 99) { *dinero = *dinero - 700; (*goodies)[1] = (*goodies)[1] + 5; } if(selection == 51 && *dinero >= 1000 && (*weaponflags)[2] == 0) { *dinero = *dinero - 1000; (*weaponflags)[2] = 1; } if(selection == 58 && *dinero >= 1200 && (*goodies)[2] < 99) { *dinero = *dinero - 1200; (*goodies)[2] = (*goodies)[2] + 5; } if(selection == 65 && *dinero >= 1400 && (*weaponflags)[3] == 0) { *dinero = *dinero - 1400; (*weaponflags)[3] = 1; } if(selection == 72 && *dinero >= 1600 && (*goodies)[0] < 1) { *dinero = *dinero - 1600; *shield = 20; (*goodies)[0] = 20; } if(selection == 79 && *dinero >= 2000 && (*weaponflags)[4] == 0) { *dinero = *dinero - 2000; (*weaponflags)[4] = 1; } if(selection == 86 && *dinero >= 2500 && (*weaponflags)[5] == 0) { *dinero = *dinero - 2500; (*weaponflags)[5] = 1; } if(selection == 93 && *dinero >= 4000 && (*weaponflags)[6] == 0) { *dinero = *dinero - 4000; (*weaponflags)[6] = 1; } selection = 0; FontSetSys(F_6x8); printf_xy(70,9," "); printf_xy(70,9,"%d",*dinero); FontSetSys(F_4x6); } if(_keytest (RR_ESC)) {loop = 0;} } } clrscr(); }*/ void getkey(int *shipx, int *shipy, int *availableweapon, int (*weaponflags)[], int *weapontype, int (*goodies)[], int *shield, int *dinero) { if((_keytest (RR_LEFT)) && (*shipx > 2)) { //drawship(*shipx, *shipy); *shipx = *shipx - 2; //drawship(*shipx, *shipy); } if((_keytest (RR_RIGHT)) && (*shipx < LCD_WIDTH-16)) { //drawship(*shipx, *shipy); *shipx = *shipx + 2; //drawship(*shipx, *shipy); } if((_keytest (RR_UP)) && (*shipy > 0)) { //drawship(*shipx, *shipy); *shipy = *shipy - 1; //drawship(*shipx, *shipy); } if((_keytest (RR_DOWN)) && (*shipy < LCD_HEIGHT-16)) { //drawship(*shipx, *shipy); *shipy = *shipy + 1; //drawship(*shipx, *shipy); } if(_keytest(RR_ESC)) { clrscr(); while(!_keytest(RR_APPS)) { if(_keytest(RR_APPS)) break; } } if((_keytest (RR_1)) && (*weaponflags)[0] == 1) {*weapontype = 1;} if((_keytest (RR_2)) && (*weaponflags)[1] == 1) {*weapontype = 2;} if((_keytest (RR_3)) && (*weaponflags)[2] == 1) {*weapontype = 3;} if((_keytest (RR_4)) && (*weaponflags)[3] == 1) {*weapontype = 4;} if((_keytest (RR_5)) && (*weaponflags)[4] == 1) {*weapontype = 5;} if((_keytest (RR_6)) && (*weaponflags)[5] == 1) {*weapontype = 6;} if(_keytest (RR_F1)) { *dinero = 0; if(*availableweapon == 1 && (*weaponflags)[1] == 0) {*weapontype = 2; (*weaponflags)[1] = 1; *availableweapon = 0;} if(*availableweapon == 2 && (*goodies)[1] < 99) {(*goodies)[1] = (*goodies)[1] + 5; *availableweapon = 0;} if(*availableweapon == 3 && (*weaponflags)[2] == 0) {*weapontype = 3; (*weaponflags)[2] = 1; *availableweapon = 0;} if(*availableweapon == 4 && (*goodies)[2] < 99) {(*goodies)[2] = (*goodies)[2] + 5; *availableweapon = 0;} if(*availableweapon == 5 && (*weaponflags)[3] == 0) {*weapontype = 4; (*weaponflags)[3] = 1; *availableweapon = 0;} if(*availableweapon == 6 && (*goodies)[0] < 1) {*shield = 20; (*goodies)[0] = 20; *availableweapon = 0;} if(*availableweapon == 7 && (*weaponflags)[4] == 0) {*weapontype = 5; (*weaponflags)[4] = 1; *availableweapon = 0;} if(*availableweapon == 8 && (*weaponflags)[5] == 0) {*weapontype = 6; (*weaponflags)[5] = 1; *availableweapon = 0;} if(*availableweapon == 9 && (*weaponflags)[6] == 0) {(*weaponflags)[6] = 1; *availableweapon = 0;} } } /*void drawship(int xship, int yship) { Sprite16 (xship, yship, 16, shipsprite, LCD_MEM, A_NORMAL); } void plotshot(int x, int y, int type) { if(type == 1) Sprite8 (x, y, 6, shotsprite, LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 4, shotsprite2, LCD_MEM, A_NORMAL); if(type == 3) Sprite8 (x, y, 4, shotsprite3, LCD_MEM, A_NORMAL); if(type == 4) Sprite8 (x, y, 4, shotsprite4, LCD_MEM, A_NORMAL); if(type == 5) Sprite8 (x, y, 4, shotsprite5, LCD_MEM, A_NORMAL); if(type == 6) Sprite8 (x, y, 8, shotsprite6, LCD_MEM, A_NORMAL); if(type == 15) Sprite8 (x, y, 7, laserhit, LCD_MEM, A_NORMAL); if(type == 100) Sprite8 (x, y, 8, gigashot, LCD_MEM, A_NORMAL); if(type == 20) Sprite8 (x, y, 6, gigabomb, LCD_MEM, A_NORMAL); } void drawenemy(int x, int y, int type, int rotation) { if(type == -1001) Sprite8 (x, y, 8, shieldcharge, LCD_MEM, A_NORMAL); if(type == -1002) Sprite8 (x, y, 8, money, LCD_MEM, A_NORMAL); if(type == 1) Sprite8 (x, y, 8, enemy1, LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 8, enemy2, LCD_MEM, A_NORMAL); if(type == 3) Sprite8 (x, y, 8, enemy3, LCD_MEM, A_NORMAL); if(type == 4) Sprite8 (x, y, 8, enemy4, LCD_MEM, A_NORMAL); if(type == 5) Sprite8 (x, y, 8, enemy5, LCD_MEM, A_NORMAL); if(type == 6) Sprite8 (x, y, 8, enemy6, LCD_MEM, A_NORMAL); if(type == 7) Sprite8 (x, y, 8, enemy7, LCD_MEM, A_NORMAL); if(type == 8) Sprite8 (x, y, 8, enemy8, LCD_MEM, A_NORMAL); if(type == 9) Sprite8 (x, y, 8, enemy9, LCD_MEM, A_NORMAL); if(type == 20 && rotation == 1) Sprite8 (x, y, 8, enemy10a, LCD_MEM, A_NORMAL); if(type == 20 && rotation == 2) Sprite8 (x, y, 8, enemy10b, LCD_MEM, A_NORMAL); if(type == 20 && rotation == 3) Sprite8 (x, y, 8, enemy10c, LCD_MEM, A_NORMAL); if(type == 20 && rotation == 4) Sprite8 (x, y, 8, enemy10d, LCD_MEM, A_NORMAL); if(type == 21) Sprite8 (x, y, 8, asteroid, LCD_MEM, A_NORMAL); if(type >= 10 && type <= 14) DrawClipEllipse(x, y, type-9, type-9, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); if(type == 100) Sprite16 (x, y, 8, boss, LCD_MEM, A_NORMAL); if(type == 1000) Sprite16 (x, y, 12, subboss1, LCD_MEM, A_NORMAL); if(type == 2000) Sprite16 (x, y, 12, subboss2, LCD_MEM, A_NORMAL); if(type == 3000) Sprite16 (x, y, 12, subboss3, LCD_MEM, A_NORMAL); if(type == 5000) Sprite32 (x, y, 20, snork, LCD_MEM, A_NORMAL); } void drawenemyshot(int x, int y, int type) { if(type == 1) Sprite8 (x, y, 4, enshot, LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 6, bossfire, LCD_MEM, A_NORMAL); }*/ void movealgrithmn1(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp, int *type) { *temp = *temp + 1; if(*temp > 0) { *temp = 0; *y = *y + shift; if(*y >= LCD_HEIGHT-8) *type = 0; } } void movealgrithm1(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp, int *move, int number) { if(*y < *ceiling) *y = *y + (*yshift * shift); if(*y >= *ceiling) { *temp = *temp + shift; *x = *x + *xshift * shift; *y = *y + *yshift * shift; if(*temp == 8 && *xshift == 1 && *yshift == 0) { *temp = 0; *xshift = 0; *yshift = 1; } if(*temp == 8 && *xshift == 0 && *yshift == 1) { *temp = 0; *xshift = -1; *yshift = 0; } if(*temp == 8 && *xshift == -1 && *yshift == 0) { *temp = 0; *xshift= 0; *yshift = -1; } if(*temp == 8 && *xshift == 0 && *yshift == -1) { *temp = 0; *xshift = 1; *yshift = 0; } if(number < 11) { *move = 2; *xshift = random(3); *yshift = random(3); *xshift = *xshift - 1; *yshift = *yshift - 1; } } } void movealgrithm2(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { if(*y < 0) *y = *y + (*yshift * shift); if(*y >= 0) { *temp = *temp + 1; *x = *x + *xshift * shift; *y = *y + *yshift * shift; if(*x < 1) *xshift = 1; if(*y < 1) *yshift = 1; if(*x > LCD_WIDTH-8) *xshift = -1; if(*y > *ceiling) *yshift = -1; if(*temp == 10) { if(random(3) == 2) *xshift = 1; if(random(3) == 1) *xshift = -1; if(random(3) == 2) *xshift = 1; if(random(3) == 1) *xshift = -1; *temp = 0; } } } void movealgrithm3(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { if(*y < *ceiling) *y = *y + (*yshift * shift); if(*y >= *ceiling) { if(*xshift == 0 && *yshift == 1) { if(random(2) == 1) *xshift = 1; if(*xshift != 1) *xshift = -1; *yshift = 0; } else { *x = *x + (*xshift * shift); if(*x < 1) *xshift = 1; if(*x > LCD_WIDTH-8) *xshift = -1; } } } void movealgrithm4(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { if(*y <= 0) *y = *y + (*yshift * shift); if(*y > 0) { *x = *x + (*xshift * shift); *y = *y + (*yshift * shift); *temp = (*xshift * shift) + (*yshift * shift) + *temp; if(*temp >= *ceiling + 1 && *xshift == 0 && *yshift == 1) { *temp = 0; *xshift = 1; *yshift = 0; } if(*temp >= LCD_WIDTH - 12 && *xshift == 1 && *yshift == 0) { *temp = *ceiling + 2; *xshift = 0; *yshift = -1; } if(*temp <= 1 && *yshift == -1 && *xshift == 0) { *temp = LCD_WIDTH-11; *xshift = -1; *yshift = 0; } if(*temp <= 1 && *xshift == -1 && *yshift == 0) { *temp = 0; *xshift = 0; *yshift = 1; } } } void movealgrithm5(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { *temp = *temp + 1; if(*temp == 1) { *y = *y + (*yshift * shift); *temp = 0; if(*y > LCD_HEIGHT) { *x = random(LCD_WIDTH-14) + 3; *y = 0; } } } void movealgrithm6(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { *temp = *temp + 1; if(*temp == 1) { *y = *y + (*yshift * shift); *x = *x + (*xshift * shift); *temp = 0; if(*x < 1) *x = LCD_WIDTH-10; if(*x > LCD_WIDTH-10) *x = 1; if(*y > LCD_HEIGHT-8) { *x = random(LCD_WIDTH-14) + 3; *y = 0; *xshift = random(3); if(*xshift == 1) *xshift = -1; if(*xshift == 2) *xshift = 1; } } } void movealgrithm7(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { *temp = *temp + 1; if(*temp == 1) { *y = *y + (*yshift * shift); *temp = 0; if(*y < 1) { *x = random(LCD_WIDTH-14) + 3; *y = random(20) + 100; } } } void movealgrithm10(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp, int type) { if(*y < *ceiling) *y = *y + (*yshift * shift); if(*y >= *ceiling) { *x = *x + (*xshift * shift); int max = LCD_WIDTH - 16; if(type == 5000) max = LCD_WIDTH - 32; if(*x > max) *xshift = -1; if(*x < 3) *xshift = 1; } } void movealgrithm20(int *x, int *y, int *xshift, int *yshift, int *ceiling, int *temp) { *x = *x + (*xshift * shift); *y = *y + (*yshift * shift); if(*y < 1) *yshift = 1; if(*y > *ceiling) *yshift = -1; if(*x > LCD_WIDTH-16) *xshift = -2; if(*x < 3) *xshift = 2; } void drawshield(int *shield, int *extrashield, int change) { int t,i; int modify = 0; if(change < 0) modify = 1; if(change > 0) modify = -1; if(change < 0) change = -change; for(i=0; i -1) { *extrashield = *extrashield + modify; t = 5*(*extrashield); } } if(modify == 1) { if(*extrashield <= 0) { t = 5*(*shield); *shield = *shield + modify; } if(*extrashield > 0) { t = 5*(*extrashield); *extrashield = *extrashield + modify; } } } } /*void togglecurrentweapon(int currentweapon, int newweapon) { plotshot(150,0,currentweapon); plotshot(150,0,newweapon); }*/ void levels(int (*entype)[], int (*enx)[], int (*eny)[], int (*enmove)[], int (*enshiftx)[], int (*enshifty)[], int (*enceiling)[], int (*entemp)[], int (*enshield)[], int levels, int *bosslevel, int (*enshotflags)[], int (*sblevel)[], int clevel) { int i; for(i=0; i<21; i++) { (*entype)[i] = 0; } if(levels == 1) { for(i=0; i<20; i++) { (*entype)[i] = 1; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } } if(levels == 2) { for(i=0; i<20; i++) { (*entype)[i] = 1; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 25; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 25; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } } if(levels == 3) { for(i=0; i<20; i++) { if(i >= 5 && i < 10) { (*entype)[i] = 1; (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 25; (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } if(i >= 10 && i < 15) { (*entype)[i] = 1; (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 40; (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 4) { *bosslevel = 1; for(i=0; i<20; i++) { (*entype)[i] = 2; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 2; } } if(levels == 5) { for(i=0; i<20; i++) { (*entype)[i] = 2; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 25; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 25; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 2; } } if(levels == 6 || levels == 10 || levels == 14 || levels == 19) { for(i=0; i<=levels; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 3; (*enshield)[i] = 3; (*entemp)[i] = 0; (*enceiling)[i] = 60; } } if(levels == 7) { for(i=0; i<20; i++) { if(i >= 5 && i < 10) { (*entype)[i] = 2; (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 25; (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } if(i >= 10 && i < 15) { (*entype)[i] = 2; (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 40; (*enmove)[i] = 1; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 1; } } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 8) { *bosslevel = 1; for(i=1; i<9; i++) { (*enx)[i] = random(152); (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enx)[i+8] = random(152); (*eny)[i+8] = random(50); (*eny)[i+8] = -(*eny)[i+8]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enshiftx)[i+8] = 0; (*enshifty)[i+8] = 1; (*enceiling)[i] = 8*i; (*enceiling)[i+8] = 8*i; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; (*entype)[i+8] = 5; (*enshield)[i+8] = 3; (*enmove)[i+8] = 3; (*entemp)[i+8] = 0; } } if(levels == 9) { for(i=1; i<9; i++) { (*enx)[i] = random(152); (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enx)[i+8] = random(152); (*eny)[i+8] = random(50); (*eny)[i+8] = -(*eny)[i+8]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enshiftx)[i+8] = 0; (*enshifty)[i+8] = 1; (*enceiling)[i] = 8*i; (*enceiling)[i+8] = 8*i; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; (*entype)[i+8] = 5; (*enshield)[i+8] = 3; (*enmove)[i+8] = 3; (*entemp)[i+8] = 0; } } if(levels == 11) { for(i=4; i<15; i++) { (*enx)[i] = random(161); (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 0 || i == 1) (*enceiling)[i] = 0; if(i == 2 || i == 3) (*enceiling)[i] = 8; if(i == 4 || i == 5) (*enceiling)[i] = 16; if(i == 5 || i == 6) (*enceiling)[i] = 24; if(i == 7 || i == 8) (*enceiling)[i] = 32; if(i == 9 || i == 10) (*enceiling)[i] = 40; if(i == 11 || i == 12) (*enceiling)[i] = 48; if(i == 13 || i == 14) (*enceiling)[i] = 56; if(i > 14) (*enceiling)[i] = 64; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 12) { *bosslevel = 1; for(i=0; i<20; i++) { (*enx)[i] = (random(146)) + 3; (*eny)[i] = -(random(148)); (*enmove)[i] = 5; (*enceiling)[i] = 0; (*entemp)[i] = 0; (*entype)[i] = 4; (*enshield)[i] = 4; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; } } if(levels == 13) { for(i=0; i<20; i++) { (*enx)[i] = (random(146)) + 3; (*eny)[i] = -(random(148)); (*enmove)[i] = 5; (*enceiling)[i] = 0; (*entemp)[i] = 0; (*entype)[i] = 4; (*enshield)[i] = 4; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; } } if(levels == 15) { for(i=4; i<15; i++) { (*enx)[i] = random(146) + 3; (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 0 || i == 1) (*enceiling)[i] = 0; if(i == 2 || i == 3) (*enceiling)[i] = 8; if(i == 4 || i == 5) (*enceiling)[i] = 16; if(i == 5 || i == 6) (*enceiling)[i] = 24; if(i == 7 || i == 8) (*enceiling)[i] = 32; if(i == 9 || i == 10) (*enceiling)[i] = 40; if(i == 11 || i == 12) (*enceiling)[i] = 48; if(i == 13 || i == 14) (*enceiling)[i] = 56; if(i > 14) (*enceiling)[i] = 64; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 16) { for(i=5; i<15; i++) { (*enx)[i] = random(146) + 3; (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 0 || i == 1) (*enceiling)[i] = 0; if(i == 2 || i == 3) (*enceiling)[i] = 8; if(i == 4 || i == 5) (*enceiling)[i] = 16; if(i == 5 || i == 6) (*enceiling)[i] = 24; if(i == 7 || i == 8) (*enceiling)[i] = 32; if(i == 9 || i == 10) (*enceiling)[i] = 40; if(i == 11 || i == 12) (*enceiling)[i] = 48; if(i == 13 || i == 14) (*enceiling)[i] = 56; if(i > 14) (*enceiling)[i] = 64; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; } //configure subboss for(i=0; i<3; i++) { (*sblevel)[i] = 0; } (*sblevel)[clevel - 1] = 1; if((*sblevel)[0] == 1) (*entype)[20] = 1000; if((*sblevel)[1] == 1) (*entype)[20] = 2000; if((*sblevel)[2] == 1) (*entype)[20] = 3000; if((*sblevel)[3] == 1) (*entype)[20] = 4000; (*enx)[20] = 50; (*eny)[20] = -50; (*enmove)[20] = 20; (*entemp)[20] = 0; (*enceiling)[20] = 20; (*enshiftx)[20] = 2; (*enshifty)[20] = 1; (*enshield)[20] = 60; } if(levels == 17) { *bosslevel= 1; for(i=0; i<20; i++) { (*enx)[i] = 2; (*eny)[i] = -(20 * i); (*enmove)[i] = 4; (*enceiling)[i] = 52; (*entype)[i] = 6; (*enshield)[i] = 6; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } } if(levels == 18) { for(i=0; i<10; i++) { (*enx)[i] = 2; (*eny)[i] = -(40 * i); (*enmove)[i] = 4; (*enceiling)[i] = 52; (*entype)[i] = 6; (*enshield)[i] = 6; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } for(i=10; i<20; i++) { (*enx)[i] = random(161); (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 10 || i == 11) (*enceiling)[i] = 16; if(i == 12 || i == 13) (*enceiling)[i] = 24; if(i == 14 || i == 15) (*enceiling)[i] = 32; if(i == 16 || i == 17) (*enceiling)[i] = 40; if(i > 17) (*enceiling)[i] = 48; (*entype)[i] = 5; (*enshield)[i] = 3; (*enmove)[i] = 3; (*entemp)[i] = 0; } } if(levels == 20) { for(i=0; i<20; i++) { (*enx)[i] = 2; (*eny)[i] = -(20 * i); (*enmove)[i] = 4; (*enceiling)[i] = 52; (*entype)[i] = 6; (*enshield)[i] = 6; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 12; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 21) { *bosslevel = 1; for(i=0; i<20; i++) { (*entype)[i] = 20; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } } if(levels == 22) { for(i=0; i<20; i++) { (*entype)[i] = 20; if(i < 5) { (*enx)[i] = (25*i) + 20; (*eny)[i] = -155; (*enceiling)[i] = 10; } if(i >= 5 && i < 10) { (*enx)[i] = ((i-5)*25) + 25; (*eny)[i] = -140; (*enceiling)[i] = 25; } if(i >= 10 && i < 15) { (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 40; } if(i >= 15) { (*enx)[i] = ((i-15)*25) + 25; (*eny)[i] = -110; (*enceiling)[i] = 55; } (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } } if(levels == 23) { for(i=0; i<20; i++) { if(i >= 5 && i < 10) { (*entype)[i] = 20; (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 25; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } if(i >= 10 && i < 15) { (*entype)[i] = 20; (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 40; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 50; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 24) { *bosslevel = 1; for(i=0; i<8; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 7; (*enshield)[i] = 7; (*entemp)[i] = 0; (*enceiling)[i] = 92; } } if(levels == 25) { for(i=0; i<16; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 7; (*enshield)[i] = 8; (*entemp)[i] = 0; (*enceiling)[i] = 92; } } if(levels == 26) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 7; (*enshield)[i] = 7; (*entemp)[i] = 0; (*enceiling)[i] = 92; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 20; (*entype)[20] = 100; (*enshield)[20] = 35; (*entemp)[20] = 0; } if(levels == 27) { *bosslevel = 1; for(i=0; i<6; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = random(3); (*enshiftx)[i] = (*enshiftx)[i] - 1; (*enshifty)[i] = 1; (*enmove)[i] = 5; (*entype)[i] = 21; (*enshield)[i] = 10; (*entemp)[i] = 0; (*enceiling)[i] = 0; (*enshotflags)[i] = -1; } for(i=10; i<20; i++) { (*enshotflags)[i] = -1; } } if(levels == 28) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = random(3); (*enshiftx)[i] = (*enshiftx)[i] - 1; (*enshifty)[i] = 1; (*enmove)[i] = 6; (*entype)[i] = 21; (*enshield)[i] = 10; (*entemp)[i] = 0; (*enceiling)[i] = 92; (*enshotflags)[i] = -1; } } if(levels == 29) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 7; (*enshield)[i] = 7; (*entemp)[i] = 0; (*enceiling)[i] = 92; (*enshotflags)[i] = -1; } for(i=11; i<20; i++) { (*enshotflags)[i] = -1; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 50; (*entype)[20] = 100; (*enshield)[20] = 20; (*entemp)[20] = 0; } if(levels == 30) { for(i=0; i<20; i++) { if(i >= 5 && i < 10) { (*entype)[i] = 20; (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 25; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } if(i >= 10 && i < 15) { (*entype)[i] = 20; (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 40; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } } for(i=0; i<4; i++) { (*sblevel)[i] = 0; } //configure subboss for(i=0; i<3; i++) { (*sblevel)[i] = 0; } (*sblevel)[clevel - 1] = 1; if((*sblevel)[0] == 1) (*entype)[20] = 1000; if((*sblevel)[1] == 1) (*entype)[20] = 2000; if((*sblevel)[2] == 1) (*entype)[20] = 3000; if((*sblevel)[3] == 1) (*entype)[20] = 4000; (*enx)[20] = 50; (*eny)[20] = -50; (*enmove)[20] = 20; (*entemp)[20] = 0; (*enceiling)[20] = 20; (*enshiftx)[20] = 2; (*enshifty)[20] = 1; (*enshield)[20] = 60; } if(levels == 31) { *bosslevel = 1; for(i=0; i<20; i++) { if(i >= 5 && i < 10) { (*entype)[i] = 20; (*enx)[i] = ((i-5)*25) + 20; (*eny)[i] = -125; (*enceiling)[i] = 25; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } if(i >= 10 && i < 15) { (*entype)[i] = 20; (*enx)[i] = ((i-10)*25) + 20; (*eny)[i] = -110; (*enceiling)[i] = 40; (*enmove)[i] = 7; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; (*enshield)[i] = 6; } } } if(levels == 32) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = random(3); (*enshiftx)[i] = (*enshiftx)[i] - 1; (*enshifty)[i] = 6; (*enmove)[i] = 5; (*entype)[i] = 8; (*enshield)[i] = 4; (*entemp)[i] = 0; (*enceiling)[i] = 0; } for(i=0; i<21; i++) { (*enshotflags)[i] = -1; } } if(levels == 33) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = random(3); (*enshiftx)[i] = (*enshiftx)[i] - 1; (*enshifty)[i] = 4; (*enmove)[i] = 6; (*entype)[i] = 8; (*enshield)[i] = 6; (*entemp)[i] = 0; (*enceiling)[i] = 0; } for(i=0; i<21; i++) { (*enshotflags)[i] = -1; } } if(levels == 34) { for(i=4; i<15; i++) { (*enx)[i] = random(146) + 3; (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 0 || i == 1) (*enceiling)[i] = 0; if(i == 2 || i == 3) (*enceiling)[i] = 8; if(i == 4 || i == 5) (*enceiling)[i] = 16; if(i == 5 || i == 6) (*enceiling)[i] = 24; if(i == 7 || i == 8) (*enceiling)[i] = 32; if(i == 9 || i == 10) (*enceiling)[i] = 40; if(i == 11 || i == 12) (*enceiling)[i] = 48; if(i == 13 || i == 14) (*enceiling)[i] = 56; if(i > 14) (*enceiling)[i] = 64; (*entype)[i] = 5; (*enshield)[i] = 8; (*enmove)[i] = 3; (*entemp)[i] = 0; } for(i=0; i<21; i++) { (*enshotflags)[i] = 0; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 50; (*entemp)[20] = 0; } if(levels == 35) { *bosslevel = 1; for(i=0; i<10; i++) { (*enx)[i] = 2; (*eny)[i] = -(50 * i); (*enmove)[i] = 4; (*enceiling)[i] = 92; (*entype)[i] = 9; (*enshield)[i] = 18; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } } if(levels == 36) { for(i=0; i<20; i++) { (*enx)[i] = 2; (*eny)[i] = -(25 * i); (*enmove)[i] = 4; (*enceiling)[i] = 92; (*entype)[i] = 9; (*enshield)[i] = 18; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } } if(levels == 37) { for(i=0; i<11; i++) { (*enx)[i] = random(148); (*eny)[i] = random(148); (*eny)[i] = (*eny)[i] - 2*(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enmove)[i] = 2; (*entype)[i] = 7; (*enshield)[i] = 8; (*entemp)[i] = 0; (*enceiling)[i] = 92; } } if(levels == 38) { for(i=0; i<20; i++) { (*enx)[i] = 2; (*eny)[i] = -(25 * i); (*enmove)[i] = 4; (*enceiling)[i] = 92; (*entype)[i] = 9; (*enshield)[i] = 18; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*entemp)[i] = 0; } //configure boss (*enx)[20] = 0; (*eny)[20] = -50; (*enmove)[20] = 10; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enceiling)[20] = 4; (*entype)[20] = 100; (*enshield)[20] = 70; (*entemp)[20] = 0; } if(levels == 39) { for(i=0; i<6; i++) { (*enx)[i] = (random(146)) + 3; (*eny)[i] = (random(148)) + 100; (*enmove)[i] = 8; (*enceiling)[i] = 0; (*entemp)[i] = 0; (*entype)[i] = 20; (*enshield)[i] = 5; (*enshiftx)[i] = 0; (*enshifty)[i] = -1; } } if(levels == 40) { for(i=0; i<11; i++) { (*enx)[i] = (random(146)) + 3; (*eny)[i] = (random(148)) + 100; (*enmove)[i] = 8; (*enceiling)[i] = 0; (*entemp)[i] = 0; (*entype)[i] = 20; (*enshield)[i] = 5; (*enshiftx)[i] = 0; (*enshifty)[i] = -1; } } if(levels == 41) { for(i=0; i<5; i++) { (*enx)[i] = 0; (*eny)[i] = -50 * i; (*enmove)[i] = 10; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; (*enceiling)[i] = (i * 16) + 2; (*entype)[i] = 100; (*enshield)[i] = 60; (*entemp)[i] = 0; } } if(levels == 42) { for(i=4; i<15; i++) { (*enx)[i] = random(146) + 3; (*eny)[i] = random(50); (*eny)[i] = -(*eny)[i]; (*enshiftx)[i] = 0; (*enshifty)[i] = 1; if(i == 0 || i == 1) (*enceiling)[i] = 0; if(i == 2 || i == 3) (*enceiling)[i] = 8; if(i == 4 || i == 5) (*enceiling)[i] = 16; if(i == 5 || i == 6) (*enceiling)[i] = 24; if(i == 7 || i == 8) (*enceiling)[i] = 32; if(i == 9 || i == 10) (*enceiling)[i] = 40; if(i == 11 || i == 12) (*enceiling)[i] = 48; if(i == 13 || i == 14) (*enceiling)[i] = 56; if(i > 14) (*enceiling)[i] = 64; (*entype)[i] = 5; (*enshield)[i] = 8; (*enmove)[i] = 3; (*entemp)[i] = 0; } //configure subboss for(i=0; i<3; i++) { (*sblevel)[i] = 0; } (*sblevel)[clevel - 1] = 1; if((*sblevel)[0] == 1) (*entype)[20] = 1000; if((*sblevel)[1] == 1) (*entype)[20] = 2000; if((*sblevel)[2] == 1) (*entype)[20] = 3000; if((*sblevel)[3] == 1) (*entype)[20] = 4000; (*enx)[20] = 50; (*eny)[20] = -50; (*enmove)[20] = 20; (*entemp)[20] = 0; (*enceiling)[20] = 20; (*enshiftx)[20] = 2; (*enshifty)[20] = 1; (*enshield)[20] = 80; } if(levels == 43) { *bosslevel = 1; for(i=0; i<3; i++) { (*sblevel)[i] = 0; } //configure subboss (*sblevel)[clevel - 1] = 1; if((*sblevel)[0] == 1) (*entype)[20] = 1000; if((*sblevel)[1] == 1) (*entype)[20] = 2000; if((*sblevel)[2] == 1) (*entype)[20] = 3000; if((*sblevel)[3] == 1) (*entype)[20] = 5000; (*enx)[20] = 2; (*eny)[20] = -50; (*enmove)[20] = 10; (*entemp)[20] = 0; (*enceiling)[20] = 1; (*enshiftx)[20] = 0; (*enshifty)[20] = 1; (*enshield)[20] = 400; } } void titlescreen(int *quit, int *invert) { clrscr(); FontSetSys(F_8x10); printf_xy(LCD_WIDTH-130,0,"Spazian 0.1"); FontSetSys(F_4x6); printf_xy(LCD_WIDTH-110,20,"By Jude Nelson"); printf_xy(LCD_WIDTH-116,26,"judecn@aol.com"); FontSetSys(F_6x8); printf_xy(LCD_WIDTH-136,60,"Press [F1] to play!"); printf_xy(LCD_WIDTH-142,70,"Press [Clear] to exit"); int j = 0, k = 0; pushkey(0); while(k == 0) { k = ngetchx(); if(k == 263) {*quit = 1; break;} else {*quit = 0; k = 0;} k = ngetchx(); if(k == 268) gamemenu(&(*quit), &(*invert), &k); else {*quit = 0; k = 0;} if(*quit == 1) k = 0; } } void gamemenu(int *quit, int *invert, int *k) { *quit = 0; OSSetSR(0x0000); char temp[sizeof(LCD_MEM)]; memmove (temp, LCD_MEM, sizeof(LCD_MEM)); clrscr(); FontSetSys(F_4x6); menus: title = "Spazian 0.2 Menu"; str1 = "Start/Resume Game"; str2 = "Game Options"; str3 = "Game Controls"; str4 = "About this Game"; str5 = "Exit this Game"; int termflags[] = {16,1,1,1,1,1,0,0,0,0}; int r = 0; menu(100,100,5,&termflags,&r,title,str1,str2,str3,str4,str5); //this is what the program does after the menu, depending on what r is if(r == 1) { *k = 1; *quit = 0; OSSetSR(0x0700); memmove (LCD_MEM, temp, sizeof(temp)); } if(r == 2) { options: title = "Game Options"; str1 = "Set Difficulty"; str2 = "Enemy Speed"; str3 = "Background (on/off)"; str4 = "Back"; int optflags[] = {12,1,1,1,1,0,0,0,0,0}; int s = 0; menu(100,60,4,&optflags,&s,title,str1,str2,str3,str4); if(s == 1) { title = "Difficulty"; str1 = "Easy"; str2 = "Medium"; str3 = "Hard"; int z = 0; int dflags[] = {10,1,1,1,0,0,0,0,0,0,0}; menu(100,55,3,&dflags,&z,title,str1,str2,str3); if(z == 1) { difficulty = 200; } if(z == 2) { difficulty = 400; } if(z == 3) { difficulty = 600; } goto options; } if(s == 2) { title = "Enemy Speed"; str1 = "Normal"; str2 = "Fast"; int z = 0; int sflags[] = {11,1,1,0,0,0,0,0,0,0}; menu(100,35,2,&sflags,&z,title,str1,str2); if(z == 1) { shift = 1; } if(z == 2) { shift = 2; } goto options; } if(s == 3) { title = "Background"; str1 = "Activate"; str2 = "Deactivate"; str3 = "back"; int boolflag[] = {10,1,1,1,0,0,0,0,0,0}; int t = 0; menu(100,40,3,&boolflag,&t,title,str1,str2,str3); if(t == 1) { *invert = 1; } if(t == 2) { *invert = 0; } goto options; } if(s == 4) goto menus; } if(r == 3) { clrscr(); FontSetSys(F_4x6); printf_xy(0,0,"Move Ship: Arrow Keys"); printf_xy(0,8,"Fire Standard Weapon: 2nd"); printf_xy(0,16,"Fire GigaBlast: Diamond"); printf_xy(0,24,"Fire Laser (if you have bought it): Shift"); printf_xy(0,32,"Fire GigaBomb: Alpha"); printf_xy(0,40,"Switch Weapons: 1-6"); printf_xy(0,48,"Exit Game: Clear"); printf_xy(0,56,"Buy item (shopping bay): 2nd"); printf_xy(0,64,"Exit shop: Esc"); printf_xy(0,72,"Pause: Home"); printf_xy(0,80,"Select Item: F1"); ngetchx(); clrscr(); goto menus; } if(r == 4) { clrscr(); FontSetSys(F_6x8); printf_xy(0,0,"Spazian 0.1"); FontSetSys(F_4x6); printf_xy(0,10,"Author: Jude Nelson"); printf_xy(0,18,"Contact: judecn@aol.com"); printf_xy(0,36,"This program was written entirely in C"); printf_xy(0,44,"using the TIGCC IDE. There is no "); printf_xy(0,52,"waranty to this program, and therefore "); printf_xy(0,60,"anything that this program causes is not"); printf_xy(0,68,"my fault. If you experience trouble with"); printf_xy(0,76,"this program, consult the README that "); printf_xy(0,84,"came with this program."); ngetchx(); clrscr(); goto menus; } if(r == 5) { *quit = 1; *k = 0; OSSetSR(0x0700); memmove (LCD_MEM, temp, sizeof(temp)); exit(0); } } void deathexplosion(int xcood, int ycood, int *deathflag) { //DrawClipEllipse(xcood, ycood, diameter, diameter, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); diameter = diameter + 1; if(diameter == 50) {diameter = 1; *deathflag = 0; /*drawship(xcood, ycood);*/} //else DrawClipEllipse(xcood, ycood, diameter, diameter, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); } /*void drawgoodies(int (*goodies)[], int lives) { int i; if((*goodies)[0] >= 1) { for(i=0; i<(5*((*goodies)[0])); i = i + 5) { Sprite8(152, i, 5, shieldbar2, LCD_MEM, A_NORMAL); } } FontSetSys(F_4x6); Sprite8(4,94,6,gigabomb,LCD_MEM,A_NORMAL); printf_xy(12,95,"%d",(*goodies)[2]); Sprite8(137,92,8,gigashot,LCD_MEM,A_NORMAL); printf_xy(145,95,"%d",(*goodies)[1]); Sprite8(5,0,8,shieldcharge,LCD_MEM,A_NORMAL); printf_xy(15,0,"%d",lives); }*/ void menu(int width, int height, int numterms, int (*termflags)[], int *r, ...) { //width is the width of the menu //height is the height of the menu //numterms is the number of terms to be put in the menu //(*termflags)[] is the length of each term //the ... allows one to put in as many as ten strings, which are the terms int x,y,i; x = (LCD_WIDTH/2) - (width/2); y = (LCD_HEIGHT/2) - (height/2); int spacing = 8; clrscr(); drawbox(x,y,width,height,0); drawbox(x+1,y+1,width-2,height-2,0); drawbox(x+3,y+3,width-6,height-6,0); int x2 = x + (width - (width - 15)); int y2 = y+6; for(i=1; i<11; i++) { if((*termflags)[i-1] == 1) { FontSetSys(F_4x6); if(i==2) printf_xy(x2, y2+((i-1)*spacing), str1); if(i==3) printf_xy(x2, y2+((i-1)*spacing), str2); if(i==4) printf_xy(x2, y2+((i-1)*spacing), str3); if(i==5) printf_xy(x2, y2+((i-1)*spacing), str4); if(i==6) printf_xy(x2, y2+((i-1)*spacing), str5); if(i==7) printf_xy(x2, y2+((i-1)*spacing), str6); if(i==8) printf_xy(x2, y2+((i-1)*spacing), str7); if(i==9) printf_xy(x2, y2+((i-1)*spacing), str8); if(i==10) printf_xy(x2, y2+((i-1)*spacing), str9); if(i==11) printf_xy(x2, y2+((i-1)*spacing), str0); } if((*termflags)[i-1] > 1) { int x3 = (LCD_WIDTH/2) - (4*(*termflags)[i-1]/2); int y3 = y + 6; FontSetSys(F_4x6); printf_xy(x3,y3,title); drawbox(x3-2,y3-2,4*(*termflags)[i-1]+2,8,1); } } unsigned char selector[] = { 0b01111000, 0b10011100, 0b10111100, 0b11111100, 0b11111100, 0b01111000 }; int spx = x2 - 8; int spy = (y2 - 1) + spacing + 1; int returnflag = 0; int selection = 1; Sprite8 (spx, spy, 6, selector, LCD_MEM, SPRT_XOR); while(returnflag == 0) { int k = ngetchx(); if(k == KEY_UP && spy > (y2-1)+2*spacing) { Sprite8 (spx, spy, 6, selector, LCD_MEM, SPRT_XOR); spy = spy - spacing; selection = selection - 1; Sprite8 (spx, spy, 6, selector, LCD_MEM, SPRT_XOR); } if(k == KEY_DOWN && spy < (numterms * spacing) + y2) { Sprite8 (spx, spy, 6, selector, LCD_MEM, SPRT_XOR); spy = spy + spacing; selection = selection + 1; Sprite8 (spx, spy, 6, selector, LCD_MEM, SPRT_XOR); } if(k == 13) { //the number in *r is the rth term in the menu in this switch/case statement switch (selection) { case 1: *r = 1; break; case 2: *r = 2; break; case 3: *r = 3; break; case 4: *r = 4; break; case 5: *r = 5; break; case 6: *r = 6; break; case 7: *r = 7; break; case 8: *r = 8; break; case 9: *r = 9; break; case 10: *r = 10; break; } returnflag = 1; } } } void drawbox(int x, int y, int width, int height, int fill) { DrawLine(x,y,x+width,y,A_XOR); DrawLine(x,y,x,y+height,A_XOR); DrawLine(x+width,y,x+width,y+height,A_XOR); DrawLine(x,y+height,x+width,y+height,A_XOR); if(fill == 1) { int i; for(i=1; i= difficulty) {dinero = 0; if(availableweapon < 9) availableweapon = availableweapon + 1;} moveshots(&shotflag, &shotx, &shoty, &shotshiftx, &shotshifty, weapontype, &shottemp, &laserarray, &gigabombarray); moveenemies(&entype, &enx, &eny, &enmove, &enshiftx, &enshifty, &enceiling, &entemp, &enshield); moveenemyshots(&enshotflags, &enshotx, &enshoty, &enshotshiftx, &enshotshifty, &enx, &eny, &entype, shipx, shipy, level); exchangeblows(&entype, &enx, &eny, &shotflag, &shotx, &shoty, &enshield, shipx, shipy, &entemp, &shield, &true, &enshotflags, &enshotx, &enshoty, &shottemp, weapontype, &dinero, &goodies, &laserarray, &gigabombarray, &shotshiftx, &shotshifty, &lives, invert, &deathflag); //drawgoodies(&goodies, lives); clrscr(); draw(bigsprites, medsprites, smallsprites, weapons, enfiresprites, misc, backgroundsprites, shotflag, shotx, shoty, shotshiftx, shotshifty, weaponflags, shottemp, entype, enx, eny, enmove, enshiftx, enshifty, enceiling, entemp, enshield, enshotflags, enshotx, enshoty, enshotshiftx, enshotshifty, gigabombarray, laserarray, bx, by, btype, btemp, shield, lives, weapontype, shipx, shipy, rotation, goodies, invert, availableweapon, deathflag); if(level == 44) {clevel = 1; level = 1;} /*for(i=0; i<(5*shield); i = i + 5) { Sprite8(0, i, 5, shieldbar, LCD_MEM, A_NORMAL); }*/ for(i=0; i<21; i++) { k = entype[i] + k; } if(k == 0) { level = level + 1; if(level == 17 || level == 31 || level == 43 || level == 44) { clrscr(); FontSetSys(F_8x10); printf_xy(0,0,"Congratulations"); FontSetSys(F_6x8); if(level != 44) { printf_xy(0,12,"You cleared world"); printf_xy(106,12,"%d",clevel); } else { printf_xy(0,12,"You Defeated Snork!"); } printf_xy(0,30,"Weapon Score:"); int wscore = 0; for(i=0; i<7; i++) { wscore = wscore + (weaponflags[i] * 100); } printf_xy(120,30,"%d",wscore); score = wscore + score; printf_xy(0,40,"Shield Score:"); int sscore = shield * 100; int gsscore = goodies[0] * 100; sscore = sscore + gsscore; printf_xy(120,40,"%d",sscore); score = sscore + score; printf_xy(0,50,"Difficulty Score:"); int dscore = ((shift-1)*100) + difficulty; printf_xy(120,50,"%d",dscore); score = dscore + score; printf_xy(0,70,"Total Score:"); printf_xy(120,70,"%d",score); int tempscore = score - (1000 * clevel); printf_xy(0,80,"Bonus:"); if(tempscore > 0) {printf_xy(120,80,"%d",tempscore); tempscore = tempscore/10; dinero = tempscore + dinero;} else printf_xy(100,70,"none"); while(!(_keytest (RR_2ND))) {i = random(1);} clevel = clevel + 1; clrscr(); } levels(&entype, &enx, &eny, &enmove, &enshiftx, &enshifty, &enceiling, &entemp, &enshield, level, &bosslevel, &enshotflags, &sbflags, clevel); /*if(bosslevel == 1) { shop(&dinero, &weaponflags, &shield, &goodies); deathflag = 0; //drawship(shipx, shipy); for(i=0; i<11; i++) { shotflag[i] = 0; } for(i=0; i<21; i++) { enshotflags[i] = 0; } bosslevel = 0; }*/ } k = 0; if(_keytest (RR_CLEAR) || continues == 0) { true = 0; } } } void draw(unsigned long *bigsprites[], unsigned short *medsprites[], unsigned char *smallsprites[], unsigned char *weapons[], unsigned char *enfiresprites[], unsigned char *misc[], unsigned char *backgroundsprites[], int shotflags[], int shotx[], int shoty[], int shotshiftx[], int shotshifty[], int weaponflags[], int shottemp[], int entype[], int enx[], int eny[], int enmove[], int enshiftx[], int enshifty[], int enceiling[], int entemp[], int enshield[], int enshotflags[], int enshotx[], int enshoty[], int enshotshiftx[], int enshotshifty[], int gigabombarray[], int laserarray[], int bx[], int by[], int btype[], int btemp[], int shield, int lives, int weapontype, int shipx, int shipy, int rotation, int goodies[], int invert, int availableweapon, int deathflag) { int i; if(deathflag == 0) Sprite16(shipx, shipy, 16, medsprites[0], LCD_MEM, A_NORMAL); if(deathflag == 1) DrawClipEllipse(shipx, shipy, diameter, diameter, &(SCR_RECT){{0,0,159,99}}, A_NORMAL); for(i=0; i<13; i++) { if(shotx[i] > 0) { if((shotflags[i] == 6 && (shottemp[i] == shotx[i] || shottemp[i] == shotx[i] - 1 || shottemp[i] == shotx[i] + 1)) || (shotx[i] <= 3 || shotx[i] >= LCD_WIDTH)) { shotshiftx[i] = 0; shotshifty[i] = -2; } if(shotx[i] >= 0 && shotx[i] <= LCD_WIDTH - 4 && shoty[i] >= 0 && shoty[i] <= LCD_HEIGHT) { int type = shotflags[i]; int x = shotx[i]; int y = shoty[i]; if(type == 1) Sprite8 (x, y, 6, weapons[0], LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 4, weapons[1], LCD_MEM, A_NORMAL); if(type == 3) Sprite8 (x, y, 4, weapons[2], LCD_MEM, A_NORMAL); if(type == 4) Sprite8 (x, y, 4, weapons[3], LCD_MEM, A_NORMAL); if(type == 5) Sprite8 (x, y, 4, weapons[4], LCD_MEM, A_NORMAL); if(type == 6) Sprite8 (x, y, 8, weapons[5], LCD_MEM, A_NORMAL); if(type == 15) Sprite8 (x, y, 7, weapons[6], LCD_MEM, A_NORMAL); if(type == 100) Sprite8 (x, y, 8, weapons[7], LCD_MEM, A_NORMAL); if(type == 20) Sprite8 (x, y, 6, weapons[8], LCD_MEM, A_NORMAL); if(shotflags[i] == 21) DrawClipEllipse(gigabombarray[0], gigabombarray[1], gigabombarray[2], gigabombarray[3], &(SCR_RECT){{0,0,LCD_WIDTH-1,LCD_HEIGHT-1}}, A_NORMAL); } } } int ty = 40; int tx = LCD_WIDTH-8; int ttype = availableweapon; //if(ttype == 1) Sprite8 (tx, ty, 6, weapons[0], LCD_MEM, A_NORMAL); if(ttype == 1) Sprite8 (tx, ty, 4, weapons[1], LCD_MEM, A_NORMAL); if(ttype == 2) Sprite8 (tx, ty, 8, weapons[7], LCD_MEM, A_NORMAL); if(ttype == 3) Sprite8 (tx, ty, 4, weapons[2], LCD_MEM, A_NORMAL); if(ttype == 4) Sprite8 (tx, ty, 6, weapons[8], LCD_MEM, A_NORMAL); if(ttype == 5) Sprite8 (tx, ty, 4, weapons[3], LCD_MEM, A_NORMAL); if(ttype == 6) Sprite8 (tx, ty, 8, misc[1], LCD_MEM, A_NORMAL); if(ttype == 7) Sprite8 (tx, ty, 4, weapons[4], LCD_MEM, A_NORMAL); if(ttype == 8) Sprite8 (tx, ty, 8, weapons[5], LCD_MEM, A_NORMAL); if(ttype == 9) Sprite8 (tx, ty, 7, weapons[6], LCD_MEM, A_NORMAL); for(i=0; i<21; i++) { if(enx[i] > 0 && enx[i] < LCD_WIDTH - 8 && eny[i] > 0 && eny[i] < LCD_HEIGHT) { int x = enx[i]; int y = eny[i]; int type = entype[i]; if(type == -1001) Sprite8 (x, y, 8, misc[3], LCD_MEM, A_NORMAL); if(type == -1002) Sprite8 (x, y, 8, misc[2], LCD_MEM, A_NORMAL); if(type == 1) Sprite8 (x, y, 8, smallsprites[0], LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 8, smallsprites[1], LCD_MEM, A_NORMAL); if(type == 3) Sprite8 (x, y, 8, smallsprites[2], LCD_MEM, A_NORMAL); if(type == 4) Sprite8 (x, y, 8, smallsprites[3], LCD_MEM, A_NORMAL); if(type == 5) Sprite8 (x, y, 8, smallsprites[4], LCD_MEM, A_NORMAL); if(type == 6) Sprite8 (x, y, 8, smallsprites[5], LCD_MEM, A_NORMAL); if(type == 7) Sprite8 (x, y, 8, smallsprites[6], LCD_MEM, A_NORMAL); if(type == 8) Sprite8 (x, y, 8, smallsprites[7], LCD_MEM, A_NORMAL); if(type == 9) Sprite8 (x, y, 8, smallsprites[8], LCD_MEM, A_NORMAL); if(type == 20 && rotation == 1) Sprite8 (x, y, 8, smallsprites[9], LCD_MEM, A_NORMAL); if(type == 20 && rotation == 2) Sprite8 (x, y, 8, smallsprites[10], LCD_MEM, A_NORMAL); if(type == 20 && rotation == 3) Sprite8 (x, y, 8, smallsprites[11], LCD_MEM, A_NORMAL); if(type == 20 && rotation == 4) Sprite8 (x, y, 8, smallsprites[12], LCD_MEM, A_NORMAL); if(type == 21) Sprite8 (x, y, 8, smallsprites[13], LCD_MEM, A_NORMAL); if(type >= 10 && type <= 14) DrawClipEllipse(x, y, type-9, type-9, &(SCR_RECT){{0,0,LCD_WIDTH-1,LCD_HEIGHT-1}}, A_NORMAL); if(type == 100) Sprite16 (x, y, 8, medsprites[1], LCD_MEM, A_NORMAL); if(type == 1000) Sprite16 (x, y, 12, medsprites[2], LCD_MEM, A_NORMAL); if(type == 2000) Sprite16 (x, y, 12, medsprites[3], LCD_MEM, A_NORMAL); if(type == 3000) Sprite16 (x, y, 12, medsprites[4], LCD_MEM, A_NORMAL); if(type == 5000) Sprite32 (x, y, 20, bigsprites[0], LCD_MEM, A_NORMAL); } if(enshotx[i] > 0 && enshotx[i] < LCD_WIDTH - 2 && enshoty[i] > 0 && enshoty[i] < LCD_HEIGHT - 2) { int type = enshotflags[i]; int x = enshotx[i]; int y = enshoty[i]; if(type == 1) Sprite8 (x, y, 4, enfiresprites[0], LCD_MEM, A_NORMAL); if(type == 2) Sprite8 (x, y, 6, enfiresprites[1], LCD_MEM, A_NORMAL); if(type > 3) DrawClipEllipse(x, y, type-9, type-9, &(SCR_RECT){{0,0,LCD_WIDTH-1,LCD_HEIGHT-1}}, A_NORMAL); } } if(goodies[0] >= 1) { Sprite8 (5,10,8,misc[1],LCD_MEM,SPRT_XOR); } for(i=0; i<(shield * 5); i = i + 5) { Sprite8(0,i,5,misc[0],LCD_MEM,A_NORMAL); } FontSetSys(F_4x6); Sprite8(LCD_WIDTH-156,94,6,weapons[8],LCD_MEM,A_NORMAL); printf_xy(LCD_WIDTH-148,95,"%d",goodies[2]); Sprite8(LCD_WIDTH-23,92,8,weapons[7],LCD_MEM,A_NORMAL); printf_xy(LCD_WIDTH-15,95,"%d",goodies[1]); Sprite8(LCD_WIDTH-155,0,8,misc[3],LCD_MEM,A_NORMAL); printf_xy(LCD_WIDTH-145,0,"%d",lives); if(laserarray[4] > 1) { DrawLineFast(laserarray[0], laserarray[1], laserarray[2], laserarray[3]); } for(i=0; i<20; i++) { if(invert == 1) { if(btype[i] != 1 && by[i] > 0 && by[i] < LCD_HEIGHT && bx[i] > 0 && bx[i] < LCD_WIDTH) Sprite8 (bx[i], by[i], 2, backgroundsprites[1], LCD_MEM, A_NORMAL); if(btype[i] == 1 && by[i] > 0 && by[i] < LCD_HEIGHT && bx[i] > 0 && bx[i] < LCD_WIDTH) Sprite8 (bx[i], by[i], 8, backgroundsprites[0], LCD_MEM, A_NORMAL); } } DrawLineFast(LCD_WIDTH-5,0,LCD_WIDTH-5,36); DrawLineFast(LCD_WIDTH-1,0,LCD_WIDTH-1,36); if(availableweapon > 0 && availableweapon < 10) Sprite8(LCD_WIDTH-5,4*(availableweapon-1),4,misc[4],LCD_MEM,A_NORMAL); for(i=0; i<=9; i++) { DrawLineFast(LCD_WIDTH-5,4*i,LCD_WIDTH-1,4*i); } }