diff --git a/data/config/param.txt b/data/config/param.txt index 109a5d4..120d7ac 100644 --- a/data/config/param.txt +++ b/data/config/param.txt @@ -18,8 +18,10 @@ scoreboard.w 320 scoreboard.h 40 # TITLE -pressStart 160 +pressStart 170 titleCounter 800 +arcadeEdition 123 +titleCC 80 # BACKGROUND backgroundAttenuateColor.r 255 diff --git a/data/font/smb2.png b/data/font/smb2.png index b11fade..5f3d1ca 100644 Binary files a/data/font/smb2.png and b/data/font/smb2.png differ diff --git a/data/gfx/player1.gif b/data/gfx/player1.gif index d436b6d..33d5c8a 100644 Binary files a/data/gfx/player1.gif and b/data/gfx/player1.gif differ diff --git a/data/gfx/player2.gif b/data/gfx/player2.gif index 3c0e049..670d3d1 100644 Binary files a/data/gfx/player2.gif and b/data/gfx/player2.gif differ diff --git a/data/gfx/title_arcade_edition.png b/data/gfx/title_arcade_edition.png new file mode 100644 index 0000000..bbf3d11 Binary files /dev/null and b/data/gfx/title_arcade_edition.png differ diff --git a/source/common/utils.cpp b/source/common/utils.cpp index 151ce75..d6f040b 100644 --- a/source/common/utils.cpp +++ b/source/common/utils.cpp @@ -222,4 +222,43 @@ hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2) } return entry2; +} + +// Dibuja un circulo +void DrawCircle(SDL_Renderer * renderer, int32_t centerX, int32_t centerY, int32_t radius) +{ + const int32_t diameter = (radius * 2); + + int32_t x = (radius - 1); + int32_t y = 0; + int32_t tx = 1; + int32_t ty = 1; + int32_t error = (tx - diameter); + + while (x >= y) + { + // Each of the following renders an octant of the circle + SDL_RenderDrawPoint(renderer, centerX + x, centerY - y); + SDL_RenderDrawPoint(renderer, centerX + x, centerY + y); + SDL_RenderDrawPoint(renderer, centerX - x, centerY - y); + SDL_RenderDrawPoint(renderer, centerX - x, centerY + y); + SDL_RenderDrawPoint(renderer, centerX + y, centerY - x); + SDL_RenderDrawPoint(renderer, centerX + y, centerY + x); + SDL_RenderDrawPoint(renderer, centerX - y, centerY - x); + SDL_RenderDrawPoint(renderer, centerX - y, centerY + x); + + if (error <= 0) + { + ++y; + error += ty; + ty += 2; + } + + if (error > 0) + { + --x; + tx += 2; + error += (tx - diameter); + } + } } \ No newline at end of file diff --git a/source/common/utils.h b/source/common/utils.h index 07c260f..4371c2e 100644 --- a/source/common/utils.h +++ b/source/common/utils.h @@ -194,8 +194,10 @@ struct param_t SDL_Rect scoreboard; // Posición y tamaño del marcador // TITLE - int pressStart; // Posición del texto para empezar a jugar - int titleCounter; // Tiempo de inactividad del titulo + int pressStart; // Posición del texto para empezar a jugar + int titleCounter; // Tiempo de inactividad del titulo + int arcadeEdition; // Posición del bitmap + int titleCC; // Posición del bitmap // BACKGROUND color_t backgroundAttenuateColor; @@ -249,4 +251,7 @@ JA_Music_t *getMusic(std::vector music, std::string name); // Ordena las entradas de la tabla de records 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); + #endif \ No newline at end of file diff --git a/source/director.cpp b/source/director.cpp index 5bda9e9..740a847 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -360,6 +360,7 @@ bool Director::setFileList() asset->add(prefix + "/data/gfx/title_bg_tile.png", t_bitmap); asset->add(prefix + "/data/gfx/title_coffee.png", t_bitmap); asset->add(prefix + "/data/gfx/title_crisis.png", t_bitmap); + asset->add(prefix + "/data/gfx/title_arcade_edition.png", t_bitmap); asset->add(prefix + "/data/gfx/title_dust.png", t_bitmap); asset->add(prefix + "/data/gfx/title_dust.ani", t_data); diff --git a/source/game_logo.cpp b/source/game_logo.cpp index 7ff79cc..4966351 100644 --- a/source/game_logo.cpp +++ b/source/game_logo.cpp @@ -15,9 +15,11 @@ GameLogo::GameLogo(SDL_Renderer *renderer, Screen *screen, Asset *asset, param_t dustTexture = new Texture(renderer, asset->get("title_dust.png")); coffeeTexture = new Texture(renderer, asset->get("title_coffee.png")); crisisTexture = new Texture(renderer, asset->get("title_crisis.png")); + arcadeEditionTexture = new Texture(renderer, asset->get("title_arcade_edition.png")); coffeeBitmap = new SmartSprite(coffeeTexture, renderer); crisisBitmap = new SmartSprite(crisisTexture, renderer); + arcadeEditionBitmap = new Sprite((param->gameWidth - arcadeEditionTexture->getWidth()) / 2, param->arcadeEdition, arcadeEditionTexture->getWidth(), arcadeEditionTexture->getHeight(), arcadeEditionTexture, renderer); dustBitmapL = new AnimatedSprite(dustTexture, renderer, asset->get("title_dust.ani")); dustBitmapR = new AnimatedSprite(dustTexture, renderer, asset->get("title_dust.ani")); @@ -31,17 +33,14 @@ GameLogo::GameLogo(SDL_Renderer *renderer, Screen *screen, Asset *asset, param_t // Destructor GameLogo::~GameLogo() { - dustTexture->unload(); delete dustTexture; - - coffeeTexture->unload(); delete coffeeTexture; - - crisisTexture->unload(); delete crisisTexture; + delete arcadeEditionTexture; delete coffeeBitmap; delete crisisBitmap; + delete arcadeEditionBitmap; delete dustBitmapL; delete dustBitmapR; @@ -117,6 +116,9 @@ void GameLogo::render() coffeeBitmap->render(); crisisBitmap->render(); + if (status == finished) + arcadeEditionBitmap->render(); + // Dibuja el polvillo del logo dustBitmapR->render(); dustBitmapL->render(); diff --git a/source/game_logo.h b/source/game_logo.h index d549585..96db753 100644 --- a/source/game_logo.h +++ b/source/game_logo.h @@ -19,15 +19,18 @@ private: Screen *screen; // Objeto encargado de dibujar en pantalla Asset *asset; // Objeto que gestiona todos los ficheros de recursos - Texture *dustTexture; // Textura con los graficos del polvo - Texture *coffeeTexture; // Textura con los graficos de la palabra coffee - Texture *crisisTexture; // Textura con los graficos de la plabra crisis + Texture *dustTexture; // Textura con los graficos del polvo + Texture *coffeeTexture; // Textura con los graficos de la palabra "COFFEE" + Texture *crisisTexture; // Textura con los graficos de la plabra "CRISIS" + Texture *arcadeEditionTexture; // Textura con los graficos de "Arcade Edition" AnimatedSprite *dustBitmapL; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo AnimatedSprite *dustBitmapR; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo - SmartSprite *coffeeBitmap; // Sprite con la palabra COFFEE para la pantalla de titulo - SmartSprite *crisisBitmap; // Sprite con la palabra CRISIS para la pantalla de titulo + SmartSprite *coffeeBitmap; // Sprite con la palabra "COFFEE" para la pantalla de titulo + SmartSprite *crisisBitmap; // Sprite con la palabra "CRISIS" para la pantalla de titulo + + Sprite *arcadeEditionBitmap; // Sprite con los graficos de "Arcade Edition" JA_Sound_t *crashSound; // Sonido con el impacto del título param_t *param; // Puntero con todos los parametros del programa diff --git a/source/load_param.cpp b/source/load_param.cpp index e6e3819..6087e1f 100644 --- a/source/load_param.cpp +++ b/source/load_param.cpp @@ -27,6 +27,8 @@ void initParam(param_t *param) // TITLE param->pressStart = 160; param->titleCounter = 800; + param->arcadeEdition = 123; + param->titleCC = 11; // BACKGROUND param->backgroundAttenuateColor = {255, 255, 255}; @@ -205,6 +207,16 @@ bool setOptions(param_t *param, std::string var, std::string value) param->titleCounter = std::stoi(value); } + else if (var == "arcadeEdition") + { + param->arcadeEdition = std::stoi(value); + } + + else if (var == "titleCC") + { + param->titleCC = std::stoi(value); + } + // BACKGROUND else if (var == "backgroundAttenuateColor.r") { diff --git a/source/player.cpp b/source/player.cpp index 77f3e50..0fac4dc 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -161,6 +161,9 @@ void Player::render() } playerSprite->render(); + + //SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + //DrawCircle(renderer, collider.x, collider.y, collider.r); } // Establece el estado del jugador cuando camina diff --git a/source/title.cpp b/source/title.cpp index e2eba0e..567913a 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -33,7 +33,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, tiledbg = new Tiledbg(renderer, screen, asset, {0, 0, param->gameWidth, param->gameHeight}, TILED_MODE_RANDOM); - gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QUARTER_Y + 20); + gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, param->titleCC); gameLogo->enable(); defineButtons = new DefineButtons(renderer, input, text2, param, options, section);