diff --git a/source/const.h b/source/const.h index ee544dd..afa119e 100644 --- a/source/const.h +++ b/source/const.h @@ -1,8 +1,7 @@ #pragma once -#include "ifdefs.h" -#include "utils.h" -#include "lang.h" +#include #include +#include "utils.h" #ifndef CONST_H #define CONST_H @@ -11,76 +10,18 @@ #define WINDOW_CAPTION "Pepe el Cazavampiros" #define TEXT_COPYRIGHT "@2021 JailDesigner (v0.1)" -// Recursos -#define BINFILE_SCORE 0 -#define BINFILE_DEMO 1 -#define BINFILE_CONFIG 2 - -#define TOTAL_BINFILE 3 - -#define MUSIC_INTRO 0 -#define MUSIC_PLAYING 1 -#define MUSIC_TITLE 2 - -#define TOTAL_MUSIC 3 - -#define SOUND_BALLOON 0 -#define SOUND_BUBBLE1 1 -#define SOUND_BUBBLE2 2 -#define SOUND_BUBBLE3 3 -#define SOUND_BUBBLE4 4 -#define SOUND_BULLET 5 -#define SOUND_COFFEE_OUT 6 -#define SOUND_HISCORE 7 -#define SOUND_ITEM_DROP 8 -#define SOUND_ITEM_PICKUP 9 -#define SOUND_MENU_CANCEL 10 -#define SOUND_MENU_MOVE 11 -#define SOUND_MENU_SELECT 12 -#define SOUND_PLAYER_COLLISION 13 -#define SOUND_STAGE_CHANGE 14 -#define SOUND_TITLE 15 -#define SOUND_CLOCK 16 -#define SOUND_POWERBALL 17 - -#define TOTAL_SOUND 18 - -#define TEXTURE_BALLOON 0 -#define TEXTURE_BULLET 1 -#define TEXTURE_FONT_BLACK 2 -#define TEXTURE_FONT_BLACK_X2 3 -#define TEXTURE_FONT_NOKIA 4 -#define TEXTURE_FONT_WHITE 5 -#define TEXTURE_FONT_WHITE_X2 6 -#define TEXTURE_GAME_BG 7 -#define TEXTURE_GAME_TEXT 8 -#define TEXTURE_INTRO 9 -#define TEXTURE_ITEMS 10 -#define TEXTURE_LOGO 11 -#define TEXTURE_MENU 12 -#define TEXTURE_PLAYER_BODY 13 -#define TEXTURE_PLAYER_DEATH 14 -#define TEXTURE_PLAYER_LEGS 15 -#define TEXTURE_TITLE 16 - -#define TOTAL_TEXTURE 17 - // Tamaño de bloque #define BLOCK 8 -#define HALF_BLOCK BLOCK / 2 +#define HALF_BLOCK 4 // Tamaño de la pantalla real #define SCREEN_WIDTH 256 -const int SCREEN_HEIGHT = SCREEN_WIDTH * 3 / 4; +#define SCREEN_HEIGHT 192 // Tamaño de la pantalla que se muestra const int VIEW_WIDTH = SCREEN_WIDTH * 3; const int VIEW_HEIGHT = SCREEN_HEIGHT * 3; -// Cantidad de enteros a escribir en los ficheros de datos -#define TOTAL_SCORE_DATA 3 -#define TOTAL_DEMO_DATA 2000 - // Zona de juego const int PLAY_AREA_TOP = (0 * BLOCK); const int PLAY_AREA_BOTTOM = SCREEN_HEIGHT - (4 * BLOCK); @@ -103,48 +44,6 @@ const int SCREEN_CENTER_Y = SCREEN_HEIGHT / 2; const int SCREEN_FIRST_QUARTER_Y = SCREEN_HEIGHT / 4; const int SCREEN_THIRD_QUARTER_Y = (SCREEN_HEIGHT / 4) * 3; -// Opciones de menu -#define MENU_NO_OPTION -1 -#define MENU_OPTION_START 0 -#define MENU_OPTION_QUIT 1 -#define MENU_OPTION_TOTAL 2 - -// Tipos de fondos para el menu -#define MENU_BACKGROUND_TRANSPARENT 0 -#define MENU_BACKGROUND_SOLID 1 - -// Estados del jugador -#define PLAYER_STATUS_WALKING_LEFT 0 -#define PLAYER_STATUS_WALKING_RIGHT 1 -#define PLAYER_STATUS_WALKING_STOP 2 - -#define PLAYER_STATUS_FIRING_UP 0 -#define PLAYER_STATUS_FIRING_LEFT 1 -#define PLAYER_STATUS_FIRING_RIGHT 2 -#define PLAYER_STATUS_FIRING_NO 3 - -#define PLAYER_ANIMATION_LEGS_WALKING_LEFT 0 -#define PLAYER_ANIMATION_LEGS_WALKING_RIGHT 1 -#define PLAYER_ANIMATION_LEGS_WALKING_STOP 2 - -#define PLAYER_ANIMATION_BODY_WALKING_LEFT 0 -#define PLAYER_ANIMATION_BODY_FIRING_LEFT 1 -#define PLAYER_ANIMATION_BODY_WALKING_RIGHT 2 -#define PLAYER_ANIMATION_BODY_FIRING_RIGHT 3 -#define PLAYER_ANIMATION_BODY_WALKING_STOP 4 -#define PLAYER_ANIMATION_BODY_FIRING_UP 5 - -#define PLAYER_ANIMATION_HEAD_WALKING_LEFT 0 -#define PLAYER_ANIMATION_HEAD_FIRING_LEFT 1 -#define PLAYER_ANIMATION_HEAD_WALKING_RIGHT 2 -#define PLAYER_ANIMATION_HEAD_FIRING_RIGHT 3 -#define PLAYER_ANIMATION_HEAD_WALKING_STOP 4 -#define PLAYER_ANIMATION_HEAD_FIRING_UP 5 - -// Variables del jugador -#define PLAYER_INVULNERABLE_COUNTER 200 -#define PLAYER_POWERUP_COUNTER 1500 - // Secciones del programa #define PROG_SECTION_LOGO 0 #define PROG_SECTION_INTRO 1 @@ -162,149 +61,11 @@ const int SCREEN_THIRD_QUARTER_Y = (SCREEN_HEIGHT / 4) * 3; #define TITLE_SECTION_3 5 #define TITLE_SECTION_INSTRUCTIONS 6 -// Modo para las instrucciones -#define INSTRUCTIONS_MODE_MANUAL 0 -#define INSTRUCTIONS_MODE_AUTO 1 - // Estados de cada elemento que pertenece a un evento #define EVENT_WAITING 1 #define EVENT_RUNNING 2 #define EVENT_COMPLETED 3 -// Cantidad de eventos de la intro -#define INTRO_TOTAL_BITMAPS 6 -#define INTRO_TOTAL_TEXTS 9 -const int INTRO_TOTAL_EVENTS = INTRO_TOTAL_BITMAPS + INTRO_TOTAL_TEXTS; - -// Cantidad de eventos de la pantalla de titulo -#define TITLE_TOTAL_EVENTS 2 - -// Relaciones de Id con nomnbres -#define BITMAP0 0 -#define BITMAP1 1 -#define BITMAP2 2 -#define BITMAP3 3 -#define BITMAP4 4 -#define BITMAP5 5 -#define TEXT0 6 -#define TEXT1 7 -#define TEXT2 8 -#define TEXT3 9 -#define TEXT4 10 -#define TEXT5 11 -#define TEXT6 12 -#define TEXT7 13 -#define TEXT8 14 - -// Anclajes para el marcador de puntos -const int SCORE_WORD_X = (SCREEN_WIDTH / 4) - ((5 * BLOCK) / 2); -const int SCORE_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2; -const int SCORE_NUMBER_X = (SCREEN_WIDTH / 4) - ((6 * BLOCK) / 2); -const int SCORE_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2; - -const int HISCORE_WORD_X = ((SCREEN_WIDTH / 4) * 3) - ((8 * BLOCK) / 2); -const int HISCORE_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2; -const int HISCORE_NUMBER_X = ((SCREEN_WIDTH / 4) * 3) - ((6 * BLOCK) / 2); -const int HISCORE_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2; - -const int MULTIPLIER_WORD_X = (SCREEN_WIDTH / 2) - ((4 * BLOCK) / 2); -const int MULTIPLIER_WORD_Y = SCREEN_HEIGHT - (3 * BLOCK) + 2; -const int MULTIPLIER_NUMBER_X = (SCREEN_WIDTH / 2) - ((3 * BLOCK) / 2); -const int MULTIPLIER_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2; - -// Ningun tipo -#define NO_KIND 0 - -// Tipos de globo -#define BALLOON_1 1 -#define BALLOON_2 2 -#define BALLOON_3 3 -#define BALLOON_4 4 -#define HEXAGON_1 5 -#define HEXAGON_2 6 -#define HEXAGON_3 7 -#define HEXAGON_4 8 -#define POWER_BALL 9 - -// Puntos de globo -#define BALLOON_SCORE_1 50 -#define BALLOON_SCORE_2 100 -#define BALLOON_SCORE_3 200 -#define BALLOON_SCORE_4 400 - -// Tamaños de globo -#define BALLOON_SIZE_1 1 -#define BALLOON_SIZE_2 2 -#define BALLOON_SIZE_3 3 -#define BALLOON_SIZE_4 4 - -// Clases de globo -#define BALLOON_CLASS 0 -#define HEXAGON_CLASS 1 - -// Velocidad del globo -#define BALLOON_VELX_POSITIVE 0.7f -#define BALLOON_VELX_NEGATIVE -0.7f - -// Indice para las animaciones de los globos -#define BALLOON_MOVING_ANIMATION 0 -#define BALLOON_POP_ANIMATION 1 -#define BALLOON_BORN_ANIMATION 2 - -// Cantidad posible de globos -#define MAX_BALLOONS 100 - -// Velocidades a las que se mueven los enemigos -#define BALLOON_SPEED_1 0.60f -#define BALLOON_SPEED_2 0.70f -#define BALLOON_SPEED_3 0.80f -#define BALLOON_SPEED_4 0.90f -#define BALLOON_SPEED_5 1.00f - -// Tamaño de los globos -#define BALLOON_WIDTH_1 8 -#define BALLOON_WIDTH_2 13 -#define BALLOON_WIDTH_3 21 -#define BALLOON_WIDTH_4 37 - -// PowerBall -#define POWERBALL_SCREENPOWER_MINIMUM 10 -#define POWERBALL_COUNTER 8 - -// Tipos de bala -#define BULLET_UP 1 -#define BULLET_LEFT 2 -#define BULLET_RIGHT 3 - -// Cantidad posible de globos -#define MAX_BULLETS 50 - -// Tipos de objetos -#define ITEM_POINTS_1_DISK 1 -#define ITEM_POINTS_2_GAVINA 2 -#define ITEM_POINTS_3_PACMAR 3 -#define ITEM_CLOCK 4 -#define ITEM_COFFEE 5 -#define ITEM_POWER_BALL 6 -#define ITEM_COFFEE_MACHINE 7 - -// Porcentaje de aparición de los objetos -#define ITEM_POINTS_1_DISK_ODDS 10 -#define ITEM_POINTS_2_GAVINA_ODDS 6 -#define ITEM_POINTS_3_PACMAR_ODDS 3 -#define ITEM_CLOCK_ODDS 5 -#define ITEM_COFFEE_ODDS 5 -#define ITEM_POWER_BALL_ODDS 0 -#define ITEM_COFFEE_MACHINE_ODDS 4 - -// Cantidad de objetos simultaneos -#define MAX_ITEMS 10 - -// Valores para las variables asociadas a los objetos -#define REMAINING_EXPLOSIONS 3 -#define REMAINING_EXPLOSIONS_COUNTER 50 -#define TIME_STOPPED_COUNTER 300 - // Estados de entrada #define NO_INPUT 0 #define INPUT_FIRE_LEFT 7 @@ -315,42 +76,11 @@ const int MULTIPLIER_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2; // Zona muerta del mando analógico #define JOYSTICK_DEAD_ZONE 8000 -// Tipos de mensajes para el retorno de las funciones -#define MSG_OK 0 -#define MSG_BULLET_OUT 1 - -// Tipos de texto -#define TEXT_FIXED 0 -#define TEXT_VARIABLE 1 - -// Cantidad de elementos del vector de SmartSprites -#define MAX_SMART_SPRITES 10 - -// Cantidad máxima de gotas de café -#define MAX_COFFEE_DROPS 100 - -// Contadores -#define TITLE_COUNTER 800 -#define STAGE_COUNTER 200 -#define INSTRUCTIONS_COUNTER 600 -#define DEATH_COUNTER 350 -#define SHAKE_COUNTER 10 -#define HELP_COUNTER 1000 - // Colores const color_t bgColor = {0x27, 0x27, 0x36}; const color_t noColor = {0xFF, 0xFF, 0xFF}; const color_t shdwTxtColor = {0x43, 0x43, 0x4F}; -// Formaciones enemigas -#define NUMBER_OF_ENEMY_FORMATIONS 100 -#define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50 - -// Dificultad del juego -#define DIFFICULTY_EASY 0 -#define DIFFICULTY_NORMAL 1 -#define DIFFICULTY_HARD 2 - // Tipo de filtro #define FILTER_NEAREST 0 #define FILTER_LINEAL 1 diff --git a/source/director.h b/source/director.h index 98d1d93..b9ba25b 100644 --- a/source/director.h +++ b/source/director.h @@ -12,6 +12,7 @@ #include "input.h" #include "fade.h" #include "game.h" +#include "lang.h" #ifndef DIRECTOR_H #define DIRECTOR_H diff --git a/source/game.h b/source/game.h index 04370fa..752d0b7 100644 --- a/source/game.h +++ b/source/game.h @@ -12,6 +12,7 @@ #include "menu.h" #include "input.h" #include "fade.h" +#include "lang.h" #include "jail_audio.h" #ifndef GAME_H diff --git a/source/ifdefs.h b/source/ifdefs.h index b4a37c1..5e4d9ee 100644 --- a/source/ifdefs.h +++ b/source/ifdefs.h @@ -1,3 +1,5 @@ +#include + #ifdef __APPLE__ #include "/Library/Frameworks/SDL2.framework/Versions/A/Headers/SDL.h" #endif diff --git a/source/menu.h b/source/menu.h index 6843919..dc3effa 100644 --- a/source/menu.h +++ b/source/menu.h @@ -10,6 +10,11 @@ #define MENU_MAX_ITEMS 50 +#define MENU_NO_OPTION -1 + +#define MENU_BACKGROUND_TRANSPARENT 0 +#define MENU_BACKGROUND_SOLID 1 + // Clase menu class Menu { diff --git a/source/utils.h b/source/utils.h index 6d25712..9046dc5 100644 --- a/source/utils.h +++ b/source/utils.h @@ -6,6 +6,10 @@ #ifndef UTILS_H #define UTILS_H +#define DIFFICULTY_EASY 0 +#define DIFFICULTY_NORMAL 1 +#define DIFFICULTY_HARD 2 + // Estructura para definir un circulo struct circle_t {