diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt index 0d022ba5..acaf7c98 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt @@ -133,6 +133,7 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit, onExi writeSetting = { key, on -> update { d -> d.withGame(game.id) { it.copy(settings = it.settings + (key to on)) } } }, writeLevel = { key, value -> update { d -> d.withGame(game.id) { it.copy(level = it.level + (key to value)) } } }, onRunEnd = { end -> update { recordRun(it, game.id, game.scoreKind, end, System.currentTimeMillis()) } }, + onRunEndIn = { table, end -> if (table in scoreTables(game.id)) update { recordRun(it, table, game.scoreKind, end, System.currentTimeMillis()) } }, onLeave = { session = SessionState.Exited; playing = null }, difficulty = difficultyFor(data, profile.kind), autoFire = autoFireFor(data), reduceFlashing = reduceFlashingFor(data), kept = record.kept, writeKept = { values -> update { d -> d.withGame(game.id) { it.copy(kept = it.kept + values) } } }) @@ -193,7 +194,8 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit, onExi if (page == ArcadePage.Play) chosen?.let { InfoPanel(it, data.game(it.id), household, note.takeIf { _ -> !it.launchable }) } KeyFooter(when (page) { ArcadePage.Play -> listOf(Control("◀▶▲▼", "Browse"), Control("OK", "Play"), Control("Menu", "Game settings"), Control("Back", "Orbit TV")) - ArcadePage.HighScores -> listOf(Control("▲▼", "Choose a game"), Control("OK", "See top 10"), Control("Back", "Orbit TV")) + ArcadePage.HighScores -> listOfNotNull(Control("▲▼", "Choose a game"), Control("◀▶", "BumbleHive Normal / Hard").takeIf { visible.any { it.id == ArcadeGames.Hive.id } }, + Control("OK", "See top 10"), Control("Back", "Orbit TV")) else -> listOf(Control("▲▼", "Choose"), Control("OK", "Select"), Control("Back", "Orbit TV")) }, note = if (profile.kind == ProfileKind.Kids && page == ArcadePage.Play) "Kids profile: only Kids games are shown" else null) } diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePages.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePages.kt index bc6d1b1f..fdd617d0 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePages.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePages.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.onFocusChanged +import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -39,6 +40,8 @@ private fun PageTitle(title: String, line: String) { @Composable internal fun HighScoresPage(profile: Profile, visible: List, data: ArcadeProfileData, household: Map) { var topTen by remember { mutableStateOf(null) } + // BumbleHive's row shows Normal's table or Hard's, switched with ◀▶ (Hard has its own High Scores). + var hiveHard by remember { mutableStateOf(false) } val now = remember { System.currentTimeMillis() } PageTitle("HIGH SCORES", "${profile.name}, on this TV") Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(10.dp)) { @@ -47,7 +50,11 @@ internal fun HighScoresPage(profile: Profile, visible: List, data: A Text("Game", Modifier.weight(1f), color = ArcadeColours.Muted, fontSize = 12.sp) listOf("Your best" to 90, "2nd" to 64, "3rd" to 64, "Played" to 64).forEach { (t, w) -> Text(t, Modifier.width(w.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1) } } - visible.forEach { g -> ScoreRow(g, data.game(g.id), now) { topTen = g } } + visible.forEach { g -> + val table = scoreTable(g, hiveHard) + ScoreRow(g, data.game(table), now, tableLabel = scoreTableLabel(g, hiveHard), + onSide = if (scoreTables(g.id).size > 1) { _ -> hiveHard = !hiveHard } else null) { topTen = g } + } } Column(Modifier.width(150.dp).fillMaxHeight().background(ArcadeColours.PanelDeep.copy(alpha = .85f), RoundedCornerShape(10.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(10.dp)).padding(8.dp)) { Text("🔒 Household Records", color = ArcadeColours.Cyan, fontSize = 13.sp, fontWeight = FontWeight.SemiBold) @@ -55,21 +62,42 @@ internal fun HighScoresPage(profile: Profile, visible: List, data: A visible.forEach { g -> Text(householdLine(g, household) ?: "—", Modifier.fillMaxWidth().height(rowHeight).padding(top = 3.dp), color = ArcadeColours.Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, textAlign = androidx.compose.ui.text.style.TextAlign.End) } } } - topTen?.let { g -> TopTen(g, data.game(g.id), now, onClose = { topTen = null }) } + topTen?.let { g -> TopTen(g, data.game(scoreTable(g, hiveHard)), now, title = scoreTableTitle(g, hiveHard), onClose = { topTen = null }) } } +/** Which High Scores table a game's row shows: BumbleHive Hard's when chosen, otherwise the game's own. */ +internal fun scoreTable(game: ArcadeGame, hard: Boolean): String = if (hard && scoreTables(game.id).size > 1) HIVE_HARD_SCORES else game.id + +/** The switch on BumbleHive's row, so it's always clear which table is showing; null for games with one table. */ +internal fun scoreTableLabel(game: ArcadeGame, hard: Boolean): String? = if (scoreTables(game.id).size > 1) (if (hard) "◀ HARD ▶" else "◀ Normal ▶") else null + +/** The Top 10's heading. */ +internal fun scoreTableTitle(game: ArcadeGame, hard: Boolean): String = game.title.uppercase() + (if (scoreTables(game.id).size > 1 && hard) " HARD" else "") + " · TOP 10" + private val rowHeight = 22.dp @Composable -private fun ScoreRow(game: ArcadeGame, record: GameRecord, now: Long, onOpen: () -> Unit) { +private fun ScoreRow(game: ArcadeGame, record: GameRecord, now: Long, tableLabel: String? = null, onSide: ((Int) -> Unit)? = null, onOpen: () -> Unit) { var focused by remember { mutableStateOf(false) } val corner = RoundedCornerShape(6.dp) val runs = rankRuns(record.runs, game.scoreKind) Row(Modifier.fillMaxWidth().height(rowHeight).onFocusChanged { focused = it.isFocused }.background(if (focused) ArcadeColours.FocusFill else ArcadeColours.Panel.copy(alpha = .35f), corner) - .border(if (focused) 2.dp else 0.dp, if (focused) ArcadeColours.Yellow else ArcadeColours.Panel, corner).clickable(onClick = onOpen).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) { + .border(if (focused) 2.dp else 0.dp, if (focused) ArcadeColours.Yellow else ArcadeColours.Panel, corner).then(if (onSide != null) Modifier.onPreviewKeyEvent { e -> + val k = e.nativeKeyEvent + val side = when (k.keyCode) { android.view.KeyEvent.KEYCODE_DPAD_LEFT -> -1; android.view.KeyEvent.KEYCODE_DPAD_RIGHT -> 1; else -> 0 } + if (side != 0 && k.action == android.view.KeyEvent.ACTION_DOWN) onSide(side) + side != 0 + } else Modifier) + .clickable(onClick = onOpen).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) { Canvas(Modifier.size(16.dp)) { drawMascot(game.mascot, center, size.minDimension * .4f) } Spacer(Modifier.width(6.dp)) - Text(game.title, Modifier.weight(1f), color = ArcadeColours.Ink, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + Text(game.title, Modifier.weight(1f, fill = tableLabel == null), color = ArcadeColours.Ink, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + if (tableLabel != null) { + val hard = tableLabel.contains("HARD") + Text(tableLabel, Modifier.padding(start = 6.dp).background(if (hard) ArcadeColours.Pink else ArcadeColours.Panel, RoundedCornerShape(8.dp)).padding(horizontal = 6.dp), + color = ArcadeColours.Ink, fontSize = 11.sp, fontWeight = FontWeight.Bold, maxLines = 1) + Spacer(Modifier.weight(1f)) + } val best = bestLine(game, record) if (best == null) Text(if (game.launchable) "Not played yet" else "Coming soon", Modifier.width(282.dp), color = ArcadeColours.Muted, fontSize = 12.sp) else { @@ -83,14 +111,14 @@ private fun ScoreRow(game: ArcadeGame, record: GameRecord, now: Long, onOpen: () } @Composable -private fun TopTen(game: ArcadeGame, record: GameRecord, now: Long, onClose: () -> Unit) { +private fun TopTen(game: ArcadeGame, record: GameRecord, now: Long, title: String = "${game.title.uppercase()} · TOP 10", onClose: () -> Unit) { val close = remember { FocusRequester() } LaunchedEffect(Unit) { runCatching { close.requestFocus() } } BackHandler(onBack = onClose) ArcadeScrim { Column(Modifier.width(320.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { - Text("${game.title.uppercase()} · TOP 10", color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp) + Text(title, color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp) if (game.scoreKind == ScoreKind.Wins || game.scoreKind == ScoreKind.Solved) Text(formatScore(game.scoreKind, record.count) + " in all", color = ArcadeColours.Yellow, fontSize = 14.sp, fontWeight = FontWeight.SemiBold) val runs = rankRuns(record.runs, game.scoreKind) if (runs.isEmpty()) Text("Nothing saved yet.", color = ArcadeColours.Muted, fontSize = 13.sp) diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePlay.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePlay.kt index 09ff69d5..387c9128 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePlay.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadePlay.kt @@ -32,6 +32,8 @@ internal class ArcadePlay( /** What the game keeps through a level reset ([GameRecord.kept]), and where it writes it. */ val kept: Map = emptyMap(), private val writeKept: (Map) -> Unit = {}, + /** Saves a run into another of the game's High Scores tables ([scoreTables]): BumbleHive Hard's. */ + val onRunEndIn: (String, RunEnd) -> Unit = { _, end -> onRunEnd(end) }, ) { fun setting(key: String) = readSetting(key) fun setSetting(key: String, on: Boolean) = writeSetting(key, on) diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeStore.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeStore.kt index 3cf31e8b..bc992eed 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeStore.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeStore.kt @@ -87,6 +87,15 @@ internal fun recordRun(data: ArcadeProfileData, gameId: String, kind: ScoreKind, internal fun markPlayed(data: ArcadeProfileData, gameId: String, nowMs: Long): ArcadeProfileData = data.withGame(gameId) { it.copy(lastPlayedMs = nowMs) }.copy(recent = (listOf(gameId) + data.recent.filter { it != gameId }).take(6)) +/** + * BumbleHive Hard's own High Scores table (Paul, 8 November 2026): its runs are kept under this record id, apart from + * Normal's (the game's own id, "Hive"), so the two never mix. It isn't a game of its own: it has no card or settings. + */ +internal const val HIVE_HARD_SCORES = "HiveHard" + +/** The High Scores tables a game keeps: BumbleHive has Normal's and Hard's; every other game has one. */ +internal fun scoreTables(gameId: String): List = if (gameId == "Hive") listOf("Hive", HIVE_HARD_SCORES) else listOf(gameId) + /** The four things the Reset screen can do, each confirmed on its own. */ internal enum class ResetAction(val title: String) { RestartLevel("Restart level"), ResetLevelProgress("Reset level progress"), ClearHighScores("Clear high scores"), ResetSettings("Reset settings") @@ -96,7 +105,8 @@ internal enum class ResetAction(val title: String) { internal fun applyReset(data: ArcadeProfileData, gameId: String, action: ResetAction, nowMs: Long): ArcadeProfileData = when (action) { ResetAction.RestartLevel -> data ResetAction.ResetLevelProgress -> data.withGame(gameId) { it.copy(level = emptyMap(), unlocks = emptySet(), levelsResetMs = nowMs) } - ResetAction.ClearHighScores -> data.withGame(gameId) { it.copy(runs = emptyList(), count = 0, scoresResetMs = nowMs) } + // Clearing BumbleHive's high scores clears both its tables, Normal and Hard. + ResetAction.ClearHighScores -> scoreTables(gameId).fold(data) { d, id -> d.withGame(id) { it.copy(runs = emptyList(), count = 0, scoresResetMs = nowMs) } } ResetAction.ResetSettings -> data.withGame(gameId) { it.copy(settings = emptyMap(), howToEveryTime = false, settingsResetMs = nowMs) } } diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/hive/BumbleHiveScreen.kt b/android/app/src/main/java/tv/orbit/classic/arcade/hive/BumbleHiveScreen.kt index d901913b..9c8a3ee0 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/hive/BumbleHiveScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/hive/BumbleHiveScreen.kt @@ -43,6 +43,14 @@ import tv.orbit.classic.arcade.rememberRun import java.io.File import java.util.concurrent.atomic.AtomicBoolean +/** + * Where a finished BumbleHive run is saved: Normal's into the game's own High Scores (as before), Hard's only into + * [tv.orbit.classic.arcade.HIVE_HARD_SCORES]. + */ +internal class HiveRunRouter(private val normal: (RunEnd) -> Unit, private val table: (String, RunEnd) -> Unit) { + fun report(mode: HiveMode, end: RunEnd) { if (mode == HiveMode.Hard) table(tv.orbit.classic.arcade.HIVE_HARD_SCORES, end) else normal(end) } +} + /** game.js ran at the screen's frame rate; the port runs its rules on a fixed 60 Hz step, at most five steps a frame. */ internal class HiveClock { private var acc = 0.0 @@ -115,8 +123,9 @@ internal fun BumbleHiveScreen(play: ArcadePlay) { var liveLevel by remember { mutableIntStateOf(0) } var liveScore by remember { mutableIntStateOf(0) } var liveMode by remember { mutableStateOf(HiveMode.Normal) } - fun detail(level: Int, mode: HiveMode) = if (mode == HiveMode.Hard) "Level $level · Hard" else "Level $level" - val run = rememberRun(play.onRunEnd) { RunEnd(liveScore, finished = false, detail = detail(liveLevel, liveMode)) } + // Each mode's runs go to its own High Scores table: Normal's as before, Hard's apart (never mixed). + val router = remember { HiveRunRouter({ latestPlay.onRunEnd(it) }, { table, end -> latestPlay.onRunEndIn(table, end) }) } + val run = rememberRun({ end -> router.report(liveMode, end) }) { RunEnd(liveScore, finished = false, detail = "Level $liveLevel") } val tones = remember { arrayOfNulls(Sfx.COUNT) } val save = remember { readHiveSave(play.level, play.kept, play::setting) } val saver = remember { HiveSaver { latestPlay }.also { it.prime(save) } } @@ -126,7 +135,7 @@ internal fun BumbleHiveScreen(play: ArcadePlay) { override fun sound(id: Int) { val f = tones[id] ?: return; latestPlay.audio.cueFile(f, 1f, save.sound) } override fun persist() = saver.write(save) override fun runStart(level: Int) { liveLevel = level; liveScore = 0; liveMode = simRef[0]?.mode ?: HiveMode.Normal; run.begin() } - override fun runEnd(level: Int, score: Int, finished: Boolean) { liveScore = score; run.end(RunEnd(score, finished, detail(level, simRef[0]?.mode ?: HiveMode.Normal))) } + override fun runEnd(level: Int, score: Int, finished: Boolean) { liveScore = score; run.end(RunEnd(score, finished, "Level $level")) } override fun leave() = latestPlay.onLeave() } } diff --git a/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveScoresTest.kt b/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveScoresTest.kt new file mode 100644 index 00000000..1cf56c5f --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveScoresTest.kt @@ -0,0 +1,89 @@ +package tv.orbit.classic.arcade.hive + +import org.json.JSONObject +import org.junit.Assert.* +import org.junit.Test +import tv.orbit.classic.arcade.ArcadeGames +import tv.orbit.classic.arcade.ArcadeProfileData +import tv.orbit.classic.arcade.ArcadeRun +import tv.orbit.classic.arcade.GameRecord +import tv.orbit.classic.arcade.HIVE_HARD_SCORES +import tv.orbit.classic.arcade.ResetAction +import tv.orbit.classic.arcade.RunEnd +import tv.orbit.classic.arcade.ScoreKind +import tv.orbit.classic.arcade.applyReset +import tv.orbit.classic.arcade.decodeArcade +import tv.orbit.classic.arcade.encodeArcade +import tv.orbit.classic.arcade.recordRun +import tv.orbit.classic.arcade.scoreTable +import tv.orbit.classic.arcade.scoreTableLabel +import tv.orbit.classic.arcade.scoreTableTitle +import tv.orbit.classic.arcade.scoreTables + +/** BumbleHive Hard has its own High Scores table (Paul, 8 November 2026); Normal's stays exactly as it was. */ +class HiveScoresTest { + /** A profile's file as it is today: Normal BumbleHive runs, levels and settings, and another game. */ + private val existing = ArcadeProfileData("p2abc9") + .withGame("Hive") { GameRecord(runs = listOf(ArcadeRun(2400, 1_000L, "Level 12"), ArcadeRun(1900, 2_000L, "Level 11")), level = mapOf("normal" to "{\"unlocked\":12}"), + settings = mapOf("sound" to true), firstRunSeen = true, lastPlayedMs = 2_000L) } + .withGame("Snake") { GameRecord(runs = listOf(ArcadeRun(140, 3_000L))) } + + @Test fun eachModeReportsToItsOwnTableOnly() { + val normal = ArrayList(); val tables = ArrayList>() + val router = HiveRunRouter({ normal += it }, { t, e -> tables += t to e }) + router.report(HiveMode.Normal, RunEnd(500, true, "Level 3")) + router.report(HiveMode.Hard, RunEnd(800, true, "Level 2")) + assertEquals(listOf(RunEnd(500, true, "Level 3")), normal) + assertEquals(listOf(HIVE_HARD_SCORES to RunEnd(800, true, "Level 2")), tables) + } + + @Test fun hardRunsNeverReachNormalsTableAndNormalsDataIsUntouched() { + val before = existing.game("Hive") + val beforeFile = JSONObject(encodeArcade(existing)).getJSONObject("games").getJSONObject("Hive").toString() + var d = existing + for (i in 1..12) d = recordRun(d, HIVE_HARD_SCORES, ScoreKind.Points, RunEnd(9000 + i, true, "Level $i"), 10_000L + i) + // Normal's record is the same object's worth, field for field, and the same in the file. + assertEquals(before, d.game("Hive")) + val back = decodeArcade(encodeArcade(d), "p2abc9")!! + assertEquals(beforeFile, JSONObject(encodeArcade(back)).getJSONObject("games").getJSONObject("Hive").toString()) + assertEquals(listOf(2400, 1900), back.game("Hive").runs.map { it.score }) + // Hard's table has its own top 10, with no Normal run in it, and no "· Hard" marker needed. + val hard = back.game(HIVE_HARD_SCORES).runs + assertEquals(10, hard.size) + assertTrue(hard.all { it.score > 9000 && it.detail?.contains("Hard") == false }) + // And Normal runs never reach Hard's. + val n = recordRun(back, "Hive", ScoreKind.Points, RunEnd(3000, true, "Level 13"), 99_999L) + assertEquals(back.game(HIVE_HARD_SCORES), n.game(HIVE_HARD_SCORES)) + assertEquals(3000, n.game("Hive").runs.first().score) + } + + @Test fun aFileFromBeforeHasAnEmptyHardTable() { + val old = decodeArcade(encodeArcade(existing), "p2abc9")!! + assertTrue(old.game(HIVE_HARD_SCORES).runs.isEmpty()) + assertEquals(existing.game("Hive"), old.game("Hive")) + } + + @Test fun theHighScoresRowSwitchesTablesAndSaysWhichIsShowing() { + val hive = ArcadeGames.Hive + assertEquals(listOf("Hive", HIVE_HARD_SCORES), scoreTables("Hive")) + assertEquals("Hive", scoreTable(hive, hard = false)); assertEquals(HIVE_HARD_SCORES, scoreTable(hive, hard = true)) + assertEquals("◀ Normal ▶", scoreTableLabel(hive, false)); assertEquals("◀ HARD ▶", scoreTableLabel(hive, true)) + assertEquals("BUMBLEHIVE HARD · TOP 10", scoreTableTitle(hive, true)); assertEquals("BUMBLEHIVE · TOP 10", scoreTableTitle(hive, false)) + // Every other game has one table and no switch. + for (g in ArcadeGames.all.filter { it.id != "Hive" }) { + assertEquals(listOf(g.id), scoreTables(g.id)); assertEquals(g.id, scoreTable(g, true)); assertNull(scoreTableLabel(g, true)) + } + // Hard's table is not a game: no card, nothing for Kids filtering to show or hide on its own. + assertNull(ArcadeGames.byId(HIVE_HARD_SCORES)) + } + + @Test fun clearingBumbleHiveScoresClearsBothTablesAndOnlyThem() { + val d = recordRun(existing, HIVE_HARD_SCORES, ScoreKind.Points, RunEnd(700, true, "Level 1"), 5L) + val cleared = applyReset(d, "Hive", ResetAction.ClearHighScores, 6L) + assertTrue(cleared.game("Hive").runs.isEmpty()); assertTrue(cleared.game(HIVE_HARD_SCORES).runs.isEmpty()) + assertEquals(existing.game("Hive").level, cleared.game("Hive").level) + assertEquals(d.game("Snake"), cleared.game("Snake")) + val snake = applyReset(d, "Snake", ResetAction.ClearHighScores, 6L) + assertEquals(d.game("Hive"), snake.game("Hive")); assertEquals(d.game(HIVE_HARD_SCORES), snake.game(HIVE_HARD_SCORES)) + } +} diff --git a/docs/VERIFICATION-bumblehive-native.md b/docs/VERIFICATION-bumblehive-native.md index 7c3facb6..3bb14a9c 100644 --- a/docs/VERIFICATION-bumblehive-native.md +++ b/docs/VERIFICATION-bumblehive-native.md @@ -5,7 +5,18 @@ worktree `/home/pauljd/Documents/OrbitTV/orbit-arcade`. Version unchanged (0.110 a release. Nothing pushed, merged or installed; no TV or adb used; `orbit-tv` and `orbit-tv-release` left alone. What it is: `docs/bumblehive-native.md`. -## Checks +## Update: Hard's own High Scores (8 November 2026, second commit) + +Paul chose a separate High Scores table for Hard. Same Gradle run afterwards: **853 run, 24 skipped, 0 failed** (5 new in +`HiveScoresTest`), Node 28 passed, lint 0 errors and 85 warnings (unchanged, no new kinds), release APK 47,793,763 bytes +(unchanged to the byte), debug +82 bytes. + +`HiveScoresTest`: each mode reports only to its own table; a dozen Hard runs leave Normal's record and its JSON in the file +identical, and Normal runs leave Hard's alone; a file from before reads with an empty Hard table; the row's switch, label and +Top 10 title (every other game has one table and no switch, and `HiveHard` is not a game); Clear high scores clears both +BumbleHive tables and nothing else. + +## Checks (first commit) One Gradle run (`assembleDebug assembleRelease testDebugUnitTest lintDebug`, orbit-tv's `.tooling`), against `760c957` built the same way in a scratch worktree. diff --git a/docs/bumblehive-native.md b/docs/bumblehive-native.md index d48f954b..9427e973 100644 --- a/docs/bumblehive-native.md +++ b/docs/bumblehive-native.md @@ -13,7 +13,7 @@ Compose Canvas like the other Arcade games, replacing the WebView, and playing e the old localStorage, the Barlow font is read from it, and keeping it makes a rollback to the WebView build safe. - Shared Arcade parts: the pause menu (Resume, Restart Level, How to Play, Sound, Exit to Arcade), How to Play, a result card in the Arcade's style, Reduce motion, the Quiet / Wind Down sound ceiling, per-profile saves in `ArcadeStore`, - High Scores (each level played is a run; Hard runs say "· Hard"). + High Scores (each level played is a run; Hard has its own table, below). | File | What it is | |---|---| @@ -110,8 +110,17 @@ Chosen on BumbleHive's title (**MODE: NORMAL / MODE: HARD**, right of Play); rem | Layouts | the 200 levels | the same shapes, rows and random draws; with more colours the flowers are coloured differently | | Save | Normal's unlocks, stars, bests, page | its own, starting at level 1; never reads or writes Normal's | -Honeybombs, the daily spin and the skin, guide and sound choices belong to the profile, whichever mode. High Scores has one -BumbleHive list; Hard runs are marked "· Hard". +Honeybombs, the daily spin and the skin, guide and sound choices belong to the profile, whichever mode. + +### Hard's own High Scores (Paul, 8 November 2026) + +- Hard runs are saved only into a separate table, record id `HiveHard` (`HIVE_HARD_SCORES`) in the profile's Arcade file; + Normal runs stay under `Hive`, exactly as before. The two never mix, and no "· Hard" marker is needed. +- High Scores: BumbleHive's row shows a **◀ Normal ▶** / **◀ HARD ▶** switch (Hard in pink); ◀▶ on that row changes + table, and the Top 10 is headed "BUMBLEHIVE HARD · TOP 10". The footer says so when BumbleHive is visible. +- `HiveHard` isn't a game: no card, no settings, nothing extra for Kids filtering (it follows BumbleHive's visibility). +- Reset › Clear high scores for BumbleHive clears both tables; nothing else touches `HiveHard`. +- Existing files simply have no `HiveHard` yet: Normal's data is read and written unchanged. ## Known gaps