functions.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* This file is part of Invaders.
  2. *
  3. * Copyright (C) 2020 LCM.
  4. * You may use, distribute and modify Invaders under the terms of the
  5. * GPLv3 license, available at <https://www.gnu.org/licenses/\>.
  6. */
  7. #ifndef _functions_
  8. #define _functions_
  9. //#includes here
  10. #include "definitions.hpp"
  11. #include "player.hpp"
  12. #include "bullet.hpp"
  13. #include "powerup.hpp"
  14. #include "enemy.hpp"
  15. #include "wall.hpp"
  16. #include "boss.hpp"
  17. typedef std::list<bullet> b_list;
  18. typedef std::list<enemy> e_list;
  19. typedef std::vector<wall> w_vec;
  20. typedef std::list<rocket> r_list;
  21. class record
  22. {
  23. public:
  24. int score;
  25. std::string nick;
  26. bool operator==(record& record2)
  27. {
  28. if(score==record2.score && nick==record2.nick)
  29. return true;
  30. else return false;
  31. }
  32. void print();
  33. void printwin(WINDOW*);
  34. void print(std::ofstream& record);
  35. };
  36. typedef std::list<bullet> b_list;
  37. typedef std::list<enemy> e_list;
  38. typedef std::vector<record> r_vec;
  39. typedef std::vector<wall> w_vec;
  40. void print_title();
  41. void print_catchphrase(std::string phrase);
  42. std::string choose_phrase();
  43. void print_info();
  44. void print_scores();
  45. int choose_level(int* commands);
  46. void setup_level(int level, double& shootr, double& poweruprate, int& refresh_t, boss& boss1, int& enemy_num, int& walls_num, int* commands);
  47. void change_commands(int* commands);
  48. void load_enemies(e_list& enemies,int enemy_num);
  49. char playagain(WINDOW*);
  50. bool gameover(player&,b_list&);
  51. void reset(player&, e_list &, boss&, b_list& bullets, b_list& bombs, w_vec& walls, int walls_num, b_list &powerups, r_list&, int& chflag);
  52. bool enemyalive(e_list &);
  53. void refreshrecords(int,WINDOW*);
  54. void write_score(WINDOW*,int);
  55. void write_bosshp(WINDOW*,int,int,std::string);
  56. void pause_game(int&);
  57. void Victory(std::string,int,char,int);
  58. void Defeat(int);
  59. int choose_level_bossrush(int* commands);
  60. void setup_level_bossrush(int level, double& shootr, double& poweruprate, int& walls_num, int& refresh_t);
  61. void resetbosses(boss* Bosses,boss& boss1,player& player1);
  62. void Victory_bossrush(std::string,int,char,int);
  63. void refreshrecords_bossrush(int,WINDOW*);
  64. void print_scores_bossrush();
  65. void get_SpecialMode(int,int&,boss&,e_list&,b_list&,b_list&,b_list&,r_list&);
  66. bool get_KonamiCode(int);
  67. void get_cheat(char,player&,e_list&,double&);
  68. void activate_combo(boss&,e_list&,b_list&,b_list&,b_list&,r_list&);
  69. void drop_powerup(int x,int y,b_list& powerups);
  70. 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);
  71. void draw(player& player1,b_list& bullets,b_list& bombs,e_list& enemies,w_vec& walls,b_list& powerups,r_list& rockets,boss& boss1);
  72. void create_readme();
  73. void create_std_bosses();
  74. //void create_setsize();
  75. void create_folder(int);
  76. // FORK FUNCTIONS (unused)
  77. /*void music();
  78. void kill_music(int);*/
  79. /*//PTHREAD FUNCTIONS
  80. void *pmusic(void *arg);
  81. void *pshoot_sound(void* arg);
  82. void *penshoot_sound(void* arg);
  83. void *pwin_theme(void *arg);
  84. void *plose_theme(void* arg);
  85. void pkill_music(pthread_t);*/
  86. #endif