|
@@ -294,7 +294,7 @@ int choose_level(int* commands)
|
|
|
return input - '0';
|
|
|
}
|
|
|
|
|
|
-void setup_level(int level, double& shootr, int& refresh_t, boss& boss1, int& enemy_num, int* commands)
|
|
|
+void setup_level(int level, double& shootr, double& poweruprate, int& refresh_t, boss& boss1, int& enemy_num, int& walls_num)
|
|
|
{
|
|
|
switch(level) //setting game parameters
|
|
|
{
|
|
@@ -308,6 +308,7 @@ void setup_level(int level, double& shootr, int& refresh_t, boss& boss1, int& en
|
|
|
bossname=bossname+RECORD_DIR+BOSS_FILE1+".dat";
|
|
|
boss1.loadpicture(bossname.c_str());
|
|
|
enemy_num=30;
|
|
|
+ walls_num = 3;
|
|
|
break;
|
|
|
}
|
|
|
case 2:
|
|
@@ -320,6 +321,7 @@ void setup_level(int level, double& shootr, int& refresh_t, boss& boss1, int& en
|
|
|
bossname=bossname+RECORD_DIR+BOSS_FILE2+".dat";
|
|
|
boss1.loadpicture(bossname.c_str());
|
|
|
enemy_num=40;
|
|
|
+ walls_num = 2;
|
|
|
break;
|
|
|
}
|
|
|
case 3:
|
|
@@ -332,6 +334,7 @@ void setup_level(int level, double& shootr, int& refresh_t, boss& boss1, int& en
|
|
|
bossname=bossname+RECORD_DIR+BOSS_FILE3+".dat";
|
|
|
boss1.loadpicture(bossname.c_str());
|
|
|
enemy_num=45;
|
|
|
+ walls_num = 2;
|
|
|
break;
|
|
|
}
|
|
|
case 4:
|
|
@@ -344,9 +347,11 @@ void setup_level(int level, double& shootr, int& refresh_t, boss& boss1, int& en
|
|
|
bossname=bossname+RECORD_DIR+BOSS_FILE4+".dat";
|
|
|
boss1.loadpicture(bossname.c_str());
|
|
|
enemy_num=50;
|
|
|
+ walls_num = 2;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ poweruprate = (double)AVERAGE_DROP/enemy_num;
|
|
|
}
|
|
|
|
|
|
void change_commands(int* commands){
|
|
@@ -457,7 +462,7 @@ bool gameover(player& _player,b_list& bombs) //Checks if a bomb/enemy/boss hit
|
|
|
}
|
|
|
|
|
|
|
|
|
-void reset(player& _player, e_list &enemies, boss& boss1, b_list& bullets, b_list& bombs, w_vec& walls, b_list& powerups, r_list& rockets, char level,int& chflag)
|
|
|
+void reset(player& _player, e_list &enemies, boss& boss1, b_list& bullets, b_list& bombs, w_vec& walls, int walls_num, b_list& powerups, r_list& rockets, int& chflag)
|
|
|
{
|
|
|
|
|
|
_player.x=C/2; //resetting initial position and stats of player1
|
|
@@ -490,14 +495,10 @@ void reset(player& _player, e_list &enemies, boss& boss1, b_list& bullets, b_lis
|
|
|
rockets.clear();
|
|
|
chflag=0;
|
|
|
|
|
|
- WALLS_NUM=2; //resetting walls
|
|
|
-
|
|
|
- if(atoi(&level)==1) WALLS_NUM=3;
|
|
|
-
|
|
|
- walls.resize(WALLS_NUM);
|
|
|
+ walls.resize(walls_num);
|
|
|
|
|
|
- for(int i=0;i<walls.size();i++)
|
|
|
- walls[i].create((i+1)*(C/(3*walls.size()+1))+i*(2*C/(3*walls.size()+1)),2*R/3,(int)min(6,2*C/(3*(int)(walls.size())+1)),2,5);
|
|
|
+ for(int i=0;i<walls_num;i++)
|
|
|
+ walls[i].create((i+1)*(C/(3*walls_num+1))+i*(2*C/(3*walls_num+1)),2*R/3,(int)min(6,2*C/(3*(int)(walls_num)+1)),2,5);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -921,7 +922,7 @@ void drop_powerup(int x,int y,b_list& powerups)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,w_vec& walls,b_list& powerups,r_list& rockets,boss& boss1,int& score){
|
|
|
+void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,w_vec& walls,b_list& powerups,r_list& rockets,boss& boss1,int& score, double poweruprate){
|
|
|
bool should_continue;
|
|
|
|
|
|
b_list::iterator it1=bullets.begin();
|
|
@@ -955,7 +956,7 @@ void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,
|
|
|
it1=bullets.erase(it1);
|
|
|
should_continue = true;
|
|
|
it3->alive=false;
|
|
|
- if((double)rand()/RAND_MAX<(double)AVERAGE_DROP/ENEMY_NUM) //a powerup is dropped (AVERAGE_DROP is the mean number of powerups dropped per play in Normal mode)
|
|
|
+ if((double)rand()/RAND_MAX<poweruprate) //a powerup is dropped
|
|
|
drop_powerup(it3->x,it3->y+1,powerups);
|
|
|
score+=100;
|
|
|
break;
|
|
@@ -1079,7 +1080,7 @@ void interactions(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,
|
|
|
++itp;
|
|
|
}
|
|
|
|
|
|
- for(int i=0;i<walls.size();i++)
|
|
|
+ for(size_t i=0;i<walls.size();i++)
|
|
|
for(int j=0;j<walls[i].width;j++)
|
|
|
for(int k=0;k<walls[i].height;k++)
|
|
|
{
|
|
@@ -1438,7 +1439,7 @@ int choose_level_bossrush(int* commands)
|
|
|
return input - '0';
|
|
|
}
|
|
|
|
|
|
-void setup_level_bossrush(int level, double& shootr, int& refresh_t)
|
|
|
+void setup_level_bossrush(int level, double& shootr, double& poweruprate, int& walls_num, int& refresh_t)
|
|
|
{
|
|
|
switch(level) //setting game parameters
|
|
|
{
|
|
@@ -1446,24 +1447,32 @@ void setup_level_bossrush(int level, double& shootr, int& refresh_t)
|
|
|
{
|
|
|
shootr = 0.006;
|
|
|
refresh_t = (int)(0.09*1E3);
|
|
|
+ poweruprate = 0.066;
|
|
|
+ break;
|
|
|
}
|
|
|
case 2:
|
|
|
{
|
|
|
shootr = 0.009;
|
|
|
refresh_t = (int)(0.085*1E3);
|
|
|
+ poweruprate = 0.05;
|
|
|
+ break;
|
|
|
}
|
|
|
case 3:
|
|
|
{
|
|
|
shootr = 0.015;
|
|
|
refresh_t = (int)(0.08*1E3);
|
|
|
+ poweruprate = 0.044;
|
|
|
+ break;
|
|
|
}
|
|
|
case 4:
|
|
|
{
|
|
|
shootr = 0.020;
|
|
|
refresh_t = (int)(0.07*1E3);
|
|
|
+ poweruprate = 0.04;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ walls_num = 3;
|
|
|
}
|
|
|
|
|
|
void resetbosses(boss* Bosses,boss& boss1,player& player1){
|