mirror of
https://github.com/FunKey-Project/Bibi.git
synced 2026-03-19 10:22:54 +01:00
First commit, compiles without sound for now. Need to change controls, levels, remove some menus, and make sound work
This commit is contained in:
37
include/bomb.h
Normal file
37
include/bomb.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef BOMB_H_
|
||||
#define BOMB_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "../include/constant.h"
|
||||
|
||||
typedef struct s_bomb * t_bomb;
|
||||
|
||||
// Creates a new bomb at a given place
|
||||
extern t_bomb bomb_init(t_bomb list_bombs, int x, int y, int portee, int joueur);
|
||||
extern void bomb_free(t_bomb bomb);
|
||||
|
||||
// Returns the current position of a bomb
|
||||
extern int bomb_get_x(t_bomb bomb);
|
||||
extern int bomb_get_y(t_bomb bomb);
|
||||
extern int bomb_get_joueur(t_bomb bomb);
|
||||
extern int bomb_get_portee(t_bomb bomb);
|
||||
|
||||
//management of the following bomb
|
||||
extern t_bomb get_next_bomb(t_bomb bomb);
|
||||
void set_next_bomb(t_bomb bomb, t_bomb nxt_bomb);
|
||||
|
||||
// Set the next image of a bomb
|
||||
extern void bomb_set_current_time(t_bomb bomb, int time);
|
||||
extern int bomb_get_current_time(t_bomb bomb);
|
||||
|
||||
// Display a bomb on the screen
|
||||
extern void bomb_display(t_bomb bomb, SDL_Surface *screen);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* BOMB_H_ */
|
||||
172
include/constant.h
Normal file
172
include/constant.h
Normal file
@@ -0,0 +1,172 @@
|
||||
#ifndef CONSTANT_H_
|
||||
#define CONSTANT_H_
|
||||
|
||||
|
||||
|
||||
// Use Sound ?
|
||||
//#define SOUND_FMOD_ACTIVATED
|
||||
//#define SOUND_SDL_ACTIVATED
|
||||
|
||||
// Resize ?
|
||||
#define HW_SCREEN_RESIZE
|
||||
#define HW_SCREEN_WIDTH 240
|
||||
#define HW_SCREEN_HEIGHT 240
|
||||
|
||||
#define WINDOW_BPP 16
|
||||
|
||||
// Size (# of pixels) of a cell of the map
|
||||
#define SIZE_BLOC 40
|
||||
|
||||
// Time management
|
||||
#define MAX_SKIPPED_FRAMES 100
|
||||
#define DEFAULT_GAME_SPEED 8 // the more, the faster
|
||||
#define BOMBS_SPEED 5 // the less, the faster
|
||||
#define MONSTER_SPEED 7 // the less, the faster
|
||||
#define ANIMATION_SPEED 2
|
||||
|
||||
// General sprites
|
||||
#define IMG_MAP_WALL "sprite/wall.png"
|
||||
#define IMG_MAP_BOX "sprite/box.png"
|
||||
#define IMG_MAP_GOAL "sprite/objectif.png"
|
||||
|
||||
//Menu sprites
|
||||
#define IMG_MENU_EMPTY "sprite/menu_empty.png"
|
||||
#define IMG_MENU_PLAYER_1 "sprite/menu_player_1.png"
|
||||
#define IMG_MENU_PLAYER_2 "sprite/menu_player_2.png"
|
||||
#define IMG_MENU_LIVES_0 "sprite/lives_0.png"
|
||||
#define IMG_MENU_LIVES_1 "sprite/lives_1.png"
|
||||
#define IMG_MENU_LIVES_2 "sprite/lives_2.png"
|
||||
#define IMG_MENU_LIVES_3 "sprite/lives_3.png"
|
||||
#define IMG_MENU_LIVES_4 "sprite/lives_4.png"
|
||||
#define IMG_MENU_BOMBS_0 "sprite/bombs_0.png"
|
||||
#define IMG_MENU_BOMBS_1 "sprite/bombs_1.png"
|
||||
#define IMG_MENU_BOMBS_2 "sprite/bombs_2.png"
|
||||
#define IMG_MENU_BOMBS_3 "sprite/bombs_3.png"
|
||||
#define IMG_MENU_BOMBS_4 "sprite/bombs_4.png"
|
||||
#define IMG_MENU_BOMBS_5 "sprite/bombs_5.png"
|
||||
#define IMG_MENU_RANGE_0 "sprite/range_0.png"
|
||||
#define IMG_MENU_RANGE_1 "sprite/range_1.png"
|
||||
#define IMG_MENU_RANGE_2 "sprite/range_2.png"
|
||||
#define IMG_MENU_RANGE_3 "sprite/range_3.png"
|
||||
#define IMG_MENU_RANGE_4 "sprite/range_4.png"
|
||||
#define IMG_MENU_RANGE_5 "sprite/range_5.png"
|
||||
|
||||
// Bombs
|
||||
#define IMG_BOMB_TTL1 "sprite/bomb1.png"
|
||||
#define IMG_BOMB_TTL2 "sprite/bomb2.png"
|
||||
#define IMG_BOMB_TTL3 "sprite/bomb3.png"
|
||||
#define IMG_BOMB_TTL4 "sprite/bomb4.png"
|
||||
|
||||
#define IMG_BONUS_BOMB_RANGE_INC "sprite/bonus_bomb_range_inc.png"
|
||||
#define IMG_BONUS_BOMB_RANGE_DEC "sprite/bonus_bomb_range_dec.png"
|
||||
#define IMG_BONUS_BOMB_NB_INC "sprite/bonus_bomb_nb_inc.png"
|
||||
#define IMG_BONUS_BOMB_NB_DEC "sprite/bonus_bomb_nb_dec.png"
|
||||
#define IMG_BONUS_LIFE_INC "sprite/bonus_life_inc.png"
|
||||
|
||||
|
||||
// Players
|
||||
#define IMG_PLAYER_LEFT "sprite/player_left.png"
|
||||
#define IMG_PLAYER_UP "sprite/player_up.png"
|
||||
#define IMG_PLAYER_RIGHT "sprite/player_right.png"
|
||||
#define IMG_PLAYER_DOWN "sprite/player_down.png"
|
||||
#define IMG_PLAYER_2_LEFT "sprite/player_left_2.png"
|
||||
#define IMG_PLAYER_2_UP "sprite/player_up_2.png"
|
||||
#define IMG_PLAYER_2_RIGHT "sprite/player_right_2.png"
|
||||
#define IMG_PLAYER_2_DOWN "sprite/player_down_2.png"
|
||||
|
||||
//Monsters
|
||||
#define IMG_MONSTER_LEFT "sprite/monster_left.png"
|
||||
#define IMG_MONSTER_UP "sprite/monster_up.png"
|
||||
#define IMG_MONSTER_RIGHT "sprite/monster_right.png"
|
||||
#define IMG_MONSTER_DOWN "sprite/monster_down.png"
|
||||
|
||||
|
||||
|
||||
//flamme
|
||||
#define IMG_FLAMME_THIN_HAUT "sprite/ThinUp.png"
|
||||
#define IMG_FLAMME_THIN_BAS "sprite/ThinDown.png"
|
||||
#define IMG_FLAMME_THIN_GAUCHE "sprite/ThinLeft.png"
|
||||
#define IMG_FLAMME_THIN_DROITE "sprite/ThinRight.png"
|
||||
#define IMG_FLAMME_THIN_HRZ "sprite/ThinHrz.png"
|
||||
#define IMG_FLAMME_THIN_VERT "sprite/ThinVert.png"
|
||||
#define IMG_FLAMME_THIN_CENTER "sprite/ThinCenter.png"
|
||||
#define IMG_FLAMME_THIN_MONSTER_BAS "sprite/monster_down_TV.png"
|
||||
#define IMG_FLAMME_THIN_MONSTER_HAUT "sprite/monster_up_TV.png"
|
||||
#define IMG_FLAMME_THIN_MONSTER_GAUCHE "sprite/monster_left_TV.png"
|
||||
#define IMG_FLAMME_THIN_MONSTER_DROITE "sprite/monster_right_TV.png"
|
||||
#define IMG_FLAMME_MEDIUM_HAUT "sprite/FireUp.png"
|
||||
#define IMG_FLAMME_MEDIUM_BAS "sprite/FireDown.png"
|
||||
#define IMG_FLAMME_MEDIUM_GAUCHE "sprite/FireLeft.png"
|
||||
#define IMG_FLAMME_MEDIUM_DROITE "sprite/FireRight.png"
|
||||
#define IMG_FLAMME_MEDIUM_HRZ "sprite/FireHrz.png"
|
||||
#define IMG_FLAMME_MEDIUM_VERT "sprite/FireVert.png"
|
||||
#define IMG_FLAMME_MEDIUM_CENTER "sprite/FireCenter.png"
|
||||
#define IMG_FLAMME_MEDIUM_MONSTER_BAS "sprite/monster_down_FV.png"
|
||||
#define IMG_FLAMME_MEDIUM_MONSTER_HAUT "sprite/monster_up_FV.png"
|
||||
#define IMG_FLAMME_MEDIUM_MONSTER_GAUCHE "sprite/monster_left_FV.png"
|
||||
#define IMG_FLAMME_MEDIUM_MONSTER_DROITE "sprite/monster_right_FV.png"
|
||||
#define IMG_FLAMME_FIRE_HAUT "sprite/LargeUp.png"
|
||||
#define IMG_FLAMME_FIRE_BAS "sprite/LargeDown.png"
|
||||
#define IMG_FLAMME_FIRE_GAUCHE "sprite/LargeLeft.png"
|
||||
#define IMG_FLAMME_FIRE_DROITE "sprite/LargeRight.png"
|
||||
#define IMG_FLAMME_FIRE_HRZ "sprite/LargeHrz.png"
|
||||
#define IMG_FLAMME_FIRE_VERT "sprite/LargeVert.png"
|
||||
#define IMG_FLAMME_FIRE_CENTER "sprite/LargeCenter.png"
|
||||
#define IMG_FLAMME_FIRE_MONSTER_BAS "sprite/monster_down_LV.png"
|
||||
#define IMG_FLAMME_FIRE_MONSTER_HAUT "sprite/monster_up_LV.png"
|
||||
#define IMG_FLAMME_FIRE_MONSTER_GAUCHE "sprite/monster_left_LV.png"
|
||||
#define IMG_FLAMME_FIRE_MONSTER_DROITE "sprite/monster_right_LV.png"
|
||||
#define IMG_FLAMME_LARGE_HAUT "sprite/XLUP.png"
|
||||
#define IMG_FLAMME_LARGE_BAS "sprite/XLDOWN.png"
|
||||
#define IMG_FLAMME_LARGE_GAUCHE "sprite/XLLEFT.png"
|
||||
#define IMG_FLAMME_LARGE_DROITE "sprite/XLRIGHT.png"
|
||||
#define IMG_FLAMME_LARGE_HRZ "sprite/XLHRZ.png"
|
||||
#define IMG_FLAMME_LARGE_VERT "sprite/XLVERT.png"
|
||||
#define IMG_FLAMME_LARGE_CENTER "sprite/XLCENTER.png"
|
||||
#define IMG_FLAMME_LARGE_MONSTER_BAS "sprite/monster_down_XLV.png"
|
||||
#define IMG_FLAMME_LARGE_MONSTER_HAUT "sprite/monster_up_XLV.png"
|
||||
#define IMG_FLAMME_LARGE_MONSTER_GAUCHE "sprite/monster_left_XLV.png"
|
||||
#define IMG_FLAMME_LARGE_MONSTER_DROITE "sprite/monster_right_XLV.png"
|
||||
|
||||
// Maximum lives for a player
|
||||
#define MAXIMUM_LIVES 4
|
||||
|
||||
//Nombre de d<>c<EFBFBD>s avant game over
|
||||
#define NB_DECES 3
|
||||
|
||||
// Maximum power of a bomb
|
||||
#define BOMB_RANGE_MAX 4
|
||||
|
||||
// Maximum number of bombs available
|
||||
#define BOMB_NUMBER_MAX 5
|
||||
|
||||
// Bonus
|
||||
// Probability that a box contains a bonus
|
||||
#define PROBA_BONUS 60
|
||||
|
||||
#define PROBA_BONUS_BOMB_RANGE 30
|
||||
|
||||
// Increase the power of a bomb +1
|
||||
#define PROBA_BONUS_BOMB_RANGE_INC 50
|
||||
|
||||
// Decrease the power of a bomb -1
|
||||
#define PROBA_BONUS_BOMB_RANGE_DEC 50
|
||||
|
||||
#define PROBA_BONUS_BOMB_NB 30
|
||||
|
||||
// Increase the number of bombs
|
||||
#define PROBA_BONUS_BOMB_NB_INC 30
|
||||
// Decrease the number of bombs
|
||||
#define PROBA_BONUS_BOMB_NB_DEC 70
|
||||
|
||||
#define PROBA_BONUS_LIFE_INC 10
|
||||
|
||||
#define PROBA_BONUS_MONSTER 30
|
||||
|
||||
// Name of the file that contains the map
|
||||
#define SRC_MAP "data/level1.lvl"
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONSTANT */
|
||||
6
include/editeur.h
Normal file
6
include/editeur.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef DEF_EDITEUR
|
||||
#define DEF_EDITEUR
|
||||
|
||||
extern void editeur(SDL_Surface *screen, int niveau);
|
||||
|
||||
#endif
|
||||
35
include/flamme.h
Normal file
35
include/flamme.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef FLAMME_H_
|
||||
#define FLAMME_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "../include/constant.h"
|
||||
|
||||
enum e_type_flamme {
|
||||
HAUT = 0, BAS, GAUCHE, DROITE, HRZLEFT, HRZRIGHT, VERTUP, VERTDOWN, CENTER, M_HAUT, M_BAS, M_GAUCHE, M_DROITE
|
||||
};
|
||||
|
||||
typedef struct s_flamme * t_flamme;
|
||||
|
||||
extern t_flamme flamme_init(t_flamme list_flammes, int x, int y, int portee, enum e_type_flamme type);
|
||||
extern void flamme_free(t_flamme flamme);
|
||||
|
||||
// Returns the current position of a flamme
|
||||
extern int flamme_get_x(t_flamme flamme);
|
||||
extern int flamme_get_y(t_flamme flamme);
|
||||
extern int flamme_get_portee(t_flamme flamme);
|
||||
extern enum e_type_flamme flamme_get_type(t_flamme flamme);
|
||||
extern t_flamme get_next_flamme(t_flamme flamme);
|
||||
void set_next_flamme(t_flamme flamme, t_flamme nxt_flamme);
|
||||
|
||||
// Set the next image of a flamme
|
||||
extern void flamme_decrease_current_time(t_flamme flamme);
|
||||
extern int flamme_get_current_time(t_flamme flamme);
|
||||
|
||||
// Display a flamme on the screen
|
||||
extern void flamme_display(t_flamme flamme, SDL_Surface *screen);
|
||||
|
||||
#endif /* FLAMME_H_ */
|
||||
|
||||
66
include/game.h
Normal file
66
include/game.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* game.h
|
||||
*
|
||||
* Created on: 15 mars 2010
|
||||
* Author: reveillere
|
||||
*/
|
||||
|
||||
#ifndef GAME_H_
|
||||
#define GAME_H_
|
||||
|
||||
#include "../include/constant.h"
|
||||
#include "../include/misc.h"
|
||||
|
||||
#include "../include/map.h"
|
||||
#include "../include/player.h"
|
||||
#include "../include/bomb.h"
|
||||
#include "../include/monsters.h"
|
||||
#include "../include/flamme.h"
|
||||
|
||||
#ifdef SOUND_FMOD_ACTIVATED
|
||||
#include <FMOD/fmod.h>
|
||||
#endif //SOUND_FMOD_ACTIVATED
|
||||
|
||||
typedef struct s_game * t_game;
|
||||
|
||||
// Create a new game
|
||||
extern t_game game_new(int nb_joueur, int niveau, int mode, int kill_bomb);
|
||||
extern void game_free(t_game game);
|
||||
|
||||
|
||||
// Return the player of the current game
|
||||
extern t_player game_get_player1(t_game game);
|
||||
extern t_player game_get_player2(t_game game);
|
||||
// Return the map of the current game
|
||||
extern t_map game_the_map(t_game game);
|
||||
|
||||
// Return a bomb of the current game
|
||||
extern void game_init_bomb(t_game game, int x, int y, int portee, int joueur);
|
||||
extern t_monster game_return_monster(t_game game, int monster_number);
|
||||
|
||||
// Generate a random bonus after an explosion
|
||||
extern void generate_bonus(t_game game, int x, int y);
|
||||
t_bonus_type return_bonus();
|
||||
|
||||
// Display the game on the screen
|
||||
extern void game_display(t_game game, SDL_Surface *screen);
|
||||
|
||||
//manage the bombs
|
||||
extern void bombs_management (t_game game, int all_bombs);
|
||||
|
||||
//manage the flammes
|
||||
extern void flamme_management(t_game game);
|
||||
extern void flamme_continue(t_flamme flamme, t_game game);
|
||||
extern void flamme_check_right(int x, int y, int portee, t_game game);
|
||||
extern void flamme_check_left(int x, int y, int portee, t_game game);
|
||||
extern void flamme_check_up(int x, int y, int portee, t_game game);
|
||||
extern void flamme_check_down(int x, int y, int portee, t_game game);
|
||||
|
||||
//manage the monsters
|
||||
extern void monsters_management(t_game game, int nb_joueur);
|
||||
extern t_monster kill_monster(t_monster list_monsters, int x, int y);
|
||||
|
||||
//explose a bomb
|
||||
extern void kill_bomb(t_game game, int x, int y);
|
||||
|
||||
#endif /* GAME_H_ */
|
||||
24
include/game_time.h
Normal file
24
include/game_time.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef __TIME_H__
|
||||
#define __TIME_H__
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
// Number of cycles to process before displaying an image
|
||||
extern Uint16 game_time_get_cycles_to_calculate();
|
||||
|
||||
// Current speed of the game
|
||||
extern Uint16 game_time_get_speed();
|
||||
|
||||
// Duration of a cycle (in ms)
|
||||
extern Uint16 game_time_get_cycles_length();
|
||||
|
||||
// Time initialization
|
||||
extern void game_time_init();
|
||||
|
||||
// Set the speed of the game
|
||||
extern void game_time_set_speed(Uint16 speed);
|
||||
|
||||
// Compute the current time of the game
|
||||
extern void game_time_update();
|
||||
|
||||
#endif /* __TIME_H__ */
|
||||
55
include/map.h
Normal file
55
include/map.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* map.h
|
||||
*
|
||||
* Created on: 16 mars 2010
|
||||
* Author: BUSO, GROSSE
|
||||
*/
|
||||
|
||||
#ifndef MAP_H_
|
||||
#define MAP_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
|
||||
typedef enum {
|
||||
CELL_EMPTY = 0, CELL_GOAL, CELL_WALL, CELL_PLAYER, CELL_PLAYER_2, CELL_BOX,
|
||||
CELL_BONUS, CELL_MONSTER, CELL_BOMB, CELL_FLAMME, CELL_MENU_EMPTY,CELL_MENU_PLAYER_1,
|
||||
CELL_MENU_PLAYER_2,CELL_MENU_LIVES, CELL_MENU_BOMBS, CELL_MENU_RANGE} t_cell_type;
|
||||
|
||||
typedef enum {
|
||||
BONUS_BOMB_RANGE_INC = 1, BONUS_BOMB_RANGE_DEC, BONUS_BOMB_NB_INC, BONUS_BOMB_NB_DEC, BONUS_MONSTER, BONUS_LIFE_INC, NO_BONUS
|
||||
} t_bonus_type;
|
||||
|
||||
typedef struct t_map * t_map;
|
||||
|
||||
// Create a new empty map
|
||||
extern t_map map_new(int width, int height);
|
||||
extern void map_free(t_map map);
|
||||
|
||||
// Return the height and width of a map
|
||||
extern int map_get_width(t_map map);
|
||||
extern int map_get_height(t_map map);
|
||||
|
||||
// Return the type of a cell
|
||||
extern t_cell_type map_get_cell_type(t_map map, int x, int y);
|
||||
// Set the type of a cell
|
||||
extern void map_set_cell_type(t_map map, int x, int y, t_cell_type type);
|
||||
|
||||
// Test if (x,y) is within the map'
|
||||
extern int map_is_inside(t_map map, int x, int y);
|
||||
|
||||
// Load a static pre-calculated map
|
||||
//extern t_map map_load_static(void);
|
||||
|
||||
// Load a dynamic map
|
||||
extern t_map map_load_dynamic(FILE* fd, int niveau, int nb_joueur);
|
||||
// Load a map
|
||||
extern void sauvegarderNiveau(t_map map, int niveau);
|
||||
|
||||
// Display the map on the screen
|
||||
extern void map_display(t_map map, int lives_player, int bombs_player, int range_player, int lives_player2, int bombs_player2, int range_player2, SDL_Surface *screen);
|
||||
|
||||
#endif /* MAP_H_ */
|
||||
43
include/misc.h
Normal file
43
include/misc.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* misc.h
|
||||
*
|
||||
* Created on: 15 mars 2010
|
||||
* Author: reveille
|
||||
*/
|
||||
|
||||
#ifndef MISC_H_
|
||||
#define MISC_H_
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
|
||||
#ifdef HW_SCREEN_RESIZE
|
||||
extern SDL_Surface *hw_screen;
|
||||
#endif //HW_SCREEN_RESIZE
|
||||
|
||||
#ifdef SOUND_SDL_ACTIVATED
|
||||
extern bool audio_init_ok;
|
||||
#endif //SOUND_SDL_ACTIVATED
|
||||
|
||||
|
||||
// Print an error message on stderr and exit
|
||||
extern void error(const char *s, ...);
|
||||
|
||||
// Load an image, raise an error in case of failure
|
||||
extern SDL_Surface *load_image(const char *filename);
|
||||
|
||||
// Copy surface with Nearest neighboor scaling
|
||||
void flip_NNOptimized_AllowOutOfScreen(SDL_Surface *virtual_screen, SDL_Surface *hardware_screen, int new_w, int new_h);
|
||||
|
||||
#endif /* MISC_H_ */
|
||||
37
include/monsters.h
Normal file
37
include/monsters.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef MONSTERS_H_
|
||||
#define MONSTERS_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "../include/constant.h"
|
||||
|
||||
typedef struct s_monster * t_monster;
|
||||
|
||||
// Creates a new monster
|
||||
extern t_monster monster_init(t_monster list_monsters, int x, int y, int portee_monstre);
|
||||
extern void monster_free(t_monster monster);
|
||||
|
||||
|
||||
// Returns the current position of the monster
|
||||
extern int monster_get_x(t_monster monster);
|
||||
extern int monster_get_y(t_monster monster);
|
||||
|
||||
//management of the following monster
|
||||
extern t_monster get_next_monster(t_monster monster);
|
||||
void set_next_monster(t_monster monster, t_monster nxt_monster);
|
||||
|
||||
|
||||
extern int monster_portee(t_monster monster);
|
||||
|
||||
// Set the direction of the next move of the monster
|
||||
enum e_way monster_get_current_way(t_monster monster);
|
||||
extern void monster_set_current_way(t_monster monster, enum e_way way);
|
||||
|
||||
// Move the monster according to the current direction
|
||||
extern int monster_move(t_monster monster, t_map map, t_player player, t_player player2, int nb_joueur);
|
||||
// Display the monster on the screen
|
||||
extern void monster_display(t_monster monster, SDL_Surface *screen);
|
||||
|
||||
#endif /* MONSTERS_H_ */
|
||||
14
include/niveau.h
Normal file
14
include/niveau.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef NIVEAU_H_
|
||||
#define NIVEAU_H_
|
||||
|
||||
|
||||
|
||||
extern int niveau_1_joueur(SDL_Surface *screen, int niveau);
|
||||
extern int niveau_2_joueur(SDL_Surface *screen, int choix_niveau);
|
||||
extern int editeur_choix_niveau(SDL_Surface *screen);
|
||||
extern int are_you_sure(SDL_Surface *screen);
|
||||
int choix_nb_joueurs(SDL_Surface *screen);
|
||||
int options(SDL_Surface *screen);
|
||||
|
||||
|
||||
#endif /* NIVEAU_H_ */
|
||||
63
include/player.h
Normal file
63
include/player.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef PLAYER_H_
|
||||
#define PLAYER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "../include/constant.h"
|
||||
|
||||
enum e_way {
|
||||
UP = 0, DOWN, LEFT, RIGHT
|
||||
};
|
||||
|
||||
enum e_player {
|
||||
PLAYER_STD, PLAYER_MONSTER
|
||||
};
|
||||
|
||||
typedef struct s_player * t_player;
|
||||
|
||||
// Creates a new player with a given number of available bombs
|
||||
extern t_player player_init(int nb_bomb, int portee_bomb, int lives, int no_joueur);
|
||||
extern void player_free(t_player player);
|
||||
|
||||
// Returns the current position of the player
|
||||
extern int player_get_x(t_player player);
|
||||
extern int player_get_y(t_player player);
|
||||
|
||||
// Confirm if the player has won the game
|
||||
extern int player_win(t_player player);
|
||||
|
||||
// Return the caracteristics of the player
|
||||
extern int player_portee_bomb(t_player player);
|
||||
|
||||
//manage the lives of the player
|
||||
extern int player_get_lives(t_player player);
|
||||
extern void player_increase_lives(t_player player);
|
||||
extern void player_decrease_lives(t_player player);
|
||||
extern void player_die(t_player player);
|
||||
extern int player_get_dead(t_player player);
|
||||
// Set the direction of the next move of the player
|
||||
extern void player_set_current_way(t_player player, enum e_way way);
|
||||
|
||||
// Load the player position from the map
|
||||
extern int player_from_map(t_player player, t_map map);
|
||||
extern void player2_from_map(t_player player, t_map map);
|
||||
|
||||
// Move the player according to the current direction
|
||||
extern int player_move(t_player player, t_map map);
|
||||
|
||||
//Manage the number of bombs available
|
||||
extern int player_get_nb_bomb(t_player player);
|
||||
extern int player_get_nb_bomb_max(t_player player);
|
||||
extern void player_set_nb_bomb(t_player player, int bomb_number);
|
||||
extern void player_increase_nb_bomb(t_player player);
|
||||
extern void player_decrease_nb_bomb(t_player player);
|
||||
extern void player_increase_nb_bomb_max(t_player player);
|
||||
extern void player_decrease_nb_bomb_max(t_player player);
|
||||
|
||||
|
||||
// Display the player on the screen
|
||||
extern void player_display(t_player player, SDL_Surface *screen);
|
||||
|
||||
#endif /* PLAYER_H_ */
|
||||
Reference in New Issue
Block a user