Eliminat "const.h"
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "balloon.h"
|
||||
#include "const.h"
|
||||
#include "param.h"
|
||||
|
||||
// Constructor
|
||||
@@ -281,9 +280,9 @@ void Balloon::allignTo(int x)
|
||||
{
|
||||
posX = float(x - (width / 2));
|
||||
|
||||
if (posX < PLAY_AREA_LEFT)
|
||||
if (posX < param.game.playArea.rect.x)
|
||||
{
|
||||
posX = PLAY_AREA_LEFT + 1;
|
||||
posX = param.game.playArea.rect.x + 1;
|
||||
}
|
||||
else if ((posX + width) > param.game.playArea.rect.w)
|
||||
{
|
||||
@@ -347,7 +346,7 @@ void Balloon::move()
|
||||
posX += (velX * speed);
|
||||
|
||||
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
||||
if ((posX < PLAY_AREA_LEFT) || (posX + width > param.game.playArea.rect.w))
|
||||
if ((posX < param.game.playArea.rect.x) || (posX + width > param.game.playArea.rect.w))
|
||||
{
|
||||
// Corrige posición
|
||||
posX -= (velX * speed);
|
||||
@@ -369,10 +368,10 @@ void Balloon::move()
|
||||
posY += (velY * speed);
|
||||
|
||||
// Si se sale por arriba
|
||||
if (posY < PLAY_AREA_TOP)
|
||||
if (posY < param.game.playArea.rect.y)
|
||||
{
|
||||
// Corrige
|
||||
posY = PLAY_AREA_TOP;
|
||||
posY = param.game.playArea.rect.y;
|
||||
|
||||
// Invierte sentido
|
||||
velY = -velY;
|
||||
@@ -508,7 +507,7 @@ void Balloon::updateState()
|
||||
posX += velX;
|
||||
|
||||
// Comprueba no se salga por los laterales
|
||||
if ((posX < PLAY_AREA_LEFT) || (posX > (param.game.playArea.rect.w - width)))
|
||||
if ((posX < param.game.playArea.rect.x) || (posX > (param.game.playArea.rect.w - width)))
|
||||
{
|
||||
// Corrige y cambia el sentido de la velocidad
|
||||
posX -= velX;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "const.h"
|
||||
#include "bullet.h"
|
||||
#include "param.h"
|
||||
|
||||
// Constructor
|
||||
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture)
|
||||
@@ -108,10 +108,10 @@ Uint8 Bullet::move()
|
||||
posX += velX;
|
||||
|
||||
// Si el objeto se sale del area de juego por los laterales
|
||||
if ((posX < PLAY_AREA_LEFT - width) || (posX > playArea->w))
|
||||
if ((posX < param.game.playArea.rect.x - width) || (posX > playArea->w))
|
||||
{
|
||||
// Se deshabilita
|
||||
kind = NO_KIND;
|
||||
kind = BULLET_NULL;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = BULLET_MOVE_OUT;
|
||||
@@ -121,10 +121,10 @@ Uint8 Bullet::move()
|
||||
posY += int(velY);
|
||||
|
||||
// Si el objeto se sale del area de juego por la parte superior
|
||||
if (posY < PLAY_AREA_TOP - height)
|
||||
if (posY < param.game.playArea.rect.y - height)
|
||||
{
|
||||
// Se deshabilita
|
||||
kind = NO_KIND;
|
||||
kind = BULLET_NULL;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = BULLET_MOVE_OUT;
|
||||
@@ -143,7 +143,7 @@ Uint8 Bullet::move()
|
||||
// Comprueba si el objeto está habilitado
|
||||
bool Bullet::isEnabled()
|
||||
{
|
||||
if (kind == NO_KIND)
|
||||
if (kind == BULLET_NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ bool Bullet::isEnabled()
|
||||
// Deshabilita el objeto
|
||||
void Bullet::disable()
|
||||
{
|
||||
kind = NO_KIND;
|
||||
kind = BULLET_NULL;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define BULLET_UP 1
|
||||
#define BULLET_LEFT 2
|
||||
#define BULLET_RIGHT 3
|
||||
#define BULLET_NULL 4
|
||||
|
||||
// Tipos de retorno de la funcion move de la bala
|
||||
#define BULLET_MOVE_OK 0
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
|
||||
// Tamaño de bloque
|
||||
#define BLOCK 8
|
||||
|
||||
// Para mejor visibilidad
|
||||
#define PLAY_AREA_LEFT 0
|
||||
#define PLAY_AREA_TOP 0
|
||||
|
||||
|
||||
|
||||
// Ningun tipo
|
||||
#define NO_KIND 0
|
||||
|
||||
// Colores
|
||||
const color_t bgColor = {0x27, 0x27, 0x36};
|
||||
const color_t noColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
|
||||
const color_t separatorColor = {0x0D, 0x1A, 0x2B};
|
||||
const color_t scoreboardColor = {0x2E, 0x3F, 0x47};
|
||||
const color_t difficultyEasyColor = {0x4B, 0x69, 0x2F};
|
||||
const color_t difficultyNormalColor = {0xFF, 0x7A, 0x00};
|
||||
const color_t difficultyHardColor = {0x76, 0x42, 0x8A};
|
||||
const color_t flashColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t fadeColor = {0x27, 0x27, 0x36};
|
||||
const color_t orangeColor = {0xFF, 0x7A, 0x00};
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include "input.h"
|
||||
#include "text.h"
|
||||
#include "const.h"
|
||||
#include "lang.h"
|
||||
|
||||
struct db_button_t
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "director.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "options.h"
|
||||
#include "section.h"
|
||||
#include <iostream>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "screen.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "fade.h"
|
||||
#include "game.h"
|
||||
#include "intro.h"
|
||||
|
||||
@@ -18,19 +18,19 @@ EnemyFormations::~EnemyFormations()
|
||||
void EnemyFormations::initEnemyFormations()
|
||||
{
|
||||
const int y4 = - BLOCK;
|
||||
const int x4_0 = PLAY_AREA_LEFT;
|
||||
const int x4_0 = param.game.playArea.rect.x;
|
||||
const int x4_100 = param.game.playArea.rect.w - BALLOON_WIDTH_4;
|
||||
|
||||
const int y3 = - BLOCK;
|
||||
const int x3_0 = PLAY_AREA_LEFT;
|
||||
const int x3_0 = param.game.playArea.rect.x;
|
||||
const int x3_100 = param.game.playArea.rect.w - BALLOON_WIDTH_3;
|
||||
|
||||
const int y2 = - BLOCK;
|
||||
const int x2_0 = PLAY_AREA_LEFT;
|
||||
const int x2_0 = param.game.playArea.rect.x;
|
||||
const int x2_100 = param.game.playArea.rect.w - BALLOON_WIDTH_2;
|
||||
|
||||
const int y1 = - BLOCK;
|
||||
const int x1_0 = PLAY_AREA_LEFT;
|
||||
const int x1_0 = param.game.playArea.rect.x;
|
||||
const int x1_50 = param.game.playArea.centerX - (BALLOON_WIDTH_1 / 2);
|
||||
const int x1_100 = param.game.playArea.rect.w - BALLOON_WIDTH_1;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "balloon.h"
|
||||
|
||||
#define NUMBER_OF_ENEMY_FORMATIONS 100
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "fade.h"
|
||||
#include "const.h"
|
||||
#include "param.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -985,7 +985,7 @@ void Game::createPowerBall()
|
||||
const int values = 6;
|
||||
const int posY = -BLOCK;
|
||||
|
||||
const int left = PLAY_AREA_LEFT;
|
||||
const int left = param.game.playArea.rect.x;
|
||||
const int center = param.game.playArea.centerX - (BALLOON_WIDTH_4 / 2);
|
||||
const int right = param.game.playArea.rect.w - BALLOON_WIDTH_4;
|
||||
|
||||
@@ -1416,7 +1416,7 @@ void Game::checkBulletBalloonCollision()
|
||||
|
||||
// Suelta el item si se da el caso
|
||||
const int droppeditem = dropItem();
|
||||
if ((droppeditem != NO_KIND) && !(demo.recording))
|
||||
if ((droppeditem != ITEM_NULL) && !(demo.recording))
|
||||
{
|
||||
if (droppeditem != ITEM_COFFEE_MACHINE)
|
||||
{
|
||||
@@ -1596,7 +1596,7 @@ int Game::dropItem()
|
||||
break;
|
||||
}
|
||||
|
||||
return NO_KIND;
|
||||
return ITEM_NULL;
|
||||
}
|
||||
|
||||
// Crea un objeto item
|
||||
@@ -2460,7 +2460,7 @@ void Game::initPaths()
|
||||
// Letrero de GetReady
|
||||
const int size = textNokiaBig2->lenght(lang::getText(75), -2);
|
||||
|
||||
const float start1 = PLAY_AREA_LEFT - size;
|
||||
const float start1 = param.game.playArea.rect.x - size;
|
||||
const float finish1 = param.game.playArea.centerX - (size / 2);
|
||||
|
||||
const float start2 = finish1;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "fade.h"
|
||||
#include "item.h"
|
||||
#include "player.h"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "screen.h"
|
||||
#include "smartsprite.h"
|
||||
#include "jail_audio.h"
|
||||
#include "const.h"
|
||||
|
||||
// Clase GameLogo
|
||||
class GameLogo
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "lang.h"
|
||||
#include "fade.h"
|
||||
#include "background.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "lang.h"
|
||||
#include "tiledbg.h"
|
||||
#include "fade.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "smartsprite.h"
|
||||
#include "utils.h"
|
||||
#include "writer.h"
|
||||
#include "const.h"
|
||||
#include "lang.h"
|
||||
#include <vector>
|
||||
#include "section.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "const.h"
|
||||
#include "item.h"
|
||||
#include "param.h"
|
||||
|
||||
// Constructor
|
||||
Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation)
|
||||
@@ -52,9 +52,9 @@ void Item::allignTo(int x)
|
||||
{
|
||||
posX = float(x - (width / 2));
|
||||
|
||||
if (posX < PLAY_AREA_LEFT)
|
||||
if (posX < param.game.playArea.rect.x)
|
||||
{
|
||||
posX = PLAY_AREA_LEFT + 1;
|
||||
posX = param.game.playArea.rect.x + 1;
|
||||
}
|
||||
else if ((posX + width) > playArea->w)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ void Item::move()
|
||||
velY += accelY;
|
||||
|
||||
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
||||
if ((posX < PLAY_AREA_LEFT) || (posX + width > playArea->w))
|
||||
if ((posX < param.game.playArea.rect.x) || (posX + width > playArea->w))
|
||||
{
|
||||
// Corregir posición
|
||||
posX -= velX;
|
||||
@@ -109,10 +109,10 @@ void Item::move()
|
||||
}
|
||||
|
||||
// Si se sale por arriba rebota (excepto la maquina de café)
|
||||
if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE))
|
||||
if ((posY < param.game.playArea.rect.y) && !(kind == ITEM_COFFEE_MACHINE))
|
||||
{
|
||||
// Corrige
|
||||
posY = PLAY_AREA_TOP;
|
||||
posY = param.game.playArea.rect.y;
|
||||
|
||||
// Invierte el sentido
|
||||
velY = -velY;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define ITEM_CLOCK 4
|
||||
#define ITEM_COFFEE 5
|
||||
#define ITEM_COFFEE_MACHINE 6
|
||||
#define ITEM_NULL 7
|
||||
|
||||
// Clase Item
|
||||
class Item
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <vector>
|
||||
#include "asset.h"
|
||||
#include "const.h"
|
||||
#include "input.h"
|
||||
#include "jail_audio.h"
|
||||
#include "lang.h"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
|
||||
// Variables
|
||||
extern options_t options;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
|
||||
extern param_t param;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "const.h"
|
||||
#include "player.h"
|
||||
#include "param.h"
|
||||
|
||||
// Constructor
|
||||
Player::Player(int id, float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations)
|
||||
@@ -114,7 +114,7 @@ void Player::move()
|
||||
posX += velX;
|
||||
|
||||
// Si el jugador abandona el area de juego por los laterales
|
||||
if ((posX < PLAY_AREA_LEFT - 5) || (posX + width > playArea->w + 5))
|
||||
if ((posX < param.game.playArea.rect.x - 5) || (posX + width > playArea->w + 5))
|
||||
{
|
||||
// Restaura su posición
|
||||
posX -= velX;
|
||||
@@ -131,7 +131,7 @@ void Player::move()
|
||||
playerSprite->update();
|
||||
|
||||
// Si el cadaver abandona el area de juego por los laterales
|
||||
if ((playerSprite->getPosX() < PLAY_AREA_LEFT) || (playerSprite->getPosX() + width > playArea->w))
|
||||
if ((playerSprite->getPosX() < param.game.playArea.rect.x) || (playerSprite->getPosX() + width > playArea->w))
|
||||
{
|
||||
// Restaura su posición
|
||||
const float vx = playerSprite->getVelX();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "lang.h"
|
||||
|
||||
// Defines
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "utils.h"
|
||||
#include "notify.h"
|
||||
#include "input.h"
|
||||
#include "const.h"
|
||||
#include <vector>
|
||||
|
||||
#define SCREEN_FILTER_NEAREST 0
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "asset.h"
|
||||
#include "screen.h"
|
||||
#include "sprite.h"
|
||||
#include "const.h"
|
||||
|
||||
// Modos de funcionamiento para el tileado de fondo
|
||||
#define TILED_MODE_CIRCLE 0
|
||||
|
||||
@@ -2,25 +2,24 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "asset.h"
|
||||
#include "define_buttons.h"
|
||||
#include "fade.h"
|
||||
#include "game.h"
|
||||
#include "game_logo.h"
|
||||
#include "hiscore_table.h"
|
||||
#include "input.h"
|
||||
#include "instructions.h"
|
||||
#include "item.h"
|
||||
#include "jail_audio.h"
|
||||
#include "lang.h"
|
||||
#include "movingsprite.h"
|
||||
#include "screen.h"
|
||||
#include "section.h"
|
||||
#include "smartsprite.h"
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "utils.h"
|
||||
#include "const.h"
|
||||
#include "fade.h"
|
||||
#include "game.h"
|
||||
#include "hiscore_table.h"
|
||||
#include "instructions.h"
|
||||
#include "item.h"
|
||||
#include "lang.h"
|
||||
#include "tiledbg.h"
|
||||
#include "game_logo.h"
|
||||
#include "define_buttons.h"
|
||||
#include "section.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Textos
|
||||
#define TEXT_COPYRIGHT "@2020,2024 JailDesigner"
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
#include "utils.h"
|
||||
#include <math.h>
|
||||
|
||||
// Colores
|
||||
const color_t bgColor = {0x27, 0x27, 0x36};
|
||||
const color_t noColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
|
||||
const color_t separatorColor = {0x0D, 0x1A, 0x2B};
|
||||
const color_t scoreboardColor = {0x2E, 0x3F, 0x47};
|
||||
const color_t difficultyEasyColor = {0x4B, 0x69, 0x2F};
|
||||
const color_t difficultyNormalColor = {0xFF, 0x7A, 0x00};
|
||||
const color_t difficultyHardColor = {0x76, 0x42, 0x8A};
|
||||
const color_t flashColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t fadeColor = {0x27, 0x27, 0x36};
|
||||
const color_t orangeColor = {0xFF, 0x7A, 0x00};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "texture.h"
|
||||
#include "jail_audio.h"
|
||||
#include "input.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "input.h"
|
||||
#include "jail_audio.h"
|
||||
|
||||
// Dificultad del juego
|
||||
#define DIFFICULTY_EASY 0
|
||||
#define DIFFICULTY_NORMAL 1
|
||||
#define DIFFICULTY_HARD 2
|
||||
|
||||
// Tamaño de bloque
|
||||
#define BLOCK 8
|
||||
|
||||
// Estructura para definir un circulo
|
||||
struct circle_t
|
||||
{
|
||||
@@ -288,4 +290,17 @@ JA_Music_t *getMusic(std::vector<music_file_t> music, std::string name);
|
||||
hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2);
|
||||
|
||||
// Dibuja un circulo
|
||||
void DrawCircle(SDL_Renderer *renderer, int32_t centerX, int32_t centerY, int32_t radius);
|
||||
void DrawCircle(SDL_Renderer *renderer, int32_t centerX, int32_t centerY, int32_t radius);
|
||||
|
||||
// Colores
|
||||
extern const color_t bgColor;
|
||||
extern const color_t noColor;
|
||||
extern const color_t shdwTxtColor;
|
||||
extern const color_t separatorColor;
|
||||
extern const color_t scoreboardColor;
|
||||
extern const color_t difficultyEasyColor;
|
||||
extern const color_t difficultyNormalColor;
|
||||
extern const color_t difficultyHardColor;
|
||||
extern const color_t flashColor;
|
||||
extern const color_t fadeColor;
|
||||
extern const color_t orangeColor;
|
||||
Reference in New Issue
Block a user