parametrizats els colors de les camisetes dels jugadors quan pillen café
This commit is contained in:
@@ -531,16 +531,19 @@ void Resource::createPlayerTextures() {
|
||||
|
||||
// Configuración de jugadores y sus paletas
|
||||
struct PlayerConfig {
|
||||
std::string base_texture;
|
||||
std::vector<std::string> palette_files;
|
||||
std::string name_prefix;
|
||||
std::string base_texture;
|
||||
std::vector<std::string> palette_files;
|
||||
std::string name_prefix;
|
||||
};
|
||||
|
||||
std::vector<PlayerConfig> players = {
|
||||
{"player1.gif", {"player1_coffee1.pal", "player1_coffee2.pal", "player1_invencible.pal"}, "player1"},
|
||||
{"player2.gif", {"player2_coffee1.pal", "player2_coffee2.pal", "player2_invencible.pal"}, "player2"}};
|
||||
|
||||
for (const auto &player : players) {
|
||||
// Bucle principal modificado para usar un índice (player_idx)
|
||||
for (size_t player_idx = 0; player_idx < players.size(); ++player_idx) {
|
||||
const auto &player = players[player_idx]; // Obtenemos el jugador actual
|
||||
|
||||
// Encontrar el archivo original de la textura
|
||||
std::string texture_file_path;
|
||||
auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
@@ -567,6 +570,17 @@ void Resource::createPlayerTextures() {
|
||||
texture_copy->addPaletteFromPalFile(Asset::get()->get(player.palette_files[1]));
|
||||
texture_copy->addPaletteFromPalFile(Asset::get()->get(player.palette_files[2]));
|
||||
|
||||
// Añade los colores establecidos en param.player usando el índice del jugador (player_idx)
|
||||
texture_copy->setPaletteColor(1, 16, param.player.one_coffee_shirt[player_idx].darkest.toUint32());
|
||||
texture_copy->setPaletteColor(1, 17, param.player.one_coffee_shirt[player_idx].dark.toUint32());
|
||||
texture_copy->setPaletteColor(1, 18, param.player.one_coffee_shirt[player_idx].base.toUint32());
|
||||
texture_copy->setPaletteColor(1, 19, param.player.one_coffee_shirt[player_idx].light.toUint32());
|
||||
|
||||
texture_copy->setPaletteColor(2, 16, param.player.two_coffee_shirt[player_idx].darkest.toUint32());
|
||||
texture_copy->setPaletteColor(2, 17, param.player.two_coffee_shirt[player_idx].dark.toUint32());
|
||||
texture_copy->setPaletteColor(2, 18, param.player.two_coffee_shirt[player_idx].base.toUint32());
|
||||
texture_copy->setPaletteColor(2, 19, param.player.two_coffee_shirt[player_idx].light.toUint32());
|
||||
|
||||
// Cambiar a la paleta específica (índice i+1 porque 0 es la original)
|
||||
texture_copy->setPalette(i + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user