Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Rider: platforms that touch the track fall from the start, the endless start on its slope
Mason363471251b9c0b4
diff --git a/games/rider/Makefile b/games/rider/Makefileindex a1fe53e8..a32eda48 100644--- a/games/rider/Makefile+++ b/games/rider/Makefile@@ -92,8 +92,8 @@ data:# on a computer: tests/play.c checks the game and saves picturesHOST_SAN = -fsanitize=address,undefined -fno-sanitize-recover=undefined-HOST_FLAGS = -std=gnu11 -O1 -g -Wall -Wextra -Wno-unused-parameter -DHOST -I$(L) -Isrc $(B2) $(HOST_ARENA) $(HOST_SAN)-HOST_CXXFLAGS = -std=gnu++11 -O2 -g -Wall -Wno-unused-parameter -Wno-unused-variable -Wno-unused-but-set-variable \+HOST_FLAGS = -std=gnu11 -O1 -g -ffp-contract=off -Wall -Wextra -Wno-unused-parameter -DHOST -I$(L) -Isrc $(B2) $(HOST_ARENA) $(HOST_SAN)+HOST_CXXFLAGS = -std=gnu++11 -O2 -g -ffp-contract=off -Wall -Wno-unused-parameter -Wno-unused-variable -Wno-unused-but-set-variable \-Wno-unused-private-field -DHOST -Isrc -fno-exceptions -fno-rtti $(B2) $(HOST_ARENA) $(HOST_SAN)HOST_PHYS = $(patsubst src/%.cpp,build/host/%.o,$(PHYS))host: build/playdiff --git a/games/rider/src/data.h b/games/rider/src/data.hindex d41f8c5b..90a9e0a1 100644--- a/games/rider/src/data.h+++ b/games/rider/src/data.h@@ -5643,102 +5643,102 @@ static const rd_track rd_tracks[144] = {{1922, 29, 2560, 68.5817f, 1275.45f, 0.0f, 2441}, /* level-BE */{1951, 45, 3840, 65.9974f, 1296.36f, 0.0f, 3753}, /* level-BF */{1996, 28, 4448, 57.0319f, 1075.91f, 0.0f, 4140}, /* level-V */- {2024, 11, 576, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunkStart01 */- {2035, 13, 1504, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk001 */- {2048, 14, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk002 */- {2062, 23, 1632, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk003 */- {2085, 24, 2432, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk004 */- {2109, 15, 1696, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk005 */- {2124, 27, 2240, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk006 */- {2151, 28, 1536, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk009 */- {2179, 17, 1056, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk010 */- {2196, 27, 1088, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk011 */- {2223, 19, 928, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk012 */- {2242, 24, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk014 */- {2266, 12, 1248, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk015 */- {2278, 20, 1216, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk016 */- {2298, 15, 1248, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk017 */- {2313, 20, 1024, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk018 */- {2333, 21, 960, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk019 */- {2354, 28, 2240, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk021 */- {2382, 15, 1472, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk023 */- {2397, 22, 1600, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk025 */- {2419, 39, 2176, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk026 */- {2458, 27, 2240, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk027 */- {2485, 17, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk028 */- {2502, 17, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk030 */- {2519, 23, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk031 */- {2542, 20, 1088, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk032 */- {2562, 17, 1152, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk033 */- {2579, 33, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk034 */- {2612, 14, 1056, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk035 */- {2626, 22, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk036 */- {2648, 21, 1472, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk037 */- {2669, 21, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk038 */- {2690, 24, 1056, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk039 */- {2714, 24, 1888, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk042 */- {2738, 17, 896, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk044 */- {2755, 14, 1728, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk046 */- {2769, 21, 1216, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk051 */- {2790, 27, 1568, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk054 */- {2817, 20, 1056, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk056 */- {2837, 21, 1056, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk057 */- {2858, 28, 1632, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk058 */- {2886, 35, 1536, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk059 */- {2921, 29, 1856, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk060 */- {2950, 20, 1568, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk061 */- {2970, 37, 2496, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk063 */- {3007, 14, 896, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk066 */- {3021, 27, 2944, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk067 */- {3048, 38, 3104, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk068 */- {3086, 21, 1312, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk071 */- {3107, 19, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk074 */- {3126, 19, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk075 */- {3145, 19, 1760, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk076 */- {3164, 19, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk077 */- {3183, 21, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk078 */- {3204, 15, 864, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk079 */- {3219, 24, 1504, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk080 */- {3243, 14, 1120, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk081 */- {3257, 15, 832, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk083 */- {3272, 16, 1216, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk084 */- {3288, 17, 2336, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk085 */- {3305, 21, 1120, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk086 */- {3326, 14, 1248, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk087 */- {3340, 17, 1440, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk088 */- {3357, 23, 1696, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk089 */- {3380, 19, 1728, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk090 */- {3399, 23, 1408, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk091 */- {3422, 33, 2080, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk092 */- {3455, 44, 3040, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk093 */- {3499, 14, 1792, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk094 */- {3513, 28, 2144, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk096 */- {3541, 25, 2272, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk098 */- {3566, 18, 2368, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk099 */- {3584, 33, 2656, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk100 */- {3617, 36, 2688, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk101 */- {3653, 32, 2496, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk102 */- {3685, 24, 1152, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk104 */- {3709, 18, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk105 */- {3727, 13, 1344, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk106 */- {3740, 18, 1856, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk107 */- {3758, 41, 1856, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk109 */- {3799, 21, 1472, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk111 */- {3820, 21, 1280, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk112 */- {3841, 23, 1728, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk113 */- {3864, 39, 1632, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk115 */- {3903, 13, 1632, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk116 */- {3916, 18, 1632, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk117 */- {3934, 23, 1312, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk118 */- {3957, 18, 1536, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk119 */- {3975, 28, 1536, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk120 */- {4003, 19, 1952, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk121 */- {4022, 30, 1952, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk122 */- {4052, 18, 1312, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk124 */- {4070, 22, 1568, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk125 */- {4092, 30, 1888, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk127 */- {4122, 24, 2432, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk130 */- {4146, 19, 2112, 211.0f, 1133.6f, 15.0f, 0}, /* levelChunk131 */+ {2024, 11, 576, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunkStart01 */+ {2035, 13, 1504, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk001 */+ {2048, 14, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk002 */+ {2062, 23, 1632, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk003 */+ {2085, 24, 2432, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk004 */+ {2109, 15, 1696, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk005 */+ {2124, 27, 2240, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk006 */+ {2151, 28, 1536, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk009 */+ {2179, 17, 1056, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk010 */+ {2196, 27, 1088, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk011 */+ {2223, 19, 928, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk012 */+ {2242, 24, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk014 */+ {2266, 12, 1248, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk015 */+ {2278, 20, 1216, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk016 */+ {2298, 15, 1248, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk017 */+ {2313, 20, 1024, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk018 */+ {2333, 21, 960, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk019 */+ {2354, 28, 2240, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk021 */+ {2382, 15, 1472, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk023 */+ {2397, 22, 1600, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk025 */+ {2419, 39, 2176, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk026 */+ {2458, 27, 2240, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk027 */+ {2485, 17, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk028 */+ {2502, 17, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk030 */+ {2519, 23, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk031 */+ {2542, 20, 1088, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk032 */+ {2562, 17, 1152, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk033 */+ {2579, 33, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk034 */+ {2612, 14, 1056, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk035 */+ {2626, 22, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk036 */+ {2648, 21, 1472, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk037 */+ {2669, 21, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk038 */+ {2690, 24, 1056, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk039 */+ {2714, 24, 1888, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk042 */+ {2738, 17, 896, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk044 */+ {2755, 14, 1728, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk046 */+ {2769, 21, 1216, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk051 */+ {2790, 27, 1568, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk054 */+ {2817, 20, 1056, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk056 */+ {2837, 21, 1056, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk057 */+ {2858, 28, 1632, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk058 */+ {2886, 35, 1536, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk059 */+ {2921, 29, 1856, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk060 */+ {2950, 20, 1568, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk061 */+ {2970, 37, 2496, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk063 */+ {3007, 14, 896, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk066 */+ {3021, 27, 2944, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk067 */+ {3048, 38, 3104, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk068 */+ {3086, 21, 1312, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk071 */+ {3107, 19, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk074 */+ {3126, 19, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk075 */+ {3145, 19, 1760, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk076 */+ {3164, 19, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk077 */+ {3183, 21, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk078 */+ {3204, 15, 864, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk079 */+ {3219, 24, 1504, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk080 */+ {3243, 14, 1120, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk081 */+ {3257, 15, 832, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk083 */+ {3272, 16, 1216, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk084 */+ {3288, 17, 2336, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk085 */+ {3305, 21, 1120, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk086 */+ {3326, 14, 1248, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk087 */+ {3340, 17, 1440, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk088 */+ {3357, 23, 1696, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk089 */+ {3380, 19, 1728, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk090 */+ {3399, 23, 1408, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk091 */+ {3422, 33, 2080, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk092 */+ {3455, 44, 3040, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk093 */+ {3499, 14, 1792, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk094 */+ {3513, 28, 2144, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk096 */+ {3541, 25, 2272, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk098 */+ {3566, 18, 2368, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk099 */+ {3584, 33, 2656, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk100 */+ {3617, 36, 2688, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk101 */+ {3653, 32, 2496, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk102 */+ {3685, 24, 1152, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk104 */+ {3709, 18, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk105 */+ {3727, 13, 1344, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk106 */+ {3740, 18, 1856, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk107 */+ {3758, 41, 1856, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk109 */+ {3799, 21, 1472, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk111 */+ {3820, 21, 1280, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk112 */+ {3841, 23, 1728, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk113 */+ {3864, 39, 1632, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk115 */+ {3903, 13, 1632, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk116 */+ {3916, 18, 1632, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk117 */+ {3934, 23, 1312, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk118 */+ {3957, 18, 1536, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk119 */+ {3975, 28, 1536, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk120 */+ {4003, 19, 1952, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk121 */+ {4022, 30, 1952, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk122 */+ {4052, 18, 1312, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk124 */+ {4070, 22, 1568, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk125 */+ {4092, 30, 1888, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk127 */+ {4122, 24, 2432, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk130 */+ {4146, 19, 2112, 211.0f, 1226.0f, 15.0f, 0}, /* levelChunk131 */};static const uint16_t star2[48] = {1500, 1700, 1300, 1200, 1150, 1850, 1250, 1450, 1300, 1100, 1500, 1300, 900, 1050, 1850, 1200,diff --git a/games/rider/src/game.c b/games/rider/src/game.cindex 873475d9..196de256 100644--- a/games/rider/src/game.c+++ b/games/rider/src/game.c@@ -48,7 +48,7 @@#define MAX_LANDINGS 3 /* maxPlatformLandingAmount */#define MAX_FORCE 10000 /* maxRealImpactForce */#define FRAME_DUR 16.6f /* defaultFrameDurationTime */-#define BASE_TOP (1600 + 107) /* the ground base's top: groundBaseTopY + 107 on a 16:9 iPhone */+#define BASE_TOP (1600 + 111) /* the ground base's top: 115 over its centre, 960 - 230 - groundBaseTopY + 1600 */#define FALL_OUT (1600 + 800) /* fallen past it, between its blocks: gone *//* physicsObjectFilter */@@ -965,9 +965,46 @@ void run_start(rd_run *r, int mode, int level, int bike, int theme, uint32_t seer->camx = b->x - 200, r->camy = b->y - 260;}+/* platforms held by a pivot that a touch takes away, already touching the track: in the game the whole track is in+ * the physics world, so the first step's preCollision (a platform top in it) lets them go; here the track is only+ * there near the bike, so they are found by testing their polygons as Box2D's contacts would */+static void first_touches(rd_run *r, int seg) {+ float a[64], q[64];+ for (int i = 0; i < r->nlive; i++) {+ rd_live *l = &r->live[i];+ if (!(l->st & ST_USED) || l->dyn == NO_DYN || (seg >= 0 && l->seg != seg)) continue;+ rd_dyn *d = &r->dyn[l->dyn];+ const rd_obj *o = O(r, i);+ if (!(d->flags & DY_PIVOT) || !(o->flags & F_REMOVE) || d->pivot_ms >= 0) continue;+ float x0, y0, x1, y1;+ obj_box(r, i, &x0, &y0, &x1, &y1);+ bool touch = false;+ for (int j = 0; j < r->nlive && !touch; j++) {+ rd_live *m = &r->live[j];+ const rd_obj *p = O(r, j);+ if (j == i || !(m->st & ST_USED) || (m->st & ST_GONE) || p->kind == K_GEM || p->kind == K_FINISH || animated(p)) continue;+ if (o->kind != K_PLATFORM && p->kind != K_PLATFORM) continue; /* (Board's preCollision: a platform top in it) */+ float u0, v0, u1, v1;+ obj_box(r, j, &u0, &v0, &u1, &v1);+ if (u1 < x0 - 1 || u0 > x1 + 1 || v1 < y0 - 1 || v0 > y1 + 1) continue;+ for (int k = 0; !touch; k++) {+ int n = obj_poly(r, i, k, a);+ if (!n) break;+ for (int h = 0; !touch; h++) {+ int nq = obj_poly(r, j, h, q);+ if (!nq) break;+ touch = ph_polys_touch(a, n, q, nq);+ }+ }+ }+ if (touch) d->pivot_ms = r->ms + (o->delay >= 0 ? o->delay : 0);+ }+}+/* the game starts with the first touch (Board.GameStart): the physics runs, the animations start */static void game_start(rd_run *r) {r->b.started = true;+ first_touches(r, -1);for (int k = 0; k < MAXDYN; k++) {rd_dyn *d = &r->dyn[k];if (!d->used || !(d->flags & DY_ANIM)) continue;@@ -1157,7 +1194,7 @@ void run_step(rd_run *r, bool held) {b->trail_x[0] = b->wx[0], b->trail_y[0] = b->wy[0];/* the endless run goes on */if (r->mode == RUN_ENDLESS)- while (r->end_x < b->x + 2400) endless_more(r);+ while (r->end_x < b->x + 2400) endless_more(r), first_touches(r, r->nseg - 1);base_stream(r);stream(r, false);/* the camera: the bike a third in, a little below the middle */diff --git a/games/rider/src/phys.cpp b/games/rider/src/phys.cppindex 5ec66916..a4b2333b 100644--- a/games/rider/src/phys.cpp+++ b/games/rider/src/phys.cpp@@ -319,6 +319,21 @@ bool ph_bounds(const ph_body *b, float *x0, float *y0, float *x1, float *y1) {return any;}+/* two polygons (in the world's pixels) touching as Box2D's contacts count it: a manifold with points */+bool ph_polys_touch(const float *a, int na, const float *b, int nb) {+ if (na < 3 || nb < 3 || na > b2_maxPolygonVertices || nb > b2_maxPolygonVertices) return false;+ b2Vec2 va[b2_maxPolygonVertices], vb[b2_maxPolygonVertices];+ for (int i = 0; i < na; i++) va[i].Set(a[2 * i] / SCALE, a[2 * i + 1] / SCALE);+ for (int i = 0; i < nb; i++) vb[i].Set(b[2 * i] / SCALE, b[2 * i + 1] / SCALE);+ b2PolygonShape sa, sb;+ if (!sa.Set(va, na) || !sb.Set(vb, nb)) return false;+ b2Transform id;+ id.SetIdentity();+ b2Manifold m;+ b2CollidePolygons(&m, &sa, id, &sb, id);+ return m.pointCount > 0;+}+/* Corona's frame-based step: dt = 1/fps (60, config.lua), 8 velocity and 3 position iterations */void ph_step(void) { world->Step(1.0f / 60, 8, 3); }diff --git a/games/rider/src/phys.h b/games/rider/src/phys.hindex efe33e84..def89b1c 100644--- a/games/rider/src/phys.h+++ b/games/rider/src/phys.h@@ -83,6 +83,7 @@ bool ph_awake(const ph_body *b);bool ph_bounds(const ph_body *b, float *x0, float *y0, float *x1, float *y1); /* its fixtures' boxes, false if none */void ph_step(void);+bool ph_polys_touch(const float *a, int na, const float *b, int nb);#ifdef __cplusplus}diff --git a/games/rider/tests/play.c b/games/rider/tests/play.cindex d8b1d217..1d05660f 100644--- a/games/rider/tests/play.c+++ b/games/rider/tests/play.c@@ -154,7 +154,8 @@ static bool bot(const rd_run *r, int flips) {/* a level ridden by search: pieces of 15 frames, a few ways to hold the button in each, the furthest* still riding kept; returns the frames' button in path (1 held), or 0 if none got to the end.* A state is the run and Box2D's arena, copied away and back. */-#define SEG 15+static int seg_len = 15; /* (the search tries 15, then 11: the path is replayed with the one that worked) */+#define SEG seg_len#ifndef BEAM#define BEAM 20#endif@@ -253,11 +254,13 @@ static int solve_from(int mode, int level, int bike, uint32_t seed, uint8_t *out}static int solve_run(int mode, int level, int bike, uint32_t seed, uint8_t *out, int max_segs) {int n = 0;- for (int k = 0; k < (mode == RUN_LEVEL ? 2 : 1) && !n; k++) {- spread = k ? BEAM : 3; /* (then the plain furthest ones) */- for (int w = 0; w < (mode == RUN_LEVEL ? 8 : 1) && !n; w++) n = solve_from(mode, level, bike, seed, out, max_segs, w);+ for (int k = 0; k < (mode == RUN_LEVEL ? 4 : 1) && !n; k++) {+ spread = k & 1 ? BEAM : 3; /* (then the plain furthest ones) */+ seg_len = k < 2 ? 15 : 11;+ for (int w = 0; w < (mode == RUN_LEVEL ? 8 : 1) && !n; w++) n = solve_from(mode, level, bike, seed, out, max_segs * 15 / seg_len, w);}spread = 3;+ if (!n) seg_len = 15;return n;}static int solve_level(int level, uint8_t *out, int max_segs) { return solve_run(RUN_LEVEL, level, 0, 9, out, max_segs); }@@ -288,16 +291,18 @@ static void test_levels(void) {/* flipping all the time ends on the bike's head */int e = ride(RUN_ENDLESS, 0, 9, 60 * 60, 0);CHECK(e == END_CRASH, "holding the button for ever crashes (%d)", e);- /* the endless run: pieces keep coming, flips are counted */- int best = 0, flips = 0;+ /* the endless run: pieces keep coming, flips are counted (a bot on every bike, then the search's ride) */+ int far = 0;for (int s = 0; s < 20; s++) {rd_run *r = &run;run_start(r, RUN_ENDLESS, 0, s % NBIKES, 6 + s % 10, 100 + (uint32_t)s);- for (int i = 0; i < 60 * 90 && !r->ended; i++) run_step(r, bot(r, 1));- best = r->score > best ? r->score : best, flips += r->flips;+ for (int i = 0; i < 60 * 90 && !r->ended; i++) run_step(r, bot(r, 0));+ if (r->b.max_x > far) far = (int)r->b.max_x;}- printf("endless: best %d, %d flips in 20 runs\n", best, flips);- CHECK(flips > 0, "flips in the endless run");+ for (uint32_t sd = 33; sd < 37 && !run.flips; sd++) solve_run(RUN_ENDLESS, 0, 0, sd, path, 60);+ printf("endless: a bot as far as x %d; the search's ride: score %d, %d flips, %d perfect\n", far, run.score, run.flips, run.perfect);+ CHECK(far > 3000, "the endless run goes on (%d)", far);+ CHECK(run.flips > 0 && run.score + run.pending > 0, "flips counted in the endless run");}/* ---------------------------------------------------------------- the app, with keys */diff --git a/games/rider/tools/data.py b/games/rider/tools/data.pyindex e3764dce..3b1ed356 100644--- a/games/rider/tools/data.py+++ b/games/rider/tools/data.py@@ -135,9 +135,9 @@ def track(path, kind):[int(round(pvx)), int(round(pvy)), delay])if start is None:# the endless run (Board.create): startX = -0.6 x 640 + 275, startY = 480 - 350, in the first piece's frame- # (it starts at x -320, y groundBaseTopY - 1600, groundBaseTopY = 0.525 x 1136 on a 16:9 iPhone);- # startRotation unset: startingCharacterRotation- start = (-0.6 * 640 + 275 + 320, 480 - 350 - (0.525 * 1136 - 1600), cfg['startingCharacterRotation'])+ # (it starts at x -320, y groundBaseTopY - 1600, groundBaseTopY = 0.525 x the screen's height: 960, the+ # game's own 640 x 960, which sets the bike just over the slope); startRotation unset: startingCharacterRotation+ start = (-0.6 * 640 + 275 + 320, 480 - 350 - (0.525 * 960 - 1600), cfg['startingCharacterRotation'])tracks.append([first, len(objs) - first, int(width), ff(start[0]), ff(start[1]), ff(start[2]),int(round(finish)) if finish is not None else 0])for l in levels: track(APP + '/data/levels/%s.json' % l, 'level')