diff --git a/TODO.txt b/TODO.txt index b1ffc33..1374ac9 100644 --- a/TODO.txt +++ b/TODO.txt @@ -59,14 +59,14 @@ =========== BUGS ================= -- sometimes getting a SLIGHTLY slower time counts as beating it (prolly - conversion fail) - immediately after starting the map countdown seems to be lower - the pinch collision test seems to sometimes stop the car e.g. after falling from bigger height or when running into ramp at high speed (or not?) - FIX =========== HANDLED ============== +- sometimes getting a SLIGHTLY slower time counts as beating it (prolly + conversion fail) (SEEMS FIXED NOW) - replay format should probably record game version - also there should probably be some version system that says version of physics vs version of everything else; replay could only record physics diff --git a/game.h b/game.h index 13cd220..52ee244 100644 --- a/game.h +++ b/game.h @@ -279,7 +279,7 @@ struct during a single frame, hold number of frames for which the key has been continuously held. */ - uint32_t runTimeMS; ///< Current time of the run + uint32_t runTime; ///< Current time of the run, in ticks. char popupStr[LCR_POPUP_STR_SIZE]; uint8_t popupCountdown; @@ -424,7 +424,7 @@ void LCR_gameResetRun(uint8_t replay, uint8_t ghost) LCR_rendererLoadMapChunks(); LCR_game.ghost.active = ghost; LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING); - LCR_game.runTimeMS = 0; + LCR_game.runTime = 0; } void LCR_gameGetNthGhostSample(unsigned int n, @@ -1129,7 +1129,7 @@ void LCR_gameDraw3DView(void) LCR_rendererComputeTextWidth(str,2) - 20, LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(2) - 20,0,2); - LCR_gameTimeToStr(LCR_game.runTimeMS,str); + LCR_gameTimeToStr(LCR_timeTicksToMS(LCR_game.runTime),str); if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED) LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y - @@ -1138,7 +1138,7 @@ void LCR_gameDraw3DView(void) LCR_rendererDrawText(str,((LCR_EFFECTIVE_RESOLUTION_X - LCR_rendererComputeTextWidth(str,4)) / 2), LCR_EFFECTIVE_RESOLUTION_Y / 2, - LCR_game.runTimeMS <= LCR_currentMap.targetTime * LCR_RACING_TICK_MS ? + LCR_game.runTime <= LCR_currentMap.targetTime ? 0x0700 : 0x4208,4); LCR_gameTimeToStr(LCR_currentMap.targetTime * LCR_RACING_TICK_MS,str); @@ -1178,11 +1178,11 @@ void LCR_gameHandleInput(void) { if (LCR_game.keyStates[LCR_KEY_A] == 1) { - if (LCR_game.runTimeMS <= LCR_currentMap.targetTime * LCR_RACING_TICK_MS + if (LCR_game.runTime <= LCR_currentMap.targetTime && !LCR_game.ghost.active) { LCR_LOG1("setting new target time"); - LCR_currentMap.targetTime = LCR_game.runTimeMS / LCR_RACING_TICK_MS; + LCR_currentMap.targetTime = LCR_game.runTime; } LCR_gameResetRun(LCR_racing.playingReplay,LCR_game.ghost.active); @@ -1456,7 +1456,7 @@ uint8_t LCR_gameStep(uint32_t time) LCR_racingGetCarBlockCoords(carBlock); LCR_rendererMarkTakenCP(carBlock[0],carBlock[1],carBlock[2]); LCR_audioPlaySound(LCR_SOUND_CLICK); - LCR_gameTimeToStr(LCR_game.runTimeMS,str); + LCR_gameTimeToStr(LCR_timeTicksToMS(LCR_game.runTime),str); LCR_gamePopupMessage(str); } else if (events & LCR_RACING_EVENT_FINISHED && @@ -1464,7 +1464,7 @@ uint8_t LCR_gameStep(uint32_t time) { LCR_LOG1("finished"); - if (LCR_game.runTimeMS <= LCR_currentMap.targetTime * LCR_RACING_TICK_MS) + if (LCR_game.runTime <= LCR_currentMap.targetTime) LCR_gameSaveReplay(); LCR_audioPlaySound(LCR_SOUND_CLICK); @@ -1492,7 +1492,7 @@ uint8_t LCR_gameStep(uint32_t time) (engineIntensity < 256 ? engineIntensity : 255)); if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED) - LCR_game.runTimeMS = LCR_racingGetRunTimeMS(); + LCR_game.runTime = LCR_racing.tick; LCR_game.nextRacingTickTime += LCR_RACING_TICK_MS; } diff --git a/media/manual.txt b/media/manual.txt index 148bc8e..47de801 100644 --- a/media/manual.txt +++ b/media/manual.txt @@ -141,9 +141,7 @@ and/or flipped. Additionally each block also has a material (concrete, grass, ...). The finish, checkpoints and car start position can also be seen as block. The format of the map data string is described in the map.h file, refer to it -for further detail. In short: TODO - - +for details. In short: TODO Under the asset directory there is a helper file for Blender (a FOSS 3D editor) with which a map layout can be comfortably created. But Blender is not required diff --git a/racing.h b/racing.h index 1531d8e..2c47890 100644 --- a/racing.h +++ b/racing.h @@ -144,12 +144,9 @@ struct } replay; } LCR_racing; -/** - Gets times of the run in milliseconds. -*/ -uint32_t LCR_racingGetRunTimeMS() +uint32_t LCR_timeTicksToMS(uint32_t ticks) { - return LCR_racing.tick * LCR_RACING_TICK_MS; + return ticks * LCR_RACING_TICK_MS; } TPE_Vec3 _LCR_TPE_vec3DividePlain(TPE_Vec3 v, TPE_Unit d)