Compare commits
6 Commits
9532caace8
...
2024-12-31
| Author | SHA1 | Date | |
|---|---|---|---|
| 40dfc32e84 | |||
| 4cd1d91560 | |||
| e43badd703 | |||
| 71dcf9cf87 | |||
| 3a8521a1da | |||
| 74d9c9a2b9 |
11
Makefile
11
Makefile
@@ -10,10 +10,11 @@ TARGET_FILE := $(DIR_BIN)$(TARGET_NAME)
|
|||||||
APP_NAME := Coffee Crisis Arcade Edition
|
APP_NAME := Coffee Crisis Arcade Edition
|
||||||
RELEASE_FOLDER := ccae_release
|
RELEASE_FOLDER := ccae_release
|
||||||
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
||||||
VERSION := 2024-12-30
|
RESOURCE_FILE := release/coffee.res
|
||||||
|
VERSION := 2024-12-31
|
||||||
|
|
||||||
# Nombres para los ficheros de lanzamiento
|
# Nombres para los ficheros de lanzamiento
|
||||||
WINDOWS_RELEASE := $(TARGET_FILE)-$(VERSION)-win32-x64.zip
|
WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-win32-x64.zip
|
||||||
MACOS_INTEL_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-intel.dmg
|
MACOS_INTEL_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-intel.dmg
|
||||||
MACOS_APPLE_SILICON_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-apple-silicon.dmg
|
MACOS_APPLE_SILICON_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-apple-silicon.dmg
|
||||||
LINUX_RELEASE := $(TARGET_FILE)-$(VERSION)-linux.tar.gz
|
LINUX_RELEASE := $(TARGET_FILE)-$(VERSION)-linux.tar.gz
|
||||||
@@ -55,7 +56,8 @@ endif
|
|||||||
# Reglas para compilación
|
# Reglas para compilación
|
||||||
windows:
|
windows:
|
||||||
@echo off
|
@echo off
|
||||||
$(CXX) $(SOURCES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE).exe"
|
windres release/coffee.rc -O coff -o $(RESOURCE_FILE)
|
||||||
|
$(CXX) $(SOURCES) $(RESOURCE_FILE) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE).exe"
|
||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE).exe" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(TARGET_FILE).exe" --strip-unneeded
|
||||||
|
|
||||||
windows_rec:
|
windows_rec:
|
||||||
@@ -82,7 +84,8 @@ windows_release:
|
|||||||
powershell Copy-Item "release\*.dll" -Destination "$(RELEASE_FOLDER)"
|
powershell Copy-Item "release\*.dll" -Destination "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
# Compila
|
# Compila
|
||||||
$(CXX) $(SOURCES) $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE).exe"
|
windres release/coffee.rc -O coff -o $(RESOURCE_FILE)
|
||||||
|
$(CXX) $(SOURCES) $(RESOURCE_FILE) $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE).exe"
|
||||||
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE).exe" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE).exe" --strip-unneeded
|
||||||
|
|
||||||
# Crea el fichero .zip
|
# Crea el fichero .zip
|
||||||
|
|||||||
2
release/coffee.rc
Normal file
2
release/coffee.rc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// coffee.rc
|
||||||
|
IDI_ICON1 ICON "icon.ico"
|
||||||
BIN
release/coffee.res
Normal file
BIN
release/coffee.res
Normal file
Binary file not shown.
BIN
release/icon.ico
Normal file
BIN
release/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -54,7 +54,7 @@ Director::Director(int argc, const char *argv[])
|
|||||||
section::name = section::Name::GAME;
|
section::name = section::Name::GAME;
|
||||||
section::options = section::Options::GAME_PLAY_1P;
|
section::options = section::Options::GAME_PLAY_1P;
|
||||||
#elif DEBUG
|
#elif DEBUG
|
||||||
section::name = section::Name::GAME;
|
section::name = section::Name::LOGO;
|
||||||
#else // NORMAL GAME
|
#else // NORMAL GAME
|
||||||
section::name = section::Name::LOGO;
|
section::name = section::Name::LOGO;
|
||||||
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
|
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
|
||||||
|
|||||||
@@ -68,11 +68,9 @@ Game::Game(int player_id, int current_stage, bool demo)
|
|||||||
|
|
||||||
fade_in_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
fade_in_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||||
fade_in_->setPost(0);
|
fade_in_->setPost(0);
|
||||||
fade_in_->setType(FadeType::VENETIAN);
|
fade_in_->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade_in_->setMode(FadeMode::IN);
|
fade_in_->setMode(FadeMode::IN);
|
||||||
fade_in_->activate();
|
fade_in_->activate();
|
||||||
// JA_PlaySound(Resource::get()->getSound("fade_in.wav"));
|
|
||||||
// playMusic();
|
|
||||||
|
|
||||||
fade_out_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
fade_out_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||||
fade_out_->setPost(param.fade.post_duration);
|
fade_out_->setPost(param.fade.post_duration);
|
||||||
@@ -943,15 +941,12 @@ void Game::fillCanvas()
|
|||||||
background_->render();
|
background_->render();
|
||||||
renderItems();
|
renderItems();
|
||||||
renderSmartSprites();
|
renderSmartSprites();
|
||||||
tabe_->render();
|
|
||||||
balloon_manager_->render();
|
balloon_manager_->render();
|
||||||
|
tabe_->render();
|
||||||
renderBullets();
|
renderBullets();
|
||||||
renderPathSprites();
|
renderPathSprites();
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
|
|
||||||
auto sprite = std::make_unique<Sprite>(Resource::get()->getTexture("game_text_game_over"));
|
|
||||||
sprite->render();
|
|
||||||
|
|
||||||
// Deja el renderizador apuntando donde estaba
|
// Deja el renderizador apuntando donde estaba
|
||||||
SDL_SetRenderTarget(renderer_, temp);
|
SDL_SetRenderTarget(renderer_, temp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,6 @@ void Intro::render()
|
|||||||
void Intro::run()
|
void Intro::run()
|
||||||
{
|
{
|
||||||
JA_PlayMusic(Resource::get()->getMusic("intro.ogg"), 0);
|
JA_PlayMusic(Resource::get()->getMusic("intro.ogg"), 0);
|
||||||
|
|
||||||
while (section::name == section::Name::INTRO)
|
while (section::name == section::Name::INTRO)
|
||||||
{
|
{
|
||||||
checkInput();
|
checkInput();
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ JA_Music_t *JA_LoadMusic(Uint8* buffer, Uint32 length)
|
|||||||
free(music->output);
|
free(music->output);
|
||||||
music->output = (short*)cvt.buf;
|
music->output = (short*)cvt.buf;
|
||||||
}
|
}
|
||||||
|
music->length = music->samples * chan * 2;
|
||||||
music->pos = 0;
|
music->pos = 0;
|
||||||
music->state = JA_MUSIC_STOPPED;
|
music->state = JA_MUSIC_STOPPED;
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void Logo::render()
|
|||||||
void Logo::run()
|
void Logo::run()
|
||||||
{
|
{
|
||||||
// Detiene la música
|
// Detiene la música
|
||||||
JA_FadeOutMusic(500);
|
JA_FadeOutMusic(300);
|
||||||
|
|
||||||
while (section::name == section::Name::LOGO)
|
while (section::name == section::Name::LOGO)
|
||||||
{
|
{
|
||||||
|
|||||||
103
source/title.cpp
103
source/title.cpp
@@ -33,7 +33,8 @@ Title::Title()
|
|||||||
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
||||||
mini_logo_sprite_(std::make_unique<Sprite>(Resource::get()->getTexture("logo_jailgames_mini.png"))),
|
mini_logo_sprite_(std::make_unique<Sprite>(Resource::get()->getTexture("logo_jailgames_mini.png"))),
|
||||||
define_buttons_(std::make_unique<DefineButtons>()),
|
define_buttons_(std::make_unique<DefineButtons>()),
|
||||||
num_controllers_(Input::get()->getNumControllers())
|
num_controllers_(Input::get()->getNumControllers()),
|
||||||
|
state_(TitleState::LOGO_ANIMATING)
|
||||||
{
|
{
|
||||||
// Configura objetos
|
// Configura objetos
|
||||||
game_logo_->enable();
|
game_logo_->enable();
|
||||||
@@ -73,9 +74,8 @@ void Title::update()
|
|||||||
// Actualiza las variables de globalInputs
|
// Actualiza las variables de globalInputs
|
||||||
globalInputs::update();
|
globalInputs::update();
|
||||||
|
|
||||||
// Comprueba el fundido y si se ha acabado
|
// Comprueba el fundido
|
||||||
fade_->update();
|
fade_->update();
|
||||||
// JA_SetMusicVolume(100 - fade_->getValue());
|
|
||||||
if (fade_->hasEnded())
|
if (fade_->hasEnded())
|
||||||
{
|
{
|
||||||
if (post_fade_ == -1)
|
if (post_fade_ == -1)
|
||||||
@@ -90,18 +90,19 @@ void Title::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sección 1 - Titulo animandose
|
// Establece la lógica según el estado
|
||||||
if (section::options == section::Options::TITLE_1)
|
switch (state_)
|
||||||
|
{
|
||||||
|
case TitleState::LOGO_ANIMATING:
|
||||||
{
|
{
|
||||||
game_logo_->update();
|
game_logo_->update();
|
||||||
if (game_logo_->hasFinished())
|
if (game_logo_->hasFinished())
|
||||||
{
|
{
|
||||||
section::options = section::Options::TITLE_2;
|
state_ = TitleState::LOGO_FINISHED;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case TitleState::LOGO_FINISHED:
|
||||||
// Sección 2 - La pantalla con el titulo, el fondo animado y la música
|
|
||||||
else if (section::options == section::Options::TITLE_2)
|
|
||||||
{
|
{
|
||||||
// El contador solo sube si no estamos definiendo botones
|
// El contador solo sube si no estamos definiendo botones
|
||||||
counter_ = define_buttons_->isEnabled() ? 0 : counter_ + 1;
|
counter_ = define_buttons_->isEnabled() ? 0 : counter_ + 1;
|
||||||
@@ -109,10 +110,7 @@ void Title::update()
|
|||||||
// Reproduce la música
|
// Reproduce la música
|
||||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||||
{
|
{
|
||||||
if (!fade_->isEnabled())
|
JA_PlayMusic(Resource::get()->getMusic("title.ogg"));
|
||||||
{
|
|
||||||
JA_PlayMusic(Resource::get()->getMusic("title.ogg"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza el logo con el título del juego
|
// Actualiza el logo con el título del juego
|
||||||
@@ -126,6 +124,27 @@ void Title::update()
|
|||||||
fade_->activate();
|
fade_->activate();
|
||||||
post_fade_ = -1;
|
post_fade_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TitleState::START_HAS_BEEN_PRESSED:
|
||||||
|
{
|
||||||
|
// Actualiza el logo con el título del juego
|
||||||
|
game_logo_->update();
|
||||||
|
|
||||||
|
// Actualiza el mosaico de fondo
|
||||||
|
tiled_bg_->update();
|
||||||
|
|
||||||
|
if (counter_ == 100)
|
||||||
|
{
|
||||||
|
fade_->activate();
|
||||||
|
}
|
||||||
|
++counter_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,16 +164,10 @@ void Title::render()
|
|||||||
// Dibuja el logo con el título del juego
|
// Dibuja el logo con el título del juego
|
||||||
game_logo_->render();
|
game_logo_->render();
|
||||||
|
|
||||||
if (section::options == section::Options::TITLE_2)
|
constexpr Color shadow = Color(0x14, 0x87, 0xc4);
|
||||||
|
|
||||||
|
if (state_ != TitleState::LOGO_ANIMATING)
|
||||||
{
|
{
|
||||||
constexpr Color shadow = Color(0x14, 0x87, 0xc4);
|
|
||||||
|
|
||||||
// 'PRESS TO PLAY'
|
|
||||||
if (counter_ % 50 > 14 && !define_buttons_->isEnabled())
|
|
||||||
{
|
|
||||||
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText(23), 1, no_color, 1, shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mini logo
|
// Mini logo
|
||||||
const int pos1 = (param.game.height / 5 * 4) + BLOCK;
|
const int pos1 = (param.game.height / 5 * 4) + BLOCK;
|
||||||
const int pos2 = pos1 + mini_logo_sprite_->getHeight() + 3;
|
const int pos2 = pos1 + mini_logo_sprite_->getHeight() + 3;
|
||||||
@@ -165,6 +178,24 @@ void Title::render()
|
|||||||
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, pos2, TEXT_COPYRIGHT, 1, no_color, 1, shadow);
|
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, pos2, TEXT_COPYRIGHT, 1, no_color, 1, shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state_ == TitleState::LOGO_FINISHED)
|
||||||
|
{
|
||||||
|
// 'PRESS TO PLAY'
|
||||||
|
if (counter_ % 50 > 14 && !define_buttons_->isEnabled())
|
||||||
|
{
|
||||||
|
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText(23), 1, no_color, 1, shadow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state_ == TitleState::START_HAS_BEEN_PRESSED)
|
||||||
|
{
|
||||||
|
// 'PRESS TO PLAY'
|
||||||
|
if (counter_ % 10 > 4 && !define_buttons_->isEnabled())
|
||||||
|
{
|
||||||
|
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText(23), 1, no_color, 1, shadow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Define Buttons
|
// Define Buttons
|
||||||
define_buttons_->render();
|
define_buttons_->render();
|
||||||
|
|
||||||
@@ -246,29 +277,28 @@ void Title::checkEvents()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Title::checkInput()
|
void Title::checkInput()
|
||||||
{
|
{
|
||||||
// Comprueba los controladores solo si no se estan definiendo los botones
|
// Comprueba las entradas solo si no se estan definiendo los botones
|
||||||
if (!define_buttons_->isEnabled())
|
if (!define_buttons_->isEnabled())
|
||||||
{
|
{
|
||||||
// Comprueba los métodos de control
|
// Comprueba todos los métodos de control
|
||||||
for (const auto &controller : options.controllers)
|
for (const auto &controller : options.controllers)
|
||||||
{
|
{
|
||||||
|
// START
|
||||||
if (Input::get()->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index) &&
|
if (Input::get()->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index) &&
|
||||||
!Input::get()->checkInput(InputType::SERVICE, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
!Input::get()->checkInput(InputType::SERVICE, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
||||||
{
|
{
|
||||||
if (section::options == section::Options::TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
if (state_ == TitleState::LOGO_FINISHED || ALLOW_TITLE_ANIMATION_SKIP)
|
||||||
{
|
{
|
||||||
if (!fade_->isEnabled())
|
JA_PlaySound(Resource::get()->getSound("game_start.wav"));
|
||||||
{
|
JA_FadeOutMusic(1500);
|
||||||
JA_PlaySound(Resource::get()->getSound("game_start.wav"));
|
post_fade_ = controller.player_id;
|
||||||
JA_FadeOutMusic(1500);
|
state_ = TitleState::START_HAS_BEEN_PRESSED;
|
||||||
fade_->activate();
|
counter_ = 0;
|
||||||
post_fade_ = controller.player_id;
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si se va a intercambiar la asignación de mandos a jugadores
|
// SWAP_CONTROLLERS
|
||||||
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, controller.type, controller.index) &&
|
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, controller.type, controller.index) &&
|
||||||
Input::get()->checkInput(InputType::SWAP_CONTROLLERS, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
Input::get()->checkInput(InputType::SWAP_CONTROLLERS, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
||||||
{
|
{
|
||||||
@@ -276,7 +306,7 @@ void Title::checkInput()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si algun mando quiere ser configurado
|
// CONFIG
|
||||||
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, controller.type, controller.index) &&
|
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, controller.type, controller.index) &&
|
||||||
Input::get()->checkInput(InputType::CONFIG, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
Input::get()->checkInput(InputType::CONFIG, INPUT_DO_NOT_ALLOW_REPEAT, controller.type, controller.index))
|
||||||
{
|
{
|
||||||
@@ -355,7 +385,6 @@ void Title::showControllers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::string spaces(lang::getText(100).length() + 3, ' ');
|
// Muestra la notificación
|
||||||
// std::string kb_text = spaces + lang::getText(69);
|
|
||||||
Notifier::get()->showText({text.at(0), text.at(1)});
|
Notifier::get()->showText({text.at(0), text.at(1)});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ constexpr bool ALLOW_TITLE_ANIMATION_SKIP = false;
|
|||||||
- Dibujar el tileado de fondo
|
- Dibujar el tileado de fondo
|
||||||
- Redifinir los botones de los mandos de juego
|
- Redifinir los botones de los mandos de juego
|
||||||
|
|
||||||
Esta clase tiene dos estados:
|
Esta clase tiene tres estados:
|
||||||
- El titulo está animandose, con el fondo estático
|
- El titulo está animandose, con el fondo estático
|
||||||
- El titulo ya está en su sitio y el fondo se está animando
|
- El titulo ya está en su sitio y el fondo se está animando
|
||||||
|
- Se ha pulsado el botón de start
|
||||||
|
|
||||||
Por razones de diseño, no se permite saltarse la animación del titulo, aunque es
|
Por razones de diseño, no se permite saltarse la animación del titulo, aunque es
|
||||||
configurable mediante un define
|
configurable mediante un define
|
||||||
@@ -39,6 +40,14 @@ constexpr bool ALLOW_TITLE_ANIMATION_SKIP = false;
|
|||||||
class Title
|
class Title
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
// Enumeraciones
|
||||||
|
enum class TitleState
|
||||||
|
{
|
||||||
|
LOGO_ANIMATING,
|
||||||
|
LOGO_FINISHED,
|
||||||
|
START_HAS_BEEN_PRESSED,
|
||||||
|
};
|
||||||
|
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
std::shared_ptr<Text> text_; // Objeto de texto para poder escribir textos en pantalla
|
std::shared_ptr<Text> text_; // Objeto de texto para poder escribir textos en pantalla
|
||||||
std::unique_ptr<Fade> fade_; // Objeto para realizar fundidos en pantalla
|
std::unique_ptr<Fade> fade_; // Objeto para realizar fundidos en pantalla
|
||||||
@@ -53,6 +62,7 @@ private:
|
|||||||
section::Name next_section_; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
|
section::Name next_section_; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
|
||||||
int post_fade_ = 0; // Opción a realizar cuando termina el fundido
|
int post_fade_ = 0; // Opción a realizar cuando termina el fundido
|
||||||
int num_controllers_; // Número de mandos conectados
|
int num_controllers_; // Número de mandos conectados
|
||||||
|
TitleState state_; // Estado en el que se encuentra la sección
|
||||||
|
|
||||||
// Actualiza las variables del objeto
|
// Actualiza las variables del objeto
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
Reference in New Issue
Block a user