diff --git a/source/const.h b/source/const.h index 57efd88..12b8a4d 100644 --- a/source/const.h +++ b/source/const.h @@ -48,12 +48,12 @@ const Uint16 GAME_WINDOW_WIDTH = 320; const Uint16 GAME_WINDOW_HEIGHT = 234; const Uint8 TEST_ROOM = 118; // 161 -const Uint8 STARTING_ROOM = 2; +const Uint8 STARTING_ROOM = 25; const Uint8 STARTING_PLAYER_TILE_X = 5; const Uint8 STARTING_PLAYER_TILE_Y = 11; const Uint8 ENEMY_HITBOX_REDUCTION = 4; const Uint8 COOLDOWN_TIME = 50; -const Uint8 GRAVITY = 0; +const Uint8 GRAVITY = 1; const Uint8 MAX_SPEED_Y = 5; const Uint8 BASE_SPEED = 1; const Uint8 MAX_SPEED = 8; diff --git a/source/volcano.cpp b/source/volcano.cpp index 07d5b36..0c93d8e 100644 --- a/source/volcano.cpp +++ b/source/volcano.cpp @@ -107,8 +107,8 @@ Uint8 GetTile(Uint8 x, Uint8 y) // Entrada: coordenades en tiles relativas a la habitación actual // Salida: el valor del byte { - Uint8 room_x = (map.room % 12) * ROOM_WIDTH_IN_TILES; - Uint8 room_y = (map.room / 12) * ROOM_HEIGHT_IN_TILES; + long room_x = (map.room % 12) * ROOM_WIDTH_IN_TILES; + long room_y = (map.room / 12) * ROOM_HEIGHT_IN_TILES; return map.tile[(room_x + x) + (room_y + y) * map.w]; } @@ -305,11 +305,11 @@ void LoadMap() std::string filename = p.substr(p.find_last_of("\\/") + 1); SDL_RWops *file = SDL_RWFromFile(p.c_str(), "r+b"); - Uint8 *w = new Uint8(); - Uint8 *h = new Uint8(); - Uint8 column = 0; - Uint8 line = 0; - Uint8 room = 0; + //Uint8 *w = new Uint8(); + //Uint8 *h = new Uint8(); + //Uint8 column = 0; + //Uint8 line = 0; + //Uint8 room = 0; if (file == NULL) { @@ -319,10 +319,10 @@ void LoadMap() { printf("Reading file %s\n", filename.c_str()); - SDL_RWread(file, w, sizeof(Uint8), 1); - SDL_RWread(file, h, sizeof(Uint8), 1); + SDL_RWread(file, &map.w, sizeof(Uint8), 1); + SDL_RWread(file, &map.h, sizeof(Uint8), 1); - long size = (*w) * (*h); + long size = (map.w) * (map.h); map.tile = new Uint8[size]; map.actor = new Uint8[size]; @@ -330,21 +330,21 @@ void LoadMap() for (Uint32 i = 0; i < size; i++) { SDL_RWread(file, &map.tile[i], sizeof(Uint8), 1); - column++; + /*column++; //std::cout << std::to_string(map.tile[i]); printf("%-3s ", std::to_string(map.tile[i]).c_str()); if (column == ROOM_WIDTH_IN_TILES) { column = 0; line++; - printf("\n"); + printf(" --%s\n",std::to_string(line).c_str()); } if (line == ROOM_HEIGHT_IN_TILES) { line = 0; - printf("==================== ROOM #%-3s =================================\n", std::to_string(room).c_str()); + printf("=========================^= ROOM #%-3s =^================================\n", std::to_string(room).c_str()); room++; - } + }*/ } for (Uint32 i = 0; i < size; i++) @@ -352,8 +352,8 @@ void LoadMap() SDL_RWclose(file); } - delete w; - delete h; + //delete w; + //delete h; } void LoadRoom(int num) @@ -1473,7 +1473,7 @@ void DrawMap() src_rect1.y = (GetTile(i, j) / 16) * MAP_TILE_HEIGHT; dst_rect1.x = i * MAP_TILE_WIDTH; dst_rect1.y = j * MAP_TILE_HEIGHT; - map.sprite_tile->render(renderer, dst_rect1.x, dst_rect1.y, &src_rect1, 45.0); + map.sprite_tile->render(renderer, dst_rect1.x, dst_rect1.y, &src_rect1); } Uint8 i = 0;