Skip to content

Commit

Permalink
Count practice mode level time from level load, not player spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
commandblockguy committed Jan 21, 2023
1 parent 5d81f61 commit 3a8f662
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/classic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ Player::Player(int x, int y) : Object(x, y) {
type = PLAYER;
create_hair(this);
player = this;
practice_on_player_spawn();
}

Player::~Player() {
Expand Down Expand Up @@ -1279,6 +1278,8 @@ void load_room(uint8_t x, uint8_t y) {
if(!is_title()) {
new RoomTitle(0, 0);
}

practice_on_load();
}

// update function //
Expand Down
4 changes: 2 additions & 2 deletions src/practice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void practice_update() {
}
}
if(!practice_mode) return;
if(player && level_index() != 30) current_time++;
if(level_index() != 30) current_time++;
if(kb_IsDown(kb_KeyYequ)) {
// while(kb_IsDown(kb_KeyYequ));
prev_room();
Expand Down Expand Up @@ -51,7 +51,7 @@ void practice_update() {
}
}

void practice_on_player_spawn() {
void practice_on_load() {
current_time = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/practice.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern bool practice_mode;

void practice_update();
void practice_on_player_spawn();
void practice_on_load();
void practice_on_complete();
void practice_draw_hud();
int practice_get_total_time();

0 comments on commit 3a8f662

Please sign in to comment.