From 6c7cfaae5970885833e764e0d268dd8fc692441c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 14 Mar 2025 21:22:55 +0100 Subject: [PATCH] Pasaeta de IWYU --- source/balloon_manager.cpp | 5 +- source/define_buttons.cpp | 1 - source/director.cpp | 70 ++++---- source/enter_name.cpp | 7 +- source/game.cpp | 11 +- source/gif.cpp | 302 ++++++++++++++++---------------- source/gif.h | 50 +++--- source/global_events.cpp | 10 +- source/global_inputs.cpp | 28 +-- source/hiscore_table.cpp | 14 +- source/instructions.cpp | 14 +- source/intro.cpp | 47 ++--- source/intro.h | 9 +- source/logo.cpp | 63 ++----- source/logo.h | 48 +---- source/manage_hiscore_table.cpp | 5 +- source/moving_sprite.cpp | 3 +- source/options.h | 7 +- source/param.h | 9 +- source/resource.cpp | 7 +- source/scoreboard.cpp | 17 +- source/screen.cpp | 8 +- source/smart_sprite.cpp | 1 - source/tabe.cpp | 13 +- source/tabe.h | 4 +- source/utils.cpp | 4 +- source/utils.h | 1 + 27 files changed, 350 insertions(+), 408 deletions(-) diff --git a/source/balloon_manager.cpp b/source/balloon_manager.cpp index 2ac957f..0fccc90 100644 --- a/source/balloon_manager.cpp +++ b/source/balloon_manager.cpp @@ -9,9 +9,8 @@ #include "param.h" // Para Param, ParamGame, param #include "resource.h" // Para Resource #include "screen.h" // Para Screen -#include "stage.h" // Para power -#include "texture.h" // Para Texture -#include "utils.h" // Para Zone, BLOCK, Color, flash_color +#include "stage.h" // Para addPower +#include "utils.h" // Para Zone, Color, flash_color // Constructor BalloonManager::BalloonManager() diff --git a/source/define_buttons.cpp b/source/define_buttons.cpp index a794330..3131eed 100644 --- a/source/define_buttons.cpp +++ b/source/define_buttons.cpp @@ -4,7 +4,6 @@ #include "options.h" // Para OptionsController, Options, options #include "param.h" // Para Param, param, ParamGame, ParamTitle #include "resource.h" // Para Resource -#include "section.h" // Para Name, Options, name, options #include "text.h" // Para Text // Constructor diff --git a/source/director.cpp b/source/director.cpp index ec33190..de95fd1 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -4,43 +4,45 @@ #include // Para AUDIO_S16 #include // Para SDL_BLENDMODE_BLEND #include // Para SDL_GetError +#include // Para SDL_DISABLE #include // Para SDL_CONTROLLER_BUTTON_B, SDL_CO... #include // Para SDL_SetHint, SDL_HINT_RENDER_DR... +#include // Para SDL_ShowCursor #include // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN -#include // Para SDL_bool, Uint32 +#include // Para Uint32, SDL_bool #include // Para errno, EEXIST, EACCES, ENAMETOO... -#include // Para printf, perror -#include // Para mkdir, stat, S_IRWXU -#include // Para getuid -#include // Para min -#include // Para chrono -#include // Para exit, EXIT_FAILURE, size_t, rand -#include // Para basic_ostream, operator<<, basi... -#include // Para make_unique, unique_ptr -#include // Para runtime_error -#include // Para operator+, char_traits, allocator -#include // Para vector -#include "asset.h" // Para Asset, AssetType -#include "credits.h" // Para Credits -#include "dbgtxt.h" // Para dbg_init -#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_... -#include "hiscore_table.h" // Para HiScoreTable -#include "input.h" // Para Input, InputType -#include "instructions.h" // Para Instructions -#include "intro.h" // Para Intro -#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV... -#include "lang.h" // Para Code, loadFromFile -#include "logo.h" // Para Logo -#include "manage_hiscore_table.h" // Para ManageHiScoreTable -#include "notifier.h" // Para Notifier -#include "on_screen_help.h" // Para OnScreenHelp -#include "options.h" // Para Options, options, OptionsContro... -#include "param.h" // Para Param, ParamGame, param, loadPa... -#include "resource.h" // Para Resource -#include "screen.h" // Para Screen -#include "section.h" // Para Name, Options, name, options -#include "title.h" // Para Title -#include "utils.h" // Para Overrides, overrides +#include // Para printf, perror +#include // Para mkdir, stat, S_IRWXU +#include // Para getuid +#include // Para min +#include // Para chrono +#include // Para exit, EXIT_FAILURE, size_t, rand +#include // Para basic_ostream, operator<<, basi... +#include // Para make_unique, unique_ptr +#include // Para runtime_error +#include // Para operator+, char_traits, allocator +#include // Para vector +#include "asset.h" // Para Asset, AssetType +#include "credits.h" // Para Credits +#include "dbgtxt.h" // Para dbg_init +#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_... +#include "hiscore_table.h" // Para HiScoreTable +#include "input.h" // Para Input, InputType +#include "instructions.h" // Para Instructions +#include "intro.h" // Para Intro +#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV... +#include "lang.h" // Para Code, loadFromFile +#include "logo.h" // Para Logo +#include "manage_hiscore_table.h" // Para ManageHiScoreTable +#include "notifier.h" // Para Notifier +#include "on_screen_help.h" // Para OnScreenHelp +#include "options.h" // Para Options, options, OptionsContro... +#include "param.h" // Para Param, ParamGame, param, loadPa... +#include "resource.h" // Para Resource +#include "screen.h" // Para Screen +#include "section.h" // Para Name, Options, name, options +#include "title.h" // Para Title +#include "utils.h" // Para Overrides, overrides #ifndef _WIN32 #include // Para getpwuid, passwd @@ -53,7 +55,7 @@ Director::Director(int argc, const char *argv[]) section::name = section::Name::GAME; section::options = section::Options::GAME_PLAY_1P; #elif DEBUG - section::name = section::Name::INTRO; + section::name = section::Name::LOGO; #else // NORMAL GAME section::name = section::Name::LOGO; section::options = section::Options::NONE; diff --git a/source/enter_name.cpp b/source/enter_name.cpp index 61687a2..a293afa 100644 --- a/source/enter_name.cpp +++ b/source/enter_name.cpp @@ -1,9 +1,6 @@ #include "enter_name.h" -#include "utils.h" -#include // Para size_t -#include // Para max, min -#include // Para assert -#include +#include // Para size_t +#include "utils.h" // Para trim // Constructor EnterName::EnterName() diff --git a/source/game.cpp b/source/game.cpp index 906311d..f359e9b 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1,6 +1,6 @@ #include "game.h" #include // Para SDL_BLENDMODE_BLEND -#include // Para SDL_PollEvent, SDL_Event, SDL_KEYDOWN +#include // Para SDL_Event, SDL_PollEvent, SDL_KEYDOWN #include // Para SDLK_1, SDLK_2, SDLK_3, SDLK_4 #include // Para SDL_PIXELFORMAT_RGBA8888 #include // Para SDL_GetTicks @@ -14,15 +14,14 @@ #include "balloon.h" // Para Balloon, BALLOON_SPEED #include "balloon_manager.h" // Para BalloonManager #include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus -#include "enter_name.h" // Para NAME_LENGHT #include "fade.h" // Para Fade, FadeType, FadeMode +#include "global_events.h" // Para check #include "global_inputs.h" // Para check, update #include "input.h" // Para InputType, Input, INPUT_DO_NOT_ALL... #include "item.h" // Para Item, ItemType #include "jail_audio.h" // Para JA_PlaySound, JA_GetMusicState #include "lang.h" // Para getText #include "manage_hiscore_table.h" // Para ManageHiScoreTable, HiScoreEntry -#include "global_events.h" // Para handleEvent #include "notifier.h" // Para Notifier #include "param.h" // Para Param, param, ParamGame, ParamFade #include "path_sprite.h" // Para Path, PathSprite, createPath, Path... @@ -30,10 +29,10 @@ #include "resource.h" // Para Resource #include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB... #include "screen.h" // Para Screen -#include "section.h" // Para Name, name, AttractMode, Options +#include "section.h" // Para Name, name, AttractMode, attract_mode #include "smart_sprite.h" // Para SmartSprite #include "stage.h" // Para number, get, Stage, total_power -#include "tabe.h" // Para Tabe +#include "tabe.h" // Para Tabe, TabeState #include "text.h" // Para Text #include "texture.h" // Para Texture @@ -1379,7 +1378,7 @@ void Game::handleDemoMode() for (const auto &player : players_) { if (player->isPlaying()) - { + { // Maneja el input específico del jugador en modo demo. handleDemoPlayerInput(player, index); } diff --git a/source/gif.cpp b/source/gif.cpp index 4d495f9..2888833 100644 --- a/source/gif.cpp +++ b/source/gif.cpp @@ -1,13 +1,13 @@ #include "gif.h" -#include // for NULL, fprintf, stderr -#include // for malloc, realloc, exit, calloc, free +#include // Para NULL, fprintf, stderr +#include // Para malloc, realloc, exit, calloc, free -void uncompress( int code_length, - const unsigned char *input, - int input_length, - unsigned char *out ) +void uncompress(int code_length, + const unsigned char *input, + int input_length, + unsigned char *out) { - //int maxbits; + // int maxbits; int i, bit; int code, prev = -1; dictionary_entry_t *dictionary; @@ -18,15 +18,15 @@ void uncompress( int code_length, int stop_code; // one more than clear code int match_len; - clear_code = 1 << ( code_length ); + clear_code = 1 << (code_length); stop_code = clear_code + 1; // To handle clear codes reset_code_length = code_length; // Create a dictionary large enough to hold "code_length" entries. // Once the dictionary overflows, code_length increases - dictionary = ( dictionary_entry_t * ) - malloc( sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + dictionary = (dictionary_entry_t *) + malloc(sizeof(dictionary_entry_t) * (1 << (code_length + 1))); // Initialize the first 2^code_len entries of the dictionary with their // indices. The rest of the entries will be built up dynamically. @@ -35,14 +35,14 @@ void uncompress( int code_length, // dictionary. The spec says that the encoder "should output a // clear code as the first code in the image data stream". It doesn't // say must, though... - for ( dictionary_ind = 0; - dictionary_ind < ( 1 << code_length ); - dictionary_ind++ ) + for (dictionary_ind = 0; + dictionary_ind < (1 << code_length); + dictionary_ind++) { - dictionary[ dictionary_ind ].byte = dictionary_ind; + dictionary[dictionary_ind].byte = dictionary_ind; // XXX this only works because prev is a 32-bit int (> 12 bits) - dictionary[ dictionary_ind ].prev = -1; - dictionary[ dictionary_ind ].len = 1; + dictionary[dictionary_ind].prev = -1; + dictionary[dictionary_ind].len = 1; } // 2^code_len + 1 is the special "end" code; don't give it an entry here @@ -50,48 +50,48 @@ void uncompress( int code_length, dictionary_ind++; // TODO verify that the very last byte is clear_code + 1 - while ( input_length ) + while (input_length) { code = 0x0; // Always read one more bit than the code length - for ( i = 0; i < ( code_length + 1 ); i++ ) + for (i = 0; i < (code_length + 1); i++) { // This is different than in the file read example; that // was a call to "next_bit" - bit = ( *input & mask ) ? 1 : 0; + bit = (*input & mask) ? 1 : 0; mask <<= 1; - if ( mask == 0x100 ) + if (mask == 0x100) { mask = 0x01; input++; input_length--; } - code = code | ( bit << i ); + code = code | (bit << i); } - if ( code == clear_code ) + if (code == clear_code) { code_length = reset_code_length; - dictionary = ( dictionary_entry_t * ) realloc( dictionary, - sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + dictionary = (dictionary_entry_t *)realloc(dictionary, + sizeof(dictionary_entry_t) * (1 << (code_length + 1))); - for ( dictionary_ind = 0; - dictionary_ind < ( 1 << code_length ); - dictionary_ind++ ) + for (dictionary_ind = 0; + dictionary_ind < (1 << code_length); + dictionary_ind++) { - dictionary[ dictionary_ind ].byte = dictionary_ind; + dictionary[dictionary_ind].byte = dictionary_ind; // XXX this only works because prev is a 32-bit int (> 12 bits) - dictionary[ dictionary_ind ].prev = -1; - dictionary[ dictionary_ind ].len = 1; + dictionary[dictionary_ind].prev = -1; + dictionary[dictionary_ind].len = 1; } dictionary_ind++; dictionary_ind++; prev = -1; continue; } - else if ( code == stop_code ) + else if (code == stop_code) { /*if ( input_length > 1 ) { @@ -103,73 +103,73 @@ void uncompress( int code_length, // Update the dictionary with this character plus the _entry_ // (character or string) that came before it - if ( ( prev > -1 ) && ( code_length < 12 ) ) + if ((prev > -1) && (code_length < 12)) { - if ( code > dictionary_ind ) + if (code > dictionary_ind) { - fprintf( stderr, "code = %.02x, but dictionary_ind = %.02x\n", - code, dictionary_ind ); - exit( 0 ); + fprintf(stderr, "code = %.02x, but dictionary_ind = %.02x\n", + code, dictionary_ind); + exit(0); } // Special handling for KwKwK - if ( code == dictionary_ind ) + if (code == dictionary_ind) { int ptr = prev; - while ( dictionary[ ptr ].prev != -1 ) + while (dictionary[ptr].prev != -1) { - ptr = dictionary[ ptr ].prev; + ptr = dictionary[ptr].prev; } - dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte; + dictionary[dictionary_ind].byte = dictionary[ptr].byte; } else { int ptr = code; - while ( dictionary[ ptr ].prev != -1 ) + while (dictionary[ptr].prev != -1) { - ptr = dictionary[ ptr ].prev; + ptr = dictionary[ptr].prev; } - dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte; + dictionary[dictionary_ind].byte = dictionary[ptr].byte; } - dictionary[ dictionary_ind ].prev = prev; + dictionary[dictionary_ind].prev = prev; - dictionary[ dictionary_ind ].len = dictionary[ prev ].len + 1; + dictionary[dictionary_ind].len = dictionary[prev].len + 1; dictionary_ind++; // GIF89a mandates that this stops at 12 bits - if ( ( dictionary_ind == ( 1 << ( code_length + 1 ) ) ) && - ( code_length < 11 ) ) + if ((dictionary_ind == (1 << (code_length + 1))) && + (code_length < 11)) { code_length++; - dictionary = ( dictionary_entry_t * ) realloc( dictionary, - sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + dictionary = (dictionary_entry_t *)realloc(dictionary, + sizeof(dictionary_entry_t) * (1 << (code_length + 1))); } } prev = code; // Now copy the dictionary entry backwards into "out" - match_len = dictionary[ code ].len; - while ( code != -1 ) + match_len = dictionary[code].len; + while (code != -1) { - out[ dictionary[ code ].len - 1 ] = dictionary[ code ].byte; - if ( dictionary[ code ].prev == code ) + out[dictionary[code].len - 1] = dictionary[code].byte; + if (dictionary[code].prev == code) { - fprintf( stderr, "Internal error; self-reference." ); - exit( 0 ); + fprintf(stderr, "Internal error; self-reference."); + exit(0); } - code = dictionary[ code ].prev; + code = dictionary[code].prev; } out += match_len; } } -static int read_sub_blocks( unsigned char* buffer, unsigned char **data ) +static int read_sub_blocks(unsigned char *buffer, unsigned char **data) { int data_length; int index; @@ -181,20 +181,20 @@ static int read_sub_blocks( unsigned char* buffer, unsigned char **data ) *data = NULL; index = 0; - while ( 1 ) + while (1) { - READ(&block_size, 1); + READ(&block_size, 1); - if ( block_size == 0 ) // end of sub-blocks + if (block_size == 0) // end of sub-blocks { break; } data_length += block_size; - *data = (unsigned char*)realloc( *data, data_length ); + *data = (unsigned char *)realloc(*data, data_length); // TODO this could be split across block size boundaries - READ(*data + index, block_size); + READ(*data + index, block_size); index += block_size; } @@ -202,10 +202,10 @@ static int read_sub_blocks( unsigned char* buffer, unsigned char **data ) return data_length; } -unsigned char* process_image_descriptor( unsigned char* buffer, - rgb *gct, - int gct_size, - int resolution_bits ) +unsigned char *process_image_descriptor(unsigned char *buffer, + rgb *gct, + int gct_size, + int resolution_bits) { image_descriptor_t image_descriptor; int compressed_data_length; @@ -215,27 +215,28 @@ unsigned char* process_image_descriptor( unsigned char* buffer, unsigned char *uncompressed_data = NULL; // TODO there could actually be lots of these - READ(&image_descriptor, 9); + READ(&image_descriptor, 9); // TODO if LCT = true, read the LCT - READ(&lzw_code_size, 1); + READ(&lzw_code_size, 1); - compressed_data_length = read_sub_blocks( buffer, &compressed_data ); + compressed_data_length = read_sub_blocks(buffer, &compressed_data); -// width = image_descriptor.image_width; -// height = image_descriptor.image_height; + // width = image_descriptor.image_width; + // height = image_descriptor.image_height; uncompressed_data_length = image_descriptor.image_width * - image_descriptor.image_height; - uncompressed_data = (unsigned char*)malloc( uncompressed_data_length ); + image_descriptor.image_height; + uncompressed_data = (unsigned char *)malloc(uncompressed_data_length); - uncompress( lzw_code_size, compressed_data, compressed_data_length, - uncompressed_data ); + uncompress(lzw_code_size, compressed_data, compressed_data_length, + uncompressed_data); - if ( compressed_data ) free( compressed_data ); + if (compressed_data) + free(compressed_data); - //if ( uncompressed_data ) - // free( uncompressed_data ); + // if ( uncompressed_data ) + // free( uncompressed_data ); return uncompressed_data; } @@ -247,47 +248,50 @@ unsigned char* process_image_descriptor( unsigned char* buffer, */ #define rb (*(buffer++)) -uint32_t* LoadPalette(unsigned char *buffer) { - unsigned char header[7]; - screen_descriptor_t screen_descriptor; - //int color_resolution_bits; +uint32_t *LoadPalette(unsigned char *buffer) +{ + unsigned char header[7]; + screen_descriptor_t screen_descriptor; + // int color_resolution_bits; - int global_color_table_size = 0; // number of entries in global_color_table - uint32_t *global_color_table = NULL; + int global_color_table_size = 0; // number of entries in global_color_table + uint32_t *global_color_table = NULL; - READ(header, 6); - READ(&screen_descriptor, 7); + READ(header, 6); + READ(&screen_descriptor, 7); - //color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1; - global_color_table = (uint32_t *)calloc(1, 1024); + // color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1; + global_color_table = (uint32_t *)calloc(1, 1024); - if (screen_descriptor.fields & 0x80) { - global_color_table_size = 1 << (((screen_descriptor.fields & 0x07) + 1)); + if (screen_descriptor.fields & 0x80) + { + global_color_table_size = 1 << (((screen_descriptor.fields & 0x07) + 1)); - //global_color_table = (rgb *)malloc(3 * global_color_table_size); - //READ(global_color_table, 3 * global_color_table_size); - for (int i=0; i> 4 ) + 1; + color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1; - if ( screen_descriptor.fields & 0x80 ) + if (screen_descriptor.fields & 0x80) { - //int i; - // If bit 7 is set, the next block is a global color table; read it - global_color_table_size = 1 << - ( ( ( screen_descriptor.fields & 0x07 ) + 1 ) ); - - global_color_table = ( rgb * ) malloc( 3 * global_color_table_size ); - + // int i; + // If bit 7 is set, the next block is a global color table; read it + global_color_table_size = 1 << (((screen_descriptor.fields & 0x07) + 1)); + + global_color_table = (rgb *)malloc(3 * global_color_table_size); + // XXX this could conceivably return a short count... - READ(global_color_table, 3 * global_color_table_size); + READ(global_color_table, 3 * global_color_table_size); } - - while ( block_type != TRAILER ) + + while (block_type != TRAILER) { - READ(&block_type, 1); - + READ(&block_type, 1); + unsigned char size; - switch ( block_type ) + switch (block_type) { - case IMAGE_DESCRIPTOR: - return process_image_descriptor(buffer, - global_color_table, - global_color_table_size, - color_resolution_bits); - break; - case EXTENSION_INTRODUCER: - buffer++; + case IMAGE_DESCRIPTOR: + return process_image_descriptor(buffer, + global_color_table, + global_color_table_size, + color_resolution_bits); + break; + case EXTENSION_INTRODUCER: + buffer++; + size = *(buffer++); + buffer += size; + do + { size = *(buffer++); buffer += size; - do { - size = *(buffer++); - buffer += size; - } while (size != 0); + } while (size != 0); - /*if ( !process_extension( buffer ) ) - { - return NULL; - }*/ - break; - case TRAILER: - break; - default: - fprintf( stderr, "Bailing on unrecognized block type %.02x\n", - block_type ); + /*if ( !process_extension( buffer ) ) + { return NULL; + }*/ + break; + case TRAILER: + break; + default: + fprintf(stderr, "Bailing on unrecognized block type %.02x\n", + block_type); + return NULL; } } - return NULL; + return NULL; } - -unsigned char* LoadGif(unsigned char *buffer, unsigned short* w, unsigned short* h) { - return process_gif_stream(buffer, w, h); +unsigned char *LoadGif(unsigned char *buffer, unsigned short *w, unsigned short *h) +{ + return process_gif_stream(buffer, w, h); } /*int main( int argc, char *argv[] ) { FILE* gif_file; - + if ( argc < 2 ) { fprintf( stderr, "Usage: %s \n", argv[ 0 ] ); exit( 0 ); } - + gif_file = fopen( argv[ 1 ], "rb" ); - + if ( gif_file == NULL ) { fprintf( stderr, "Unable to open file '%s'", argv[ 1 ] ); perror( ": " ); } - + process_gif_stream( gif_file ); - + fclose( gif_file ); }*/ \ No newline at end of file diff --git a/source/gif.h b/source/gif.h index 5e6641f..7c14a08 100644 --- a/source/gif.h +++ b/source/gif.h @@ -1,19 +1,22 @@ #pragma once -#include // for uint32_t -#include // for memcpy +#include // Para uint32_t +#include // Para memcpy -#define EXTENSION_INTRODUCER 0x21 -#define IMAGE_DESCRIPTOR 0x2C -#define TRAILER 0x3B -#define GRAPHIC_CONTROL 0xF9 -#define APPLICATION_EXTENSION 0xFF -#define COMMENT_EXTENSION 0xFE -#define PLAINTEXT_EXTENSION 0x01 +#define EXTENSION_INTRODUCER 0x21 +#define IMAGE_DESCRIPTOR 0x2C +#define TRAILER 0x3B +#define GRAPHIC_CONTROL 0xF9 +#define APPLICATION_EXTENSION 0xFF +#define COMMENT_EXTENSION 0xFE +#define PLAINTEXT_EXTENSION 0x01 -#define READ(dst, size) memcpy(dst, buffer, size); buffer += size +#define READ(dst, size) \ + memcpy(dst, buffer, size); \ + buffer += size -typedef struct { +typedef struct +{ unsigned short width; unsigned short height; unsigned char fields; @@ -21,11 +24,13 @@ typedef struct { unsigned char pixel_aspect_ratio; } screen_descriptor_t; -typedef struct { +typedef struct +{ unsigned char r, g, b; } rgb; -typedef struct { +typedef struct +{ unsigned short image_left_position; unsigned short image_top_position; unsigned short image_width; @@ -33,34 +38,39 @@ typedef struct { unsigned char fields; } image_descriptor_t; -typedef struct { +typedef struct +{ unsigned char byte; int prev; int len; } dictionary_entry_t; -typedef struct { +typedef struct +{ unsigned char extension_code; unsigned char block_size; } extension_t; -typedef struct { +typedef struct +{ unsigned char fields; unsigned short delay_time; unsigned char transparent_color_index; } graphic_control_extension_t; -typedef struct { +typedef struct +{ unsigned char application_id[8]; unsigned char version[3]; } application_extension_t; -typedef struct { +typedef struct +{ unsigned short left, top, width, height; unsigned char cell_width, cell_height; unsigned char foreground_color, background_color; } plaintext_extension_t; void uncompress(int code_length, const unsigned char *input, int input_length, unsigned char *out); -uint32_t* LoadPalette(unsigned char *buffer); -unsigned char* LoadGif(unsigned char *buffer, unsigned short* w, unsigned short* h); \ No newline at end of file +uint32_t *LoadPalette(unsigned char *buffer); +unsigned char *LoadGif(unsigned char *buffer, unsigned short *w, unsigned short *h); \ No newline at end of file diff --git a/source/global_events.cpp b/source/global_events.cpp index 8cea419..ed99ae2 100644 --- a/source/global_events.cpp +++ b/source/global_events.cpp @@ -1,8 +1,8 @@ #include "global_events.h" -#include "section.h" -#include "mouse.h" -#include "resource.h" -#include +#include // Para SDL_WINDOWEVENT_SIZE_CHANGED +#include // Para char_traits, basic_ostream, operator<< +#include "mouse.h" // Para handleEvent +#include "section.h" // Para Name, Options, name, options namespace globalEvents { @@ -17,13 +17,11 @@ namespace globalEvents return; case SDL_RENDER_DEVICE_RESET: case SDL_RENDER_TARGETS_RESET: - // Resource::get()->reloadTextures(); std::cout << "SDL_RENDER_TARGETS_RESET" << std::endl; break; case SDL_WINDOWEVENT: if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { - // Resource::get()->reloadTextures(); std::cout << "SDL_WINDOWEVENT_SIZE_CHANGED" << std::endl; } break; diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index 036ee6d..493dd59 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -1,16 +1,18 @@ #include "global_inputs.h" -#include // Para operator+, string, to_string, basic_string -#include // Para vector -#include "asset.h" // Para Asset -#include "input.h" // Para Input, InputDeviceToUse, InputType, INPU... -#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume -#include "lang.h" // Para Code, getText, change, loadFromFile -#include "notifier.h" // Para Notifier -#include "on_screen_help.h" // Para OnScreenHelp -#include "options.h" // Para Options, options, OptionsGame, OptionsAudio -#include "screen.h" // Para Screen, ScreenVideoMode -#include "section.h" // Para Name, Options, name, options -#include "utils.h" // Para boolToOnOff, stringInVector +#include // Para SDL_RenderSetIntegerScale +#include // Para SDL_FALSE, SDL_TRUE +#include // Para operator+, string, to_string, basic_string +#include // Para vector +#include "asset.h" // Para Asset +#include "input.h" // Para Input, InputDeviceToUse, InputType, INP... +#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume +#include "lang.h" // Para getText, Code, getNextLangCode, loadFro... +#include "notifier.h" // Para Notifier +#include "on_screen_help.h" // Para OnScreenHelp +#include "options.h" // Para Options, options, OptionsGame, OptionsV... +#include "screen.h" // Para Screen, ScreenVideoMode +#include "section.h" // Para Name, name, Options, options, AttractMode +#include "utils.h" // Para boolToOnOff namespace globalInputs { @@ -33,7 +35,7 @@ namespace globalInputs // Si la notificación de salir no está activa, muestra la notificación #ifdef ARCADE const int INDEX = code == section::Options::QUIT_WITH_CONTROLLER ? 116 : 94; - Notifier::get()->showText({lang::getText(INDEX), std::string()}, -1, CODE); + Notifier::get()->show({lang::getText(INDEX), std::string()}, -1, CODE); #else Notifier::get()->show({lang::getText(94), std::string()}, -1, CODE); #endif diff --git a/source/hiscore_table.cpp b/source/hiscore_table.cpp index c40e371..6c7d4ef 100644 --- a/source/hiscore_table.cpp +++ b/source/hiscore_table.cpp @@ -1,31 +1,29 @@ #include "hiscore_table.h" #include // Para SDL_BLENDMODE_BLEND -#include // Para SDL_PollEvent, SDL_Event, SDL_QUIT +#include // Para SDL_PollEvent, SDL_Event #include // Para SDL_PIXELFORMAT_RGBA8888 #include // Para SDL_GetTicks -#include // Para SDL_WINDOWEVENT_SIZE_CHANGED -#include // Para rand +#include // Para rand, size_t #include // Para max #include // Para function #include // Para vector #include "background.h" // Para Background #include "fade.h" // Para Fade, FadeMode, FadeType +#include "global_events.h" // Para check #include "global_inputs.h" // Para check, update -#include "input.h" // Para Input #include "jail_audio.h" // Para JA_GetMusicState, JA_Music_state #include "lang.h" // Para getText #include "manage_hiscore_table.h" // Para HiScoreEntry -#include "global_events.h" // Para handleEvent #include "options.h" // Para Options, OptionsGame, options #include "param.h" // Para Param, param, ParamGame, ParamFade #include "path_sprite.h" // Para PathSprite, Path, PathType #include "resource.h" // Para Resource #include "screen.h" // Para Screen -#include "section.h" // Para Name, name, Options, options, Attr... +#include "section.h" // Para Name, name #include "sprite.h" // Para Sprite -#include "text.h" // Para Text, TEXT_COLOR, TEXT_SHADOW +#include "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR #include "texture.h" // Para Texture -#include "utils.h" // Para Color, easeOutQuint, fade_color +#include "utils.h" // Para Color, easeOutQuint, fade_color, Zone // Constructor HiScoreTable::HiScoreTable() diff --git a/source/instructions.cpp b/source/instructions.cpp index 3e23139..14ecc66 100644 --- a/source/instructions.cpp +++ b/source/instructions.cpp @@ -1,14 +1,14 @@ #include "instructions.h" #include // Para SDL_BLENDMODE_BLEND -#include // Para SDL_PollEvent, SDL_Event, SDL_QUIT +#include // Para SDL_PollEvent, SDL_Event #include // Para SDL_PIXELFORMAT_RGBA8888 #include // Para SDL_GetTicks -#include // Para SDL_WINDOWEVENT_SIZE_CHANGED #include // Para max #include // Para move +#include // Para vector #include "fade.h" // Para Fade, FadeMode, FadeType -#include "global_inputs.h" // Para check -#include "input.h" // Para Input +#include "global_events.h" // Para check +#include "global_inputs.h" // Para check, update #include "jail_audio.h" // Para JA_GetMusicState, JA_Music_state #include "lang.h" // Para getText #include "param.h" // Para Param, param, ParamGame, ParamFade @@ -17,14 +17,8 @@ #include "section.h" // Para Name, name, Options, options #include "sprite.h" // Para Sprite #include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR, TEXT_... -#include "texture.h" // Para Texture #include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "utils.h" // Para Color, shdw_txt_color, Zone, no_color -#include "global_events.h" - -#include -#include -#include // Constructor Instructions::Instructions() diff --git a/source/intro.cpp b/source/intro.cpp index c78c141..8380937 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -1,24 +1,27 @@ #include "intro.h" -#include // Para SDL_PollEvent, SDL_Event, SDL_QUIT, SDL... -#include // Para SDL_GetTicks -#include // Para SDL_WINDOWEVENT_SIZE_CHANGED -#include // Para move -#include "global_inputs.h" // Para check -#include "input.h" // Para Input -#include "jail_audio.h" // Para JA_StopMusic, JA_PlayMusic -#include "lang.h" // Para getText -#include "param.h" // Para Param, ParamGame, param -#include "resource.h" // Para Resource -#include "screen.h" // Para Screen -#include "section.h" // Para Name, name, Options, options -#include "path_sprite.h" // Para PathSprite -#include "text.h" // Para Text -#include "texture.h" // Para Texture -#include "utils.h" // Para Zone, BLOCK, Color, bg_color -#include "writer.h" // Para Writer -#include "global_events.h" -#include "tiled_bg.h" -#include +#include // Para SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD +#include // Para SDL_PollEvent, SDL_Event +#include // Para SDL_PIXELFORMAT_RGBA8888 +#include // Para SDL_Rect +#include // Para SDL_SetTextureBlendMode, SDL_GetRend... +#include // Para SDL_GetTicks +#include // Para array +#include // Para function +#include // Para basic_string, string +#include // Para move +#include "global_events.h" // Para check +#include "global_inputs.h" // Para check, update +#include "jail_audio.h" // Para JA_PlayMusic, JA_StopMusic +#include "lang.h" // Para getText +#include "param.h" // Para Param, ParamGame, param +#include "path_sprite.h" // Para PathSprite, PathType +#include "resource.h" // Para Resource +#include "screen.h" // Para Screen +#include "section.h" // Para Name, name, Options, options +#include "texture.h" // Para Texture +#include "tiled_bg.h" // Para TiledBG, TiledBGMode +#include "utils.h" // Para Color, Zone, easeOutQuint, BLOCK +#include "writer.h" // Para Writer // Constructor Intro::Intro() @@ -358,7 +361,7 @@ void Intro::initSprites() SDL_RenderCopy(Screen::get()->getRenderer(), texture, nullptr, &rect); SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_NONE); - //shadow_texture->setAlpha(160); + // shadow_texture->setAlpha(160); SDL_SetRenderTarget(Screen::get()->getRenderer(), temp); shadow_textures.push_back(shadow_texture); @@ -491,7 +494,7 @@ void Intro::updatePostState() if (ELAPSED_TIME >= 1000) { tiled_bg_->stopGracefully(); - + // Modifica el color del fondo hasta llegar a blanco if (bg_color_ < 255) { diff --git a/source/intro.h b/source/intro.h index 52d0156..39bb2e7 100644 --- a/source/intro.h +++ b/source/intro.h @@ -1,14 +1,11 @@ #pragma once -#include // Para Uint32 -#include // Para SDL_Texture -#include // Para unique_ptr, shared_ptr +#include // Para Uint32, Uint8 +#include // Para unique_ptr #include // Para vector #include "path_sprite.h" // Para PathSprite +#include "tiled_bg.h" // Para TiledBG #include "writer.h" // Para Writer -#include "tiled_bg.h" -class Text; // lines 8-8 -class Texture; // lines 9-9 /* Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia diff --git a/source/logo.cpp b/source/logo.cpp index 48758a3..3625841 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -1,20 +1,17 @@ #include "logo.h" -#include // Para SDL_PollEvent, SDL_Event, SDL_QUIT, SDL... +#include // Para SDL_PollEvent, SDL_Event #include // Para SDL_GetTicks -#include // Para SDL_WINDOWEVENT_SIZE_CHANGED #include // Para move -#include -#include "global_inputs.h" // Para check -#include "input.h" // Para Input -#include "jail_audio.h" // Para JA_StopMusic -#include "param.h" // Para Param, ParamGame, param -#include "resource.h" // Para Resource -#include "screen.h" // Para Screen -#include "section.h" // Para Name, name, Options, options -#include "sprite.h" // Para Sprite -#include "texture.h" // Para Texture -#include "utils.h" // Para Color, Zone -#include "global_events.h" +#include "global_events.h" // Para check +#include "global_inputs.h" // Para check, update +#include "jail_audio.h" // Para JA_FadeOutMusic, JA_PlaySound, JA_StopC... +#include "param.h" // Para Param, ParamGame, param +#include "resource.h" // Para Resource +#include "screen.h" // Para Screen +#include "section.h" // Para Name, name +#include "sprite.h" // Para Sprite +#include "texture.h" // Para Texture +#include "utils.h" // Para Color, Zone // Constructor Logo::Logo() @@ -115,17 +112,10 @@ void Logo::updateJAILGAMES() // Comprueba si ha terminado el logo if (counter_ == END_LOGO_COUNTER_MARK + POST_LOGO_DURATION) { - state_ = LogoState::RETROWEEKEND; - ticks_start_ = SDL_GetTicks(); + section::name = section::Name::INTRO; } } -// Gestiona el logo de RETROWEEKEND -void Logo::updateRETROWEEKEND() -{ - section::name = section::Name::INTRO; -} - // Gestiona el color de las texturas void Logo::updateTextureColors() { @@ -165,20 +155,8 @@ void Logo::update() // Comprueba las entradas checkInput(); - switch (state_) - { - case LogoState::JAILGAMES: - updateJAILGAMES(); - updateTextureColors(); - break; - - case LogoState::RETROWEEKEND: - updateRETROWEEKEND(); - break; - - default: - break; - } + updateJAILGAMES(); + updateTextureColors(); // Gestiona el contador counter_++; @@ -194,18 +172,7 @@ void Logo::render() Screen::get()->start(); Screen::get()->clean(); - switch (state_) - { - case LogoState::JAILGAMES: - renderJAILGAMES(); - break; - - case LogoState::RETROWEEKEND: - break; - - default: - break; - } + renderJAILGAMES(); Screen::get()->render(); } diff --git a/source/logo.h b/source/logo.h index 729eb8b..bd7cb3f 100644 --- a/source/logo.h +++ b/source/logo.h @@ -2,12 +2,11 @@ #include // Para SDL_Point #include // Para Uint32 -#include -#include // Para shared_ptr, unique_ptr -#include // Para vector -class Sprite; -class Texture; // lines 9-9 -struct Color; +#include // Para shared_ptr, unique_ptr +#include // Para vector +class Sprite; // lines 8-8 +class Texture; // lines 9-9 +struct Color; // lines 10-10 /* Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el @@ -17,31 +16,10 @@ struct Color; ZX Spectrum */ -struct Pixel -{ - int x, y; // Coordenadas del píxel - Uint8 r, g, b, a; // Color del píxel - - // Método para ascender y desvanecerse - void evaporate() - { - y -= 1; // Asciende hacia arriba - a = (a > 5) ? a - 5 : 0; // Desvanece el alfa (transparencia) - // Añadir movimiento zig-zag aleatorio - x += (rand() % 3 - 1); // Movimiento horizontal aleatorio (-1, 0, 1) - } -}; - // Clase Logo class Logo { private: - enum class LogoState - { - JAILGAMES, - RETROWEEKEND, - }; - // Constantes static constexpr int SHOW_SINCE_SPRITE_COUNTER_MARK = 70; // Tiempo del contador en el que empieza a verse el sprite de "SINCE 1998" static constexpr int INIT_FADE_COUNTER_MARK = 300; // Tiempo del contador cuando inicia el fade a negro @@ -56,12 +34,10 @@ private: std::vector> jail_sprite_; // Vector con los sprites de cada linea que forman el bitmap JAILGAMES // Variables - std::vector color_; // Vector con los colores para el fade - int counter_ = 0; // Contador - Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa - SDL_Point dest_; // Posición X donde dibujar el logo - LogoState state_ = LogoState::JAILGAMES; // El estado indica qué logo se está procesando - Uint32 ticks_start_ = 0; // Almacena el valor actual de los ticks de SDL + std::vector color_; // Vector con los colores para el fade + int counter_ = 0; // Contador + Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa + SDL_Point dest_; // Posición X donde dibujar el logo // Actualiza las variables void update(); @@ -78,15 +54,9 @@ private: // Gestiona el logo de JAILGAMES void updateJAILGAMES(); - // Gestiona el logo de RETROWEEKEND - void updateRETROWEEKEND(); - // Renderiza el logo de JAILGAMES void renderJAILGAMES(); - // Renderiza el logo de RETROWEEKEND - void renderRETROWEEKEND(); - // Gestiona el color de las texturas void updateTextureColors(); diff --git a/source/manage_hiscore_table.cpp b/source/manage_hiscore_table.cpp index a5b9764..01c26c9 100644 --- a/source/manage_hiscore_table.cpp +++ b/source/manage_hiscore_table.cpp @@ -1,9 +1,10 @@ #include "manage_hiscore_table.h" #include // Para SDL_GetError #include // Para SDL_RWread, SDL_RWwrite, SDL_RWFromFile -#include // Para sort +#include // Para find_if, sort #include // Para basic_ostream, operator<<, cout, endl -#include "utils.h" // Para HiScoreEntry, getFileName +#include // Para distance +#include "utils.h" // Para getFileName // Resetea la tabla a los valores por defecto void ManageHiScoreTable::clear() diff --git a/source/moving_sprite.cpp b/source/moving_sprite.cpp index e675326..2dcdf0e 100644 --- a/source/moving_sprite.cpp +++ b/source/moving_sprite.cpp @@ -1,5 +1,4 @@ #include "moving_sprite.h" -#include // Para max #include "texture.h" // Para Texture // Constructor @@ -28,7 +27,7 @@ MovingSprite::MovingSprite(std::shared_ptr texture) rotate_(Rotate()), zoom_w_(1.0f), zoom_h_(1.0f), - flip_(SDL_FLIP_NONE) {Sprite::clear(); } + flip_(SDL_FLIP_NONE) { Sprite::clear(); } // Reinicia todas las variables void MovingSprite::clear() diff --git a/source/options.h b/source/options.h index 2fb6782..feea2a9 100644 --- a/source/options.h +++ b/source/options.h @@ -1,16 +1,17 @@ #pragma once #include // Para SDL_CONTROLLER_BUTTON_B, SDL_CO... +#include // Para Uint32 #include // Para string #include // Para vector #include "input.h" // Para InputType, InputDeviceToUse #include "manage_hiscore_table.h" // Para HiScoreEntry -enum class ScreenFilter : int; // lines 10-10 -enum class ScreenVideoMode : Uint32; // lines 11-11 +enum class ScreenFilter : int; // lines 8-8 +enum class ScreenVideoMode : Uint32; // lines 9-9 namespace lang { enum class Code : int; -} // lines 14-14 +} // lines 12-12 // Dificultad del juego enum class GameDifficulty diff --git a/source/param.h b/source/param.h index 345a81e..8438193 100644 --- a/source/param.h +++ b/source/param.h @@ -1,9 +1,10 @@ #pragma once -#include // Para SDL_Rect -#include // Para string -#include // Para vector -#include "utils.h" // Para Color, Zone +#include // Para SDL_Rect +#include // Para Uint32 +#include // Para string +#include // Para vector +#include "utils.h" // Para Color, Zone // param.game struct ParamGame diff --git a/source/resource.cpp b/source/resource.cpp index 0fbf853..b65df46 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -2,14 +2,13 @@ #include // Para find_if #include // Para basic_ostream, operator<<, endl, cout, cerr #include // Para runtime_error -#include // Para pair #include "asset.h" // Para Asset, AssetType -#include "jail_audio.h" // Para JA_LoadMusic, JA_LoadSound +#include "jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_LoadMusic #include "lang.h" // Para getText #include "screen.h" // Para Screen #include "text.h" // Para Text, loadTextFile -struct JA_Music_t; // lines 10-10 -struct JA_Sound_t; // lines 11-11 +struct JA_Music_t; // lines 11-11 +struct JA_Sound_t; // lines 12-12 // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado Resource *Resource::resource_ = nullptr; diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index e8cdbf8..aa594a1 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -5,13 +5,12 @@ #include // Para roundf #include // Para operator<<, setfill, setw #include // Para basic_ostream, basic_ostringstream +#include "enter_name.h" // Para MAX_NAME_LENGHT #include "lang.h" // Para getText #include "resource.h" // Para Resource #include "screen.h" // Para Screen #include "sprite.h" // Para Sprite -#include "text.h" // Para Text -#include "enter_name.h" // Para NAME_LENGHT -#include +#include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado Scoreboard *Scoreboard::scoreboard_ = nullptr; @@ -297,6 +296,7 @@ void Scoreboard::fillPanelTextures() // NAME text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106)); text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_4_.x, slot4_4_.y, record_name_[i], 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5)); + // text_scoreboard_->writeColored(enter_name_pos_.x, enter_name_pos_.y, record_name_[i], getColorLikeKnightRider(name_colors_, loop_counter_ / 5)); break; } case ScoreboardMode::GAME_COMPLETED: @@ -439,9 +439,12 @@ void Scoreboard::renderSeparator() // Inicializa el vector de colores para el nombre void Scoreboard::iniNameColors() { + // Color color = orange_soft_color; + Color color = green_color; + name_colors_.clear(); - name_colors_.emplace_back(green_color.lighten(50)); - name_colors_.emplace_back(green_color.lighten(25)); - name_colors_.emplace_back(green_color); - name_colors_.emplace_back(green_color.darken(25)); + name_colors_.emplace_back(color.lighten(50)); + name_colors_.emplace_back(color.lighten(25)); + name_colors_.emplace_back(color); + name_colors_.emplace_back(color.darken(25)); } \ No newline at end of file diff --git a/source/screen.cpp b/source/screen.cpp index 6658ebc..bbda19c 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -1,9 +1,7 @@ #include "screen.h" -#include // Para SDL_DISABLE, SDL_ENABLE -#include // Para SDL_ShowCursor #include // Para SDL_PIXELFORMAT_RGBA8888 #include // Para SDL_GetTicks -#include // Para clamp, max, min +#include // Para max, min #include // Para basic_ifstream, ifstream #include // Para istreambuf_iterator, operator== #include // Para allocator, operator+, char_traits, to_s... @@ -11,11 +9,11 @@ #include "asset.h" // Para Asset #include "dbgtxt.h" // Para dbg_print #include "global_inputs.h" // Para service_pressed_counter +#include "jail_shader.h" // Para init, render +#include "mouse.h" // Para updateCursorVisibility #include "notifier.h" // Para Notifier #include "on_screen_help.h" // Para OnScreenHelp #include "options.h" // Para Options, OptionsVideo, options, Options... -#include "mouse.h" -#include "jail_shader.h" // para init, render // [SINGLETON] Screen *Screen::screen_ = nullptr; diff --git a/source/smart_sprite.cpp b/source/smart_sprite.cpp index 281d4f7..1989e70 100644 --- a/source/smart_sprite.cpp +++ b/source/smart_sprite.cpp @@ -1,6 +1,5 @@ #include "smart_sprite.h" #include "moving_sprite.h" // Para MovingSprite -class Texture; // lines 2-2 // Actualiza la posición y comprueba si ha llegado a su destino void SmartSprite::update() diff --git a/source/tabe.cpp b/source/tabe.cpp index e18741c..2ff762d 100644 --- a/source/tabe.cpp +++ b/source/tabe.cpp @@ -1,13 +1,12 @@ // IWYU pragma: no_include #include "tabe.h" #include // Para SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE -#include -#include // Para rand, abs -#include // Para max -#include "jail_audio.h" // Para JA_PlaySound -#include "param.h" // Para Param, ParamGame, param -#include "resource.h" // Para Resource -#include "utils.h" // Para Zone +#include // Para rand, abs +#include // Para max +#include "jail_audio.h" // Para JA_PlaySound +#include "param.h" // Para Param, ParamGame, param +#include "resource.h" // Para Resource +#include "utils.h" // Para Zone // Constructor Tabe::Tabe() diff --git a/source/tabe.h b/source/tabe.h index 608ebab..63df5c8 100644 --- a/source/tabe.h +++ b/source/tabe.h @@ -1,7 +1,9 @@ #pragma once #include // Para SDL_Rect -#include +#include // Para Uint32 +#include // Para SDL_GetTicks +#include // Para rand #include // Para unique_ptr #include "animated_sprite.h" // Para AnimatedSprite diff --git a/source/utils.cpp b/source/utils.cpp index a89d92d..54c577d 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,8 +1,9 @@ #include "utils.h" #include // Para SDL_RWFromFile, SDL_RWclose, SDL_RWread +#include // Para size_t #include // Para min, clamp, find_if_not, find, transform #include // Para tolower, isspace -#include // Para cos, pow, M_PI +#include // Para pow, sin, M_PI, cos #include // Para operator< #include // Para path #include // Para basic_ostream, cout, basic_ios, endl, ios @@ -254,7 +255,6 @@ double easeInElastic(double t) return t == 0 ? 0 : (t == 1 ? 1 : -pow(2, 10 * t - 10) * sin((t * 10 - 10.75) * (2 * M_PI) / 3)); } - // Función de suavizado double easeOutBounce(double t) { diff --git a/source/utils.h b/source/utils.h index 4c37253..4973f6d 100644 --- a/source/utils.h +++ b/source/utils.h @@ -4,6 +4,7 @@ #include // Para SDL_Renderer #include // Para Uint8 #include // Para int32_t +#include // Para max, min #include // Para string #include // Para vector