orton_runner/include/game/core.h

144 lines
3.2 KiB
C

/*
** EPITECH PROJECT, 2018
** task01
** File description:
** I do task
*/
#ifndef __CORE_H__
# define __CORE_H__
#define sgn(x) (x < 0 ? -1 : 1)
#define SCREEN_WIDTH 1920
#define SCREEN_HEIGHT 1080
#define MAP_WIDTH_MIN (SCREEN_WIDTH >> 6) + 1
#define MAP_HEIGHT_MIN (SCREEN_HEIGHT >> 6) + 1
#define BLOCK_LOAD_X (SCREEN_WIDTH >> 6)
#define BLOCK_LOAD_Y (SCREEN_HEIGHT >> 6) + 1
#ifndef CAMERA_SPEED
# define CAMERA_SPEED 32
#endif
#ifndef CAMERA_SHAKY
# define CAMERA_SHAKY 15
#endif
#ifndef NB_OBJECT
# define NB_OBJECT 32
#endif
#ifndef THROWER_STONE_SLEEP
# define THROWER_STONE_SLEEP 35
#endif
#ifndef THROWER_BULLET_SLEEP
# define THROWER_BULLET_SLEEP 100
#endif
#ifndef THROWER_DX_SLEEP
# define THROWER_DX_SLEEP 10
#endif
#ifndef BULLET_SPEED
# define BULLET_SPEED 32
#endif
#define BULLET_STOP 0xffff
#define PLAYER_IDLE 0x01
#define PLAYER_RUN 0x02
#define PLAYER_JUMP 0x04
#define PLAYER_WALL 0x08
#define PLAYER_LEFT 0x80
#define PLAYER_DEAD 0x40
#define PLAYER_WIN 0x20
#define PLAYER_CANT_JUMP 0x10
#define PLAYER_FALL_MAX 64
#ifndef PLAYER_SPEED
# define PLAYER_SPEED 6
#endif
#define PLAYER_DEAD_TIME 10
#ifndef PLAYER_MAX_JUMP
# define PLAYER_MAX_JUMP 7
#endif
#define ID_PLAYER 'A'
#define ID_PRINCESS 'B'
#define ID_FAKE_PRINCESS 'C'
#define ID_GROUND '1'
#define ID_FAKE_GROUND '2'
#define ID_PIK_DOWN '3'
#define ID_PIK_UP ID_PIK_DOWN + 1
#define ID_PIK_LEFT ID_PIK_DOWN + 2
#define ID_PIK_RIGHT ID_PIK_DOWN + 3
#define ID_THROWER_STONE 'V'
#define ID_THROWER_UP ID_THROWER_STONE + 1
#define ID_THROWER_DOWN ID_THROWER_STONE + 2
#define ID_THROWER_LEFT ID_THROWER_STONE + 3
#define ID_THROWER_RIGHT ID_THROWER_STONE + 4
#define WALL_SIZE 128
#ifndef WALL_SPEED
# define WALL_SPEED 5
#endif
#define KEY_LSHIFT 0x00000001
#define KEY_RSHIFT 0x00000002
#define KEY_RIGHT 0x00000004
#define KEY_LEFT 0x00000008
#define KEY_UP 0x00000010
#define KEY_SPACE 0x00000020
#define KEY_A 0x00000040
#define KEY_ESC 0x00000080
#define KEY_DOWN 0x00000100
#define KEY_ENTER 0x00000200
#define PRES_LSHIFT 0x00010000
#define PRES_RSHIFT 0x00020000
#define PRES_RIGHT 0x00040000
#define PRES_LEFT 0x00080000
#define PRES_UP 0x00100000
#define PRES_SPACE 0x00200000
#define PRES_A 0x00400000
#define PRES_ESC 0x00800000
#define PRES_DOWN 0x01000000
#define PRES_ENTER 0x02000000
#define NB_MESSAGE 20
#define MESSAGE_GAME 0
#define MESSAGE_INTRO 1
#define MESSAGE_X_TRIGGER 0x01
#define MESSAGE_BEGIN 0x02
#define MESSAGE_DEAD 0x04
#define MESSAGE_FAKE_GROUND 0x08
#define MESSAGE_FAKE_PRINCESS 0x10
#define MESSAGE_X_PRINCESS 0x20
#ifndef MESSAGE_DEFAULT_TIME
# define MESSAGE_DEFAULT_TIME 200
#endif
#define FADE_SPEED 8
#define FADE_CLOSE 0x00
#define FADE_OPEN 0x01
#define BMP_WIDTH 16
#define BMP_HEIGHT 56
#define BMP_SPEED 4
#define SOUND_ON 0x01
#define SCENE_LOAD_PLAYER 0x01
#define SCENE_LOAD_THROWER 0x02
#define SCENE_LOAD_MESSAGE_INTRO 0x04
#define SCENE_LOAD_MESSAGE_GAME 0x08
#define SCENE_LOAD_WALL 0x10
#define SCENE_LOAD_ALL_GAME (SCENE_LOAD_PLAYER | SCENE_LOAD_THROWER | \
SCENE_LOAD_WALL | SCENE_LOAD_MESSAGE_GAME)
#define NOT_SAVE_WINDOW 0
#define SAVE_WINDOW 1
#include "lib/s_sfml.h"
void map_rendering(sfml_t *sfml);
void set_exit(sfml_t *sfml);
void get_key(sfml_t *sfml);
#endif