Commit 804e7a88 authored by Kiste's avatar Kiste
Browse files

Code formatting

parent 2e6276cf
......@@ -227,12 +227,12 @@ void initAttractManager() {
case 2:
case 3:
for ( j=0 ; j<=i ; j++, s++, x+=STG_BOX_SIZE*1.2f ) {
stageX[s] = x; stageY[s] = y;
stageX[s] = x; stageY[s] = y;
}
break;
case 4:
for ( j=0 ; j<=2 ; j++, s++, x+=STG_BOX_SIZE*1.2f ) {
stageX[s] = x; stageY[s] = y;
stageX[s] = x; stageY[s] = y;
}
x += STG_BOX_SIZE*1.2f;
stageX[s] = x; stageY[s] = y;
......@@ -266,12 +266,9 @@ void drawTitle() {
}
static int stgMv[STAGE_NUM+ENDLESS_STAGE_NUM+1][4] = {
{0, 0, 1, 0},
{-1, 1, 2, 0}, {0, 0, 2, -1},
{-2, 1, 3, 0}, {-2, 1, 3, -1}, {0, 0, 3, -1},
{-3, 1, 4, 0}, {-3, 1, 4, -1}, {-3, 1, 4, -1}, {0, 0, 3, -1},
{-4, 1, 4, 0}, {-4, 1, 3, -1}, {-4, 1, 2, -1}, {0, 0, 1, -1},
{-4, 0, 0, 0},
{0, 0, 1, 0}, {-1, 1, 2, 0}, {0, 0, 2, -1}, {-2, 1, 3, 0}, {-2, 1, 3, -1},
{0, 0, 3, -1}, {-3, 1, 4, 0}, {-3, 1, 4, -1}, {-3, 1, 4, -1}, {0, 0, 3, -1},
{-4, 1, 4, 0}, {-4, 1, 3, -1}, {-4, 1, 2, -1}, {0, 0, 1, -1}, {-4, 0, 0, 0},
};
void moveTitleMenu() {
......@@ -323,32 +320,32 @@ void drawTitleMenu() {
int sz = STG_BOX_SIZE+6+sctbl[(titleCnt*16)&(DIV-1)]/24;
drawBox(stageX[i], stageY[i], sz, sz, 16*2-14, 16*2-3, buf);
if ( i < STAGE_NUM ) {
drawStringBuf(stgChr, 180, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawNumCenter(i+1, 308, 80, 12, 16*1-14, 16*1-2);
drawStringBuf(stgChr, 180, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawNumCenter(i+1, 308, 80, 12, 16*1-14, 16*1-2);
} else {
switch ( i ) {
case 10:
drawStringBuf(endlessChr, 188, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 11:
drawStringBuf(endlessChr, 93, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(hardChr, 248, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 12:
drawStringBuf(endlessChr, 36, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(extChr, 190, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 13:
drawStringBuf(endlessChr, 56, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(insChr, 210, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 14:
drawStringBuf(quitChr, 230, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
}
switch ( i ) {
case 10:
drawStringBuf(endlessChr, 188, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 11:
drawStringBuf(endlessChr, 93, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(hardChr, 248, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 12:
drawStringBuf(endlessChr, 36, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(extChr, 190, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 13:
drawStringBuf(endlessChr, 56, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
drawStringBuf(insChr, 210, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
case 14:
drawStringBuf(quitChr, 230, 80, 12, 2, 16*1-14, 16*1-2, buf, 0);
break;
}
}
if ( i < STAGE_NUM+ENDLESS_STAGE_NUM ) {
drawNumCenter(hiScore.stageScore[i], 308, 112, 12, 16*1-14, 16*1-2);
drawNumCenter(hiScore.stageScore[i], 308, 112, 12, 16*1-14, 16*1-2);
}
}
drawBox(stageX[i], stageY[i], STG_BOX_SIZE, STG_BOX_SIZE, 16*1-14, 16*1-3, buf);
......@@ -357,26 +354,26 @@ void drawTitleMenu() {
} else {
switch ( i ) {
case 9:
drawNumCenter(10, stageX[i]+8, stageY[i], 12, 16*1-16, 16*1-1);
break;
drawNumCenter(10, stageX[i]+8, stageY[i], 12, 16*1-16, 16*1-1);
break;
case 10:
drawLetterBuf('E'-'A'+10, stageX[i], stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
drawLetterBuf('E'-'A'+10, stageX[i], stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
case 11:
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('H'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('H'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
case 12:
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('E'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('E'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
case 13:
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('I'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
drawLetterBuf('E'-'A'+10, stageX[i]-8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
drawLetterBuf('I'-'A'+10, stageX[i]+8, stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
case 14:
drawLetterBuf('Q'-'A'+10, stageX[i], stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
drawLetterBuf('Q'-'A'+10, stageX[i], stageY[i], 12, 2, 16*1-16, 16*1-1, buf, 0);
break;
}
}
}
......
......@@ -52,14 +52,14 @@ void setStageBackground(int bn) {
addBoard(9000, 9000, 500, 25000, 25000);
for ( i=0 ; i<4 ; i++ ) {
for ( j=0 ; j<4 ; j++ ) {
if ( i > 1 || j > 1 ) {
addBoard(i*16384, j*16384, 500, 10000+(i*12345)%3000, 10000+(j*54321)%3000);
}
if ( i > 1 || j > 1 ) {
addBoard(i*16384, j*16384, 500, 10000+(i*12345)%3000, 10000+(j*54321)%3000);
}
}
}
for ( j=0 ; j<8 ; j++ ) {
for ( i=0 ; i<4 ; i++ ) {
addBoard(0, i*16384, 500-j*50, 20000-j*1000, 12000-j*500);
addBoard(0, i*16384, 500-j*50, 20000-j*1000, 12000-j*500);
}
}
for ( i=0 ; i<8 ; i++ ) {
......@@ -80,7 +80,7 @@ void setStageBackground(int bn) {
for ( i=0 ; i<16 ; i++ ) {
addBoard(0, 0, 400-i*10, 16000, 16000);
if ( i < 6 ) {
addBoard(9600, 16000, 400-i*10, 40000, 16000);
addBoard(9600, 16000, 400-i*10, 40000, 16000);
}
}
boardMx = 128; boardMy = 512;
......@@ -104,16 +104,16 @@ void setStageBackground(int bn) {
addBoard(9000, 9000, 500, 30000, 30000);
for ( i=0 ; i<4 ; i++ ) {
for ( j=0 ; j<4 ; j++ ) {
if ( i > 1 || j > 1 ) {
addBoard(i*16384, j*16384, 500, 12000+(i*12345)%3000, 12000+(j*54321)%3000);
}
if ( i > 1 || j > 1 ) {
addBoard(i*16384, j*16384, 500, 12000+(i*12345)%3000, 12000+(j*54321)%3000);
}
}
}
for ( i=0 ; i<4 ; i++ ) {
for ( j=0 ; j<4 ; j++ ) {
if ( (i > 1 || j > 1) && (i+j)%3 == 0 ) {
addBoard(i*16384, j*16384, 480, 9000+(i*12345)%3000, 9000+(j*54321)%3000);
}
if ( (i > 1 || j > 1) && (i+j)%3 == 0 ) {
addBoard(i*16384, j*16384, 480, 9000+(i*12345)%3000, 9000+(j*54321)%3000);
}
}
}
addBoard(9000, 9000, 480, 20000, 20000);
......@@ -132,7 +132,7 @@ void setStageBackground(int bn) {
for ( i=0 ; i<16 ; i++ ) {
addBoard(20000, 0, 160-i*10, 16000, 16000);
if ( i < 6 ) {
addBoard(29600, 16000, 160-i*10, 40000, 16000);
addBoard(29600, 16000, 160-i*10, 40000, 16000);
}
}
boardMx = 0; boardMy = 128;
......@@ -143,12 +143,12 @@ void setStageBackground(int bn) {
for ( k=0 ; k<5 ; k++ ) {
j = 0;
for ( i=0 ; i<16 ; i++ ) {
addBoard(j, i*4096, 200-k*10, 16000, 4096);
addBoard(j+16000-j*2, i*4096, 200-k*10, 16000, 4096);
if ( i < 4 ) j += 2000;
else if ( i < 6 ) j -= 3500;
else if ( i < 12 ) j += 1500;
else j -= 2000;
addBoard(j, i*4096, 200-k*10, 16000, 4096);
addBoard(j+16000-j*2, i*4096, 200-k*10, 16000, 4096);
if ( i < 4 ) j += 2000;
else if ( i < 6 ) j -= 3500;
else if ( i < 12 ) j += 1500;
else j -= 2000;
}
}
boardMx = -10; boardMy = 25;
......@@ -182,8 +182,7 @@ void drawBackground() {
for ( rx = 0 ; rx < boardRepXn ; rx++, ox += boardRepx ) {
oy = osy;
for ( ry = 0 ; ry < boardRepYn ; ry++, oy += boardRepy ) {
drawBox((bd->x+ox)/bd->z+LAYER_WIDTH/2, (bd->y+oy)/bd->z+LAYER_HEIGHT/2,
bd->width, bd->height, 1, 3, l1buf);
drawBox((bd->x+ox)/bd->z+LAYER_WIDTH/2, (bd->y+oy)/bd->z+LAYER_HEIGHT/2, bd->width, bd->height, 1, 3, l1buf);
}
}
}
......
......@@ -177,8 +177,8 @@ void setBarrages(float level, int bm, int midMode) {
if ( bn >= BARRAGE_MAX ) break;
} else {
if ( bn >= barrageMax ) {
bn = 0;
addFrqLoop = 1;
bn = 0;
addFrqLoop = 1;
}
}
if ( addFrqLoop ) {
......@@ -191,31 +191,31 @@ void setBarrages(float level, int bm, int midMode) {
barrage[bn] = barrageQueue[bpn][0];
barrage[bn]->frq = 1;
if ( level < barrageQueue[bpn][0]->maxRank ) {
if ( level < 0 ) level = 0;
barrage[bn]->rank = level;
if ( !bossMode || bn > 0 ) break;
if ( level < 0 ) level = 0;
barrage[bn]->rank = level;
if ( !bossMode || bn > 0 ) break;
}
barrage[bn]->rank = barrageQueue[bpn][0]->maxRank;
if ( !bossMode ) {
level -= 1+barrageQueue[bpn][0]->maxRank;
level -= 1+barrageQueue[bpn][0]->maxRank;
} else {
if ( bn > 0 ) level -= 4+(barrageQueue[bpn][0]->maxRank*6);
if ( bn > 0 ) level -= 4+(barrageQueue[bpn][0]->maxRank*6);
}
bpn++;
if ( bpn >= BARRAGE_TYPE_NUM ) {
if ( !midMode ) {
bpn = 0;
} else {
bpn = 1;
}
if ( !midMode ) {
bpn = 0;
} else {
bpn = 1;
}
}
}
}
pax = (nextRandInt(&rnd)%(SCAN_WIDTH_8*2/3) + (SCAN_WIDTH_8/6));
pay = (nextRandInt(&rnd)%(SCAN_HEIGHT_8/6) + (SCAN_HEIGHT_8/10));
scene++;
}
......@@ -249,9 +249,9 @@ void addBullets() {
} else {
sceneCnt = SCENE_TERM;
if ( scene%10 == 3 ) {
setBarrages(level, false, true);
setBarrages(level, false, true);
} else {
setBarrages(level, false, false);
setBarrages(level, false, false);
}
}
level += levelInc;
......@@ -283,7 +283,7 @@ void addBullets() {
x = nextRandInt(&rnd)%(SCAN_WIDTH_8*2/3) + (SCAN_WIDTH_8/6);
y = nextRandInt(&rnd)%(SCAN_HEIGHT_8/6) + (SCAN_HEIGHT_8/10);
if ( type == quickAppType ) {
pax = x; pay = y;
pax = x; pay = y;
}
addFoe(x, y, barrage[i]->rank, 512, 0, type, shield[type], barrage[i]->bulletml);
}
......@@ -310,12 +310,10 @@ void addBossBullet() {
for ( int i=0 ; i<barrageNum ; i++ ) {
if ( barrage[i]->type != 2 ) continue;
if ( bossBullet == NULL ) {
bl = addFoe(SCAN_WIDTH_8/2, SCAN_HEIGHT_8/5, barrage[i]->rank, 512, 0,
BOSS_TYPE, BOSS_SHIELD, barrage[i]->bulletml);
bl = addFoe(SCAN_WIDTH_8/2, SCAN_HEIGHT_8/5, barrage[i]->rank, 512, 0, BOSS_TYPE, BOSS_SHIELD, barrage[i]->bulletml);
bossBullet = bl;
} else {
bl = addFoeBossActiveBullet(SCAN_WIDTH_8/2, SCAN_HEIGHT_8/5, barrage[i]->rank, 512, 0,
barrage[i]->bulletml);
bl = addFoeBossActiveBullet(SCAN_WIDTH_8/2, SCAN_HEIGHT_8/5, barrage[i]->rank, 512, 0, barrage[i]->bulletml);
}
}
}
......@@ -88,19 +88,19 @@ void moveBonuses() {
if ( bn->down ) {
bn->vel.y += (BONUS_SPEED-bn->vel.y)>>6;
if ( bn->pos.y > SCAN_HEIGHT_8 ) {
bn->down = 0;
bn->pos.y = SCAN_HEIGHT_8;
bn->vel.y = -bn->vel.y;
bn->down = 0;
bn->pos.y = SCAN_HEIGHT_8;
bn->vel.y = -bn->vel.y;
}
} else {
bn->vel.y += (-BONUS_SPEED-bn->vel.y)>>6;
if ( bn->pos.y < 0 ) {
missBonus();
bn->cnt = NOT_EXIST;
continue;
missBonus();
bn->cnt = NOT_EXIST;
continue;
}
}
d = vctDist(&(ship.pos), &(bn->pos));
if ( d < BONUS_ACQUIRE_WIDTH ) {
getBonus();
......@@ -131,13 +131,9 @@ void drawBonuses() {
y = (bn->pos.y/SCAN_HEIGHT*LAYER_HEIGHT)>>8;
ox = sctbl[d]>>5;
oy = sctbl[d+DIV/4]>>5;
drawBox(x+ox, y+oy, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH,
BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x-ox, y-oy, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH,
BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x+oy, y-ox, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH,
BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x-oy, y+ox, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH,
BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x+ox, y+oy, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH, BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x-ox, y-oy, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH, BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x+oy, y-ox, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH, BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
drawBox(x-oy, y+ox, BONUS_DRAW_WIDTH, BONUS_DRAW_WIDTH, BONUS_COLOR_1, BONUS_COLOR_2, l1buf);
}
}
......@@ -42,20 +42,20 @@ int getDeg(int x, int y) {
if ( y < 0 ) {
ty = -y;
if ( tx > ty ) {
f = 1;
od = DIV*3/4; tn = ty*TAN_TABLE_SIZE/tx;
f = 1;
od = DIV*3/4; tn = ty*TAN_TABLE_SIZE/tx;
} else {
f = -1;
od = DIV; tn = tx*TAN_TABLE_SIZE/ty;
f = -1;
od = DIV; tn = tx*TAN_TABLE_SIZE/ty;
}
} else {
ty = y;
if ( tx > ty ) {
f = -1;
od = DIV*3/4; tn=ty*TAN_TABLE_SIZE/tx;
f = -1;
od = DIV*3/4; tn=ty*TAN_TABLE_SIZE/tx;
} else {
f=1;
od = DIV/2; tn=tx*TAN_TABLE_SIZE/ty;
f=1;
od = DIV/2; tn=tx*TAN_TABLE_SIZE/ty;
}
}
} else {
......@@ -63,20 +63,20 @@ int getDeg(int x, int y) {
if ( y < 0 ) {
ty = -y;
if ( tx > ty ) {
f = -1;
od = DIV/4; tn = ty*TAN_TABLE_SIZE/tx;
f = -1;
od = DIV/4; tn = ty*TAN_TABLE_SIZE/tx;
} else {
f = 1;
od = 0; tn = tx*TAN_TABLE_SIZE/ty;
f = 1;
od = 0; tn = tx*TAN_TABLE_SIZE/ty;
}
} else {
ty = y;
if ( tx > ty ) {
f = 1;
od = DIV/4; tn = ty*TAN_TABLE_SIZE/tx;
f = 1;
od = DIV/4; tn = ty*TAN_TABLE_SIZE/tx;
} else {
f = -1;
od = DIV/2; tn = tx*TAN_TABLE_SIZE/ty;
f = -1;
od = DIV/2; tn = tx*TAN_TABLE_SIZE/ty;
}
}
}
......
......@@ -86,8 +86,7 @@ static Foe* getNextFoe() {
return &(foe[i]);
}
Foe* addFoe(int x, int y, double rank, int d, int spd, int type, int shield,
BulletMLParser *parser) {
Foe* addFoe(int x, int y, double rank, int d, int spd, int type, int shield, BulletMLParser *parser) {
Foe *fe = getNextFoe();
if ( !fe ) return NULL;
......@@ -112,8 +111,7 @@ Foe* addFoe(int x, int y, double rank, int d, int spd, int type, int shield,
return fe;
}
Foe* addFoeBossActiveBullet(int x, int y, double rank,
int d, int spd, BulletMLParser *parser) {
Foe* addFoeBossActiveBullet(int x, int y, double rank, int d, int spd, BulletMLParser *parser) {
Foe *fe = addFoe(x, y, rank, d, spd, BOSS_TYPE, 0, parser);
if ( !fe ) return NULL;
foeCnt--; enNum[BOSS_TYPE]--;
......@@ -121,8 +119,7 @@ Foe* addFoeBossActiveBullet(int x, int y, double rank,
return fe;
}
void addFoeActiveBullet(Vector *pos, double rank,
int d, int spd, int color, BulletMLState *state) {
void addFoeActiveBullet(Vector *pos, double rank, int d, int spd, int color, BulletMLState *state) {
Foe *fe = getNextFoe();
if ( !fe ) return;
fe->cmd = new FoeCommand(state, fe);
......@@ -193,19 +190,19 @@ void moveFoes() {
fe = &(foe[i]);
if ( fe->cmd ) {
if ( fe->type == BOSS_TYPE ) {
if ( fe->cmd->isEnd() ) {
delete fe->cmd;
fe->cmd = new FoeCommand(fe->parser, fe);
//fe->cmd->reset();
}
if ( fe->cmd->isEnd() ) {
delete fe->cmd;
fe->cmd = new FoeCommand(fe->parser, fe);
//fe->cmd->reset();
}
}
fe->cmd->run();
if ( fe->spc == NOT_EXIST ) {
if ( fe->cmd ) {
delete fe->cmd;
fe->cmd = NULL;
}
continue;
if ( fe->cmd ) {
delete fe->cmd;
fe->cmd = NULL;
}
continue;
}
}
mx = ((sctbl[fe->d]*fe->spd)>>8) + fe->vel.x;
......@@ -225,28 +222,28 @@ void moveFoes() {
fe->hit = 0;
// Check if the shot hits the foe.
for ( j=0 ; j<SHOT_MAX ; j++ ) {
if ( shot[j].cnt != NOT_EXIST ) {
if ( absN(fe->pos.x-shot[j].pos.x) < foeScanSize[fe->type] &&
absN(fe->pos.y-shot[j].pos.y) < foeScanSize[fe->type]+SHOT_SCAN_HEIGHT ) {
shot[j].cnt = NOT_EXIST;
fe->shield--; fe->hit = 1;
addShotFrag(&shot[j].pos);
if ( fe->shield <= 0 ) {
addScore(enemyScore[fe->type]);
wipeBullets(&(fe->pos), BULLET_WIPE_WIDTH*(fe->type+1));
addEnemyFrag(&(fe->pos), mx, my, fe->type);
if ( fe->type == BOSS_TYPE ) {
bossDestroied();
playChunk(3);
} else {
playChunk(2);
}
removeFoeForced(fe);
continue;
}
playChunk(1);
}
}
if ( shot[j].cnt != NOT_EXIST ) {
if ( absN(fe->pos.x-shot[j].pos.x) < foeScanSize[fe->type] &&
absN(fe->pos.y-shot[j].pos.y) < foeScanSize[fe->type]+SHOT_SCAN_HEIGHT ) {
shot[j].cnt = NOT_EXIST;
fe->shield--; fe->hit = 1;
addShotFrag(&shot[j].pos);
if ( fe->shield <= 0 ) {
addScore(enemyScore[fe->type]);
wipeBullets(&(fe->pos), BULLET_WIPE_WIDTH*(fe->type+1));
addEnemyFrag(&(fe->pos), mx, my, fe->type);
if ( fe->type == BOSS_TYPE ) {
bossDestroied();
playChunk(3);
} else {
playChunk(2);
}
removeFoeForced(fe);
continue;
}
playChunk(1);
}
}
}
} else {
// Check if the bullet hits the ship.
......@@ -254,20 +251,19 @@ void moveFoes() {
vctSub(&bmv, &(fe->ppos));
inaa = vctInnerProduct(&bmv, &bmv);
if ( inaa > 1.0f ) {
sofs = ship.pos;
vctSub(&sofs, &(fe->ppos));
inab = vctInnerProduct(&bmv, &sofs);
ht = inab / inaa;
if ( ht > 0.0f && ht < 1.0f ) {
hd = vctInnerProduct(&sofs, &sofs) - inab*inab/inaa/inaa;
if ( hd >= 0 && hd < SHIP_HIT_WIDTH ) {
destroyShip();
}
}
sofs = ship.pos;
vctSub(&sofs, &(fe->ppos));
inab = vctInnerProduct(&bmv, &sofs);
ht = inab / inaa;
if ( ht > 0.0f && ht < 1.0f ) {
hd = vctInnerProduct(&sofs, &sofs) - inab*inab/inaa/inaa;
if ( hd >= 0 && hd < SHIP_HIT_WIDTH ) {
destroyShip();
}
}
}
}
if ( fe->ppos.x < 0 || fe->ppos.x >= SCAN_WIDTH_8 ||
fe->ppos.y < 0 || fe->ppos.y >= SCAN_HEIGHT_8 ) {
if ( fe->ppos.x < 0 || fe->ppos.x >= SCAN_WIDTH_8 || fe->ppos.y < 0 || fe->ppos.y >= SCAN_HEIGHT_8 ) {
removeFoeForced(fe);
continue;
}
......@@ -277,8 +273,7 @@ void moveFoes() {
// A game speed becomes slow as many bullets appears.
interval = INTERVAL_BASE;
if ( !insane && !nowait && foeNum > processSpeedDownBulletsNum ) {
interval += (foeNum-processSpeedDownBulletsNum) * INTERVAL_BASE /
processSpeedDownBulletsNum;
interval += (foeNum-processSpeedDownBulletsNum) * INTERVAL_BASE / processSpeedDownBulletsNum;
if ( interval > INTERVAL_BASE*2 ) interval = INTERVAL_BASE*2;
}
}
......@@ -298,8 +293,7 @@ void clearFoesZako() {
int i;
Foe *fe;
for ( i=0 ; i<FOE_MAX ; i++ ) {
if ( foe[i].spc == NOT_EXIST ||
foe[i].type == BOSS_TYPE || foe[i].spc == BOSS_ACTIVE_BULLET ) continue;
if ( foe[i].spc == NOT_EXIST || foe[i].type == BOSS_TYPE || foe[i].spc == BOSS_ACTIVE_BULLET ) continue;
fe = &(foe[i]);
addClearFrag(&(fe->pos), &(fe->mv));
removeFoeForced(fe);
......@@ -365,7 +359,7 @@ static int bulletColor[BULLET_COLOR_NUM][2] = {
};
#define BULLET_WIDTH 6
void drawBullets() {
int i;
Foe *fe;
......