canvia de pc
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
void BalloonFormations::initBalloonFormations() {
|
||||
// Calcular posiciones base
|
||||
constexpr int Y_BASE = -BLOCK;
|
||||
const int Y_BASE = param.game.play_area.rect.h - BALLOON_SPAWN_HEIGHT;
|
||||
|
||||
const int X4_0 = param.game.play_area.rect.x;
|
||||
const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3];
|
||||
@@ -28,7 +28,7 @@ void BalloonFormations::initBalloonFormations() {
|
||||
const int QUARTER3_X4 = param.game.play_area.third_quarter_x - (BALLOON_SIZE[3] / 2);
|
||||
|
||||
// Mapa de variables para reemplazar en el archivo
|
||||
std::map<std::string, int> variables = {
|
||||
std::map<std::string, float> variables = {
|
||||
{"X1_0", X1_0},
|
||||
{"X1_50", X1_50},
|
||||
{"X1_100", X1_100},
|
||||
@@ -56,7 +56,7 @@ void BalloonFormations::initBalloonFormations() {
|
||||
}
|
||||
}
|
||||
|
||||
auto BalloonFormations::loadFormationsFromFile(const std::string& filename, const std::map<std::string, int>& variables) -> bool {
|
||||
auto BalloonFormations::loadFormationsFromFile(const std::string& filename, const std::map<std::string, float>& variables) -> bool {
|
||||
std::ifstream file(filename);
|
||||
if (!file.is_open()) {
|
||||
return false;
|
||||
@@ -112,7 +112,7 @@ auto BalloonFormations::loadFormationsFromFile(const std::string& filename, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map<std::string, int>& variables) -> std::optional<BalloonFormationParams> {
|
||||
auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map<std::string, float>& variables) -> std::optional<BalloonFormationParams> {
|
||||
std::istringstream iss(line);
|
||||
std::string token;
|
||||
std::vector<std::string> tokens;
|
||||
@@ -127,9 +127,9 @@ auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map
|
||||
}
|
||||
|
||||
try {
|
||||
int x = evaluateExpression(tokens[0], variables);
|
||||
int y = evaluateExpression(tokens[1], variables);
|
||||
int vel_x = evaluateExpression(tokens[2], variables);
|
||||
float x = evaluateExpression(tokens[0], variables);
|
||||
float y = evaluateExpression(tokens[1], variables);
|
||||
float vel_x = evaluateExpression(tokens[2], variables);
|
||||
|
||||
BalloonType type = (tokens[3] == "BALLOON") ? BalloonType::BALLOON : BalloonType::FLOATER;
|
||||
|
||||
@@ -154,7 +154,7 @@ auto BalloonFormations::parseBalloonLine(const std::string& line, const std::map
|
||||
}
|
||||
}
|
||||
|
||||
auto BalloonFormations::evaluateExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int {
|
||||
auto BalloonFormations::evaluateExpression(const std::string& expr, const std::map<std::string, float>& variables) -> float {
|
||||
std::string trimmed_expr = trim(expr);
|
||||
|
||||
// Si es un número directo
|
||||
@@ -171,7 +171,7 @@ auto BalloonFormations::evaluateExpression(const std::string& expr, const std::m
|
||||
return evaluateSimpleExpression(trimmed_expr, variables);
|
||||
}
|
||||
|
||||
auto BalloonFormations::evaluateSimpleExpression(const std::string& expr, const std::map<std::string, int>& variables) -> int {
|
||||
auto BalloonFormations::evaluateSimpleExpression(const std::string& expr, const std::map<std::string, float>& variables) -> float {
|
||||
// Buscar operadores (+, -, *, /)
|
||||
for (size_t i = 1; i < expr.length(); ++i) {
|
||||
char op = expr[i];
|
||||
@@ -241,7 +241,7 @@ void BalloonFormations::loadDefaultFormations() {
|
||||
// Código de fallback con algunas formaciones básicas hardcodeadas
|
||||
// para que el juego funcione aunque falle la carga del archivo
|
||||
|
||||
const int Y_BASE = -BLOCK;
|
||||
const int Y_BASE = param.game.play_area.rect.h - BALLOON_SPAWN_HEIGHT;
|
||||
const int X4_0 = param.game.play_area.rect.x;
|
||||
const int X4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3];
|
||||
constexpr int CREATION_TIME = 300;
|
||||
@@ -260,16 +260,16 @@ void BalloonFormations::initBalloonFormationPools() {
|
||||
|
||||
// Set #0
|
||||
balloon_formation_pool_.at(0) = {
|
||||
&balloon_formation_.at(0),
|
||||
&balloon_formation_.at(1),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(3),
|
||||
&balloon_formation_.at(4),
|
||||
&balloon_formation_.at(5),
|
||||
&balloon_formation_.at(6),
|
||||
&balloon_formation_.at(7),
|
||||
&balloon_formation_.at(8),
|
||||
&balloon_formation_.at(9)};
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2),
|
||||
&balloon_formation_.at(2)};
|
||||
|
||||
// Set #1
|
||||
balloon_formation_pool_.at(1) = {
|
||||
|
||||
Reference in New Issue
Block a user