From 3a8f6627481af6aac20ca4d97301e4beffadff6a Mon Sep 17 00:00:00 2001 From: commandblockguy Date: Sat, 21 Jan 2023 13:19:31 -0600 Subject: [PATCH] Count practice mode level time from level load, not player spawn --- src/classic.cpp | 3 ++- src/practice.cpp | 4 ++-- src/practice.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/classic.cpp b/src/classic.cpp index 235fd27..c3b46fb 100644 --- a/src/classic.cpp +++ b/src/classic.cpp @@ -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() { @@ -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 // diff --git a/src/practice.cpp b/src/practice.cpp index 2ec5b72..550d85c 100644 --- a/src/practice.cpp +++ b/src/practice.cpp @@ -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(); @@ -51,7 +51,7 @@ void practice_update() { } } -void practice_on_player_spawn() { +void practice_on_load() { current_time = 0; } diff --git a/src/practice.h b/src/practice.h index 43904d0..5908066 100644 --- a/src/practice.h +++ b/src/practice.h @@ -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();