P7.2 fix: reset per-gem landing state on restart
The restart button (BoardView.do_restart) reseeded the model and dropped selection/drag/anim/FX, but left GemMotion.land_at carrying the prior move's landing stamps. A restart fired right after a terminal cascade therefore replayed that move's squash-bounce on the freshly seeded board instead of showing a clean resting pose. Factor the landing reset into GemMotion.reset_landings (init now delegates to it) and call it from do_restart, so a restart returns every cell to its resting idle pose. The idle clock keeps running, so the always-on idle simply resumes from rest. Regression: tests/gem_pose.sx section 7 stamps a cell mid-squash, asserts it is squashing, then asserts reset_landings returns every cell to rest while leaving the clock untouched. Fails on the pre-fix (no-op reset) behaviour, passes after. Gate green: ios-sim build + 18/18 logic tests.
This commit is contained in:
@@ -103,6 +103,14 @@ GemMotion :: struct {
|
||||
init :: (self: *GemMotion) {
|
||||
self.clock = 0.0;
|
||||
self.pinned = false;
|
||||
self.reset_landings();
|
||||
}
|
||||
|
||||
// Drop every landing stamp back to the never-landed sentinel so no cell
|
||||
// carries a squash-bounce. `restart` calls this so a reseeded board starts at
|
||||
// its resting pose instead of replaying the prior move's landing wobble; the
|
||||
// idle clock keeps running, so the always-on idle simply resumes from rest.
|
||||
reset_landings :: (self: *GemMotion) {
|
||||
for 0..BOARD_CELLS: (i) { self.land_at[i] = -1000.0; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user