diff --git a/Makefile b/Makefile index 2cc76b1..5652c76 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,21 @@ # pxl8 - Makefile # # Usage: -# make Build everything (debug) -# make release Build everything (release) -# make run Build and run (CART=script.fnl) -# make server Build pxl8d only -# make client Build pxl8 only -# make install Install to ~/.local/bin (release) -# make profile Profile with perf + flamegraph (Linux) -# make ase Aseprite tools (ASE_CMD=package|clean) -# make clean Remove build artifacts -# make clean-all Remove build artifacts and dependencies -# make clean-deps Remove only dependencies -# make clean-cache Clear ccache -# make update Fetch/update all dependencies -# make vendor-sdl Vendor SDL3 from source -# make help Show available targets +# make Build everything (debug) +# make release Build everything (release) +# make run Build and run (CART=script.fnl) +# make demo3d-server Build demo3d server only +# make client Build pxl8 only +# make install Install to ~/.local/bin (release) +# make profile Profile with perf + flamegraph (Linux) +# make ase Aseprite tools (ASE_CMD=package|clean) +# make clean Remove build artifacts +# make clean-all Remove build artifacts and dependencies +# make clean-deps Remove only dependencies +# make clean-cache Clear ccache +# make update Fetch/update all dependencies +# make vendor-sdl Vendor SDL3 from source +# make help Show available targets # # Variables: # MODE=release Build in release mode (default: debug) @@ -173,11 +173,17 @@ endif # -- Include paths ------------------------------------------------------------ INCLUDES = \ - -Isrc/asset -Isrc/bsp -Isrc/core -Isrc/gfx -Isrc/gui -Isrc/hal \ + -Isrc/asset -Isrc/core -Isrc/gfx -Isrc/gui -Isrc/platform \ -Isrc/math -Isrc/net -Isrc/procgen -Isrc/script -Isrc/shader \ - -Isrc/sfx -Isrc/sim -Isrc/world \ + -Isrc/sfx \ -I$(LINENOISE_DIR) -Ilib/luajit/src -Ilib/miniz -I.build/shaders/c +DEMO3D_INCLUDES = \ + -Idemo3d/client/bsp \ + -Idemo3d/client/world \ + -Idemo3d/client/sim \ + -Idemo3d/client/net + # -- Source files ------------------------------------------------------------- LIB_SRCS = $(LINENOISE_SRCS) lib/miniz/miniz.c @@ -186,21 +192,19 @@ PXL8_SRCS = \ src/asset/pxl8_ase.c \ src/asset/pxl8_cart.c \ src/asset/pxl8_save.c \ - src/bsp/pxl8_bsp.c \ - src/bsp/pxl8_bsp_render.c \ src/core/pxl8.c \ src/core/pxl8_bytes.c \ src/core/pxl8_io.c \ src/core/pxl8_log.c \ src/core/pxl8_replay.c \ src/core/pxl8_rng.c \ - src/gfx/pxl8_3d_camera.c \ + src/gfx/pxl8_camera3d.c \ src/gfx/pxl8_anim.c \ src/gfx/pxl8_atlas.c \ src/gfx/pxl8_blit.c \ src/gfx/pxl8_colormap.c \ src/gfx/pxl8_dither.c \ - src/gfx/pxl8_render.c \ + src/gfx/pxl8_blit3d.c \ src/gfx/pxl8_shader_registry.c \ src/gfx/pxl8_shader_runtime.c \ src/gfx/pxl8_font.c \ @@ -215,33 +219,40 @@ PXL8_SRCS = \ src/gfx/pxl8_tilesheet.c \ src/gfx/pxl8_transition.c \ src/gui/pxl8_gui.c \ - src/hal/pxl8_hal_sdl3.c \ - src/hal/pxl8_thread_sdl3.c \ + src/platform/pxl8_platform_sdl3.c \ + src/platform/pxl8_thread_sdl3.c \ src/math/pxl8_math.c \ src/math/pxl8_noise.c \ src/net/pxl8_net.c \ - src/net/pxl8_protocol.c \ src/procgen/pxl8_graph.c \ src/script/pxl8_repl.c \ src/script/pxl8_script.c \ - src/sfx/pxl8_sfx.c \ - src/sim/pxl8_sim.c \ - src/world/pxl8_entity.c \ - src/world/pxl8_world.c \ - src/world/pxl8_world_chunk.c \ - src/world/pxl8_world_chunk_cache.c + src/sfx/pxl8_sfx.c + +DEMO3D_SRCS = \ + demo3d/client/bsp/demo3d_bsp.c \ + demo3d/client/bsp/demo3d_bsp_render.c \ + demo3d/client/world/demo3d_world.c \ + demo3d/client/world/demo3d_chunk.c \ + demo3d/client/world/demo3d_chunk_cache.c \ + demo3d/client/world/demo3d_entity.c \ + demo3d/client/sim/demo3d_sim.c \ + demo3d/client/net/demo3d_protocol.c \ + demo3d/client/net/demo3d_net.c \ + demo3d/client/demo3d.c ifeq ($(HAS_SDL3),1) - PXL8_SRCS += src/hal/pxl8_io_sdl3.c src/hal/pxl8_mem_sdl3.c + PXL8_SRCS += src/platform/pxl8_io_sdl3.c src/platform/pxl8_mem_sdl3.c else - PXL8_SRCS += src/hal/pxl8_mem.c + PXL8_SRCS += src/platform/pxl8_mem.c endif # -- Object files ------------------------------------------------------------- -LIB_OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(LIB_SRCS))) -PXL8_OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(PXL8_SRCS))) -ALL_OBJS = $(LIB_OBJS) $(PXL8_OBJS) +LIB_OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(LIB_SRCS))) +PXL8_OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(PXL8_SRCS))) +DEMO3D_OBJS = $(patsubst %.c,$(OBJDIR)/demo3d_%.o,$(notdir $(DEMO3D_SRCS))) +ALL_OBJS = $(LIB_OBJS) $(PXL8_OBJS) # -- Shader objects ----------------------------------------------------------- @@ -252,16 +263,18 @@ SHADER_INCLUDES = -Isrc/core -Isrc/gfx -Isrc/math # -- Targets ------------------------------------------------------------------ CLIENT = $(BINDIR)/pxl8$(EXE_EXT) -SERVER = $(BINDIR)/pxl8d$(EXE_EXT) +SERVER = $(BINDIR)/demo3d-server$(EXE_EXT) +DEMO3D = $(BINDIR)/demo3d$(EXE_EXT) CART ?= demo PROFILE_DURATION ?= 30 ASE_CMD ?= -.PHONY: all release client server run clean clean-all clean-deps clean-cache \ +.PHONY: all release client server demo3d demo3d-server run run-demo3d \ + clean clean-all clean-deps clean-cache \ update vendor-sdl deps luajit install ase profile help -all: client server +all: client demo3d demo3d-server release: $(MAKE) MODE=release all @@ -326,19 +339,21 @@ $(LUAJIT_LIB): lib/luajit/src/luajit.c # -- Server (Rust) ------------------------------------------------------------ -server: $(SERVER) +server: demo3d-server -$(SERVER): $(wildcard pxl8d/src/*.rs pxl8d/Cargo.toml) +demo3d-server: $(SERVER) + +$(SERVER): $(wildcard demo3d/server/src/*.rs demo3d/server/Cargo.toml) @mkdir -p $(BINDIR) - $(INFO) "Building pxl8d ($(MODE) mode)" + $(INFO) "Building demo3d-server ($(MODE) mode)" ifeq ($(MODE),release) - @cd pxl8d && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --release --quiet - @cp pxl8d/target/release/pxl8d$(EXE_EXT) $(SERVER) + @cd demo3d/server && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --release --quiet + @cp demo3d/server/target/release/demo3d-server$(EXE_EXT) $(SERVER) else - @cd pxl8d && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --quiet - @cp pxl8d/target/debug/pxl8d$(EXE_EXT) $(SERVER) + @cd demo3d/server && PATH="$$(echo $$PATH | tr ':' '\n' | grep -v '/usr/bin' | tr '\n' ':')" cargo build --quiet + @cp demo3d/server/target/debug/demo3d-server$(EXE_EXT) $(SERVER) endif - $(INFO) "Built pxl8d" + $(INFO) "Built demo3d-server" # -- Client (C23) ------------------------------------------------------------- @@ -359,6 +374,31 @@ ifeq ($(STRIP),true) endif $(INFO) "Built pxl8 -> $@" +# -- Demo3D (game client) ---------------------------------------------------- + +demo3d: deps $(DEMO3D) + +$(DEMO3D): $(ALL_OBJS) $(DEMO3D_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB) + @mkdir -p $(BINDIR) + $(INFO) "Linking demo3d" +ifeq ($(PLATFORM),windows) + @(echo EXPORTS && llvm-nm --defined-only $(ALL_OBJS) $(DEMO3D_OBJS) $(SHADER_OBJS) | grep ' T pxl8_\| T demo3d_\| T SDL' | awk '{print $$3}') > $(BUILDDIR)/demo3d.def + @MSYS_NO_PATHCONV=1 $(CC) $(LDFLAGS) $(ALL_OBJS) $(DEMO3D_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB) $(LIBS) -Wl,/DEF:$(BUILDDIR)/demo3d.def -o $@ + @cp -u $(SDL3_BUILD_DIR)/SDL3.dll $(BINDIR)/ +else + @$(CC) $(LDFLAGS) $(ALL_OBJS) $(DEMO3D_OBJS) $(SHADER_OBJS) $(LUAJIT_LIB) $(LIBS) -o $@ +endif +ifeq ($(STRIP),true) + @llvm-strip $@ +endif + $(INFO) "Built demo3d -> $@" + +run-demo3d: demo3d demo3d-server + @$(BINDIR)/demo3d-server$(EXE_EXT) & SERVER_PID=$$!; \ + sleep 0.5; \ + $(BINDIR)/demo3d$(EXE_EXT) demo3d $(EXTRA_ARGS) || true; \ + kill $$SERVER_PID 2>/dev/null; wait $$SERVER_PID 2>/dev/null || true + # -- Compile rules ------------------------------------------------------------ # Lib sources (dep flags, no warnings) @@ -385,7 +425,15 @@ $(OBJDIR)/%.o: $(1)/%.c | $(OBJDIR) @$$(CC) -c $$(CFLAGS) $$(INCLUDES) $$< -o $$@ endef -$(foreach dir,src/asset src/bsp src/core src/gfx src/gui src/hal src/math src/net src/procgen src/script src/shader src/sfx src/sim src/world,$(eval $(call PXL8_COMPILE_RULE,$(dir)))) +$(foreach dir,src/asset src/core src/gfx src/gui src/platform src/math src/net src/procgen src/script src/shader src/sfx,$(eval $(call PXL8_COMPILE_RULE,$(dir)))) + +define DEMO3D_COMPILE_RULE +$(OBJDIR)/demo3d_%.o: $(1)/%.c | $(OBJDIR) + @printf '$(CYAN)[%s CC]$(NC) %s\n' "$$$$(date +%H:%M:%S)" "$$<" + @$$(CC) -c $$(CFLAGS) $$(INCLUDES) $$(DEMO3D_INCLUDES) $$< -o $$@ +endef + +$(foreach dir,demo3d/client demo3d/client/bsp demo3d/client/world demo3d/client/sim demo3d/client/net,$(eval $(call DEMO3D_COMPILE_RULE,$(dir)))) # pxl8_script.o depends on embedded Lua/Fennel sources LUA_SRCS = $(wildcard src/lua/*.lua src/lua/pxl8/*.lua) lib/fennel/fennel.lua @@ -410,17 +458,14 @@ $(shell [ -f lib/.gitignore ] || echo '*' > lib/.gitignore) # -- Run ---------------------------------------------------------------------- -run: all - @$(BINDIR)/pxl8d$(EXE_EXT) & SERVER_PID=$$!; \ - sleep 0.5; \ - $(BINDIR)/pxl8$(EXE_EXT) $(CART) || true; \ - kill $$SERVER_PID 2>/dev/null; wait $$SERVER_PID 2>/dev/null || true +run: client + @$(BINDIR)/pxl8$(EXE_EXT) $(CART) $(EXTRA_ARGS) # -- Clean -------------------------------------------------------------------- clean: rm -rf .build/debug .build/release bin/debug bin/release .build/shaders - @if [ -d pxl8d ]; then cd pxl8d && cargo clean 2>/dev/null; fi || true + @if [ -d demo3d/server ]; then cd demo3d/server && cargo clean 2>/dev/null; fi || true clean-all: clean rm -rf lib @@ -458,7 +503,7 @@ profile: client TIMESTAMP=$$(date +%Y%m%d_%H%M%S); \ PDIR=.build/$(MODE)/profile; \ echo "[INFO] Starting server..."; \ - $(BINDIR)/pxl8d$(EXE_EXT) & SERVER_PID=$$!; \ + $(BINDIR)/demo3d-server$(EXE_EXT) & SERVER_PID=$$!; \ sleep 0.5; \ echo "[INFO] Profiling for $(PROFILE_DURATION)s (Ctrl+C to stop early)..."; \ perf record -F 99 -g --call-graph dwarf -o $$PDIR/perf_$$TIMESTAMP.data -- \ @@ -479,24 +524,25 @@ help: @echo "pxl8 - framework build system" @echo "" @echo "TARGETS:" - @echo " make Build everything (debug)" - @echo " make release Build everything (release)" - @echo " make run Build and run (CART=\"demo --repl\")" - @echo " make client Build pxl8 only" - @echo " make server Build pxl8d only" - @echo " make install Install to ~/.local/bin (release)" - @echo " make profile Profile with perf (PROFILE_DURATION=30, Linux only)" - @echo " make ase Aseprite tools (ASE_CMD=package|clean)" - @echo " make clean Remove build artifacts" - @echo " make clean-all Remove artifacts + dependencies" - @echo " make clean-deps Remove only dependencies" - @echo " make clean-cache Clear ccache" - @echo " make update Fetch/update all dependencies" - @echo " make vendor-sdl Vendor SDL3 from source" + @echo " make Build everything (debug)" + @echo " make release Build everything (release)" + @echo " make run Build and run (CART=\"demo --repl\")" + @echo " make client Build pxl8 only" + @echo " make demo3d-server Build demo3d client" + @echo " make server Build demo3d-server" + @echo " make install Install to ~/.local/bin (release)" + @echo " make profile Profile with perf (PROFILE_DURATION=30, Linux only)" + @echo " make ase Aseprite tools (ASE_CMD=package|clean)" + @echo " make clean Remove build artifacts" + @echo " make clean-all Remove artifacts + dependencies" + @echo " make clean-deps Remove only dependencies" + @echo " make clean-cache Clear ccache" + @echo " make update Fetch/update all dependencies" + @echo " make vendor-sdl Vendor SDL3 from source" @echo "" @echo "VARIABLES:" - @echo " MODE=release Build mode (default: debug)" - @echo " CART=demo Cart or script to run" + @echo " MODE=release Build mode (default: debug)" + @echo " CART=demo Cart or script to run" # -- Auto-generated header dependencies -------------------------------------- @@ -505,7 +551,7 @@ help: # -- compile_commands.json ---------------------------------------------------- -compile_commands.json: $(LIB_SRCS) $(PXL8_SRCS) +compile_commands.json: $(LIB_SRCS) $(PXL8_SRCS) $(DEMO3D_SRCS) $(INFO) "Generating compile_commands.json" @echo '[' > $@.tmp @first=true; \ @@ -518,6 +564,11 @@ compile_commands.json: $(LIB_SRCS) $(PXL8_SRCS) if $$first; then first=false; else printf ',\n' >> $@.tmp; fi; \ printf ' {"directory":"%s","command":"clang -c %s %s","file":"%s"}' \ "$(CURDIR)" "$(CFLAGS) $(INCLUDES)" "$$f" "$$f" >> $@.tmp; \ + done; \ + for f in $(DEMO3D_SRCS); do \ + if $$first; then first=false; else printf ',\n' >> $@.tmp; fi; \ + printf ' {"directory":"%s","command":"clang -c %s %s %s","file":"%s"}' \ + "$(CURDIR)" "$(CFLAGS) $(INCLUDES)" "$(DEMO3D_INCLUDES)" "$$f" "$$f" >> $@.tmp; \ done @printf '\n]\n' >> $@.tmp @mv $@.tmp $@ diff --git a/demo/main.fnl b/demo/main.fnl index 9fe84cf..2874aa4 100644 --- a/demo/main.fnl +++ b/demo/main.fnl @@ -1,110 +1,51 @@ (local pxl8 (require :pxl8)) (local menu (require :mod.menu)) (local music (require :mod.music)) -(local first_person3d (require :mod.first_person3d)) (var time 0) -(var in-world false) -(var first_person3d-init? false) (var logo-x 256) (var logo-y 148) (var logo-dx 100) (var logo-dy 80) (var logo-sprite nil) -(var transition nil) -(var transition-to-world false) - -(fn start-transition [] - (when (not transition) - (set transition-to-world true) - (set transition (pxl8.create_transition :pixelate 0.5)) - (transition:set_color 0xFF000000) - (transition:start))) - -(fn enter-world [] - (when (first_person3d.is-ready) - (start-transition))) (global init (fn [] (pxl8.load_palette "res/sprites/pxl8_logo.ase") (set logo-sprite (pxl8.load_sprite "res/sprites/pxl8_logo.ase")) (music.init) - (menu.init) - (first_person3d.preload))) + (menu.init))) (global update (fn [dt] (when (pxl8.key_pressed "escape") - (if (menu.is-paused) - (do - (menu.hide) - (when in-world - (pxl8.set_relative_mouse_mode true))) - (if in-world - (do - (menu.show) - (pxl8.set_relative_mouse_mode false)) - (menu.toggle)))) + (menu.toggle)) (when (not (menu.is-paused)) (set time (+ time dt)) (music.update dt) - (when transition - (transition:update dt) - (when (transition:is_complete) - (when transition-to-world - (set in-world true) - (set transition-to-world false) - (pxl8.set_relative_mouse_mode true)) - (transition:destroy) - (set transition nil))) - - (if in-world - (do - (when (not first_person3d-init?) - (first_person3d.init) - (set first_person3d-init? true)) - (first_person3d.update dt)) - (do - (when (and (not (menu.is-paused)) - (first_person3d.is-ready) - (or (pxl8.key_pressed "return") (pxl8.key_pressed "space"))) - (enter-world)) - (set logo-x (+ logo-x (* logo-dx dt))) - (set logo-y (+ logo-y (* logo-dy dt))) - (when (< logo-x 0) - (set logo-x 0) - (set logo-dx (math.abs logo-dx))) - (when (> logo-x 512) - (set logo-x 512) - (set logo-dx (- (math.abs logo-dx)))) - (when (< logo-y 0) - (set logo-y 0) - (set logo-dy (math.abs logo-dy))) - (when (> logo-y 296) - (set logo-y 296) - (set logo-dy (- (math.abs logo-dy))))))) + (set logo-x (+ logo-x (* logo-dx dt))) + (set logo-y (+ logo-y (* logo-dy dt))) + (when (< logo-x 0) + (set logo-x 0) + (set logo-dx (math.abs logo-dx))) + (when (> logo-x 512) + (set logo-x 512) + (set logo-dx (- (math.abs logo-dx)))) + (when (< logo-y 0) + (set logo-y 0) + (set logo-dy (math.abs logo-dy))) + (when (> logo-y 296) + (set logo-y 296) + (set logo-dy (- (math.abs logo-dy))))) (when (menu.is-paused) (menu.update)))) (global frame (fn [] - (if in-world - (first_person3d.frame) - (do - (pxl8.clear 0) - (when logo-sprite - (pxl8.sprite logo-sprite logo-x logo-y 128 64 (< logo-dx 0) (< logo-dy 0))) - (when (not (menu.is-paused)) - (if (first_person3d.is-ready) - (pxl8.text "Press ENTER to start" 240 320 1) - (if (first_person3d.is-connected) - (pxl8.text "Loading world..." 260 320 1) - (pxl8.text "Connecting..." 275 320 1)))))) - - (when transition - (transition:render)) + (pxl8.clear 0) + (when logo-sprite + (pxl8.sprite logo-sprite logo-x logo-y 128 64 (< logo-dx 0) (< logo-dy 0))) (when (menu.is-paused) (pxl8.push_target) diff --git a/demo/mod/blendtable.fnl b/demo/mod/blendtable.fnl deleted file mode 100644 index b210921..0000000 --- a/demo/mod/blendtable.fnl +++ /dev/null @@ -1,4103 +0,0 @@ -(require :pxl8) -(local ffi (require :ffi)) - -(local data (ffi.new "u8[65536]" [ - 143 175 141 47 158 95 2 2 43 43 3 4 4 4 5 5 - 158 158 158 158 1 47 141 141 47 141 141 142 142 142 175 143 - 31 31 94 94 94 45 158 46 46 47 47 47 141 174 142 142 - 26 245 245 172 41 26 246 245 99 23 62 246 245 172 173 174 - 246 171 172 172 172 172 173 78 79 79 79 174 174 142 175 175 - 30 157 157 45 103 158 46 1 1 47 141 141 141 142 142 142 - 63 77 1 47 190 127 142 175 24 91 39 4 5 38 4 244 - 244 187 124 125 126 126 125 126 190 190 127 190 191 191 143 143 - 27 246 139 139 139 172 140 158 140 47 141 141 142 142 175 143 - 41 155 43 93 44 44 44 30 103 45 102 1 159 141 142 175 - 138 171 139 172 172 173 173 173 173 79 174 174 175 175 143 175 - 186 186 186 187 187 188 188 188 189 126 127 127 127 141 191 175 - 41 42 43 43 93 44 31 45 158 158 1 47 159 141 142 175 - 156 206 206 206 156 101 44 6 6 5 152 201 19 19 17 61 - 17 61 62 62 239 239 171 76 76 77 77 77 78 79 174 174 - 171 137 139 189 127 175 141 39 25 26 172 5 3 244 169 129 - 159 47 158 95 94 2 43 3 3 4 4 4 5 5 5 6 - 101 101 245 63 102 103 103 103 103 158 158 1 47 47 159 159 - 43 43 43 93 44 2 31 94 94 45 103 103 158 1 1 1 - 155 24 26 245 40 22 62 62 17 19 21 62 246 245 63 173 - 137 169 170 170 171 171 171 172 172 172 172 173 140 47 141 141 - 42 25 93 101 101 101 30 157 45 45 103 158 46 1 47 173 - 246 245 102 95 189 158 47 79 90 88 4 5 35 5 5 4 - 244 244 187 187 124 124 124 125 126 126 126 127 127 47 159 141 - 42 24 138 138 138 138 94 94 103 103 46 46 1 47 141 141 - 39 41 41 155 155 42 43 43 44 44 30 45 103 158 1 141 - 137 137 170 246 171 171 171 63 172 172 140 140 47 141 141 190 - 185 185 185 186 186 186 187 187 188 188 189 189 158 46 1 141 - 39 41 41 155 42 43 93 44 157 157 45 102 158 1 159 159 - 205 205 204 204 20 155 156 6 33 200 200 200 16 16 60 61 - 61 61 61 61 238 238 169 239 239 239 75 76 77 173 173 173 - 170 136 137 138 95 159 140 38 136 91 245 36 4 39 168 128 - 95 95 2 2 43 3 3 3 4 4 5 5 35 6 33 33 - 42 24 25 26 101 28 44 44 44 31 31 45 45 45 95 95 - 244 3 3 3 3 3 43 43 43 2 2 2 2 94 45 157 - 40 41 155 24 153 20 21 62 83 17 98 19 23 26 101 139 - 136 168 168 169 170 170 170 246 246 246 246 139 94 103 103 103 - 39 41 42 92 42 42 43 43 43 93 2 2 94 94 45 103 - 62 62 101 2 2 2 102 172 86 134 5 35 34 34 35 5 - 4 4 186 186 121 122 124 124 124 124 188 94 45 95 95 46 - 39 41 42 92 92 92 93 93 93 29 94 94 94 45 95 158 - 4 4 4 4 39 39 41 3 3 3 43 44 2 31 45 103 - 89 136 90 137 137 24 246 246 246 246 94 94 45 103 95 189 - 185 184 185 185 185 186 186 187 187 187 2 2 2 94 45 158 - 5 4 39 39 41 155 155 155 43 43 44 30 157 45 102 158 - 202 203 203 203 154 155 41 7 7 199 200 200 55 55 55 60 - 60 60 97 61 61 168 168 168 169 169 170 170 171 139 139 139 - 168 135 136 244 2 102 94 37 134 88 24 6 5 4 88 128 - 31 2 43 3 3 4 4 4 5 5 35 33 6 33 7 7 - 155 41 41 41 155 42 43 43 43 43 43 43 2 2 2 2 - 4 4 4 4 4 39 244 3 3 3 3 3 3 43 43 93 - 37 40 154 21 152 153 18 19 51 83 84 17 99 22 42 26 - 135 135 88 87 90 90 137 137 137 24 25 27 93 93 44 29 - 38 39 41 41 41 39 41 3 3 3 3 43 43 93 2 28 - 87 21 42 3 3 43 44 101 153 37 36 33 32 33 34 35 - 35 5 4 186 185 186 187 186 186 244 244 43 2 2 2 45 - 38 39 39 39 39 41 41 3 3 3 43 43 43 44 2 31 - 5 5 5 5 4 4 4 4 39 39 3 3 43 43 43 93 - 134 85 86 88 89 90 90 91 92 92 25 93 93 29 2 188 - 183 183 184 184 185 185 185 186 244 244 244 244 3 43 2 2 - 36 5 5 5 40 40 40 40 41 155 42 43 43 44 44 157 - 202 203 201 201 152 154 154 7 8 199 199 214 150 55 55 55 - 55 60 96 96 97 98 166 167 167 168 169 169 170 26 27 138 - 135 133 134 4 3 2 27 36 37 40 41 7 6 5 135 128 - 43 3 3 4 4 4 5 5 35 33 34 33 7 7 7 8 - 39 40 40 40 39 39 41 3 3 3 3 3 3 3 3 3 - 5 5 5 5 38 4 4 4 4 4 4 4 4 3 3 3 - 36 153 153 40 150 152 152 17 150 50 82 83 85 154 41 91 - 84 84 85 85 85 86 88 89 89 41 41 42 42 3 3 43 - 5 38 38 4 4 4 4 39 4 39 39 244 3 3 244 42 - 85 18 154 39 244 3 3 42 151 131 33 7 7 32 32 33 - 34 34 5 184 184 185 186 185 186 186 244 244 244 3 3 43 - 5 38 38 38 38 38 4 39 4 39 244 3 244 244 244 43 - 6 6 6 37 5 5 5 5 38 4 4 39 244 3 3 42 - 37 133 84 85 85 85 40 40 41 41 155 3 3 3 43 187 - 33 182 183 183 183 183 5 5 4 4 4 4 4 244 3 43 - 6 36 36 36 152 153 153 153 153 154 154 41 41 3 3 156 - 201 202 201 200 200 152 5 8 8 147 196 214 214 214 49 54 - 54 55 55 51 83 83 84 166 166 167 167 88 136 136 42 137 - 133 132 132 5 4 3 42 149 151 153 40 8 7 6 132 128 - 3 3 4 4 38 5 5 35 34 7 7 7 8 8 8 9 - 5 153 153 153 40 39 39 39 4 39 39 39 4 4 4 3 - 35 35 37 5 5 5 5 38 4 4 4 4 4 4 244 3 - 6 152 152 153 149 151 151 83 49 50 50 152 153 153 40 41 - 132 83 84 84 84 84 85 86 40 40 40 39 39 39 39 244 - 37 37 37 5 5 5 38 4 38 38 4 4 4 4 4 41 - 153 153 4 4 4 4 41 41 150 130 7 8 8 8 7 7 - 33 34 35 35 183 184 185 184 185 4 4 4 4 39 244 3 - 37 37 37 5 5 5 38 4 38 4 4 4 4 244 244 3 - 33 33 33 6 6 36 37 5 5 5 38 4 4 4 39 41 - 151 82 152 152 84 153 153 153 40 39 39 39 39 244 244 244 - 32 33 33 33 33 34 35 35 5 5 5 4 4 4 4 3 - 7 6 6 150 151 152 152 152 153 153 40 4 39 39 3 155 - 196 200 200 201 200 152 6 10 9 145 146 146 147 214 49 49 - 49 54 54 50 81 51 82 84 165 85 85 85 135 40 41 136 - 132 131 131 35 4 3 41 148 150 152 153 8 7 7 131 128 - 4 4 5 5 5 35 6 33 7 7 8 8 8 9 10 9 - 36 151 152 37 5 5 38 38 38 38 4 4 4 4 4 4 - 33 34 6 35 35 35 35 35 35 5 5 5 5 38 4 4 - 149 150 150 152 148 150 150 151 48 49 49 150 151 152 5 40 - 131 82 82 82 82 132 133 153 153 38 39 38 38 38 4 4 - 34 6 6 6 36 37 37 37 35 5 5 5 5 38 4 4 - 152 152 5 5 5 4 4 40 149 129 8 8 9 9 8 7 - 7 33 33 33 34 35 183 35 35 35 5 5 38 4 4 4 - 6 33 6 35 36 35 37 5 5 5 5 38 38 4 4 4 - 7 7 7 7 33 33 6 6 6 35 37 5 5 5 4 38 - 150 50 151 151 151 152 152 37 37 38 38 4 38 4 4 4 - 32 32 32 33 32 33 34 34 35 35 35 5 5 4 4 4 - 8 7 7 149 150 150 151 152 152 152 153 5 5 4 4 39 - 196 197 197 197 199 150 6 9 9 144 145 145 146 147 147 48 - 49 49 49 49 80 80 81 82 83 83 84 133 133 38 38 135 - 131 130 130 34 5 4 40 146 149 151 151 146 8 8 130 128 - 5 5 35 6 34 33 7 7 7 8 8 8 9 10 10 10 - 150 150 150 150 6 36 37 37 5 5 5 5 5 5 5 5 - 7 32 33 33 33 33 33 33 33 34 35 35 35 5 5 5 - 148 148 148 150 146 148 148 149 146 48 148 149 149 150 6 37 - 254 49 49 80 50 50 151 151 152 37 37 5 5 5 5 5 - 7 7 7 33 33 6 34 33 34 6 35 35 5 5 5 5 - 150 150 6 6 35 5 5 5 128 128 9 9 10 9 9 8 - 9 7 32 32 33 33 32 33 35 35 35 5 5 5 5 5 - 7 7 7 33 34 6 34 34 35 35 37 5 5 5 5 5 - 8 8 8 7 7 7 7 7 33 33 34 34 34 35 5 37 - 149 254 254 150 150 150 151 36 36 37 37 5 5 5 5 5 - 9 8 32 32 32 33 32 32 33 33 34 35 35 5 5 5 - 8 8 8 147 147 148 149 150 150 151 151 6 36 5 5 5 - 196 214 196 214 196 199 7 10 10 10 144 144 144 146 146 146 - 48 48 48 48 49 49 49 80 81 81 82 132 132 37 37 37 - 129 129 128 32 35 5 38 253 148 149 149 9 9 8 129 128 - 35 6 34 33 7 7 7 8 8 9 9 10 10 10 11 11 - 7 148 7 7 7 6 6 6 6 33 33 34 34 34 34 6 - 7 7 7 7 7 7 7 7 33 6 33 33 33 33 6 6 - 8 147 147 148 145 146 147 148 146 48 48 147 148 149 6 150 - 128 48 254 49 254 254 254 150 150 150 6 33 6 6 35 5 - 7 7 8 7 7 7 7 8 34 34 34 33 33 33 34 36 - 149 149 7 33 33 34 6 36 128 146 9 10 10 10 10 9 - 8 8 8 8 32 32 32 32 33 34 33 34 34 35 5 35 - 7 7 7 7 7 7 7 8 33 34 34 34 34 6 35 5 - 9 8 9 9 8 8 7 7 8 7 7 33 6 33 34 34 - 147 48 48 148 149 149 149 7 36 6 6 6 35 35 35 35 - 9 8 8 9 8 8 7 8 33 32 33 33 33 33 6 5 - 9 8 8 8 146 146 148 149 149 148 148 6 6 6 6 5 - 195 196 196 195 196 147 147 12 10 11 11 144 144 144 144 147 - 146 48 48 48 48 48 254 49 254 254 130 130 131 36 36 36 - 129 128 128 8 33 6 150 106 253 148 148 10 9 8 253 128 - 33 6 7 8 7 8 9 8 9 10 10 10 11 11 11 11 - 8 8 148 7 7 7 7 8 7 7 7 7 33 33 33 34 - 8 8 9 9 9 8 8 7 7 7 7 7 7 7 33 33 - 9 146 146 146 144 145 145 253 253 144 144 146 147 8 7 36 - 129 48 48 48 48 48 148 149 149 149 7 33 33 34 34 34 - 9 8 8 8 8 8 7 32 8 8 8 7 32 33 33 34 - 147 147 7 7 7 7 33 37 106 106 10 10 11 11 10 10 - 10 10 9 9 8 8 32 32 32 33 7 7 33 33 34 33 - 9 8 8 8 8 8 7 7 7 7 8 7 33 6 34 33 - 9 10 10 9 8 8 9 8 8 7 7 8 8 7 34 34 - 147 48 48 147 148 148 148 148 8 7 7 33 34 6 34 33 - 9 10 10 9 9 9 9 8 9 8 7 7 8 32 34 33 - 10 9 9 9 146 146 146 146 146 148 7 7 7 7 33 6 - 194 195 195 194 194 145 146 11 12 11 11 252 144 144 144 144 - 144 144 253 48 48 253 48 254 48 48 254 254 129 7 33 34 - 128 128 128 8 32 7 149 144 144 253 147 10 11 10 128 128 - 7 7 8 8 8 9 9 10 10 10 11 11 11 12 12 12 - 9 9 9 9 8 8 8 7 7 8 8 7 7 7 7 7 - 10 10 9 8 8 8 8 8 9 8 8 8 7 7 7 7 - 9 9 9 9 10 144 144 253 106 144 144 144 145 9 8 7 - 106 106 253 253 128 128 128 147 148 148 7 8 8 7 7 7 - 10 9 9 8 9 9 9 9 8 8 8 8 8 7 7 8 - 146 145 9 8 8 7 7 8 106 106 11 11 12 12 11 10 - 10 10 10 9 9 9 9 9 8 8 7 7 7 7 32 8 - 10 9 9 8 8 8 9 9 9 8 8 7 7 7 7 7 - 11 10 9 9 10 10 9 8 9 8 9 8 8 8 7 7 - 106 144 253 253 146 146 146 8 7 7 7 7 7 7 7 32 - 10 110 10 10 10 10 9 9 8 9 9 8 7 7 7 8 - 10 10 10 10 9 9 9 9 8 8 8 8 7 7 7 7 - 194 194 193 193 194 145 9 13 13 107 107 107 252 106 106 106 - 144 106 144 253 106 106 106 253 48 48 128 128 128 8 8 7 - 106 253 11 9 8 7 7 252 106 144 144 11 11 10 106 128 - 7 8 8 8 9 10 9 10 11 11 11 12 12 12 12 13 - 10 9 9 9 9 8 8 8 8 9 9 8 8 8 8 8 - 9 9 9 9 9 10 10 9 9 9 9 8 8 9 8 9 - 10 10 10 10 11 106 106 144 252 106 144 144 144 9 8 8 - 144 106 106 106 144 253 253 146 146 8 8 8 8 8 8 8 - 9 10 10 10 10 9 9 10 8 8 9 9 8 8 8 8 - 144 145 9 8 8 9 8 8 106 106 11 12 12 12 12 11 - 11 11 10 10 112 112 9 9 9 8 9 8 8 8 7 7 - 9 9 9 10 10 10 9 9 8 8 8 9 9 9 8 7 - 11 10 11 11 10 10 9 10 10 10 10 8 8 8 8 8 - 144 144 144 144 144 253 9 8 9 8 8 8 8 8 8 32 - 11 110 110 11 10 10 10 10 9 9 9 8 8 9 9 8 - 11 11 11 11 10 10 9 9 9 9 9 8 8 9 8 7 - 193 193 192 192 192 144 10 14 13 107 107 252 107 251 107 252 - 252 106 106 144 253 253 253 106 106 253 253 253 253 8 8 8 - 106 253 10 8 8 9 9 107 106 144 144 13 11 11 106 128 - 9 8 9 10 10 10 11 11 11 12 12 12 12 13 13 13 - 10 10 10 9 9 9 10 10 9 10 9 9 9 9 9 8 - 10 11 11 11 11 10 10 9 10 9 10 10 9 9 9 9 - 11 10 10 11 107 107 252 106 252 252 252 106 144 10 9 8 - 253 106 106 106 106 106 106 144 10 9 9 8 8 8 9 9 - 11 11 11 10 10 10 9 10 10 10 9 9 9 9 9 8 - 10 10 10 10 10 9 9 8 107 107 12 13 13 13 108 108 - 12 109 110 110 110 111 111 112 10 9 9 9 9 9 8 8 - 11 11 11 11 10 10 10 9 10 10 9 9 9 8 8 9 - 11 12 12 11 10 11 11 10 11 9 9 10 10 9 8 9 - 106 106 106 144 144 10 10 9 10 9 9 9 9 9 8 8 - 12 109 109 109 11 11 10 11 11 10 9 10 10 9 9 9 - 12 11 11 11 11 11 10 10 11 10 9 10 9 9 9 8 - 11 192 192 192 11 11 11 14 14 14 251 107 252 252 107 107 - 252 252 252 252 252 106 253 253 106 106 106 144 253 9 9 8 - 106 253 11 9 9 10 9 107 107 252 144 12 13 12 106 128 - 9 9 10 10 11 11 11 11 12 12 12 13 13 13 14 14 - 10 10 11 11 11 10 10 10 10 10 10 9 9 9 9 9 - 12 12 11 11 10 11 11 10 11 10 10 10 10 10 9 9 - 12 11 11 11 12 107 107 252 251 251 107 252 11 10 10 9 - 107 252 106 106 144 106 106 106 10 10 10 10 10 10 9 9 - 12 11 11 10 10 11 11 11 10 10 10 10 10 10 9 9 - 10 10 11 10 10 9 9 10 107 251 13 13 14 14 13 108 - 109 109 109 110 110 110 110 110 10 10 10 9 9 9 9 10 - 12 11 11 11 10 10 11 11 11 10 10 9 9 9 9 10 - 13 12 11 11 12 12 11 10 11 10 10 10 10 10 9 9 - 107 252 252 106 106 11 11 11 10 10 9 9 9 10 10 10 - 108 108 108 109 109 12 12 11 11 11 11 11 10 9 9 10 - 13 12 12 12 11 12 11 11 11 10 11 10 10 9 9 10 - 11 10 10 11 11 11 11 15 215 215 215 251 251 252 252 251 - 251 251 107 252 252 252 252 252 253 106 106 106 10 10 10 9 - 252 107 13 10 9 9 9 251 251 107 106 14 13 12 252 128 - 10 11 10 11 12 12 11 12 13 13 13 14 14 14 15 15 - 12 12 11 11 11 11 11 11 11 11 11 11 11 11 11 11 - 11 11 12 12 12 12 12 12 11 10 11 10 10 11 11 11 - 13 12 12 12 13 107 107 252 251 251 107 107 107 11 10 10 - 107 252 252 252 252 252 252 106 10 10 10 11 11 11 10 10 - 12 12 12 12 12 12 11 11 11 11 11 10 10 10 10 10 - 107 11 10 110 11 11 11 10 107 251 13 14 15 15 14 108 - 108 108 108 109 109 110 110 110 10 10 11 11 11 11 10 9 - 12 12 12 12 12 12 11 11 11 11 11 11 11 11 10 9 - 13 13 13 13 13 12 11 12 11 12 12 11 10 11 10 10 - 107 107 107 107 107 107 11 10 11 11 11 11 10 10 10 9 - 108 108 108 108 12 12 12 12 12 12 11 10 11 11 11 9 - 13 13 13 13 13 12 12 12 12 11 11 10 11 11 11 9 - 11 11 11 12 11 12 12 15 15 215 216 216 216 216 251 251 - 251 251 251 251 107 252 252 252 252 252 252 252 252 11 10 10 - 107 251 107 10 11 11 10 14 251 107 107 215 13 13 251 128 - 11 10 11 12 12 12 13 12 13 13 14 14 15 15 15 215 - 12 12 12 12 12 12 11 11 12 12 11 11 11 11 11 10 - 13 13 13 13 13 12 12 11 11 11 12 12 12 12 11 10 - 13 13 13 13 14 251 251 251 251 251 251 107 107 107 107 11 - 107 252 252 252 107 251 107 252 107 252 11 10 10 11 11 11 - 13 13 13 12 12 12 12 12 11 12 12 12 11 11 11 10 - 107 107 12 12 12 11 11 10 251 251 215 215 15 15 15 14 - 14 108 108 108 109 109 109 12 12 12 11 11 10 11 10 11 - 13 13 13 13 12 107 107 107 12 12 12 11 11 10 10 11 - 14 14 14 13 13 13 13 13 13 107 11 107 107 11 11 11 - 251 251 251 107 107 107 107 107 107 107 11 11 11 10 11 11 - 14 108 108 14 13 13 13 13 13 12 11 12 12 11 11 11 - 14 14 14 13 13 13 13 13 12 11 12 12 11 11 10 11 - 13 12 12 13 12 12 12 215 215 215 216 216 216 216 216 216 - 216 251 251 251 251 252 252 251 252 252 252 252 252 106 11 106 - 252 251 251 12 12 11 11 215 251 251 107 215 215 14 251 128 - 21 99 154 40 153 153 152 152 151 150 150 149 148 148 146 145 - 152 153 16 16 153 17 18 18 19 19 154 20 20 20 20 20 - 151 152 152 152 153 153 153 153 85 18 40 18 40 154 154 20 - 151 51 83 83 49 50 51 96 49 54 55 96 97 16 17 98 - 96 96 96 96 96 97 97 97 98 98 98 19 88 88 88 20 - 152 152 152 152 152 153 16 17 17 17 18 18 18 19 20 20 - 84 16 16 18 18 19 20 20 82 49 149 147 146 147 148 7 - 7 6 36 5 5 5 4 4 4 39 41 41 41 41 155 23 - 151 152 152 152 152 152 16 16 16 17 18 19 20 99 21 21 - 149 150 150 150 151 151 152 152 152 152 16 18 19 19 20 20 - 51 51 83 97 97 97 97 17 98 98 86 19 20 99 21 155 - 6 6 6 6 6 36 37 5 37 153 153 40 86 86 20 99 - 149 149 150 151 151 83 83 83 16 16 18 19 19 20 20 21 - 196 197 198 200 200 200 152 145 147 146 48 53 53 53 58 54 - 54 54 54 54 55 96 96 96 96 165 165 97 98 87 87 87 - 164 163 132 134 39 154 21 49 50 50 97 48 254 254 81 48 - 23 21 20 19 18 16 84 83 82 151 150 150 149 148 147 146 - 16 17 17 17 17 19 19 19 19 20 20 21 21 21 23 23 - 152 84 84 84 84 85 85 18 18 19 19 20 20 20 21 21 - 51 96 97 97 54 55 96 60 54 59 55 96 97 17 19 61 - 96 60 60 60 61 61 61 61 61 61 61 90 90 21 21 21 - 83 83 16 16 16 16 17 17 19 19 19 19 20 21 21 62 - 16 17 17 19 20 21 21 62 51 80 49 148 147 148 148 199 - 150 36 152 153 153 4 39 39 39 154 155 22 22 21 23 62 - 152 83 83 16 16 16 17 17 17 19 19 20 21 21 23 62 - 150 50 50 51 51 83 83 83 16 16 17 19 19 20 21 62 - 55 96 16 97 97 61 61 61 61 61 168 21 21 21 62 100 - 6 35 37 37 37 5 38 38 153 40 86 19 20 99 21 21 - 150 50 50 51 51 96 96 97 17 17 98 19 20 20 21 23 - 201 201 201 201 201 201 153 145 147 48 53 54 58 58 59 58 - 58 59 59 59 60 60 60 96 165 165 166 166 61 61 90 168 - 165 164 133 135 40 99 21 49 55 55 97 48 49 80 82 104 - 62 23 21 20 19 18 84 84 152 151 150 150 149 148 148 146 - 17 17 17 19 19 19 19 20 21 21 21 21 21 23 23 23 - 153 153 84 84 84 85 18 19 19 19 20 20 21 21 21 23 - 51 96 16 16 55 55 60 60 54 55 55 96 97 61 19 61 - 60 60 60 61 61 61 61 61 61 61 168 21 21 23 23 62 - 16 16 16 17 17 17 17 17 19 19 20 21 21 21 23 62 - 17 17 98 19 20 21 21 62 83 80 50 49 148 148 149 199 - 36 152 5 38 39 39 39 154 41 41 155 23 23 23 23 62 - 152 16 16 17 17 17 17 17 19 20 21 21 21 23 62 62 - 50 151 151 83 83 83 16 16 16 17 18 19 20 20 21 62 - 96 96 97 61 61 61 61 61 61 61 21 21 21 23 62 24 - 36 35 5 5 5 5 38 38 40 40 88 99 99 22 23 62 - 150 151 83 83 83 83 16 16 17 61 98 19 20 21 23 23 - 202 202 202 202 202 201 153 146 147 48 48 54 59 59 59 59 - 58 59 59 60 60 60 60 96 165 166 61 61 168 168 168 168 - 165 164 134 135 88 99 62 49 55 96 17 48 49 80 82 48 - 62 23 22 99 88 18 85 153 152 151 150 150 149 148 148 146 - 17 17 19 19 19 19 20 20 21 21 21 21 22 23 23 22 - 153 153 153 153 85 85 86 19 19 20 99 21 21 22 23 62 - 83 16 16 17 55 55 97 97 55 55 55 96 97 61 21 62 - 97 60 97 61 61 61 61 61 61 21 21 21 62 23 23 62 - 16 16 17 17 17 17 18 19 19 19 20 21 21 23 23 62 - 17 17 19 19 20 21 21 62 83 50 50 149 148 149 149 6 - 36 37 5 38 39 39 41 41 155 155 155 42 100 24 24 62 - 84 16 17 17 17 17 18 19 20 20 21 21 23 23 62 62 - 151 151 152 83 84 84 84 17 17 18 19 20 20 21 23 62 - 97 97 97 61 61 61 61 61 61 21 21 21 23 23 62 26 - 36 35 37 5 5 5 38 39 40 40 41 99 22 23 23 23 - 150 151 83 83 16 16 16 17 61 98 19 20 21 23 23 24 - 201 201 201 201 202 202 202 146 146 48 48 54 58 58 59 59 - 59 59 59 60 60 60 60 165 165 166 237 168 168 168 62 169 - 165 164 133 135 41 22 62 50 55 96 17 48 49 50 83 48 - 246 246 23 21 99 19 85 153 153 152 151 150 149 149 148 147 - 19 19 20 20 20 21 21 21 21 21 23 23 23 62 62 246 - 153 153 40 40 86 86 20 20 99 21 22 23 23 23 62 62 - 16 16 17 17 51 96 97 61 55 60 96 97 17 19 21 62 - 61 61 61 61 61 61 61 168 169 62 62 62 62 62 246 62 - 17 17 17 17 17 19 19 20 20 21 21 23 62 62 62 62 - 98 19 20 21 21 23 62 62 84 50 50 149 148 149 150 6 - 36 37 5 39 39 41 3 3 3 155 42 100 26 26 246 246 - 85 17 17 17 18 19 19 20 20 21 21 23 23 23 246 246 - 151 152 152 152 153 84 85 85 85 86 87 99 21 22 23 62 - 97 97 61 61 61 61 61 21 21 21 62 62 62 62 246 246 - 37 35 5 5 5 38 4 39 39 41 41 91 23 100 24 246 - 150 151 152 16 16 16 17 19 19 19 20 21 62 62 24 246 - 202 202 202 201 201 202 202 147 146 48 54 54 54 58 58 59 - 59 59 60 60 60 60 165 166 166 237 237 238 169 169 62 169 - 166 165 134 135 136 23 62 50 96 97 61 254 50 82 83 48 - 245 246 24 23 22 99 40 85 153 152 151 151 150 149 148 148 - 20 20 21 21 21 21 23 23 62 23 62 62 62 246 246 246 - 153 40 40 154 41 99 99 21 21 22 23 23 23 24 246 62 - 16 17 18 19 55 16 17 61 55 60 97 97 61 21 23 62 - 98 61 61 61 61 168 62 62 62 62 62 62 62 246 246 246 - 18 18 19 19 19 19 21 21 21 21 23 62 62 62 246 62 - 20 20 21 21 23 62 62 62 85 82 50 150 149 150 6 37 - 5 5 38 39 41 3 3 3 3 43 43 156 101 246 245 246 - 85 18 18 18 19 20 21 62 21 23 62 62 62 246 246 246 - 152 152 153 153 153 85 85 85 86 99 90 22 23 100 26 62 - 98 61 61 61 61 61 21 21 62 62 62 62 246 246 246 246 - 35 5 5 38 38 4 39 39 39 41 155 42 92 24 26 246 - 152 152 153 17 17 17 19 19 19 20 21 62 62 62 246 246 - 203 203 202 202 202 202 154 147 147 49 54 54 54 59 59 59 - 60 60 60 60 60 60 166 237 237 237 72 238 238 62 62 169 - 166 166 135 136 91 24 62 50 96 97 61 254 50 83 97 254 - 245 246 26 24 91 22 154 40 153 152 151 151 150 149 149 148 - 20 21 21 21 23 23 62 62 62 246 246 246 246 246 246 246 - 40 40 154 41 41 99 22 22 22 23 23 24 24 246 246 246 - 17 18 19 19 83 16 17 61 55 60 97 98 61 21 23 62 - 98 61 61 168 168 169 169 62 62 62 62 246 246 246 245 245 - 86 19 19 99 99 21 21 23 23 23 62 62 246 246 246 246 - 21 21 22 23 23 246 246 246 86 83 82 150 149 6 36 5 - 5 38 39 39 3 3 3 3 43 43 43 93 28 157 245 63 - 85 86 86 20 99 21 62 62 23 62 62 246 246 246 245 245 - 153 153 153 153 40 86 86 86 88 90 91 23 24 246 246 245 - 98 167 61 168 168 168 62 62 23 62 246 246 246 245 245 245 - 37 5 5 4 4 4 39 41 41 41 42 92 25 26 101 246 - 152 153 153 18 18 19 19 19 20 21 23 62 23 246 246 245 - 202 202 203 203 203 203 154 147 148 150 49 54 54 59 59 60 - 60 60 60 60 60 165 166 237 71 72 238 238 239 170 170 170 - 167 166 135 136 92 26 245 50 16 17 21 254 50 84 97 48 - 245 245 246 24 92 41 154 40 40 153 152 152 151 150 199 148 - 21 21 23 62 62 62 62 246 246 246 246 246 245 245 245 245 - 41 41 41 41 41 155 23 23 24 26 246 246 246 246 246 245 - 18 19 20 20 16 16 19 61 55 60 97 98 19 21 24 246 - 167 167 168 168 238 238 62 169 62 62 246 246 246 245 245 245 - 86 88 87 21 21 23 23 23 62 62 246 246 246 246 245 245 - 22 62 62 24 246 246 245 171 86 83 132 131 150 36 36 5 - 5 38 4 3 3 3 43 43 43 43 44 44 28 157 245 63 - 40 86 89 99 90 90 22 23 23 62 246 246 246 245 245 63 - 152 153 153 40 40 86 89 99 99 22 23 24 24 246 245 171 - 167 167 168 168 168 90 62 62 62 246 246 245 245 245 63 139 - 5 5 38 38 4 4 3 3 3 42 43 26 101 101 157 245 - 152 153 153 40 19 20 20 20 21 62 62 62 246 246 245 207 - 203 203 203 203 203 202 20 148 148 149 49 54 55 60 60 60 - 55 60 60 61 61 165 166 237 71 168 238 238 239 239 171 171 - 167 166 135 136 27 246 63 152 16 98 21 49 82 84 97 48 - 172 245 28 26 92 155 41 40 40 40 38 37 6 6 7 149 - 23 23 23 23 62 246 246 246 246 246 246 245 245 245 63 63 - 41 41 41 41 155 155 92 24 24 246 246 246 246 245 245 245 - 18 20 20 21 16 18 19 62 55 16 17 19 21 62 246 171 - 98 168 238 238 238 238 239 170 171 171 246 246 245 245 245 245 - 99 99 22 22 22 23 23 62 24 246 246 246 246 245 245 63 - 23 62 24 26 246 246 245 63 86 84 132 131 150 6 5 5 - 4 4 39 3 3 3 43 43 43 2 2 31 94 139 172 172 - 40 88 99 22 22 23 23 23 24 26 246 246 246 245 63 63 - 152 153 40 40 40 20 99 99 22 91 100 26 246 246 245 245 - 88 167 168 168 168 169 62 246 24 26 246 246 245 63 63 103 - 5 5 38 4 4 39 3 3 3 42 43 93 101 157 245 102 - 152 153 153 40 40 20 20 20 22 23 62 246 246 245 245 207 - 203 202 202 203 203 203 20 148 149 149 50 55 60 60 60 60 - 55 60 60 60 97 167 237 168 238 238 238 239 239 239 171 171 - 167 166 136 136 25 101 63 152 16 61 21 150 132 84 167 48 - 140 172 157 101 25 42 41 41 39 39 38 5 36 6 33 7 - 23 23 23 24 246 246 246 246 246 246 245 245 245 63 63 103 - 41 3 3 3 155 42 92 25 26 246 246 101 246 245 245 63 - 19 21 99 23 16 19 20 62 16 16 98 19 21 62 246 171 - 167 168 238 238 238 239 239 239 171 171 171 171 171 245 245 245 - 99 90 22 22 23 23 24 24 246 246 246 246 246 245 245 63 - 23 23 24 26 246 246 245 63 89 134 132 36 6 6 37 5 - 4 4 39 3 3 3 43 43 2 2 94 45 45 103 172 172 - 40 88 90 91 23 23 24 24 246 246 246 245 245 63 172 140 - 153 153 40 154 154 41 99 22 22 23 24 26 246 245 245 63 - 87 168 168 168 169 169 62 246 246 246 246 245 245 63 172 158 - 5 5 4 4 4 39 3 3 3 43 93 101 101 157 102 102 - 153 153 40 154 41 21 22 21 23 24 246 246 246 245 63 63 - 203 203 203 203 203 203 20 148 149 150 50 55 60 60 55 55 - 55 60 60 97 61 61 168 238 238 238 238 239 239 171 171 171 - 168 166 136 136 138 245 63 152 16 61 21 150 132 84 167 48 - 140 103 157 28 93 43 3 41 39 39 38 5 5 36 6 6 - 100 23 24 246 246 246 245 245 245 245 245 63 63 172 172 158 - 3 3 3 3 3 43 25 26 26 101 157 157 245 63 139 63 - 20 21 21 23 16 19 20 62 16 61 19 87 21 62 245 245 - 168 168 238 238 238 239 239 239 75 171 171 171 171 63 172 172 - 90 22 91 23 23 100 26 26 246 246 246 245 245 63 172 172 - 23 24 26 246 246 245 172 172 88 134 132 36 36 36 5 5 - 4 4 244 244 244 43 2 2 2 2 94 45 103 103 158 172 - 41 90 91 23 24 24 26 26 246 246 245 139 139 139 158 1 - 40 153 153 154 21 41 41 23 23 100 26 246 245 245 63 63 - 90 168 169 169 169 169 170 246 246 245 245 245 63 172 140 46 - 4 4 4 4 4 244 3 3 43 43 44 30 157 102 102 158 - 38 40 154 154 41 22 23 23 24 246 246 246 245 63 172 207 - 203 203 203 203 203 203 155 148 149 150 51 55 60 55 55 55 - 60 60 61 61 61 168 168 238 238 238 238 239 239 171 171 171 - 168 166 136 136 29 103 63 152 17 21 23 150 132 84 167 128 - 1 158 45 30 93 43 3 3 41 39 4 5 5 5 6 6 - 24 246 246 246 246 245 245 245 245 63 63 172 172 158 140 1 - 3 3 3 43 43 43 93 101 27 101 157 157 139 103 158 172 - 99 23 23 62 16 20 21 62 16 61 61 21 62 246 245 171 - 168 168 238 238 239 239 239 239 171 171 172 172 172 172 172 172 - 91 91 91 24 24 26 246 246 246 245 245 245 63 63 172 172 - 24 246 246 246 245 63 172 172 88 134 132 36 36 36 5 4 - 4 4 244 3 43 2 188 188 188 188 45 95 103 158 140 140 - 41 91 23 24 26 26 246 246 246 246 139 139 139 158 1 1 - 40 40 154 41 155 155 155 42 24 26 26 101 245 63 63 172 - 90 169 169 169 169 170 170 246 171 245 63 63 158 1 1 1 - 4 185 185 186 244 244 244 3 43 43 44 31 45 102 158 1 - 38 39 154 154 41 155 23 23 246 246 245 245 245 63 173 173 - 204 204 204 204 204 204 155 149 149 150 151 55 55 55 55 60 - 60 60 61 61 168 168 168 238 238 238 239 239 239 171 172 77 - 168 167 136 137 94 103 173 153 19 62 62 151 133 85 87 128 - 141 1 102 157 2 44 43 3 3 39 4 38 5 5 35 6 - 26 246 246 245 245 245 63 63 63 139 172 158 140 140 140 1 - 3 3 3 43 43 93 44 30 28 157 157 45 103 158 46 140 - 22 23 23 246 17 21 21 62 17 61 87 90 62 245 63 172 - 169 238 238 239 239 239 239 76 76 77 77 172 172 172 172 173 - 91 92 24 26 26 246 246 246 245 245 245 63 139 172 140 173 - 26 246 246 245 63 172 140 173 91 135 134 37 36 37 5 4 - 4 39 244 43 2 188 188 188 125 95 95 158 46 47 141 141 - 91 91 24 26 246 246 246 246 139 139 139 140 140 1 141 141 - 40 154 41 41 41 155 100 42 25 26 101 157 63 63 140 173 - 23 169 170 170 170 170 171 171 171 171 172 172 140 1 159 159 - 186 186 186 186 186 244 244 187 43 2 2 94 45 102 46 159 - 4 154 41 41 155 23 100 24 246 245 245 245 63 63 173 173 - 204 204 204 204 204 204 156 150 150 150 151 55 55 55 60 60 - 61 61 61 61 238 238 238 238 238 238 239 75 76 77 173 77 - 169 167 137 137 94 103 173 153 99 62 62 132 133 135 87 128 - 141 47 158 45 31 44 43 3 3 39 4 38 5 5 35 6 - 26 246 245 245 245 245 63 172 172 172 158 140 140 140 1 47 - 3 3 43 43 44 44 29 31 30 45 103 103 103 158 1 1 - 22 24 24 246 18 21 23 62 61 61 62 62 62 245 63 172 - 169 238 239 239 239 239 171 76 77 77 173 173 173 173 173 173 - 92 24 26 26 246 246 246 245 245 63 63 172 172 140 140 173 - 246 246 245 63 172 140 173 173 91 135 134 37 37 5 4 4 - 4 3 3 2 188 188 188 188 189 189 189 46 47 159 141 79 - 92 24 26 246 246 246 246 171 139 139 172 140 140 47 159 174 - 39 41 155 41 41 42 24 24 93 101 30 157 103 158 1 173 - 23 62 170 170 170 171 171 171 171 172 172 140 1 159 159 159 - 185 186 186 186 186 187 187 187 188 188 94 45 103 158 1 47 - 39 154 155 155 155 42 24 26 246 245 63 63 63 173 173 159 - 205 204 204 204 204 204 156 6 150 151 151 55 60 60 60 61 - 61 61 97 61 238 238 238 238 74 74 75 75 76 77 173 78 - 169 168 137 137 103 1 173 153 19 22 23 131 133 135 87 128 - 174 159 158 45 31 44 43 3 3 244 4 4 5 5 35 36 - 101 245 245 63 63 63 172 140 140 140 140 140 1 47 47 47 - 43 43 43 2 2 2 31 31 157 103 102 102 158 1 47 159 - 22 24 24 245 18 21 62 62 61 61 62 62 62 245 172 173 - 170 238 239 239 239 239 171 77 77 77 173 173 173 173 173 173 - 24 26 26 246 246 246 245 245 63 63 172 140 140 1 141 79 - 246 245 63 172 140 140 173 173 91 135 134 37 37 5 4 4 - 4 3 3 2 188 188 189 189 189 126 126 46 47 141 141 79 - 92 24 26 246 246 246 246 139 139 139 172 140 140 159 159 174 - 154 41 155 155 155 42 43 43 93 28 94 103 103 46 1 173 - 100 23 170 170 170 171 171 171 172 172 172 173 173 159 159 127 - 185 185 186 186 187 187 187 188 188 188 188 189 95 46 47 141 - 4 41 155 155 155 100 26 101 101 245 63 63 1 159 159 159 - 205 204 204 204 204 204 101 6 151 151 151 55 60 60 61 61 - 61 61 97 61 238 238 238 74 75 75 75 76 76 77 78 78 - 170 168 170 138 103 1 79 153 20 23 23 36 134 135 90 128 - 142 159 1 102 45 2 2 43 244 244 4 4 38 5 35 35 - 28 245 139 139 139 103 140 140 140 1 1 1 47 47 141 141 - 43 43 2 2 2 2 2 94 45 103 158 158 158 1 47 47 - 155 24 26 245 19 23 62 62 17 61 62 62 246 245 140 173 - 170 238 239 239 75 75 76 78 173 173 173 173 141 141 141 141 - 25 26 27 28 28 28 157 139 172 172 140 140 140 47 141 141 - 245 245 139 158 140 140 173 173 137 41 134 38 37 5 4 4 - 4 244 244 187 188 188 125 189 126 126 126 127 159 141 174 174 - 92 25 27 138 138 138 138 139 139 172 140 140 47 141 141 142 - 3 39 41 3 43 3 43 43 44 29 94 45 103 46 1 141 - 24 246 246 246 171 171 172 172 172 172 140 173 141 159 141 190 - 185 185 186 186 186 187 187 187 188 188 189 189 189 1 47 141 - 4 41 3 42 42 43 101 101 101 245 158 1 1 159 159 159 - 204 204 205 205 205 205 101 6 6 151 151 16 16 16 97 61 - 61 61 61 61 238 238 238 75 239 75 75 76 77 77 78 78 - 170 168 170 137 189 1 79 85 23 62 246 37 40 136 169 129 - 38 5 5 35 35 34 33 33 32 32 8 9 8 9 10 9 - 34 34 35 35 37 37 37 5 37 5 5 5 5 5 38 38 - 32 32 33 33 33 34 34 35 35 35 5 5 5 5 5 5 - 7 7 6 36 147 148 149 50 48 48 149 149 150 36 37 37 - 130 130 131 131 132 132 132 37 37 37 5 5 5 5 5 38 - 34 34 33 33 34 34 35 35 37 37 37 37 37 5 5 5 - 34 36 37 37 37 5 5 38 7 7 9 8 10 8 9 9 - 32 32 32 32 182 183 183 183 184 184 5 5 5 5 38 4 - 33 33 33 34 34 34 34 34 35 37 37 37 5 5 38 4 - 8 7 7 8 7 7 33 33 33 34 35 35 35 5 5 38 - 129 131 131 131 36 37 37 37 37 37 5 5 5 38 4 4 - 181 181 181 181 181 32 32 32 34 34 35 35 35 5 5 5 - 7 7 7 8 7 33 6 6 33 6 37 5 5 5 5 4 - 196 196 198 197 198 199 6 10 9 9 144 144 145 48 48 48 - 48 48 48 49 80 254 130 131 131 132 132 132 132 37 38 38 - 131 129 130 34 35 5 37 146 147 150 150 10 8 7 129 128 - 4 38 5 35 35 34 33 33 32 32 8 8 9 9 9 10 - 35 35 35 35 35 37 5 5 5 5 5 5 38 38 38 38 - 33 33 33 34 34 34 35 35 35 35 5 5 5 5 5 38 - 7 33 6 36 8 148 149 151 147 149 149 150 131 37 37 38 - 130 162 131 132 132 132 133 37 38 38 38 38 5 38 4 4 - 33 33 33 34 34 35 35 35 35 35 37 5 5 5 5 38 - 36 36 37 37 5 5 38 38 7 7 8 9 9 9 8 8 - 32 32 32 182 182 183 183 183 183 183 5 38 38 4 4 4 - 33 33 33 34 34 35 35 35 35 37 5 5 5 38 4 4 - 7 7 32 32 33 33 33 33 34 34 35 35 5 5 5 38 - 7 131 131 131 36 37 37 37 37 5 5 5 38 4 4 4 - 181 181 181 181 32 32 33 33 35 35 35 35 5 5 38 4 - 32 8 8 32 33 6 34 33 35 35 5 5 5 5 38 39 - 197 214 198 197 198 199 6 10 10 10 144 145 146 147 48 48 - 48 48 49 49 254 130 131 131 132 132 132 133 133 38 38 38 - 131 129 130 34 35 5 38 128 148 150 131 9 8 7 129 128 - 4 4 5 5 35 35 34 33 33 8 8 8 9 8 8 10 - 5 37 37 37 5 5 5 5 5 5 38 4 4 4 4 4 - 34 34 34 34 35 35 35 35 5 5 5 5 5 5 38 4 - 33 6 6 36 148 149 150 151 148 149 150 150 151 37 38 38 - 131 163 132 132 132 133 133 37 38 38 38 38 38 4 4 4 - 33 33 34 35 35 5 5 5 37 5 5 5 38 38 4 4 - 36 37 5 5 5 38 4 39 33 7 8 9 9 9 8 8 - 32 32 32 182 183 183 183 184 183 183 5 4 4 4 4 4 - 34 34 34 34 35 35 35 37 37 5 5 38 38 4 4 4 - 7 8 7 33 34 33 33 34 35 35 5 5 5 5 38 4 - 131 132 132 131 36 37 37 37 38 38 38 38 38 4 4 4 - 32 181 181 32 32 32 33 34 35 35 37 5 5 5 4 4 - 7 8 7 33 6 6 33 33 5 5 5 5 38 4 4 154 - 197 213 200 197 200 199 6 9 10 9 145 146 146 48 48 48 - 48 49 49 49 49 131 131 131 132 132 133 133 134 38 38 38 - 131 130 131 35 5 4 40 128 254 150 36 9 8 7 130 128 - 39 4 38 5 5 35 34 34 33 32 32 8 8 8 8 9 - 5 37 37 5 5 5 38 38 4 4 4 4 4 4 39 4 - 34 34 35 35 35 35 35 5 5 5 5 38 4 4 4 4 - 6 6 36 37 149 149 151 152 149 49 150 151 152 37 38 134 - 131 163 132 132 133 133 133 133 38 38 38 4 4 4 4 4 - 34 35 35 35 5 5 5 5 5 5 5 38 4 4 4 4 - 37 37 38 38 38 4 39 39 33 7 7 8 9 8 8 32 - 32 33 33 182 183 183 183 184 184 184 38 4 4 4 4 4 - 34 34 35 35 35 35 35 37 5 5 38 4 4 4 4 4 - 8 7 33 6 34 33 34 35 35 5 5 5 5 38 4 39 - 131 132 132 132 132 37 37 37 38 38 38 4 4 4 39 4 - 32 32 32 32 32 33 34 35 35 35 5 5 5 38 4 4 - 8 7 33 6 6 33 6 6 5 5 5 38 4 4 4 154 - 196 198 200 198 200 150 6 9 9 9 145 146 147 48 48 48 - 49 49 49 49 80 81 82 131 132 133 133 134 134 40 39 39 - 131 130 131 35 5 4 40 128 254 150 36 8 8 7 130 128 - 39 4 4 5 5 5 35 34 33 33 32 8 7 8 9 8 - 37 37 5 5 38 38 4 4 4 4 4 4 4 4 39 4 - 35 35 35 35 35 37 5 5 5 5 38 4 4 4 4 39 - 6 36 37 37 149 150 151 83 49 49 150 151 152 153 38 135 - 132 132 132 133 133 134 134 134 40 40 39 39 39 39 39 41 - 35 35 37 5 5 5 5 5 5 38 38 4 4 4 4 39 - 37 38 38 38 38 39 39 39 34 7 8 8 9 8 8 32 - 32 33 33 182 183 184 184 184 185 185 4 4 4 4 4 244 - 35 35 35 37 5 5 37 5 38 38 4 4 4 4 39 3 - 7 33 6 6 33 6 35 5 35 5 5 38 38 4 4 39 - 132 132 132 132 132 133 37 38 38 38 39 39 39 39 39 244 - 32 32 33 33 34 34 35 35 37 5 5 38 38 4 4 4 - 7 6 6 6 6 6 37 5 37 5 5 4 4 4 39 41 - 196 200 200 200 200 151 6 9 9 9 146 147 48 48 48 49 - 54 49 49 80 81 82 82 164 165 133 134 134 135 40 39 41 - 132 130 131 35 5 4 40 128 150 151 37 8 8 7 130 128 - 3 244 4 4 5 5 35 35 33 33 32 8 7 8 9 8 - 5 38 38 38 4 4 4 4 4 4 4 4 39 3 41 39 - 35 35 35 37 5 5 5 5 38 4 4 4 4 4 39 3 - 6 36 37 37 149 150 152 84 49 49 50 152 153 153 39 136 - 132 164 133 133 134 135 135 135 88 40 154 41 41 41 41 3 - 37 37 5 5 5 5 5 38 38 4 4 4 4 39 39 41 - 38 153 38 38 39 39 41 41 36 33 7 8 8 8 32 33 - 33 33 34 183 184 184 184 184 184 184 4 4 39 3 3 3 - 5 35 37 37 37 5 38 38 4 4 4 39 39 3 3 3 - 33 6 6 33 6 5 5 5 5 5 38 4 4 4 4 41 - 132 132 132 132 133 133 133 38 40 39 39 39 41 41 3 244 - 32 33 33 34 34 35 35 5 5 5 38 38 4 4 4 3 - 33 6 6 6 6 37 5 37 5 38 38 4 4 39 3 156 - 198 201 200 200 200 151 36 9 9 145 146 147 48 49 49 54 - 54 49 49 54 51 82 83 165 165 165 85 135 135 40 41 136 - 132 131 132 35 4 244 41 128 150 151 37 8 7 33 131 128 - 3 3 244 4 4 5 5 35 35 34 32 7 7 8 8 8 - 38 38 40 40 39 39 39 39 39 39 244 3 3 3 3 3 - 5 5 5 5 5 38 38 4 4 4 4 39 39 3 3 3 - 36 37 37 153 150 151 83 16 50 50 82 84 153 40 40 136 - 133 133 134 134 135 135 86 86 89 41 41 41 155 155 42 3 - 37 5 5 38 38 38 4 4 4 39 39 39 3 3 3 3 - 40 40 40 40 39 41 42 155 37 34 7 7 8 8 33 33 - 33 34 35 183 184 184 184 184 185 185 4 3 3 3 3 3 - 5 37 37 5 5 38 38 38 4 39 41 3 3 3 3 3 - 6 6 6 6 37 5 5 5 5 38 4 4 39 41 3 42 - 132 133 133 84 85 85 85 40 40 41 41 41 3 3 3 244 - 33 33 34 34 35 35 5 5 5 38 4 4 39 244 3 3 - 6 6 6 36 36 37 5 153 153 39 39 39 39 41 3 156 - 201 201 201 201 200 152 37 9 9 146 147 147 49 54 54 54 - 54 54 54 55 51 83 165 166 165 166 135 86 88 41 41 136 - 133 132 132 37 4 3 91 129 150 152 38 8 7 6 132 128 - 43 3 3 39 4 4 5 5 5 6 6 33 7 7 7 8 - 38 40 40 40 154 41 41 3 3 3 3 3 3 3 3 3 - 5 5 38 38 38 4 4 4 4 4 41 3 3 3 3 3 - 37 37 153 153 151 152 84 16 50 51 83 84 85 40 41 91 - 134 165 134 135 135 86 86 88 91 91 91 42 92 92 43 43 - 5 38 38 4 4 4 4 39 39 39 41 41 3 3 3 43 - 40 154 154 41 41 42 92 42 37 34 34 8 7 8 33 33 - 34 35 5 184 185 185 185 185 186 244 244 3 3 43 43 43 - 5 5 38 38 4 39 39 4 39 39 3 3 43 43 43 43 - 6 6 36 5 5 5 5 4 38 4 39 41 3 3 3 92 - 133 84 84 85 86 88 86 99 41 41 155 42 42 43 43 43 - 35 183 183 183 35 5 5 4 4 4 39 41 3 3 43 43 - 6 151 152 153 153 152 153 154 40 154 154 155 3 3 3 156 - 202 202 201 202 152 153 38 8 8 147 147 147 214 54 54 54 - 54 55 60 96 51 96 165 166 166 167 167 136 136 91 42 137 - 133 132 133 38 4 3 92 254 151 152 40 7 7 36 133 128 - 44 43 3 3 4 4 5 5 35 5 6 33 33 7 8 7 - 154 41 41 41 41 41 3 3 3 3 3 3 3 3 43 43 - 38 38 38 38 4 4 39 39 39 41 3 3 3 3 3 43 - 37 153 40 40 151 152 17 17 50 51 83 84 18 89 91 137 - 134 134 135 135 88 89 90 90 90 91 91 92 92 25 25 43 - 38 4 4 39 4 39 39 41 3 3 3 3 3 43 43 93 - 40 154 41 41 41 42 25 25 37 36 36 8 7 32 33 33 - 35 35 5 184 185 185 185 186 186 244 244 3 43 43 2 2 - 5 38 38 38 39 39 39 39 41 3 3 3 43 43 44 44 - 36 36 37 37 5 38 4 4 4 4 39 3 3 3 43 43 - 153 84 85 86 86 86 99 41 41 41 155 3 3 43 43 2 - 183 182 183 184 183 184 184 5 4 4 4 3 3 3 43 44 - 36 151 152 152 153 153 40 40 154 154 41 155 3 43 43 101 - 201 201 202 201 201 153 38 8 8 147 148 214 214 54 54 54 - 60 55 55 55 96 97 166 167 166 167 168 168 90 137 92 137 - 134 132 133 38 244 3 25 130 132 153 40 7 6 36 133 128 - 2 43 3 3 244 4 4 5 5 5 35 34 34 33 7 7 - 41 99 155 155 155 155 42 3 43 43 43 43 43 43 43 2 - 4 4 4 4 4 39 41 3 3 3 3 3 43 43 43 43 - 5 40 154 40 151 84 18 98 51 83 16 17 19 21 92 26 - 135 135 167 136 168 90 169 137 91 100 24 25 26 26 27 101 - 38 4 39 39 39 39 41 41 3 3 3 43 43 43 44 28 - 41 99 91 42 92 25 27 28 38 37 34 33 7 33 33 35 - 35 5 184 185 186 186 186 186 186 244 43 43 44 2 2 2 - 38 38 39 39 39 39 41 41 3 3 43 43 43 44 2 2 - 37 37 5 5 38 4 4 4 4 39 3 3 3 43 43 44 - 40 86 86 20 99 99 22 23 23 100 156 93 44 2 2 188 - 183 183 184 184 184 184 185 185 185 4 244 3 3 43 44 157 - 152 152 152 153 153 40 154 154 154 41 155 155 43 43 44 157 - 202 202 202 201 201 154 4 8 8 148 199 214 214 54 55 55 - 60 60 60 60 97 97 166 167 167 167 168 168 137 26 27 138 - 135 133 134 38 244 43 27 150 84 85 40 7 6 37 133 128 - 31 2 43 3 3 244 4 4 38 5 35 35 34 33 32 7 - 41 22 23 23 42 42 43 43 43 43 43 2 2 2 2 2 - 4 4 39 39 39 3 3 3 3 3 43 43 43 43 2 44 - 38 40 154 20 152 84 18 19 83 83 16 19 99 23 26 246 - 135 167 168 168 169 169 169 24 26 26 26 101 28 101 28 30 - 39 39 154 41 41 41 3 3 3 3 43 43 43 2 2 30 - 155 22 91 92 92 43 27 28 38 37 36 36 7 33 33 5 - 35 5 184 185 186 186 186 187 187 187 2 2 2 31 31 31 - 38 39 39 39 41 41 155 155 42 43 43 93 2 2 31 31 - 5 5 38 38 4 39 4 4 39 3 3 43 43 93 2 30 - 40 86 88 99 90 22 23 23 24 25 101 44 2 31 31 188 - 184 183 184 184 184 185 185 185 186 244 244 3 43 44 30 157 - 5 153 153 153 40 154 154 154 41 155 155 156 43 44 30 157 - 202 202 203 202 201 154 154 7 8 199 199 214 214 55 55 55 - 55 60 60 61 61 61 166 167 167 168 168 169 137 138 138 138 - 135 133 135 39 187 2 28 131 84 85 41 7 6 37 134 128 - 45 2 44 43 3 3 4 4 4 5 5 35 34 33 33 7 - 155 22 23 100 92 156 43 43 44 44 2 2 2 31 31 31 - 4 39 39 41 3 3 3 3 43 43 43 43 43 2 2 31 - 40 40 41 41 152 84 19 87 83 16 17 20 21 23 26 246 - 135 136 168 169 169 169 169 170 246 246 246 101 28 157 157 157 - 39 154 41 155 3 3 3 3 3 43 43 44 2 2 2 31 - 42 91 92 92 43 93 28 28 38 37 37 34 34 33 34 5 - 5 5 185 185 186 186 186 187 187 2 2 31 31 31 94 45 - 39 40 41 41 41 42 42 42 92 43 93 2 2 31 45 45 - 5 5 38 39 39 39 39 39 41 3 3 43 43 44 2 94 - 40 86 88 99 22 23 23 24 26 26 101 30 31 31 31 188 - 184 183 184 184 184 185 185 186 186 244 244 43 43 44 31 102 - 5 5 153 153 40 154 41 41 155 155 156 156 44 44 31 102 - 202 203 204 202 202 154 154 7 7 199 199 214 50 55 55 55 - 55 60 60 61 61 61 167 167 168 168 169 169 170 138 138 138 - 135 134 136 244 187 2 28 36 84 86 41 33 37 5 134 128 - 95 45 2 43 43 3 39 4 4 5 5 5 6 34 33 7 - 42 23 100 24 25 156 101 44 2 2 2 31 94 45 45 45 - 39 41 3 3 3 3 3 3 43 43 43 2 2 2 2 45 - 40 154 41 22 153 85 87 21 83 16 18 20 22 24 101 246 - 136 136 169 169 169 170 170 171 246 246 246 157 94 157 45 45 - 41 41 155 155 3 3 43 43 43 43 44 2 2 31 45 102 - 24 24 26 27 28 29 94 139 38 38 38 34 34 34 35 5 - 5 4 185 186 186 187 186 187 188 188 2 31 45 95 95 158 - 39 41 41 41 42 92 92 25 93 93 44 31 94 45 95 158 - 5 38 39 39 39 41 41 3 3 3 43 43 2 2 31 45 - 41 89 90 91 91 24 246 246 246 101 157 157 45 95 158 126 - 184 184 184 184 185 185 185 186 187 187 187 43 2 2 45 102 - 5 153 153 40 154 41 155 155 156 156 156 44 30 31 45 102 - 203 202 202 202 203 155 41 7 7 199 200 200 55 55 96 55 - 55 60 60 61 61 167 167 168 169 169 169 170 170 138 139 139 - 136 135 136 244 188 2 94 132 85 89 91 6 5 38 135 128 - 47 158 45 2 43 3 3 3 4 4 38 5 35 35 34 33 - 24 24 26 26 101 101 30 157 94 45 45 95 95 95 158 158 - 3 3 3 3 3 43 43 43 2 2 2 2 2 94 45 95 - 41 41 23 23 153 86 21 62 84 17 19 21 23 246 245 139 - 90 169 169 169 170 170 171 171 171 245 139 139 103 103 158 158 - 3 155 155 155 3 43 43 44 44 2 31 31 45 95 95 158 - 26 26 28 28 31 45 103 140 39 39 38 36 33 5 35 5 - 4 185 186 186 187 187 187 187 125 189 45 95 95 158 46 47 - 41 41 91 91 92 25 27 27 28 29 94 45 95 158 158 1 - 38 39 154 41 41 41 3 3 3 43 93 2 2 94 95 103 - 136 136 91 137 137 246 246 246 246 245 245 157 45 158 46 190 - 184 185 185 185 186 186 186 187 187 187 188 188 188 45 95 158 - 38 4 39 154 155 155 155 42 156 101 30 157 45 45 102 1 - 203 203 203 203 20 155 155 7 7 199 200 200 55 16 96 96 - 60 60 61 61 61 168 168 169 238 239 239 170 171 139 139 172 - 136 135 137 244 188 95 172 37 86 90 92 6 5 4 135 128 - 159 1 95 31 2 43 3 3 39 4 4 5 5 35 34 34 - 27 246 246 101 157 157 45 103 45 95 95 95 158 46 46 1 - 3 3 3 43 43 43 2 2 2 2 31 95 95 95 95 158 - 41 155 100 24 40 88 22 62 16 17 20 21 24 246 245 172 - 137 169 169 169 170 170 171 171 172 172 172 172 140 1 1 1 - 3 42 42 43 43 93 2 31 2 31 94 95 95 95 158 1 - 27 27 28 30 94 103 140 140 41 39 38 37 6 5 5 5 - 4 186 186 122 123 123 123 124 125 189 95 95 46 46 127 47 - 41 91 137 137 24 138 138 28 94 94 45 158 158 46 127 159 - 39 154 41 41 41 155 3 3 43 43 2 31 45 95 95 46 - 136 137 137 137 170 170 246 171 171 245 63 103 103 46 46 126 - 185 185 185 185 186 186 186 187 187 188 188 188 188 189 189 46 - 4 39 39 41 155 42 156 156 44 30 157 45 102 158 46 159 - 204 203 204 204 20 155 42 6 7 199 200 201 16 16 96 96 - 61 61 61 61 61 168 238 238 239 239 239 171 171 172 140 140 - 169 135 137 244 125 126 140 153 86 22 92 6 5 39 135 128 - 141 140 103 157 28 93 43 42 39 41 39 5 38 37 6 36 - 246 246 246 245 245 245 63 172 139 103 103 158 158 140 140 140 - 42 92 25 93 93 93 28 29 29 94 45 103 103 103 158 1 - 155 22 23 24 18 19 62 62 97 17 61 62 62 245 63 63 - 169 169 169 170 239 76 76 76 63 63 172 172 173 173 173 173 - 91 100 24 26 26 101 101 157 30 157 45 103 103 158 1 173 - 246 246 245 245 139 172 173 173 91 40 40 37 5 5 5 4 - 4 3 3 187 124 124 124 125 188 95 102 158 1 1 47 173 - 91 91 137 24 26 246 246 246 245 139 172 140 140 1 47 141 - 40 154 41 41 41 155 42 24 25 26 157 45 103 103 46 140 - 137 137 170 170 170 171 171 171 171 63 172 173 173 140 140 47 - 185 185 185 185 187 187 244 187 188 188 188 94 45 103 46 140 - 40 40 154 41 155 23 100 24 101 101 245 63 63 140 140 159 - 205 204 204 204 204 23 156 6 6 150 150 55 60 60 60 60 - 61 61 61 61 61 72 73 238 238 74 239 239 171 172 173 173 - 169 167 136 244 45 158 173 84 86 22 246 36 40 41 88 128 - 152 152 151 150 149 149 148 148 146 146 253 145 144 10 10 144 - 254 254 49 49 150 150 150 150 131 131 131 151 151 132 36 151 - 128 128 148 254 149 254 149 149 130 150 150 150 36 36 36 151 - 147 48 254 254 253 146 48 49 48 48 48 48 49 49 149 82 - 254 104 104 104 49 80 80 80 50 50 150 150 151 151 132 151 - 48 254 254 254 254 254 254 254 254 150 150 150 131 151 132 151 - 254 149 149 150 150 151 151 151 146 146 144 144 10 10 10 9 - 9 146 8 7 7 7 7 7 6 6 36 36 151 151 152 152 - 48 128 254 254 254 49 49 149 150 150 150 151 151 151 152 153 - 147 147 146 146 147 148 148 147 254 149 149 149 150 131 36 151 - 128 48 254 254 254 254 49 50 49 50 151 151 151 151 132 37 - 9 9 9 8 8 7 8 8 7 7 7 130 36 36 36 151 - 253 146 147 146 146 147 148 149 149 150 150 150 150 151 151 152 - 195 196 214 214 196 147 147 11 10 144 144 106 52 52 53 53 - 53 53 53 52 53 104 104 104 104 161 162 80 80 130 151 133 - 255 129 129 33 34 36 132 144 48 48 49 106 144 146 128 128 - 84 84 84 82 50 50 49 49 147 148 147 146 144 253 144 144 - 50 50 50 51 51 51 82 82 83 83 83 84 84 84 84 84 - 49 49 49 50 50 50 50 82 82 151 82 152 152 153 153 85 - 49 49 49 80 48 49 54 54 53 53 49 49 54 51 83 83 - 80 162 162 54 81 96 96 55 51 51 83 83 84 84 84 84 - 254 49 49 80 50 50 82 82 50 82 83 83 83 84 84 84 - 50 51 82 82 83 84 84 97 49 48 146 145 145 145 145 147 - 147 148 149 150 151 151 151 152 5 152 153 153 153 153 85 18 - 49 49 80 80 50 50 50 50 82 82 83 84 84 84 84 84 - 146 48 49 49 49 49 50 50 50 50 50 151 82 152 84 84 - 49 49 80 50 50 50 51 51 51 83 83 16 84 84 85 40 - 7 7 8 8 7 33 6 36 150 150 151 152 152 84 84 84 - 48 48 49 49 49 49 50 50 50 51 82 83 83 84 17 19 - 196 213 214 214 214 149 149 10 144 144 53 52 53 53 53 53 - 52 53 59 59 58 249 249 249 249 250 250 165 96 83 83 84 - 162 255 130 131 132 152 85 253 48 49 50 253 48 48 254 128 - 98 98 16 83 83 82 151 150 149 149 148 148 146 146 144 144 - 83 83 83 83 83 16 16 16 16 16 16 17 17 18 18 17 - 51 51 82 82 51 50 82 83 16 16 16 16 16 17 18 18 - 49 50 50 50 49 54 55 54 53 54 54 54 55 96 16 97 - 250 250 250 250 55 55 96 96 97 16 16 16 17 17 17 17 - 50 50 50 50 51 83 83 83 83 16 17 17 16 17 17 17 - 51 83 83 83 16 16 16 16 49 49 48 146 146 146 146 147 - 148 149 150 151 152 152 5 5 5 37 153 153 40 40 40 18 - 50 50 50 50 82 82 83 83 84 84 84 85 85 85 85 19 - 49 49 49 49 48 49 49 50 51 83 83 83 16 17 18 17 - 50 50 50 51 55 96 96 16 16 16 16 17 17 19 19 20 - 7 7 7 6 6 36 150 150 151 152 153 153 16 16 17 18 - 48 49 49 49 49 50 50 50 51 83 16 16 16 17 17 203 - 214 213 213 213 200 150 151 144 144 253 53 53 53 57 58 53 - 58 58 58 58 58 59 59 68 68 68 250 250 96 97 17 98 - 163 162 131 132 37 153 17 48 54 55 50 253 48 48 80 48 - 61 61 17 16 16 83 83 51 50 49 148 149 147 146 253 146 - 96 96 96 16 16 16 16 16 61 17 17 17 19 19 19 19 - 50 50 51 83 83 16 16 17 16 16 17 17 17 19 19 61 - 51 55 96 55 53 54 55 60 54 59 54 55 60 60 16 61 - 250 250 250 250 60 61 61 61 61 61 61 61 61 61 61 61 - 55 96 96 55 55 96 96 16 16 16 17 17 17 19 19 61 - 16 16 16 16 17 61 61 61 54 49 48 48 146 147 148 148 - 149 150 151 152 153 153 153 153 40 40 40 20 21 21 21 21 - 51 51 82 83 83 83 16 16 16 16 17 18 19 19 19 21 - 49 49 49 50 51 96 96 55 96 96 16 16 16 17 19 61 - 55 55 55 55 60 60 60 60 60 16 61 61 61 61 61 20 - 150 6 6 36 151 152 152 153 152 153 16 17 17 17 19 61 - 49 54 54 51 55 55 96 96 96 16 16 16 17 61 61 203 - 214 213 213 213 55 55 50 144 253 48 53 53 57 57 58 58 - 59 58 59 59 59 60 60 236 250 250 60 60 61 61 61 61 - 96 163 132 133 85 19 61 48 54 55 96 48 49 49 80 104 - 49 49 48 48 48 48 253 253 144 253 253 106 252 252 252 252 - 48 53 53 53 48 48 48 48 49 49 49 49 49 49 49 49 - 48 48 48 48 48 253 253 253 253 48 48 48 49 49 49 49 - 52 52 53 53 52 52 52 53 52 52 52 52 53 53 48 54 - 52 248 248 52 52 53 53 53 54 54 49 49 49 49 49 49 - 48 53 53 48 48 48 48 48 48 48 48 48 49 49 49 49 - 52 52 53 53 48 48 49 54 105 105 106 252 252 252 144 144 - 144 144 145 146 146 147 147 147 147 146 147 48 49 49 49 49 - 253 105 48 48 48 48 48 48 48 48 48 49 80 49 49 49 - 106 106 106 144 105 48 48 253 48 48 48 48 48 48 49 49 - 53 53 53 53 53 53 53 53 53 53 49 49 49 49 49 49 - 144 144 144 106 106 144 253 146 146 48 48 48 48 49 49 49 - 106 106 106 144 52 52 53 53 53 53 48 48 49 54 49 214 - 195 212 214 214 53 53 48 252 252 252 247 247 247 247 247 56 - 56 56 56 52 52 52 52 52 53 53 53 53 54 54 54 54 - 105 105 105 253 146 48 49 247 52 52 53 252 252 247 105 160 - 51 51 81 49 49 48 48 48 48 48 48 105 105 106 106 106 - 54 54 54 54 54 54 49 49 55 55 55 55 55 55 55 55 - 48 48 48 48 49 49 49 49 49 49 80 54 51 51 51 55 - 53 53 53 54 53 53 53 58 52 52 53 53 53 54 54 54 - 249 249 249 249 249 54 54 54 54 54 54 55 55 55 51 55 - 53 53 54 54 54 54 54 54 54 49 49 54 55 55 55 55 - 54 54 54 54 54 55 55 55 53 52 105 105 106 144 253 253 - 146 146 48 148 49 149 149 149 50 50 50 51 51 55 55 55 - 53 53 53 54 54 54 54 54 54 54 54 55 55 55 55 55 - 48 48 48 48 53 53 53 49 49 54 49 49 54 54 55 55 - 53 53 54 54 54 54 54 54 54 54 55 55 55 55 55 51 - 253 253 128 48 254 48 48 48 49 49 49 80 50 51 55 55 - 48 53 53 53 53 53 54 54 54 54 53 54 55 55 55 55 - 195 212 214 214 53 53 48 252 106 247 247 52 56 56 56 56 - 56 56 57 57 57 57 58 58 58 59 59 54 54 55 55 55 - 249 160 255 130 50 96 55 53 52 52 54 105 52 53 105 160 - 97 97 96 51 50 50 49 49 49 48 48 253 253 106 106 105 - 55 55 55 55 55 55 55 55 96 96 96 97 97 97 97 97 - 49 49 49 50 50 50 50 50 83 96 96 96 96 96 96 96 - 53 54 54 54 53 53 54 59 53 58 58 54 59 55 55 60 - 249 249 249 249 250 250 250 60 55 55 60 60 97 96 96 96 - 49 54 54 54 54 55 55 55 55 55 55 96 96 97 97 60 - 55 55 55 55 55 96 96 96 53 48 48 48 253 253 146 146 - 148 148 149 150 151 151 151 151 152 152 83 16 97 97 97 60 - 53 54 54 54 55 55 55 55 55 55 55 60 60 60 16 61 - 48 48 49 54 49 49 49 54 54 55 55 55 55 96 97 97 - 49 54 54 54 55 55 55 55 55 55 60 60 97 97 97 97 - 48 128 148 254 254 254 49 49 50 51 51 83 83 97 97 97 - 48 48 48 49 49 54 54 54 55 55 55 55 96 96 96 16 - 196 213 213 214 54 54 54 144 144 144 52 52 57 57 57 57 - 57 57 58 58 58 58 58 59 59 59 250 60 60 60 60 96 - 250 104 131 131 82 97 96 53 54 54 49 105 53 53 160 160 - 61 61 61 60 60 55 55 54 54 54 80 48 49 48 48 105 - 60 60 60 60 60 60 60 61 60 60 61 61 61 61 61 61 - 51 51 51 55 55 55 55 96 61 60 60 60 60 61 61 61 - 59 59 60 59 58 59 59 60 58 58 59 59 60 60 60 61 - 60 67 250 60 68 60 60 60 61 61 61 61 61 61 61 61 - 59 55 60 60 60 60 60 60 60 60 60 61 61 61 61 61 - 60 60 60 60 60 61 61 61 55 53 53 53 105 48 49 49 - 49 49 50 51 16 16 16 16 61 61 61 61 61 61 61 61 - 55 55 60 60 60 60 60 60 60 60 60 61 61 61 61 61 - 54 54 54 54 54 54 55 60 55 60 60 60 60 61 61 61 - 60 59 59 59 60 60 60 60 60 60 60 61 61 61 61 61 - 49 49 50 50 50 51 51 83 96 97 97 97 97 61 61 61 - 54 54 54 54 55 55 60 60 60 60 60 60 61 61 61 204 - 213 213 213 54 59 59 55 52 52 53 53 58 57 58 57 57 - 229 58 58 58 59 59 59 60 60 60 236 60 60 60 61 70 - 68 249 164 164 97 61 61 54 59 59 55 53 53 54 54 104 - 59 58 53 53 53 53 52 52 247 52 52 247 247 247 247 247 - 53 58 58 57 58 58 58 53 53 53 53 53 53 53 58 59 - 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 - 52 52 52 52 56 56 56 56 56 56 56 56 56 57 58 53 - 52 52 52 52 57 58 58 53 53 53 53 53 53 53 53 58 - 52 52 52 52 53 58 53 58 53 53 53 53 53 53 58 58 - 58 57 57 53 53 53 58 58 52 52 52 52 52 247 247 247 - 106 144 52 53 48 48 53 53 53 53 53 53 54 59 59 58 - 52 52 52 52 53 53 53 53 53 53 53 53 53 58 59 59 - 247 52 52 52 52 52 52 52 52 53 53 53 53 53 58 58 - 52 52 52 52 57 58 57 58 58 58 53 53 53 58 59 54 - 247 247 52 52 53 53 53 53 53 53 53 53 53 53 53 58 - 52 52 52 52 52 52 52 52 58 58 53 53 53 53 53 59 - 212 212 52 52 52 52 52 247 247 52 56 56 219 225 225 225 - 225 56 56 56 56 56 56 56 56 57 58 58 53 53 58 58 - 248 248 248 53 53 53 53 52 56 52 52 247 52 52 52 58 - 59 59 59 58 58 53 53 53 53 52 52 247 52 247 247 52 - 57 57 58 58 58 58 59 59 59 59 58 58 58 58 59 59 - 53 53 53 53 53 53 58 58 58 59 59 59 59 59 58 58 - 57 58 58 58 56 57 57 57 56 56 56 57 58 58 58 59 - 58 58 58 57 57 58 58 58 58 58 59 59 58 58 58 59 - 57 58 58 58 58 57 58 58 59 58 59 59 59 58 58 58 - 57 58 58 59 59 58 58 58 52 52 52 247 247 247 52 52 - 52 53 53 53 48 49 49 54 54 54 54 54 59 59 59 58 - 53 58 58 57 57 53 58 58 58 58 58 59 59 59 59 59 - 53 53 53 52 52 52 53 53 53 58 58 59 59 59 59 58 - 57 58 58 58 58 58 58 58 58 58 59 59 59 59 59 59 - 52 52 52 52 53 53 53 53 53 53 58 58 59 59 59 59 - 52 52 57 57 57 58 58 57 57 58 59 59 58 58 59 59 - 212 212 58 58 58 57 57 247 52 52 56 225 225 225 225 225 - 56 56 56 56 56 57 58 58 58 57 57 58 58 59 59 58 - 227 227 53 249 59 59 59 52 56 57 58 52 52 52 52 58 - 60 60 55 54 54 54 54 54 53 53 53 53 53 52 247 52 - 59 59 59 59 59 59 59 59 60 60 59 60 60 60 60 55 - 54 49 54 54 54 54 54 54 54 54 54 55 55 60 60 60 - 53 58 58 58 53 57 58 58 57 57 57 58 58 59 59 59 - 53 58 58 58 58 58 59 59 59 59 59 60 60 60 250 60 - 58 58 58 58 59 59 59 59 59 54 59 59 60 60 60 60 - 59 59 59 59 59 59 60 60 53 53 52 52 52 52 48 48 - 48 48 48 49 49 50 50 50 51 51 55 55 55 55 55 55 - 53 58 59 59 59 58 58 59 59 59 59 55 60 60 55 55 - 53 53 53 53 53 53 54 59 54 54 54 54 59 55 60 60 - 53 58 58 58 58 58 58 59 59 59 59 60 60 55 55 60 - 48 48 48 48 48 48 48 49 49 54 54 54 55 55 55 60 - 53 53 53 53 53 58 59 59 59 59 59 59 55 60 60 55 - 214 213 213 58 58 58 58 52 247 52 52 56 56 56 56 56 - 56 56 57 58 58 58 58 58 58 58 58 59 59 59 60 59 - 249 64 161 162 55 55 60 52 53 58 58 52 52 53 53 53 - 61 16 55 55 55 55 54 49 54 48 48 48 48 48 253 144 - 55 60 55 55 55 55 55 55 60 55 55 60 60 60 60 60 - 49 49 50 51 55 55 55 55 55 55 55 55 96 96 96 60 - 54 54 54 54 53 58 59 59 53 58 58 59 54 55 60 55 - 54 59 59 59 250 60 60 250 55 250 250 60 60 60 60 60 - 54 54 54 54 55 60 55 55 55 55 55 55 60 60 60 60 - 55 60 55 55 55 60 60 60 54 53 53 53 48 48 48 48 - 48 148 149 150 151 151 152 152 152 83 16 16 16 97 61 61 - 54 54 54 54 59 60 60 60 55 55 60 60 60 61 61 61 - 49 54 49 49 49 49 49 49 54 55 55 55 55 55 60 60 - 54 59 59 59 59 60 55 60 55 55 60 60 60 60 61 61 - 48 48 49 49 49 49 50 50 50 51 51 51 96 16 16 61 - 48 53 54 54 54 54 54 54 60 55 55 55 60 55 60 61 - 214 213 214 214 54 54 54 144 144 52 52 52 56 56 57 57 - 58 57 57 58 58 58 58 59 249 250 250 250 250 96 60 60 - 249 249 162 162 51 96 60 53 58 59 54 52 53 54 54 48 - 61 61 17 97 97 96 51 50 80 50 49 48 48 48 48 48 - 55 55 60 60 60 60 61 61 97 61 61 61 61 61 61 61 - 82 82 82 82 83 83 97 97 97 97 97 97 97 17 98 61 - 55 55 55 55 54 59 59 59 59 58 59 60 60 60 61 61 - 60 60 250 250 60 60 60 60 97 97 97 61 61 61 61 61 - 55 55 55 55 96 60 96 97 61 97 97 97 97 61 61 61 - 96 60 61 61 61 61 61 61 54 49 48 48 48 48 48 148 - 149 150 151 152 153 153 16 17 17 17 18 98 61 61 61 61 - 55 55 54 55 60 60 60 60 61 61 61 61 61 61 61 61 - 49 49 80 51 51 55 96 96 51 96 61 61 97 97 17 61 - 55 60 250 60 60 60 60 60 61 97 61 61 61 61 61 61 - 254 130 131 50 50 82 82 82 83 84 97 97 16 17 61 61 - 49 49 54 55 55 55 55 55 96 60 97 61 61 97 17 204 - 214 198 200 55 55 55 55 144 48 53 53 53 58 57 58 53 - 59 59 58 58 59 60 60 250 250 250 165 165 165 61 61 166 - 250 250 163 132 84 97 61 53 54 55 60 48 48 49 81 104 - 169 62 90 19 98 17 84 83 82 82 80 49 50 80 48 146 - 97 61 61 61 61 61 61 61 168 168 169 62 169 169 62 62 - 85 85 85 85 84 16 17 17 98 98 98 19 87 21 62 62 - 51 97 97 97 55 60 60 60 59 60 250 96 61 61 61 238 - 60 60 60 60 165 166 61 61 168 61 168 169 62 62 62 62 - 83 97 17 97 97 97 17 61 17 61 61 61 168 168 62 62 - 61 61 61 61 61 168 238 238 96 51 80 49 48 148 149 150 - 151 152 153 153 40 154 41 21 99 21 22 23 21 62 62 62 - 96 97 97 61 61 61 61 61 61 61 61 62 62 62 62 62 - 50 51 82 83 83 83 97 97 97 17 98 98 98 21 62 62 - 97 61 61 61 61 61 61 61 168 61 168 168 169 169 169 169 - 132 132 132 152 133 153 84 84 85 19 87 20 99 21 21 62 - 51 51 51 83 96 96 97 61 97 61 61 61 62 62 62 21 - 201 201 202 201 16 16 16 146 48 48 54 59 59 58 59 58 - 58 59 59 60 60 60 60 60 165 166 166 167 168 169 169 168 - 165 164 133 134 88 21 62 54 55 60 61 48 49 81 164 128 - 63 245 246 23 23 23 99 18 85 85 153 151 151 149 149 150 - 20 21 62 62 62 62 62 62 62 62 62 62 246 246 245 245 - 40 40 99 22 23 23 62 62 62 62 62 62 62 246 246 62 - 16 19 61 61 16 16 61 61 55 61 61 97 61 62 62 62 - 166 237 72 72 238 238 238 238 239 62 239 239 63 63 63 207 - 19 20 19 19 21 62 21 21 23 62 62 62 62 62 246 62 - 61 61 62 62 62 62 239 75 98 97 82 150 149 150 151 152 - 5 38 39 39 3 3 43 43 43 43 101 101 245 245 63 63 - 18 20 19 98 19 87 168 62 168 62 62 62 246 245 63 63 - 153 84 85 18 17 18 19 19 19 20 21 23 62 246 245 239 - 97 61 61 61 61 168 168 62 168 169 169 62 171 63 63 63 - 38 38 38 39 39 41 41 41 41 23 24 24 246 246 246 63 - 151 83 16 17 19 19 19 19 19 62 62 62 62 62 245 207 - 203 203 203 202 202 17 20 148 49 49 54 54 58 59 59 60 - 60 55 60 60 60 60 61 237 237 71 238 238 238 239 239 75 - 167 166 135 136 24 246 62 51 97 61 61 49 51 97 166 128 - 77 77 171 170 170 169 169 90 87 98 84 84 84 82 50 50 - 62 62 239 239 239 239 75 75 76 76 76 76 76 77 77 77 - 90 90 90 90 169 62 62 239 239 239 239 75 76 76 77 76 - 61 62 62 62 97 61 61 73 61 60 237 73 73 238 75 74 - 71 71 72 72 72 73 74 74 75 75 75 75 75 76 76 77 - 21 62 62 21 62 62 62 62 239 239 75 75 76 76 77 77 - 238 238 74 75 75 75 75 76 167 98 84 83 82 152 153 40 - 40 39 41 92 27 29 29 29 138 139 139 172 172 77 77 77 - 87 169 169 62 239 239 169 169 75 75 171 171 76 77 77 77 - 84 98 88 87 168 168 168 168 169 62 239 239 239 171 76 76 - 237 71 71 71 73 73 74 75 75 75 75 75 75 76 77 77 - 40 39 41 41 136 91 91 91 246 246 246 246 171 76 77 77 - 97 98 61 98 61 168 62 62 239 62 62 239 76 76 76 77 - 204 204 204 204 204 61 20 49 80 54 54 60 59 60 59 59 - 60 236 70 236 70 71 71 71 73 72 73 74 75 75 76 76 - 238 167 136 137 171 63 76 96 61 237 238 81 96 165 167 160 - 166 165 165 164 163 163 162 162 161 104 160 160 160 160 105 247 - 163 163 163 164 164 164 164 164 165 165 165 165 165 165 165 165 - 162 162 162 163 163 163 163 163 164 164 164 164 165 165 165 165 - 161 162 163 163 160 161 162 250 104 64 64 249 250 250 250 250 - 249 65 65 66 66 66 67 67 68 68 68 165 165 165 165 165 - 162 162 162 163 163 163 163 163 164 164 164 164 165 165 165 165 - 163 250 250 163 164 164 165 165 162 161 160 105 105 105 128 129 - 129 129 130 131 132 132 132 133 133 133 84 165 165 166 166 166 - 162 162 162 162 162 163 163 163 164 164 164 165 165 165 166 166 - 161 104 104 104 161 162 162 162 162 163 163 164 164 165 165 165 - 64 64 65 65 66 66 66 67 250 250 165 165 165 165 166 167 - 129 129 129 130 130 130 131 81 81 163 164 164 165 165 165 166 - 104 104 104 104 161 162 163 163 250 96 96 96 165 165 165 61 - 214 55 214 54 54 54 162 105 105 248 52 52 52 57 57 57 - 227 231 229 230 232 65 65 65 65 66 66 67 67 68 165 68 - 66 64 163 133 83 165 165 248 64 64 65 105 160 160 161 160 - 166 166 165 164 164 163 162 162 64 64 160 160 160 248 248 248 - 250 250 250 250 164 164 164 164 165 165 165 166 166 166 166 166 - 162 162 162 163 250 250 250 250 250 250 164 165 165 166 166 69 - 249 249 250 250 104 249 65 66 64 64 65 66 67 68 68 69 - 65 65 66 66 66 235 234 234 68 69 69 69 69 69 69 69 - 162 162 163 250 250 250 250 164 165 164 164 165 165 166 166 236 - 66 67 67 67 164 69 69 69 64 64 160 160 105 160 160 255 - 255 255 162 163 164 164 164 165 165 165 165 166 166 166 70 70 - 162 162 163 163 163 250 250 250 164 165 165 165 166 166 70 70 - 161 64 64 64 64 64 162 163 163 250 164 164 165 165 166 69 - 65 65 66 66 66 235 235 235 235 68 69 69 69 69 70 166 - 255 255 255 255 162 162 162 163 164 164 164 165 165 69 236 70 - 104 64 64 64 249 250 250 250 250 250 165 165 165 236 236 61 - 54 60 54 54 54 249 250 247 247 248 248 57 57 58 57 57 - 228 229 229 230 232 232 233 66 66 66 235 235 68 69 69 69 - 66 64 163 165 165 166 236 160 64 65 66 248 160 104 249 160 - 237 166 166 165 164 164 163 162 162 162 161 160 160 160 160 248 - 250 164 164 165 165 165 165 165 165 166 166 166 70 70 237 70 - 163 163 250 250 250 250 68 68 68 68 165 165 166 70 166 70 - 162 250 250 250 161 249 66 66 64 249 65 67 68 68 69 69 - 66 66 66 235 235 234 234 69 69 236 236 70 70 70 70 70 - 250 250 250 250 250 250 164 164 165 165 165 166 166 166 70 70 - 67 68 68 68 69 69 70 70 64 64 160 160 160 160 160 255 - 162 162 163 164 164 133 165 165 165 166 166 166 167 237 237 70 - 162 163 250 250 250 250 164 164 165 165 166 70 70 70 237 70 - 161 64 162 65 162 162 250 250 250 164 164 165 165 166 166 236 - 66 66 66 235 235 235 234 68 69 236 236 70 70 70 70 237 - 255 130 130 162 162 163 163 164 164 164 165 165 166 166 70 70 - 104 64 249 249 250 250 250 250 250 250 165 166 166 70 70 237 - 49 60 60 60 60 250 250 247 248 248 52 57 57 57 57 57 - 229 229 229 232 232 233 233 233 66 235 235 234 69 236 70 70 - 66 64 163 165 166 167 70 64 64 65 235 248 104 161 162 160 - 237 237 166 166 165 164 164 163 162 162 162 161 160 160 160 160 - 165 165 165 165 165 166 166 166 166 70 237 237 237 237 237 237 - 164 164 164 164 164 165 69 69 69 69 236 70 70 70 237 70 - 250 250 250 250 162 250 250 67 249 65 66 67 68 69 69 236 - 66 235 235 234 234 234 69 236 236 70 70 70 70 237 237 237 - 250 250 250 164 165 165 165 165 165 166 70 70 70 70 237 237 - 68 69 69 69 69 70 70 70 163 249 161 160 160 104 255 255 - 130 131 132 133 165 165 166 166 166 166 167 167 237 237 237 237 - 163 250 250 250 164 165 69 165 165 166 70 237 237 237 237 237 - 162 162 162 163 250 250 250 250 164 165 165 166 166 166 166 70 - 66 66 235 235 235 68 69 236 236 236 70 70 237 237 237 237 - 255 130 162 163 163 163 164 164 164 165 165 166 166 70 70 237 - 162 249 250 250 250 250 250 250 250 165 166 166 70 237 237 237 - 55 16 55 55 55 60 250 105 248 248 53 53 57 58 58 58 - 229 229 230 232 233 233 234 235 235 234 234 69 236 70 70 70 - 235 65 164 165 166 167 70 64 65 66 68 160 104 162 250 160 - 72 71 237 237 166 165 165 164 163 163 162 162 161 160 160 160 - 165 166 166 166 237 237 237 237 237 237 237 237 237 237 168 71 - 164 164 165 165 165 165 166 236 70 70 237 237 237 237 237 237 - 250 250 68 69 162 250 67 68 66 66 67 68 69 236 70 237 - 68 234 234 69 69 236 236 70 70 70 70 70 237 71 71 71 - 165 165 165 69 69 166 166 70 70 70 237 237 237 237 237 71 - 236 236 70 70 237 237 237 71 250 163 162 104 104 255 255 80 - 131 132 133 134 135 135 167 167 167 167 168 168 168 238 72 72 - 164 164 164 165 165 69 166 166 70 237 237 237 237 71 72 73 - 250 250 250 250 250 250 165 165 165 166 70 70 166 237 237 237 - 68 68 68 69 69 236 236 70 70 70 70 237 71 72 72 73 - 163 132 163 164 164 164 165 165 165 166 166 167 237 237 237 71 - 163 250 250 250 250 250 250 165 166 166 237 237 237 237 237 238 - 16 16 55 55 55 60 96 160 160 53 53 53 58 58 58 59 - 230 230 230 233 233 234 234 235 234 69 69 236 70 70 71 71 - 68 66 165 166 167 168 237 64 66 66 69 160 161 162 250 160 - 73 73 71 237 237 166 165 165 164 163 162 162 255 255 255 160 - 166 166 237 237 237 237 237 237 237 237 72 238 238 238 238 238 - 165 165 165 165 166 166 166 237 237 237 237 237 237 71 72 72 - 164 165 69 236 250 250 68 69 250 67 67 69 236 70 237 71 - 69 69 69 236 236 70 70 70 71 71 71 71 71 72 72 72 - 165 165 165 236 70 70 70 237 237 237 237 237 237 71 72 73 - 70 70 237 237 237 71 72 72 164 163 162 104 255 255 81 81 - 132 133 134 135 86 88 87 88 168 168 169 169 238 238 238 73 - 165 165 165 69 166 70 70 166 237 237 237 237 72 73 73 74 - 164 250 250 164 165 165 166 166 165 166 237 237 237 237 71 71 - 68 68 69 236 236 70 70 70 70 70 237 71 72 73 73 74 - 163 132 164 164 165 165 165 166 166 167 167 168 168 71 238 73 - 163 250 250 96 96 165 165 166 237 237 237 237 237 237 238 74 - 16 16 16 61 60 97 96 160 160 53 59 58 58 59 58 58 - 230 230 233 234 234 234 234 68 69 236 236 70 70 71 71 72 - 69 67 165 166 168 169 71 249 66 67 236 160 161 163 165 160 - 74 73 238 168 168 167 166 165 165 164 163 162 162 255 255 255 - 167 237 237 237 237 168 168 168 168 238 238 238 238 238 74 74 - 166 166 166 166 166 167 167 237 237 237 71 238 238 238 238 73 - 165 166 70 70 250 250 69 70 250 250 250 69 70 71 71 72 - 236 236 236 70 70 70 70 71 71 71 72 72 73 73 73 73 - 166 166 166 70 237 237 237 237 237 237 71 72 72 238 73 74 - 237 237 237 71 72 238 73 73 165 163 163 161 255 255 131 132 - 132 134 135 88 136 90 137 90 169 169 169 239 238 238 74 74 - 165 166 166 166 70 237 237 167 237 237 72 238 238 73 74 74 - 96 96 96 165 165 166 166 166 166 237 237 168 168 238 238 73 - 69 69 236 70 70 70 237 71 71 71 71 73 73 73 74 74 - 164 133 133 165 165 166 166 167 167 167 168 168 168 238 238 74 - 163 96 96 96 165 166 61 61 167 237 72 238 238 238 238 75 - 19 202 16 16 60 61 165 255 104 104 59 59 59 59 58 58 - 230 233 234 234 234 234 69 69 236 70 70 70 71 71 73 73 - 69 69 166 167 169 239 72 250 67 68 237 161 162 164 165 160 - 75 74 74 238 168 168 167 166 165 165 164 164 82 130 254 129 - 168 168 168 238 238 238 238 238 238 74 74 74 74 74 75 75 - 167 166 166 167 167 168 168 168 238 238 238 238 238 238 74 74 - 166 237 237 237 164 96 236 237 250 250 68 70 71 73 73 73 - 70 70 70 70 71 71 71 71 72 73 73 73 74 74 74 74 - 237 237 237 237 237 237 72 238 238 238 238 238 238 74 74 75 - 71 71 71 238 238 238 74 75 166 165 164 162 81 130 132 132 - 132 134 135 88 136 137 137 137 137 170 239 239 239 75 75 75 - 166 166 237 237 237 237 237 237 238 238 238 74 74 74 75 75 - 96 96 97 166 166 166 61 61 61 168 238 238 238 238 74 74 - 166 70 70 237 237 71 71 72 72 73 73 74 74 74 74 75 - 84 133 134 135 135 166 167 167 168 168 169 169 169 238 239 74 - 96 96 97 97 61 61 61 61 61 168 238 238 74 74 74 75 - 153 202 203 61 17 61 97 49 80 53 54 59 59 59 59 59 - 67 234 234 234 234 69 236 236 70 70 71 71 72 73 74 74 - 70 69 166 167 170 239 238 250 68 69 71 162 163 165 166 160 - 76 75 75 239 169 168 168 167 166 166 84 83 82 81 80 254 - 238 238 238 238 238 74 238 238 238 74 75 75 75 75 75 75 - 167 167 168 168 168 168 168 169 238 239 239 239 239 239 75 75 - 166 167 237 238 165 165 237 72 250 250 250 237 71 71 74 74 - 237 70 70 71 71 71 72 73 73 73 74 74 74 75 75 75 - 167 168 72 238 238 238 238 238 238 238 238 74 74 75 75 75 - 72 72 238 238 239 75 75 75 166 166 164 163 80 131 132 132 - 134 134 88 136 91 24 138 246 246 246 170 171 75 76 76 75 - 167 167 237 237 237 238 238 238 238 238 74 75 75 75 75 75 - 97 97 97 61 61 61 61 61 168 168 238 239 239 239 239 75 - 167 237 237 237 71 72 73 73 73 74 74 74 75 75 75 75 - 134 135 135 135 135 136 168 168 168 169 169 170 239 239 75 75 - 96 97 97 61 61 61 61 61 238 238 169 239 75 75 75 76 - 20 202 203 61 61 17 61 49 49 49 54 54 59 59 60 250 - 67 68 67 236 69 236 70 70 70 71 72 73 73 74 74 74 - 237 70 167 169 170 239 75 163 69 237 71 80 164 166 166 160 - 76 75 75 239 169 168 168 167 86 85 84 83 82 82 50 80 - 169 238 238 238 238 239 239 238 239 239 75 75 75 75 76 76 - 168 136 168 168 168 168 169 169 169 239 239 239 239 239 75 75 - 166 167 168 238 97 97 61 72 96 60 165 71 73 238 75 75 - 237 237 71 71 72 72 73 73 74 74 74 75 75 75 75 75 - 167 168 168 168 238 238 238 238 239 239 239 239 75 75 75 75 - 238 238 238 238 239 75 75 75 166 166 164 81 131 131 132 37 - 134 40 41 91 92 25 138 246 246 246 171 171 76 76 76 76 - 167 167 168 168 168 238 238 238 238 239 239 75 75 76 76 76 - 97 97 97 98 61 61 61 61 168 168 169 239 239 239 75 75 - 167 237 237 237 71 72 73 73 74 74 75 75 75 75 75 76 - 134 134 135 135 88 136 136 136 137 169 170 170 170 171 76 76 - 97 97 97 61 61 61 168 168 62 169 169 239 75 75 76 77 - 20 203 203 204 61 61 61 49 49 49 54 54 59 60 60 250 - 250 68 68 70 236 70 70 70 71 71 72 73 74 74 75 75 - 237 167 167 137 170 171 75 164 165 237 238 80 84 166 166 160 - 77 76 76 171 169 169 169 87 86 85 84 83 83 82 50 50 - 169 169 239 239 239 239 239 239 75 75 76 76 76 76 76 76 - 136 136 137 137 169 169 169 170 170 239 239 171 171 76 76 76 - 98 61 168 238 97 61 61 73 60 60 166 72 238 238 75 75 - 237 71 71 73 73 73 74 74 74 75 75 75 75 76 76 76 - 167 168 168 169 169 169 239 239 239 239 239 239 75 76 76 76 - 238 238 238 239 239 75 76 76 167 166 84 82 131 132 37 38 - 40 39 41 42 92 93 28 29 29 94 245 63 172 77 77 77 - 167 168 168 169 169 238 238 169 239 239 239 75 76 76 76 77 - 84 17 17 98 19 21 21 90 90 169 62 239 239 171 76 76 - 168 237 237 238 238 238 74 74 75 75 75 75 76 76 76 77 - 134 38 135 135 136 136 137 137 137 170 170 170 171 171 76 77 - 84 17 98 19 19 21 21 62 62 62 62 239 76 76 76 77 - 21 203 203 203 20 20 21 49 49 80 55 60 60 60 55 250 - 250 68 68 70 70 70 70 71 71 72 73 74 74 75 75 75 - 237 167 168 137 171 171 76 164 166 237 238 80 83 98 167 160 - 77 77 172 171 170 169 23 90 87 86 85 84 152 152 151 50 - 169 169 239 239 239 239 75 75 76 76 76 76 76 77 77 77 - 137 137 137 137 137 170 170 170 170 170 171 171 171 172 172 77 - 87 168 169 62 98 61 168 238 97 97 61 238 238 239 75 76 - 168 71 73 73 74 74 74 75 75 75 75 76 76 76 77 77 - 90 169 169 169 62 170 239 171 239 171 171 171 76 77 77 77 - 239 239 239 239 171 76 76 77 168 167 84 132 132 37 38 38 - 39 39 155 92 43 44 29 29 94 139 139 172 172 173 77 77 - 168 168 169 169 169 239 239 170 239 239 75 76 76 77 77 77 - 85 18 19 20 99 21 22 23 62 62 170 171 171 63 77 77 - 168 168 238 238 238 238 239 239 75 75 76 76 76 77 77 77 - 38 38 39 41 136 136 137 138 138 246 246 171 171 172 172 77 - 85 18 19 19 20 21 62 62 62 62 170 171 76 77 77 77 - 23 204 204 204 204 21 62 149 50 50 55 60 60 55 55 60 - 60 60 68 71 237 71 71 71 73 73 74 74 75 75 76 76 - 168 167 136 137 139 171 76 165 166 168 169 50 84 98 167 104 - 78 172 172 63 246 26 100 22 99 88 40 153 153 152 151 150 - 169 170 171 171 171 171 76 171 76 76 77 77 77 77 77 77 - 137 137 137 26 26 246 246 246 246 171 171 171 172 172 172 173 - 87 90 169 62 98 19 62 62 97 97 61 238 169 239 76 76 - 168 238 238 74 74 74 75 75 76 76 76 76 77 77 77 77 - 22 62 62 62 62 170 246 171 171 171 171 172 172 77 77 77 - 239 239 239 171 171 77 77 77 87 88 134 132 132 37 38 4 - 39 41 3 43 44 2 2 31 45 103 103 140 173 173 173 78 - 90 169 169 169 169 170 239 239 171 171 76 76 77 77 77 77 - 86 86 20 99 21 22 23 23 24 246 246 245 63 172 77 77 - 169 169 238 238 238 239 239 239 75 76 76 77 77 77 77 78 - 4 4 4 244 244 244 92 138 138 138 139 139 139 172 173 78 - 85 19 20 21 21 21 62 62 62 246 245 63 172 77 77 173 - 204 204 204 204 204 23 62 149 150 150 51 55 60 55 60 60 - 60 61 165 71 71 71 71 73 73 74 74 75 75 76 76 76 - 238 167 137 137 139 139 76 165 167 168 239 82 84 86 168 48 - 78 173 172 172 246 26 24 91 41 41 40 40 38 37 36 150 - 246 171 171 171 171 171 63 63 63 172 77 173 173 173 78 173 - 92 25 26 27 138 246 246 246 246 171 172 172 172 140 173 173 - 90 62 62 62 19 21 62 62 97 97 168 62 62 171 63 77 - 169 238 238 74 75 75 75 76 76 76 77 77 77 173 78 78 - 23 62 62 62 246 246 246 245 245 63 63 172 173 173 173 78 - 239 239 171 171 77 77 77 78 136 88 134 132 37 37 38 4 - 39 3 3 43 2 2 31 94 95 95 158 140 173 173 79 78 - 169 169 169 169 170 170 171 171 171 171 172 77 77 77 78 78 - 88 99 99 21 22 23 23 100 26 246 246 245 63 172 173 77 - 169 169 238 238 239 239 239 239 76 76 77 77 77 78 78 173 - 4 4 244 244 244 244 43 93 29 94 139 139 172 172 173 78 - 86 20 99 21 22 23 24 246 246 245 63 63 172 173 173 173 - 205 205 204 204 204 23 23 149 150 50 51 55 55 55 60 61 - 61 61 166 72 71 71 72 73 74 74 75 75 76 76 77 76 - 238 167 170 137 139 172 77 165 167 169 239 152 84 88 168 48 - 79 173 173 172 245 101 27 92 42 41 39 39 38 37 37 36 - 246 245 171 171 171 63 63 63 172 173 173 173 78 78 79 79 - 25 27 27 28 246 246 246 139 139 172 172 172 172 140 173 173 - 23 62 62 62 20 21 62 62 17 17 62 62 62 171 172 77 - 170 238 238 239 75 76 76 76 76 77 77 77 78 78 79 79 - 23 246 246 246 246 246 245 245 245 63 172 172 173 173 173 78 - 171 239 171 172 77 173 78 78 90 88 134 133 37 38 4 4 - 3 3 43 2 2 95 95 95 95 158 1 47 141 79 79 79 - 137 169 170 170 170 171 171 171 172 172 172 173 78 78 78 79 - 41 41 22 22 91 23 24 26 246 246 245 63 63 172 173 78 - 169 169 239 239 239 239 75 76 76 77 77 173 173 78 78 174 - 244 186 186 244 244 187 2 93 29 94 139 140 173 173 78 79 - 20 99 22 23 23 26 246 246 245 63 63 63 172 173 78 79 - 205 205 205 204 204 23 24 150 151 152 83 96 60 60 60 61 - 61 61 61 73 72 72 73 73 74 74 75 76 77 77 77 77 - 239 167 170 137 139 172 77 166 167 169 171 152 153 87 169 48 - 174 78 173 172 63 245 246 26 92 155 41 40 38 38 37 37 - 245 63 63 63 63 63 63 63 172 173 78 79 79 79 79 79 - 26 26 246 246 245 245 245 63 63 172 172 172 173 173 173 79 - 22 62 62 62 19 21 62 62 61 61 62 239 239 77 77 78 - 170 169 169 239 75 76 76 76 76 77 77 78 78 78 79 79 - 24 246 246 245 245 245 63 63 245 63 172 172 173 78 78 78 - 171 76 76 77 77 173 78 78 90 87 85 153 38 38 4 4 - 3 3 43 2 95 95 126 95 158 46 1 141 141 79 174 79 - 170 170 170 170 171 171 171 171 77 77 173 173 78 78 79 79 - 99 22 22 23 23 24 246 246 246 245 63 63 63 173 173 78 - 170 239 239 75 75 76 76 77 77 77 77 78 78 78 79 174 - 244 187 187 187 187 188 2 93 29 94 103 140 173 78 79 79 - 99 21 22 23 246 246 246 246 245 63 63 63 63 173 79 79 - 205 205 205 205 205 205 246 151 151 152 16 60 60 60 61 61 - 61 61 61 73 73 73 73 73 74 74 75 76 77 77 78 77 - 75 167 171 137 140 173 78 98 167 169 76 153 153 90 169 48 - 85 153 152 152 151 150 149 149 148 147 147 146 145 144 144 144 - 150 50 50 151 82 152 151 152 153 152 152 153 153 153 153 153 - 149 149 150 150 150 150 150 150 151 151 152 152 152 153 153 153 - 149 80 150 50 48 49 49 50 48 49 49 49 50 50 151 133 - 130 130 131 131 81 82 82 82 83 83 83 84 152 153 153 153 - 149 150 150 150 150 151 151 151 151 152 152 152 152 133 153 84 - 50 50 151 152 152 133 84 84 254 128 146 253 144 9 8 8 - 8 7 7 7 34 6 35 37 5 37 37 37 37 38 153 153 - 254 49 130 130 131 50 50 151 151 152 152 153 153 153 153 153 - 147 148 254 254 254 254 49 49 131 131 131 151 152 152 153 84 - 254 80 80 80 50 50 82 82 151 152 152 153 153 153 134 38 - 7 8 8 8 32 32 33 6 34 6 36 36 152 153 153 85 - 147 148 148 148 149 149 150 150 151 151 151 151 152 153 153 153 - 196 214 200 198 214 149 150 144 144 144 253 53 53 53 53 53 - 53 53 54 249 104 104 162 162 163 163 164 164 164 133 133 133 - 130 255 130 131 37 37 84 253 48 49 49 106 146 128 254 48 - 86 85 153 152 152 151 150 150 149 148 148 147 146 145 145 144 - 82 83 83 83 83 83 83 84 84 84 84 84 85 85 85 85 - 150 50 50 50 50 82 82 83 83 84 84 84 153 153 153 85 - 49 50 50 82 48 49 80 51 49 54 49 80 51 51 83 85 - 130 131 131 132 164 84 84 84 97 85 85 85 85 153 153 85 - 130 50 50 50 50 82 82 82 152 83 84 84 84 84 85 85 - 82 83 83 152 153 153 84 85 80 254 48 146 146 8 8 8 - 7 7 33 6 35 35 37 5 5 5 38 38 38 40 40 86 - 150 50 50 50 50 82 83 82 152 84 153 153 153 85 86 86 - 147 254 254 49 49 80 50 50 50 82 83 83 84 153 85 85 - 81 81 81 82 82 83 83 84 152 153 153 85 85 85 86 40 - 7 32 32 33 33 34 34 35 37 37 37 37 153 85 85 18 - 148 148 149 149 149 150 150 50 82 82 152 84 153 85 85 18 - 214 213 213 213 198 200 151 144 144 253 253 53 53 53 53 53 - 53 58 249 249 104 249 250 250 250 250 164 164 164 84 134 134 - 131 130 131 132 37 134 85 48 49 50 50 144 48 48 49 48 - 88 86 85 153 152 152 151 150 149 148 148 148 146 146 145 144 - 152 83 83 83 84 84 84 84 84 84 153 85 85 86 86 86 - 150 150 151 151 151 83 83 83 84 84 84 84 153 153 85 85 - 49 50 50 83 48 80 50 51 54 54 49 51 51 83 84 85 - 131 131 132 132 164 84 84 84 84 85 85 85 85 85 40 86 - 131 50 82 82 82 83 83 83 152 84 84 84 85 85 85 86 - 83 83 83 153 153 153 85 85 50 254 48 147 146 8 8 7 - 7 33 6 35 5 5 5 5 38 38 38 38 40 154 41 99 - 150 50 50 50 82 83 83 83 84 84 153 85 85 86 86 20 - 148 149 254 149 80 50 50 50 50 82 84 84 153 153 85 86 - 82 81 82 82 82 83 83 84 84 84 85 85 86 86 86 41 - 7 32 33 34 34 35 35 35 37 37 37 153 153 85 85 18 - 148 148 149 149 150 150 151 151 82 83 84 84 153 85 86 20 - 197 214 213 200 200 200 151 144 144 253 48 53 53 53 53 53 - 58 59 59 53 249 250 250 250 250 164 164 165 165 85 135 134 - 131 131 131 132 133 134 86 48 49 50 50 253 48 254 80 104 - 99 88 85 153 153 152 151 151 150 149 148 148 147 146 146 145 - 152 83 83 83 84 84 84 85 85 134 134 85 86 86 86 86 - 151 151 151 151 152 152 83 84 84 84 84 85 85 85 85 86 - 150 82 82 83 49 50 50 51 54 54 54 51 51 83 17 85 - 132 132 132 164 133 84 97 84 84 85 85 85 86 86 86 88 - 151 82 82 82 83 83 84 84 84 84 85 85 85 85 86 86 - 83 83 84 153 153 85 86 86 50 254 254 147 146 8 8 7 - 7 33 6 35 5 5 5 5 38 38 4 39 40 154 41 99 - 150 50 82 82 82 83 84 84 84 153 85 85 85 86 20 99 - 149 149 150 150 150 50 50 50 82 83 84 153 153 85 86 86 - 132 131 132 132 132 83 133 84 85 85 85 86 86 88 89 41 - 7 32 33 34 34 34 35 5 37 37 38 38 153 40 86 20 - 148 149 149 150 150 151 151 152 83 84 85 85 85 85 86 20 - 196 198 200 200 200 200 151 144 253 253 48 53 53 53 53 58 - 58 59 58 53 250 250 250 250 250 164 165 165 166 86 135 135 - 163 162 132 132 133 134 19 254 49 50 82 253 254 254 80 104 - 22 99 86 85 153 153 152 151 150 149 149 148 147 147 146 145 - 152 84 84 84 85 85 85 86 86 40 40 40 88 89 89 89 - 37 37 37 152 133 133 84 84 84 85 85 85 86 86 88 87 - 50 82 82 84 49 50 51 96 54 54 55 96 55 16 20 86 - 132 164 164 165 165 166 98 98 87 19 88 19 89 99 99 99 - 151 83 83 83 83 84 84 84 85 85 85 86 86 88 89 99 - 83 84 84 85 86 88 89 87 82 49 254 147 146 148 7 7 - 33 6 6 35 5 38 5 4 4 39 39 154 41 41 22 22 - 151 82 83 83 83 84 84 84 85 85 86 86 88 99 99 99 - 149 150 150 151 151 151 151 152 84 153 153 153 40 154 99 89 - 132 132 133 133 133 84 85 85 85 86 86 88 89 90 90 41 - 34 33 33 34 35 35 35 5 5 5 38 38 40 40 88 99 - 149 149 150 151 151 152 152 152 84 84 85 85 86 89 99 21 - 197 200 201 201 200 200 152 145 253 146 48 53 53 53 59 59 - 58 59 58 59 250 250 250 250 164 165 166 166 167 87 89 88 - 164 163 132 133 134 40 90 49 50 51 84 146 254 49 81 48 - 22 99 88 86 153 153 152 152 151 150 149 149 148 147 147 146 - 153 85 85 85 86 85 135 88 88 88 88 41 89 90 90 41 - 37 37 37 133 133 153 153 134 85 85 86 86 86 88 89 87 - 151 83 152 84 49 51 82 96 49 54 96 96 16 17 20 88 - 83 164 165 165 166 167 167 98 87 19 88 20 99 21 99 90 - 152 83 84 84 84 84 85 85 85 85 86 86 88 89 99 90 - 84 17 18 86 88 88 89 90 82 80 49 147 146 7 7 33 - 6 6 35 5 38 4 4 4 4 39 41 41 41 41 155 23 - 151 83 83 84 84 84 85 85 86 86 88 99 99 99 22 22 - 149 150 150 151 151 152 152 152 153 153 153 85 86 99 21 90 - 132 133 133 133 134 135 86 86 86 86 86 88 99 90 91 91 - 34 34 34 35 35 35 35 5 38 38 39 39 40 41 41 22 - 149 150 150 151 151 152 153 84 84 85 85 86 88 90 90 21 - 201 201 201 200 200 201 152 145 253 146 48 53 53 59 59 58 - 58 59 59 59 60 250 250 250 165 165 166 166 167 90 90 136 - 164 164 133 134 135 88 90 49 50 83 16 48 254 80 82 48 - 23 22 99 154 40 153 153 152 151 150 150 149 148 148 147 146 - 153 85 85 85 86 86 86 89 89 89 89 41 91 91 91 91 - 37 38 38 38 38 153 153 134 86 86 88 88 89 89 90 90 - 152 84 133 84 49 51 83 97 54 55 96 96 16 61 20 90 - 133 165 165 165 166 167 167 87 19 19 88 99 21 22 91 23 - 152 84 84 84 84 85 85 85 86 86 88 88 89 99 91 22 - 17 17 18 88 88 99 90 90 83 80 254 148 128 7 7 33 - 6 35 35 5 4 4 4 4 4 39 3 155 155 155 42 100 - 152 83 84 84 84 85 85 85 86 88 89 99 99 91 23 100 - 150 150 151 152 152 152 153 153 153 85 85 86 88 99 22 90 - 133 133 133 134 135 135 86 86 88 88 88 99 22 91 91 92 - 34 34 35 35 35 37 5 5 38 4 39 39 41 41 41 42 - 150 150 151 151 152 152 153 153 85 85 85 86 99 22 91 23 - 202 201 201 201 201 201 153 145 146 146 48 54 54 59 54 59 - 59 59 59 60 60 60 60 165 166 166 166 167 167 90 90 136 - 165 164 133 134 135 136 22 49 50 51 16 48 254 50 83 104 - 26 100 91 99 154 40 153 153 152 151 150 150 149 7 148 147 - 18 86 86 86 87 99 89 90 90 91 91 91 91 24 24 24 - 38 38 38 38 40 40 40 40 88 88 89 90 90 22 91 23 - 152 84 84 85 50 83 84 97 55 60 96 97 61 61 20 23 - 84 165 166 166 166 167 167 87 62 169 22 23 23 23 100 23 - 153 84 85 85 85 86 86 86 88 88 99 22 91 91 91 23 - 85 18 19 99 90 91 91 23 84 131 130 254 148 7 7 6 - 6 35 5 38 4 4 4 4 4 3 3 42 42 24 26 246 - 153 84 85 85 85 86 86 86 99 99 99 22 91 100 26 246 - 151 151 152 152 152 153 153 153 153 85 88 99 99 22 91 137 - 134 165 134 135 135 88 88 87 90 90 90 22 23 24 26 26 - 35 35 35 37 35 5 38 4 38 4 41 41 155 42 92 26 - 150 151 152 152 153 153 153 85 85 86 88 99 90 23 23 24 - 201 201 202 202 201 201 153 146 146 146 48 54 54 54 54 59 - 59 59 60 60 250 60 70 165 70 70 167 167 168 90 137 137 - 166 164 133 134 136 91 62 49 51 83 17 48 254 50 83 104 - 26 24 23 22 41 40 40 153 152 152 36 6 7 7 7 148 - 20 20 20 99 99 90 22 91 22 91 100 100 24 24 24 26 - 38 38 39 39 40 154 41 99 99 99 22 22 22 23 23 24 - 84 85 85 88 151 16 84 17 55 55 96 97 17 20 21 62 - 84 166 167 167 166 167 168 168 169 23 23 23 23 24 26 26 - 153 85 85 86 86 86 88 88 89 99 90 91 92 24 26 246 - 86 19 99 90 91 92 24 170 84 132 131 254 148 33 34 34 - 35 5 5 38 4 4 244 3 244 3 3 43 43 156 26 246 - 153 84 85 85 85 86 88 88 90 91 91 100 24 24 26 246 - 151 151 152 152 153 153 153 85 85 86 88 99 90 91 100 137 - 135 166 166 135 167 87 90 90 90 22 23 23 24 246 246 26 - 36 35 35 37 5 38 4 4 4 39 41 41 42 92 26 26 - 36 152 152 152 153 153 40 40 20 99 99 22 91 23 24 246 - 202 202 202 201 201 201 153 146 146 148 50 54 54 54 53 59 - 60 59 59 60 60 60 96 70 70 237 237 168 168 169 137 137 - 166 164 135 135 136 137 62 50 83 16 18 254 49 82 97 48 - 246 246 24 42 41 154 40 40 38 5 37 6 6 7 7 148 - 20 20 99 21 21 22 23 23 100 24 24 26 26 26 246 246 - 39 39 39 39 154 41 41 22 22 22 23 23 100 24 26 246 - 153 85 85 88 151 16 16 98 55 55 96 16 19 20 23 62 - 166 166 167 167 167 168 168 168 169 23 62 246 246 246 246 246 - 85 85 86 86 88 89 99 99 91 91 91 100 24 26 26 246 - 87 99 90 22 92 24 26 246 85 132 131 254 7 34 34 6 - 5 5 38 4 4 4 244 244 3 3 43 43 43 93 101 246 - 153 85 85 86 86 88 99 99 91 23 100 24 26 26 246 245 - 152 152 152 153 153 153 40 40 86 88 89 90 91 100 24 170 - 135 166 166 167 167 87 90 90 23 23 23 246 246 246 245 101 - 37 37 5 5 5 5 4 4 39 41 3 3 42 25 101 101 - 36 37 153 153 153 40 40 154 99 99 22 23 23 24 246 246 - 202 202 202 201 201 201 153 147 147 148 49 49 54 54 54 59 - 60 60 60 60 60 60 165 237 237 237 237 168 169 169 170 170 - 166 165 135 135 137 92 62 50 83 16 19 254 150 82 97 48 - 245 101 26 24 42 41 154 39 38 38 5 36 6 33 7 7 - 99 21 21 23 23 23 100 24 26 26 246 246 246 245 245 245 - 39 39 39 41 41 41 155 42 23 23 24 26 246 246 246 246 - 153 86 86 99 152 16 17 61 96 60 97 98 61 21 24 246 - 167 166 167 167 168 169 169 90 169 62 246 246 246 246 246 246 - 40 86 88 99 99 22 91 91 100 24 24 26 26 246 246 246 - 21 21 23 24 26 27 246 171 85 132 132 150 7 6 35 35 - 5 38 4 4 244 244 244 244 3 43 44 2 2 30 157 245 - 40 86 88 89 89 90 91 91 92 24 26 26 246 157 245 245 - 152 153 153 153 40 40 86 88 89 90 91 91 24 26 246 246 - 88 167 167 167 168 168 169 23 62 62 246 246 245 245 245 245 - 37 5 5 38 38 4 4 3 3 3 3 43 43 101 157 157 - 37 5 153 153 40 154 99 99 21 22 23 24 26 246 246 245 - 202 203 203 203 202 202 41 148 148 149 49 49 54 55 55 60 - 59 60 60 60 60 165 166 237 237 71 238 169 169 170 246 170 - 167 165 136 136 137 26 246 151 16 18 99 149 151 83 97 48 - 172 245 28 26 92 42 41 39 38 38 5 37 36 6 33 7 - 22 23 23 23 100 24 246 246 246 246 245 245 245 245 63 245 - 41 3 3 3 155 155 42 92 24 26 26 101 101 245 245 245 - 86 89 99 22 152 17 19 61 96 16 17 19 21 62 246 246 - 167 167 167 168 169 239 170 170 170 170 246 246 245 245 245 245 - 88 99 90 22 22 23 100 24 26 26 26 246 246 245 245 245 - 23 23 24 26 101 28 245 63 88 153 152 131 34 36 35 5 - 5 38 4 244 244 244 244 244 43 2 2 31 45 45 103 172 - 88 88 89 22 91 91 100 26 24 26 246 246 245 245 63 63 - 153 153 153 40 40 154 41 41 90 91 91 24 26 246 245 171 - 87 168 168 168 168 169 169 62 62 246 246 245 245 63 63 103 - 5 5 4 4 4 4 244 3 3 43 43 93 44 157 157 102 - 37 5 153 40 154 41 22 22 23 23 24 246 246 245 245 63 - 202 203 203 203 202 202 155 7 148 149 150 55 55 60 55 60 - 55 60 60 60 166 166 237 71 71 72 238 238 239 171 171 171 - 168 166 136 136 138 138 245 152 18 19 23 150 132 84 98 48 - 140 102 30 28 43 43 3 41 39 4 38 5 37 35 6 6 - 23 23 24 26 246 246 246 245 246 245 245 245 63 63 63 103 - 3 3 3 3 3 42 43 25 26 101 101 157 157 157 103 63 - 154 21 22 23 16 19 20 62 96 16 98 19 21 62 246 246 - 167 168 168 169 239 239 239 171 171 171 171 63 63 63 172 172 - 99 22 22 91 91 100 24 26 26 26 246 157 245 63 172 172 - 23 62 246 101 101 157 139 172 99 153 133 36 36 37 5 5 - 5 4 4 3 244 43 187 2 2 2 2 45 102 158 158 140 - 41 90 91 91 91 24 26 246 26 246 246 139 139 172 140 140 - 153 153 40 154 154 41 41 91 91 91 24 26 101 245 139 63 - 90 168 168 169 169 169 170 170 246 246 246 245 63 63 140 140 - 4 185 185 185 4 4 244 244 3 43 43 2 31 157 103 158 - 5 38 39 154 41 155 23 23 100 24 246 246 245 63 63 207 - 203 203 203 203 203 203 155 7 148 150 150 55 60 60 55 55 - 60 60 60 61 61 237 72 238 238 238 238 239 239 171 172 171 - 168 166 136 136 138 94 63 152 19 21 23 150 152 85 98 48 - 159 158 45 30 44 43 3 3 41 4 38 5 5 35 34 34 - 26 246 246 246 246 245 245 245 139 139 139 172 172 140 140 1 - 3 3 3 43 43 43 93 44 28 30 157 45 45 103 102 140 - 20 22 22 24 16 20 21 62 16 61 87 90 62 246 245 171 - 168 169 169 239 239 239 239 171 76 63 63 172 172 172 140 173 - 91 91 23 100 24 26 246 246 246 246 245 245 63 172 140 173 - 246 246 246 157 157 103 172 172 91 85 153 37 36 5 5 5 - 4 39 3 43 2 2 188 188 188 94 45 95 46 1 1 173 - 91 91 91 24 24 26 246 246 246 245 139 139 172 140 173 173 - 40 154 154 154 41 155 155 42 92 24 26 101 157 102 158 140 - 90 90 169 169 170 170 170 246 171 245 245 63 172 140 140 47 - 185 185 186 186 186 244 244 244 43 2 2 31 45 103 158 1 - 38 39 154 41 41 42 100 23 26 246 245 245 63 63 140 173 - 205 204 204 204 204 204 156 199 149 151 150 55 60 55 55 55 - 60 61 61 61 168 238 238 238 238 238 239 239 171 172 172 172 - 169 167 137 136 138 139 172 153 19 21 23 151 152 85 88 48 - 141 1 102 45 94 44 43 3 244 4 4 38 5 35 35 34 - 246 246 245 245 245 245 139 172 172 172 140 140 1 1 173 47 - 43 43 43 43 2 2 2 94 94 45 103 158 158 158 1 47 - 99 23 24 246 17 21 62 62 17 61 169 169 62 63 172 172 - 169 169 239 239 239 239 239 76 77 172 172 172 173 173 173 173 - 24 24 26 26 246 246 246 245 245 63 63 172 140 173 173 173 - 246 245 245 63 103 158 140 173 24 40 153 37 37 5 5 4 - 4 3 3 2 2 188 188 189 189 95 95 46 47 159 141 141 - 92 24 24 26 246 246 246 245 245 63 172 140 140 173 141 141 - 154 154 155 155 155 42 156 25 26 101 157 102 102 158 1 173 - 91 169 170 170 170 171 171 171 172 172 172 172 140 140 141 190 - 185 185 186 186 187 187 187 188 188 188 94 95 95 158 46 159 - 4 154 41 155 42 24 26 26 246 245 63 63 172 173 173 159 - 205 204 204 204 204 204 156 6 150 151 151 55 60 60 60 60 - 61 61 61 61 168 238 238 238 74 75 75 75 76 173 173 173 - 169 168 137 137 139 103 173 153 99 23 246 151 153 88 168 254 - 174 79 140 63 63 245 27 25 42 41 39 39 38 38 37 37 - 246 171 171 63 63 63 77 172 172 173 173 173 173 173 79 79 - 43 43 93 44 28 157 157 63 139 63 172 140 140 173 173 79 - 21 62 62 245 19 62 62 239 61 61 62 62 62 76 77 77 - 239 74 74 75 75 75 76 76 76 77 77 78 78 78 78 78 - 62 246 246 246 246 245 63 63 63 63 172 173 173 173 78 78 - 171 171 63 63 172 173 173 78 62 86 85 133 37 38 38 4 - 41 3 43 44 94 45 95 158 46 46 46 1 141 79 79 79 - 24 170 170 170 246 171 171 171 63 77 77 173 78 78 79 79 - 41 155 155 23 23 24 246 246 245 245 63 63 63 173 173 173 - 62 169 239 239 75 76 76 76 77 77 77 173 173 78 79 174 - 186 186 186 244 187 187 188 2 94 94 103 103 140 140 141 79 - 40 154 155 23 100 246 246 246 245 245 63 173 173 173 173 79 - 204 204 205 205 204 204 205 151 150 152 51 60 60 60 61 61 - 61 61 61 61 238 238 238 74 74 75 75 75 76 77 78 78 - 239 169 170 138 139 140 78 85 168 62 239 132 85 87 168 254 - 23 21 20 19 17 84 83 82 151 150 254 254 254 147 146 48 - 97 97 97 97 98 98 98 98 87 87 87 87 87 87 87 99 - 152 152 152 153 153 153 153 16 85 18 18 19 20 87 99 21 - 51 51 96 97 54 55 96 60 54 54 55 96 97 97 98 167 - 164 250 164 164 165 166 166 166 167 167 167 167 87 87 87 88 - 83 83 83 84 84 97 97 98 85 98 98 86 86 88 87 168 - 97 97 97 98 98 86 88 167 82 80 254 48 128 128 254 149 - 150 151 152 37 153 38 40 40 40 40 88 99 21 22 23 169 - 83 83 83 84 97 97 97 97 98 98 98 98 87 87 90 21 - 150 150 151 151 82 82 83 83 16 16 16 17 19 20 21 21 - 96 96 96 96 165 165 166 166 166 98 167 88 88 87 169 137 - 34 34 35 35 36 37 37 37 134 134 86 88 88 88 88 87 - 150 150 151 151 82 83 83 83 16 17 18 18 18 20 99 21 - 201 201 201 201 200 152 16 146 48 253 53 53 53 53 58 59 - 59 54 54 54 250 250 164 163 166 166 166 166 166 168 168 168 - 164 163 133 134 135 87 167 104 163 250 165 48 254 80 81 48 - 62 62 21 19 19 17 84 83 83 50 80 49 49 48 48 48 - 61 61 61 61 61 61 61 61 61 61 61 168 168 169 62 62 - 84 84 16 17 17 17 17 18 18 19 19 87 168 168 168 168 - 96 96 97 97 55 55 60 61 54 59 60 60 61 61 61 168 - 165 165 165 165 166 237 237 237 166 167 167 168 168 169 62 62 - 83 97 97 97 97 97 61 61 61 61 167 168 168 168 168 169 - 97 61 61 61 61 168 168 169 83 81 49 254 48 254 150 150 - 151 151 152 153 153 40 40 41 89 99 99 21 23 62 62 62 - 83 164 165 165 165 97 166 61 167 61 61 168 168 168 62 62 - 50 50 51 83 83 83 83 16 17 17 98 19 61 21 62 62 - 96 96 165 165 165 166 61 61 167 167 167 168 168 168 169 169 - 36 36 37 37 37 37 133 134 85 85 88 87 90 90 169 62 - 50 50 51 83 83 16 16 16 17 17 19 19 21 21 62 62 - 201 201 202 202 16 16 16 146 48 48 53 59 59 59 58 58 - 58 59 250 60 250 250 250 250 236 70 70 237 237 168 168 168 - 165 164 134 135 88 90 168 104 250 250 165 48 49 81 81 104 - 62 62 23 21 20 19 17 84 84 83 50 150 150 149 148 148 - 19 61 61 61 61 61 168 21 21 21 21 23 62 62 62 246 - 153 85 85 18 18 19 19 19 99 99 21 90 169 169 169 62 - 97 97 97 61 55 96 60 61 55 55 60 61 61 61 168 169 - 166 166 166 237 237 237 168 168 238 169 169 169 169 169 23 62 - 16 16 17 17 17 61 61 61 61 61 168 62 62 62 62 62 - 61 61 61 61 62 62 62 62 97 82 50 49 149 149 150 151 - 36 37 5 40 39 41 41 155 155 42 92 24 24 246 246 62 - 84 97 98 98 98 167 167 87 168 87 90 169 62 62 62 62 - 82 82 83 83 84 84 84 17 98 18 19 20 21 22 62 62 - 97 61 61 61 61 61 61 61 61 62 62 62 62 62 62 246 - 37 37 37 5 38 38 40 40 40 86 99 21 23 62 62 62 - 50 51 83 97 97 97 17 61 17 61 61 61 62 62 62 62 - 202 202 202 202 16 16 17 48 48 48 54 59 59 59 58 59 - 59 59 250 60 60 250 68 236 70 70 237 237 72 238 238 238 - 165 164 134 135 41 24 62 81 96 97 61 48 50 82 83 48 - 245 246 62 23 22 87 86 18 153 152 151 151 150 149 148 148 - 20 20 21 21 21 62 62 62 62 62 24 246 246 246 246 246 - 40 40 40 86 86 99 99 21 22 23 23 23 62 62 170 62 - 84 16 98 61 83 96 61 61 55 60 60 61 61 168 169 169 - 166 167 167 168 168 168 238 238 169 169 170 62 62 246 246 246 - 18 19 19 19 19 20 21 21 21 62 62 62 62 62 246 62 - 61 61 62 62 62 62 62 62 18 83 50 150 150 150 151 36 - 5 5 4 39 3 3 3 43 3 43 43 27 101 101 246 246 - 85 86 88 87 168 90 90 90 90 22 23 23 62 246 246 245 - 152 84 84 85 85 85 18 86 86 88 87 90 22 62 62 62 - 97 61 61 61 61 61 62 62 62 62 62 62 62 246 245 245 - 37 37 5 38 38 39 154 41 41 41 22 23 23 24 246 246 - 83 83 16 16 17 17 61 61 61 61 62 62 62 62 62 62 - 203 202 202 202 16 16 18 148 48 49 54 54 54 59 59 60 - 60 60 60 60 60 60 236 237 70 237 71 72 238 238 238 238 - 166 165 135 41 42 101 62 51 97 61 19 149 151 84 97 254 - 63 245 246 24 91 90 88 86 40 153 152 152 151 150 149 149 - 21 21 22 23 62 62 62 246 246 246 246 246 246 245 245 245 - 41 41 41 99 90 91 91 100 23 24 26 246 246 246 246 246 - 85 19 19 20 83 97 61 61 96 97 61 61 168 169 62 170 - 167 167 168 168 168 238 238 238 169 170 239 171 171 245 63 63 - 20 20 20 21 21 21 23 23 23 24 246 246 101 245 157 245 - 22 62 62 62 246 246 245 245 86 152 151 151 150 36 5 5 - 5 4 4 3 3 3 3 43 43 2 44 29 157 45 139 245 - 85 86 88 90 90 90 90 90 62 246 246 246 245 245 63 63 - 153 153 85 86 86 86 88 99 99 90 91 24 246 246 246 171 - 88 168 168 168 168 168 169 62 62 246 246 245 245 245 245 245 - 5 5 38 4 4 39 41 155 92 24 24 26 26 246 245 63 - 152 153 85 18 18 19 20 21 23 62 62 62 246 246 245 63 - 203 202 203 203 203 203 20 148 148 49 49 54 55 60 55 55 - 55 60 60 60 165 166 237 237 237 238 238 238 239 239 239 170 - 167 166 136 136 93 157 245 82 16 61 21 150 152 84 98 48 - 172 139 246 138 25 92 41 41 41 39 38 5 37 36 6 6 - 23 62 62 62 246 246 246 245 245 245 245 245 63 63 172 172 - 155 42 42 42 92 24 25 26 26 26 246 245 245 139 139 172 - 20 21 23 62 16 17 61 61 97 97 61 61 169 62 245 171 - 168 168 238 238 238 239 239 239 76 76 76 63 63 63 245 245 - 21 22 22 23 23 100 24 26 26 246 246 157 157 45 103 172 - 23 23 246 246 246 245 172 172 89 134 37 36 36 36 5 5 - 4 4 3 3 3 43 2 2 2 2 94 45 103 158 140 172 - 88 87 90 169 169 169 169 170 246 246 245 245 63 172 140 140 - 153 40 40 154 41 41 22 23 91 24 26 101 246 245 139 172 - 90 168 169 168 90 169 170 246 246 245 245 63 139 103 158 158 - 4 4 4 4 39 3 3 3 43 43 93 28 30 45 103 140 - 153 153 40 154 41 21 23 23 24 246 246 246 246 63 172 173 - 203 203 203 203 203 203 155 149 149 149 50 55 60 60 55 60 - 60 60 61 61 61 168 238 168 238 238 239 170 170 171 171 171 - 167 166 136 137 29 102 63 16 17 21 23 151 152 85 168 48 - 190 46 189 94 2 43 244 244 244 4 4 5 5 5 35 6 - 246 246 246 245 245 245 63 63 63 63 63 172 173 173 173 173 - 156 156 156 156 156 101 101 157 157 157 45 102 102 158 46 1 - 21 23 62 62 18 20 62 62 17 61 61 62 62 245 63 77 - 169 238 238 74 239 75 75 76 76 76 77 77 77 173 173 173 - 91 91 137 137 170 170 246 246 246 171 171 139 139 172 140 140 - 26 246 246 245 139 172 173 173 137 86 134 37 37 5 5 5 - 4 3 3 43 2 2 31 95 95 95 95 158 1 159 141 79 - 90 169 169 170 170 170 246 171 245 63 63 172 140 1 47 159 - 154 154 154 155 155 155 156 156 156 101 157 157 45 102 158 173 - 90 169 169 169 170 170 171 171 172 172 172 140 140 1 141 141 - 185 185 186 186 244 244 187 187 187 188 188 94 94 95 46 140 - 38 40 154 41 155 100 24 26 246 246 245 245 63 172 140 173 - 204 204 204 204 203 204 156 150 150 150 51 60 55 55 60 61 - 61 61 97 61 168 238 238 238 238 239 239 239 171 76 77 76 - 168 167 137 27 45 1 173 17 61 62 62 152 153 86 168 48 - 141 141 140 139 94 29 93 92 3 41 39 39 38 38 37 37 - 171 171 75 171 76 76 77 77 77 77 77 77 77 78 78 78 - 26 101 101 101 101 245 245 63 63 63 172 140 140 140 173 173 - 90 62 62 62 98 168 62 74 61 61 238 238 239 76 77 77 - 238 73 74 74 74 75 75 76 76 76 76 77 78 78 78 77 - 169 169 169 170 170 239 239 171 76 76 77 77 77 173 78 78 - 239 239 171 76 77 77 77 78 169 86 134 133 133 38 4 4 - 39 155 43 44 94 45 103 158 140 140 140 140 173 78 79 78 - 169 169 169 239 239 239 239 239 76 77 77 77 173 78 79 79 - 41 21 21 23 23 100 24 26 246 245 63 63 172 173 173 78 - 169 169 238 239 239 75 76 76 77 77 77 77 78 78 78 79 - 244 244 244 244 244 93 93 138 29 94 139 139 140 140 140 173 - 40 154 22 23 23 24 246 246 245 63 63 77 77 173 78 173 - 204 204 205 205 205 205 205 151 152 50 55 60 60 60 61 61 - 61 61 61 72 72 72 73 74 74 75 75 75 76 77 77 77 - 238 169 170 138 139 173 77 97 168 74 239 83 85 167 238 160 - 84 82 50 50 80 254 254 254 49 48 253 105 106 106 105 105 - 255 255 255 162 162 162 255 162 162 162 81 81 163 82 132 132 - 129 129 129 129 129 254 254 130 130 131 131 131 131 131 131 131 - 128 255 255 255 105 160 104 161 105 160 160 160 104 162 81 163 - 161 160 104 161 161 161 162 162 162 162 163 163 163 163 163 164 - 255 255 80 80 255 255 80 81 81 81 80 80 81 82 132 82 - 104 162 162 162 162 163 163 163 160 105 105 105 106 106 106 106 - 128 128 128 129 130 130 130 130 131 131 131 131 131 132 133 164 - 105 160 104 104 255 255 255 255 162 162 81 81 131 131 132 133 - 253 253 253 128 129 254 254 254 254 129 129 131 131 131 131 132 - 160 104 161 104 104 162 162 161 162 162 162 163 163 164 164 83 - 129 129 129 129 129 129 129 129 129 130 131 131 131 81 81 82 - 253 146 146 146 146 254 49 254 50 50 50 50 50 82 83 83 - 147 214 214 214 214 148 148 252 253 144 247 247 247 52 52 52 - 52 52 53 53 64 104 104 64 249 162 162 162 162 163 163 163 - 162 105 130 131 131 130 163 105 160 160 255 106 105 105 160 160 - 81 80 80 254 253 48 48 105 105 106 106 106 252 252 252 252 - 105 105 48 160 255 255 255 255 160 255 255 255 255 255 255 130 - 128 128 128 128 128 128 128 128 128 128 129 129 129 129 130 130 - 105 105 105 105 106 105 105 105 105 105 105 105 160 104 255 104 - 160 160 160 160 105 160 104 161 160 104 255 255 255 255 255 80 - 48 105 105 105 105 48 48 255 255 255 254 254 254 254 254 80 - 160 104 255 255 255 255 255 104 105 247 106 106 252 252 106 106 - 106 106 253 253 128 128 128 128 128 128 128 129 254 130 130 255 - 105 105 160 160 160 160 104 255 255 160 129 129 130 130 130 130 - 106 106 105 106 106 106 253 253 253 128 128 128 129 129 130 130 - 160 160 160 160 105 160 160 161 104 104 255 255 255 161 80 80 - 106 106 106 106 106 253 128 129 128 128 128 254 254 80 80 80 - 106 253 144 144 144 253 48 48 253 48 254 254 254 49 49 49 - 146 145 145 145 147 147 147 107 252 252 247 247 247 247 247 247 - 247 247 248 248 248 248 248 248 160 160 104 104 104 255 255 255 - 105 105 128 128 129 129 160 247 105 105 105 252 106 106 247 160 - 128 129 128 253 253 253 106 106 106 252 252 252 251 107 107 251 - 106 106 106 106 253 253 253 128 128 128 128 129 128 128 128 128 - 10 10 10 10 106 106 106 106 253 253 253 128 128 128 128 128 - 106 106 106 105 252 106 105 105 252 247 105 105 106 106 253 254 - 106 106 105 105 106 105 253 253 128 128 128 128 128 128 128 128 - 106 106 106 253 253 106 106 106 253 253 253 128 128 128 129 128 - 106 106 253 253 128 128 254 254 106 252 252 251 107 107 107 107 - 11 10 10 9 9 9 9 8 8 8 8 8 8 128 148 128 - 106 106 106 106 106 106 106 106 253 253 128 254 129 128 128 128 - 252 106 106 144 106 106 106 144 106 253 253 253 253 128 128 128 - 106 106 106 105 105 106 105 253 128 128 128 128 128 128 128 128 - 11 10 10 11 11 10 10 10 10 9 9 8 8 128 128 128 - 252 106 106 106 144 144 144 106 144 253 146 146 128 48 48 147 - 144 144 144 144 144 144 144 251 251 251 252 252 247 247 247 247 - 247 247 247 247 247 247 248 248 105 105 105 160 160 160 160 128 - 253 253 10 9 8 128 128 252 106 106 253 107 252 252 106 160 - 8 10 9 9 11 11 11 107 11 107 13 13 14 13 251 14 - 10 144 144 10 10 144 144 144 10 10 10 10 10 10 9 10 - 10 10 11 11 11 11 10 10 106 10 144 144 9 10 10 144 - 107 252 252 106 251 252 252 106 252 252 252 252 106 253 106 106 - 252 252 106 253 106 106 253 144 144 144 144 144 144 144 144 144 - 252 252 106 106 144 144 144 106 106 144 144 144 10 10 10 10 - 253 106 106 10 10 10 106 106 106 107 251 251 13 13 13 108 - 12 11 11 11 110 10 10 10 9 10 9 9 9 9 8 8 - 252 252 252 252 106 144 144 144 106 144 10 10 10 10 9 148 - 107 107 107 107 107 107 11 106 252 106 106 10 10 144 253 253 - 252 252 252 106 253 106 106 106 106 106 144 144 144 253 253 9 - 12 109 109 109 109 110 110 110 11 11 10 10 10 10 9 8 - 107 107 107 107 107 252 106 106 106 106 10 10 10 144 253 145 - 11 10 192 11 11 11 11 15 215 251 251 251 251 252 252 252 - 247 252 252 252 252 252 247 247 105 105 105 105 106 106 106 106 - 106 11 12 9 10 10 253 251 252 106 106 14 251 251 252 128 - 9 9 10 11 11 11 12 12 13 13 13 13 14 15 14 15 - 11 11 10 10 10 10 11 11 10 10 10 10 10 9 9 9 - 12 12 12 12 12 11 11 11 10 10 10 10 11 10 10 10 - 107 107 107 252 251 107 107 252 251 251 252 252 252 252 11 10 - 107 107 252 106 11 11 10 11 11 11 11 10 10 10 10 9 - 12 12 12 12 12 11 11 11 11 11 11 11 11 10 10 9 - 11 11 11 10 10 10 10 9 13 13 14 14 15 14 14 108 - 108 108 109 109 110 110 110 110 110 110 110 111 10 10 9 9 - 12 107 107 107 11 11 10 11 11 11 10 10 10 10 9 9 - 13 13 13 12 12 107 107 107 107 11 10 10 10 11 10 10 - 107 107 107 107 11 11 11 11 11 11 11 11 10 10 9 9 - 108 108 109 109 109 109 109 109 110 110 110 110 11 11 10 9 - 13 13 12 12 12 11 12 12 11 10 10 11 11 10 10 10 - 11 11 11 12 11 11 12 15 15 15 215 215 216 251 251 251 - 252 251 251 251 251 251 252 252 252 252 106 106 106 10 10 10 - 107 107 13 9 110 11 10 251 251 107 11 15 14 251 252 128 - 9 10 9 10 11 11 10 109 109 109 109 108 108 108 14 14 - 11 11 10 10 10 9 9 9 9 10 10 10 9 9 9 9 - 11 110 110 110 11 11 10 10 10 10 10 10 10 10 9 9 - 11 11 11 10 12 11 11 10 251 107 252 252 11 10 10 9 - 11 11 10 10 10 10 9 9 9 9 9 9 9 9 9 9 - 10 10 10 10 11 11 11 11 9 9 9 9 10 10 10 10 - 11 10 10 10 10 10 10 9 12 12 13 13 14 108 108 109 - 109 109 109 110 111 111 111 111 111 111 111 111 111 112 112 9 - 11 11 10 10 11 11 11 11 9 9 9 10 10 9 9 9 - 12 11 12 12 12 11 11 10 11 11 10 10 10 10 10 9 - 11 10 10 11 11 10 10 10 9 9 10 10 9 9 9 9 - 109 109 109 110 110 109 109 109 110 110 110 111 10 10 10 10 - 11 12 12 12 12 11 11 10 11 10 10 9 9 9 9 9 - 10 192 192 192 10 10 110 14 14 14 14 14 251 107 107 251 - 251 252 252 252 252 252 106 106 106 106 9 9 10 10 10 10 - 107 10 11 10 112 10 10 12 107 11 11 14 12 12 252 128 - 8 8 9 9 112 112 111 110 110 110 109 109 109 109 108 108 - 9 9 10 10 10 10 9 9 9 8 8 8 8 8 9 9 - 111 111 111 111 111 10 10 10 10 9 9 8 8 8 8 8 - 11 10 10 10 12 11 10 9 107 11 11 10 9 9 9 8 - 10 10 10 9 10 9 9 9 9 8 8 8 8 9 9 9 - 11 10 10 10 9 9 9 10 10 9 9 9 8 8 8 8 - 10 10 9 9 9 8 8 8 11 11 12 13 108 108 109 109 - 110 110 110 111 111 111 111 111 113 112 112 112 112 112 113 8 - 11 10 10 10 10 10 9 9 10 9 8 8 8 9 9 8 - 12 11 11 11 11 11 11 11 9 10 10 9 9 8 8 8 - 11 10 9 10 10 10 10 10 9 9 9 9 9 8 8 8 - 110 110 109 110 110 111 111 111 111 111 111 112 112 8 8 8 - 12 12 11 11 10 10 10 10 10 10 9 9 8 8 8 8 - 11 192 192 192 192 11 10 14 14 13 13 107 107 107 107 107 - 252 252 252 106 106 106 106 253 144 144 9 9 9 8 8 8 - 106 9 10 10 112 9 9 12 11 10 9 108 12 12 252 128 - 32 8 8 8 112 112 112 111 111 111 110 110 110 109 108 109 - 9 9 9 8 8 9 9 8 9 8 8 32 8 8 32 32 - 111 111 111 111 112 112 8 9 9 9 9 9 9 8 8 32 - 10 9 10 9 11 9 9 10 11 11 10 10 9 8 8 8 - 10 9 9 8 9 9 8 8 9 8 8 32 32 8 8 32 - 9 9 9 9 9 8 8 9 8 8 8 8 8 8 32 32 - 8 8 9 9 8 8 7 8 10 11 11 109 109 109 110 110 - 110 110 111 111 111 113 113 112 113 113 113 114 113 114 114 32 - 10 10 10 9 9 8 8 9 8 8 9 8 8 32 32 32 - 110 110 111 111 111 112 10 10 9 9 8 9 9 8 8 32 - 10 9 9 9 8 8 8 9 9 8 8 8 32 32 32 32 - 110 111 111 111 111 111 111 111 113 112 112 112 112 113 8 32 - 11 11 10 10 10 10 10 10 8 8 9 8 8 8 7 7 - 144 193 193 193 193 9 9 108 108 12 11 11 11 252 11 252 - 106 144 144 144 144 144 106 253 146 9 8 8 8 8 32 8 - 10 106 10 9 112 113 32 11 11 9 8 108 109 11 106 128 - 32 32 181 114 113 113 113 113 111 111 111 111 110 110 110 109 - 112 8 8 32 8 8 32 32 32 32 32 32 32 32 32 33 - 113 113 113 113 113 112 113 8 32 32 32 32 32 32 32 32 - 10 9 8 8 10 9 9 8 10 144 9 8 8 8 8 32 - 8 9 9 8 8 32 32 32 32 32 32 32 32 32 32 32 - 8 8 9 9 9 9 8 8 32 8 8 32 32 32 32 33 - 8 8 7 8 32 32 32 33 10 10 10 110 110 110 110 110 - 111 111 112 113 113 113 114 114 114 114 114 114 114 114 114 182 - 9 8 9 9 9 8 8 32 32 32 32 32 32 32 32 32 - 111 111 111 111 111 112 113 8 9 9 8 8 32 32 32 33 - 9 8 8 9 8 8 32 8 8 32 32 32 32 32 32 32 - 111 111 111 112 113 113 113 113 113 113 114 114 181 180 181 32 - 111 112 112 112 9 8 8 9 8 8 7 7 32 32 32 33 - 9 195 194 193 8 113 113 108 109 12 11 11 192 192 192 144 - 144 144 144 145 145 145 9 8 8 8 7 7 32 32 32 32 - 128 9 8 8 181 114 32 11 9 9 8 109 110 10 253 128 - 183 182 182 114 114 114 113 113 112 113 111 111 111 110 110 110 - 32 32 32 32 32 32 32 33 32 33 182 182 182 182 182 182 - 114 114 114 114 114 113 114 181 32 32 32 32 32 182 182 183 - 8 8 32 32 9 8 8 7 9 145 8 8 7 32 32 34 - 32 7 7 7 32 33 33 33 32 32 33 33 33 33 182 182 - 8 8 32 32 32 33 32 32 32 32 32 33 182 182 182 182 - 32 32 32 32 32 33 33 35 8 9 112 111 110 111 111 111 - 113 113 113 113 114 113 114 114 114 115 115 115 115 115 115 183 - 9 8 8 32 32 32 32 32 32 32 33 182 182 182 183 183 - 112 113 113 113 113 113 113 113 32 113 32 32 32 33 33 35 - 8 8 32 32 32 32 32 32 32 33 33 33 32 182 182 183 - 113 113 113 113 113 113 113 114 114 114 114 114 182 182 182 182 - 112 113 112 112 113 113 32 32 33 33 32 32 33 33 34 5 - 112 7 114 114 114 114 114 110 110 11 11 10 144 144 144 144 - 145 145 145 146 147 8 8 7 7 7 33 33 32 33 182 182 - 8 8 32 180 114 114 182 10 9 8 32 110 111 9 128 128 - 184 184 183 115 114 114 114 114 113 113 113 113 111 111 111 111 - 32 33 33 33 33 33 182 183 183 183 183 183 183 183 184 116 - 114 114 114 114 114 114 114 182 182 182 182 183 183 183 183 184 - 32 32 32 32 8 7 7 33 8 8 7 7 33 33 183 183 - 33 33 33 33 34 34 34 34 35 35 183 183 183 183 183 184 - 32 32 32 32 32 33 33 32 182 182 182 183 183 183 183 184 - 32 33 33 33 183 183 184 184 8 8 112 111 111 111 112 111 - 113 113 114 114 114 115 115 115 115 115 115 116 116 116 116 184 - 32 32 32 32 33 33 32 32 182 183 183 183 183 184 184 116 - 113 113 114 114 113 114 114 114 114 114 114 115 115 183 184 184 - 32 32 32 33 33 33 33 34 182 183 183 183 183 183 184 117 - 113 113 113 113 114 114 114 114 115 114 114 115 115 116 116 116 - 113 113 113 113 114 114 114 114 114 114 182 182 183 183 183 184 - 112 114 114 114 114 113 114 110 111 10 10 144 144 194 195 195 - 147 146 147 148 7 7 7 33 33 34 34 34 35 183 183 183 - 32 8 32 181 115 116 183 9 8 7 6 10 112 8 129 128 - 117 117 117 116 115 115 115 115 114 113 114 114 113 113 113 111 - 183 183 183 183 183 183 184 184 185 185 120 118 117 117 117 118 - 115 115 115 115 115 115 115 116 116 116 116 117 117 117 117 117 - 32 33 33 34 32 7 33 6 8 7 34 33 6 35 184 184 - 34 34 35 35 35 35 183 183 185 185 185 185 184 185 117 120 - 182 33 33 33 182 183 183 184 183 183 184 184 117 117 117 120 - 183 183 183 183 184 185 185 185 33 32 113 113 113 113 113 113 - 113 114 115 114 115 116 116 116 116 116 116 117 117 117 117 120 - 182 33 33 182 183 183 184 184 184 184 184 117 117 117 117 118 - 113 114 114 114 114 114 115 115 115 115 116 116 116 117 117 118 - 182 34 35 35 35 35 183 183 183 184 185 185 185 117 117 118 - 113 114 114 114 115 115 115 115 115 115 116 116 116 116 117 117 - 113 114 114 114 115 115 115 114 115 115 116 116 117 117 117 118 - 115 115 115 115 115 115 115 111 111 10 10 145 145 195 195 195 - 148 148 148 199 6 6 6 35 35 35 5 5 184 184 184 185 - 35 32 33 182 116 117 185 113 32 33 5 112 113 8 33 128 - 119 118 117 117 116 116 116 115 114 115 114 114 114 113 113 112 - 184 184 185 185 185 185 185 120 117 118 118 118 118 118 118 118 - 116 116 116 116 116 116 116 117 117 117 117 118 118 118 118 118 - 183 184 184 184 33 6 35 5 7 6 5 35 5 184 185 185 - 35 5 5 5 184 185 185 185 186 186 186 121 120 120 119 120 - 183 183 183 184 184 185 185 184 185 185 118 118 118 118 118 118 - 185 185 184 184 185 118 118 120 183 33 32 114 114 113 114 115 - 115 115 115 116 116 116 116 117 117 117 117 118 118 118 119 120 - 183 183 183 184 184 184 184 184 184 185 120 120 118 119 119 119 - 115 115 114 114 115 115 115 116 116 116 117 117 117 117 118 118 - 183 184 184 184 184 184 185 185 185 185 185 120 118 120 119 119 - 115 115 115 115 115 116 116 116 116 116 117 118 117 117 118 119 - 115 115 115 114 115 116 116 116 117 117 117 117 118 118 118 119 - 116 115 115 115 115 115 116 111 112 9 8 196 196 197 197 199 - 150 150 150 36 37 5 5 38 5 38 4 185 185 186 121 186 - 183 34 184 183 117 117 120 32 6 5 4 112 114 32 35 128 - 119 119 118 118 117 117 116 115 115 115 115 114 113 114 114 113 - 185 184 185 185 185 185 185 120 118 118 119 119 119 119 119 119 - 116 116 116 116 116 117 117 117 118 117 118 118 118 118 119 119 - 183 184 185 184 34 35 5 4 33 36 5 5 4 185 121 186 - 5 5 38 4 185 185 186 186 186 186 186 121 121 119 119 119 - 184 184 184 184 184 184 184 184 120 118 118 118 119 119 119 119 - 184 185 185 185 118 118 119 121 182 32 32 114 114 113 114 115 - 115 115 116 116 117 116 116 117 117 118 118 119 119 119 119 121 - 184 184 184 184 184 184 184 184 185 120 120 119 119 119 119 119 - 115 115 115 115 115 116 116 116 117 117 117 117 117 118 119 119 - 183 184 185 184 185 185 186 185 186 120 120 120 119 119 119 119 - 115 115 115 115 115 116 116 116 117 117 117 117 118 119 119 119 - 115 115 115 115 115 116 117 117 117 117 117 117 118 118 119 119 - 116 116 116 116 116 116 116 113 112 8 8 196 196 196 197 199 - 150 150 151 37 5 5 4 4 4 4 185 186 186 121 121 121 - 184 183 184 184 118 119 121 114 6 5 185 113 114 182 37 128 - 119 119 119 119 117 117 117 116 115 114 115 114 113 114 114 113 - 186 185 185 186 186 121 121 121 121 119 119 119 119 119 119 119 - 116 116 117 117 117 117 118 118 118 118 118 118 119 119 119 119 - 183 184 184 184 6 35 5 4 6 37 5 5 4 186 121 187 - 184 5 38 4 185 186 186 186 186 186 186 121 123 123 119 123 - 184 184 184 184 184 185 185 121 120 120 120 119 119 119 119 119 - 184 185 185 120 119 119 119 123 183 182 33 114 114 114 114 115 - 115 116 116 116 117 118 118 117 118 118 119 119 119 119 119 123 - 184 184 184 184 184 185 185 186 186 121 121 119 119 119 119 119 - 115 182 115 183 116 116 117 116 117 117 117 117 118 119 119 119 - 183 184 184 185 185 185 186 185 186 120 121 121 123 123 119 119 - 115 115 116 116 116 116 116 116 117 117 117 118 119 119 119 119 - 114 115 115 115 116 117 117 117 117 118 119 119 119 119 119 119 - 117 116 117 117 116 116 116 112 113 7 7 197 197 198 198 198 - 150 151 151 37 5 38 4 4 4 4 185 186 186 121 122 123 - 185 183 184 117 119 119 123 114 6 5 185 32 182 183 134 128 - 123 119 119 119 118 118 118 116 116 116 115 115 114 114 113 113 - 186 186 185 186 186 122 122 123 123 123 119 119 119 119 119 119 - 116 117 117 117 117 118 118 118 119 119 119 119 119 119 119 119 - 183 184 185 185 5 5 5 4 36 5 5 4 4 186 122 123 - 4 4 4 4 244 244 244 187 186 186 187 123 123 123 123 123 - 184 185 185 185 185 185 185 185 121 121 122 123 119 119 119 123 - 185 186 186 121 123 123 119 123 183 183 33 32 114 114 115 115 - 115 116 116 117 117 117 117 118 118 119 119 119 119 119 123 123 - 184 184 184 185 185 185 185 185 186 121 121 123 123 119 119 123 - 183 183 184 184 184 184 184 184 120 120 120 119 119 119 119 119 - 184 184 184 185 186 186 186 187 122 122 121 121 121 123 123 123 - 115 115 116 116 116 116 117 117 117 118 119 119 119 119 119 123 - 6 5 5 183 183 184 185 120 120 120 120 119 123 123 123 123 - 119 117 118 118 116 116 184 112 32 7 199 199 197 198 198 198 - 151 152 152 153 38 39 39 39 39 39 244 244 187 122 123 124 - 185 184 185 120 119 119 123 33 5 4 185 32 182 184 134 128 - 123 123 119 119 119 120 118 117 184 184 183 183 182 114 114 113 - 186 186 186 186 122 122 123 123 123 123 123 123 123 123 124 124 - 117 117 118 118 118 120 119 119 119 119 119 119 119 119 119 123 - 184 4 185 244 5 4 4 244 37 153 38 4 3 3 122 124 - 4 4 3 244 244 244 244 187 188 187 187 124 124 124 124 124 - 185 185 186 186 186 186 186 186 121 122 123 123 123 123 123 124 - 186 244 187 122 123 123 124 124 184 35 35 32 114 114 115 115 - 116 116 117 117 117 118 119 119 119 119 119 119 119 123 124 124 - 185 185 185 185 186 186 186 186 186 186 122 123 123 124 124 124 - 182 183 184 185 185 185 185 185 185 120 121 121 121 123 123 123 - 184 4 185 186 186 186 187 187 122 123 124 123 124 124 124 123 - 116 116 116 116 116 117 117 117 118 119 119 119 119 123 123 124 - 5 5 5 4 4 185 185 186 121 122 123 124 124 124 124 124 - 119 120 120 120 185 185 185 8 8 7 199 199 200 200 200 200 - 151 152 153 153 40 40 41 39 3 3 244 244 187 124 124 124 - 185 184 185 120 119 119 124 34 5 4 185 32 182 183 134 128 - 124 124 123 123 121 121 120 185 184 184 184 183 182 114 114 114 - 186 244 244 186 187 123 124 124 124 124 124 124 124 124 124 124 - 185 185 185 120 120 121 121 121 123 123 123 124 124 124 124 124 - 4 4 4 244 5 4 4 3 153 40 4 39 3 3 123 125 - 3 3 3 3 3 43 43 2 188 187 188 188 125 124 124 125 - 186 186 186 186 186 186 186 187 122 122 123 124 124 124 125 125 - 3 3 187 187 124 124 125 125 4 35 35 33 114 115 115 115 - 116 116 117 118 119 119 119 119 119 119 123 123 124 124 125 125 - 185 185 186 186 186 186 187 187 187 187 124 124 124 124 125 125 - 5 5 184 184 185 185 186 186 186 186 122 123 123 123 123 124 - 185 4 244 244 244 244 187 187 124 124 124 124 124 125 125 125 - 116 116 116 117 117 117 118 118 119 119 123 123 123 124 124 125 - 5 5 38 4 4 4 186 186 186 122 123 124 124 124 125 125 - 121 121 4 4 4 4 185 32 7 7 199 198 200 200 200 201 - 152 16 17 18 40 41 41 91 92 92 43 43 188 125 125 125 - 244 4 185 121 123 123 124 35 4 39 244 33 182 35 135 128 - 125 125 124 123 123 122 186 186 185 185 184 183 183 182 32 32 - 244 3 187 187 124 124 124 125 125 125 125 125 125 125 125 125 - 186 186 186 186 186 122 122 123 124 124 124 124 124 124 125 125 - 4 3 244 3 5 39 41 92 153 40 154 41 43 43 124 125 - 3 3 43 43 43 44 2 2 2 2 188 188 125 125 125 126 - 186 186 186 186 186 187 187 187 187 187 124 125 125 125 125 126 - 43 43 93 2 125 125 126 126 4 5 37 34 182 183 183 116 - 117 117 118 119 119 119 119 119 123 123 124 124 124 125 125 125 - 186 186 186 186 186 187 187 187 188 188 188 125 125 125 125 126 - 4 38 38 38 4 244 244 244 186 122 124 124 124 124 124 125 - 3 3 3 3 3 43 43 187 188 188 125 125 125 126 126 126 - 184 184 184 185 120 120 120 120 121 123 123 124 124 124 125 126 - 5 38 4 4 4 244 244 244 186 122 124 124 125 125 125 126 - 4 4 4 4 154 3 3 33 33 198 200 200 200 201 201 201 - 16 16 18 19 19 99 91 91 24 26 138 29 2 125 125 126 - 244 4 244 121 124 124 125 5 4 41 244 34 35 5 135 128 - 126 125 125 124 124 187 187 186 186 185 184 184 35 34 33 33 - 43 2 2 2 2 2 125 125 125 126 126 126 126 126 126 126 - 186 186 187 187 187 187 187 124 124 124 125 125 125 125 126 126 - 3 3 3 43 38 41 155 26 153 19 41 155 156 157 31 126 - 42 25 93 101 44 30 157 45 94 45 45 189 189 126 126 127 - 244 244 244 244 244 187 187 2 188 188 125 125 126 126 126 127 - 44 101 29 94 126 126 127 127 3 38 38 35 35 184 184 184 - 118 118 119 119 119 123 123 123 124 124 125 125 125 125 126 126 - 186 244 244 244 244 187 188 188 188 188 189 126 126 126 126 127 - 4 4 4 39 3 3 3 3 3 187 124 125 125 125 125 126 - 3 3 3 43 93 44 2 94 2 2 189 126 126 126 127 126 - 184 184 185 185 186 186 121 121 123 123 124 124 124 125 125 126 - 4 4 4 244 244 244 244 187 187 187 124 125 125 126 126 127 - 154 203 154 154 155 156 43 33 6 200 200 200 201 201 201 16 - 16 17 19 19 20 21 22 23 170 246 245 139 45 95 126 127 - 244 39 244 186 124 125 126 5 39 41 92 34 5 38 136 128 - 190 127 126 125 125 124 187 187 244 244 4 5 5 35 35 34 - 2 157 31 31 45 95 95 95 126 126 126 127 127 190 190 190 - 187 187 187 187 187 188 188 188 125 125 126 126 126 126 127 127 - 3 43 43 28 40 155 92 246 18 20 22 92 101 157 95 47 - 25 26 246 157 157 157 103 103 103 140 140 46 158 46 127 127 - 3 43 43 2 2 2 2 94 94 95 95 126 126 127 127 127 - 157 157 94 103 95 126 127 159 3 39 38 5 35 184 184 184 - 185 121 121 123 123 123 124 124 125 125 125 126 126 126 127 127 - 244 3 3 43 2 2 2 2 45 189 189 126 126 127 127 127 - 4 39 3 3 3 3 43 3 43 2 125 125 125 126 126 127 - 3 43 93 28 28 94 94 103 94 95 46 46 127 127 127 190 - 185 185 185 186 186 186 186 187 124 124 125 125 126 126 126 127 - 4 4 3 3 3 3 43 2 2 188 125 126 126 126 127 127 - 155 204 204 204 156 156 43 33 6 6 200 201 201 202 16 17 - 17 61 61 21 21 62 62 170 239 171 172 172 140 1 127 190 - 137 136 244 244 125 125 126 38 41 24 28 37 5 4 136 128 - 191 127 126 126 125 188 187 187 244 244 4 38 5 5 5 35 - 44 45 45 31 95 158 158 1 158 46 127 127 127 127 190 190 - 187 187 187 188 188 188 188 95 189 95 126 126 127 127 127 127 - 3 43 93 157 154 23 92 246 19 21 22 24 245 102 158 47 - 138 170 171 171 139 172 140 140 140 140 47 1 1 47 159 142 - 43 44 2 29 31 94 45 45 45 45 158 158 46 127 127 159 - 157 157 139 103 158 127 127 159 42 39 39 5 5 5 184 185 - 186 122 123 124 124 124 125 125 125 125 126 126 127 127 127 191 - 3 43 93 44 2 94 45 94 95 158 46 127 127 127 127 191 - 39 3 3 3 3 43 43 2 2 31 95 126 126 126 127 127 - 43 27 246 246 138 94 139 139 140 140 1 1 127 127 191 191 - 185 185 186 186 186 187 187 187 188 125 125 126 127 127 127 127 - 4 4 3 3 43 43 44 44 31 45 95 126 126 126 127 142 - 205 205 204 204 23 156 43 6 6 6 200 201 202 16 16 17 - 61 61 61 62 62 62 239 239 239 76 77 172 140 47 127 141 - 138 136 138 2 126 126 190 38 22 26 157 5 4 41 169 128 - 191 127 127 126 126 125 2 187 244 244 4 4 4 5 5 5 - 157 172 103 103 158 1 1 47 47 47 127 127 190 190 191 191 - 187 187 188 188 188 2 94 45 95 158 46 46 127 127 127 191 - 43 101 29 103 41 100 26 246 20 21 23 246 245 63 46 141 - 170 170 171 171 172 172 140 173 173 141 141 141 141 142 142 142 - 44 44 30 94 94 94 103 103 158 158 1 47 47 159 191 191 - 102 102 172 140 46 127 191 142 43 154 154 4 5 5 4 186 - 186 187 124 124 125 125 125 126 126 126 127 127 127 127 191 191 - 93 138 29 29 94 103 95 95 1 127 127 127 127 191 191 175 - 3 3 3 43 43 43 44 29 94 45 95 126 126 127 127 191 - 28 246 171 172 139 139 172 172 140 141 47 47 159 191 175 191 - 186 186 186 186 187 187 188 188 188 189 189 126 127 127 190 191 - 244 3 3 43 43 101 157 157 102 102 1 1 1 159 142 142 - 205 205 205 204 156 156 2 6 6 6 152 201 16 17 17 61 - 61 61 61 62 62 239 239 239 75 75 76 77 173 141 141 174 - 139 137 138 2 126 127 141 39 22 26 245 5 4 3 169 48 - 175 142 174 47 46 103 94 44 43 92 41 39 39 38 5 37 - 172 173 172 172 173 140 140 173 141 141 141 141 141 174 174 142 - 29 29 29 94 139 139 139 172 140 140 140 141 141 141 142 142 - 26 245 246 172 99 24 246 171 61 62 62 170 63 63 140 78 - 170 239 75 76 76 77 77 173 78 79 79 79 79 174 142 174 - 246 245 139 139 139 172 172 172 172 173 173 141 141 174 142 175 - 103 172 172 140 173 174 174 175 26 90 41 40 5 38 4 244 - 244 187 187 125 125 126 126 126 127 127 127 191 191 175 143 175 - 138 246 246 246 139 172 140 140 173 47 141 141 174 142 175 175 - 41 42 92 25 26 28 138 138 139 139 172 140 140 141 174 142 - 246 171 171 172 77 77 77 173 173 78 79 174 142 175 175 175 - 244 186 187 187 187 188 188 189 94 189 140 140 140 140 174 175 - 155 155 42 25 101 245 245 245 63 173 173 173 79 79 174 175 - 206 206 206 206 206 101 44 6 36 152 152 16 61 61 61 61 - 61 61 72 73 74 74 74 75 75 75 76 77 78 79 174 79 - 171 169 171 94 127 190 174 135 62 171 63 38 41 92 169 48 - 133 133 132 131 131 130 129 129 128 128 128 253 253 106 10 10 - 130 131 131 131 131 132 132 132 132 132 133 133 133 132 132 133 - 129 129 130 130 130 130 131 131 132 132 132 132 132 133 133 133 - 254 130 129 130 253 129 254 80 105 53 80 80 80 81 132 132 - 161 161 161 162 162 81 163 132 133 133 133 133 133 133 133 133 - 129 130 130 130 130 131 131 131 132 132 132 132 132 133 133 133 - 131 131 131 132 132 132 132 132 254 254 128 106 10 9 8 8 - 8 8 32 33 33 6 6 35 35 5 5 37 37 37 38 134 - 129 130 130 130 130 131 131 131 131 132 132 133 133 133 133 134 - 128 128 128 128 148 254 254 254 254 130 131 132 132 132 132 133 - 129 130 130 130 130 131 131 131 132 132 132 133 133 133 134 134 - 8 8 8 8 8 32 33 33 34 131 131 132 132 132 132 133 - 128 147 147 148 254 254 149 149 150 151 151 151 151 37 37 153 - 196 197 214 196 149 149 149 106 106 144 144 48 53 53 53 53 - 52 53 53 104 104 104 161 161 162 162 163 163 163 132 133 133 - 255 255 130 131 35 37 132 128 254 80 130 106 128 128 255 160 - 135 134 133 132 132 132 130 254 254 128 128 128 253 144 106 106 - 131 163 132 132 132 164 133 133 132 133 133 133 134 134 134 165 - 255 255 162 162 162 81 163 132 131 132 132 132 133 133 134 84 - 254 80 130 130 128 254 80 81 53 54 54 54 81 82 133 165 - 162 162 162 163 163 163 164 164 164 133 133 133 133 133 133 134 - 130 130 130 131 131 131 163 163 132 132 132 133 133 133 134 134 - 131 131 163 132 133 133 84 84 160 160 128 253 10 9 8 8 - 8 32 32 34 35 35 35 35 5 5 5 37 38 134 135 135 - 130 130 130 130 131 131 163 163 132 164 133 165 84 165 165 85 - 48 254 254 254 254 49 49 80 50 82 82 83 83 133 84 134 - 130 130 130 131 131 163 163 132 164 133 133 133 133 134 134 135 - 8 7 32 32 32 33 34 34 132 131 132 133 133 133 133 165 - 48 48 254 254 254 130 150 150 50 82 83 152 152 133 134 153 - 196 198 214 214 150 150 49 106 106 253 105 53 53 53 53 53 - 53 58 249 249 64 249 249 162 162 163 163 164 164 164 133 165 - 162 255 131 131 132 133 133 160 104 162 131 106 128 129 255 160 - 135 135 133 133 133 83 131 130 254 254 128 129 128 253 144 106 - 132 164 164 164 132 133 133 133 134 134 134 134 135 135 135 166 - 130 81 163 81 81 82 132 132 132 133 133 134 134 135 135 135 - 80 81 131 132 129 130 81 164 104 54 104 80 96 83 133 166 - 162 162 163 163 164 164 164 165 165 165 134 134 135 135 135 166 - 131 131 163 163 163 163 132 164 164 164 133 133 134 135 135 135 - 132 132 164 164 133 134 135 166 255 255 129 128 8 8 8 8 - 7 32 33 34 35 35 5 5 5 5 38 38 38 135 135 88 - 130 130 131 131 163 132 164 164 164 133 133 165 135 135 135 86 - 254 254 254 49 80 50 50 50 50 83 83 83 133 84 135 85 - 130 131 131 163 163 164 164 164 133 133 134 134 134 135 135 135 - 7 32 33 33 33 34 34 35 132 132 132 133 84 134 165 166 - 254 254 254 49 130 130 50 50 82 83 84 84 84 85 134 40 - 197 200 200 214 151 150 150 106 106 253 48 53 53 53 53 52 - 58 249 249 64 249 249 65 162 250 250 164 164 165 165 166 166 - 162 162 131 132 133 133 134 255 255 162 82 253 128 129 255 160 - 88 86 84 84 133 83 82 80 254 49 254 48 48 148 146 144 - 83 164 164 164 133 133 165 134 166 166 166 135 135 166 166 166 - 131 163 82 82 82 132 132 133 133 133 133 133 134 134 135 85 - 80 81 131 132 129 130 131 163 49 54 54 80 96 84 133 166 - 162 250 250 250 164 164 165 165 165 165 135 135 135 135 167 167 - 131 163 132 132 164 164 164 133 133 133 165 134 135 135 135 135 - 133 133 164 164 134 135 86 167 255 255 129 128 8 8 8 7 - 7 33 34 35 35 37 5 5 5 38 4 39 40 135 135 88 - 131 131 163 163 132 164 164 164 133 133 165 135 135 167 167 88 - 254 254 49 150 50 50 50 151 82 83 83 133 84 85 86 135 - 131 131 163 132 164 164 164 165 133 134 165 135 135 135 135 135 - 7 33 34 34 34 34 35 35 37 132 133 84 84 166 135 167 - 254 49 49 80 131 131 82 82 83 83 84 84 84 85 135 20 - 199 200 200 200 151 151 150 106 106 253 48 53 53 53 53 53 - 59 249 249 249 249 250 250 163 250 250 165 165 165 166 166 166 - 163 162 132 132 133 134 166 255 255 163 83 253 128 254 162 160 - 90 87 88 85 84 84 83 82 49 80 49 48 48 254 48 253 - 84 165 165 165 165 135 166 166 166 135 135 135 167 167 167 168 - 132 132 132 133 133 133 133 133 134 134 135 135 135 135 86 86 - 131 132 132 133 254 131 81 164 104 54 81 81 96 166 135 166 - 163 250 67 164 165 165 165 166 166 166 167 167 167 88 167 167 - 132 132 164 164 133 133 165 165 165 165 166 135 135 135 167 167 - 134 134 165 165 135 135 167 167 162 255 129 128 8 8 8 7 - 33 34 35 37 5 38 38 38 4 4 39 41 41 89 136 168 - 132 163 164 164 164 164 165 165 165 166 135 167 167 136 168 168 - 254 149 150 150 50 151 151 152 83 83 84 85 85 86 88 87 - 132 132 164 164 133 133 165 165 165 166 135 167 167 136 136 136 - 33 33 34 34 34 35 35 37 37 134 134 85 135 167 167 167 - 49 80 50 50 50 82 83 83 83 84 84 85 85 86 89 99 - 198 200 200 200 151 151 151 253 253 253 48 52 53 53 58 58 - 59 58 249 249 250 250 250 250 67 68 165 166 166 166 167 167 - 164 163 132 132 134 135 166 255 162 163 84 128 129 130 163 160 - 169 169 90 86 85 84 84 83 82 50 49 49 254 148 147 254 - 84 165 166 166 166 167 167 167 167 167 167 168 136 168 168 169 - 132 132 133 133 84 134 85 85 135 86 86 86 88 90 90 169 - 82 133 133 134 130 82 133 165 104 54 96 96 165 167 136 167 - 164 67 68 165 165 166 166 166 167 167 167 167 136 136 136 168 - 132 133 133 165 165 165 166 166 166 166 135 167 167 136 168 168 - 134 166 166 166 167 136 168 168 163 162 130 129 128 8 7 33 - 34 35 37 5 38 38 4 4 4 39 41 41 136 90 137 169 - 164 164 164 164 165 165 165 165 166 135 167 167 168 168 169 169 - 130 150 50 151 151 152 83 84 84 84 85 86 88 88 87 169 - 133 164 164 165 165 165 166 166 166 167 167 167 136 168 169 137 - 34 34 34 35 35 35 37 38 38 134 135 86 88 87 168 168 - 80 50 50 82 82 83 83 84 84 85 18 86 88 90 90 23 - 200 201 201 201 152 152 84 253 253 146 48 53 53 58 59 59 - 58 249 249 250 250 250 250 68 69 69 166 166 167 167 167 168 - 164 163 132 133 135 136 167 255 163 164 85 128 254 131 163 160 - 169 169 90 88 85 84 84 83 83 50 150 150 149 147 147 254 - 85 166 135 135 166 167 167 167 168 168 168 168 168 168 168 169 - 132 132 133 134 134 135 135 135 134 135 135 88 88 136 136 90 - 82 83 133 134 254 82 83 165 54 55 96 96 165 167 136 168 - 164 68 69 69 166 166 167 167 168 168 168 168 136 136 137 169 - 133 133 134 134 135 166 166 167 135 167 167 136 136 168 169 169 - 135 135 166 167 136 136 169 169 163 162 130 129 128 8 7 33 - 34 35 37 38 38 4 4 4 4 39 41 42 91 91 137 169 - 133 133 165 165 165 166 166 166 135 167 136 136 136 136 137 137 - 131 50 151 83 152 84 84 84 84 85 85 86 88 87 90 169 - 133 133 165 165 166 166 166 167 167 167 136 136 136 137 137 137 - 35 34 35 35 35 35 5 38 38 135 135 135 88 90 169 169 - 50 50 50 82 83 84 84 84 85 18 19 87 87 91 137 24 - 201 201 201 201 152 16 85 146 253 48 48 54 54 59 58 58 - 58 59 250 250 250 250 68 69 69 70 70 237 168 168 168 168 - 164 163 133 133 135 137 168 130 163 164 166 128 130 81 164 160 - 170 137 90 88 86 85 84 152 152 151 150 150 149 148 148 147 - 86 167 167 135 167 167 168 169 136 136 136 136 169 170 169 169 - 133 134 134 134 135 86 135 86 135 88 136 90 137 137 137 169 - 133 85 134 85 50 83 84 166 55 55 96 96 98 167 136 169 - 165 69 69 70 70 237 167 168 168 168 168 136 136 137 137 169 - 134 84 134 135 135 135 135 135 167 136 136 136 136 136 169 169 - 135 135 167 167 136 136 137 169 164 163 130 129 128 7 33 34 - 35 37 5 38 4 4 4 4 244 3 3 42 137 137 137 170 - 133 133 165 165 165 166 167 167 135 136 136 136 136 137 137 170 - 131 50 152 83 84 84 84 84 84 86 86 86 88 90 169 169 - 134 134 135 166 166 166 167 167 167 136 168 169 137 137 137 137 - 35 34 35 5 5 5 5 38 38 39 40 88 136 137 170 170 - 50 50 82 152 84 84 84 84 85 18 19 87 87 91 137 24 - 201 201 202 202 201 153 85 146 147 48 48 54 54 59 58 59 - 59 250 60 250 250 165 69 165 69 70 237 168 168 168 169 169 - 165 164 133 134 136 137 168 130 164 165 86 128 130 132 164 160 - 138 137 137 136 89 86 85 153 153 152 151 151 150 149 148 128 - 88 88 89 136 136 90 169 169 137 137 137 137 137 170 170 170 - 134 40 40 40 40 40 88 89 136 136 137 137 137 137 170 170 - 84 85 86 87 50 83 97 61 55 60 97 166 61 168 90 169 - 166 236 70 237 237 237 168 168 169 169 169 169 137 137 170 170 - 135 135 135 86 88 88 136 168 136 136 136 137 137 137 170 170 - 88 168 168 168 137 137 137 170 134 133 131 130 7 33 34 35 - 35 5 38 4 4 4 244 244 244 3 43 43 27 138 246 170 - 134 135 135 135 135 167 167 136 136 136 137 137 137 137 138 246 - 132 83 83 84 84 84 85 85 86 86 87 90 91 137 170 170 - 134 135 135 167 167 167 167 136 168 136 137 137 170 170 138 138 - 35 35 5 5 5 5 38 4 39 41 42 137 137 170 170 246 - 152 83 84 84 84 85 86 87 19 20 21 23 23 24 26 246 - 202 202 201 201 16 17 18 147 147 149 49 54 54 59 59 59 - 59 60 60 250 166 236 165 70 70 237 237 168 169 169 169 170 - 166 164 135 135 137 137 170 81 164 166 88 129 131 132 165 160 - 139 138 138 137 91 41 40 40 38 153 37 36 36 150 7 129 - 90 90 90 169 169 169 169 170 170 170 170 170 170 246 246 171 - 40 40 40 40 41 41 41 91 91 137 137 246 138 246 246 246 - 84 86 86 90 82 97 97 61 60 60 61 61 61 169 169 170 - 166 70 237 237 237 238 238 169 239 170 170 170 170 170 171 171 - 135 86 86 88 88 89 136 137 137 137 137 170 170 170 246 171 - 136 169 169 169 170 246 246 171 134 133 131 130 33 6 35 35 - 5 38 4 4 244 244 244 244 244 43 44 44 29 139 171 171 - 135 135 135 167 167 168 136 136 169 137 137 138 138 246 171 171 - 132 133 84 84 85 85 86 86 88 89 91 91 137 170 246 170 - 135 167 167 136 168 168 168 169 169 170 170 246 246 171 171 139 - 35 183 5 5 5 4 4 244 39 41 42 92 25 26 246 171 - 152 152 153 85 85 40 88 99 21 21 23 62 246 246 246 245 - 202 202 203 203 202 17 20 148 148 149 49 54 54 59 59 60 - 55 60 60 250 166 166 166 237 237 237 238 238 169 170 170 170 - 167 165 135 135 137 137 170 81 165 166 88 129 131 132 165 160 - 139 139 138 27 92 42 41 39 39 38 38 37 36 34 33 7 - 90 91 137 137 137 137 170 246 246 246 138 246 246 171 139 139 - 41 41 41 41 41 155 42 92 25 27 138 246 138 246 246 171 - 85 87 88 21 83 98 61 61 60 61 61 61 168 62 246 171 - 167 237 237 168 238 238 238 239 239 239 171 171 171 171 139 139 - 86 88 89 90 90 90 137 137 137 137 137 138 138 246 139 172 - 91 137 169 169 246 246 246 171 135 134 132 131 6 36 37 5 - 38 38 4 4 244 244 187 43 2 2 2 31 45 139 172 172 - 88 88 136 136 136 169 137 137 137 137 138 138 138 139 139 172 - 133 84 85 85 86 86 89 99 90 91 91 24 246 246 246 171 - 88 88 168 168 168 169 169 169 170 170 246 171 139 139 172 103 - 184 184 184 185 4 4 244 244 244 3 43 93 138 138 245 63 - 152 153 40 40 88 41 99 99 23 23 24 246 246 246 139 63 - 154 202 203 203 203 20 21 148 148 149 49 54 55 55 55 60 - 60 60 60 96 166 237 167 237 237 238 238 238 239 171 171 171 - 167 166 136 136 138 138 171 132 85 86 90 130 131 133 166 160 - 140 139 94 138 93 42 3 41 39 4 38 5 37 35 34 33 - 137 24 24 246 246 246 246 246 246 171 139 139 139 139 172 172 - 3 3 3 3 42 43 93 28 27 28 29 94 139 139 139 172 - 88 21 22 62 16 61 21 62 97 61 61 87 21 62 246 171 - 168 168 168 238 238 239 239 239 171 171 171 172 172 172 172 172 - 90 90 91 100 137 137 137 246 138 138 138 139 139 139 139 172 - 92 170 137 170 171 139 139 172 88 135 133 132 36 5 5 5 - 4 4 4 244 187 2 2 188 188 188 31 95 103 140 140 172 - 136 136 137 137 137 170 170 137 138 138 138 139 139 172 140 140 - 134 40 40 88 88 41 22 91 91 92 24 27 246 246 139 172 - 136 136 136 169 169 169 170 170 170 171 171 139 172 172 172 140 - 185 185 185 185 244 244 244 244 3 43 2 29 94 139 172 172 - 153 40 40 41 41 41 91 23 24 26 246 245 245 245 172 63 - 204 203 203 203 204 21 155 148 149 150 50 55 55 60 55 60 - 60 60 60 166 237 237 237 72 238 238 238 239 239 171 171 171 - 168 166 136 136 29 139 172 133 98 88 91 131 37 134 167 160 - 173 140 103 94 44 43 43 3 41 4 4 38 5 37 35 34 - 26 246 246 246 245 245 245 63 139 172 140 140 140 140 140 47 - 43 3 3 43 43 43 28 94 29 94 94 139 103 103 140 140 - 41 23 23 246 17 20 62 62 61 61 61 169 62 246 63 172 - 169 169 169 239 239 239 75 76 76 77 77 172 172 173 140 140 - 91 23 24 26 246 246 246 246 171 139 139 172 140 140 140 173 - 26 246 246 246 172 140 140 173 136 135 133 37 37 5 5 5 - 4 4 244 2 188 188 188 125 125 125 126 126 47 47 141 173 - 91 137 137 137 170 170 170 246 171 139 139 172 140 140 140 141 - 40 40 41 41 41 155 42 24 25 26 28 30 139 103 140 140 - 137 169 169 170 170 170 171 171 171 139 172 172 140 140 173 47 - 185 185 185 186 244 244 43 2 2 188 188 94 45 103 140 173 - 40 40 154 41 41 42 92 24 101 245 245 63 63 140 140 159 - 204 204 204 204 204 21 100 150 149 151 151 51 55 60 60 60 - 61 61 61 61 168 238 238 238 238 74 75 75 76 172 172 77 - 169 167 137 137 45 140 78 85 88 87 24 36 37 86 167 128 - 141 141 140 103 94 2 43 3 3 39 4 38 5 5 35 35 - 28 245 245 245 245 63 63 172 172 140 140 1 140 47 47 141 - 43 43 43 93 44 44 2 45 94 45 103 103 140 140 47 173 - 155 24 26 245 18 21 62 239 61 61 168 169 62 245 172 173 - 170 170 239 239 239 75 76 76 77 77 173 173 173 173 173 141 - 24 26 26 246 246 246 246 245 139 139 139 140 140 140 140 141 - 101 245 245 245 140 1 1 141 136 88 134 37 37 5 5 4 - 4 244 187 188 188 188 125 125 126 126 126 127 127 159 141 79 - 92 24 246 246 246 246 171 171 139 172 140 140 140 141 141 141 - 39 41 41 155 42 42 156 101 101 101 157 45 103 46 1 141 - 137 169 170 170 171 171 171 172 172 172 140 173 141 141 141 190 - 185 185 186 186 187 187 2 2 188 188 189 189 95 46 141 79 - 40 154 41 41 155 42 43 101 245 63 63 1 173 159 141 159 - 205 205 205 204 204 23 156 6 150 151 152 55 60 60 60 61 - 61 61 61 168 168 238 238 238 74 75 75 76 77 173 173 78 - 239 168 137 93 45 140 78 85 90 90 246 37 38 88 168 128 - 174 174 47 46 102 31 2 43 3 3 4 4 38 5 35 35 - 157 245 63 63 63 63 140 173 173 159 159 47 159 141 141 142 - 2 2 2 2 94 94 45 95 95 158 158 46 47 141 141 141 - 92 101 101 245 20 62 62 239 61 61 169 170 246 63 140 173 - 170 239 239 239 76 76 77 77 77 77 78 78 173 79 79 174 - 101 101 101 245 245 245 63 172 172 103 158 1 47 47 141 174 - 245 63 63 172 173 159 159 174 137 136 135 38 5 5 4 4 - 244 244 187 188 125 125 125 126 126 126 127 127 127 142 142 174 - 26 246 246 246 246 139 139 139 172 140 140 140 141 141 141 142 - 41 155 42 156 156 156 101 157 157 157 102 102 158 47 159 174 - 137 170 170 171 171 171 172 172 173 173 173 141 141 174 174 191 - 186 186 186 187 187 2 2 188 188 189 189 189 46 47 141 142 - 41 41 155 42 43 43 101 157 102 63 1 1 173 159 141 142 - 206 205 204 205 205 206 101 6 36 152 152 16 16 61 61 61 - 61 61 61 238 238 238 239 239 75 75 76 77 77 78 79 78 - 239 168 138 138 46 1 78 85 169 23 245 38 40 90 169 128 - 175 142 174 159 1 102 157 157 43 43 3 39 4 38 5 37 - 63 63 1 173 173 173 79 79 174 174 174 174 174 142 175 143 - 31 31 157 102 102 102 158 1 1 1 47 159 141 174 174 174 - 101 245 245 63 21 62 62 239 61 62 62 246 245 63 173 79 - 171 75 76 76 76 77 77 78 78 78 79 79 174 142 142 175 - 245 245 245 63 63 63 63 173 173 173 141 174 174 174 142 142 - 63 173 173 173 79 174 142 175 24 91 88 40 38 5 4 244 - 187 187 188 188 189 126 126 127 127 127 127 191 142 175 175 175 - 246 245 245 245 245 172 140 173 173 173 141 174 174 142 175 143 - 155 42 156 156 156 101 157 157 102 102 158 1 159 159 142 142 - 246 171 171 76 77 77 77 78 78 79 79 174 142 142 175 143 - 186 186 187 187 187 188 94 95 189 189 127 47 159 174 142 175 - 155 155 156 101 101 101 157 63 1 173 173 173 159 174 142 175 - 206 206 206 206 206 205 206 152 152 152 152 16 61 61 61 61 - 61 61 72 73 74 74 75 75 75 76 77 77 78 79 174 79 - 239 169 171 94 141 174 79 86 62 62 63 40 154 23 170 129 - 7 148 148 147 146 146 145 9 10 10 10 10 10 11 11 12 - 145 146 147 147 147 147 148 148 148 148 148 148 148 149 149 149 - 9 9 9 145 146 146 146 147 147 147 147 148 148 148 148 148 - 144 145 145 146 144 144 145 146 144 144 145 146 147 148 148 148 - 146 146 146 146 48 48 48 48 148 148 147 148 148 149 199 199 - 145 145 146 146 146 146 146 147 147 147 148 148 148 148 148 149 - 146 147 147 147 148 148 148 149 144 144 106 11 11 11 11 11 - 10 10 9 9 8 8 32 32 7 7 7 7 7 7 7 149 - 145 145 145 145 146 146 147 147 147 148 148 148 148 149 149 149 - 10 144 144 144 144 145 145 145 146 146 146 147 147 148 148 148 - 146 146 146 146 146 147 147 147 148 148 148 148 148 149 149 7 - 9 10 10 10 9 9 8 8 9 8 8 8 8 148 149 199 - 144 144 144 144 145 145 145 146 146 146 147 148 148 148 148 199 - 196 195 194 194 144 145 145 11 107 11 192 144 106 247 52 52 - 247 247 52 52 53 48 48 48 253 48 48 48 254 149 149 254 - 128 128 128 8 8 7 149 144 144 145 146 252 10 144 253 48 - 150 149 148 148 147 147 146 146 145 144 10 10 10 10 11 11 - 147 147 148 148 148 148 148 148 199 149 149 149 149 149 149 150 - 146 146 146 146 147 147 147 147 148 148 148 148 148 149 149 199 - 145 146 146 146 144 145 146 147 144 145 146 147 147 147 148 150 - 146 48 48 48 48 48 254 149 149 149 149 149 149 150 199 199 - 146 146 146 147 147 147 147 147 148 148 148 149 149 149 150 150 - 147 148 148 148 148 149 150 150 145 145 144 10 11 10 10 10 - 10 9 9 8 8 8 8 8 7 7 7 7 33 150 150 150 - 146 146 146 146 147 147 148 148 148 148 149 199 199 199 150 150 - 144 145 145 145 145 146 146 146 146 147 147 148 148 149 149 149 - 146 48 48 48 48 48 148 148 149 149 149 149 150 150 150 150 - 10 10 10 9 8 8 8 9 8 7 7 148 148 149 150 150 - 144 144 145 145 145 146 146 146 147 147 148 149 149 149 150 200 - 212 212 194 194 145 146 145 252 11 192 192 144 106 247 52 52 - 52 52 52 53 53 53 48 48 48 48 254 254 49 149 150 149 - 128 128 128 128 8 7 149 144 145 146 147 252 10 144 253 48 - 151 150 150 149 148 148 147 146 146 145 144 144 10 10 10 10 - 148 148 148 148 149 149 199 199 150 150 150 150 150 150 150 150 - 147 147 147 147 148 148 148 148 148 149 149 150 150 150 150 150 - 146 147 147 148 145 146 146 147 146 146 48 147 147 148 149 151 - 147 48 48 254 254 49 49 49 150 150 150 150 150 150 151 151 - 147 147 147 147 148 148 148 148 149 149 149 149 150 150 150 150 - 148 148 149 149 149 150 150 151 146 145 144 10 10 10 10 10 - 9 9 8 8 7 7 7 7 33 33 33 6 6 151 151 151 - 147 147 147 147 148 148 148 148 149 149 199 150 150 150 151 151 - 145 145 145 146 146 146 147 147 148 148 148 149 149 149 150 150 - 147 48 48 48 48 149 149 149 149 149 150 150 150 151 151 151 - 9 9 8 8 9 9 8 7 7 7 7 7 149 150 151 151 - 145 145 145 146 146 147 147 147 148 148 149 199 150 150 150 201 - 212 212 195 195 194 195 146 11 192 192 192 144 144 247 52 52 - 52 53 53 53 53 53 48 48 49 49 49 49 150 150 150 150 - 128 128 128 32 7 33 150 144 146 48 148 144 144 145 253 48 - 152 151 150 150 149 148 148 147 146 146 145 144 10 10 10 10 - 149 149 149 149 150 150 150 150 150 150 151 151 151 151 151 151 - 147 147 147 148 148 148 149 149 199 150 150 151 151 151 151 151 - 147 148 148 148 146 147 147 148 48 48 48 48 149 150 150 151 - 148 254 49 49 49 49 49 150 50 151 151 151 151 151 151 152 - 148 148 148 148 149 149 149 149 149 149 149 150 150 151 151 151 - 149 149 150 150 150 150 151 152 147 146 144 10 10 10 10 9 - 8 8 8 7 7 32 33 33 6 6 6 6 36 36 151 151 - 147 148 148 148 148 149 149 149 149 150 150 150 151 151 152 152 - 145 146 146 146 147 147 147 148 148 148 149 149 150 150 151 151 - 147 254 49 254 49 49 150 150 150 150 150 151 151 151 152 152 - 8 8 9 8 8 7 7 7 7 7 33 6 150 151 152 152 - 145 146 146 146 147 147 148 148 149 199 150 150 150 151 151 201 - 212 212 196 196 195 196 147 144 192 192 192 144 144 52 52 57 - 53 53 53 53 53 53 49 49 49 49 49 150 50 151 151 151 - 129 129 129 33 33 6 150 144 48 148 149 144 144 145 48 48 - 152 152 151 150 150 149 148 148 147 146 146 145 144 10 10 10 - 149 150 150 150 150 150 151 151 151 151 151 152 152 151 152 152 - 148 148 148 148 149 149 149 199 150 150 151 151 151 151 152 152 - 147 148 148 149 146 147 48 49 146 48 48 49 149 150 151 151 - 149 49 49 49 80 50 50 50 50 151 151 152 152 152 152 152 - 148 148 149 149 149 149 149 150 150 150 151 151 151 151 152 152 - 150 150 150 151 151 151 152 152 148 146 145 144 10 9 9 9 - 9 8 8 7 33 33 33 33 6 6 6 36 36 152 152 153 - 148 148 149 149 149 149 150 150 150 150 151 151 151 152 152 152 - 146 146 147 147 147 148 148 148 149 149 149 150 150 151 151 152 - 148 254 49 49 49 150 50 151 151 151 151 152 152 152 152 5 - 8 9 8 8 7 7 7 8 33 6 6 6 36 151 152 152 - 145 146 146 147 148 148 148 149 150 150 150 151 151 152 152 201 - 195 213 214 196 195 196 148 144 192 192 192 144 145 52 53 58 - 53 53 53 53 53 54 54 54 80 80 80 50 50 151 152 132 - 129 129 129 33 6 36 151 145 48 148 149 144 145 146 48 48 - 153 152 152 151 150 150 149 148 147 147 146 145 145 144 10 10 - 150 150 151 150 150 150 151 152 152 152 152 152 152 152 152 152 - 148 149 149 149 149 150 150 150 150 151 151 151 152 152 152 152 - 148 149 149 149 146 148 49 49 146 48 49 49 49 150 151 152 - 49 49 49 80 50 50 82 82 82 152 152 152 152 152 152 152 - 148 149 149 149 149 149 150 150 150 151 152 152 152 152 152 153 - 150 150 151 151 151 151 152 153 148 147 146 144 9 9 9 8 - 8 8 7 7 33 33 6 6 6 36 37 5 5 5 153 153 - 148 149 149 149 150 150 150 150 151 151 151 152 152 152 153 153 - 146 147 147 148 148 148 148 149 199 150 150 151 151 152 152 152 - 149 49 49 49 80 50 50 151 151 152 152 152 152 153 153 153 - 9 8 7 7 8 8 7 33 6 6 6 36 36 36 152 153 - 146 146 147 148 148 149 149 150 150 150 151 151 152 152 153 201 - 196 213 214 214 196 197 148 144 144 192 144 145 48 53 53 53 - 53 53 53 54 54 54 49 49 50 50 50 50 151 152 152 133 - 129 129 129 34 6 5 152 146 48 149 150 144 145 147 48 48 - 153 153 152 152 151 150 199 149 148 148 147 146 146 145 144 144 - 151 151 151 151 151 151 152 152 152 152 152 153 153 153 153 153 - 7 149 149 150 150 151 151 151 152 152 152 152 152 153 153 153 - 148 150 150 150 147 149 49 50 48 49 49 50 150 151 152 85 - 49 49 80 50 82 82 82 83 84 152 153 153 153 153 153 153 - 149 149 150 150 150 150 151 151 151 152 152 152 152 153 153 153 - 150 151 151 152 152 152 153 153 149 148 146 145 9 9 8 8 - 7 7 7 33 34 6 35 5 5 5 5 38 38 153 153 153 - 149 150 150 150 150 151 151 151 152 152 152 153 153 153 153 40 - 147 147 148 148 149 149 149 199 150 151 151 152 152 152 153 153 - 149 49 50 50 50 151 82 152 152 152 152 153 153 153 153 40 - 7 7 7 7 7 33 34 6 6 6 6 37 37 37 153 40 - 147 148 148 148 149 199 150 150 150 151 151 152 152 153 153 202 - 214 213 214 214 197 198 199 144 144 144 194 145 48 53 53 52 - 53 53 53 54 54 54 54 54 51 51 51 82 83 84 153 134 - 130 130 130 34 35 5 153 48 48 150 151 144 145 148 254 48 - 154 40 153 152 152 151 150 199 149 148 148 147 146 145 145 144 - 151 151 151 152 152 153 153 153 153 5 153 153 40 40 40 40 - 6 6 6 6 151 151 152 152 153 153 153 153 153 153 153 154 - 149 150 151 150 147 149 50 51 49 49 49 49 50 83 84 85 - 80 50 50 82 83 83 83 83 84 84 153 153 40 40 40 40 - 150 150 150 151 151 151 151 151 152 153 153 153 153 40 40 153 - 151 152 152 152 37 153 153 40 149 148 147 145 9 9 8 8 - 8 7 33 35 5 5 5 5 5 5 5 38 38 40 40 154 - 150 50 151 151 151 151 152 152 153 153 153 153 153 40 40 154 - 148 148 149 199 150 150 150 150 151 151 152 152 153 153 153 40 - 150 50 50 50 82 83 152 152 152 153 153 153 153 40 40 39 - 7 7 32 33 33 33 6 6 5 5 5 5 5 5 153 154 - 148 148 149 149 199 150 150 150 151 152 152 153 153 40 40 202 - 197 213 214 198 198 200 199 144 144 145 194 145 53 53 53 53 - 53 53 54 54 54 54 55 55 55 51 83 83 84 84 153 134 - 131 131 130 35 35 5 153 48 49 151 152 145 146 148 254 254 - 154 154 153 5 37 36 36 150 149 148 148 147 8 8 9 9 - 152 152 152 152 153 153 153 153 154 40 40 40 39 39 39 39 - 6 6 36 36 6 36 37 153 153 153 153 153 40 40 154 154 - 150 150 151 152 148 49 50 51 49 49 50 50 51 83 84 85 - 82 82 82 82 83 84 84 85 85 85 85 40 40 40 40 40 - 150 151 151 151 152 152 152 153 153 153 153 153 40 40 40 40 - 152 152 153 153 153 38 40 40 150 149 148 146 9 8 8 7 - 7 33 34 6 35 5 5 5 5 4 4 39 39 39 40 154 - 151 50 82 82 152 152 152 152 153 153 153 40 154 154 154 41 - 148 149 149 149 150 150 150 151 151 152 152 153 153 153 40 154 - 150 50 82 82 83 83 84 153 153 153 40 40 40 154 154 154 - 33 33 33 33 33 6 35 5 5 5 5 38 4 39 39 154 - 148 149 199 150 150 150 151 152 152 152 153 153 153 40 154 203 - 196 214 214 198 200 200 200 145 144 145 194 146 48 53 53 58 - 53 54 54 54 54 55 55 55 55 83 83 84 85 85 40 135 - 131 131 131 37 5 4 40 148 49 150 152 145 147 149 80 48 - 155 41 39 4 5 5 37 36 6 33 7 7 7 8 8 8 - 153 153 153 153 153 40 40 40 40 39 39 154 41 41 155 41 - 37 5 5 5 5 5 153 40 40 40 40 154 154 154 154 154 - 151 151 152 153 149 150 51 97 49 50 51 51 83 85 86 87 - 82 83 83 83 84 84 84 85 86 86 88 88 41 41 41 41 - 151 152 152 152 153 153 153 153 153 40 40 39 154 41 41 41 - 153 84 85 40 40 40 154 41 151 150 148 146 8 8 7 7 - 33 6 6 35 5 4 5 4 4 4 39 41 39 41 41 155 - 151 83 83 83 84 153 153 153 40 40 40 154 41 41 155 155 - 149 150 150 150 151 151 151 152 152 153 153 40 39 154 41 41 - 151 82 83 84 84 84 85 85 85 40 154 41 41 41 155 155 - 33 33 34 34 35 35 5 5 5 5 4 4 39 154 41 41 - 149 150 150 151 151 152 152 153 153 153 40 40 154 154 41 155 - 197 198 200 201 200 200 200 144 145 145 195 214 49 54 54 54 - 54 54 54 55 60 55 55 96 96 97 97 98 86 86 41 88 - 133 132 132 38 5 3 41 149 50 152 153 146 148 150 50 254 - 43 3 3 39 4 4 5 5 36 6 6 33 7 7 8 8 - 40 40 40 154 154 41 41 155 41 41 41 155 155 42 42 3 - 5 38 4 4 38 38 39 39 154 154 41 41 155 155 155 155 - 152 152 153 153 151 82 16 17 50 51 83 16 16 18 99 90 - 84 85 85 85 86 86 86 87 90 90 22 91 91 91 91 23 - 152 153 153 153 40 40 40 154 154 154 41 41 155 155 3 42 - 85 86 88 41 41 41 91 91 152 151 149 148 7 7 7 32 - 6 37 5 5 4 4 4 4 4 244 3 3 3 3 43 25 - 152 84 84 84 85 86 86 40 41 41 41 155 155 155 156 156 - 150 151 151 152 152 152 153 153 153 153 39 154 41 155 155 42 - 153 84 84 85 85 86 86 88 89 41 22 42 42 42 156 43 - 34 34 35 35 35 5 5 5 4 4 39 3 3 3 3 156 - 150 151 151 152 152 153 153 153 40 154 154 41 155 155 156 156 - 201 201 202 202 201 201 201 146 147 146 196 214 49 54 54 54 - 54 55 60 55 55 55 97 61 61 98 98 87 90 90 91 137 - 134 133 133 38 4 3 22 150 152 84 18 147 199 150 82 254 - 44 43 3 3 41 39 4 38 5 36 6 6 33 7 7 8 - 40 88 41 41 41 155 155 42 156 42 43 43 43 43 43 43 - 38 4 4 39 4 39 39 41 41 155 3 3 43 43 43 93 - 153 153 40 18 151 83 17 61 51 83 16 17 18 20 22 91 - 85 88 88 88 87 90 90 90 91 23 100 24 24 26 26 26 - 153 154 154 154 154 41 41 155 41 155 155 42 43 43 43 26 - 20 99 22 91 42 92 92 26 153 152 150 7 7 33 33 34 - 35 5 5 5 4 244 4 244 244 244 3 43 43 43 44 101 - 153 85 85 86 86 99 99 99 91 155 42 24 43 43 44 157 - 151 152 152 152 153 153 153 40 39 39 154 41 3 3 43 156 - 153 85 86 86 88 89 90 90 91 91 92 25 26 93 101 2 - 35 35 35 5 5 5 5 4 4 4 3 3 3 43 43 44 - 36 152 152 5 153 153 40 40 154 41 155 155 42 43 93 101 - 202 202 202 201 201 201 153 147 147 147 196 214 49 54 54 54 - 55 60 55 55 60 61 61 61 167 167 168 168 91 91 24 26 - 135 133 134 38 3 43 24 150 83 17 19 148 199 151 83 48 - 157 2 43 3 3 3 39 4 4 5 37 6 6 33 7 7 - 41 22 91 91 91 42 92 24 43 43 43 93 44 2 2 44 - 4 4 4 3 3 3 3 3 3 3 43 43 43 44 44 157 - 153 40 154 99 152 84 98 61 51 83 16 17 20 23 26 246 - 88 167 88 88 90 169 90 91 24 24 26 26 101 101 157 245 - 40 41 41 154 41 155 155 42 42 156 43 43 44 44 30 157 - 21 22 91 92 25 93 27 101 153 152 151 150 33 33 6 35 - 5 5 4 4 244 244 244 244 244 187 2 2 2 2 31 103 - 40 86 86 88 99 22 91 91 24 24 25 101 44 44 157 102 - 152 153 153 153 153 40 40 154 41 41 3 3 43 43 2 30 - 40 86 88 89 90 90 91 91 92 24 26 28 101 30 157 94 - 35 183 184 184 184 184 4 4 244 244 3 43 43 44 2 157 - 5 5 153 153 40 154 154 154 41 155 3 43 43 44 30 157 - 203 203 203 203 203 203 154 7 148 148 199 214 54 55 55 60 - 55 55 55 60 61 61 97 166 167 167 168 169 169 26 26 246 - 88 134 135 39 3 2 246 151 84 19 99 149 6 152 85 48 - 158 102 2 44 43 3 3 39 4 4 5 5 35 6 33 33 - 92 23 24 26 26 26 101 101 101 101 30 157 45 45 45 45 - 4 4 244 3 3 3 43 43 43 44 2 2 2 31 31 45 - 40 41 22 22 153 85 19 61 83 16 19 20 22 26 246 245 - 90 168 168 87 169 170 170 170 246 246 246 245 245 63 63 63 - 41 155 155 155 100 24 24 25 156 93 101 101 157 157 45 103 - 23 23 24 26 28 94 94 139 40 153 152 36 6 6 35 5 - 5 4 4 244 187 187 187 187 187 188 188 188 94 95 95 158 - 154 99 99 22 91 100 24 24 246 27 28 157 45 45 102 158 - 153 40 40 40 154 154 154 155 3 3 43 43 44 2 31 45 - 41 89 90 91 91 24 26 246 26 246 28 157 45 102 102 95 - 184 184 185 185 185 185 186 244 244 244 43 2 2 31 45 102 - 5 153 40 39 154 41 155 155 3 43 44 44 30 45 102 102 - 202 202 203 202 202 202 154 7 7 149 199 200 55 60 96 55 - 55 60 61 61 61 61 61 238 168 169 169 170 170 171 245 172 - 168 135 136 244 2 95 63 152 84 87 22 150 152 153 86 48 - 159 1 102 157 2 43 3 3 244 4 4 5 5 35 34 6 - 26 246 246 245 245 245 245 63 158 103 103 158 158 46 158 158 - 244 244 244 3 3 43 44 44 31 31 45 45 45 102 158 158 - 41 42 24 100 85 19 62 62 17 19 21 62 62 245 63 63 - 169 169 169 169 239 171 171 171 63 63 172 172 172 140 140 173 - 42 24 24 100 26 101 101 101 101 30 157 45 102 158 158 1 - 246 246 246 245 139 103 140 140 41 40 153 37 37 37 5 4 - 4 4 244 187 188 188 188 125 125 125 189 126 126 46 47 159 - 42 23 24 24 26 246 246 246 245 94 139 158 158 46 1 159 - 39 154 154 41 155 155 155 43 43 43 44 2 31 45 95 46 - 91 23 24 26 246 246 246 245 245 245 139 158 1 1 1 47 - 185 185 186 186 186 186 187 187 187 2 2 94 45 95 46 1 - 4 39 154 41 155 155 3 43 44 30 31 45 102 158 1 159 - 156 204 204 204 203 204 156 6 33 150 200 151 55 60 96 55 - 61 61 61 60 61 73 74 238 239 239 239 171 172 172 173 173 - 169 135 137 244 188 95 140 153 85 22 24 36 5 40 90 128 - 79 173 173 139 139 138 25 92 41 41 39 39 38 37 36 36 - 170 239 239 171 171 76 76 77 77 172 172 173 173 78 78 173 - 137 137 93 27 138 138 138 94 94 139 139 172 140 140 173 173 - 90 169 170 170 98 168 238 74 97 61 61 62 62 171 77 77 - 169 238 239 239 75 76 76 76 77 77 77 77 77 77 78 78 - 169 170 170 62 170 171 246 171 171 63 63 172 173 173 78 78 - 171 239 171 171 172 173 77 77 90 88 84 84 37 38 38 39 - 39 3 3 93 94 94 94 47 189 189 46 140 140 141 141 79 - 169 62 170 170 170 171 171 171 171 171 172 173 173 173 173 79 - 41 22 22 41 91 91 91 25 27 138 94 139 139 140 140 173 - 169 169 170 239 239 239 75 76 76 76 77 77 173 78 78 79 - 244 244 244 244 244 244 93 138 138 94 139 139 140 140 173 79 - 40 41 155 23 23 100 26 246 245 63 63 63 172 173 78 78 - 23 204 205 205 205 23 100 150 149 151 152 16 60 60 61 61 - 61 61 61 237 72 72 72 73 73 74 74 75 76 76 77 77 - 169 167 170 137 95 140 78 85 167 169 170 152 40 88 168 160 - 85 84 133 132 131 131 130 129 129 129 129 128 253 106 253 105 - 162 163 163 163 163 163 164 164 164 164 164 164 165 165 165 165 - 130 130 130 130 130 131 131 131 132 132 132 132 133 133 133 133 - 255 161 162 162 160 104 161 249 53 104 54 104 162 164 164 164 - 161 162 162 162 162 163 163 163 164 164 164 164 164 165 165 165 - 161 162 162 162 162 162 163 163 163 163 164 164 164 164 165 166 - 163 163 163 163 164 164 165 165 104 160 105 105 106 144 253 128 - 128 129 129 130 131 131 131 132 132 132 132 133 134 134 134 165 - 255 161 162 162 162 163 163 163 163 164 164 164 84 84 85 85 - 128 129 254 254 254 129 130 130 131 131 131 131 132 132 133 133 - 255 161 162 162 162 162 163 163 163 164 164 164 165 165 165 165 - 129 129 129 129 129 129 130 130 131 131 132 132 132 133 133 134 - 128 48 254 254 254 49 49 50 50 51 97 83 84 83 165 98 - 147 214 214 54 49 80 49 106 105 105 52 52 52 52 53 53 - 53 53 58 53 64 64 65 64 65 65 250 163 164 164 165 165 - 162 255 131 132 133 133 164 160 160 161 162 105 253 128 161 160 - 166 166 165 164 163 163 131 130 255 255 255 104 48 105 105 105 - 250 250 250 250 250 250 250 164 165 165 165 165 165 166 166 165 - 162 131 131 131 131 132 132 132 132 132 133 133 133 134 134 165 - 161 162 162 163 160 104 249 250 104 104 249 249 250 250 164 69 - 162 162 163 250 250 250 250 164 164 165 165 165 165 165 165 69 - 161 64 65 65 162 163 250 250 250 250 164 164 165 165 165 166 - 163 250 250 164 164 165 165 165 161 160 160 105 105 253 48 128 - 129 254 130 131 82 132 132 133 133 133 133 134 165 166 166 166 - 161 64 249 249 249 250 250 250 250 164 164 165 165 165 166 166 - 255 254 255 255 130 130 131 131 131 131 132 164 133 133 134 165 - 162 64 65 65 65 66 250 250 67 68 165 165 165 166 166 166 - 255 129 255 255 255 255 130 131 131 132 132 133 133 133 134 135 - 128 254 49 49 49 80 50 51 51 55 96 96 165 165 166 61 - 49 214 214 54 49 54 80 105 105 105 52 53 57 57 57 57 - 53 58 249 249 64 65 65 65 65 66 66 67 67 165 165 165 - 162 255 131 132 133 165 165 160 160 64 162 105 160 160 162 160 - 167 166 165 164 164 164 132 131 255 255 255 255 104 48 105 105 - 163 250 250 250 164 165 165 165 166 165 166 166 166 166 166 166 - 163 131 163 163 163 164 164 164 165 165 84 165 166 166 166 166 - 162 162 250 250 104 249 250 250 249 104 249 250 250 250 164 70 - 163 250 250 250 250 164 68 165 165 165 166 166 166 166 166 166 - 162 162 250 250 250 250 250 164 165 165 165 165 166 166 166 166 - 164 164 164 165 165 165 166 166 162 161 104 160 48 48 254 254 - 254 130 131 81 83 133 133 133 134 134 135 166 166 167 167 167 - 162 249 250 250 250 250 250 250 165 165 165 166 166 166 167 167 - 255 254 255 130 130 131 163 132 132 132 133 165 165 166 166 166 - 162 163 250 250 250 250 250 68 68 165 165 166 166 166 167 167 - 255 129 130 130 130 131 131 163 132 133 133 165 134 134 135 167 - 254 254 49 80 50 51 51 55 55 96 97 96 166 165 166 61 - 49 214 55 55 55 55 96 105 105 105 53 53 57 57 57 58 - 58 58 249 66 64 66 65 66 66 66 235 68 68 69 166 166 - 163 162 131 132 134 166 166 160 64 65 163 105 104 255 162 160 - 168 167 166 165 165 133 132 131 131 130 255 255 104 48 48 105 - 164 164 165 165 165 165 166 166 166 166 166 166 166 166 167 167 - 163 163 163 164 164 164 165 165 165 165 166 166 166 166 166 166 - 162 250 250 250 161 249 250 68 64 249 250 250 250 165 166 70 - 163 250 250 250 164 164 165 165 69 166 166 70 70 70 70 166 - 163 250 250 250 250 165 165 165 166 165 166 166 166 166 167 167 - 165 165 69 69 166 166 166 70 162 161 104 104 48 48 254 254 - 254 80 131 82 133 133 133 134 135 135 135 167 167 167 168 168 - 163 250 250 250 250 250 68 165 165 166 166 166 167 167 167 168 - 254 254 80 81 81 81 82 82 164 133 165 165 166 166 167 167 - 163 250 250 250 250 164 68 165 165 166 166 166 166 167 167 168 - 255 130 131 131 131 131 132 164 133 133 165 165 135 166 167 167 - 254 49 80 50 51 51 55 96 96 97 61 97 166 166 167 61 - 150 214 201 55 60 51 82 106 48 53 52 53 53 57 58 58 - 58 58 249 249 66 235 66 235 235 235 68 69 69 70 70 237 - 164 162 132 133 135 167 166 104 64 250 164 105 255 255 162 160 - 169 167 166 166 165 133 133 132 132 131 130 130 254 48 48 48 - 166 166 166 166 166 166 166 166 166 167 167 237 168 168 168 168 - 164 164 164 165 165 165 165 166 166 166 167 167 167 167 167 167 - 163 250 250 68 162 250 250 68 104 250 250 250 250 166 70 70 - 250 250 164 165 69 69 166 166 70 70 237 237 237 237 237 237 - 164 164 164 165 165 165 165 165 166 166 166 166 167 237 237 237 - 166 69 69 70 166 237 237 237 163 162 161 104 48 254 254 254 - 130 131 132 83 84 84 134 135 135 86 88 167 167 168 168 238 - 163 164 164 164 164 165 165 165 166 166 237 237 237 237 168 238 - 49 80 81 82 82 82 83 133 165 165 165 166 166 167 167 168 - 164 164 164 165 165 69 69 166 166 70 237 237 168 168 168 168 - 130 130 131 132 132 132 132 133 165 165 166 166 167 167 167 168 - 254 80 50 51 51 51 96 96 97 61 61 61 61 167 168 168 - 201 200 201 55 55 51 83 105 48 48 53 53 58 58 58 59 - 59 58 249 66 235 66 234 234 234 69 69 236 70 70 237 237 - 164 163 133 134 135 167 167 161 249 250 165 160 255 162 163 160 - 169 169 167 167 135 135 133 133 132 131 131 80 254 254 48 48 - 166 166 166 166 166 167 237 167 167 167 168 168 168 238 238 238 - 164 165 165 165 165 165 166 167 166 167 167 167 167 167 168 168 - 164 165 165 69 250 250 250 68 249 250 250 250 165 165 166 237 - 164 165 165 69 236 70 70 237 237 237 237 237 237 71 72 238 - 165 165 165 165 166 166 166 166 166 167 167 167 168 168 238 238 - 166 70 70 70 237 237 238 72 164 162 161 255 254 254 130 130 - 131 132 133 84 85 85 135 86 88 89 90 168 168 168 169 238 - 164 164 165 165 165 166 166 70 70 237 237 237 237 238 238 238 - 80 50 82 82 82 83 84 165 165 166 166 166 167 167 168 238 - 164 164 165 165 166 166 70 70 237 237 237 168 238 238 238 238 - 131 131 132 132 133 133 133 134 135 166 167 167 167 168 168 169 - 49 50 51 83 83 96 97 97 61 61 61 61 168 168 238 238 - 202 201 202 16 16 16 97 48 48 48 53 58 58 58 58 59 - 58 249 67 67 234 66 234 234 69 236 70 70 70 237 237 71 - 164 164 134 135 135 168 237 162 249 250 166 104 130 81 164 160 - 170 169 168 168 167 135 134 134 133 132 82 81 130 254 254 48 - 166 166 166 166 167 168 168 168 168 168 238 238 238 238 238 169 - 165 165 166 166 166 166 167 167 167 167 168 168 168 168 169 169 - 96 165 166 166 250 250 250 236 250 250 60 165 70 237 237 238 - 165 165 236 70 70 237 237 237 237 237 237 238 238 238 238 238 - 165 166 166 166 166 166 167 167 167 167 168 168 238 238 238 238 - 166 237 70 237 237 238 238 73 164 163 162 80 254 254 130 131 - 132 133 84 85 86 88 88 89 90 90 169 169 169 169 170 238 - 165 165 165 166 166 166 237 237 237 237 237 238 238 238 238 74 - 82 82 82 83 83 84 84 85 166 167 167 167 167 168 169 238 - 165 165 165 166 70 237 237 237 237 237 168 238 238 238 239 239 - 132 132 132 133 133 134 135 135 166 167 167 168 168 169 169 239 - 50 51 83 83 16 16 17 61 61 61 168 61 238 168 238 239 - 201 201 201 202 16 16 97 48 48 48 54 54 59 59 59 58 - 59 59 68 68 68 235 234 69 236 70 70 71 71 71 72 73 - 166 165 166 135 136 169 238 162 250 165 166 255 130 82 165 160 - 170 169 168 168 168 86 135 85 84 133 83 82 80 130 254 48 - 167 61 167 167 168 168 238 238 238 238 238 238 238 238 238 239 - 166 166 167 167 167 167 167 168 168 168 169 169 169 169 169 239 - 165 166 61 237 96 165 166 70 250 60 60 96 166 72 238 238 - 166 166 70 237 237 237 237 71 238 238 238 238 238 238 238 238 - 166 166 167 167 167 167 167 167 167 168 238 238 238 238 238 238 - 167 237 237 237 238 238 238 74 165 163 162 80 254 254 130 131 - 37 153 40 40 41 41 41 91 91 91 137 170 170 170 170 239 - 165 165 166 166 167 167 237 237 237 238 238 238 238 238 238 239 - 83 83 83 84 98 98 98 85 98 167 168 168 168 168 169 239 - 166 166 166 237 237 237 237 237 168 238 238 238 238 239 239 239 - 132 132 133 133 134 135 135 135 135 167 168 168 169 169 169 239 - 82 83 83 83 16 17 61 61 61 61 62 168 169 169 239 239 - 202 203 202 202 16 17 84 48 48 49 54 54 59 59 59 58 - 59 60 250 68 67 69 69 236 70 70 71 71 71 72 238 73 - 70 165 167 88 136 169 238 162 164 165 167 254 131 133 165 160 - 239 239 170 169 169 90 88 85 84 133 132 131 131 130 254 254 - 98 168 168 169 238 238 238 238 239 239 238 238 239 239 239 239 - 135 86 88 87 136 168 136 168 136 169 169 169 169 170 170 239 - 97 61 61 61 96 165 61 237 96 60 60 166 61 168 238 238 - 166 166 237 237 237 237 238 238 238 238 238 238 239 239 239 239 - 167 167 167 167 167 168 168 168 169 169 169 239 239 239 239 239 - 168 168 238 238 169 239 239 239 165 164 163 80 130 130 131 36 - 37 38 40 41 42 42 42 92 25 26 246 246 246 171 171 239 - 166 166 166 167 168 168 168 168 238 238 238 238 239 239 239 75 - 84 84 84 85 98 98 98 88 88 87 168 168 169 169 239 239 - 166 166 237 237 237 237 237 168 238 238 238 239 239 239 239 171 - 133 133 38 134 134 135 135 88 136 136 169 169 169 170 170 239 - 82 83 16 16 16 17 19 61 61 62 62 169 62 239 239 76 - 202 202 203 203 19 19 18 48 48 49 54 54 59 59 59 59 - 250 60 250 68 69 236 69 71 70 70 71 72 73 74 74 74 - 237 165 167 135 137 169 74 163 165 166 168 130 131 133 166 160 - 76 171 170 170 169 90 87 86 85 84 132 132 131 130 130 254 - 90 168 169 169 169 169 239 239 239 239 239 239 239 75 75 239 - 135 88 136 136 136 90 90 137 137 169 170 170 170 171 171 171 - 97 61 61 168 96 97 61 237 96 60 61 61 168 238 239 239 - 167 237 237 168 168 238 238 238 238 239 239 239 239 239 75 75 - 87 87 87 87 168 168 168 168 169 62 239 239 239 239 171 75 - 169 238 238 238 239 239 239 75 166 165 164 81 131 131 132 37 - 38 38 39 155 42 42 43 43 93 27 246 246 171 171 171 76 - 167 167 167 168 168 169 169 169 169 238 239 239 239 75 76 76 - 84 153 85 18 86 18 86 87 90 90 169 169 170 170 171 75 - 167 167 167 237 237 238 238 238 238 238 239 239 239 239 171 171 - 37 38 38 38 135 135 136 136 137 137 137 170 170 170 171 76 - 83 16 16 17 18 19 20 21 21 62 62 62 170 171 171 77 - 202 203 203 203 19 19 19 48 49 49 49 54 59 59 59 60 - 59 60 60 68 70 70 70 70 237 71 72 73 74 74 75 75 - 237 166 167 136 170 170 75 164 166 166 168 130 132 84 166 160 - 77 77 171 246 170 23 90 89 86 85 133 152 132 151 150 149 - 169 62 62 62 62 239 239 75 239 239 171 171 76 76 76 171 - 88 136 136 91 137 137 137 137 170 246 246 246 171 171 171 171 - 98 87 169 62 97 61 61 72 96 61 61 61 168 239 239 75 - 168 168 238 238 238 238 239 239 239 239 239 75 171 76 76 76 - 90 90 90 90 90 169 169 62 170 170 171 171 171 171 171 76 - 169 239 239 239 239 171 76 76 167 165 83 132 132 37 37 37 - 38 4 41 3 43 43 44 2 44 29 94 139 172 172 173 77 - 136 168 168 168 169 169 169 170 170 239 239 171 76 76 77 77 - 85 40 18 19 88 20 87 90 22 23 62 170 171 171 63 76 - 168 168 168 168 238 238 238 239 239 239 239 75 171 76 77 172 - 38 38 38 4 39 41 136 136 137 137 138 246 171 171 171 172 - 153 17 18 19 20 20 21 21 23 62 62 246 245 63 63 77 - 20 203 203 203 20 20 21 254 149 50 54 55 60 60 60 60 - 55 60 70 250 70 237 71 71 71 72 73 74 74 75 75 75 - 237 166 168 136 171 171 75 164 166 166 169 131 132 84 167 160 - 78 173 172 245 246 26 100 91 41 40 40 153 37 37 36 150 - 62 62 62 170 170 170 171 76 171 171 171 172 77 77 77 172 - 136 91 91 92 137 26 138 246 246 246 171 171 139 172 172 172 - 99 21 62 62 17 98 168 238 97 61 61 61 62 239 171 76 - 168 238 238 238 238 239 239 75 76 76 76 76 77 77 77 77 - 91 22 23 23 62 62 246 246 246 171 171 171 172 172 172 77 - 170 239 239 239 171 172 172 77 167 85 133 132 37 37 38 38 - 4 39 3 3 43 2 2 31 31 94 103 103 140 173 173 78 - 136 136 169 169 169 169 170 171 171 171 171 172 172 77 173 78 - 40 154 41 99 99 21 22 23 23 24 246 246 245 63 172 77 - 168 168 169 238 238 238 239 239 239 75 76 76 77 77 77 173 - 4 4 4 244 244 244 244 137 27 138 138 139 139 139 172 173 - 85 18 20 20 21 21 23 23 23 246 246 245 63 172 172 173 - 204 204 203 203 204 21 23 150 149 50 55 55 60 60 55 55 - 60 60 61 166 237 71 72 71 73 73 74 75 75 76 76 76 - 238 167 169 137 139 171 76 165 166 167 169 131 133 85 167 128 - 79 173 172 139 157 101 26 92 41 41 39 38 38 37 36 36 - 26 246 246 245 245 171 63 172 172 172 172 173 173 173 173 173 - 42 92 92 26 27 28 138 157 139 139 139 139 172 172 140 172 - 22 23 62 62 18 87 62 62 97 61 61 62 62 171 77 77 - 169 238 238 239 239 239 75 76 76 77 77 77 173 173 173 173 - 91 23 24 246 246 246 246 246 245 171 63 172 172 173 173 78 - 171 171 171 171 172 172 173 173 136 86 133 132 37 5 38 4 - 4 244 244 43 2 188 125 125 95 95 158 46 1 173 141 79 - 137 137 137 137 170 170 171 171 171 172 172 172 173 173 173 79 - 40 41 41 22 22 23 23 24 24 246 246 245 63 172 140 173 - 169 169 169 239 239 239 239 239 76 76 77 77 173 173 173 141 - 244 186 186 244 244 244 43 93 93 29 94 139 139 140 140 173 - 40 154 99 21 22 23 100 24 246 245 245 63 172 140 173 79 - 205 204 204 204 204 205 24 150 150 152 83 55 55 55 60 60 - 61 61 61 71 71 72 72 73 73 74 75 75 76 76 77 77 - 238 167 137 137 139 139 77 85 167 168 170 132 133 86 168 128 - 174 141 140 103 45 157 28 43 3 41 39 39 38 38 37 36 - 101 245 63 63 63 63 172 172 172 173 173 173 173 173 79 79 - 25 93 28 28 28 30 157 103 103 103 158 158 140 173 173 173 - 23 24 246 246 19 90 62 239 98 61 62 62 239 63 77 78 - 169 239 239 75 75 75 76 76 77 77 173 173 78 78 79 79 - 24 26 246 246 246 245 245 245 63 63 172 172 173 173 173 79 - 171 171 76 172 172 173 173 79 137 136 135 37 37 5 4 4 - 244 244 187 188 188 125 126 126 126 126 127 127 159 141 141 79 - 137 137 137 246 246 171 171 172 172 173 173 173 173 141 174 174 - 41 41 155 42 100 24 26 26 246 246 245 63 172 140 173 79 - 170 170 170 239 239 171 76 77 77 77 173 78 79 79 174 174 - 244 186 187 187 187 187 188 188 29 94 103 140 140 140 141 174 - 41 41 22 23 100 26 246 246 245 63 63 63 173 173 173 142 - 205 205 204 204 204 205 26 151 150 152 16 96 60 60 60 61 - 61 61 61 73 72 73 73 73 74 75 75 76 77 77 78 78 - 239 168 170 93 189 140 78 86 167 169 171 37 153 89 168 128 - 142 142 141 46 103 45 29 93 3 3 39 4 4 5 5 37 - 245 63 63 140 140 173 173 173 173 173 141 79 79 174 174 142 - 44 44 30 31 157 45 103 158 158 1 1 1 141 141 141 141 - 25 101 245 245 99 23 62 239 19 62 62 62 63 77 173 78 - 239 239 75 75 76 76 77 77 78 78 78 79 79 174 174 174 - 246 246 246 245 139 63 63 172 172 173 173 173 173 79 79 79 - 172 63 77 77 173 79 174 174 137 136 135 38 5 5 4 4 - 244 244 188 188 125 126 126 126 126 127 127 127 141 142 142 174 - 138 138 138 246 171 172 172 172 173 173 173 141 174 142 142 175 - 41 42 92 92 24 26 101 101 245 63 172 140 140 141 174 174 - 170 239 171 171 171 76 77 77 77 173 79 79 174 174 142 175 - 187 186 187 187 187 188 188 188 94 189 46 1 1 47 142 175 - 41 155 42 24 26 101 245 245 63 140 63 1 141 141 174 175 - 205 205 205 205 205 205 101 151 150 152 16 16 61 61 61 61 - 61 61 61 74 73 74 74 74 75 75 76 77 78 78 79 78 - 239 169 138 29 190 47 79 86 90 62 63 153 40 91 169 128 - 191 191 190 190 189 189 188 187 186 186 185 185 184 184 5 5 - 189 158 189 46 46 46 190 190 190 190 190 190 190 190 191 191 - 188 188 188 188 188 189 189 189 189 189 190 190 190 190 190 190 - 187 2 94 94 41 92 246 63 20 23 62 246 245 172 140 79 - 171 171 171 172 172 172 173 173 141 141 141 141 141 191 191 191 - 2 188 94 94 189 189 189 189 189 189 190 190 190 190 191 191 - 139 139 139 140 190 190 191 175 244 244 39 38 5 184 185 185 - 186 187 187 188 125 126 126 126 126 190 190 190 190 191 191 191 - 188 188 188 188 188 189 189 189 189 190 190 190 190 191 191 191 - 244 244 244 244 187 188 188 188 188 189 189 189 189 190 190 191 - 138 138 139 139 139 140 140 140 140 141 141 191 191 191 191 191 - 186 186 186 187 187 187 188 188 188 189 189 126 126 190 190 191 - 3 3 3 43 43 2 94 94 189 189 189 189 190 190 190 143 - 2 157 206 205 101 156 157 36 37 37 152 16 17 61 17 61 - 61 61 62 238 239 239 76 239 76 76 77 173 141 141 191 174 - 170 137 188 188 189 190 174 40 23 246 140 38 4 3 137 128 - 181 181 181 180 179 179 179 178 178 177 177 176 109 109 109 108 - 179 180 180 180 180 180 180 180 181 181 181 181 181 181 181 181 - 178 178 179 179 179 179 179 179 180 180 180 180 180 180 181 181 - 178 179 179 180 110 10 9 7 10 9 9 9 9 32 180 182 - 8 8 9 8 32 32 32 181 181 181 181 181 181 181 181 181 - 179 179 179 179 179 179 179 180 180 180 180 180 181 181 181 181 - 181 180 180 180 180 180 181 182 112 9 112 110 109 177 176 176 - 177 177 178 178 179 179 179 180 180 180 180 181 181 181 181 181 - 179 179 179 179 179 179 179 180 180 180 180 180 181 181 181 182 - 111 110 110 111 178 179 179 179 179 179 179 180 181 181 181 181 - 179 179 179 180 180 180 180 180 181 181 181 181 181 181 181 181 - 177 177 177 177 178 178 178 179 179 179 179 180 180 181 181 181 - 111 111 111 110 111 112 113 180 180 180 180 181 181 181 181 114 - 113 113 113 113 113 113 113 108 108 12 12 11 10 10 106 106 - 144 144 144 253 253 8 9 9 9 8 32 32 181 181 181 181 - 32 9 179 181 178 180 182 11 9 8 32 109 110 111 8 128 - 181 181 181 180 179 179 179 178 178 176 177 177 177 110 110 110 - 180 180 180 180 180 180 181 180 180 180 180 181 181 181 181 181 - 178 178 179 179 179 179 179 179 179 180 180 180 180 181 181 181 - 179 179 179 180 111 112 8 32 9 9 9 9 8 181 181 182 - 112 8 8 8 181 181 181 181 181 181 181 181 181 182 182 182 - 179 179 179 179 180 180 180 180 180 180 180 180 181 181 181 181 - 180 180 180 180 180 181 181 182 113 112 111 110 109 176 176 176 - 177 178 178 178 179 179 179 180 180 180 180 181 181 181 181 181 - 179 178 178 179 179 180 180 179 180 180 180 181 181 181 182 182 - 110 111 178 179 179 178 178 178 179 179 179 180 180 181 181 181 - 179 179 179 180 180 180 181 181 181 180 181 181 181 181 182 182 - 177 177 177 177 178 178 178 179 179 179 179 180 180 181 181 181 - 110 111 111 112 113 113 179 180 180 180 180 180 181 181 181 181 - 113 113 113 112 111 112 113 109 109 109 11 11 10 10 10 10 - 106 106 9 9 9 9 9 9 8 32 181 181 181 181 181 182 - 32 9 179 181 179 180 182 11 9 8 32 109 110 111 8 128 - 182 181 181 181 180 180 179 178 178 178 177 178 176 111 110 109 - 181 180 180 180 181 181 181 181 181 181 181 182 182 182 182 182 - 179 179 179 179 179 180 180 180 180 180 181 181 181 181 181 182 - 179 180 180 181 112 112 8 32 9 9 8 9 32 180 182 182 - 8 32 32 32 32 181 181 181 182 182 181 181 181 182 182 182 - 180 180 180 180 180 180 180 180 181 181 181 181 181 182 182 182 - 180 180 180 181 181 181 182 182 113 112 111 110 176 176 177 177 - 177 178 178 179 180 180 180 180 180 181 181 181 181 182 182 182 - 179 179 180 180 180 180 180 181 181 181 181 181 182 182 182 182 - 111 113 180 180 179 179 179 180 180 180 180 181 181 181 182 182 - 180 180 180 180 180 181 181 181 182 181 181 181 182 182 182 182 - 177 177 178 178 178 179 179 179 180 180 180 181 181 181 182 182 - 111 112 112 113 113 180 181 180 181 180 180 181 181 182 182 182 - 114 113 113 113 113 113 113 110 109 110 10 10 10 10 10 144 - 144 253 253 128 8 8 8 8 32 32 32 181 181 182 182 182 - 32 8 179 180 180 181 182 10 9 8 32 110 111 112 8 128 - 183 182 182 181 180 180 180 179 178 179 178 178 176 111 110 110 - 181 181 181 181 181 182 182 182 182 182 182 182 182 182 182 182 - 180 180 180 180 180 181 181 181 181 181 182 182 182 182 182 182 - 179 180 181 181 112 9 8 33 8 8 8 8 32 181 182 182 - 32 32 32 32 32 32 181 182 182 182 182 182 182 182 182 182 - 181 181 180 180 180 181 181 181 181 182 182 182 182 182 182 182 - 181 181 181 181 182 182 182 182 113 112 112 111 111 176 177 178 - 178 179 179 180 180 181 180 181 181 181 182 182 182 182 182 183 - 180 180 181 181 180 180 181 182 182 181 182 182 182 182 183 183 - 112 113 180 180 180 180 181 181 180 181 181 181 182 182 182 182 - 181 181 181 181 181 181 181 181 182 182 182 182 182 182 183 183 - 178 178 178 179 179 179 180 180 180 181 181 181 182 182 182 183 - 113 113 112 113 113 181 181 181 180 180 181 181 182 182 182 182 - 114 114 114 113 113 114 114 110 110 110 10 10 10 144 144 145 - 253 146 128 129 128 128 7 7 33 33 33 33 182 182 182 183 - 32 8 179 180 181 182 183 9 8 8 32 110 111 113 129 128 - 183 183 182 182 181 181 181 180 180 178 179 179 180 110 110 111 - 32 181 181 182 182 183 183 182 182 182 183 183 183 183 183 183 - 180 180 181 181 181 181 181 182 182 182 182 182 182 182 183 183 - 32 32 32 32 8 7 32 33 8 7 8 32 32 182 183 183 - 32 33 32 32 33 34 182 183 182 183 183 183 183 183 183 183 - 181 181 180 181 181 181 182 182 182 182 182 183 183 183 183 183 - 33 33 182 182 183 183 183 183 8 9 9 110 110 176 178 178 - 179 180 180 180 181 181 181 182 182 182 182 182 183 183 183 183 - 181 180 180 181 181 182 182 182 182 182 182 183 183 183 183 184 - 112 113 181 181 181 181 181 180 181 182 182 182 182 183 183 183 - 180 32 32 32 32 33 182 182 182 182 183 183 183 183 183 184 - 179 178 179 179 180 180 180 181 181 181 182 182 182 183 183 183 - 112 112 8 8 32 32 32 32 32 181 182 182 183 183 183 183 - 114 114 113 114 114 114 114 110 110 10 10 9 144 145 145 145 - 48 48 254 254 129 129 130 130 131 34 34 34 183 183 183 183 - 129 128 179 179 182 182 183 9 8 7 33 110 112 8 129 128 - 183 183 183 182 182 182 182 181 181 179 180 180 180 111 111 111 - 33 33 33 182 183 183 183 183 183 183 183 183 183 183 183 184 - 181 181 181 181 182 182 182 182 182 182 182 182 183 183 183 184 - 32 33 32 33 8 7 33 34 8 7 8 33 33 35 183 184 - 33 33 33 33 35 35 34 35 183 183 183 183 183 183 183 183 - 32 32 32 33 182 182 183 183 183 183 183 183 183 183 183 184 - 34 34 182 183 183 183 184 184 32 8 9 111 111 178 179 178 - 180 180 181 181 181 182 182 182 182 183 183 183 183 183 183 184 - 181 181 32 32 182 182 183 183 183 183 183 183 183 183 184 184 - 113 32 32 32 32 32 181 181 181 182 183 183 183 183 183 183 - 32 32 33 33 34 34 35 35 182 183 184 184 183 183 184 184 - 179 179 180 180 180 181 181 181 182 182 182 182 183 183 183 184 - 112 8 32 32 32 32 32 32 33 34 183 183 183 183 183 184 - 114 114 114 114 114 32 32 110 10 10 9 9 145 146 146 146 - 48 48 48 254 254 130 130 131 131 131 34 34 35 183 184 184 - 130 129 180 181 183 183 183 9 8 33 35 10 112 8 129 128 - 184 184 183 183 183 182 182 181 180 181 180 180 112 112 112 110 - 34 35 35 35 183 184 184 184 184 184 184 184 184 184 184 184 - 182 182 182 182 182 182 183 183 183 183 183 183 183 184 184 184 - 32 34 34 35 8 7 33 35 148 7 33 34 35 35 183 184 - 34 35 35 35 35 35 35 35 5 184 184 184 184 184 184 184 - 33 34 34 34 34 34 183 183 183 183 183 184 184 184 184 184 - 34 35 183 183 184 184 184 185 33 32 8 112 112 179 179 179 - 180 181 181 181 182 182 182 183 183 183 184 184 184 184 184 185 - 32 33 34 34 33 34 183 183 183 183 183 184 184 184 184 185 - 32 32 32 32 32 32 32 33 32 183 183 183 183 183 184 184 - 33 34 34 35 35 35 35 35 183 184 184 184 184 184 184 184 - 180 180 180 181 181 181 182 182 182 182 183 183 183 184 184 184 - 32 32 33 33 32 32 33 34 34 35 183 184 184 184 184 184 - 6 6 33 33 33 33 34 10 10 9 9 145 145 146 147 147 - 48 48 254 254 130 131 131 132 132 132 36 35 35 184 184 185 - 131 130 33 182 184 184 184 8 32 33 35 9 8 32 130 128 - 186 185 184 184 183 183 182 181 180 180 181 32 112 112 9 112 - 35 35 35 35 5 184 185 185 184 184 184 185 184 185 185 185 - 182 182 182 182 182 183 183 183 184 184 184 184 184 184 184 185 - 33 6 34 37 7 6 35 35 7 148 36 34 37 5 5 185 - 34 35 35 35 37 5 5 4 5 5 184 184 185 185 185 185 - 34 35 35 35 34 35 183 184 184 184 184 184 184 185 185 185 - 35 5 5 184 185 185 185 185 34 32 8 8 112 180 180 181 - 181 181 182 182 183 183 183 183 183 184 184 184 185 185 185 185 - 34 34 34 34 35 35 35 35 184 184 184 184 185 185 185 185 - 33 32 32 33 33 33 33 34 34 183 184 184 184 184 185 185 - 33 34 35 37 37 5 5 5 5 184 184 184 185 185 185 185 - 180 180 181 181 181 182 182 182 183 183 183 184 184 184 184 185 - 32 32 32 33 34 35 35 34 35 35 5 184 184 185 185 185 - 33 6 6 33 33 33 34 10 9 8 8 146 146 147 148 148 - 49 49 49 80 81 132 132 132 132 132 133 37 38 185 185 185 - 131 131 34 182 184 184 185 8 32 34 37 9 7 33 130 128 - 186 186 185 184 184 184 183 183 181 32 32 32 32 8 9 9 - 5 38 38 38 5 185 185 185 185 185 186 185 185 185 185 185 - 182 183 183 183 183 183 184 184 184 184 184 184 184 185 185 186 - 35 35 35 5 33 36 35 37 149 130 34 36 37 38 4 244 - 35 37 37 38 38 38 38 38 4 4 4 185 185 186 185 185 - 35 35 35 35 5 5 184 185 184 185 185 185 185 185 185 186 - 5 5 38 184 185 186 186 186 34 33 32 8 113 181 181 180 - 181 182 182 183 183 183 184 184 184 184 185 185 185 185 185 186 - 34 35 35 5 5 5 4 185 184 185 185 185 185 185 186 186 - 32 33 33 34 34 35 35 35 35 5 184 184 185 185 185 185 - 34 36 37 37 5 38 38 4 38 185 185 185 186 186 186 186 - 181 181 181 182 182 182 182 183 183 183 184 184 184 185 185 186 - 32 33 33 34 35 35 5 5 5 5 5 185 185 185 185 186 - 6 200 6 36 6 35 35 9 8 8 8 146 147 149 149 149 - 49 80 50 82 82 132 132 133 133 134 134 38 38 185 186 244 - 37 131 5 183 185 185 185 32 33 35 37 8 33 33 131 128 - 187 186 185 185 185 184 184 183 34 33 33 33 32 32 8 8 - 5 38 4 4 4 4 185 185 186 186 186 186 186 186 186 186 - 183 183 184 184 184 184 184 185 185 185 185 185 186 186 186 186 - 35 37 5 5 34 36 37 38 130 131 36 37 38 39 39 244 - 38 38 38 38 38 39 39 41 41 3 244 244 244 186 186 187 - 5 38 38 5 5 38 4 185 185 185 185 186 186 186 186 186 - 38 4 4 4 185 186 186 244 35 34 33 32 8 181 181 181 - 182 182 183 183 184 184 184 185 185 185 186 186 186 186 186 187 - 35 5 5 5 5 38 4 4 185 185 186 186 186 186 186 187 - 33 34 34 35 35 35 5 5 5 5 185 185 185 186 186 186 - 5 5 38 38 38 4 4 4 4 185 185 186 186 187 187 186 - 182 182 182 182 183 183 183 184 184 184 185 185 185 186 186 186 - 33 33 35 35 5 5 5 5 38 4 4 244 186 186 186 187 - 152 201 200 153 37 5 5 9 8 8 8 147 147 149 149 49 - 50 50 50 82 133 133 133 133 134 135 135 39 39 244 186 244 - 134 132 38 184 186 122 187 34 34 5 38 8 33 6 132 128 - 188 187 186 186 185 185 184 184 35 34 34 33 33 32 32 8 - 4 39 39 4 4 244 244 186 186 186 187 187 187 187 187 187 - 184 184 184 185 185 185 185 185 186 186 186 186 186 187 187 187 - 5 5 38 4 36 37 38 135 131 151 37 38 40 41 3 43 - 135 135 135 135 88 41 91 42 42 42 3 244 187 187 187 187 - 38 38 38 4 4 4 4 185 185 185 186 187 187 187 187 187 - 4 39 39 244 244 187 187 187 5 34 34 32 32 181 181 182 - 183 183 183 184 184 185 185 186 186 186 186 186 187 187 187 188 - 5 38 38 4 4 4 4 4 185 186 186 187 187 187 187 187 - 34 35 35 5 5 5 5 38 4 4 185 186 186 186 186 187 - 38 38 39 39 39 39 41 244 244 244 186 186 187 187 187 187 - 182 183 183 183 183 183 183 184 184 185 185 186 186 186 187 187 - 34 35 35 5 5 38 4 4 4 4 244 244 244 186 187 2 - 201 202 201 153 153 4 4 8 8 8 148 148 148 149 150 50 - 50 50 82 84 165 166 166 134 135 136 136 137 244 244 187 2 - 134 132 38 184 185 122 187 33 35 38 38 7 6 35 133 128 - 188 188 187 187 186 186 185 184 5 35 35 34 33 33 32 32 - 41 3 3 244 244 244 244 244 244 187 187 187 187 187 187 187 - 185 185 185 185 185 186 186 186 186 186 187 187 187 187 187 187 - 38 4 4 4 37 38 39 136 152 83 134 40 41 155 43 93 - 135 135 136 136 91 137 137 92 92 92 43 93 2 188 188 188 - 38 4 39 39 39 244 244 244 244 244 244 187 187 187 188 188 - 3 155 244 244 244 187 188 188 38 35 35 34 32 32 181 183 - 183 184 184 184 185 185 186 186 186 186 186 187 187 188 188 188 - 38 38 4 39 39 41 3 244 244 244 187 187 187 187 188 188 - 35 5 5 5 38 4 4 4 4 4 244 244 244 187 187 188 - 38 39 39 41 41 41 42 92 244 244 187 187 188 188 188 188 - 183 183 183 183 184 184 184 185 185 185 186 186 187 187 187 188 - 35 5 5 38 4 4 4 39 41 3 3 3 244 187 187 31 - 202 202 202 202 153 154 39 8 7 7 149 149 150 150 50 51 - 51 51 83 97 166 166 166 167 168 168 137 137 27 93 2 29 - 135 133 4 184 122 124 2 34 37 38 136 7 6 5 134 128 - 189 94 188 187 187 186 185 4 4 38 5 37 35 34 33 32 - 244 42 42 3 43 43 43 43 2 2 188 188 188 188 188 188 - 186 185 185 185 186 186 244 244 244 187 187 188 188 188 188 188 - 4 39 39 41 37 40 41 90 84 16 86 89 22 24 44 94 - 88 88 136 137 137 137 170 246 138 138 138 29 94 94 94 94 - 41 41 3 3 3 3 3 3 43 43 187 188 188 188 188 189 - 92 92 92 43 93 2 94 94 4 37 37 34 33 33 34 183 - 184 184 185 185 186 186 122 187 187 187 187 188 188 188 189 189 - 38 39 41 41 155 42 92 43 244 43 188 188 188 188 188 189 - 5 5 4 4 4 4 39 41 3 3 3 187 187 188 188 189 - 39 41 136 91 91 137 26 138 137 93 29 188 188 188 189 189 - 184 184 184 184 185 185 185 186 186 186 187 187 187 188 188 189 - 5 38 38 4 4 39 41 3 3 3 43 43 2 2 94 102 - 203 203 202 203 154 155 155 7 7 149 149 150 151 51 55 55 - 96 96 97 97 166 167 167 168 168 169 169 170 138 29 94 139 - 135 133 244 185 124 125 95 37 38 40 136 33 5 5 135 128 - 158 45 94 188 187 187 244 4 4 4 38 5 35 35 33 33 - 43 25 93 43 93 44 2 2 31 45 45 95 95 189 189 126 - 244 244 244 244 244 244 244 187 187 2 188 188 188 189 189 95 - 41 155 3 42 153 154 22 23 16 17 88 90 23 101 94 139 - 136 136 169 169 169 170 246 171 139 139 139 139 103 103 103 158 - 3 3 3 43 43 43 43 43 2 2 2 2 94 45 189 46 - 27 26 27 28 94 94 103 140 39 38 38 35 34 35 35 184 - 185 185 186 186 122 187 187 124 124 188 188 189 189 189 46 140 - 39 41 42 92 92 25 26 93 28 29 94 94 189 189 189 46 - 4 4 4 39 39 41 3 3 3 43 43 2 2 188 189 158 - 136 136 137 137 137 26 138 138 138 138 94 45 189 189 158 189 - 184 184 185 185 185 186 186 187 187 187 187 188 188 188 189 189 - 38 4 39 39 41 3 3 3 43 43 44 2 45 103 103 158 - 203 203 202 203 154 155 155 7 6 150 150 151 51 55 96 60 - 97 97 97 61 167 167 168 169 169 169 170 170 246 139 140 172 - 136 134 136 244 188 125 102 37 40 88 137 34 5 4 88 128 - 141 1 189 188 188 188 3 3 39 39 39 38 5 35 34 33 - 93 28 30 30 157 103 102 102 102 102 158 46 1 1 47 159 - 3 43 43 43 43 2 2 2 2 94 45 45 95 158 46 46 - 155 100 26 101 20 20 23 62 16 19 90 91 24 157 45 139 - 170 169 169 170 170 171 171 172 172 172 172 140 140 140 140 141 - 3 43 43 93 93 44 30 31 31 45 45 103 103 158 1 47 - 101 246 245 103 103 103 140 141 42 39 38 37 37 5 5 4 - 185 186 186 187 123 124 125 125 125 126 126 126 46 47 47 141 - 42 92 27 27 101 101 101 157 45 103 103 46 46 47 47 159 - 39 41 3 3 3 3 43 43 43 44 2 94 45 95 46 47 - 137 137 137 170 170 246 171 171 139 139 139 140 140 47 141 190 - 185 185 185 186 186 186 186 187 187 188 188 188 189 189 46 47 - 39 154 41 155 155 42 43 43 44 30 157 102 158 1 1 159 - 204 204 203 204 41 156 156 6 6 150 151 152 16 60 60 60 - 61 61 61 61 168 168 238 238 239 239 239 171 172 172 173 78 - 170 167 138 187 189 127 1 153 99 91 170 36 5 39 136 128 - 174 174 159 46 95 45 2 43 156 42 155 39 38 5 5 5 - 157 63 63 63 63 1 1 1 159 159 159 159 159 174 174 142 - 43 44 157 157 157 157 102 102 158 1 1 1 159 159 141 159 - 156 156 245 245 21 23 62 206 17 61 62 62 245 63 159 173 - 170 239 239 75 76 76 77 77 77 173 173 173 79 79 174 174 - 101 101 101 157 157 157 102 102 102 158 1 159 159 141 174 174 - 245 245 63 173 173 173 159 79 26 41 40 38 38 5 5 4 - 244 244 187 188 125 126 126 126 126 127 127 159 141 174 174 174 - 24 26 101 245 245 245 63 63 140 140 1 141 141 174 174 142 - 155 155 155 156 156 156 101 101 157 157 102 158 1 159 159 174 - 137 170 170 171 171 63 77 77 173 173 173 173 141 174 174 141 - 186 186 186 187 187 187 187 188 94 95 158 1 1 159 141 142 - 41 155 155 23 156 156 101 157 102 207 159 159 159 159 159 159 - 206 205 204 205 23 101 101 36 151 152 201 16 16 60 61 61 - 61 61 61 72 73 74 74 74 75 75 76 77 77 78 78 78 - 239 168 138 244 126 159 173 18 62 62 171 37 4 155 90 48 - 149 148 147 146 146 145 145 144 144 144 10 11 11 11 11 12 - 195 146 146 146 147 147 148 147 147 148 148 148 148 148 148 148 - 145 145 145 9 9 146 146 146 146 147 147 147 147 148 148 148 - 144 145 146 145 144 144 145 145 144 144 144 145 145 146 147 148 - 146 48 48 253 48 146 146 147 148 148 148 148 148 148 148 7 - 145 145 145 145 146 146 146 145 146 147 146 147 148 148 148 148 - 146 146 146 147 147 148 148 148 144 106 11 11 11 11 10 10 - 10 10 9 9 8 8 8 8 8 8 8 8 148 148 149 150 - 144 145 145 145 145 146 146 146 147 147 146 148 148 148 149 149 - 144 144 144 144 144 144 145 145 145 145 146 146 147 147 148 148 - 253 253 253 146 146 147 146 146 147 148 148 148 148 7 7 7 - 10 10 10 10 10 9 9 8 8 8 147 147 147 148 7 199 - 192 144 144 144 144 144 145 145 195 195 195 196 147 196 197 198 - 195 195 194 194 145 145 145 13 107 107 192 144 144 247 52 52 - 52 247 247 52 52 53 48 48 48 48 48 48 147 148 148 148 - 253 106 10 8 8 196 148 106 144 253 146 107 11 10 144 48 - 150 149 148 148 147 147 146 145 145 144 144 192 192 192 11 11 - 194 195 196 196 148 199 148 148 199 199 149 149 149 149 149 149 - 145 146 146 146 146 147 147 147 147 148 148 148 148 149 150 199 - 145 195 146 146 144 145 195 195 144 145 146 146 146 196 196 150 - 146 48 48 48 48 48 48 149 149 149 149 149 149 199 199 199 - 146 146 147 147 147 147 147 148 147 148 148 148 149 149 149 149 - 146 147 148 199 199 199 199 149 145 144 144 10 11 10 192 10 - 144 9 9 8 8 7 7 7 7 7 148 149 149 149 150 151 - 145 146 146 146 146 147 147 147 148 148 147 149 149 148 150 150 - 144 144 144 145 145 146 146 146 146 147 147 148 148 149 149 149 - 147 146 146 146 146 48 148 149 148 149 149 149 149 199 199 6 - 10 9 9 9 9 9 8 8 8 147 148 148 148 148 149 199 - 144 144 145 194 194 194 195 195 196 196 196 196 197 197 197 200 - 212 212 195 194 145 145 146 11 252 192 192 192 144 52 52 52 - 52 52 52 53 53 53 53 48 48 48 48 254 149 149 150 150 - 128 253 9 32 7 199 150 144 253 146 48 252 144 144 145 48 - 152 150 150 149 148 148 147 146 146 145 144 144 192 192 192 192 - 196 196 196 196 197 199 199 199 199 199 200 151 151 151 150 150 - 146 147 147 147 147 148 148 148 148 149 199 149 199 150 150 200 - 195 195 147 147 145 146 195 196 146 48 147 196 196 196 199 150 - 146 48 48 48 49 49 49 150 149 150 150 150 150 200 200 200 - 146 146 146 147 147 148 148 148 149 199 149 150 150 150 150 151 - 147 148 199 199 198 200 198 150 146 145 144 192 10 10 144 144 - 144 9 8 8 7 7 7 7 7 7 150 150 150 150 151 152 - 146 146 147 147 148 148 148 148 149 149 149 150 150 150 151 151 - 144 145 194 194 195 195 147 147 196 148 148 149 199 150 150 150 - 147 48 48 48 48 49 149 150 149 150 150 150 150 151 151 36 - 9 9 8 8 8 8 8 8 8 148 148 149 199 150 150 151 - 144 194 194 194 194 195 195 196 196 196 197 199 198 198 198 200 - 212 212 212 196 196 146 195 11 11 192 192 144 106 247 52 52 - 52 53 53 53 53 53 53 48 49 49 49 49 150 150 150 149 - 128 128 128 32 7 198 150 144 253 48 48 106 144 145 146 48 - 152 151 150 150 149 148 148 147 146 146 145 144 144 144 192 192 - 199 199 197 197 197 198 200 200 198 200 200 200 200 200 151 152 - 147 148 148 148 148 149 149 199 149 150 150 150 150 151 151 200 - 195 196 196 199 146 147 196 214 48 48 214 214 214 197 198 151 - 147 49 49 49 49 49 49 50 150 150 151 151 151 200 200 200 - 199 148 148 148 199 199 199 199 199 199 150 150 200 200 200 152 - 149 149 199 198 200 200 200 152 147 146 145 144 10 144 144 145 - 9 9 8 7 7 7 33 6 6 6 6 151 151 152 152 152 - 147 147 148 148 148 149 149 149 150 150 150 151 151 151 152 152 - 194 194 195 195 195 195 196 147 148 199 199 199 199 200 151 151 - 48 48 49 49 49 49 150 150 150 150 151 151 151 200 152 152 - 9 8 8 8 8 8 7 8 7 149 150 150 151 151 151 152 - 145 194 195 195 195 196 196 196 197 197 198 200 200 200 200 201 - 212 212 212 214 214 196 196 192 192 11 192 144 52 52 52 53 - 53 53 53 53 53 53 54 49 49 49 49 50 151 151 152 152 - 128 129 128 33 6 200 150 253 146 48 148 144 144 146 147 48 - 153 152 152 151 150 199 149 148 147 146 146 145 144 144 144 192 - 199 198 200 200 200 200 200 200 200 200 200 200 200 200 152 152 - 148 149 149 149 199 150 150 200 150 151 151 151 151 151 151 200 - 196 196 197 198 147 147 196 214 146 48 214 214 214 200 200 152 - 149 49 80 50 50 50 50 51 83 152 152 152 152 201 201 201 - 148 199 199 199 199 199 199 198 199 200 200 200 200 200 200 152 - 150 150 198 200 200 200 201 152 147 146 145 144 144 144 145 146 - 146 8 7 7 6 6 6 6 36 36 36 152 152 153 153 153 - 148 148 149 149 199 150 150 150 151 200 151 152 152 152 201 201 - 195 195 196 196 196 196 196 196 199 199 198 200 200 200 200 152 - 49 49 49 49 49 49 50 151 151 151 151 152 152 201 201 153 - 8 8 8 8 32 7 7 7 7 150 150 151 152 152 152 152 - 195 195 196 196 196 196 197 197 199 198 200 200 200 200 201 201 - 212 212 213 214 214 196 197 192 144 192 192 145 53 53 53 53 - 53 52 53 53 53 54 54 54 49 50 50 50 151 152 152 152 - 254 130 129 34 36 200 151 146 48 48 49 144 144 146 48 48 - 154 153 153 152 151 150 150 149 148 147 147 146 145 145 144 144 - 198 200 200 200 200 200 201 201 200 201 201 201 201 201 201 201 - 199 150 150 151 151 151 151 151 151 152 152 152 152 5 152 201 - 197 197 198 200 147 148 214 200 48 48 214 214 200 200 200 152 - 49 50 50 50 51 51 51 83 83 152 152 152 201 201 201 202 - 200 200 200 200 200 200 200 201 200 200 200 200 201 201 201 201 - 151 151 200 200 201 201 201 201 148 147 146 145 144 145 146 147 - 147 148 7 150 6 36 36 36 5 37 152 152 153 153 153 153 - 149 149 150 150 150 150 151 151 152 152 152 201 201 201 201 202 - 196 196 196 197 197 197 197 198 199 200 200 200 201 201 201 153 - 49 49 80 50 50 50 51 152 151 152 152 152 201 202 202 154 - 8 8 32 32 32 33 6 6 6 151 151 152 152 153 153 153 - 195 196 196 197 197 197 198 198 200 200 200 201 201 201 201 202 - 212 212 213 213 214 197 198 192 144 144 194 145 53 53 53 52 - 53 53 53 54 54 54 54 55 55 96 83 51 83 152 153 152 - 131 130 129 34 6 201 152 48 48 254 151 144 145 147 254 48 - 154 153 153 153 152 151 151 150 149 148 147 147 146 146 145 144 - 200 201 201 201 200 201 201 202 201 201 201 201 201 202 203 203 - 150 150 151 151 151 151 151 152 201 201 201 153 153 202 153 202 - 198 200 200 200 214 214 200 55 49 54 54 200 200 201 201 201 - 50 51 51 51 83 83 83 16 16 16 16 16 202 202 202 203 - 200 200 198 200 200 200 200 200 201 201 201 201 202 202 202 202 - 152 152 201 201 201 202 202 202 49 148 147 146 145 146 147 147 - 148 148 149 6 36 37 37 36 5 5 153 40 154 154 154 20 - 150 150 150 150 150 151 152 152 153 152 153 153 201 202 202 203 - 196 196 197 198 198 197 198 200 200 200 201 201 201 201 202 202 - 49 80 51 51 83 83 83 16 16 16 16 202 202 202 203 154 - 7 7 32 33 33 6 6 6 36 152 152 152 153 153 153 153 - 196 196 197 197 198 198 200 200 200 201 201 201 201 202 202 203 - 212 213 213 213 198 198 198 192 144 145 194 146 53 53 53 53 - 58 58 59 54 54 54 55 60 55 55 96 83 16 17 19 18 - 83 131 130 35 5 202 17 48 49 49 151 145 146 148 49 48 - 203 154 202 202 152 152 151 150 150 149 148 147 147 146 146 145 - 201 201 202 202 202 202 202 201 201 202 203 203 203 202 202 203 - 152 151 151 151 151 151 152 153 153 201 201 201 202 202 202 203 - 198 200 200 200 150 151 200 55 54 54 54 55 201 201 202 202 - 51 83 83 83 83 83 83 16 17 19 19 203 203 203 202 202 - 200 200 200 200 200 200 201 201 201 201 201 201 202 203 203 203 - 16 16 201 201 202 202 203 203 50 149 147 146 146 146 147 148 - 149 149 150 151 152 153 5 37 5 153 154 154 154 154 203 20 - 151 151 151 151 151 152 152 152 153 153 154 202 202 203 202 204 - 197 197 198 200 200 198 200 200 200 201 201 201 202 202 202 203 - 50 51 83 83 83 83 83 16 17 17 17 202 202 203 203 154 - 7 33 33 6 6 6 6 6 5 153 153 153 153 154 154 154 - 196 197 198 198 200 200 200 200 201 201 202 202 202 203 203 203 - 213 213 213 213 198 198 200 194 145 145 194 196 53 53 53 58 - 58 59 54 54 54 55 55 55 55 96 97 16 16 17 19 17 - 83 131 131 37 5 202 19 146 49 50 152 146 147 150 80 48 - 204 203 202 202 153 153 152 152 151 150 149 149 148 147 146 146 - 201 201 201 202 203 203 203 203 202 203 203 203 204 204 204 204 - 152 152 153 153 152 153 153 154 202 202 202 202 202 203 203 204 - 200 200 201 202 151 151 201 16 54 54 55 16 201 202 203 204 - 16 97 96 96 97 16 17 19 19 19 20 204 204 204 204 204 - 201 201 201 201 201 202 201 202 203 203 203 203 203 204 204 204 - 16 16 202 203 203 202 203 204 50 50 150 148 147 147 148 149 - 150 151 152 152 153 153 40 154 40 154 41 155 23 204 20 20 - 152 152 152 152 153 153 18 18 18 18 202 202 203 204 204 203 - 197 200 200 200 201 201 201 201 202 202 202 202 203 203 204 204 - 83 83 83 97 16 17 17 17 19 19 20 204 204 204 204 203 - 6 33 6 6 36 37 5 153 153 153 154 154 154 155 155 20 - 199 198 200 200 200 201 201 201 202 202 202 203 203 203 204 204 - 214 213 213 200 200 201 201 194 194 195 196 214 214 54 59 59 - 58 59 59 59 60 55 55 60 60 97 97 61 61 20 20 19 - 84 132 132 38 154 203 203 49 50 51 16 146 148 150 50 49 - 205 204 204 203 154 202 153 153 152 151 150 150 149 148 147 147 - 202 203 203 203 203 203 204 204 204 204 204 204 204 204 205 205 - 152 5 40 154 154 154 154 154 154 203 203 204 204 204 204 204 - 201 201 202 202 151 152 16 16 55 55 60 16 203 203 203 20 - 16 97 97 97 17 98 19 21 21 21 23 205 205 204 204 205 - 201 202 202 202 203 203 203 203 203 203 203 204 204 204 204 205 - 17 19 203 204 204 203 204 205 51 50 150 149 148 148 149 150 - 151 152 153 153 40 154 154 41 41 155 155 156 23 204 205 205 - 16 16 16 17 17 18 19 19 20 20 20 20 204 204 205 205 - 200 200 201 201 201 201 202 201 202 202 203 203 204 204 204 205 - 16 97 97 17 17 19 19 20 20 20 21 204 204 204 205 23 - 6 6 35 5 5 5 153 153 40 154 155 155 155 23 156 204 - 198 200 201 201 201 201 202 202 203 203 203 204 204 204 205 205 - 202 202 202 201 201 201 202 196 196 196 196 214 214 54 59 59 - 59 59 60 60 60 60 60 61 61 61 61 61 62 62 205 62 - 97 132 133 38 154 204 204 50 51 16 17 147 199 151 51 48 - 206 205 205 204 20 154 154 154 153 152 151 151 150 199 148 148 - 203 204 204 204 204 204 204 205 205 205 204 205 205 205 205 206 - 154 39 39 38 40 154 41 155 154 203 204 204 205 205 205 205 - 201 202 203 203 152 16 203 17 55 60 16 17 203 204 204 204 - 16 17 98 61 61 168 21 62 62 62 62 206 206 206 206 206 - 203 203 203 203 204 204 204 203 204 204 204 204 204 205 205 205 - 20 20 204 204 204 204 205 205 83 82 151 149 148 149 150 151 - 152 152 153 154 41 155 155 155 156 156 156 156 156 205 206 206 - 18 18 18 19 19 20 20 20 21 23 23 205 205 205 206 206 - 201 201 201 201 201 202 202 202 203 203 204 204 204 204 205 205 - 17 17 98 98 19 19 20 21 21 23 23 205 205 205 206 206 - 37 5 5 38 4 39 39 154 41 155 155 156 156 156 156 205 - 200 201 201 201 202 202 202 203 203 203 204 204 204 205 205 205 - 203 203 202 202 201 201 202 196 196 196 214 214 214 54 59 60 - 60 60 55 60 60 61 61 61 61 61 61 62 62 62 205 62 - 98 84 135 39 155 204 205 51 16 16 61 149 200 152 83 48 - 207 206 205 23 155 41 154 154 153 153 152 151 151 150 149 148 - 204 204 203 204 204 205 205 204 205 205 205 205 206 206 206 206 - 40 39 39 41 41 155 155 155 155 23 204 205 205 205 206 206 - 201 202 20 20 152 17 204 61 55 96 17 203 203 20 23 205 - 19 61 61 61 62 62 169 62 62 62 62 206 206 206 206 206 - 20 20 20 20 204 204 204 204 204 204 205 205 205 205 206 206 - 20 21 204 205 205 205 206 206 16 84 151 150 149 150 36 36 - 5 153 40 41 155 3 3 3 43 156 101 101 101 206 206 206 - 18 18 19 20 20 21 21 21 62 62 62 206 206 206 206 207 - 201 201 201 201 202 202 203 203 203 203 204 204 205 205 206 206 - 17 18 19 19 20 20 21 23 62 62 205 206 206 206 206 207 - 5 5 4 4 39 154 154 41 155 155 42 156 156 156 101 206 - 200 201 202 202 202 203 203 203 204 204 204 204 205 205 206 206 - 203 202 202 202 202 202 203 196 196 214 198 200 54 54 55 60 - 60 55 55 60 61 61 61 61 61 61 168 62 62 62 206 62 - 168 86 136 244 156 205 206 51 16 17 20 149 152 153 97 48 - 207 207 206 101 156 155 155 41 154 40 153 152 152 151 150 199 - 23 23 21 23 205 205 205 205 206 206 206 206 207 207 207 207 - 41 41 155 155 156 156 156 156 101 101 206 205 206 206 206 206 - 202 20 21 20 16 18 204 204 97 97 61 204 21 21 205 206 - 21 62 169 169 62 62 169 170 246 246 245 63 207 207 207 207 - 20 20 20 21 23 23 23 205 205 205 206 206 206 206 206 207 - 21 23 205 205 206 206 206 207 18 85 152 151 150 36 37 5 - 38 39 41 3 3 43 43 44 44 2 157 102 102 207 207 207 - 20 20 20 21 23 62 62 62 62 246 245 206 206 207 207 207 - 201 202 202 202 202 203 203 203 203 204 205 205 205 206 206 207 - 20 21 21 23 23 23 62 62 245 245 206 206 207 207 207 207 - 5 5 4 4 39 41 3 3 3 3 43 44 157 157 207 207 - 201 202 202 203 203 203 204 204 204 205 205 205 206 206 207 207 - 203 203 203 203 203 203 203 197 199 199 198 214 54 55 60 60 - 55 60 60 61 61 97 61 238 168 238 62 239 62 245 63 63 - 169 167 136 244 156 206 206 16 16 19 21 150 152 153 98 254 - 159 207 207 245 101 156 42 155 154 154 4 5 37 152 151 150 - 156 101 206 206 101 101 245 207 207 207 207 207 207 207 207 159 - 156 43 3 3 42 156 101 157 157 102 207 207 207 207 207 207 - 20 21 62 62 16 19 204 62 17 61 61 21 205 206 207 207 - 62 62 62 62 239 239 170 171 171 63 63 173 207 207 207 207 - 21 23 23 23 24 24 26 207 246 206 245 207 207 207 207 207 - 23 246 245 206 207 207 207 207 19 98 153 152 36 37 38 4 - 39 39 3 3 43 2 2 2 94 95 158 158 1 1 1 1 - 21 21 23 23 62 62 246 246 245 245 63 207 207 207 159 159 - 154 154 154 20 155 155 155 23 23 205 206 206 206 207 207 207 - 21 23 62 62 62 246 246 245 63 63 63 207 207 207 207 1 - 4 185 185 4 3 3 43 43 43 43 2 31 102 158 1 159 - 153 202 203 203 203 204 204 205 205 205 206 206 207 207 207 207 - 204 204 204 203 203 203 204 198 150 200 200 200 55 60 60 60 - 60 61 61 61 61 61 61 74 239 239 239 75 171 63 63 77 - 169 136 137 244 157 207 207 16 18 21 62 151 153 40 87 48 - 159 159 1 102 157 101 43 42 41 41 39 38 5 5 36 6 - 101 245 63 63 245 245 63 207 1 1 1 1 1 159 159 159 - 155 43 93 30 157 157 101 101 157 102 102 1 1 1 173 173 - 23 62 62 62 18 20 205 205 17 61 61 205 206 207 207 77 - 62 239 239 239 239 76 171 77 171 63 63 172 63 207 1 173 - 26 246 246 246 246 246 246 63 245 63 63 207 1 1 159 173 - 246 171 63 207 207 207 173 173 87 86 153 152 37 5 4 4 - 3 3 3 43 2 188 188 189 189 189 46 47 159 159 159 159 - 100 23 24 246 246 246 246 245 63 63 63 1 159 159 159 159 - 154 154 155 155 156 156 156 156 101 101 245 207 207 207 159 159 - 23 62 62 62 246 245 245 63 63 63 207 173 159 159 159 159 - 185 185 186 244 3 43 43 2 2 2 94 94 95 1 159 159 - 154 154 20 204 204 204 205 205 206 206 206 207 207 207 159 159 - 205 205 205 205 204 205 206 200 200 151 201 201 55 96 60 61 - 61 61 97 61 61 238 238 239 239 239 75 76 77 173 173 173 - 169 136 137 187 102 159 207 16 99 62 62 152 153 154 168 128 - 159 159 159 159 159 207 206 206 205 205 204 203 203 202 202 201 - 207 207 207 207 159 159 159 159 159 159 159 159 159 159 159 159 - 206 206 206 206 206 207 207 159 159 159 159 159 159 159 159 159 - 205 205 206 206 204 204 205 206 203 204 205 206 206 207 207 159 - 206 207 207 207 207 207 207 159 159 159 159 159 159 159 159 159 - 206 206 206 206 207 207 207 159 207 159 159 159 159 159 159 159 - 207 207 159 159 159 159 159 159 205 204 203 202 202 202 203 203 - 205 205 206 207 207 159 159 159 159 159 159 159 159 159 159 159 - 206 206 206 206 207 207 207 207 207 159 159 159 159 159 159 159 - 204 204 204 205 205 205 206 206 206 207 207 159 159 159 159 159 - 206 206 206 206 207 207 207 159 207 159 159 159 159 159 159 159 - 156 156 157 157 206 206 206 206 207 159 159 159 159 159 159 159 - 204 205 205 205 205 205 206 206 206 207 207 159 159 159 159 159 - 205 205 205 205 205 205 205 201 201 201 201 202 203 203 204 204 - 203 203 203 204 205 206 206 207 207 207 207 207 159 159 159 159 - 206 26 2 125 159 159 159 203 205 206 206 202 203 204 206 48 - 210 210 210 210 210 210 210 210 211 211 211 211 211 211 211 211 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 211 211 211 211 211 211 210 210 210 210 210 210 210 210 210 210 - 210 210 211 211 211 211 211 211 211 211 211 210 210 210 210 210 - 211 211 211 211 211 211 211 211 211 211 210 210 210 210 210 210 - 211 211 211 211 211 211 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 211 211 211 211 211 211 211 211 - 211 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 211 211 211 211 211 211 211 211 210 210 210 210 210 210 210 210 - 211 211 211 211 211 211 210 210 210 210 210 210 210 210 210 210 - 211 211 211 211 211 211 211 211 210 210 210 210 210 210 210 210 - 211 211 211 211 211 211 211 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 211 211 211 210 210 210 211 211 211 - 211 211 211 211 211 211 211 211 211 211 211 211 211 211 211 211 - 212 194 193 201 211 210 211 211 211 211 211 211 210 211 194 214 - 210 210 210 210 210 210 210 210 210 210 210 210 211 211 211 211 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 209 209 209 209 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 209 209 210 210 210 - 210 211 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 210 - 210 210 210 210 210 210 210 209 209 209 210 210 210 210 210 210 - 209 208 209 209 209 209 210 211 211 211 210 210 210 210 210 210 - 211 211 210 210 210 210 210 210 210 210 210 210 210 210 211 211 - 211 211 195 201 210 210 210 210 210 210 211 210 210 210 212 213 - 202 213 212 212 211 211 211 211 211 211 211 212 212 212 212 194 - 212 211 211 211 211 211 211 212 213 212 213 212 212 212 213 213 - 212 212 212 212 211 211 211 211 211 211 211 211 211 211 211 211 - 211 211 211 211 211 211 211 211 211 211 211 211 211 211 211 211 - 212 212 212 212 212 213 213 213 213 213 213 213 212 213 213 213 - 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 213 - 212 212 212 212 212 212 212 213 212 212 212 212 212 212 212 211 - 211 211 211 211 211 211 211 211 211 211 211 211 211 212 213 201 - 212 212 212 212 212 212 212 212 213 213 213 213 212 213 213 203 - 211 211 211 211 211 211 211 211 211 211 211 211 211 211 212 212 - 212 212 212 212 212 212 212 212 213 213 213 212 212 213 213 201 - 212 212 212 212 212 212 211 211 211 212 212 212 212 212 212 211 - 211 210 210 210 210 210 210 210 210 210 211 211 211 211 211 210 - 210 209 210 210 210 210 211 193 194 212 211 210 210 210 211 211 - 211 211 211 211 211 211 212 212 213 213 213 213 213 213 213 213 - 213 213 196 201 212 211 212 212 212 212 212 212 211 212 214 49 - 203 202 213 213 213 213 212 212 212 212 212 212 194 194 194 192 - 213 213 213 213 213 213 213 213 213 213 213 213 213 201 202 203 - 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 - 212 212 212 212 212 212 212 212 211 211 212 212 212 213 213 213 - 213 213 213 213 213 213 213 213 213 213 213 213 200 201 201 203 - 213 213 213 213 213 213 213 213 213 213 213 213 213 213 201 202 - 196 196 196 196 213 213 201 201 196 196 195 195 194 195 212 212 - 212 212 212 212 213 213 212 212 213 212 213 213 213 202 203 203 - 213 213 213 213 213 213 213 213 213 214 214 213 200 201 202 203 - 212 212 212 212 212 212 212 212 212 212 213 213 213 213 200 203 - 213 213 213 213 213 213 213 213 213 213 213 200 200 201 202 203 - 196 214 213 213 213 213 213 213 213 213 213 213 213 213 201 202 - 212 211 211 211 211 211 211 211 212 212 213 213 212 213 201 203 - 210 210 210 210 210 211 212 192 192 194 212 211 211 211 212 212 - 212 212 212 212 212 213 213 213 213 213 213 198 200 200 201 202 - 214 198 199 200 196 213 213 195 213 212 213 212 212 212 146 48 - 202 202 201 213 213 213 197 197 196 195 195 195 194 194 144 192 - 213 213 213 213 213 213 213 213 213 200 200 201 201 201 201 202 - 214 213 213 213 213 213 213 213 213 213 213 213 213 200 201 201 - 214 214 213 213 212 213 213 213 212 212 212 213 213 197 198 201 - 213 213 213 213 213 213 213 213 200 200 201 201 201 201 202 202 - 213 213 213 213 213 213 213 213 200 213 213 198 200 201 201 201 - 198 198 198 198 200 201 201 202 196 196 194 194 193 194 194 196 - 214 213 213 213 197 197 198 200 213 213 200 201 202 202 201 201 - 213 213 213 213 213 213 213 213 213 213 200 201 202 202 202 202 - 195 212 213 213 213 213 213 213 213 213 213 213 198 198 200 202 - 213 213 213 213 213 213 213 213 214 200 200 201 201 201 201 201 - 195 195 196 196 214 214 214 214 198 198 198 214 198 200 201 202 - 212 212 212 212 213 213 213 213 213 213 213 213 200 201 201 203 - 211 210 211 211 211 212 196 192 192 193 195 212 212 212 212 212 - 212 212 213 213 213 214 214 214 214 214 214 200 200 201 201 202 - 149 149 7 6 197 201 201 194 196 197 197 193 194 196 147 254 - 202 202 202 201 200 198 197 197 196 195 195 195 194 144 144 144 - 198 200 200 201 201 201 201 201 202 202 202 202 202 201 201 201 - 197 198 198 198 198 198 200 200 200 200 201 201 201 201 201 202 - 197 197 214 200 214 214 214 213 213 213 213 214 198 198 200 201 - 200 201 201 201 200 200 201 200 201 201 201 201 201 201 202 202 - 198 198 198 198 198 200 200 200 201 201 201 201 201 201 201 202 - 199 198 198 200 200 201 201 201 196 196 146 145 144 145 194 195 - 196 214 197 197 198 198 200 200 200 201 201 201 201 201 201 202 - 197 198 198 198 200 200 200 201 200 200 201 201 201 201 201 201 - 196 196 196 197 197 197 198 200 213 198 200 200 201 201 152 152 - 198 198 200 200 200 200 201 201 201 201 201 201 202 202 202 201 - 147 147 148 148 199 199 199 199 200 200 200 200 201 201 201 202 - 196 196 197 197 197 197 197 198 198 198 200 201 201 201 201 202 - 212 211 211 212 212 213 196 192 144 144 194 212 212 213 213 214 - 53 58 58 54 54 48 48 54 96 55 55 16 201 201 201 152 - 49 149 7 6 200 202 201 146 196 198 198 194 195 197 147 128 - 201 201 200 200 200 200 198 197 199 147 147 146 145 144 9 144 - 198 200 200 200 152 152 201 201 152 152 152 152 152 152 153 153 - 198 198 198 198 200 200 200 200 200 200 201 201 153 153 152 151 - 199 199 198 200 147 148 149 150 214 214 214 150 151 151 152 153 - 150 51 51 51 151 152 153 153 153 153 152 152 152 152 153 153 - 198 198 198 200 200 200 200 200 198 200 152 153 153 152 153 153 - 200 200 201 201 201 202 202 202 148 147 146 145 145 144 146 147 - 195 196 198 200 200 200 200 200 5 5 5 5 152 152 153 202 - 199 199 199 200 200 151 200 200 152 152 152 201 153 5 4 154 - 195 196 148 148 148 199 199 198 200 200 200 201 201 153 153 152 - 150 150 150 151 151 151 152 152 152 153 153 152 152 153 40 154 - 7 7 7 7 7 199 199 150 150 200 151 151 152 153 153 153 - 147 147 148 199 199 196 199 199 198 200 201 202 201 201 153 202 - 195 195 196 214 197 197 199 144 144 144 145 145 214 214 214 53 - 53 59 54 49 49 104 104 81 81 51 55 16 16 16 153 153 - 254 254 7 6 36 152 153 146 149 200 200 145 196 147 253 129 - 11 11 11 12 13 13 13 14 14 215 215 215 215 215 215 215 - 107 107 251 251 251 13 107 107 11 11 107 107 107 107 107 107 - 14 14 14 13 13 12 12 13 13 13 13 12 12 11 11 11 - 14 14 251 251 216 216 251 251 216 216 216 251 251 251 107 252 - 251 251 251 251 251 251 107 107 107 107 107 11 11 11 11 11 - 14 14 251 251 251 251 107 107 107 13 12 12 11 11 11 11 - 251 107 107 12 12 107 11 11 215 215 215 215 215 215 215 215 - 15 14 13 13 13 13 12 12 12 12 12 12 11 11 11 107 - 251 251 251 251 251 251 251 13 13 13 12 12 11 11 11 11 - 215 215 14 14 14 14 14 14 13 12 12 12 12 107 11 107 - 251 251 251 251 251 251 251 251 251 107 107 11 12 11 11 11 - 14 15 15 14 14 14 13 13 13 13 13 13 12 107 11 107 - 215 215 14 14 14 14 14 13 107 13 13 107 107 11 107 11 - 13 13 13 13 13 14 14 215 215 216 216 216 216 216 216 216 - 216 217 217 216 251 251 251 251 251 251 251 252 252 252 107 252 - 251 251 13 13 13 12 107 215 215 251 251 216 216 215 251 128 - 11 11 107 107 107 251 251 251 251 251 215 216 216 216 216 216 - 252 107 107 107 107 107 107 107 107 107 107 107 107 252 11 11 - 13 13 13 13 12 12 12 12 12 107 12 12 12 12 11 11 - 13 251 251 252 216 251 216 252 216 251 251 252 252 252 107 107 - 251 251 252 251 251 252 107 107 107 107 107 107 107 107 11 10 - 251 251 251 107 107 107 107 107 107 107 107 107 12 12 11 11 - 252 252 107 107 107 107 107 252 251 216 215 215 215 215 215 15 - 14 14 12 12 13 13 12 11 11 109 12 109 11 192 192 11 - 251 251 251 251 107 107 107 107 107 107 107 12 12 11 10 11 - 215 215 251 251 251 14 14 13 107 107 107 107 107 107 107 252 - 251 251 107 107 251 107 107 107 107 107 107 107 107 11 11 11 - 14 14 14 14 14 13 13 13 13 12 12 11 11 11 11 11 - 215 14 14 251 251 13 107 107 107 107 107 107 107 252 11 11 - 12 13 12 107 251 251 107 215 215 216 216 216 217 217 217 217 - 217 217 216 252 252 251 251 251 251 251 252 252 252 252 107 252 - 252 251 107 107 12 12 11 215 251 251 251 216 216 216 251 128 - 106 252 252 252 252 251 251 251 251 251 251 216 216 216 216 216 - 252 251 252 252 252 106 106 106 106 144 144 144 144 144 144 144 - 107 107 107 107 107 107 107 107 252 252 106 106 106 11 11 252 - 107 252 252 251 216 252 252 252 217 217 216 252 252 252 106 252 - 252 252 252 252 252 252 252 252 252 106 106 144 144 144 144 106 - 251 251 252 252 252 252 252 252 252 252 106 144 144 106 106 106 - 252 252 252 252 106 106 106 106 252 251 216 216 216 216 215 13 - 14 13 13 12 11 11 11 11 11 11 11 11 192 192 192 144 - 252 251 252 252 252 252 252 252 252 252 106 144 144 144 144 144 - 251 251 252 252 251 252 252 251 107 107 252 252 106 106 144 106 - 252 252 252 252 251 252 252 252 252 106 106 106 144 144 144 106 - 13 13 13 13 107 107 107 107 107 107 252 11 11 10 10 144 - 251 251 252 251 252 251 107 252 252 252 106 106 106 106 106 144 - 144 144 216 216 252 252 252 216 216 216 217 217 217 218 218 218 - 217 217 217 247 252 247 247 252 247 247 252 252 106 106 106 106 - 252 251 252 252 11 11 144 216 252 252 252 216 216 251 252 105 - 144 106 106 144 144 106 252 252 144 218 216 217 217 216 217 217 - 52 247 247 52 52 52 52 52 52 52 52 52 52 52 52 52 - 252 252 252 252 252 106 106 106 106 144 144 144 144 144 144 144 - 252 252 52 52 217 217 52 52 218 218 218 52 52 52 52 247 - 247 247 247 247 247 247 52 52 52 52 52 52 52 52 52 52 - 247 247 247 247 52 247 247 52 247 52 52 52 52 52 52 52 - 247 247 247 247 247 247 52 52 247 217 216 217 216 216 216 217 - 252 11 107 11 144 11 252 144 144 144 144 144 144 144 144 52 - 247 247 247 52 52 247 52 52 247 52 52 52 52 52 52 52 - 217 217 247 247 252 252 251 106 106 106 106 144 144 144 144 106 - 247 247 247 247 247 52 52 52 52 52 52 52 52 52 52 52 - 252 252 252 252 252 252 252 252 144 144 144 144 144 144 144 144 - 217 217 217 218 218 252 52 52 52 52 52 52 52 52 52 52 - 217 218 218 217 217 52 52 216 217 217 218 218 218 218 219 219 - 219 218 218 218 56 56 56 52 52 52 52 52 52 52 52 52 - 52 252 252 252 144 144 144 216 217 52 52 216 217 217 252 104 - 53 52 52 52 52 52 52 52 52 217 217 217 217 218 218 217 - 56 52 56 56 56 56 56 56 56 56 56 56 52 56 56 52 - 247 247 247 247 247 52 52 52 52 52 52 52 52 52 52 52 - 52 52 52 56 218 218 56 57 219 219 219 222 56 56 56 52 - 56 56 56 56 56 56 56 52 56 56 56 56 56 56 56 56 - 52 52 52 52 56 56 56 56 56 56 56 56 56 52 56 52 - 52 52 247 52 52 52 52 56 56 218 218 218 217 217 218 217 - 216 144 144 144 144 144 144 144 52 52 52 52 52 52 52 52 - 247 52 52 52 52 52 52 56 56 56 56 52 52 52 52 57 - 218 218 218 56 52 52 52 52 52 52 52 52 52 52 52 52 - 52 56 56 56 56 56 56 56 56 56 56 56 52 52 56 52 - 252 252 252 252 247 247 52 52 52 52 52 52 52 52 52 52 - 218 218 218 218 56 56 52 52 52 52 52 52 52 52 52 56 - 219 219 219 218 218 222 56 218 218 218 218 219 219 219 219 219 - 220 220 220 219 219 221 225 56 56 56 56 56 52 52 52 52 - 52 52 247 52 52 52 52 217 217 56 56 218 218 217 247 53 - 57 56 56 56 56 52 52 52 52 218 217 218 218 218 218 218 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 - 52 52 52 52 52 56 56 56 56 56 56 56 56 56 56 56 - 218 56 225 225 219 219 219 222 220 221 219 219 222 225 56 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 - 56 56 56 56 56 56 56 56 222 219 218 218 218 218 218 218 - 217 52 52 52 52 52 52 52 52 56 56 57 56 56 56 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 57 - 219 219 219 219 225 56 56 56 56 56 56 56 56 56 56 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 57 - 52 52 52 247 247 52 52 52 52 52 56 56 56 56 56 56 - 218 219 219 219 219 219 56 56 56 56 56 56 56 56 56 56 - 219 220 220 220 219 219 219 218 218 218 219 219 219 219 219 220 - 220 220 220 220 221 222 222 225 225 225 56 56 56 56 56 56 - 56 56 247 52 56 57 56 218 219 225 225 218 218 219 56 231 - 57 56 56 56 56 56 56 56 56 56 56 218 218 219 218 218 - 56 56 56 56 56 56 56 56 56 56 56 56 56 57 57 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 - 225 225 222 224 219 224 223 223 221 221 221 223 225 225 56 56 - 225 225 225 56 56 56 56 56 56 56 56 56 56 56 56 56 - 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 - 56 56 56 56 56 56 56 56 223 223 219 219 218 218 218 56 - 56 52 247 52 52 52 56 56 57 56 56 56 56 56 57 58 - 56 56 56 56 56 56 56 57 56 56 56 56 56 56 57 57 - 219 223 222 225 222 225 225 225 56 56 56 56 56 56 56 56 - 225 225 225 225 56 56 56 56 56 56 56 56 56 57 57 57 - 52 52 52 52 52 52 56 56 56 56 56 56 56 56 56 57 - 219 221 223 222 225 225 225 225 56 56 56 56 56 56 56 56 - 220 219 220 220 219 223 222 218 218 219 219 220 220 220 220 220 - 220 220 222 222 221 221 224 224 225 225 56 56 56 56 56 56 - 225 225 247 52 56 56 57 219 224 224 225 218 218 222 247 231 - 58 57 57 56 56 56 56 56 56 56 56 56 56 218 218 218 - 56 56 56 56 56 56 56 56 56 56 56 56 57 57 57 57 - 56 56 56 56 56 56 56 56 56 56 56 56 56 57 57 57 - 225 222 225 226 219 224 225 225 221 221 222 56 56 56 56 56 - 225 225 225 56 56 56 56 56 56 56 56 56 56 57 57 57 - 225 225 56 56 56 56 56 56 56 56 56 56 56 56 57 57 - 56 56 56 56 56 57 57 57 225 225 223 218 218 218 56 56 - 52 52 52 52 56 56 56 56 56 56 57 58 58 57 57 57 - 56 225 56 56 56 56 56 56 56 56 56 56 57 57 57 58 - 225 223 225 222 225 225 225 56 56 56 56 56 56 57 57 57 - 222 225 225 225 56 56 56 56 56 56 56 56 57 57 57 58 - 52 52 52 52 52 52 52 52 56 56 56 56 56 56 57 57 - 225 225 223 225 225 225 56 56 56 56 56 56 56 57 57 57 - 219 219 219 223 225 222 223 218 218 219 220 220 220 220 220 220 - 222 224 221 224 224 224 224 224 225 225 56 56 56 56 57 57 - 225 56 52 52 56 56 57 222 225 225 56 218 223 223 247 64 - 58 58 57 57 56 56 56 56 56 56 56 56 222 222 56 218 - 56 56 56 56 56 56 56 56 57 57 57 57 57 57 57 57 - 56 56 56 56 56 56 56 56 56 56 57 57 57 57 57 57 - 56 56 56 225 223 225 225 225 222 224 225 225 56 56 56 57 - 56 225 225 225 56 56 56 56 56 57 57 57 57 57 57 57 - 56 56 56 56 56 56 56 56 56 56 57 57 57 57 58 58 - 56 56 56 56 56 57 57 57 56 225 225 56 56 56 56 247 - 52 247 52 56 56 56 57 57 57 57 57 57 57 57 57 57 - 56 56 56 56 56 56 56 56 56 56 57 57 58 58 57 57 - 222 225 222 225 56 56 56 56 56 56 56 56 57 57 57 57 - 225 225 225 225 225 56 56 56 56 57 57 57 57 58 58 57 - 52 247 247 52 52 52 52 56 56 56 56 57 57 57 57 57 - 225 225 225 225 56 56 56 56 56 56 56 56 57 57 58 58 - 56 56 57 225 225 225 56 218 218 219 220 221 220 221 221 222 - 222 224 224 224 224 224 226 226 226 226 56 56 56 57 57 227 - 225 56 52 53 58 57 228 225 225 225 56 56 223 222 247 53 - 57 58 57 57 56 56 56 56 56 56 225 225 225 225 225 225 - 56 56 56 56 56 57 57 57 57 57 57 57 57 57 57 57 - 56 56 56 56 56 56 56 56 57 57 57 57 57 57 57 57 - 56 56 56 56 222 225 225 225 224 224 225 225 56 56 57 227 - 226 225 226 226 226 226 227 227 227 227 227 227 57 57 57 57 - 56 56 56 56 56 56 56 56 57 57 57 57 57 57 57 57 - 56 56 57 57 57 57 57 57 56 225 225 56 56 56 52 52 - 52 52 56 57 57 57 57 58 57 57 57 57 57 57 57 57 - 56 56 56 56 56 56 56 56 57 57 57 57 57 57 57 57 - 56 225 56 56 56 56 56 56 56 56 56 57 58 57 57 57 - 56 226 226 225 225 225 56 56 227 227 227 57 57 57 57 57 - 52 52 52 52 52 56 56 56 56 57 58 57 57 57 57 57 - 225 225 225 56 56 56 56 56 56 56 57 57 57 57 57 57 - 56 56 56 56 56 56 56 218 219 219 221 221 222 222 222 224 - 224 224 224 224 226 226 226 226 226 226 226 227 227 227 227 227 - 226 56 52 58 58 57 57 225 225 226 226 225 223 225 52 58 - 58 58 57 58 57 57 56 57 56 56 56 56 225 225 225 56 - 57 57 57 57 57 57 58 57 57 57 57 57 57 57 57 57 - 56 56 56 57 57 57 58 58 57 57 57 57 57 57 57 57 - 56 56 56 56 225 225 225 226 225 225 226 226 227 227 228 227 - 226 226 226 226 226 227 228 228 228 228 228 228 228 228 228 228 - 56 56 56 56 56 57 57 57 57 57 57 57 58 57 57 57 - 227 227 227 227 57 57 57 57 56 56 56 56 56 52 52 52 - 52 56 56 57 58 58 57 57 57 57 57 58 58 58 58 58 - 57 56 56 56 56 57 227 57 227 57 57 57 57 58 58 58 - 56 56 56 56 56 56 56 56 56 57 58 58 57 58 58 57 - 227 226 227 227 227 227 228 228 228 228 228 228 228 228 58 58 - 247 247 52 52 52 57 57 57 58 57 57 57 57 57 58 228 - 56 56 56 56 56 57 56 56 57 57 57 57 57 57 57 57 - 56 56 56 57 56 56 57 225 223 223 224 222 222 224 224 224 - 224 224 225 226 226 226 226 226 226 226 228 228 228 228 228 229 - 227 227 57 58 53 57 227 225 225 226 227 225 225 56 56 58 - 59 58 58 57 58 58 57 56 56 56 56 56 56 56 56 56 - 57 227 227 227 57 57 57 57 58 58 58 58 58 58 58 58 - 57 57 57 57 57 57 57 57 58 58 58 58 58 58 59 59 - 56 57 57 227 225 225 226 227 226 226 226 226 228 228 229 228 - 227 227 228 227 227 228 228 228 229 229 229 229 229 230 229 229 - 57 58 58 58 58 57 57 57 57 57 58 58 58 58 58 228 - 227 227 227 228 228 228 229 229 227 56 56 56 56 247 247 52 - 52 57 58 57 57 58 58 59 58 58 58 58 58 58 58 58 - 56 57 57 227 227 227 227 227 229 229 228 228 58 58 58 58 - 57 56 56 56 56 57 57 58 58 58 57 57 58 58 58 58 - 227 227 227 228 227 227 228 228 229 229 229 229 229 230 230 229 - 52 52 52 52 52 57 57 57 57 57 58 58 59 58 58 58 - 56 56 56 56 56 57 57 57 57 57 57 58 58 58 58 58 - 57 58 57 56 56 57 228 56 225 223 223 224 224 224 224 224 - 226 226 226 226 226 226 226 227 228 228 228 228 229 229 229 229 - 228 227 248 58 58 58 228 225 225 226 227 56 56 56 52 58 - 68 59 249 58 58 57 57 58 57 57 52 52 52 52 52 52 - 228 228 229 229 230 230 230 230 230 230 230 230 230 230 230 230 - 57 57 57 58 58 58 58 58 58 58 58 58 58 58 58 58 - 57 227 227 227 56 227 227 228 226 226 226 228 228 229 230 229 - 228 228 228 229 229 228 228 229 229 229 229 229 229 230 230 230 - 57 58 57 57 57 57 57 58 58 231 231 230 230 230 230 230 - 229 229 229 229 229 230 230 230 227 56 56 56 52 247 52 52 - 52 53 53 53 58 59 59 58 59 59 58 58 58 249 249 249 - 57 227 57 227 228 229 229 229 230 230 230 230 230 230 230 230 - 56 56 57 58 57 58 57 57 57 57 59 59 58 58 59 230 - 227 227 228 229 229 228 229 229 229 229 229 230 230 230 230 230 - 248 52 53 53 58 249 59 59 59 58 58 58 58 249 249 67 - 56 57 57 57 57 58 58 57 58 58 58 58 58 249 230 230 - 57 57 57 58 57 57 57 56 56 222 223 224 224 224 226 226 - 226 226 226 226 226 227 228 228 229 228 228 229 229 229 230 230 - 227 228 231 249 249 58 230 56 227 228 228 56 56 56 52 53 - 67 68 68 249 249 58 249 58 53 53 53 52 52 52 52 247 - 230 230 229 229 229 232 232 232 233 233 233 233 233 233 234 234 - 249 249 249 249 58 58 249 249 58 249 66 234 234 234 68 234 - 248 227 229 229 227 227 229 229 226 228 227 229 229 229 230 230 - 229 228 229 229 229 229 229 230 230 230 230 230 230 230 233 233 - 57 58 58 249 230 230 230 230 232 232 233 233 233 233 233 233 - 229 229 229 230 230 233 233 233 227 57 56 52 52 52 52 52 - 248 53 249 249 58 58 59 59 60 60 250 250 67 68 236 236 - 248 231 230 230 230 232 231 230 232 232 233 233 233 234 234 234 - 57 57 58 57 57 57 58 58 58 58 249 58 249 234 234 234 - 231 228 229 229 229 229 229 230 229 230 230 233 233 233 234 234 - 248 160 64 64 64 64 64 249 249 249 66 67 67 67 67 67 - 57 57 57 57 58 58 58 59 58 58 249 249 249 233 234 234 - 58 58 57 57 58 57 58 52 56 56 225 225 226 226 226 226 - 226 226 226 226 228 228 228 229 228 229 229 229 230 230 230 233 - 229 231 64 249 67 68 234 56 228 229 229 56 56 57 53 53 - 236 235 67 67 67 249 249 249 249 249 58 53 248 248 52 248 - 232 231 232 232 233 233 233 233 234 234 234 234 234 234 234 234 - 64 249 249 249 249 66 66 233 233 234 234 234 234 235 235 234 - 231 231 231 230 228 229 229 229 227 228 229 229 230 229 233 233 - 229 229 229 229 230 230 230 230 230 233 234 234 234 234 234 234 - 249 66 249 249 249 233 233 234 233 233 233 233 233 233 234 234 - 231 230 232 233 233 234 234 234 231 227 248 248 248 248 53 160 - 249 249 64 249 250 250 250 250 250 250 250 250 67 68 68 68 - 66 233 232 231 232 232 233 233 233 233 233 233 234 234 234 234 - 248 53 58 58 58 249 249 249 64 249 234 234 233 234 234 234 - 232 229 230 230 230 230 230 230 230 233 233 234 234 234 234 69 - 160 160 64 64 64 64 64 249 249 66 235 67 235 235 234 234 - 53 53 53 58 59 58 58 58 58 249 67 234 234 234 234 236 - 58 58 59 58 59 59 59 247 52 56 56 225 226 226 226 226 - 226 226 228 228 228 228 229 229 229 230 230 230 230 233 234 234 - 231 231 65 66 69 68 234 227 229 229 230 248 57 58 249 104 - 234 69 234 235 66 68 66 64 64 64 64 64 53 248 248 248 - 233 233 233 234 234 234 234 234 234 234 235 234 68 68 69 69 - 249 65 65 66 66 233 234 234 234 234 234 234 235 234 69 236 - 232 233 233 233 231 229 230 230 228 228 229 230 230 230 234 234 - 230 230 230 230 230 233 233 233 233 233 234 234 234 234 234 234 - 65 233 233 233 234 234 233 233 234 234 234 234 234 234 234 234 - 233 233 234 234 234 234 234 234 232 232 231 248 248 248 160 104 - 160 64 249 250 250 250 250 250 250 250 250 68 69 236 236 236 - 64 65 66 233 233 233 233 234 233 234 234 234 234 234 69 236 - 249 64 249 249 64 249 249 65 234 66 65 234 234 234 234 234 - 232 230 230 230 233 233 234 234 233 234 234 234 234 234 69 69 - 64 64 64 64 64 64 65 65 65 66 235 235 235 235 234 234 - 249 58 58 58 59 58 249 249 67 67 68 234 235 234 234 236 - 58 58 58 59 58 53 249 52 52 52 56 56 225 226 226 228 - 228 228 228 229 229 229 229 230 230 230 230 233 234 234 234 234 - 232 231 64 162 69 68 234 248 230 230 233 248 58 249 249 160 - 236 236 69 69 67 68 66 66 249 64 160 64 64 160 248 248 - 234 234 234 234 234 234 234 234 236 69 69 236 236 70 70 70 - 65 66 66 67 235 235 235 235 235 234 234 69 69 69 69 69 - 65 66 233 234 232 230 233 233 231 230 232 233 233 234 234 234 - 233 230 233 234 234 233 234 234 234 234 234 234 234 69 236 236 - 233 233 233 233 233 234 234 234 235 234 234 69 69 69 236 70 - 234 234 234 234 68 69 236 70 65 65 64 248 248 160 104 104 - 65 249 249 250 250 165 165 165 166 166 236 70 70 70 70 236 - 66 65 66 235 233 234 234 233 234 234 234 69 69 236 236 70 - 64 64 249 249 249 66 66 67 66 68 235 234 234 234 236 234 - 232 233 233 233 233 234 234 233 234 234 234 234 69 236 70 70 - 160 161 162 162 162 66 66 66 67 67 235 69 69 68 234 236 - 64 249 249 249 250 250 250 250 68 68 69 69 69 236 236 70 - 250 60 59 58 58 250 250 248 52 52 57 227 228 228 227 228 - 228 229 229 229 229 230 230 230 230 233 234 234 234 234 236 236 - 233 66 66 164 69 68 70 231 230 230 234 248 64 249 250 160 - 70 70 70 236 69 68 67 250 250 249 249 64 64 104 160 248 - 235 234 234 234 234 234 69 236 236 236 236 236 70 70 70 70 - 250 250 250 67 68 68 69 236 69 69 236 236 70 70 70 70 - 67 235 235 234 232 233 233 233 231 230 233 233 234 234 69 236 - 233 233 234 234 234 234 234 234 236 236 236 70 70 236 70 70 - 66 233 234 234 234 234 234 234 234 69 236 236 70 70 70 71 - 68 69 236 236 70 70 70 70 66 65 64 64 160 160 161 161 - 162 162 250 165 165 166 166 166 237 237 70 70 70 70 70 70 - 66 235 235 235 235 234 234 234 69 69 236 70 70 70 70 71 - 249 249 250 250 250 66 67 68 68 68 69 69 236 70 70 70 - 233 233 233 234 234 234 234 234 234 234 236 236 70 70 70 70 - 162 162 162 163 163 250 250 250 67 68 69 236 70 70 70 70 - 64 249 250 67 250 250 250 250 68 69 69 236 236 70 70 70 - 250 60 60 60 60 250 250 248 53 53 57 227 227 228 228 228 - 229 229 229 229 230 230 230 233 233 234 234 234 236 236 236 236 - 233 65 66 164 70 70 70 232 233 233 234 248 64 249 250 160 - 71 71 70 70 70 69 68 250 250 250 162 162 161 160 160 248 - 69 69 69 236 236 236 236 70 70 70 70 70 70 70 70 237 - 164 165 165 165 69 69 236 236 70 70 70 70 237 71 71 71 - 67 235 68 68 65 233 234 234 232 233 233 234 234 69 236 70 - 234 234 234 234 234 234 236 236 236 236 236 70 70 70 237 70 - 235 235 235 234 234 69 69 69 236 70 70 70 70 71 71 71 - 236 236 70 70 70 70 70 71 67 66 64 64 160 161 161 162 - 163 163 164 165 166 166 167 167 167 237 237 237 237 71 71 71 - 235 235 235 234 234 234 69 236 236 70 70 70 70 71 71 71 - 250 250 250 250 250 250 68 68 69 69 236 70 70 70 237 71 - 235 234 234 234 234 236 236 236 236 70 70 70 70 237 71 72 - 162 163 163 164 164 165 165 165 165 236 70 70 70 71 71 70 - 249 250 250 250 250 250 250 68 236 236 70 70 70 70 70 71 - 60 60 60 59 250 250 250 53 104 53 53 57 227 228 229 230 - 229 230 230 230 233 233 233 234 234 234 234 234 236 70 70 71 - 234 66 164 166 70 70 70 65 233 233 234 64 64 249 68 160 - 73 72 71 237 70 70 69 165 164 250 163 162 161 161 160 160 - 236 70 70 70 70 70 70 237 70 237 71 71 71 71 71 71 - 166 166 166 166 166 70 70 70 70 237 237 71 71 71 71 71 - 67 68 69 69 66 235 234 234 233 233 234 234 69 236 70 71 - 234 234 236 236 236 236 70 70 71 70 70 71 71 71 71 71 - 69 68 69 69 70 70 70 70 70 70 71 71 71 71 71 71 - 70 236 70 70 70 237 71 71 67 66 64 64 104 161 162 162 - 164 164 165 166 166 167 168 168 168 168 72 72 71 71 72 72 - 235 235 234 69 69 236 236 70 70 70 70 237 71 71 73 73 - 250 250 250 164 164 165 69 69 69 70 237 237 71 71 71 71 - 68 69 69 236 236 70 70 70 70 70 237 237 71 72 73 74 - 163 164 164 164 165 165 166 166 166 237 237 237 237 71 71 71 - 250 250 250 250 250 250 69 236 70 70 70 237 237 71 71 72 - 60 61 60 60 60 96 165 160 160 249 249 58 229 229 230 229 - 230 230 230 230 233 234 234 234 234 234 236 236 70 71 71 71 - 68 67 165 166 237 71 71 65 66 234 69 64 249 250 164 160 - 74 73 72 237 237 237 166 166 165 164 163 163 162 162 161 160 - 70 237 237 71 71 71 71 71 71 71 72 73 73 73 74 74 - 166 166 166 167 237 237 237 237 237 237 71 71 72 73 73 73 - 68 69 69 70 67 68 69 236 235 234 235 69 70 70 71 71 - 68 69 236 70 70 70 71 71 71 71 72 73 73 73 73 73 - 166 236 70 70 237 237 237 237 237 71 71 72 72 73 73 73 - 70 70 70 71 71 71 71 72 68 66 162 161 161 162 162 163 - 164 165 166 167 167 168 168 169 169 169 238 238 74 74 74 75 - 69 69 69 236 236 70 70 70 70 237 71 71 73 73 74 75 - 164 164 164 164 165 165 166 166 166 237 237 71 71 72 73 73 - 236 236 70 70 70 70 70 237 71 71 71 73 73 74 74 75 - 164 165 165 165 165 166 166 167 167 168 237 237 71 73 73 73 - 250 164 165 165 165 166 70 237 237 237 71 71 71 72 73 74 - 61 61 61 60 60 165 166 160 104 104 249 58 58 58 230 230 - 233 233 233 234 234 234 234 236 236 236 70 70 71 71 71 71 - 236 68 165 167 72 73 72 65 68 69 70 161 162 163 165 160 - 75 75 73 238 168 168 167 167 165 165 164 164 163 162 161 161 - 237 237 71 71 71 72 72 73 73 73 74 74 75 75 75 75 - 167 167 167 167 168 168 168 238 238 238 238 73 74 74 75 75 - 166 166 237 237 68 69 70 70 68 68 69 70 71 72 73 73 - 236 236 70 70 71 71 71 71 71 73 73 74 75 75 75 75 - 167 167 167 167 237 237 237 71 72 72 73 74 74 75 75 75 - 71 71 71 72 73 73 74 75 166 165 164 162 162 131 132 133 - 134 135 88 90 137 137 137 137 170 170 170 239 75 75 76 75 - 70 70 70 70 70 237 237 71 72 73 74 74 75 75 75 75 - 164 165 165 166 166 166 166 167 237 237 238 238 238 74 75 75 - 70 70 70 237 71 71 71 71 71 73 73 75 75 75 75 75 - 134 134 135 135 135 167 167 168 168 168 238 238 238 74 75 75 - 165 165 166 166 166 167 167 168 72 238 73 73 74 74 75 76 - 17 203 61 61 61 61 167 104 80 104 54 58 59 58 250 236 - 234 234 234 234 234 236 236 236 70 71 71 71 71 73 73 74 - 237 166 166 167 239 75 75 163 236 70 71 162 163 164 166 160 - 76 76 75 239 169 169 168 168 167 166 165 164 164 163 131 80 - 238 238 238 238 238 238 74 74 75 75 75 75 75 75 76 76 - 168 168 168 168 169 169 169 239 239 239 239 239 75 75 75 75 - 168 167 168 238 166 70 237 71 68 236 70 71 73 74 74 75 - 237 237 71 71 71 72 73 73 73 74 75 75 75 75 75 76 - 168 168 169 169 168 169 238 238 238 239 74 75 75 75 76 76 - 238 73 73 74 75 75 75 75 166 166 165 163 131 132 133 134 - 135 40 136 137 138 138 138 138 171 171 171 171 77 77 77 77 - 168 237 237 237 237 72 238 238 74 74 75 75 76 76 76 76 - 165 166 167 167 167 167 168 168 168 169 238 238 239 75 76 76 - 237 70 237 71 72 73 73 74 74 74 75 75 75 75 76 76 - 134 134 135 135 136 136 136 137 169 169 170 170 239 75 76 76 - 166 166 98 98 87 168 169 169 238 238 74 75 75 75 76 77 - 204 204 204 61 61 61 168 49 80 80 55 60 60 59 250 68 - 68 234 236 236 236 70 70 70 71 71 72 73 73 75 75 75 - 72 167 135 136 239 76 75 163 166 237 238 163 164 166 167 160 - 78 77 76 171 171 170 137 137 89 88 135 134 133 132 132 131 - 170 239 239 239 239 75 75 76 76 76 76 76 77 77 77 77 - 169 169 169 170 170 170 171 171 171 171 171 171 76 76 76 76 - 168 169 169 239 61 168 238 73 165 70 237 238 74 75 76 77 - 238 73 73 73 74 74 75 75 76 75 76 76 77 76 76 77 - 169 169 169 170 170 239 239 239 239 239 76 76 76 77 77 77 - 239 239 75 75 76 76 77 77 168 167 165 132 132 133 38 38 - 39 3 92 93 29 94 94 94 139 172 172 172 173 78 78 78 - 169 169 169 169 239 239 239 239 239 239 76 76 77 77 78 78 - 86 87 90 90 90 169 169 169 170 170 170 171 76 76 77 77 - 168 71 238 238 238 74 75 75 75 75 76 76 76 77 78 78 - 39 39 39 244 244 137 137 138 138 138 171 171 171 172 77 78 - 86 86 88 87 21 62 62 239 239 239 239 75 76 76 77 77 - 205 205 204 204 61 168 168 49 80 51 55 60 55 60 60 60 - 236 69 70 71 237 71 72 71 73 73 74 75 75 76 76 76 - 73 168 136 136 170 76 76 164 166 168 239 82 165 167 167 160 - 78 77 76 76 171 170 170 169 136 88 135 135 134 133 133 132 - 239 75 75 75 75 76 76 76 76 76 77 77 77 77 77 77 - 170 170 170 170 170 170 171 76 76 76 76 76 76 77 77 77 - 168 169 239 75 61 237 238 74 70 70 72 73 74 75 76 76 - 73 72 73 73 74 75 75 75 75 75 76 76 77 77 77 77 - 169 169 169 239 239 75 75 239 75 76 76 76 76 77 77 77 - 239 75 75 76 76 76 77 77 168 167 166 133 133 134 135 135 - 136 244 244 138 138 138 139 139 139 172 172 78 77 78 78 78 - 169 238 238 74 74 75 75 75 76 76 76 76 77 77 78 78 - 167 87 168 168 169 169 169 169 239 239 75 76 76 76 77 76 - 73 73 73 73 73 74 75 75 75 76 76 77 77 78 78 78 - 136 244 244 244 137 137 137 137 138 139 139 171 171 77 77 78 - 167 168 168 169 169 62 62 239 75 75 75 75 76 76 77 78 - 23 205 204 61 62 238 238 80 81 96 60 60 60 61 61 70 - 236 69 70 71 71 71 71 71 71 71 74 75 75 76 76 76 - 73 237 169 137 239 76 76 166 167 238 74 163 165 167 168 160 - 70 70 166 164 163 163 163 163 162 162 255 255 128 128 253 105 - 163 250 163 164 164 164 164 165 165 165 165 165 165 166 166 166 - 131 131 131 162 163 164 164 163 165 165 165 165 165 165 165 164 - 162 164 164 163 104 161 162 250 64 249 64 249 250 68 164 68 - 66 65 65 66 66 65 66 66 68 164 164 165 69 69 236 236 - 250 163 163 163 163 164 164 163 164 164 165 165 165 164 165 166 - 163 163 66 69 165 164 164 166 164 161 160 160 105 128 128 130 - 129 130 129 131 131 131 131 131 132 133 133 165 166 167 167 70 - 66 66 65 66 164 164 164 163 165 165 165 165 165 166 166 166 - 162 162 162 162 162 163 164 164 164 163 164 69 69 164 165 69 - 66 66 65 66 65 67 163 163 165 165 165 165 165 166 166 166 - 129 130 129 129 129 131 132 130 130 131 132 164 164 164 166 237 - 162 163 163 162 162 164 164 250 164 164 164 164 165 165 165 166 - 104 55 59 249 162 163 163 105 105 53 52 52 53 53 53 53 - 248 64 65 66 65 65 65 65 65 65 65 66 235 68 68 69 - 235 161 164 161 164 165 164 160 66 67 250 105 162 161 161 160 - 161 162 255 255 255 255 160 128 128 105 105 105 106 106 106 106 - 255 161 160 160 255 255 255 255 255 255 255 255 255 162 162 130 - 131 131 130 129 129 255 255 255 255 255 255 255 255 255 255 255 - 105 160 255 255 160 160 160 161 160 104 160 160 160 161 161 162 - 160 248 64 64 64 64 161 161 161 161 161 161 162 162 162 162 - 160 160 161 161 160 160 255 161 255 255 255 255 255 255 162 162 - 161 161 160 160 255 255 255 162 105 105 105 105 105 253 106 253 - 131 182 180 181 181 180 180 180 180 130 130 130 255 255 162 162 - 160 160 160 160 160 160 160 255 255 255 255 255 255 162 162 162 - 105 105 105 105 105 160 160 160 161 160 160 160 255 161 162 162 - 248 160 160 160 160 160 160 161 255 255 255 162 162 162 162 131 - 130 181 181 182 181 181 182 180 181 131 131 131 255 255 255 161 - 105 160 160 160 160 255 255 255 160 255 255 255 161 162 162 162 - 104 161 104 104 160 255 255 106 105 105 53 53 248 248 160 160 - 248 248 160 248 64 64 64 64 64 64 64 64 64 162 162 163 - 160 162 160 162 255 160 162 105 105 160 160 105 105 105 160 160 - 183 183 182 182 182 182 181 180 180 180 180 180 178 177 176 176 - 180 181 182 182 182 182 182 181 182 182 182 182 183 183 183 182 - 179 179 180 181 181 181 181 182 182 182 182 182 182 182 182 182 - 180 129 130 130 129 130 130 131 128 128 131 132 132 131 132 132 - 162 162 162 162 162 162 131 131 181 181 181 182 182 182 182 182 - 181 182 181 181 182 182 181 181 182 182 182 182 182 182 182 182 - 180 131 132 131 182 183 183 183 183 182 180 177 177 177 178 180 - 179 241 241 241 241 241 241 241 181 182 182 182 182 182 183 183 - 131 131 131 131 131 182 182 181 182 182 182 182 182 183 182 182 - 180 180 180 180 180 181 181 182 181 182 183 182 182 182 183 183 - 131 161 162 131 131 131 131 182 182 182 182 183 182 182 182 182 - 180 241 179 179 241 241 241 241 241 241 241 181 182 182 183 183 - 180 180 180 180 180 180 180 180 182 182 182 182 183 183 182 183 - 129 130 129 130 129 180 180 177 9 106 106 105 105 105 105 105 - 160 161 164 164 162 65 65 65 65 164 163 162 132 131 182 183 - 131 129 182 180 181 183 131 131 131 131 131 106 128 128 130 105 - 186 186 186 186 186 185 183 181 181 181 181 181 181 181 181 181 - 183 185 186 186 186 186 186 186 185 186 186 186 186 186 186 185 - 180 181 183 184 186 186 186 186 186 186 186 186 186 186 186 186 - 181 182 182 182 32 34 35 35 130 129 130 129 130 34 186 188 - 131 131 130 129 130 133 186 187 186 186 186 186 186 186 186 186 - 181 182 181 182 186 187 186 186 186 186 186 186 187 187 186 186 - 182 184 186 186 186 186 186 186 180 180 181 180 181 181 180 181 - 180 180 181 184 185 184 184 184 184 184 185 186 186 186 186 186 - 181 181 181 183 185 187 186 186 186 186 186 186 186 186 186 186 - 181 181 181 182 182 181 181 182 182 184 186 186 186 186 186 186 - 181 180 180 182 184 186 186 185 186 186 186 186 186 186 186 186 - 180 180 180 180 181 181 184 186 185 185 185 186 186 186 186 186 - 181 181 181 182 182 182 182 182 186 186 186 186 186 186 186 187 - 4 38 36 6 33 182 183 180 181 8 8 128 128 129 130 255 - 128 129 255 255 161 162 162 162 163 163 132 134 186 186 186 187 - 182 136 180 186 185 186 186 181 182 181 181 181 182 182 131 129 - 187 186 186 186 185 185 184 183 183 183 182 182 181 181 181 180 - 184 185 185 184 184 185 185 186 186 186 186 186 186 186 186 186 - 183 183 183 184 184 185 185 186 185 185 185 185 186 186 186 186 - 184 184 185 185 35 38 39 39 152 151 134 135 136 41 187 187 - 135 136 137 137 137 244 244 186 186 186 186 186 186 186 186 186 - 183 185 184 184 185 185 184 185 185 185 185 186 186 186 186 186 - 185 185 186 186 186 187 187 186 183 182 182 180 180 181 180 182 - 182 182 183 118 120 118 117 117 118 120 120 121 187 187 187 187 - 183 183 184 184 184 184 184 184 185 185 185 186 186 186 186 187 - 183 182 183 184 184 183 183 184 184 185 185 186 186 121 187 186 - 184 184 184 184 185 185 186 186 186 186 186 186 186 187 187 187 - 183 183 183 183 182 182 183 183 184 184 184 185 186 186 187 187 - 183 182 183 183 183 183 184 184 184 185 185 185 186 186 186 187 - 5 202 202 203 4 185 184 179 8 8 7 150 149 150 50 50 - 82 83 96 96 165 166 167 167 167 167 136 244 186 186 186 186 - 184 185 184 184 187 186 186 180 182 183 244 8 182 33 38 8 - 189 188 187 187 186 186 186 186 184 184 184 184 183 35 33 32 - 187 187 187 244 187 188 188 188 188 188 188 188 188 188 188 188 - 187 186 186 186 186 186 187 187 187 187 188 188 188 188 125 189 - 4 41 244 92 38 154 91 23 18 17 86 99 23 26 139 139 - 136 137 137 137 137 137 138 139 94 188 188 188 188 189 189 189 - 4 244 244 244 244 244 186 188 187 188 188 188 188 188 189 189 - 244 43 137 138 188 188 188 189 4 37 37 35 34 183 183 183 - 184 185 185 122 124 123 123 123 124 124 124 125 125 189 126 189 - 185 244 244 244 244 244 244 187 188 188 188 188 188 188 189 126 - 184 5 184 185 185 185 186 187 187 187 187 187 187 188 188 189 - 185 244 244 244 244 244 187 188 188 188 188 188 189 189 189 189 - 184 184 185 186 185 186 187 186 187 187 187 187 188 188 125 126 - 4 4 4 244 244 244 244 187 187 188 188 188 125 125 125 127 - 204 204 203 202 202 41 244 32 7 149 150 151 152 152 16 16 - 55 61 61 61 61 61 72 168 169 170 170 138 188 188 188 189 - 137 137 185 186 186 188 188 37 135 135 135 34 35 38 135 149 - 173 173 172 172 171 170 137 136 137 88 134 84 133 84 152 151 - 62 62 239 239 76 76 75 76 76 77 77 77 77 78 78 77 - 23 100 24 26 246 246 246 246 246 246 139 172 172 140 140 172 - 136 136 137 169 84 88 169 169 97 61 166 168 238 239 75 77 - 238 238 74 74 74 74 75 75 75 75 75 75 76 76 76 76 - 169 169 169 62 170 170 170 171 171 171 171 171 172 77 77 77 - 62 239 75 76 76 77 77 78 169 84 84 84 37 37 38 38 - 40 155 42 26 28 157 172 139 139 172 173 172 172 173 78 78 - 90 168 168 169 169 170 170 170 239 171 76 77 173 172 173 78 - 135 88 136 90 90 87 90 90 169 246 171 63 171 171 77 77 - 169 169 169 239 239 75 239 239 239 75 76 76 76 76 77 78 - 244 186 244 244 137 137 138 137 138 138 246 245 63 173 173 173 - 85 18 20 21 21 22 23 62 62 245 245 63 77 77 77 173 - 205 205 204 204 21 62 23 150 150 50 50 55 55 60 16 61 - 61 61 60 60 61 73 73 238 238 238 74 74 75 76 76 77 - 168 88 137 138 103 63 78 84 98 238 74 50 85 85 87 48 - 254 48 253 253 106 106 253 253 106 252 252 252 252 252 252 251 - 105 105 105 105 105 105 105 48 48 48 48 48 48 48 48 48 - 144 253 253 144 144 253 253 106 106 253 253 253 146 146 146 48 - 105 106 105 105 252 106 105 105 252 247 247 105 105 105 105 48 - 105 105 105 105 105 105 248 248 160 160 160 160 160 160 53 53 - 105 105 105 105 105 105 105 105 105 105 105 48 48 48 48 48 - 105 105 105 105 105 48 48 48 105 252 252 252 252 252 252 252 - 252 106 144 144 144 106 144 106 253 253 146 128 253 128 48 254 - 105 105 105 105 105 105 105 105 105 105 105 48 48 48 48 254 - 252 252 106 105 105 105 105 105 105 105 105 105 253 253 48 48 - 105 105 247 105 105 105 105 105 105 105 160 160 160 160 160 254 - 252 107 252 106 253 106 253 253 253 106 106 253 253 146 146 48 - 252 106 106 105 105 105 105 105 105 253 253 253 48 48 48 48 - 144 193 144 144 144 144 144 251 251 252 247 247 247 247 247 52 - 52 52 52 247 247 105 105 105 105 105 105 105 160 104 53 53 - 105 106 106 253 144 48 48 252 252 247 52 252 252 251 105 48 - 81 81 81 80 49 254 48 253 105 106 106 105 105 106 252 252 - 104 249 249 104 104 104 104 104 104 249 249 249 249 249 249 162 - 105 105 105 48 160 255 255 129 255 255 254 80 80 80 80 80 - 105 248 248 160 247 248 248 248 248 248 248 248 53 249 249 249 - 160 160 160 104 64 104 104 104 104 161 162 162 162 162 81 163 - 160 160 160 160 160 160 104 104 104 104 104 104 161 162 162 162 - 160 104 64 160 104 161 162 162 105 247 105 106 106 106 106 106 - 106 253 253 128 129 128 129 254 254 254 254 254 80 81 81 81 - 160 160 248 248 160 104 161 161 161 161 161 162 162 162 162 163 - 105 105 105 105 48 48 48 48 48 48 254 254 254 49 80 81 - 105 248 160 160 160 104 104 104 160 161 162 162 162 162 162 163 - 106 106 106 105 105 128 160 160 255 255 255 255 255 130 130 81 - 105 105 105 105 48 105 105 48 48 104 49 48 48 49 81 51 - 195 196 214 48 53 53 52 106 252 247 247 247 52 56 247 52 - 56 56 52 52 53 248 53 248 64 64 64 64 249 249 249 249 - 160 105 128 130 80 81 54 105 248 53 249 247 105 105 160 104 - 97 96 82 81 80 80 49 254 254 48 253 253 253 105 106 105 - 163 250 250 250 250 250 250 250 250 250 250 250 250 68 165 165 - 80 80 80 80 81 81 81 81 81 81 81 82 82 82 96 96 - 104 249 249 249 53 53 104 249 248 58 249 249 249 250 250 250 - 161 249 249 249 162 250 250 250 250 250 250 250 96 96 165 165 - 104 104 161 162 162 162 162 162 250 250 250 250 250 250 164 250 - 250 66 66 66 250 164 164 164 104 160 160 105 105 253 253 128 - 128 128 129 130 131 130 131 82 82 82 82 83 83 83 84 96 - 161 162 162 249 249 249 65 65 250 250 250 250 164 164 165 96 - 48 48 48 48 49 49 49 49 49 80 50 81 81 82 83 83 - 161 64 249 249 249 250 250 250 250 250 250 250 164 164 165 165 - 254 128 128 254 80 162 162 255 162 163 163 163 132 133 133 165 - 105 105 48 48 104 49 49 49 49 54 96 51 51 96 97 97 - 214 214 214 214 54 54 54 105 52 247 247 247 56 56 56 57 - 57 57 57 58 58 249 249 249 64 65 66 66 250 250 67 67 - 162 161 130 132 80 82 96 160 249 249 249 105 160 160 104 104 - 62 61 18 17 17 83 83 82 150 149 254 254 254 253 253 253 - 165 165 96 96 165 165 166 165 166 166 166 166 166 61 61 167 - 82 82 82 82 82 132 83 84 85 85 98 98 19 19 61 61 - 51 96 163 96 54 55 250 250 54 59 54 250 60 60 61 166 - 163 164 164 163 164 164 165 70 70 70 61 61 61 61 61 61 - 163 250 96 96 165 165 165 165 165 165 166 166 166 166 61 61 - 96 250 164 165 166 166 166 61 163 162 104 48 253 147 148 149 - 150 150 151 152 153 153 85 86 153 17 17 18 19 61 61 61 - 51 96 96 96 164 164 165 165 165 166 166 166 166 61 168 61 - 49 54 54 51 51 51 51 51 51 83 97 98 98 98 87 168 - 96 250 250 250 250 164 165 96 237 237 166 166 61 61 61 61 - 130 131 132 132 132 132 83 133 133 133 134 135 135 135 86 88 - 80 81 51 51 96 51 51 51 96 97 61 61 97 61 61 61 - 50 54 55 55 55 51 81 105 105 105 53 53 58 58 57 59 - 59 58 58 64 66 67 67 250 250 68 69 236 70 237 237 237 - 164 163 132 135 85 86 167 255 161 165 165 105 160 255 162 104 - 144 144 144 144 106 252 107 107 107 251 251 251 14 215 215 215 - 252 252 252 252 106 106 253 253 106 144 144 144 144 253 253 144 - 252 252 252 252 252 252 252 106 106 106 106 106 106 144 144 144 - 252 252 251 252 251 252 252 252 252 252 252 252 106 106 106 253 - 252 252 252 252 252 252 252 106 105 105 105 144 144 144 144 144 - 252 252 252 252 252 252 252 252 106 106 106 106 144 144 253 253 - 252 252 252 106 106 144 144 253 252 251 251 216 215 14 13 13 - 13 12 12 107 11 11 11 11 10 10 10 144 144 144 144 144 - 252 252 252 252 252 252 252 252 252 106 106 106 106 144 144 144 - 251 251 251 252 252 252 252 252 252 252 252 106 106 106 144 144 - 252 252 252 252 252 252 252 252 106 106 144 144 144 144 144 144 - 13 13 13 13 107 107 107 107 107 252 11 106 106 106 144 144 - 251 251 251 252 252 252 252 252 252 252 106 106 106 144 144 144 - 144 252 144 252 252 252 252 215 215 216 216 216 216 217 217 218 - 247 247 247 247 247 252 247 247 252 252 252 252 106 105 105 106 - 252 251 107 10 11 106 106 251 251 252 252 216 251 251 252 48 - 147 146 145 145 144 144 144 144 106 252 107 107 107 251 251 251 - 144 144 106 106 144 253 253 253 253 253 253 253 253 253 146 146 - 144 10 144 144 144 144 144 144 144 145 145 145 145 145 146 146 - 144 144 144 144 252 144 144 144 252 106 144 144 106 144 145 146 - 253 106 106 105 253 106 253 253 48 48 48 48 48 147 147 147 - 144 144 144 144 144 144 144 144 144 144 144 145 145 146 146 146 - 144 144 144 144 253 146 146 146 106 252 252 251 13 12 12 11 - 11 10 10 10 10 9 9 9 8 8 8 8 8 8 147 147 - 144 144 144 144 144 144 144 144 144 144 145 146 146 146 146 147 - 107 252 106 106 144 144 144 144 144 144 145 145 145 146 146 146 - 144 106 106 106 106 144 106 106 253 146 147 147 147 147 147 147 - 12 11 10 10 11 10 10 9 10 9 9 9 146 146 147 147 - 107 252 11 144 144 144 144 144 144 145 145 145 145 146 147 147 - 194 192 193 192 192 144 144 251 251 251 252 252 247 247 247 247 - 52 247 247 247 247 247 247 247 105 105 106 105 253 128 128 128 - 253 106 9 8 9 9 9 252 107 106 106 251 107 252 253 254 - 50 49 254 148 147 253 253 253 144 144 106 106 106 106 252 251 - 128 48 48 48 48 148 147 147 148 149 149 149 149 149 150 150 - 145 145 146 146 146 147 147 147 147 148 148 148 148 148 149 149 - 253 253 48 146 144 144 253 48 106 144 253 48 48 48 148 254 - 253 48 253 253 128 128 48 48 49 49 49 49 254 254 130 130 - 253 146 48 48 48 48 147 147 147 147 147 148 149 150 150 149 - 147 48 48 48 148 149 150 149 253 106 106 252 252 11 10 10 - 10 9 9 8 8 8 8 8 7 7 7 7 7 149 149 150 - 253 253 48 48 48 146 48 147 147 147 147 254 149 149 149 150 - 106 106 144 253 253 253 253 146 146 147 48 148 148 149 149 49 - 48 48 48 48 48 48 254 254 48 254 254 254 254 49 80 131 - 10 10 10 9 9 8 8 9 8 8 8 148 148 149 149 149 - 144 144 144 145 145 145 146 146 147 147 148 148 148 149 149 149 - 195 194 194 193 145 146 146 107 251 251 252 252 247 52 247 247 - 247 52 52 52 248 248 160 160 160 160 160 255 254 254 130 130 - 128 128 128 8 8 7 129 106 106 253 253 106 106 106 106 48 - 82 82 82 81 80 254 254 48 48 253 253 105 105 105 106 106 - 254 80 80 80 81 81 82 81 81 82 82 82 82 83 83 83 - 48 48 254 254 49 80 80 80 80 81 81 80 81 82 82 81 - 48 104 80 255 48 48 255 255 105 105 105 255 80 80 130 81 - 255 162 162 255 162 163 81 81 82 96 96 51 81 163 163 164 - 48 48 254 255 80 80 80 80 80 80 81 81 82 83 83 83 - 80 80 80 80 81 82 83 83 160 105 105 106 106 253 253 253 - 128 128 129 254 130 131 131 131 131 131 131 131 82 82 83 83 - 48 104 80 80 80 80 80 81 81 81 82 82 82 83 83 83 - 128 128 48 48 48 48 254 254 49 80 80 80 81 81 82 82 - 255 255 255 255 80 80 80 80 81 81 82 81 163 163 164 164 - 253 128 128 129 128 128 129 129 130 130 131 131 131 81 82 82 - 253 253 253 48 48 254 254 49 49 80 80 81 82 83 84 97 - 148 147 147 48 48 48 48 106 106 106 106 247 52 53 248 248 - 52 52 52 53 104 104 104 104 162 162 163 163 163 81 131 132 - 255 255 128 129 131 83 82 105 48 49 49 106 106 253 160 104 - 160 160 160 160 160 160 104 48 48 48 160 160 160 160 160 160 - 160 104 104 160 160 160 104 104 104 104 48 48 48 254 254 48 - 160 104 104 104 160 160 160 160 160 160 160 160 160 160 160 160 - 160 160 160 160 160 160 104 160 160 104 160 160 160 160 160 160 - 160 160 160 160 160 160 160 104 48 48 104 104 160 160 160 160 - 160 160 160 160 160 160 160 160 160 160 104 160 48 48 48 104 - 48 160 160 104 104 48 48 104 160 160 160 160 128 128 128 129 - 128 254 129 128 128 128 128 128 128 128 128 128 160 160 160 160 - 160 160 160 160 160 160 160 160 48 160 160 128 160 160 104 160 - 160 48 104 104 160 48 48 48 160 160 160 160 160 128 128 160 - 160 160 160 160 160 160 48 48 160 160 160 160 160 160 160 160 - 128 128 128 128 128 128 128 128 128 128 128 128 128 160 160 160 - 160 128 128 128 160 160 160 160 160 160 160 160 160 160 160 48 - 48 49 49 48 48 48 49 48 128 128 160 160 53 53 160 104 - 104 160 104 160 104 160 160 160 104 160 160 160 160 160 128 128 - 160 160 128 128 128 48 49 53 104 53 104 48 104 160 160 160 -])) - -data diff --git a/demo/mod/vfx.fnl b/demo/mod/vfx.fnl deleted file mode 100644 index 446de1c..0000000 --- a/demo/mod/vfx.fnl +++ /dev/null @@ -1,75 +0,0 @@ -(local vfx {}) - -(fn vfx.explosion [ps x y ?opts] - (let [opts (or ?opts {}) - color (or opts.color 208) - force (or opts.force 200)] - (ps:set_position x y) - (ps:set_colors color (+ color 15)) - (ps:set_velocity (- force) force (- force) force) - (ps:set_gravity 0 100) - (ps:set_life 0.3 0.8) - (ps:set_size 1 3) - (ps:set_drag 0.98) - (ps:set_spawn_rate 0) - (ps:emit (or opts.count 50)))) - -(fn vfx.fire [ps x y ?opts] - (let [opts (or ?opts {}) - width (or opts.width 50) - color (or opts.color 208)] - (ps:set_position x y) - (ps:set_spread width 5) - (ps:set_colors color (+ color 15)) - (ps:set_velocity -20 20 -80 -40) - (ps:set_gravity 0 -30) - (ps:set_life 0.5 1.5) - (ps:set_size 1 2) - (ps:set_turbulence 30) - (ps:set_drag 0.95) - (ps:set_spawn_rate (or opts.rate 50)))) - -(fn vfx.rain [ps width ?opts] - (let [opts (or ?opts {}) - wind (or opts.wind 0) - color (or opts.color 153)] - (ps:set_position (/ width 2) -10) - (ps:set_spread width 0) - (ps:set_colors color (+ color 3)) - (ps:set_velocity (- wind 10) (+ wind 10) 300 400) - (ps:set_gravity 0 200) - (ps:set_life 1 2) - (ps:set_size 1 1) - (ps:set_drag 1) - (ps:set_spawn_rate (or opts.rate 100)))) - -(fn vfx.smoke [ps x y ?opts] - (let [opts (or ?opts {}) - color (or opts.color 248)] - (ps:set_position x y) - (ps:set_spread 10 5) - (ps:set_colors color (+ color 7)) - (ps:set_velocity -15 15 -30 -10) - (ps:set_gravity 0 -20) - (ps:set_life 1 3) - (ps:set_size 2 4) - (ps:set_turbulence 20) - (ps:set_drag 0.98) - (ps:set_spawn_rate (or opts.rate 20)))) - -(fn vfx.snow [ps width ?opts] - (let [opts (or ?opts {}) - wind (or opts.wind 10) - color (or opts.color 15)] - (ps:set_position (/ width 2) -10) - (ps:set_spread width 0) - (ps:set_colors color color) - (ps:set_velocity (- wind 20) (+ wind 20) 30 60) - (ps:set_gravity 0 10) - (ps:set_life 3 6) - (ps:set_size 1 2) - (ps:set_turbulence 15) - (ps:set_drag 0.99) - (ps:set_spawn_rate (or opts.rate 30)))) - -vfx diff --git a/demo/profile_3d.fnl b/demo/profile_3d.fnl deleted file mode 100644 index 461c45a..0000000 --- a/demo/profile_3d.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(local first_person3d (require :mod.first_person3d)) - -(global init first_person3d.init) -(global update first_person3d.update) -(global frame first_person3d.frame) diff --git a/demo3d/cart.fnl b/demo3d/cart.fnl new file mode 100644 index 0000000..463cc92 --- /dev/null +++ b/demo3d/cart.fnl @@ -0,0 +1,3 @@ +{:title "pxl8 3d demo" + :resolution "640x360" + :window-size [1280 720]} diff --git a/src/bsp/pxl8_bsp.c b/demo3d/client/bsp/demo3d_bsp.c similarity index 86% rename from src/bsp/pxl8_bsp.c rename to demo3d/client/bsp/demo3d_bsp.c index 27131ff..48bce3b 100644 --- a/src/bsp/pxl8_bsp.c +++ b/demo3d/client/bsp/demo3d_bsp.c @@ -1,4 +1,4 @@ -#include "pxl8_bsp.h" +#include "demo3d_bsp.h" #include @@ -26,17 +26,17 @@ typedef enum { CHUNK_SURFEDGES = 13, CHUNK_MODELS = 14, CHUNK_COUNT = 15 -} pxl8_bsp_chunk_type; +} demo3d_bsp_chunk_type; typedef struct { u32 offset; u32 size; -} pxl8_bsp_chunk; +} demo3d_bsp_chunk; typedef struct { u32 version; - pxl8_bsp_chunk chunks[CHUNK_COUNT]; -} pxl8_bsp_header; + demo3d_bsp_chunk chunks[CHUNK_COUNT]; +} demo3d_bsp_header; static inline pxl8_vec3 read_vec3(pxl8_stream* stream) { f32 x = pxl8_read_f32(stream); @@ -45,7 +45,7 @@ static inline pxl8_vec3 read_vec3(pxl8_stream* stream) { return (pxl8_vec3){x, z, y}; } -static bool validate_chunk(const pxl8_bsp_chunk* chunk, u32 element_size, usize file_size) { +static bool validate_chunk(const demo3d_bsp_chunk* chunk, u32 element_size, usize file_size) { if (chunk->size == 0) return true; if (chunk->offset >= file_size) return false; if (chunk->offset + chunk->size > file_size) return false; @@ -53,7 +53,7 @@ static bool validate_chunk(const pxl8_bsp_chunk* chunk, u32 element_size, usize return true; } -static inline bool pxl8_bsp_get_edge_vertex(const pxl8_bsp* bsp, i32 surfedge_idx, u32* out_vert_idx) { +static inline bool demo3d_bsp_get_edge_vertex(const demo3d_bsp* bsp, i32 surfedge_idx, u32* out_vert_idx) { if (surfedge_idx >= (i32)bsp->num_surfedges) return false; i32 edge_idx = bsp->surfedges[surfedge_idx]; @@ -72,7 +72,7 @@ static inline bool pxl8_bsp_get_edge_vertex(const pxl8_bsp* bsp, i32 surfedge_id return *out_vert_idx < bsp->num_vertices; } -pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { +pxl8_result demo3d_bsp_load(const char* path, demo3d_bsp* bsp) { if (!path || !bsp) return PXL8_ERROR_INVALID_ARGUMENT; memset(bsp, 0, sizeof(*bsp)); @@ -85,7 +85,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { return result; } - if (file_size < sizeof(pxl8_bsp_header)) { + if (file_size < sizeof(demo3d_bsp_header)) { pxl8_error("BSP file too small: %s", path); pxl8_free(file_data); return PXL8_ERROR_INVALID_FORMAT; @@ -93,7 +93,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { pxl8_stream stream = pxl8_stream_create(file_data, (u32)file_size); - pxl8_bsp_header header; + demo3d_bsp_header header; header.version = pxl8_read_u32(&stream); if (header.version != BSP_VERSION) { @@ -107,11 +107,11 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { header.chunks[i].size = pxl8_read_u32(&stream); } - pxl8_bsp_chunk* chunk = &header.chunks[CHUNK_VERTICES]; + demo3d_bsp_chunk* chunk = &header.chunks[CHUNK_VERTICES]; if (!validate_chunk(chunk, 12, file_size)) goto error_cleanup; bsp->num_vertices = chunk->size / 12; if (bsp->num_vertices > 0) { - bsp->vertices = pxl8_calloc(bsp->num_vertices, sizeof(pxl8_bsp_vertex)); + bsp->vertices = pxl8_calloc(bsp->num_vertices, sizeof(demo3d_bsp_vertex)); if (!bsp->vertices) goto error_cleanup; pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_vertices; i++) { @@ -123,7 +123,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 4, file_size)) goto error_cleanup; bsp->num_edges = chunk->size / 4; if (bsp->num_edges > 0) { - bsp->edges = pxl8_calloc(bsp->num_edges, sizeof(pxl8_bsp_edge)); + bsp->edges = pxl8_calloc(bsp->num_edges, sizeof(demo3d_bsp_edge)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_edges; i++) { bsp->edges[i].vertex[0] = pxl8_read_u16(&stream); @@ -146,7 +146,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 20, file_size)) goto error_cleanup; bsp->num_planes = chunk->size / 20; if (bsp->num_planes > 0) { - bsp->planes = pxl8_calloc(bsp->num_planes, sizeof(pxl8_bsp_plane)); + bsp->planes = pxl8_calloc(bsp->num_planes, sizeof(demo3d_bsp_plane)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_planes; i++) { bsp->planes[i].normal = read_vec3(&stream); @@ -159,7 +159,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 20, file_size)) goto error_cleanup; bsp->num_faces = chunk->size / 20; if (bsp->num_faces > 0) { - bsp->faces = pxl8_calloc(bsp->num_faces, sizeof(pxl8_bsp_face)); + bsp->faces = pxl8_calloc(bsp->num_faces, sizeof(demo3d_bsp_face)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_faces; i++) { bsp->faces[i].plane_id = pxl8_read_u16(&stream); @@ -182,7 +182,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 24, file_size)) goto error_cleanup; bsp->num_nodes = chunk->size / 24; if (bsp->num_nodes > 0) { - bsp->nodes = pxl8_calloc(bsp->num_nodes, sizeof(pxl8_bsp_node)); + bsp->nodes = pxl8_calloc(bsp->num_nodes, sizeof(demo3d_bsp_node)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_nodes; i++) { bsp->nodes[i].plane_id = pxl8_read_u32(&stream); @@ -209,7 +209,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 28, file_size)) goto error_cleanup; bsp->num_leafs = chunk->size / 28; if (bsp->num_leafs > 0) { - bsp->leafs = pxl8_calloc(bsp->num_leafs, sizeof(pxl8_bsp_leaf)); + bsp->leafs = pxl8_calloc(bsp->num_leafs, sizeof(demo3d_bsp_leaf)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_leafs; i++) { bsp->leafs[i].contents = pxl8_read_i32(&stream); @@ -247,7 +247,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { if (!validate_chunk(chunk, 64, file_size)) goto error_cleanup; bsp->num_models = chunk->size / 64; if (bsp->num_models > 0) { - bsp->models = pxl8_calloc(bsp->num_models, sizeof(pxl8_bsp_model)); + bsp->models = pxl8_calloc(bsp->num_models, sizeof(demo3d_bsp_model)); pxl8_stream_seek(&stream, chunk->offset); for (u32 i = 0; i < bsp->num_models; i++) { f32 minx = pxl8_read_f32(&stream); @@ -289,7 +289,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { pxl8_free(file_data); for (u32 i = 0; i < bsp->num_faces; i++) { - pxl8_bsp_face* face = &bsp->faces[i]; + demo3d_bsp_face* face = &bsp->faces[i]; f32 min_x = 1e30f, min_y = 1e30f, min_z = 1e30f; f32 max_x = -1e30f, max_y = -1e30f, max_z = -1e30f; @@ -297,7 +297,7 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { i32 surfedge_idx = face->first_edge + j; u32 vert_idx; - if (!pxl8_bsp_get_edge_vertex(bsp, surfedge_idx, &vert_idx)) continue; + if (!demo3d_bsp_get_edge_vertex(bsp, surfedge_idx, &vert_idx)) continue; pxl8_vec3 v = bsp->vertices[vert_idx].position; @@ -321,11 +321,11 @@ pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp) { error_cleanup: pxl8_error("BSP chunk validation failed: %s", path); pxl8_free(file_data); - pxl8_bsp_destroy(bsp); + demo3d_bsp_destroy(bsp); return PXL8_ERROR_INVALID_FORMAT; } -void pxl8_bsp_destroy(pxl8_bsp* bsp) { +void demo3d_bsp_destroy(demo3d_bsp* bsp) { if (!bsp) return; pxl8_free(bsp->cell_portals); @@ -347,14 +347,14 @@ void pxl8_bsp_destroy(pxl8_bsp* bsp) { memset(bsp, 0, sizeof(*bsp)); } -i32 pxl8_bsp_find_leaf(const pxl8_bsp* bsp, pxl8_vec3 pos) { +i32 demo3d_bsp_find_leaf(const demo3d_bsp* bsp, pxl8_vec3 pos) { if (!bsp || bsp->num_nodes == 0) return -1; i32 node_id = 0; while (node_id >= 0) { - const pxl8_bsp_node* node = &bsp->nodes[node_id]; - const pxl8_bsp_plane* plane = &bsp->planes[node->plane_id]; + const demo3d_bsp_node* node = &bsp->nodes[node_id]; + const demo3d_bsp_plane* plane = &bsp->planes[node->plane_id]; f32 dist = pxl8_vec3_dot(pos, plane->normal) - plane->dist; node_id = node->children[dist < 0 ? 1 : 0]; @@ -364,7 +364,7 @@ i32 pxl8_bsp_find_leaf(const pxl8_bsp* bsp, pxl8_vec3 pos) { } -bool pxl8_bsp_is_leaf_visible(const pxl8_bsp* bsp, i32 leaf_from, i32 leaf_to) { +bool demo3d_bsp_is_leaf_visible(const demo3d_bsp* bsp, i32 leaf_from, i32 leaf_to) { if (!bsp || !bsp->visdata || bsp->visdata_size == 0) return true; if (leaf_from < 0 || leaf_to < 0) return true; if ((u32)leaf_from >= bsp->num_leafs || (u32)leaf_to >= bsp->num_leafs) return true; @@ -401,8 +401,8 @@ bool pxl8_bsp_is_leaf_visible(const pxl8_bsp* bsp, i32 leaf_from, i32 leaf_to) { return out > byte_idx ? false : true; } -pxl8_bsp_pvs pxl8_bsp_decompress_pvs(const pxl8_bsp* bsp, i32 leaf) { - pxl8_bsp_pvs pvs = {0}; +demo3d_bsp_pvs demo3d_bsp_decompress_pvs(const demo3d_bsp* bsp, i32 leaf) { + demo3d_bsp_pvs pvs = {0}; u32 row = (bsp->num_leafs + 7) >> 3; pvs.data = pxl8_malloc(row); @@ -441,7 +441,7 @@ pxl8_bsp_pvs pxl8_bsp_decompress_pvs(const pxl8_bsp* bsp, i32 leaf) { return pvs; } -void pxl8_bsp_pvs_destroy(pxl8_bsp_pvs* pvs) { +void demo3d_bsp_pvs_destroy(demo3d_bsp_pvs* pvs) { if (pvs) { pxl8_free(pvs->data); pvs->data = NULL; @@ -449,7 +449,7 @@ void pxl8_bsp_pvs_destroy(pxl8_bsp_pvs* pvs) { } } -bool pxl8_bsp_pvs_is_visible(const pxl8_bsp_pvs* pvs, i32 leaf) { +bool demo3d_bsp_pvs_is_visible(const demo3d_bsp_pvs* pvs, i32 leaf) { if (!pvs || !pvs->data || leaf < 0) return true; u32 byte_idx = (u32)leaf >> 3; u32 bit_idx = (u32)leaf & 7; @@ -457,8 +457,8 @@ bool pxl8_bsp_pvs_is_visible(const pxl8_bsp_pvs* pvs, i32 leaf) { return (pvs->data[byte_idx] & (1 << bit_idx)) != 0; } -pxl8_bsp_lightmap pxl8_bsp_lightmap_uniform(u8 r, u8 g, u8 b) { - return (pxl8_bsp_lightmap){ +demo3d_bsp_lightmap demo3d_bsp_lightmap_uniform(u8 r, u8 g, u8 b) { + return (demo3d_bsp_lightmap){ .color = {r, g, b}, .height = 0, .offset = 0, @@ -466,8 +466,8 @@ pxl8_bsp_lightmap pxl8_bsp_lightmap_uniform(u8 r, u8 g, u8 b) { }; } -pxl8_bsp_lightmap pxl8_bsp_lightmap_mapped(u8 width, u8 height, u32 offset) { - return (pxl8_bsp_lightmap){ +demo3d_bsp_lightmap demo3d_bsp_lightmap_mapped(u8 width, u8 height, u32 offset) { + return (demo3d_bsp_lightmap){ .color = {0, 0, 0}, .height = height, .offset = offset, @@ -475,7 +475,7 @@ pxl8_bsp_lightmap pxl8_bsp_lightmap_mapped(u8 width, u8 height, u32 offset) { }; } -u8 pxl8_bsp_light_at(const pxl8_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient) { +u8 demo3d_bsp_light_at(const demo3d_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient) { if (!bsp || !bsp->vertices || !bsp->vertex_lights) return 255; f32 best_dist = FLT_MAX; @@ -501,17 +501,17 @@ u8 pxl8_bsp_light_at(const pxl8_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient) { return (u8)(combined > 255.0f ? 255.0f : combined); } -pxl8_bsp_lightmap_sample pxl8_bsp_sample_lightmap(const pxl8_bsp* bsp, u32 face_idx, f32 u, f32 v) { - pxl8_bsp_lightmap_sample white = {255, 255, 255}; +demo3d_bsp_lightmap_sample demo3d_bsp_sample_lightmap(const demo3d_bsp* bsp, u32 face_idx, f32 u, f32 v) { + demo3d_bsp_lightmap_sample white = {255, 255, 255}; if (!bsp || !bsp->lightmaps || face_idx >= bsp->num_lightmaps) { return white; } - const pxl8_bsp_lightmap* lm = &bsp->lightmaps[face_idx]; + const demo3d_bsp_lightmap* lm = &bsp->lightmaps[face_idx]; if (lm->width == 0) { - return (pxl8_bsp_lightmap_sample){lm->color[2], lm->color[1], lm->color[0]}; + return (demo3d_bsp_lightmap_sample){lm->color[2], lm->color[1], lm->color[0]}; } if (!bsp->lightdata || bsp->lightdata_size == 0) { @@ -564,19 +564,19 @@ pxl8_bsp_lightmap_sample pxl8_bsp_sample_lightmap(const pxl8_bsp* bsp, u32 face_ u8 g = (u8)(g00 * inv_x * inv_y + g10 * frac_x * inv_y + g01 * inv_x * frac_y + g11 * frac_x * frac_y); u8 b = (u8)(b00 * inv_x * inv_y + b10 * frac_x * inv_y + b01 * inv_x * frac_y + b11 * frac_x * frac_y); - return (pxl8_bsp_lightmap_sample){b, g, r}; + return (demo3d_bsp_lightmap_sample){b, g, r}; } -u32 pxl8_bsp_face_count(const pxl8_bsp* bsp) { +u32 demo3d_bsp_face_count(const demo3d_bsp* bsp) { if (!bsp) return 0; return bsp->num_faces; } -pxl8_vec3 pxl8_bsp_face_normal(const pxl8_bsp* bsp, u32 face_id) { +pxl8_vec3 demo3d_bsp_face_normal(const demo3d_bsp* bsp, u32 face_id) { pxl8_vec3 up = {0, 1, 0}; if (!bsp || face_id >= bsp->num_faces) return up; - const pxl8_bsp_face* face = &bsp->faces[face_id]; + const demo3d_bsp_face* face = &bsp->faces[face_id]; if (face->plane_id >= bsp->num_planes) return up; pxl8_vec3 normal = bsp->planes[face->plane_id].normal; @@ -588,7 +588,7 @@ pxl8_vec3 pxl8_bsp_face_normal(const pxl8_bsp* bsp, u32 face_id) { return normal; } -void pxl8_bsp_face_set_material(pxl8_bsp* bsp, u32 face_id, u16 material_id) { +void demo3d_bsp_face_set_material(demo3d_bsp* bsp, u32 face_id, u16 material_id) { if (!bsp || face_id >= bsp->num_faces) return; bsp->faces[face_id].material_id = material_id; } diff --git a/demo3d/client/bsp/demo3d_bsp.h b/demo3d/client/bsp/demo3d_bsp.h new file mode 100644 index 0000000..be6b28b --- /dev/null +++ b/demo3d/client/bsp/demo3d_bsp.h @@ -0,0 +1,162 @@ +#pragma once + +#include "pxl8_math.h" +#include "pxl8_types.h" + +typedef struct demo3d_bsp_edge { + u16 vertex[2]; +} demo3d_bsp_edge; + +typedef struct demo3d_bsp_face { + u32 first_edge; + u32 lightmap_offset; + u16 num_edges; + u16 plane_id; + u16 side; + + u8 styles[4]; + u16 material_id; + + pxl8_vec3 aabb_min; + pxl8_vec3 aabb_max; +} demo3d_bsp_face; + +typedef struct demo3d_bsp_leaf { + u8 ambient_level[4]; + i32 contents; + + u16 first_marksurface; + i16 maxs[3]; + i16 mins[3]; + u16 num_marksurfaces; + + i32 visofs; +} demo3d_bsp_leaf; + +typedef struct demo3d_bsp_model { + i32 first_face; + i32 headnode[4]; + f32 maxs[3]; + f32 mins[3]; + i32 num_faces; + + pxl8_vec3 origin; + i32 visleafs; +} demo3d_bsp_model; + +typedef struct demo3d_bsp_node { + i32 children[2]; + + u16 first_face; + i16 maxs[3]; + i16 mins[3]; + u16 num_faces; + + u32 plane_id; +} demo3d_bsp_node; + +typedef struct demo3d_bsp_plane { + f32 dist; + pxl8_vec3 normal; + i32 type; +} demo3d_bsp_plane; + + +typedef struct demo3d_bsp_vertex { + pxl8_vec3 position; +} demo3d_bsp_vertex; + +typedef struct demo3d_bsp_lightmap { + u8 color[3]; + u8 height; + u32 offset; + u8 width; +} demo3d_bsp_lightmap; + +typedef struct demo3d_bsp_lightmap_sample { + u8 b; + u8 g; + u8 r; +} demo3d_bsp_lightmap_sample; + +typedef struct demo3d_bsp_pvs { + u8* data; + u32 size; +} demo3d_bsp_pvs; + +typedef struct demo3d_bsp_portal { + f32 x0, z0; + f32 x1, z1; + u32 target_leaf; +} demo3d_bsp_portal; + +typedef struct demo3d_bsp_cell_portals { + demo3d_bsp_portal portals[4]; + u8 num_portals; +} demo3d_bsp_cell_portals; + +typedef struct demo3d_bsp { + demo3d_bsp_cell_portals* cell_portals; + demo3d_bsp_edge* edges; + demo3d_bsp_face* faces; + demo3d_bsp_leaf* leafs; + u8* lightdata; + demo3d_bsp_lightmap* lightmaps; + u16* marksurfaces; + demo3d_bsp_model* models; + demo3d_bsp_node* nodes; + demo3d_bsp_plane* planes; + i32* surfedges; + u32* vertex_lights; + demo3d_bsp_vertex* vertices; + u8* visdata; + f32* heightfield; + + u32 lightdata_size; + u32 num_cell_portals; + u32 num_edges; + u32 num_faces; + u32 num_leafs; + u32 num_lightmaps; + u32 num_marksurfaces; + u32 num_models; + u32 num_nodes; + u32 num_planes; + u32 num_surfedges; + u32 num_vertex_lights; + u32 num_vertices; + u32 num_heightfield; + f32 heightfield_ox; + f32 heightfield_oz; + f32 heightfield_cell_size; + u16 heightfield_w; + u16 heightfield_h; + u32 visdata_size; + f32 bounds_min_x; + f32 bounds_min_z; + f32 bounds_max_x; + f32 bounds_max_z; +} demo3d_bsp; + +#ifdef __cplusplus +extern "C" { +#endif + +demo3d_bsp_pvs demo3d_bsp_decompress_pvs(const demo3d_bsp* bsp, i32 leaf); +void demo3d_bsp_destroy(demo3d_bsp* bsp); +u32 demo3d_bsp_face_count(const demo3d_bsp* bsp); +pxl8_vec3 demo3d_bsp_face_normal(const demo3d_bsp* bsp, u32 face_id); +void demo3d_bsp_face_set_material(demo3d_bsp* bsp, u32 face_id, u16 material_id); +i32 demo3d_bsp_find_leaf(const demo3d_bsp* bsp, pxl8_vec3 pos); +bool demo3d_bsp_is_leaf_visible(const demo3d_bsp* bsp, i32 leaf_from, i32 leaf_to); +demo3d_bsp_lightmap demo3d_bsp_lightmap_mapped(u8 width, u8 height, u32 offset); +demo3d_bsp_lightmap demo3d_bsp_lightmap_uniform(u8 r, u8 g, u8 b); +pxl8_result demo3d_bsp_load(const char* path, demo3d_bsp* bsp); +void demo3d_bsp_pvs_destroy(demo3d_bsp_pvs* pvs); +bool demo3d_bsp_pvs_is_visible(const demo3d_bsp_pvs* pvs, i32 leaf); +u8 demo3d_bsp_light_at(const demo3d_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient); +demo3d_bsp_lightmap_sample demo3d_bsp_sample_lightmap(const demo3d_bsp* bsp, u32 face_idx, f32 u, f32 v); + +#ifdef __cplusplus +} +#endif diff --git a/src/bsp/pxl8_bsp_render.c b/demo3d/client/bsp/demo3d_bsp_render.c similarity index 85% rename from src/bsp/pxl8_bsp_render.c rename to demo3d/client/bsp/demo3d_bsp_render.c index 08d61ed..9743a4b 100644 --- a/src/bsp/pxl8_bsp_render.c +++ b/demo3d/client/bsp/demo3d_bsp_render.c @@ -1,4 +1,4 @@ -#include "pxl8_bsp_render.h" +#include "demo3d_bsp_render.h" #include @@ -7,7 +7,7 @@ #include "pxl8_mem.h" #include "pxl8_mesh.h" -static inline bool pxl8_bsp_get_edge_vertex(const pxl8_bsp* bsp, i32 surfedge_idx, u32* out_vert_idx) { +static inline bool demo3d_bsp_get_edge_vertex(const demo3d_bsp* bsp, i32 surfedge_idx, u32* out_vert_idx) { if (surfedge_idx >= (i32)bsp->num_surfedges) return false; i32 edge_idx = bsp->surfedges[surfedge_idx]; @@ -26,14 +26,14 @@ static inline bool pxl8_bsp_get_edge_vertex(const pxl8_bsp* bsp, i32 surfedge_id return *out_vert_idx < bsp->num_vertices; } -static inline bool face_in_frustum(const pxl8_bsp* bsp, u32 face_id, const pxl8_frustum* frustum) { - const pxl8_bsp_face* face = &bsp->faces[face_id]; +static inline bool face_in_frustum(const demo3d_bsp* bsp, u32 face_id, const pxl8_frustum* frustum) { + const demo3d_bsp_face* face = &bsp->faces[face_id]; return pxl8_frustum_test_aabb(frustum, face->aabb_min, face->aabb_max); } -static void collect_face_to_mesh(const pxl8_bsp* bsp, const pxl8_bsp_render_state* state, +static void collect_face_to_mesh(const demo3d_bsp* bsp, const demo3d_bsp_render_state* state, u32 face_id, pxl8_mesh* mesh, u8 ambient) { - const pxl8_bsp_face* face = &bsp->faces[face_id]; + const demo3d_bsp_face* face = &bsp->faces[face_id]; if (face->num_edges < 3) return; pxl8_vec3 normal = {0, 1, 0}; @@ -82,7 +82,7 @@ static void collect_face_to_mesh(const pxl8_bsp* bsp, const pxl8_bsp_render_stat i32 surfedge_idx = face->first_edge + edge_i; u32 vert_idx; - if (!pxl8_bsp_get_edge_vertex(bsp, surfedge_idx, &vert_idx)) { + if (!demo3d_bsp_get_edge_vertex(bsp, surfedge_idx, &vert_idx)) { continue; } @@ -119,8 +119,8 @@ static void collect_face_to_mesh(const pxl8_bsp* bsp, const pxl8_bsp_render_stat } } -pxl8_bsp_render_state* pxl8_bsp_render_state_create(u32 num_faces) { - pxl8_bsp_render_state* state = pxl8_calloc(1, sizeof(pxl8_bsp_render_state)); +demo3d_bsp_render_state* demo3d_bsp_render_state_create(u32 num_faces) { + demo3d_bsp_render_state* state = pxl8_calloc(1, sizeof(demo3d_bsp_render_state)); if (!state) return NULL; state->num_faces = num_faces; @@ -135,15 +135,15 @@ pxl8_bsp_render_state* pxl8_bsp_render_state_create(u32 num_faces) { return state; } -void pxl8_bsp_render_state_destroy(pxl8_bsp_render_state* state) { +void demo3d_bsp_render_state_destroy(demo3d_bsp_render_state* state) { if (!state) return; pxl8_free(state->materials); pxl8_free(state->render_face_flags); pxl8_free(state); } -void pxl8_bsp_render(pxl8_gfx* gfx, const pxl8_bsp* bsp, - pxl8_bsp_render_state* state, +void demo3d_bsp_render(pxl8_gfx* gfx, const demo3d_bsp* bsp, + demo3d_bsp_render_state* state, const pxl8_gfx_draw_opts* opts) { if (!gfx || !bsp || !state || bsp->num_faces == 0) return; if (!state->materials || state->num_materials == 0) return; @@ -161,7 +161,7 @@ void pxl8_bsp_render(pxl8_gfx* gfx, const pxl8_bsp* bsp, for (u32 mat = 0; mat < state->num_materials; mat++) { for (u32 face_id = 0; face_id < bsp->num_faces; face_id++) { if (!state->render_face_flags[face_id]) continue; - const pxl8_bsp_face* face = &bsp->faces[face_id]; + const demo3d_bsp_face* face = &bsp->faces[face_id]; if (face->material_id != mat) continue; if (!face_in_frustum(bsp, face_id, frustum)) continue; collect_face_to_mesh(bsp, state, face_id, mesh, ambient); @@ -177,7 +177,7 @@ void pxl8_bsp_render(pxl8_gfx* gfx, const pxl8_bsp* bsp, pxl8_mesh_destroy(mesh); } -void pxl8_bsp_set_material(pxl8_bsp_render_state* state, u16 material_id, const pxl8_gfx_material* material) { +void demo3d_bsp_set_material(demo3d_bsp_render_state* state, u16 material_id, const pxl8_gfx_material* material) { if (!state || !material) return; if (material_id >= state->num_materials) { diff --git a/demo3d/client/bsp/demo3d_bsp_render.h b/demo3d/client/bsp/demo3d_bsp_render.h new file mode 100644 index 0000000..92fc08f --- /dev/null +++ b/demo3d/client/bsp/demo3d_bsp_render.h @@ -0,0 +1,29 @@ +#pragma once + +#include "demo3d_bsp.h" +#include "pxl8_gfx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct demo3d_bsp_render_state { + pxl8_gfx_material* materials; + u8* render_face_flags; + u32 num_materials; + u32 num_faces; + bool exterior; +} demo3d_bsp_render_state; + +demo3d_bsp_render_state* demo3d_bsp_render_state_create(u32 num_faces); +void demo3d_bsp_render_state_destroy(demo3d_bsp_render_state* state); + +void demo3d_bsp_render(pxl8_gfx* gfx, const demo3d_bsp* bsp, + demo3d_bsp_render_state* state, + const pxl8_gfx_draw_opts* opts); +void demo3d_bsp_set_material(demo3d_bsp_render_state* state, u16 material_id, + const pxl8_gfx_material* material); + +#ifdef __cplusplus +} +#endif diff --git a/demo3d/client/demo3d.c b/demo3d/client/demo3d.c new file mode 100644 index 0000000..23737d0 --- /dev/null +++ b/demo3d/client/demo3d.c @@ -0,0 +1,218 @@ +#include "pxl8_sys.h" +#include "pxl8_log.h" +#include "pxl8_mem.h" +#include "pxl8_script.h" + +#include "demo3d_net.h" +#include "demo3d_world.h" + +static const char* demo3d_ffi_cdefs = +"typedef struct demo3d_bsp demo3d_bsp;\n" +"\n" +"u32 demo3d_bsp_face_count(const demo3d_bsp* bsp);\n" +"pxl8_vec3 demo3d_bsp_face_normal(const demo3d_bsp* bsp, u32 face_id);\n" +"void demo3d_bsp_face_set_material(demo3d_bsp* bsp, u32 face_id, u16 material_id);\n" +"u8 demo3d_bsp_light_at(const demo3d_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient);\n" +"\n" +"typedef struct demo3d_chunk {\n" +" u32 id;\n" +" u32 version;\n" +" demo3d_bsp* bsp;\n" +"} demo3d_chunk;\n" +"\n" +"typedef struct demo3d_world demo3d_world;\n" +"\n" +"typedef struct pxl8_ray {\n" +" pxl8_vec3 normal;\n" +" pxl8_vec3 point;\n" +" float fraction;\n" +" bool hit;\n" +"} pxl8_ray;\n" +"\n" +"demo3d_world* demo3d_get_world(pxl8* sys);\n" +"demo3d_chunk* demo3d_world_active_chunk(demo3d_world* world);\n" +"bool demo3d_world_point_solid(const demo3d_world* world, float x, float y, float z);\n" +"pxl8_ray demo3d_world_ray(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to);\n" +"pxl8_ray demo3d_world_sweep(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to, float radius);\n" +"void demo3d_world_render(demo3d_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos);\n" +"void demo3d_world_set_bsp_material(demo3d_world* world, u16 material_id, const pxl8_gfx_material* material);\n" +"\n" +"typedef struct demo3d_sim_entity {\n" +" pxl8_vec3 pos;\n" +" pxl8_vec3 vel;\n" +" f32 yaw;\n" +" f32 pitch;\n" +" u32 flags;\n" +" u16 kind;\n" +" u16 _pad;\n" +"} demo3d_sim_entity;\n" +"\n" +"void demo3d_world_init_local_player(demo3d_world* world, f32 x, f32 y, f32 z);\n" +"void demo3d_world_set_look(demo3d_world* world, f32 yaw, f32 pitch);\n" +"demo3d_sim_entity* demo3d_world_local_player(demo3d_world* world);\n" +"\n" +"typedef struct demo3d_input_msg {\n" +" u32 buttons;\n" +" f32 look_dx;\n" +" f32 look_dy;\n" +" f32 move_x;\n" +" f32 move_y;\n" +" f32 yaw;\n" +" u64 tick;\n" +" u64 timestamp;\n" +"} demo3d_input_msg;\n" +"\n" +"typedef struct demo3d_sim_config {\n" +" f32 move_speed;\n" +" f32 ground_accel;\n" +" f32 air_accel;\n" +" f32 stop_speed;\n" +" f32 friction;\n" +" f32 gravity;\n" +" f32 jump_velocity;\n" +" f32 player_radius;\n" +" f32 player_height;\n" +" f32 max_pitch;\n" +"} demo3d_sim_config;\n" +"\n" +"typedef struct demo3d_sim_world {\n" +" const demo3d_bsp* chunks[9];\n" +" i32 center_cx;\n" +" i32 center_cz;\n" +" f32 chunk_size;\n" +"} demo3d_sim_world;\n" +"\n" +"void demo3d_sim_move_player(demo3d_sim_entity* ent, const demo3d_input_msg* input, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt);\n" +"void demo3d_sim_integrate(demo3d_sim_entity* ent, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt);\n" +"pxl8_vec3 demo3d_sim_trace(const demo3d_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height);\n" +"bool demo3d_sim_check_ground(const demo3d_sim_world* world, pxl8_vec3 pos, f32 radius);\n" +"\n" +"demo3d_sim_world demo3d_world_sim_world(const demo3d_world* world, pxl8_vec3 pos);\n" +"void demo3d_world_set_sim_config(demo3d_world* world, const demo3d_sim_config* config);\n" +"void demo3d_world_push_input(demo3d_world* world, const demo3d_input_msg* input);\n" +"\n" +"typedef struct demo3d_net demo3d_net;\n" +"\n" +"typedef struct demo3d_entity_state {\n" +" u64 entity_id;\n" +" u8 userdata[56];\n" +"} demo3d_entity_state;\n" +"\n" +"typedef struct demo3d_snapshot_header {\n" +" u16 entity_count;\n" +" u16 event_count;\n" +" u64 player_id;\n" +" u64 tick;\n" +" f32 time;\n" +"} demo3d_snapshot_header;\n" +"\n" +"demo3d_net* demo3d_get_net(pxl8* sys);\n" +"bool demo3d_net_connected(const demo3d_net* ng);\n" +"i32 demo3d_net_spawn(demo3d_net* ng, f32 x, f32 y, f32 z, f32 yaw, f32 pitch);\n" +"bool demo3d_net_has_chunk(const demo3d_net* ng);\n" +"i32 demo3d_net_chunk_cx(const demo3d_net* ng);\n" +"i32 demo3d_net_chunk_cz(const demo3d_net* ng);\n" +"const demo3d_entity_state* demo3d_net_entities(const demo3d_net* ng);\n" +"u64 demo3d_net_player_id(const demo3d_net* ng);\n" +"const u8* demo3d_net_entity_userdata(const demo3d_net* ng, u64 entity_id);\n" +"const u8* demo3d_net_entity_prev_userdata(const demo3d_net* ng, u64 entity_id);\n" +"f32 demo3d_net_lerp_alpha(const demo3d_net* ng);\n" +"const demo3d_snapshot_header* demo3d_net_snapshot(const demo3d_net* ng);\n" +; + +typedef struct demo3d_state { + demo3d_net* net; + demo3d_world* world; +} demo3d_state; + +static pxl8_result demo3d_init(pxl8_game* game, void* userdata) { + (void)userdata; + demo3d_state* state = pxl8_calloc(1, sizeof(demo3d_state)); + if (!state) return PXL8_ERROR_INITIALIZATION_FAILED; + game->userdata = state; + + pxl8_script_add_ffi(game->script, demo3d_ffi_cdefs); + + state->world = demo3d_world_create(); + if (!state->world) { + pxl8_error("failed to create world"); + return PXL8_ERROR_INITIALIZATION_FAILED; + } + + pxl8_net_config net_cfg = { .address = "127.0.0.1", .port = 7777 }; + state->net = demo3d_net_create(&net_cfg); + if (state->net) { + demo3d_net_set_chunk_cache(state->net, demo3d_world_get_chunk_cache(state->world)); + demo3d_net_set_world(state->net, state->world); + demo3d_net_connect(state->net); + } + +#ifdef PXL8_ASYNC_THREADS + if (state->net) { + demo3d_net_start_thread(state->net); + } + if (state->world) { + demo3d_world_start_sim_thread(state->world, state->net); + } +#endif + + return PXL8_OK; +} + +static void demo3d_update(pxl8_game* game, f32 dt, void* userdata) { + (void)userdata; + demo3d_state* state = (demo3d_state*)game->userdata; + +#ifdef PXL8_ASYNC_THREADS + demo3d_net_update(state->net, dt); +#else + if (state->net) { + while (demo3d_net_poll(state->net)) {} + demo3d_net_update(state->net, dt); + demo3d_world_sync(state->world, state->net); + } + demo3d_world_update(state->world, dt); +#endif +} + +static void demo3d_quit(pxl8_game* game, void* userdata) { + (void)userdata; + demo3d_state* state = (demo3d_state*)game->userdata; + if (!state) return; + +#ifdef PXL8_ASYNC_THREADS + if (state->world) { + demo3d_world_stop_sim_thread(state->world); + } + if (state->net) { + demo3d_net_stop_thread(state->net); + } +#endif + + if (state->net) demo3d_net_destroy(state->net); + if (state->world) demo3d_world_destroy(state->world); + + pxl8_free(state); + game->userdata = NULL; +} + +demo3d_net* demo3d_get_net(pxl8* sys) { + pxl8_game* game = pxl8_get_game(sys); + if (!game || !game->userdata) return NULL; + return ((demo3d_state*)game->userdata)->net; +} + +demo3d_world* demo3d_get_world(pxl8* sys) { + pxl8_game* game = pxl8_get_game(sys); + if (!game || !game->userdata) return NULL; + return ((demo3d_state*)game->userdata)->world; +} + +void pxl8_register_game(pxl8* sys) { + pxl8_game_hooks hooks = { + .init = demo3d_init, + .update = demo3d_update, + .quit = demo3d_quit, + }; + pxl8_set_game_hooks(sys, hooks); +} diff --git a/demo3d/client/net/demo3d_net.c b/demo3d/client/net/demo3d_net.c new file mode 100644 index 0000000..cfe2e4d --- /dev/null +++ b/demo3d/client/net/demo3d_net.c @@ -0,0 +1,297 @@ +#include "pxl8_platform.h" +#include "demo3d_net.h" + +#include + +#include "pxl8_bytes.h" +#include "pxl8_log.h" +#include "pxl8_mem.h" +#include "demo3d_world.h" +#include "demo3d_chunk_cache.h" + +static const demo3d_entity_state* find_entity(const demo3d_entity_state* entities, u16 count, u64 id) { + for (u16 i = 0; i < count; i++) { + if (entities[i].entity_id == id) return &entities[i]; + } + return NULL; +} + +static bool dispatch_message(demo3d_net* ng, const u8* data, usize len) { + if (len < sizeof(demo3d_msg_header)) return false; + + demo3d_msg_header hdr; + usize offset = demo3d_protocol_deserialize_header(data, len, &hdr); + + if (hdr.type == DEMO3D_MSG_CHUNK) { + if (!ng->chunk_cache) return false; + demo3d_chunk_msg_header chunk_hdr; + offset += demo3d_protocol_deserialize_chunk_msg_header(data + offset, len - offset, &chunk_hdr); + const u8* payload = data + offset; + usize payload_len = chunk_hdr.payload_size; + if (payload_len > len - offset) payload_len = len - offset; + demo3d_chunk_cache_receive(ng->chunk_cache, &chunk_hdr, payload, payload_len); + return true; + } + + if (hdr.type == DEMO3D_MSG_CHUNK_ENTER) { + demo3d_chunk_enter_msg chunk_msg; + demo3d_protocol_deserialize_chunk_enter(data + offset, len - offset, &chunk_msg); + ng->chunk_cx = chunk_msg.cx; + ng->chunk_cz = chunk_msg.cz; + ng->has_chunk = true; + pxl8_debug("Received CHUNK_ENTER cx=%d cz=%d", chunk_msg.cx, chunk_msg.cz); + return true; + } + + if (hdr.type == DEMO3D_MSG_CHUNK_EXIT) { + ng->has_chunk = false; + return true; + } + + if (hdr.type != DEMO3D_MSG_SNAPSHOT) return false; + + demo3d_snapshot_header snap; + offset += demo3d_protocol_deserialize_snapshot_header(data + offset, len - offset, &snap); + if (snap.tick <= ng->highest_tick) return false; + + memcpy(ng->prev_entities, ng->entities, sizeof(ng->entities)); + ng->prev_snapshot = ng->snapshot; + ng->highest_tick = snap.tick; + ng->snapshot = snap; + ng->interp_time = 0.0f; + + u16 count = snap.entity_count; + if (count > DEMO3D_MAX_SNAPSHOT_ENTITIES) count = DEMO3D_MAX_SNAPSHOT_ENTITIES; + + for (u16 i = 0; i < count; i++) { + offset += demo3d_protocol_deserialize_entity_state(data + offset, len - offset, &ng->entities[i]); + } + + return true; +} + +demo3d_net* demo3d_net_create(const pxl8_net_config* config) { + demo3d_net* ng = pxl8_calloc(1, sizeof(demo3d_net)); + if (!ng) return NULL; + ng->transport = pxl8_net_create(config); + if (!ng->transport) { + pxl8_free(ng); + return NULL; + } + return ng; +} + +void demo3d_net_destroy(demo3d_net* ng) { + if (!ng) return; + pxl8_net_destroy(ng->transport); + pxl8_free(ng); +} + +pxl8_result demo3d_net_connect(demo3d_net* ng) { + if (!ng) return PXL8_ERROR_INVALID_ARGUMENT; + return pxl8_net_connect(ng->transport); +} + +bool demo3d_net_connected(const demo3d_net* ng) { + return ng && pxl8_net_connected(ng->transport); +} + +void demo3d_net_disconnect(demo3d_net* ng) { + if (!ng) return; + pxl8_net_disconnect(ng->transport); +} + +const demo3d_entity_state* demo3d_net_entities(const demo3d_net* ng) { + if (!ng) return NULL; + return ng->entities; +} + +const u8* demo3d_net_entity_prev_userdata(const demo3d_net* ng, u64 entity_id) { + if (!ng) return NULL; + const demo3d_entity_state* e = find_entity(ng->prev_entities, ng->prev_snapshot.entity_count, entity_id); + return e ? e->userdata : NULL; +} + +const u8* demo3d_net_entity_userdata(const demo3d_net* ng, u64 entity_id) { + if (!ng) return NULL; + const demo3d_entity_state* e = find_entity(ng->entities, ng->snapshot.entity_count, entity_id); + return e ? e->userdata : NULL; +} + +const demo3d_input_msg* demo3d_net_input_at(const demo3d_net* ng, u64 tick) { + if (!ng) return NULL; + if (tick < ng->input_oldest_tick) return NULL; + u64 age = tick - ng->input_oldest_tick; + if (age >= DEMO3D_NET_INPUT_HISTORY_SIZE) return NULL; + u64 idx = tick % DEMO3D_NET_INPUT_HISTORY_SIZE; + const demo3d_input_msg* msg = &ng->input_history[idx]; + if (msg->tick != tick) return NULL; + return msg; +} + +u64 demo3d_net_input_oldest_tick(const demo3d_net* ng) { + if (!ng) return 0; + return ng->input_oldest_tick; +} + +void demo3d_net_input_push(demo3d_net* ng, const demo3d_input_msg* input) { + if (!ng || !input) return; + u64 idx = input->tick % DEMO3D_NET_INPUT_HISTORY_SIZE; + ng->input_history[idx] = *input; + ng->input_head = input->tick; + if (input->tick >= DEMO3D_NET_INPUT_HISTORY_SIZE) { + ng->input_oldest_tick = input->tick - DEMO3D_NET_INPUT_HISTORY_SIZE + 1; + } +} + +f32 demo3d_net_lerp_alpha(const demo3d_net* ng) { + if (!ng) return 1.0f; + return ng->interp_time / (1.0f / DEMO3D_NET_TICK_RATE); +} + +bool demo3d_net_needs_correction(const demo3d_net* ng) { + if (!ng) return false; + if (ng->snapshot.tick == 0) return false; + if (ng->predicted_tick == 0) return false; + + u64 player_id = ng->snapshot.player_id; + const demo3d_entity_state* server = find_entity(ng->entities, ng->snapshot.entity_count, player_id); + if (!server) return false; + + return memcmp(server->userdata, ng->predicted_state, DEMO3D_NET_USERDATA_SIZE) != 0; +} + +u64 demo3d_net_player_id(const demo3d_net* ng) { + if (!ng) return 0; + return ng->snapshot.player_id; +} + +bool demo3d_net_poll(demo3d_net* ng) { + if (!ng || !pxl8_net_connected(ng->transport)) return false; + + u8 recv_buf[4096]; + usize len = pxl8_net_recv(ng->transport, recv_buf, sizeof(recv_buf)); + u64 prev_tick = ng->highest_tick; + if (!dispatch_message(ng, recv_buf, len)) return false; + + if (ng->highest_tick > prev_tick && ng->world) { + demo3d_world_reconcile(ng->world, ng, 1.0f / 30.0f); + } + + return true; +} + +u8* demo3d_net_predicted_state(demo3d_net* ng) { + if (!ng) return NULL; + return ng->predicted_state; +} + +void demo3d_net_predicted_tick_set(demo3d_net* ng, u64 tick) { + if (!ng) return; + ng->predicted_tick = tick; +} + +pxl8_result demo3d_net_send_command(demo3d_net* ng, const demo3d_command_msg* cmd) { + if (!ng || !cmd) return PXL8_ERROR_INVALID_ARGUMENT; + if (!pxl8_net_connected(ng->transport)) return PXL8_ERROR_INVALID_ARGUMENT; + + u8 buf[512]; + demo3d_msg_header hdr = {.type = DEMO3D_MSG_COMMAND, .version = DEMO3D_PROTOCOL_VERSION}; + usize offset = demo3d_protocol_serialize_header(&hdr, buf, sizeof(buf)); + offset += demo3d_protocol_serialize_command(cmd, buf + offset, sizeof(buf) - offset); + + return pxl8_net_send(ng->transport, buf, offset); +} + +pxl8_result demo3d_net_send_input(demo3d_net* ng, const demo3d_input_msg* input) { + if (!ng || !input) return PXL8_ERROR_INVALID_ARGUMENT; + if (!pxl8_net_connected(ng->transport)) return PXL8_ERROR_INVALID_ARGUMENT; + + demo3d_net_input_push(ng, input); + + u8 buf[512]; + demo3d_msg_header hdr = {.type = DEMO3D_MSG_INPUT, .version = DEMO3D_PROTOCOL_VERSION}; + usize offset = demo3d_protocol_serialize_header(&hdr, buf, sizeof(buf)); + offset += demo3d_protocol_serialize_input(input, buf + offset, sizeof(buf) - offset); + + return pxl8_net_send(ng->transport, buf, offset); +} + +const demo3d_snapshot_header* demo3d_net_snapshot(const demo3d_net* ng) { + if (!ng) return NULL; + return &ng->snapshot; +} + +u64 demo3d_net_tick(const demo3d_net* ng) { + if (!ng) return 0; + return ng->snapshot.tick; +} + +void demo3d_net_update(demo3d_net* ng, f32 dt) { + if (!ng) return; + ng->interp_time += dt; +} + +void demo3d_net_set_chunk_cache(demo3d_net* ng, demo3d_chunk_cache* cache) { + if (!ng) return; + ng->chunk_cache = cache; +} + +demo3d_chunk_cache* demo3d_net_chunk_cache(demo3d_net* ng) { + if (!ng) return NULL; + return ng->chunk_cache; +} + +void demo3d_net_set_world(demo3d_net* ng, demo3d_world* world) { + if (!ng) return; + ng->world = world; +} + +i32 demo3d_net_chunk_cx(const demo3d_net* ng) { + if (!ng) return 0; + return ng->chunk_cx; +} + +i32 demo3d_net_chunk_cz(const demo3d_net* ng) { + if (!ng) return 0; + return ng->chunk_cz; +} + +bool demo3d_net_has_chunk(const demo3d_net* ng) { + if (!ng) return false; + return ng->has_chunk; +} + +pxl8_result demo3d_net_spawn(demo3d_net* ng, f32 x, f32 y, f32 z, f32 yaw, f32 pitch) { + if (!ng) return PXL8_ERROR_INVALID_ARGUMENT; + + demo3d_command_msg cmd = {0}; + cmd.cmd_type = DEMO3D_CMD_SPAWN_ENTITY; + + u8* p = cmd.payload; + memcpy(p, &x, 4); p += 4; + memcpy(p, &y, 4); p += 4; + memcpy(p, &z, 4); p += 4; + memcpy(p, &yaw, 4); p += 4; + memcpy(p, &pitch, 4); + cmd.payload_size = 20; + + return demo3d_net_send_command(ng, &cmd); +} + +#ifdef PXL8_ASYNC_THREADS +void demo3d_net_start_thread(demo3d_net* ng) { + if (!ng) return; + pxl8_net_start_thread(ng->transport); +} + +void demo3d_net_stop_thread(demo3d_net* ng) { + if (!ng) return; + pxl8_net_stop_thread(ng->transport); +} + +bool demo3d_net_dispatch_packet(demo3d_net* ng, const pxl8_packet* pkt) { + if (!ng || !pkt) return false; + return dispatch_message(ng, pkt->data, pkt->len); +} +#endif diff --git a/demo3d/client/net/demo3d_net.h b/demo3d/client/net/demo3d_net.h new file mode 100644 index 0000000..60dc312 --- /dev/null +++ b/demo3d/client/net/demo3d_net.h @@ -0,0 +1,74 @@ +#pragma once + +#include "pxl8_net.h" +#include "demo3d_protocol.h" +#include "pxl8_types.h" + +#define DEMO3D_NET_INPUT_HISTORY_SIZE 64 +#define DEMO3D_NET_USERDATA_SIZE 56 +#define DEMO3D_NET_TICK_RATE 30.0f + +typedef struct demo3d_world demo3d_world; +typedef struct demo3d_chunk_cache demo3d_chunk_cache; + +typedef struct demo3d_net { + pxl8_net* transport; + + demo3d_chunk_cache* chunk_cache; + i32 chunk_cx; + i32 chunk_cz; + bool has_chunk; + demo3d_world* world; + + u64 highest_tick; + f32 interp_time; + + demo3d_entity_state entities[DEMO3D_MAX_SNAPSHOT_ENTITIES]; + demo3d_entity_state prev_entities[DEMO3D_MAX_SNAPSHOT_ENTITIES]; + demo3d_snapshot_header prev_snapshot; + demo3d_snapshot_header snapshot; + + u64 input_head; + demo3d_input_msg input_history[DEMO3D_NET_INPUT_HISTORY_SIZE]; + u64 input_oldest_tick; + + u8 predicted_state[DEMO3D_NET_USERDATA_SIZE]; + u64 predicted_tick; +} demo3d_net; + +demo3d_net* demo3d_net_create(const pxl8_net_config* config); +void demo3d_net_destroy(demo3d_net* ng); +pxl8_result demo3d_net_connect(demo3d_net* ng); +bool demo3d_net_connected(const demo3d_net* ng); +void demo3d_net_disconnect(demo3d_net* ng); + +const demo3d_entity_state* demo3d_net_entities(const demo3d_net* ng); +const u8* demo3d_net_entity_prev_userdata(const demo3d_net* ng, u64 entity_id); +const u8* demo3d_net_entity_userdata(const demo3d_net* ng, u64 entity_id); +const demo3d_input_msg* demo3d_net_input_at(const demo3d_net* ng, u64 tick); +u64 demo3d_net_input_oldest_tick(const demo3d_net* ng); +void demo3d_net_input_push(demo3d_net* ng, const demo3d_input_msg* input); +f32 demo3d_net_lerp_alpha(const demo3d_net* ng); +bool demo3d_net_needs_correction(const demo3d_net* ng); +u64 demo3d_net_player_id(const demo3d_net* ng); +bool demo3d_net_poll(demo3d_net* ng); +u8* demo3d_net_predicted_state(demo3d_net* ng); +void demo3d_net_predicted_tick_set(demo3d_net* ng, u64 tick); +pxl8_result demo3d_net_send_command(demo3d_net* ng, const demo3d_command_msg* cmd); +pxl8_result demo3d_net_send_input(demo3d_net* ng, const demo3d_input_msg* input); +const demo3d_snapshot_header* demo3d_net_snapshot(const demo3d_net* ng); +u64 demo3d_net_tick(const demo3d_net* ng); +void demo3d_net_update(demo3d_net* ng, f32 dt); +void demo3d_net_set_chunk_cache(demo3d_net* ng, demo3d_chunk_cache* cache); +demo3d_chunk_cache* demo3d_net_chunk_cache(demo3d_net* ng); +void demo3d_net_set_world(demo3d_net* ng, demo3d_world* world); +i32 demo3d_net_chunk_cx(const demo3d_net* ng); +i32 demo3d_net_chunk_cz(const demo3d_net* ng); +bool demo3d_net_has_chunk(const demo3d_net* ng); +pxl8_result demo3d_net_spawn(demo3d_net* ng, f32 x, f32 y, f32 z, f32 yaw, f32 pitch); + +#ifdef PXL8_ASYNC_THREADS +void demo3d_net_start_thread(demo3d_net* ng); +void demo3d_net_stop_thread(demo3d_net* ng); +bool demo3d_net_dispatch_packet(demo3d_net* ng, const pxl8_packet* pkt); +#endif diff --git a/src/net/pxl8_protocol.c b/demo3d/client/net/demo3d_protocol.c similarity index 67% rename from src/net/pxl8_protocol.c rename to demo3d/client/net/demo3d_protocol.c index 5a29fe8..40d90f9 100644 --- a/src/net/pxl8_protocol.c +++ b/demo3d/client/net/demo3d_protocol.c @@ -1,8 +1,8 @@ -#include "pxl8_protocol.h" +#include "demo3d_protocol.h" #include "pxl8_bytes.h" -usize pxl8_protocol_serialize_header(const pxl8_msg_header* msg, u8* buf, usize len) { - if (len < sizeof(pxl8_msg_header)) return 0; +usize demo3d_protocol_serialize_header(const demo3d_msg_header* msg, u8* buf, usize len) { + if (len < sizeof(demo3d_msg_header)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u32_be(&s, msg->sequence); pxl8_write_u16_be(&s, msg->size); @@ -11,8 +11,8 @@ usize pxl8_protocol_serialize_header(const pxl8_msg_header* msg, u8* buf, usize return s.offset; } -usize pxl8_protocol_deserialize_header(const u8* buf, usize len, pxl8_msg_header* msg) { - if (len < sizeof(pxl8_msg_header)) return 0; +usize demo3d_protocol_deserialize_header(const u8* buf, usize len, demo3d_msg_header* msg) { + if (len < sizeof(demo3d_msg_header)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); msg->sequence = pxl8_read_u32_be(&s); msg->size = pxl8_read_u16_be(&s); @@ -21,8 +21,8 @@ usize pxl8_protocol_deserialize_header(const u8* buf, usize len, pxl8_msg_header return s.offset; } -usize pxl8_protocol_serialize_input(const pxl8_input_msg* msg, u8* buf, usize len) { - if (len < sizeof(pxl8_input_msg)) return 0; +usize demo3d_protocol_serialize_input(const demo3d_input_msg* msg, u8* buf, usize len) { + if (len < sizeof(demo3d_input_msg)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u32_be(&s, msg->buttons); pxl8_write_f32_be(&s, msg->look_dx); @@ -35,8 +35,8 @@ usize pxl8_protocol_serialize_input(const pxl8_input_msg* msg, u8* buf, usize le return s.offset; } -usize pxl8_protocol_deserialize_input(const u8* buf, usize len, pxl8_input_msg* msg) { - if (len < sizeof(pxl8_input_msg)) return 0; +usize demo3d_protocol_deserialize_input(const u8* buf, usize len, demo3d_input_msg* msg) { + if (len < sizeof(demo3d_input_msg)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); msg->buttons = pxl8_read_u32_be(&s); msg->look_dx = pxl8_read_f32_be(&s); @@ -49,60 +49,60 @@ usize pxl8_protocol_deserialize_input(const u8* buf, usize len, pxl8_input_msg* return s.offset; } -usize pxl8_protocol_serialize_command(const pxl8_command_msg* msg, u8* buf, usize len) { - if (len < sizeof(pxl8_command_msg)) return 0; +usize demo3d_protocol_serialize_command(const demo3d_command_msg* msg, u8* buf, usize len) { + if (len < sizeof(demo3d_command_msg)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u16_be(&s, msg->cmd_type); - pxl8_write_bytes(&s, msg->payload, PXL8_COMMAND_PAYLOAD_SIZE); + pxl8_write_bytes(&s, msg->payload, DEMO3D_COMMAND_PAYLOAD_SIZE); pxl8_write_u16_be(&s, msg->payload_size); pxl8_write_u64_be(&s, msg->tick); return s.offset; } -usize pxl8_protocol_deserialize_command(const u8* buf, usize len, pxl8_command_msg* msg) { - if (len < sizeof(pxl8_command_msg)) return 0; +usize demo3d_protocol_deserialize_command(const u8* buf, usize len, demo3d_command_msg* msg) { + if (len < sizeof(demo3d_command_msg)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); msg->cmd_type = pxl8_read_u16_be(&s); - pxl8_read_bytes(&s, msg->payload, PXL8_COMMAND_PAYLOAD_SIZE); + pxl8_read_bytes(&s, msg->payload, DEMO3D_COMMAND_PAYLOAD_SIZE); msg->payload_size = pxl8_read_u16_be(&s); msg->tick = pxl8_read_u64_be(&s); return s.offset; } -usize pxl8_protocol_serialize_entity_state(const pxl8_entity_state* state, u8* buf, usize len) { - if (len < sizeof(pxl8_entity_state)) return 0; +usize demo3d_protocol_serialize_entity_state(const demo3d_entity_state* state, u8* buf, usize len) { + if (len < sizeof(demo3d_entity_state)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u64_be(&s, state->entity_id); pxl8_write_bytes(&s, state->userdata, 56); return s.offset; } -usize pxl8_protocol_deserialize_entity_state(const u8* buf, usize len, pxl8_entity_state* state) { - if (len < sizeof(pxl8_entity_state)) return 0; +usize demo3d_protocol_deserialize_entity_state(const u8* buf, usize len, demo3d_entity_state* state) { + if (len < sizeof(demo3d_entity_state)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); state->entity_id = pxl8_read_u64_be(&s); pxl8_read_bytes(&s, state->userdata, 56); return s.offset; } -usize pxl8_protocol_serialize_event(const pxl8_event_msg* msg, u8* buf, usize len) { - if (len < sizeof(pxl8_event_msg)) return 0; +usize demo3d_protocol_serialize_event(const demo3d_event_msg* msg, u8* buf, usize len) { + if (len < sizeof(demo3d_event_msg)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u8(&s, msg->event_type); - pxl8_write_bytes(&s, msg->payload, PXL8_EVENT_PAYLOAD_SIZE); + pxl8_write_bytes(&s, msg->payload, DEMO3D_EVENT_PAYLOAD_SIZE); return s.offset; } -usize pxl8_protocol_deserialize_event(const u8* buf, usize len, pxl8_event_msg* msg) { - if (len < sizeof(pxl8_event_msg)) return 0; +usize demo3d_protocol_deserialize_event(const u8* buf, usize len, demo3d_event_msg* msg) { + if (len < sizeof(demo3d_event_msg)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); msg->event_type = pxl8_read_u8(&s); - pxl8_read_bytes(&s, msg->payload, PXL8_EVENT_PAYLOAD_SIZE); + pxl8_read_bytes(&s, msg->payload, DEMO3D_EVENT_PAYLOAD_SIZE); return s.offset; } -usize pxl8_protocol_serialize_snapshot_header(const pxl8_snapshot_header* hdr, u8* buf, usize len) { - if (len < sizeof(pxl8_snapshot_header)) return 0; +usize demo3d_protocol_serialize_snapshot_header(const demo3d_snapshot_header* hdr, u8* buf, usize len) { + if (len < sizeof(demo3d_snapshot_header)) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u16_be(&s, hdr->entity_count); pxl8_write_u16_be(&s, hdr->event_count); @@ -112,8 +112,8 @@ usize pxl8_protocol_serialize_snapshot_header(const pxl8_snapshot_header* hdr, u return s.offset; } -usize pxl8_protocol_deserialize_snapshot_header(const u8* buf, usize len, pxl8_snapshot_header* hdr) { - if (len < sizeof(pxl8_snapshot_header)) return 0; +usize demo3d_protocol_deserialize_snapshot_header(const u8* buf, usize len, demo3d_snapshot_header* hdr) { + if (len < sizeof(demo3d_snapshot_header)) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); hdr->entity_count = pxl8_read_u16_be(&s); hdr->event_count = pxl8_read_u16_be(&s); @@ -123,7 +123,7 @@ usize pxl8_protocol_deserialize_snapshot_header(const u8* buf, usize len, pxl8_s return s.offset; } -usize pxl8_protocol_serialize_chunk_msg_header(const pxl8_chunk_msg_header* hdr, u8* buf, usize len) { +usize demo3d_protocol_serialize_chunk_msg_header(const demo3d_chunk_msg_header* hdr, u8* buf, usize len) { if (len < 24) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u8(&s, hdr->chunk_type); @@ -140,7 +140,7 @@ usize pxl8_protocol_serialize_chunk_msg_header(const pxl8_chunk_msg_header* hdr, return s.offset; } -usize pxl8_protocol_deserialize_chunk_msg_header(const u8* buf, usize len, pxl8_chunk_msg_header* hdr) { +usize demo3d_protocol_deserialize_chunk_msg_header(const u8* buf, usize len, demo3d_chunk_msg_header* hdr) { if (len < 24) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); hdr->chunk_type = pxl8_read_u8(&s); @@ -157,7 +157,7 @@ usize pxl8_protocol_deserialize_chunk_msg_header(const u8* buf, usize len, pxl8_ return s.offset; } -usize pxl8_protocol_deserialize_bsp_wire_header(const u8* buf, usize len, pxl8_bsp_wire_header* hdr) { +usize demo3d_protocol_deserialize_bsp_wire_header(const u8* buf, usize len, demo3d_bsp_wire_header* hdr) { if (len < 48) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); hdr->num_vertices = pxl8_read_u32_be(&s); @@ -175,7 +175,7 @@ usize pxl8_protocol_deserialize_bsp_wire_header(const u8* buf, usize len, pxl8_b return s.offset; } -usize pxl8_protocol_serialize_chunk_enter(const pxl8_chunk_enter_msg* msg, u8* buf, usize len) { +usize demo3d_protocol_serialize_chunk_enter(const demo3d_chunk_enter_msg* msg, u8* buf, usize len) { if (len < 8) return 0; pxl8_write_stream s = pxl8_write_stream_create(buf, (u32)len); pxl8_write_u32_be(&s, (u32)msg->cx); @@ -183,7 +183,7 @@ usize pxl8_protocol_serialize_chunk_enter(const pxl8_chunk_enter_msg* msg, u8* b return s.offset; } -usize pxl8_protocol_deserialize_chunk_enter(const u8* buf, usize len, pxl8_chunk_enter_msg* msg) { +usize demo3d_protocol_deserialize_chunk_enter(const u8* buf, usize len, demo3d_chunk_enter_msg* msg) { if (len < 8) return 0; pxl8_stream s = pxl8_stream_create(buf, (u32)len); msg->cx = (i32)pxl8_read_u32_be(&s); @@ -191,7 +191,7 @@ usize pxl8_protocol_deserialize_chunk_enter(const u8* buf, usize len, pxl8_chunk return s.offset; } -u32 pxl8_chunk_hash(i32 cx, i32 cz) { +u32 demo3d_chunk_hash(i32 cx, i32 cz) { u32 h = (u32)cx * 374761393u + (u32)cz * 668265263u; return h ^ (h >> 16); } diff --git a/demo3d/client/net/demo3d_protocol.h b/demo3d/client/net/demo3d_protocol.h new file mode 100644 index 0000000..66a1779 --- /dev/null +++ b/demo3d/client/net/demo3d_protocol.h @@ -0,0 +1,143 @@ +#pragma once + +#include "pxl8_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEMO3D_PROTOCOL_VERSION 1 +#define DEMO3D_MAX_SNAPSHOT_ENTITIES 256 +#define DEMO3D_MAX_SNAPSHOT_EVENTS 32 +#define DEMO3D_COMMAND_PAYLOAD_SIZE 64 +#define DEMO3D_EVENT_PAYLOAD_SIZE 15 + +typedef enum demo3d_msg_type { + DEMO3D_MSG_NONE = 0, + DEMO3D_MSG_CHUNK, + DEMO3D_MSG_CHUNK_ENTER, + DEMO3D_MSG_CHUNK_EXIT, + DEMO3D_MSG_COMMAND, + DEMO3D_MSG_CONNECT, + DEMO3D_MSG_DISCONNECT, + DEMO3D_MSG_EVENT, + DEMO3D_MSG_INPUT, + DEMO3D_MSG_SNAPSHOT +} demo3d_msg_type; + +typedef struct demo3d_msg_header { + u32 sequence; + u16 size; + u8 type; + u8 version; +} demo3d_msg_header; + +typedef enum demo3d_cmd_type { + DEMO3D_CMD_NONE = 0, + DEMO3D_CMD_SPAWN_ENTITY, +} demo3d_cmd_type; + +typedef struct demo3d_input_msg { + u32 buttons; + f32 look_dx; + f32 look_dy; + f32 move_x; + f32 move_y; + f32 yaw; + u64 tick; + u64 timestamp; +} demo3d_input_msg; + +typedef struct demo3d_command_msg { + u16 cmd_type; + u8 payload[DEMO3D_COMMAND_PAYLOAD_SIZE]; + u16 payload_size; + u64 tick; +} demo3d_command_msg; + +typedef struct demo3d_entity_state { + u64 entity_id; + u8 userdata[56]; +} demo3d_entity_state; + +typedef struct demo3d_event_msg { + u8 event_type; + u8 payload[DEMO3D_EVENT_PAYLOAD_SIZE]; +} demo3d_event_msg; + +typedef struct demo3d_snapshot_header { + u16 entity_count; + u16 event_count; + u64 player_id; + u64 tick; + f32 time; +} demo3d_snapshot_header; + +#define DEMO3D_CHUNK_TYPE_BSP 1 + +#define DEMO3D_CHUNK_FLAG_FINAL 0x04 +#define DEMO3D_CHUNK_MAX_PAYLOAD 1400 + +typedef struct demo3d_chunk_msg_header { + u8 chunk_type; + u8 flags; + u8 fragment_idx; + u8 fragment_count; + u32 id; + i32 cx, cy, cz; + u32 version; + u16 payload_size; + u16 reserved; +} demo3d_chunk_msg_header; + +typedef struct demo3d_bsp_wire_header { + u32 num_vertices; + u32 num_edges; + u32 num_faces; + u32 num_planes; + u32 num_nodes; + u32 num_leafs; + u32 num_surfedges; + u32 num_marksurfaces; + u32 num_cell_portals; + u32 visdata_size; + u32 num_vertex_lights; + u32 num_heightfield; +} demo3d_bsp_wire_header; + +usize demo3d_protocol_serialize_header(const demo3d_msg_header* msg, u8* buf, usize len); +usize demo3d_protocol_deserialize_header(const u8* buf, usize len, demo3d_msg_header* msg); + +usize demo3d_protocol_serialize_input(const demo3d_input_msg* msg, u8* buf, usize len); +usize demo3d_protocol_deserialize_input(const u8* buf, usize len, demo3d_input_msg* msg); + +usize demo3d_protocol_serialize_command(const demo3d_command_msg* msg, u8* buf, usize len); +usize demo3d_protocol_deserialize_command(const u8* buf, usize len, demo3d_command_msg* msg); + +usize demo3d_protocol_serialize_entity_state(const demo3d_entity_state* state, u8* buf, usize len); +usize demo3d_protocol_deserialize_entity_state(const u8* buf, usize len, demo3d_entity_state* state); + +usize demo3d_protocol_serialize_event(const demo3d_event_msg* msg, u8* buf, usize len); +usize demo3d_protocol_deserialize_event(const u8* buf, usize len, demo3d_event_msg* msg); + +usize demo3d_protocol_serialize_snapshot_header(const demo3d_snapshot_header* hdr, u8* buf, usize len); +usize demo3d_protocol_deserialize_snapshot_header(const u8* buf, usize len, demo3d_snapshot_header* hdr); + +usize demo3d_protocol_serialize_chunk_msg_header(const demo3d_chunk_msg_header* hdr, u8* buf, usize len); +usize demo3d_protocol_deserialize_chunk_msg_header(const u8* buf, usize len, demo3d_chunk_msg_header* hdr); + +usize demo3d_protocol_deserialize_bsp_wire_header(const u8* buf, usize len, demo3d_bsp_wire_header* hdr); + +typedef struct demo3d_chunk_enter_msg { + i32 cx; + i32 cz; +} demo3d_chunk_enter_msg; + +usize demo3d_protocol_serialize_chunk_enter(const demo3d_chunk_enter_msg* msg, u8* buf, usize len); +usize demo3d_protocol_deserialize_chunk_enter(const u8* buf, usize len, demo3d_chunk_enter_msg* msg); + +u32 demo3d_chunk_hash(i32 cx, i32 cz); + +#ifdef __cplusplus +} +#endif diff --git a/src/sim/pxl8_sim.c b/demo3d/client/sim/demo3d_sim.c similarity index 80% rename from src/sim/pxl8_sim.c rename to demo3d/client/sim/demo3d_sim.c index ff19667..482924b 100644 --- a/src/sim/pxl8_sim.c +++ b/demo3d/client/sim/demo3d_sim.c @@ -1,4 +1,4 @@ -#include "pxl8_sim.h" +#include "demo3d_sim.h" #include @@ -11,13 +11,13 @@ typedef struct { bool start_solid; } trace_result; -static i32 bsp_find_leaf(const pxl8_bsp* bsp, pxl8_vec3 pos) { +static i32 bsp_find_leaf(const demo3d_bsp* bsp, pxl8_vec3 pos) { if (!bsp || bsp->num_nodes == 0) return -1; i32 node_id = 0; while (node_id >= 0) { - const pxl8_bsp_node* node = &bsp->nodes[node_id]; - const pxl8_bsp_plane* plane = &bsp->planes[node->plane_id]; + const demo3d_bsp_node* node = &bsp->nodes[node_id]; + const demo3d_bsp_plane* plane = &bsp->planes[node->plane_id]; f32 dist = pxl8_vec3_dot(pos, plane->normal) - plane->dist; node_id = node->children[dist < 0 ? 1 : 0]; } @@ -25,10 +25,10 @@ static i32 bsp_find_leaf(const pxl8_bsp* bsp, pxl8_vec3 pos) { return -(node_id + 1); } -static i32 bsp_contents_from(const pxl8_bsp* bsp, i32 node_id, pxl8_vec3 pos) { +static i32 bsp_contents_from(const demo3d_bsp* bsp, i32 node_id, pxl8_vec3 pos) { while (node_id >= 0) { - const pxl8_bsp_node* node = &bsp->nodes[node_id]; - const pxl8_bsp_plane* plane = &bsp->planes[node->plane_id]; + const demo3d_bsp_node* node = &bsp->nodes[node_id]; + const demo3d_bsp_plane* plane = &bsp->planes[node->plane_id]; f32 d = pxl8_vec3_dot(pos, plane->normal) - plane->dist; node_id = node->children[d < 0 ? 1 : 0]; } @@ -37,7 +37,7 @@ static i32 bsp_contents_from(const pxl8_bsp* bsp, i32 node_id, pxl8_vec3 pos) { return bsp->leafs[leaf_idx].contents; } -static bool bsp_recursive_trace(const pxl8_bsp* bsp, i32 node_id, +static bool bsp_recursive_trace(const demo3d_bsp* bsp, i32 node_id, f32 p1f, f32 p2f, pxl8_vec3 p1, pxl8_vec3 p2, trace_result* tr) { @@ -52,8 +52,8 @@ static bool bsp_recursive_trace(const pxl8_bsp* bsp, i32 node_id, return true; } - const pxl8_bsp_node* node = &bsp->nodes[node_id]; - const pxl8_bsp_plane* plane = &bsp->planes[node->plane_id]; + const demo3d_bsp_node* node = &bsp->nodes[node_id]; + const demo3d_bsp_plane* plane = &bsp->planes[node->plane_id]; f32 t1 = pxl8_vec3_dot(p1, plane->normal) - plane->dist; f32 t2 = pxl8_vec3_dot(p2, plane->normal) - plane->dist; @@ -104,7 +104,7 @@ static bool bsp_recursive_trace(const pxl8_bsp* bsp, i32 node_id, return false; } -static trace_result bsp_trace_line(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to) { +static trace_result bsp_trace_line(const demo3d_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to) { trace_result tr = { .fraction = 1.0f, .all_solid = true }; if (!bsp || bsp->num_nodes == 0) { tr.all_solid = false; @@ -118,7 +118,7 @@ static trace_result bsp_trace_line(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec return tr; } -bool pxl8_bsp_point_solid(const pxl8_bsp* bsp, pxl8_vec3 pos) { +bool demo3d_bsp_point_solid(const demo3d_bsp* bsp, pxl8_vec3 pos) { if (!bsp) return false; if (bsp->bounds_max_x > bsp->bounds_min_x && (pos.x < bsp->bounds_min_x || pos.x >= bsp->bounds_max_x || @@ -129,7 +129,7 @@ bool pxl8_bsp_point_solid(const pxl8_bsp* bsp, pxl8_vec3 pos) { return bsp->leafs[leaf].contents == -1; } -static void trace_offsets(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, +static void trace_offsets(const demo3d_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32* out_frac, pxl8_vec3* out_normal) { f32 d = radius * 0.7071f; pxl8_vec3 offsets[9] = { @@ -154,7 +154,7 @@ static void trace_offsets(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, } } -pxl8_vec3 pxl8_bsp_trace(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius) { +pxl8_vec3 demo3d_bsp_trace(const demo3d_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius) { if (!bsp || bsp->num_nodes == 0) return to; f32 frac; @@ -196,7 +196,7 @@ pxl8_vec3 pxl8_bsp_trace(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 }; } -static const pxl8_bsp* sim_bsp_at(const pxl8_sim_world* world, f32 x, f32 z) { +static const demo3d_bsp* sim_bsp_at(const demo3d_sim_world* world, f32 x, f32 z) { i32 cx = (i32)floorf(x / world->chunk_size); i32 cz = (i32)floorf(z / world->chunk_size); i32 dx = cx - world->center_cx + 1; @@ -205,7 +205,7 @@ static const pxl8_bsp* sim_bsp_at(const pxl8_sim_world* world, f32 x, f32 z) { return world->chunks[dz * 3 + dx]; } -static f32 bsp_terrain_height(const pxl8_bsp* bsp, f32 x, f32 z) { +static f32 bsp_terrain_height(const demo3d_bsp* bsp, f32 x, f32 z) { if (!bsp || !bsp->heightfield || bsp->heightfield_cell_size <= 0) return -1e9f; f32 lx = (x - bsp->heightfield_ox) / bsp->heightfield_cell_size; f32 lz = (z - bsp->heightfield_oz) / bsp->heightfield_cell_size; @@ -224,12 +224,12 @@ static f32 bsp_terrain_height(const pxl8_bsp* bsp, f32 x, f32 z) { return h0 + (h1 - h0) * fz; } -static f32 sim_terrain_height(const pxl8_sim_world* world, f32 x, f32 z) { - const pxl8_bsp* bsp = sim_bsp_at(world, x, z); +static f32 sim_terrain_height(const demo3d_sim_world* world, f32 x, f32 z) { + const demo3d_bsp* bsp = sim_bsp_at(world, x, z); return bsp_terrain_height(bsp, x, z); } -static void sim_trace_offsets(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, +static void sim_trace_offsets(const demo3d_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32* out_frac, pxl8_vec3* out_normal) { f32 d = radius * 0.7071f; pxl8_vec3 offsets[9] = { @@ -246,8 +246,8 @@ static void sim_trace_offsets(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_ for (i32 i = 0; i < 9; i++) { pxl8_vec3 s = { from.x + offsets[i].x, from.y + offsets[i].y, from.z + offsets[i].z }; pxl8_vec3 e = { to.x + offsets[i].x, to.y + offsets[i].y, to.z + offsets[i].z }; - const pxl8_bsp* bsp_s = sim_bsp_at(world, s.x, s.z); - const pxl8_bsp* bsp_e = sim_bsp_at(world, e.x, e.z); + const demo3d_bsp* bsp_s = sim_bsp_at(world, s.x, s.z); + const demo3d_bsp* bsp_e = sim_bsp_at(world, e.x, e.z); if (bsp_s) { trace_result tr = bsp_trace_line(bsp_s, s, e); if (tr.fraction < *out_frac && !tr.start_solid) { @@ -270,7 +270,7 @@ static void sim_trace_offsets(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_ } } -pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height) { +pxl8_vec3 demo3d_sim_trace(const demo3d_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height) { (void)height; if (!world || world->chunk_size <= 0) return to; @@ -313,22 +313,22 @@ pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 }; } -bool pxl8_sim_check_ground(const pxl8_sim_world* world, pxl8_vec3 pos, f32 radius) { +bool demo3d_sim_check_ground(const demo3d_sim_world* world, pxl8_vec3 pos, f32 radius) { if (!world || world->chunk_size <= 0) return true; f32 th = sim_terrain_height(world, pos.x, pos.z); if (th > -1e8f && pos.y - th < 2.0f) return true; pxl8_vec3 down = {pos.x, pos.y - 2.0f, pos.z}; - pxl8_vec3 result = pxl8_sim_trace(world, pos, down, radius, 0.0f); + pxl8_vec3 result = demo3d_sim_trace(world, pos, down, radius, 0.0f); return result.y > down.y; } -void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, - const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt) { +void demo3d_sim_move_player(demo3d_sim_entity* ent, const demo3d_input_msg* input, + const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt) { if (!ent || !input || !cfg) return; - if (!(ent->flags & PXL8_SIM_FLAG_ALIVE)) return; + if (!(ent->flags & DEMO3D_SIM_FLAG_ALIVE)) return; ent->yaw -= input->look_dx * 0.008f; f32 new_pitch = ent->pitch - input->look_dy * 0.008f; @@ -355,11 +355,11 @@ void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, ent->vel.x = move_dir.x * target_speed; ent->vel.z = move_dir.z * target_speed; - bool grounded = (ent->flags & PXL8_SIM_FLAG_GROUNDED) != 0; + bool grounded = (ent->flags & DEMO3D_SIM_FLAG_GROUNDED) != 0; if (grounded && (input->buttons & 1)) { ent->vel.y = cfg->jump_velocity; - ent->flags &= ~PXL8_SIM_FLAG_GROUNDED; + ent->flags &= ~DEMO3D_SIM_FLAG_GROUNDED; grounded = false; } @@ -378,7 +378,7 @@ void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, if (th_dest > -1e8f) target.y = th_dest; } - pxl8_vec3 new_pos = pxl8_sim_trace(world, ent->pos, target, cfg->player_radius, cfg->player_height); + pxl8_vec3 new_pos = demo3d_sim_trace(world, ent->pos, target, cfg->player_radius, cfg->player_height); f32 th = sim_terrain_height(world, new_pos.x, new_pos.z); if (th > -1e8f && new_pos.y < th) { @@ -388,21 +388,21 @@ void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, ent->pos = new_pos; - if (pxl8_sim_check_ground(world, ent->pos, cfg->player_radius)) { - ent->flags |= PXL8_SIM_FLAG_GROUNDED; + if (demo3d_sim_check_ground(world, ent->pos, cfg->player_radius)) { + ent->flags |= DEMO3D_SIM_FLAG_GROUNDED; if (ent->vel.y < 0) ent->vel.y = 0; } else { - ent->flags &= ~PXL8_SIM_FLAG_GROUNDED; + ent->flags &= ~DEMO3D_SIM_FLAG_GROUNDED; } } -void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, - const pxl8_sim_config* cfg, f32 dt) { +void demo3d_sim_integrate(demo3d_sim_entity* ent, const demo3d_sim_world* world, + const demo3d_sim_config* cfg, f32 dt) { if (!ent || !cfg) return; - if (!(ent->flags & PXL8_SIM_FLAG_ALIVE)) return; - if (ent->flags & PXL8_SIM_FLAG_PLAYER) return; + if (!(ent->flags & DEMO3D_SIM_FLAG_ALIVE)) return; + if (ent->flags & DEMO3D_SIM_FLAG_PLAYER) return; - bool grounded = (ent->flags & PXL8_SIM_FLAG_GROUNDED) != 0; + bool grounded = (ent->flags & DEMO3D_SIM_FLAG_GROUNDED) != 0; ent->vel.y -= cfg->gravity * dt; @@ -429,7 +429,7 @@ void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, if (th_dest > -1e8f) target.y = th_dest; } - pxl8_vec3 new_pos = pxl8_sim_trace(world, ent->pos, target, cfg->player_radius, cfg->player_height); + pxl8_vec3 new_pos = demo3d_sim_trace(world, ent->pos, target, cfg->player_radius, cfg->player_height); f32 th2 = sim_terrain_height(world, new_pos.x, new_pos.z); if (th2 > -1e8f && new_pos.y < th2) { @@ -439,10 +439,10 @@ void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, ent->pos = new_pos; - if (pxl8_sim_check_ground(world, ent->pos, cfg->player_radius)) { - ent->flags |= PXL8_SIM_FLAG_GROUNDED; + if (demo3d_sim_check_ground(world, ent->pos, cfg->player_radius)) { + ent->flags |= DEMO3D_SIM_FLAG_GROUNDED; if (ent->vel.y < 0.0f) ent->vel.y = 0.0f; } else { - ent->flags &= ~PXL8_SIM_FLAG_GROUNDED; + ent->flags &= ~DEMO3D_SIM_FLAG_GROUNDED; } } diff --git a/demo3d/client/sim/demo3d_sim.h b/demo3d/client/sim/demo3d_sim.h new file mode 100644 index 0000000..bd1236c --- /dev/null +++ b/demo3d/client/sim/demo3d_sim.h @@ -0,0 +1,56 @@ +#pragma once + +#include "demo3d_bsp.h" +#include "pxl8_math.h" +#include "demo3d_protocol.h" +#include "pxl8_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEMO3D_SIM_FLAG_ALIVE (1 << 0) +#define DEMO3D_SIM_FLAG_PLAYER (1 << 1) +#define DEMO3D_SIM_FLAG_GROUNDED (1 << 2) + +typedef struct demo3d_sim_config { + f32 move_speed; + f32 ground_accel; + f32 air_accel; + f32 stop_speed; + f32 friction; + f32 gravity; + f32 jump_velocity; + f32 player_radius; + f32 player_height; + f32 max_pitch; +} demo3d_sim_config; + +typedef struct demo3d_sim_entity { + pxl8_vec3 pos; + pxl8_vec3 vel; + f32 yaw; + f32 pitch; + u32 flags; + u16 kind; + u16 _pad; +} demo3d_sim_entity; + +typedef struct demo3d_sim_world { + const demo3d_bsp* chunks[9]; + i32 center_cx; + i32 center_cz; + f32 chunk_size; +} demo3d_sim_world; + +bool demo3d_bsp_point_solid(const demo3d_bsp* bsp, pxl8_vec3 pos); +pxl8_vec3 demo3d_bsp_trace(const demo3d_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius); + +pxl8_vec3 demo3d_sim_trace(const demo3d_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height); +bool demo3d_sim_check_ground(const demo3d_sim_world* world, pxl8_vec3 pos, f32 radius); +void demo3d_sim_move_player(demo3d_sim_entity* ent, const demo3d_input_msg* input, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt); +void demo3d_sim_integrate(demo3d_sim_entity* ent, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt); + +#ifdef __cplusplus +} +#endif diff --git a/demo3d/client/world/demo3d_chunk.c b/demo3d/client/world/demo3d_chunk.c new file mode 100644 index 0000000..d48f134 --- /dev/null +++ b/demo3d/client/world/demo3d_chunk.c @@ -0,0 +1,17 @@ +#include "demo3d_chunk.h" + +#include "demo3d_bsp.h" +#include "pxl8_mem.h" + +demo3d_chunk* demo3d_chunk_create_bsp(u32 id) { + demo3d_chunk* chunk = pxl8_calloc(1, sizeof(demo3d_chunk)); + if (!chunk) return NULL; + chunk->id = id; + return chunk; +} + +void demo3d_chunk_destroy(demo3d_chunk* chunk) { + if (!chunk) return; + if (chunk->bsp) demo3d_bsp_destroy(chunk->bsp); + pxl8_free(chunk); +} diff --git a/demo3d/client/world/demo3d_chunk.h b/demo3d/client/world/demo3d_chunk.h new file mode 100644 index 0000000..c23d542 --- /dev/null +++ b/demo3d/client/world/demo3d_chunk.h @@ -0,0 +1,21 @@ +#pragma once + +#include "demo3d_bsp.h" +#include "pxl8_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct demo3d_chunk { + u32 id; + u32 version; + demo3d_bsp* bsp; +} demo3d_chunk; + +demo3d_chunk* demo3d_chunk_create_bsp(u32 id); +void demo3d_chunk_destroy(demo3d_chunk* chunk); + +#ifdef __cplusplus +} +#endif diff --git a/src/world/pxl8_world_chunk_cache.c b/demo3d/client/world/demo3d_chunk_cache.c similarity index 73% rename from src/world/pxl8_world_chunk_cache.c rename to demo3d/client/world/demo3d_chunk_cache.c index 063dcd9..749e9c5 100644 --- a/src/world/pxl8_world_chunk_cache.c +++ b/demo3d/client/world/demo3d_chunk_cache.c @@ -1,4 +1,4 @@ -#include "pxl8_world_chunk_cache.h" +#include "demo3d_chunk_cache.h" #include #include @@ -7,9 +7,9 @@ #include "pxl8_log.h" #include "pxl8_mem.h" -static pxl8_world_chunk_cache_entry* find_entry_bsp(pxl8_world_chunk_cache* cache, u32 id) { +static demo3d_chunk_cache_entry* find_entry_bsp(demo3d_chunk_cache* cache, u32 id) { for (u32 i = 0; i < cache->entry_count; i++) { - pxl8_world_chunk_cache_entry* e = &cache->entries[i]; + demo3d_chunk_cache_entry* e = &cache->entries[i]; if (e->valid && e->chunk && e->chunk->id == id) { return e; } @@ -17,16 +17,16 @@ static pxl8_world_chunk_cache_entry* find_entry_bsp(pxl8_world_chunk_cache* cach return NULL; } -static pxl8_world_chunk_cache_entry* alloc_entry(pxl8_world_chunk_cache* cache) { - if (cache->entry_count < PXL8_WORLD_CHUNK_CACHE_SIZE) { - pxl8_world_chunk_cache_entry* e = &cache->entries[cache->entry_count++]; +static demo3d_chunk_cache_entry* alloc_entry(demo3d_chunk_cache* cache) { + if (cache->entry_count < DEMO3D_CHUNK_CACHE_SIZE) { + demo3d_chunk_cache_entry* e = &cache->entries[cache->entry_count++]; memset(e, 0, sizeof(*e)); return e; } - for (u32 i = 0; i < PXL8_WORLD_CHUNK_CACHE_SIZE; i++) { + for (u32 i = 0; i < DEMO3D_CHUNK_CACHE_SIZE; i++) { if (!cache->entries[i].valid) { - pxl8_world_chunk_cache_entry* e = &cache->entries[i]; + demo3d_chunk_cache_entry* e = &cache->entries[i]; memset(e, 0, sizeof(*e)); return e; } @@ -34,22 +34,22 @@ static pxl8_world_chunk_cache_entry* alloc_entry(pxl8_world_chunk_cache* cache) u64 oldest = cache->entries[0].last_used; u32 slot = 0; - for (u32 i = 1; i < PXL8_WORLD_CHUNK_CACHE_SIZE; i++) { + for (u32 i = 1; i < DEMO3D_CHUNK_CACHE_SIZE; i++) { if (cache->entries[i].last_used < oldest) { oldest = cache->entries[i].last_used; slot = i; } } - pxl8_world_chunk_cache_entry* e = &cache->entries[slot]; + demo3d_chunk_cache_entry* e = &cache->entries[slot]; if (e->chunk) { - pxl8_world_chunk_destroy(e->chunk); + demo3d_chunk_destroy(e->chunk); } memset(e, 0, sizeof(*e)); return e; } -static void assembly_reset(pxl8_world_chunk_assembly* a) { +static void assembly_reset(demo3d_chunk_assembly* a) { a->id = 0; a->cx = 0; a->cy = 0; @@ -62,7 +62,7 @@ static void assembly_reset(pxl8_world_chunk_assembly* a) { a->complete = false; } -static void assembly_init(pxl8_world_chunk_assembly* a, const pxl8_chunk_msg_header* hdr) { +static void assembly_init(demo3d_chunk_assembly* a, const demo3d_chunk_msg_header* hdr) { assembly_reset(a); a->id = hdr->id; a->cx = hdr->cx; @@ -72,27 +72,27 @@ static void assembly_init(pxl8_world_chunk_assembly* a, const pxl8_chunk_msg_hea a->fragment_count = hdr->fragment_count; a->active = true; - u32 needed = PXL8_CHUNK_MAX_PAYLOAD * hdr->fragment_count; + u32 needed = DEMO3D_CHUNK_MAX_PAYLOAD * hdr->fragment_count; if (a->data_capacity < needed) { a->data_capacity = needed; a->data = pxl8_realloc(a->data, a->data_capacity); } } -static pxl8_result deserialize_vertex(pxl8_stream* s, pxl8_bsp_vertex* v) { +static pxl8_result deserialize_vertex(pxl8_stream* s, demo3d_bsp_vertex* v) { v->position.x = pxl8_read_f32_be(s); v->position.y = pxl8_read_f32_be(s); v->position.z = pxl8_read_f32_be(s); return PXL8_OK; } -static pxl8_result deserialize_edge(pxl8_stream* s, pxl8_bsp_edge* e) { +static pxl8_result deserialize_edge(pxl8_stream* s, demo3d_bsp_edge* e) { e->vertex[0] = pxl8_read_u16_be(s); e->vertex[1] = pxl8_read_u16_be(s); return PXL8_OK; } -static pxl8_result deserialize_plane(pxl8_stream* s, pxl8_bsp_plane* p) { +static pxl8_result deserialize_plane(pxl8_stream* s, demo3d_bsp_plane* p) { p->normal.x = pxl8_read_f32_be(s); p->normal.y = pxl8_read_f32_be(s); p->normal.z = pxl8_read_f32_be(s); @@ -101,7 +101,7 @@ static pxl8_result deserialize_plane(pxl8_stream* s, pxl8_bsp_plane* p) { return PXL8_OK; } -static pxl8_result deserialize_face(pxl8_stream* s, pxl8_bsp_face* f) { +static pxl8_result deserialize_face(pxl8_stream* s, demo3d_bsp_face* f) { f->first_edge = pxl8_read_u32_be(s); f->lightmap_offset = pxl8_read_u32_be(s); f->num_edges = pxl8_read_u16_be(s); @@ -118,7 +118,7 @@ static pxl8_result deserialize_face(pxl8_stream* s, pxl8_bsp_face* f) { return PXL8_OK; } -static pxl8_result deserialize_node(pxl8_stream* s, pxl8_bsp_node* n) { +static pxl8_result deserialize_node(pxl8_stream* s, demo3d_bsp_node* n) { n->children[0] = (i32)pxl8_read_u32_be(s); n->children[1] = (i32)pxl8_read_u32_be(s); n->first_face = pxl8_read_u16_be(s); @@ -133,7 +133,7 @@ static pxl8_result deserialize_node(pxl8_stream* s, pxl8_bsp_node* n) { return PXL8_OK; } -static pxl8_result deserialize_leaf(pxl8_stream* s, pxl8_bsp_leaf* l) { +static pxl8_result deserialize_leaf(pxl8_stream* s, demo3d_bsp_leaf* l) { pxl8_read_bytes(s, l->ambient_level, 4); l->contents = (i32)pxl8_read_u32_be(s); l->first_marksurface = pxl8_read_u16_be(s); @@ -148,7 +148,7 @@ static pxl8_result deserialize_leaf(pxl8_stream* s, pxl8_bsp_leaf* l) { return PXL8_OK; } -static pxl8_result deserialize_portal(pxl8_stream* s, pxl8_bsp_portal* p) { +static pxl8_result deserialize_portal(pxl8_stream* s, demo3d_bsp_portal* p) { p->x0 = pxl8_read_f32_be(s); p->z0 = pxl8_read_f32_be(s); p->x1 = pxl8_read_f32_be(s); @@ -157,7 +157,7 @@ static pxl8_result deserialize_portal(pxl8_stream* s, pxl8_bsp_portal* p) { return PXL8_OK; } -static pxl8_result deserialize_cell_portals(pxl8_stream* s, pxl8_bsp_cell_portals* cp) { +static pxl8_result deserialize_cell_portals(pxl8_stream* s, demo3d_bsp_cell_portals* cp) { cp->num_portals = pxl8_read_u8(s); pxl8_read_u8(s); pxl8_read_u8(s); @@ -168,22 +168,22 @@ static pxl8_result deserialize_cell_portals(pxl8_stream* s, pxl8_bsp_cell_portal return PXL8_OK; } -static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { +static demo3d_bsp* assembly_to_bsp(demo3d_chunk_assembly* a) { if (!a->complete || a->data_size < 48) { return NULL; } - pxl8_bsp* bsp = pxl8_calloc(1, sizeof(pxl8_bsp)); + demo3d_bsp* bsp = pxl8_calloc(1, sizeof(demo3d_bsp)); if (!bsp) return NULL; pxl8_stream s = pxl8_stream_create(a->data, (u32)a->data_size); - pxl8_bsp_wire_header wire_hdr; - pxl8_protocol_deserialize_bsp_wire_header(a->data, 48, &wire_hdr); + demo3d_bsp_wire_header wire_hdr; + demo3d_protocol_deserialize_bsp_wire_header(a->data, 48, &wire_hdr); s.offset = 48; if (wire_hdr.num_vertices > 0) { - bsp->vertices = pxl8_calloc(wire_hdr.num_vertices, sizeof(pxl8_bsp_vertex)); + bsp->vertices = pxl8_calloc(wire_hdr.num_vertices, sizeof(demo3d_bsp_vertex)); bsp->num_vertices = wire_hdr.num_vertices; for (u32 i = 0; i < wire_hdr.num_vertices; i++) { deserialize_vertex(&s, &bsp->vertices[i]); @@ -191,7 +191,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_edges > 0) { - bsp->edges = pxl8_calloc(wire_hdr.num_edges, sizeof(pxl8_bsp_edge)); + bsp->edges = pxl8_calloc(wire_hdr.num_edges, sizeof(demo3d_bsp_edge)); bsp->num_edges = wire_hdr.num_edges; for (u32 i = 0; i < wire_hdr.num_edges; i++) { deserialize_edge(&s, &bsp->edges[i]); @@ -207,7 +207,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_planes > 0) { - bsp->planes = pxl8_calloc(wire_hdr.num_planes, sizeof(pxl8_bsp_plane)); + bsp->planes = pxl8_calloc(wire_hdr.num_planes, sizeof(demo3d_bsp_plane)); bsp->num_planes = wire_hdr.num_planes; for (u32 i = 0; i < wire_hdr.num_planes; i++) { deserialize_plane(&s, &bsp->planes[i]); @@ -215,7 +215,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_faces > 0) { - bsp->faces = pxl8_calloc(wire_hdr.num_faces, sizeof(pxl8_bsp_face)); + bsp->faces = pxl8_calloc(wire_hdr.num_faces, sizeof(demo3d_bsp_face)); bsp->num_faces = wire_hdr.num_faces; for (u32 i = 0; i < wire_hdr.num_faces; i++) { deserialize_face(&s, &bsp->faces[i]); @@ -223,7 +223,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_nodes > 0) { - bsp->nodes = pxl8_calloc(wire_hdr.num_nodes, sizeof(pxl8_bsp_node)); + bsp->nodes = pxl8_calloc(wire_hdr.num_nodes, sizeof(demo3d_bsp_node)); bsp->num_nodes = wire_hdr.num_nodes; for (u32 i = 0; i < wire_hdr.num_nodes; i++) { deserialize_node(&s, &bsp->nodes[i]); @@ -231,7 +231,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_leafs > 0) { - bsp->leafs = pxl8_calloc(wire_hdr.num_leafs, sizeof(pxl8_bsp_leaf)); + bsp->leafs = pxl8_calloc(wire_hdr.num_leafs, sizeof(demo3d_bsp_leaf)); bsp->num_leafs = wire_hdr.num_leafs; for (u32 i = 0; i < wire_hdr.num_leafs; i++) { deserialize_leaf(&s, &bsp->leafs[i]); @@ -247,7 +247,7 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { } if (wire_hdr.num_cell_portals > 0) { - bsp->cell_portals = pxl8_calloc(wire_hdr.num_cell_portals, sizeof(pxl8_bsp_cell_portals)); + bsp->cell_portals = pxl8_calloc(wire_hdr.num_cell_portals, sizeof(demo3d_bsp_cell_portals)); bsp->num_cell_portals = wire_hdr.num_cell_portals; for (u32 i = 0; i < wire_hdr.num_cell_portals; i++) { deserialize_cell_portals(&s, &bsp->cell_portals[i]); @@ -298,21 +298,21 @@ static pxl8_bsp* assembly_to_bsp(pxl8_world_chunk_assembly* a) { return bsp; } -static pxl8_result assemble_bsp(pxl8_world_chunk_cache* cache, pxl8_world_chunk_assembly* a) { - pxl8_bsp* bsp = assembly_to_bsp(a); +static pxl8_result assemble_bsp(demo3d_chunk_cache* cache, demo3d_chunk_assembly* a) { + demo3d_bsp* bsp = assembly_to_bsp(a); if (!bsp) { assembly_reset(a); return PXL8_ERROR_INVALID_ARGUMENT; } - pxl8_world_chunk_cache_entry* entry = find_entry_bsp(cache, a->id); + demo3d_chunk_cache_entry* entry = find_entry_bsp(cache, a->id); if (entry) { if (entry->chunk && entry->chunk->bsp) { - pxl8_bsp_destroy(entry->chunk->bsp); + demo3d_bsp_destroy(entry->chunk->bsp); } } else { entry = alloc_entry(cache); - entry->chunk = pxl8_world_chunk_create_bsp(a->id); + entry->chunk = demo3d_chunk_create_bsp(a->id); entry->valid = true; } @@ -324,31 +324,31 @@ static pxl8_result assemble_bsp(pxl8_world_chunk_cache* cache, pxl8_world_chunk_ return PXL8_OK; } -pxl8_world_chunk_cache* pxl8_world_chunk_cache_create(void) { - pxl8_world_chunk_cache* cache = pxl8_calloc(1, sizeof(pxl8_world_chunk_cache)); +demo3d_chunk_cache* demo3d_chunk_cache_create(void) { + demo3d_chunk_cache* cache = pxl8_calloc(1, sizeof(demo3d_chunk_cache)); if (!cache) return NULL; assembly_reset(&cache->assembly); return cache; } -void pxl8_world_chunk_cache_destroy(pxl8_world_chunk_cache* cache) { +void demo3d_chunk_cache_destroy(demo3d_chunk_cache* cache) { if (!cache) return; for (u32 i = 0; i < cache->entry_count; i++) { - pxl8_world_chunk_cache_entry* e = &cache->entries[i]; - if (e->chunk) pxl8_world_chunk_destroy(e->chunk); + demo3d_chunk_cache_entry* e = &cache->entries[i]; + if (e->chunk) demo3d_chunk_destroy(e->chunk); } pxl8_free(cache->assembly.data); pxl8_free(cache); } -pxl8_result pxl8_world_chunk_cache_receive(pxl8_world_chunk_cache* cache, - const pxl8_chunk_msg_header* hdr, +pxl8_result demo3d_chunk_cache_receive(demo3d_chunk_cache* cache, + const demo3d_chunk_msg_header* hdr, const u8* payload, usize len) { if (!cache || !hdr || !payload) return PXL8_ERROR_INVALID_ARGUMENT; - pxl8_world_chunk_assembly* a = &cache->assembly; + demo3d_chunk_assembly* a = &cache->assembly; bool new_assembly = !a->active || a->id != hdr->id || @@ -358,11 +358,11 @@ pxl8_result pxl8_world_chunk_cache_receive(pxl8_world_chunk_cache* cache, assembly_init(a, hdr); } - if (hdr->fragment_idx >= PXL8_WORLD_CHUNK_MAX_FRAGMENTS) { + if (hdr->fragment_idx >= DEMO3D_CHUNK_MAX_FRAGMENTS) { return PXL8_ERROR_INVALID_ARGUMENT; } - u32 offset = (u32)hdr->fragment_idx * PXL8_CHUNK_MAX_PAYLOAD; + u32 offset = (u32)hdr->fragment_idx * DEMO3D_CHUNK_MAX_PAYLOAD; u32 required = offset + (u32)len; if (required > a->data_capacity) { @@ -377,7 +377,7 @@ pxl8_result pxl8_world_chunk_cache_receive(pxl8_world_chunk_cache* cache, a->fragments_received++; - if (hdr->flags & PXL8_CHUNK_FLAG_FINAL) { + if (hdr->flags & DEMO3D_CHUNK_FLAG_FINAL) { a->complete = true; return assemble_bsp(cache, a); } @@ -385,9 +385,9 @@ pxl8_result pxl8_world_chunk_cache_receive(pxl8_world_chunk_cache* cache, return PXL8_OK; } -pxl8_world_chunk* pxl8_world_chunk_cache_get_bsp(pxl8_world_chunk_cache* cache, u32 id) { +demo3d_chunk* demo3d_chunk_cache_get_bsp(demo3d_chunk_cache* cache, u32 id) { if (!cache) return NULL; - pxl8_world_chunk_cache_entry* e = find_entry_bsp(cache, id); + demo3d_chunk_cache_entry* e = find_entry_bsp(cache, id); if (e) { e->last_used = cache->frame_counter; return e->chunk; @@ -395,7 +395,7 @@ pxl8_world_chunk* pxl8_world_chunk_cache_get_bsp(pxl8_world_chunk_cache* cache, return NULL; } -void pxl8_world_chunk_cache_tick(pxl8_world_chunk_cache* cache) { +void demo3d_chunk_cache_tick(demo3d_chunk_cache* cache) { if (!cache) return; cache->frame_counter++; } diff --git a/demo3d/client/world/demo3d_chunk_cache.h b/demo3d/client/world/demo3d_chunk_cache.h new file mode 100644 index 0000000..0814cca --- /dev/null +++ b/demo3d/client/world/demo3d_chunk_cache.h @@ -0,0 +1,55 @@ +#pragma once + +#include "pxl8_mesh.h" +#include "demo3d_protocol.h" +#include "pxl8_types.h" +#include "demo3d_chunk.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEMO3D_CHUNK_CACHE_SIZE 512 +#define DEMO3D_CHUNK_MAX_FRAGMENTS 255 +#define DEMO3D_CHUNK_MAX_DATA_SIZE 131072 + +typedef struct demo3d_chunk_cache_entry { + demo3d_chunk* chunk; + u64 last_used; + bool valid; +} demo3d_chunk_cache_entry; + +typedef struct demo3d_chunk_assembly { + u32 id; + i32 cx, cy, cz; + u32 version; + u8 fragment_count; + u8 fragments_received; + u8* data; + u32 data_size; + u32 data_capacity; + bool active; + bool complete; +} demo3d_chunk_assembly; + +typedef struct demo3d_chunk_cache { + demo3d_chunk_cache_entry entries[DEMO3D_CHUNK_CACHE_SIZE]; + demo3d_chunk_assembly assembly; + u32 entry_count; + u64 frame_counter; +} demo3d_chunk_cache; + +demo3d_chunk_cache* demo3d_chunk_cache_create(void); +void demo3d_chunk_cache_destroy(demo3d_chunk_cache* cache); + +pxl8_result demo3d_chunk_cache_receive(demo3d_chunk_cache* cache, + const demo3d_chunk_msg_header* hdr, + const u8* payload, usize len); + +demo3d_chunk* demo3d_chunk_cache_get_bsp(demo3d_chunk_cache* cache, u32 id); + +void demo3d_chunk_cache_tick(demo3d_chunk_cache* cache); + +#ifdef __cplusplus +} +#endif diff --git a/src/world/pxl8_entity.c b/demo3d/client/world/demo3d_entity.c similarity index 59% rename from src/world/pxl8_entity.c rename to demo3d/client/world/demo3d_entity.c index e260b8a..8cc7323 100644 --- a/src/world/pxl8_entity.c +++ b/demo3d/client/world/demo3d_entity.c @@ -1,61 +1,61 @@ -#include "pxl8_entity.h" +#include "demo3d_entity.h" #include #include "pxl8_mem.h" -#define PXL8_ENTITY_COMPONENT_NAME_MAX 32 -#define PXL8_ENTITY_RELATIONSHIP_NAME_MAX 32 +#define DEMO3D_ENTITY_COMPONENT_NAME_MAX 32 +#define DEMO3D_ENTITY_RELATIONSHIP_NAME_MAX 32 -typedef struct pxl8_component_type { - char name[PXL8_ENTITY_COMPONENT_NAME_MAX]; +typedef struct demo3d_component_type { + char name[DEMO3D_ENTITY_COMPONENT_NAME_MAX]; u32 size; -} pxl8_component_type; +} demo3d_component_type; -typedef struct pxl8_component_storage { +typedef struct demo3d_component_storage { u32* sparse; void* dense_data; - pxl8_entity* dense_entities; + demo3d_entity* dense_entities; u32 count; -} pxl8_component_storage; +} demo3d_component_storage; -typedef struct pxl8_relationship_type { - char name[PXL8_ENTITY_RELATIONSHIP_NAME_MAX]; -} pxl8_relationship_type; +typedef struct demo3d_relationship_type { + char name[DEMO3D_ENTITY_RELATIONSHIP_NAME_MAX]; +} demo3d_relationship_type; -typedef struct pxl8_relationship_entry { - pxl8_entity subject; - pxl8_entity object; - pxl8_entity_relationship rel; +typedef struct demo3d_relationship_entry { + demo3d_entity subject; + demo3d_entity object; + demo3d_entity_relationship rel; u32 next_by_subject; u32 next_by_object; -} pxl8_relationship_entry; +} demo3d_relationship_entry; -struct pxl8_entity_pool { +struct demo3d_entity_pool { u32* generations; u32* free_list; u32 free_count; u32 capacity; u32 alive_count; - pxl8_component_type* component_types; - pxl8_component_storage* component_storage; + demo3d_component_type* component_types; + demo3d_component_storage* component_storage; u32 component_type_count; u32 component_type_capacity; - pxl8_relationship_type* relationship_types; + demo3d_relationship_type* relationship_types; u32 relationship_type_count; u32 relationship_type_capacity; - pxl8_relationship_entry* relationships; + demo3d_relationship_entry* relationships; u32* rel_by_subject; u32* rel_by_object; u32 relationship_count; u32 relationship_capacity; }; -pxl8_entity_pool* pxl8_entity_pool_create(u32 capacity) { - pxl8_entity_pool* pool = pxl8_calloc(1, sizeof(pxl8_entity_pool)); +demo3d_entity_pool* demo3d_entity_pool_create(u32 capacity) { + demo3d_entity_pool* pool = pxl8_calloc(1, sizeof(demo3d_entity_pool)); if (!pool) return NULL; pool->capacity = capacity; @@ -63,7 +63,7 @@ pxl8_entity_pool* pxl8_entity_pool_create(u32 capacity) { pool->free_list = pxl8_malloc(capacity * sizeof(u32)); if (!pool->generations || !pool->free_list) { - pxl8_entity_pool_destroy(pool); + demo3d_entity_pool_destroy(pool); return NULL; } @@ -73,14 +73,14 @@ pxl8_entity_pool* pxl8_entity_pool_create(u32 capacity) { pool->free_count = capacity; pool->component_type_capacity = 16; - pool->component_types = pxl8_calloc(pool->component_type_capacity, sizeof(pxl8_component_type)); - pool->component_storage = pxl8_calloc(pool->component_type_capacity, sizeof(pxl8_component_storage)); + pool->component_types = pxl8_calloc(pool->component_type_capacity, sizeof(demo3d_component_type)); + pool->component_storage = pxl8_calloc(pool->component_type_capacity, sizeof(demo3d_component_storage)); pool->relationship_type_capacity = 16; - pool->relationship_types = pxl8_calloc(pool->relationship_type_capacity, sizeof(pxl8_relationship_type)); + pool->relationship_types = pxl8_calloc(pool->relationship_type_capacity, sizeof(demo3d_relationship_type)); pool->relationship_capacity = 256; - pool->relationships = pxl8_malloc(pool->relationship_capacity * sizeof(pxl8_relationship_entry)); + pool->relationships = pxl8_malloc(pool->relationship_capacity * sizeof(demo3d_relationship_entry)); pool->rel_by_subject = pxl8_malloc(capacity * sizeof(u32)); pool->rel_by_object = pxl8_malloc(capacity * sizeof(u32)); @@ -92,7 +92,7 @@ pxl8_entity_pool* pxl8_entity_pool_create(u32 capacity) { return pool; } -void pxl8_entity_pool_clear(pxl8_entity_pool* pool) { +void demo3d_entity_pool_clear(demo3d_entity_pool* pool) { if (!pool) return; for (u32 i = 0; i < pool->capacity; i++) { @@ -111,7 +111,7 @@ void pxl8_entity_pool_clear(pxl8_entity_pool* pool) { pool->relationship_count = 0; } -void pxl8_entity_pool_destroy(pxl8_entity_pool* pool) { +void demo3d_entity_pool_destroy(demo3d_entity_pool* pool) { if (!pool) return; for (u32 i = 0; i < pool->component_type_count; i++) { @@ -131,21 +131,21 @@ void pxl8_entity_pool_destroy(pxl8_entity_pool* pool) { pxl8_free(pool); } -pxl8_entity pxl8_entity_spawn(pxl8_entity_pool* pool) { - if (!pool || pool->free_count == 0) return PXL8_ENTITY_INVALID; +demo3d_entity demo3d_entity_spawn(demo3d_entity_pool* pool) { + if (!pool || pool->free_count == 0) return DEMO3D_ENTITY_INVALID; u32 idx = pool->free_list[--pool->free_count]; pool->generations[idx]++; pool->alive_count++; - return (pxl8_entity){ .idx = idx, .gen = pool->generations[idx] }; + return (demo3d_entity){ .idx = idx, .gen = pool->generations[idx] }; } -void pxl8_entity_despawn(pxl8_entity_pool* pool, pxl8_entity e) { - if (!pool || !pxl8_entity_alive(pool, e)) return; +void demo3d_entity_despawn(demo3d_entity_pool* pool, demo3d_entity e) { + if (!pool || !demo3d_entity_alive(pool, e)) return; for (u32 i = 0; i < pool->component_type_count; i++) { - pxl8_entity_component_remove(pool, e, i + 1); + demo3d_entity_component_remove(pool, e, i + 1); } pool->free_list[pool->free_count++] = e.idx; @@ -153,42 +153,42 @@ void pxl8_entity_despawn(pxl8_entity_pool* pool, pxl8_entity e) { pool->alive_count--; } -bool pxl8_entity_alive(const pxl8_entity_pool* pool, pxl8_entity e) { +bool demo3d_entity_alive(const demo3d_entity_pool* pool, demo3d_entity e) { if (!pool || e.idx >= pool->capacity) return false; return pool->generations[e.idx] == e.gen && e.gen != 0; } -u32 pxl8_entity_count(const pxl8_entity_pool* pool) { +u32 demo3d_entity_count(const demo3d_entity_pool* pool) { return pool ? pool->alive_count : 0; } -pxl8_entity_component pxl8_entity_component_register(pxl8_entity_pool* pool, const char* name, u32 size) { - if (!pool || !name || size == 0) return PXL8_ENTITY_COMPONENT_INVALID; +demo3d_entity_component demo3d_entity_component_register(demo3d_entity_pool* pool, const char* name, u32 size) { + if (!pool || !name || size == 0) return DEMO3D_ENTITY_COMPONENT_INVALID; - pxl8_entity_component existing = pxl8_entity_component_find(pool, name); - if (existing != PXL8_ENTITY_COMPONENT_INVALID) return existing; + demo3d_entity_component existing = demo3d_entity_component_find(pool, name); + if (existing != DEMO3D_ENTITY_COMPONENT_INVALID) return existing; if (pool->component_type_count >= pool->component_type_capacity) { u32 new_capacity = pool->component_type_capacity * 2; - pxl8_component_type* new_types = pxl8_realloc(pool->component_types, new_capacity * sizeof(pxl8_component_type)); - pxl8_component_storage* new_storage = pxl8_realloc(pool->component_storage, new_capacity * sizeof(pxl8_component_storage)); - if (!new_types || !new_storage) return PXL8_ENTITY_COMPONENT_INVALID; + demo3d_component_type* new_types = pxl8_realloc(pool->component_types, new_capacity * sizeof(demo3d_component_type)); + demo3d_component_storage* new_storage = pxl8_realloc(pool->component_storage, new_capacity * sizeof(demo3d_component_storage)); + if (!new_types || !new_storage) return DEMO3D_ENTITY_COMPONENT_INVALID; pool->component_types = new_types; pool->component_storage = new_storage; - memset(&pool->component_types[pool->component_type_capacity], 0, (new_capacity - pool->component_type_capacity) * sizeof(pxl8_component_type)); - memset(&pool->component_storage[pool->component_type_capacity], 0, (new_capacity - pool->component_type_capacity) * sizeof(pxl8_component_storage)); + memset(&pool->component_types[pool->component_type_capacity], 0, (new_capacity - pool->component_type_capacity) * sizeof(demo3d_component_type)); + memset(&pool->component_storage[pool->component_type_capacity], 0, (new_capacity - pool->component_type_capacity) * sizeof(demo3d_component_storage)); pool->component_type_capacity = new_capacity; } u32 type_idx = pool->component_type_count++; - strncpy(pool->component_types[type_idx].name, name, PXL8_ENTITY_COMPONENT_NAME_MAX - 1); + strncpy(pool->component_types[type_idx].name, name, DEMO3D_ENTITY_COMPONENT_NAME_MAX - 1); pool->component_types[type_idx].size = size; - pxl8_component_storage* storage = &pool->component_storage[type_idx]; + demo3d_component_storage* storage = &pool->component_storage[type_idx]; storage->sparse = pxl8_malloc(pool->capacity * sizeof(u32)); storage->dense_data = pxl8_malloc(pool->capacity * size); - storage->dense_entities = pxl8_malloc(pool->capacity * sizeof(pxl8_entity)); + storage->dense_entities = pxl8_malloc(pool->capacity * sizeof(demo3d_entity)); storage->count = 0; for (u32 i = 0; i < pool->capacity; i++) { @@ -198,28 +198,28 @@ pxl8_entity_component pxl8_entity_component_register(pxl8_entity_pool* pool, con return type_idx + 1; } -pxl8_entity_component pxl8_entity_component_find(const pxl8_entity_pool* pool, const char* name) { - if (!pool || !name) return PXL8_ENTITY_COMPONENT_INVALID; +demo3d_entity_component demo3d_entity_component_find(const demo3d_entity_pool* pool, const char* name) { + if (!pool || !name) return DEMO3D_ENTITY_COMPONENT_INVALID; for (u32 i = 0; i < pool->component_type_count; i++) { if (strcmp(pool->component_types[i].name, name) == 0) { return i + 1; } } - return PXL8_ENTITY_COMPONENT_INVALID; + return DEMO3D_ENTITY_COMPONENT_INVALID; } -const char* pxl8_entity_component_name(const pxl8_entity_pool* pool, pxl8_entity_component comp) { +const char* demo3d_entity_component_name(const demo3d_entity_pool* pool, demo3d_entity_component comp) { if (!pool || comp == 0 || comp > pool->component_type_count) return NULL; return pool->component_types[comp - 1].name; } -void* pxl8_entity_component_add(pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp) { - if (!pool || !pxl8_entity_alive(pool, e)) return NULL; +void* demo3d_entity_component_add(demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp) { + if (!pool || !demo3d_entity_alive(pool, e)) return NULL; if (comp == 0 || comp > pool->component_type_count) return NULL; u32 type_idx = comp - 1; - pxl8_component_storage* storage = &pool->component_storage[type_idx]; + demo3d_component_storage* storage = &pool->component_storage[type_idx]; u32 size = pool->component_types[type_idx].size; if (storage->sparse[e.idx] != UINT32_MAX) { @@ -235,12 +235,12 @@ void* pxl8_entity_component_add(pxl8_entity_pool* pool, pxl8_entity e, pxl8_enti return data; } -void* pxl8_entity_component_get(const pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp) { - if (!pool || !pxl8_entity_alive(pool, e)) return NULL; +void* demo3d_entity_component_get(const demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp) { + if (!pool || !demo3d_entity_alive(pool, e)) return NULL; if (comp == 0 || comp > pool->component_type_count) return NULL; u32 type_idx = comp - 1; - const pxl8_component_storage* storage = &pool->component_storage[type_idx]; + const demo3d_component_storage* storage = &pool->component_storage[type_idx]; if (storage->sparse[e.idx] == UINT32_MAX) return NULL; @@ -248,12 +248,12 @@ void* pxl8_entity_component_get(const pxl8_entity_pool* pool, pxl8_entity e, pxl return (u8*)storage->dense_data + storage->sparse[e.idx] * size; } -void pxl8_entity_component_remove(pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp) { - if (!pool || !pxl8_entity_alive(pool, e)) return; +void demo3d_entity_component_remove(demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp) { + if (!pool || !demo3d_entity_alive(pool, e)) return; if (comp == 0 || comp > pool->component_type_count) return; u32 type_idx = comp - 1; - pxl8_component_storage* storage = &pool->component_storage[type_idx]; + demo3d_component_storage* storage = &pool->component_storage[type_idx]; u32 size = pool->component_types[type_idx].size; u32 dense_idx = storage->sparse[e.idx]; @@ -261,7 +261,7 @@ void pxl8_entity_component_remove(pxl8_entity_pool* pool, pxl8_entity e, pxl8_en u32 last_idx = storage->count - 1; if (dense_idx != last_idx) { - pxl8_entity last_entity = storage->dense_entities[last_idx]; + demo3d_entity last_entity = storage->dense_entities[last_idx]; memcpy((u8*)storage->dense_data + dense_idx * size, (u8*)storage->dense_data + last_idx * size, size); storage->dense_entities[dense_idx] = last_entity; @@ -272,67 +272,67 @@ void pxl8_entity_component_remove(pxl8_entity_pool* pool, pxl8_entity e, pxl8_en storage->count--; } -bool pxl8_entity_component_has(const pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp) { - if (!pool || !pxl8_entity_alive(pool, e)) return false; +bool demo3d_entity_component_has(const demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp) { + if (!pool || !demo3d_entity_alive(pool, e)) return false; if (comp == 0 || comp > pool->component_type_count) return false; return pool->component_storage[comp - 1].sparse[e.idx] != UINT32_MAX; } -pxl8_entity_relationship pxl8_entity_relationship_register(pxl8_entity_pool* pool, const char* name) { - if (!pool || !name) return PXL8_ENTITY_RELATIONSHIP_INVALID; +demo3d_entity_relationship demo3d_entity_relationship_register(demo3d_entity_pool* pool, const char* name) { + if (!pool || !name) return DEMO3D_ENTITY_RELATIONSHIP_INVALID; - pxl8_entity_relationship existing = pxl8_entity_relationship_find(pool, name); - if (existing != PXL8_ENTITY_RELATIONSHIP_INVALID) return existing; + demo3d_entity_relationship existing = demo3d_entity_relationship_find(pool, name); + if (existing != DEMO3D_ENTITY_RELATIONSHIP_INVALID) return existing; if (pool->relationship_type_count >= pool->relationship_type_capacity) { u32 new_capacity = pool->relationship_type_capacity * 2; - pxl8_relationship_type* new_types = pxl8_realloc(pool->relationship_types, new_capacity * sizeof(pxl8_relationship_type)); - if (!new_types) return PXL8_ENTITY_RELATIONSHIP_INVALID; + demo3d_relationship_type* new_types = pxl8_realloc(pool->relationship_types, new_capacity * sizeof(demo3d_relationship_type)); + if (!new_types) return DEMO3D_ENTITY_RELATIONSHIP_INVALID; pool->relationship_types = new_types; - memset(&pool->relationship_types[pool->relationship_type_capacity], 0, (new_capacity - pool->relationship_type_capacity) * sizeof(pxl8_relationship_type)); + memset(&pool->relationship_types[pool->relationship_type_capacity], 0, (new_capacity - pool->relationship_type_capacity) * sizeof(demo3d_relationship_type)); pool->relationship_type_capacity = new_capacity; } u32 type_idx = pool->relationship_type_count++; - strncpy(pool->relationship_types[type_idx].name, name, PXL8_ENTITY_RELATIONSHIP_NAME_MAX - 1); + strncpy(pool->relationship_types[type_idx].name, name, DEMO3D_ENTITY_RELATIONSHIP_NAME_MAX - 1); return type_idx + 1; } -pxl8_entity_relationship pxl8_entity_relationship_find(const pxl8_entity_pool* pool, const char* name) { - if (!pool || !name) return PXL8_ENTITY_RELATIONSHIP_INVALID; +demo3d_entity_relationship demo3d_entity_relationship_find(const demo3d_entity_pool* pool, const char* name) { + if (!pool || !name) return DEMO3D_ENTITY_RELATIONSHIP_INVALID; for (u32 i = 0; i < pool->relationship_type_count; i++) { if (strcmp(pool->relationship_types[i].name, name) == 0) { return i + 1; } } - return PXL8_ENTITY_RELATIONSHIP_INVALID; + return DEMO3D_ENTITY_RELATIONSHIP_INVALID; } -const char* pxl8_entity_relationship_name(const pxl8_entity_pool* pool, pxl8_entity_relationship rel) { +const char* demo3d_entity_relationship_name(const demo3d_entity_pool* pool, demo3d_entity_relationship rel) { if (!pool || rel == 0 || rel > pool->relationship_type_count) return NULL; return pool->relationship_types[rel - 1].name; } -void pxl8_entity_relationship_add(pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object) { +void demo3d_entity_relationship_add(demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object) { if (!pool) return; - if (!pxl8_entity_alive(pool, subject) || !pxl8_entity_alive(pool, object)) return; + if (!demo3d_entity_alive(pool, subject) || !demo3d_entity_alive(pool, object)) return; if (rel == 0 || rel > pool->relationship_type_count) return; - if (pxl8_entity_relationship_has(pool, subject, rel, object)) return; + if (demo3d_entity_relationship_has(pool, subject, rel, object)) return; if (pool->relationship_count >= pool->relationship_capacity) { u32 new_capacity = pool->relationship_capacity * 2; - pxl8_relationship_entry* new_rels = pxl8_realloc(pool->relationships, new_capacity * sizeof(pxl8_relationship_entry)); + demo3d_relationship_entry* new_rels = pxl8_realloc(pool->relationships, new_capacity * sizeof(demo3d_relationship_entry)); if (!new_rels) return; pool->relationships = new_rels; pool->relationship_capacity = new_capacity; } u32 entry_idx = pool->relationship_count++; - pxl8_relationship_entry* entry = &pool->relationships[entry_idx]; + demo3d_relationship_entry* entry = &pool->relationships[entry_idx]; entry->subject = subject; entry->object = object; entry->rel = rel; @@ -344,7 +344,7 @@ void pxl8_entity_relationship_add(pxl8_entity_pool* pool, pxl8_entity subject, p pool->rel_by_object[object.idx] = entry_idx; } -void pxl8_entity_relationship_remove(pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object) { +void demo3d_entity_relationship_remove(demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object) { if (!pool) return; if (rel == 0 || rel > pool->relationship_type_count) return; @@ -352,9 +352,9 @@ void pxl8_entity_relationship_remove(pxl8_entity_pool* pool, pxl8_entity subject u32 idx = *prev_ptr; while (idx != UINT32_MAX) { - pxl8_relationship_entry* entry = &pool->relationships[idx]; - if (pxl8_entity_eq(entry->subject, subject) && - pxl8_entity_eq(entry->object, object) && + demo3d_relationship_entry* entry = &pool->relationships[idx]; + if (demo3d_entity_eq(entry->subject, subject) && + demo3d_entity_eq(entry->object, object) && entry->rel == rel) { *prev_ptr = entry->next_by_subject; @@ -370,7 +370,7 @@ void pxl8_entity_relationship_remove(pxl8_entity_pool* pool, pxl8_entity subject if (idx != pool->relationship_count - 1) { u32 last_idx = pool->relationship_count - 1; - pxl8_relationship_entry* last = &pool->relationships[last_idx]; + demo3d_relationship_entry* last = &pool->relationships[last_idx]; u32* last_subj_prev = &pool->rel_by_subject[last->subject.idx]; while (*last_subj_prev != UINT32_MAX) { @@ -400,15 +400,15 @@ void pxl8_entity_relationship_remove(pxl8_entity_pool* pool, pxl8_entity subject } } -bool pxl8_entity_relationship_has(const pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object) { +bool demo3d_entity_relationship_has(const demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object) { if (!pool) return false; if (rel == 0 || rel > pool->relationship_type_count) return false; u32 idx = pool->rel_by_subject[subject.idx]; while (idx != UINT32_MAX) { - const pxl8_relationship_entry* entry = &pool->relationships[idx]; - if (pxl8_entity_eq(entry->subject, subject) && - pxl8_entity_eq(entry->object, object) && + const demo3d_relationship_entry* entry = &pool->relationships[idx]; + if (demo3d_entity_eq(entry->subject, subject) && + demo3d_entity_eq(entry->object, object) && entry->rel == rel) { return true; } @@ -417,15 +417,15 @@ bool pxl8_entity_relationship_has(const pxl8_entity_pool* pool, pxl8_entity subj return false; } -u32 pxl8_entity_relationship_subjects(const pxl8_entity_pool* pool, pxl8_entity object, pxl8_entity_relationship rel, pxl8_entity* out, u32 max) { +u32 demo3d_entity_relationship_subjects(const demo3d_entity_pool* pool, demo3d_entity object, demo3d_entity_relationship rel, demo3d_entity* out, u32 max) { if (!pool || !out || max == 0) return 0; if (rel == 0 || rel > pool->relationship_type_count) return 0; u32 count = 0; u32 idx = pool->rel_by_object[object.idx]; while (idx != UINT32_MAX && count < max) { - const pxl8_relationship_entry* entry = &pool->relationships[idx]; - if (pxl8_entity_eq(entry->object, object) && entry->rel == rel) { + const demo3d_relationship_entry* entry = &pool->relationships[idx]; + if (demo3d_entity_eq(entry->object, object) && entry->rel == rel) { out[count++] = entry->subject; } idx = entry->next_by_object; @@ -433,15 +433,15 @@ u32 pxl8_entity_relationship_subjects(const pxl8_entity_pool* pool, pxl8_entity return count; } -u32 pxl8_entity_relationship_objects(const pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity* out, u32 max) { +u32 demo3d_entity_relationship_objects(const demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity* out, u32 max) { if (!pool || !out || max == 0) return 0; if (rel == 0 || rel > pool->relationship_type_count) return 0; u32 count = 0; u32 idx = pool->rel_by_subject[subject.idx]; while (idx != UINT32_MAX && count < max) { - const pxl8_relationship_entry* entry = &pool->relationships[idx]; - if (pxl8_entity_eq(entry->subject, subject) && entry->rel == rel) { + const demo3d_relationship_entry* entry = &pool->relationships[idx]; + if (demo3d_entity_eq(entry->subject, subject) && entry->rel == rel) { out[count++] = entry->object; } idx = entry->next_by_subject; @@ -449,20 +449,20 @@ u32 pxl8_entity_relationship_objects(const pxl8_entity_pool* pool, pxl8_entity s return count; } -void pxl8_entity_each(pxl8_entity_pool* pool, pxl8_entity_component comp, pxl8_entity_each_fn fn, void* ctx) { +void demo3d_entity_each(demo3d_entity_pool* pool, demo3d_entity_component comp, demo3d_entity_each_fn fn, void* ctx) { if (!pool || !fn) return; if (comp == 0 || comp > pool->component_type_count) return; - pxl8_component_storage* storage = &pool->component_storage[comp - 1]; + demo3d_component_storage* storage = &pool->component_storage[comp - 1]; for (u32 i = 0; i < storage->count; i++) { - pxl8_entity e = storage->dense_entities[i]; - if (pxl8_entity_alive(pool, e)) { + demo3d_entity e = storage->dense_entities[i]; + if (demo3d_entity_alive(pool, e)) { fn(pool, e, ctx); } } } -void pxl8_entity_each_with(pxl8_entity_pool* pool, const pxl8_entity_component* comps, u32 count, pxl8_entity_each_fn fn, void* ctx) { +void demo3d_entity_each_with(demo3d_entity_pool* pool, const demo3d_entity_component* comps, u32 count, demo3d_entity_each_fn fn, void* ctx) { if (!pool || !comps || !fn || count == 0) return; u32 smallest_idx = 0; @@ -477,15 +477,15 @@ void pxl8_entity_each_with(pxl8_entity_pool* pool, const pxl8_entity_component* } } - pxl8_component_storage* storage = &pool->component_storage[comps[smallest_idx] - 1]; + demo3d_component_storage* storage = &pool->component_storage[comps[smallest_idx] - 1]; for (u32 i = 0; i < storage->count; i++) { - pxl8_entity e = storage->dense_entities[i]; - if (!pxl8_entity_alive(pool, e)) continue; + demo3d_entity e = storage->dense_entities[i]; + if (!demo3d_entity_alive(pool, e)) continue; bool has_all = true; for (u32 j = 0; j < count && has_all; j++) { if (j != smallest_idx) { - has_all = pxl8_entity_component_has(pool, e, comps[j]); + has_all = demo3d_entity_component_has(pool, e, comps[j]); } } diff --git a/demo3d/client/world/demo3d_entity.h b/demo3d/client/world/demo3d_entity.h new file mode 100644 index 0000000..2bdf0f7 --- /dev/null +++ b/demo3d/client/world/demo3d_entity.h @@ -0,0 +1,67 @@ +#pragma once + +#include "pxl8_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct demo3d_entity_pool demo3d_entity_pool; + +typedef struct demo3d_entity { + u32 idx; + u32 gen; +} demo3d_entity; + +#define DEMO3D_ENTITY_INVALID ((demo3d_entity){0, 0}) + +typedef u32 demo3d_entity_component; +typedef u32 demo3d_entity_relationship; + +#define DEMO3D_ENTITY_COMPONENT_INVALID 0 +#define DEMO3D_ENTITY_RELATIONSHIP_INVALID 0 + +demo3d_entity_pool* demo3d_entity_pool_create(u32 capacity); +void demo3d_entity_pool_clear(demo3d_entity_pool* pool); +void demo3d_entity_pool_destroy(demo3d_entity_pool* pool); + +demo3d_entity demo3d_entity_spawn(demo3d_entity_pool* pool); +void demo3d_entity_despawn(demo3d_entity_pool* pool, demo3d_entity e); +bool demo3d_entity_alive(const demo3d_entity_pool* pool, demo3d_entity e); +u32 demo3d_entity_count(const demo3d_entity_pool* pool); + +demo3d_entity_component demo3d_entity_component_register(demo3d_entity_pool* pool, const char* name, u32 size); +demo3d_entity_component demo3d_entity_component_find(const demo3d_entity_pool* pool, const char* name); +const char* demo3d_entity_component_name(const demo3d_entity_pool* pool, demo3d_entity_component comp); + +void* demo3d_entity_component_add(demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp); +void* demo3d_entity_component_get(const demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp); +void demo3d_entity_component_remove(demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp); +bool demo3d_entity_component_has(const demo3d_entity_pool* pool, demo3d_entity e, demo3d_entity_component comp); + +demo3d_entity_relationship demo3d_entity_relationship_register(demo3d_entity_pool* pool, const char* name); +demo3d_entity_relationship demo3d_entity_relationship_find(const demo3d_entity_pool* pool, const char* name); +const char* demo3d_entity_relationship_name(const demo3d_entity_pool* pool, demo3d_entity_relationship rel); + +void demo3d_entity_relationship_add(demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object); +void demo3d_entity_relationship_remove(demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object); +bool demo3d_entity_relationship_has(const demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity object); + +u32 demo3d_entity_relationship_subjects(const demo3d_entity_pool* pool, demo3d_entity object, demo3d_entity_relationship rel, demo3d_entity* out, u32 max); +u32 demo3d_entity_relationship_objects(const demo3d_entity_pool* pool, demo3d_entity subject, demo3d_entity_relationship rel, demo3d_entity* out, u32 max); + +typedef void (*demo3d_entity_each_fn)(demo3d_entity_pool* pool, demo3d_entity e, void* ctx); +void demo3d_entity_each(demo3d_entity_pool* pool, demo3d_entity_component comp, demo3d_entity_each_fn fn, void* ctx); +void demo3d_entity_each_with(demo3d_entity_pool* pool, const demo3d_entity_component* comps, u32 count, demo3d_entity_each_fn fn, void* ctx); + +static inline bool demo3d_entity_valid(demo3d_entity e) { + return e.idx != 0 || e.gen != 0; +} + +static inline bool demo3d_entity_eq(demo3d_entity a, demo3d_entity b) { + return a.idx == b.idx && a.gen == b.gen; +} + +#ifdef __cplusplus +} +#endif diff --git a/src/world/pxl8_world.c b/demo3d/client/world/demo3d_world.c similarity index 65% rename from src/world/pxl8_world.c rename to demo3d/client/world/demo3d_world.c index aa217a3..32622cc 100644 --- a/src/world/pxl8_world.c +++ b/demo3d/client/world/demo3d_world.c @@ -1,26 +1,26 @@ -#include "pxl8_world.h" +#include "demo3d_world.h" #include -#include "pxl8_hal.h" +#include "pxl8_platform.h" #ifdef PXL8_ASYNC_THREADS #include #include "pxl8_queue.h" #endif -#include "pxl8_bsp_render.h" +#include "demo3d_bsp_render.h" #include "pxl8_io.h" #include "pxl8_gfx3d.h" #include "pxl8_log.h" #include "pxl8_mem.h" -#include "pxl8_protocol.h" -#include "pxl8_sim.h" +#include "demo3d_protocol.h" +#include "demo3d_sim.h" -#define PXL8_VIS_MAX_NODES (PXL8_WORLD_MAX_LOADED_CHUNKS * 512) -#define PXL8_VIS_MAX_QUEUE (PXL8_VIS_MAX_NODES * 4) -#define PXL8_VIS_BYTES ((PXL8_VIS_MAX_NODES + 7) / 8) -#define PXL8_WORLD_ENTITY_CAPACITY 256 +#define DEMO3D_VIS_MAX_NODES (DEMO3D_WORLD_MAX_LOADED_CHUNKS * 512) +#define DEMO3D_VIS_MAX_QUEUE (DEMO3D_VIS_MAX_NODES * 4) +#define DEMO3D_VIS_BYTES ((DEMO3D_VIS_MAX_NODES + 7) / 8) +#define DEMO3D_WORLD_ENTITY_CAPACITY 256 typedef struct { u16 chunk_idx; @@ -28,49 +28,49 @@ typedef struct { pxl8_rect window; } world_vis_node; -struct pxl8_world { - pxl8_loaded_chunk loaded[PXL8_WORLD_MAX_LOADED_CHUNKS]; +struct demo3d_world { + demo3d_loaded_chunk loaded[DEMO3D_WORLD_MAX_LOADED_CHUNKS]; u32 loaded_count; - pxl8_world_chunk* active_chunk; - pxl8_bsp_render_state* active_render_state; + demo3d_chunk* active_chunk; + demo3d_bsp_render_state* active_render_state; pxl8_gfx_material shared_materials[16]; bool shared_material_set[16]; - pxl8_world_chunk_cache* chunk_cache; - pxl8_entity_pool* entities; + demo3d_chunk_cache* chunk_cache; + demo3d_entity_pool* entities; - pxl8_sim_entity local_player; + demo3d_sim_entity local_player; u64 client_tick; pxl8_vec2 pointer_motion; - pxl8_sim_config sim_config; + demo3d_sim_config sim_config; - u8 vis_bits[PXL8_VIS_BYTES]; - u8* vis_ptrs[PXL8_WORLD_MAX_LOADED_CHUNKS]; - pxl8_rect vis_windows[PXL8_VIS_MAX_NODES]; - pxl8_rect* vis_win_ptrs[PXL8_WORLD_MAX_LOADED_CHUNKS]; - world_vis_node vis_queue[PXL8_VIS_MAX_QUEUE]; + u8 vis_bits[DEMO3D_VIS_BYTES]; + u8* vis_ptrs[DEMO3D_WORLD_MAX_LOADED_CHUNKS]; + pxl8_rect vis_windows[DEMO3D_VIS_MAX_NODES]; + pxl8_rect* vis_win_ptrs[DEMO3D_WORLD_MAX_LOADED_CHUNKS]; + world_vis_node vis_queue[DEMO3D_VIS_MAX_QUEUE]; #ifdef PXL8_ASYNC_THREADS - pxl8_sim_entity render_state[2]; + demo3d_sim_entity render_state[2]; atomic_uint active_buffer; pxl8_thread* sim_thread; atomic_bool sim_running; atomic_bool sim_paused; - pxl8_net* net; + demo3d_net* net; pxl8_queue input_queue; f32 sim_accumulator; #endif }; -pxl8_world* pxl8_world_create(void) { - pxl8_world* world = pxl8_calloc(1, sizeof(pxl8_world)); +demo3d_world* demo3d_world_create(void) { + demo3d_world* world = pxl8_calloc(1, sizeof(demo3d_world)); if (!world) return NULL; - world->chunk_cache = pxl8_world_chunk_cache_create(); - world->entities = pxl8_entity_pool_create(PXL8_WORLD_ENTITY_CAPACITY); - world->sim_config = (pxl8_sim_config){ + world->chunk_cache = demo3d_chunk_cache_create(); + world->entities = demo3d_entity_pool_create(DEMO3D_WORLD_ENTITY_CAPACITY); + world->sim_config = (demo3d_sim_config){ .move_speed = 180.0f, .ground_accel = 10.0f, .air_accel = 1.0f, @@ -84,36 +84,36 @@ pxl8_world* pxl8_world_create(void) { }; if (!world->chunk_cache || !world->entities) { - pxl8_world_destroy(world); + demo3d_world_destroy(world); return NULL; } return world; } -void pxl8_world_destroy(pxl8_world* world) { +void demo3d_world_destroy(demo3d_world* world) { if (!world) return; for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_bsp_render_state_destroy(world->loaded[i].render_state); + demo3d_bsp_render_state_destroy(world->loaded[i].render_state); } - pxl8_world_chunk_cache_destroy(world->chunk_cache); - pxl8_entity_pool_destroy(world->entities); + demo3d_chunk_cache_destroy(world->chunk_cache); + demo3d_entity_pool_destroy(world->entities); pxl8_free(world); } -pxl8_world_chunk_cache* pxl8_world_get_chunk_cache(pxl8_world* world) { +demo3d_chunk_cache* demo3d_world_get_chunk_cache(demo3d_world* world) { if (!world) return NULL; return world->chunk_cache; } -pxl8_world_chunk* pxl8_world_active_chunk(pxl8_world* world) { +demo3d_chunk* demo3d_world_active_chunk(demo3d_world* world) { if (!world) return NULL; return world->active_chunk; } -pxl8_sim_world pxl8_world_sim_world(const pxl8_world* world, pxl8_vec3 pos) { - pxl8_sim_world sim = {0}; +demo3d_sim_world demo3d_world_sim_world(const demo3d_world* world, pxl8_vec3 pos) { + demo3d_sim_world sim = {0}; const f32 chunk_size = 16.0f * 64.0f; sim.chunk_size = chunk_size; @@ -123,7 +123,7 @@ pxl8_sim_world pxl8_world_sim_world(const pxl8_world* world, pxl8_vec3 pos) { sim.center_cz = pcz; for (u32 i = 0; i < world->loaded_count; i++) { - const pxl8_loaded_chunk* lc = &world->loaded[i]; + const demo3d_loaded_chunk* lc = &world->loaded[i]; if (!lc->chunk || !lc->chunk->bsp) continue; i32 dx = lc->cx - pcx + 1; i32 dz = lc->cz - pcz + 1; @@ -135,7 +135,7 @@ pxl8_sim_world pxl8_world_sim_world(const pxl8_world* world, pxl8_vec3 pos) { return sim; } -static void entity_to_userdata(const pxl8_sim_entity* ent, u8* userdata) { +static void entity_to_userdata(const demo3d_sim_entity* ent, u8* userdata) { u8* p = userdata; memcpy(p, &ent->pos.x, 4); p += 4; memcpy(p, &ent->pos.y, 4); p += 4; @@ -149,7 +149,7 @@ static void entity_to_userdata(const pxl8_sim_entity* ent, u8* userdata) { memcpy(p, &ent->kind, 2); } -static void userdata_to_entity(const u8* userdata, pxl8_sim_entity* ent) { +static void userdata_to_entity(const u8* userdata, demo3d_sim_entity* ent) { const u8* p = userdata; memcpy(&ent->pos.x, p, 4); p += 4; memcpy(&ent->pos.y, p, 4); p += 4; @@ -163,17 +163,17 @@ static void userdata_to_entity(const u8* userdata, pxl8_sim_entity* ent) { memcpy(&ent->kind, p, 2); } -bool pxl8_world_point_solid(const pxl8_world* world, f32 x, f32 y, f32 z) { +bool demo3d_world_point_solid(const demo3d_world* world, f32 x, f32 y, f32 z) { if (!world) return false; if (world->active_chunk && world->active_chunk->bsp) { - return pxl8_bsp_point_solid(world->active_chunk->bsp, (pxl8_vec3){x, y, z}); + return demo3d_bsp_point_solid(world->active_chunk->bsp, (pxl8_vec3){x, y, z}); } return false; } -pxl8_ray pxl8_world_ray(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to) { +pxl8_ray demo3d_world_ray(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to) { pxl8_ray result = {0}; if (!world) return result; @@ -193,18 +193,18 @@ pxl8_ray pxl8_world_ray(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to) { from.z + dir.z * t }; - if (pxl8_world_point_solid(world, pos.x, pos.y, pos.z)) { + if (demo3d_world_point_solid(world, pos.x, pos.y, pos.z)) { result.hit = true; result.fraction = t; result.point = pos; f32 eps = 0.1f; - bool sx_neg = pxl8_world_point_solid(world, pos.x - eps, pos.y, pos.z); - bool sx_pos = pxl8_world_point_solid(world, pos.x + eps, pos.y, pos.z); - bool sy_neg = pxl8_world_point_solid(world, pos.x, pos.y - eps, pos.z); - bool sy_pos = pxl8_world_point_solid(world, pos.x, pos.y + eps, pos.z); - bool sz_neg = pxl8_world_point_solid(world, pos.x, pos.y, pos.z - eps); - bool sz_pos = pxl8_world_point_solid(world, pos.x, pos.y, pos.z + eps); + bool sx_neg = demo3d_world_point_solid(world, pos.x - eps, pos.y, pos.z); + bool sx_pos = demo3d_world_point_solid(world, pos.x + eps, pos.y, pos.z); + bool sy_neg = demo3d_world_point_solid(world, pos.x, pos.y - eps, pos.z); + bool sy_pos = demo3d_world_point_solid(world, pos.x, pos.y + eps, pos.z); + bool sz_neg = demo3d_world_point_solid(world, pos.x, pos.y, pos.z - eps); + bool sz_pos = demo3d_world_point_solid(world, pos.x, pos.y, pos.z + eps); result.normal = (pxl8_vec3){ (sx_neg && !sx_pos) ? 1.0f : (!sx_neg && sx_pos) ? -1.0f : 0.0f, @@ -228,22 +228,22 @@ pxl8_ray pxl8_world_ray(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to) { return result; } -pxl8_ray pxl8_world_sweep(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius) { +pxl8_ray demo3d_world_sweep(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius) { pxl8_ray result = {0}; if (!world) return result; f32 diag = radius * 0.707f; - bool dest_blocked = pxl8_world_point_solid(world, to.x, to.y, to.z) || - pxl8_world_point_solid(world, to.x + radius, to.y, to.z) || - pxl8_world_point_solid(world, to.x - radius, to.y, to.z) || - pxl8_world_point_solid(world, to.x, to.y, to.z + radius) || - pxl8_world_point_solid(world, to.x, to.y, to.z - radius) || - pxl8_world_point_solid(world, to.x + diag, to.y, to.z + diag) || - pxl8_world_point_solid(world, to.x + diag, to.y, to.z - diag) || - pxl8_world_point_solid(world, to.x - diag, to.y, to.z + diag) || - pxl8_world_point_solid(world, to.x - diag, to.y, to.z - diag); + bool dest_blocked = demo3d_world_point_solid(world, to.x, to.y, to.z) || + demo3d_world_point_solid(world, to.x + radius, to.y, to.z) || + demo3d_world_point_solid(world, to.x - radius, to.y, to.z) || + demo3d_world_point_solid(world, to.x, to.y, to.z + radius) || + demo3d_world_point_solid(world, to.x, to.y, to.z - radius) || + demo3d_world_point_solid(world, to.x + diag, to.y, to.z + diag) || + demo3d_world_point_solid(world, to.x + diag, to.y, to.z - diag) || + demo3d_world_point_solid(world, to.x - diag, to.y, to.z + diag) || + demo3d_world_point_solid(world, to.x - diag, to.y, to.z - diag); if (dest_blocked) { result.hit = true; @@ -261,10 +261,10 @@ pxl8_ray pxl8_world_sweep(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to, return result; } -void pxl8_world_update(pxl8_world* world, f32 dt) { +void demo3d_world_update(demo3d_world* world, f32 dt) { (void)dt; if (!world) return; - pxl8_world_chunk_cache_tick(world->chunk_cache); + demo3d_chunk_cache_tick(world->chunk_cache); } static inline bool vr_valid(pxl8_rect r) { @@ -319,9 +319,9 @@ static pxl8_rect project_portal(f32 px0, f32 pz0, f32 px1, f32 pz1, return r; } -static void compute_edge_leafs(pxl8_loaded_chunk* lc) { +static void compute_edge_leafs(demo3d_loaded_chunk* lc) { const f32 CHUNK_SIZE = 16.0f * 64.0f; - const pxl8_bsp* bsp = lc->chunk->bsp; + const demo3d_bsp* bsp = lc->chunk->bsp; f32 cx0 = lc->cx * CHUNK_SIZE; f32 cz0 = lc->cz * CHUNK_SIZE; f32 cx1 = cx0 + CHUNK_SIZE; @@ -330,7 +330,7 @@ static void compute_edge_leafs(pxl8_loaded_chunk* lc) { memset(lc->edges, 0, sizeof(lc->edges)); for (u32 i = 0; i < bsp->num_leafs; i++) { - const pxl8_bsp_leaf* leaf = &bsp->leafs[i]; + const demo3d_bsp_leaf* leaf = &bsp->leafs[i]; if (bsp->leafs[i].contents == -1) continue; if ((f32)leaf->mins[2] <= (f32)((i16)cz0) + 1.0f && lc->edges[0].count < 16) @@ -344,7 +344,7 @@ static void compute_edge_leafs(pxl8_loaded_chunk* lc) { } } -static i32 world_find_chunk(const pxl8_world* world, i32 cx, i32 cz) { +static i32 world_find_chunk(const demo3d_world* world, i32 cx, i32 cz) { for (u32 i = 0; i < world->loaded_count; i++) { if (world->loaded[i].cx == cx && world->loaded[i].cz == cz && world->loaded[i].chunk && world->loaded[i].chunk->bsp) @@ -353,8 +353,8 @@ static i32 world_find_chunk(const pxl8_world* world, i32 cx, i32 cz) { return -1; } -static void world_mark_leaf_faces(const pxl8_bsp* bsp, pxl8_bsp_render_state* rs, u32 leaf_idx) { - const pxl8_bsp_leaf* leaf = &bsp->leafs[leaf_idx]; +static void world_mark_leaf_faces(const demo3d_bsp* bsp, demo3d_bsp_render_state* rs, u32 leaf_idx) { + const demo3d_bsp_leaf* leaf = &bsp->leafs[leaf_idx]; for (u32 i = 0; i < leaf->num_marksurfaces; i++) { u32 si = leaf->first_marksurface + i; if (si < bsp->num_marksurfaces) { @@ -392,7 +392,7 @@ static bool vis_try_enqueue(u8** vis, pxl8_rect** windows, world_vis_node* queue return true; } -static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos) { +static void world_compute_visibility(demo3d_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos) { const f32 CHUNK_SIZE = 16.0f * 64.0f; const f32 PORTAL_Y_HI = 192.0f; @@ -400,9 +400,9 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 i32 cam_ci = -1, cam_li = -1; for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_loaded_chunk* lc = &world->loaded[i]; + demo3d_loaded_chunk* lc = &world->loaded[i]; if (!lc->chunk || !lc->chunk->bsp) continue; - const pxl8_bsp* bsp = lc->chunk->bsp; + const demo3d_bsp* bsp = lc->chunk->bsp; f32 cx0 = lc->cx * CHUNK_SIZE; f32 cz0 = lc->cz * CHUNK_SIZE; if (camera_pos.x < cx0 || camera_pos.x >= cx0 + CHUNK_SIZE || @@ -411,28 +411,9 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 (camera_pos.x < bsp->bounds_min_x || camera_pos.x >= bsp->bounds_max_x || camera_pos.z < bsp->bounds_min_z || camera_pos.z >= bsp->bounds_max_z)) continue; - i32 leaf = pxl8_bsp_find_leaf(bsp, camera_pos); + i32 leaf = demo3d_bsp_find_leaf(bsp, camera_pos); if (leaf >= 0 && (u32)leaf < bsp->num_leafs && - bsp->leafs[leaf].contents != -1 && - (!(bsp->bounds_max_x > bsp->bounds_min_x) || bsp->leafs[leaf].contents == -2)) { - cam_ci = (i32)i; - cam_li = leaf; - break; - } - } - - if (cam_ci < 0) { - for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_loaded_chunk* lc = &world->loaded[i]; - if (!lc->chunk || !lc->chunk->bsp) continue; - const pxl8_bsp* bsp = lc->chunk->bsp; - if (bsp->bounds_max_x > bsp->bounds_min_x) continue; - i32 leaf = pxl8_bsp_find_leaf(bsp, camera_pos); - if (leaf < 0 || (u32)leaf >= bsp->num_leafs) continue; - const pxl8_bsp_leaf* l = &bsp->leafs[leaf]; - if (l->contents == -1) continue; - if (camera_pos.x < (f32)l->mins[0] || camera_pos.x > (f32)l->maxs[0] || - camera_pos.z < (f32)l->mins[2] || camera_pos.z > (f32)l->maxs[2]) continue; + bsp->leafs[leaf].contents == -2) { cam_ci = (i32)i; cam_li = leaf; break; @@ -441,7 +422,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (cam_ci < 0 || !vp) { for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_bsp_render_state* rs = world->loaded[i].render_state; + demo3d_bsp_render_state* rs = world->loaded[i].render_state; if (!rs) continue; if (rs->render_face_flags) memset(rs->render_face_flags, 1, rs->num_faces); @@ -459,7 +440,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (world->loaded[i].chunk && world->loaded[i].chunk->bsp) { u32 nl = world->loaded[i].chunk->bsp->num_leafs; u32 vbytes = (nl + 7) / 8; - if (voff + vbytes > PXL8_VIS_BYTES || woff + nl > PXL8_VIS_MAX_NODES) + if (voff + vbytes > DEMO3D_VIS_BYTES || woff + nl > DEMO3D_VIS_MAX_NODES) continue; world->vis_ptrs[i] = world->vis_bits + voff; voff += vbytes; @@ -471,7 +452,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (!world->vis_ptrs[cam_ci] || !world->vis_win_ptrs[cam_ci]) return; for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_bsp_render_state* rs = world->loaded[i].render_state; + demo3d_bsp_render_state* rs = world->loaded[i].render_state; if (!rs) continue; if (rs->render_face_flags) memset(rs->render_face_flags, 0, rs->num_faces); @@ -481,7 +462,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 u32 head = 0, tail = 0; pxl8_rect full_screen = {-1.0f, -1.0f, 1.0f, 1.0f}; - const pxl8_bsp* cam_bsp = world->loaded[cam_ci].chunk->bsp; + const demo3d_bsp* cam_bsp = world->loaded[cam_ci].chunk->bsp; bool cam_exterior = cam_bsp->leafs[cam_li].contents == 0 && !(cam_bsp->bounds_max_x > cam_bsp->bounds_min_x); @@ -491,25 +472,25 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 while (head < tail) { world_vis_node cur = world->vis_queue[head++]; - pxl8_loaded_chunk* lc = &world->loaded[cur.chunk_idx]; - const pxl8_bsp* bsp = lc->chunk->bsp; + demo3d_loaded_chunk* lc = &world->loaded[cur.chunk_idx]; + const demo3d_bsp* bsp = lc->chunk->bsp; world_mark_leaf_faces(bsp, lc->render_state, cur.leaf_idx); if (bsp->cell_portals && cur.leaf_idx < bsp->num_cell_portals) { bool is_cam_leaf = (cur.chunk_idx == (u16)cam_ci && cur.leaf_idx == (u16)cam_li); bool is_cam_chunk = (cur.chunk_idx == (u16)cam_ci); - const pxl8_bsp_cell_portals* cp = &bsp->cell_portals[cur.leaf_idx]; + const demo3d_bsp_cell_portals* cp = &bsp->cell_portals[cur.leaf_idx]; for (u8 pi = 0; pi < cp->num_portals; pi++) { - const pxl8_bsp_portal* p = &cp->portals[pi]; + const demo3d_bsp_portal* p = &cp->portals[pi]; u32 target = p->target_leaf; if (target >= bsp->num_leafs) continue; if (bsp->leafs[target].contents == -1) continue; - if (is_cam_chunk && !pxl8_bsp_is_leaf_visible(bsp, cam_li, (i32)target)) continue; + if (is_cam_chunk && !demo3d_bsp_is_leaf_visible(bsp, cam_li, (i32)target)) continue; if (is_cam_leaf || cam_exterior) { vis_try_enqueue(world->vis_ptrs, world->vis_win_ptrs, - world->vis_queue, &tail, PXL8_VIS_MAX_QUEUE, + world->vis_queue, &tail, DEMO3D_VIS_MAX_QUEUE, cur.chunk_idx, (u16)target, full_screen); continue; } @@ -521,12 +502,12 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (!vr_valid(nw)) continue; vis_try_enqueue(world->vis_ptrs, world->vis_win_ptrs, - world->vis_queue, &tail, PXL8_VIS_MAX_QUEUE, + world->vis_queue, &tail, DEMO3D_VIS_MAX_QUEUE, cur.chunk_idx, (u16)target, nw); } } - const pxl8_bsp_leaf* leaf = &bsp->leafs[cur.leaf_idx]; + const demo3d_bsp_leaf* leaf = &bsp->leafs[cur.leaf_idx]; f32 chunk_x0 = lc->cx * CHUNK_SIZE; f32 chunk_z0 = lc->cz * CHUNK_SIZE; f32 chunk_x1 = chunk_x0 + CHUNK_SIZE; @@ -546,12 +527,12 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 i32 nci = world_find_chunk(world, lc->cx + dirs[d].dx, lc->cz + dirs[d].dz); if (nci < 0) continue; - const pxl8_bsp* nbsp = world->loaded[nci].chunk->bsp; - const pxl8_edge_leafs* nedge = &world->loaded[nci].edges[opposite_edge[d]]; + const demo3d_bsp* nbsp = world->loaded[nci].chunk->bsp; + const demo3d_edge_leafs* nedge = &world->loaded[nci].edges[opposite_edge[d]]; for (u8 k = 0; k < nedge->count; k++) { u16 nl = nedge->leafs[k]; - const pxl8_bsp_leaf* nleaf =  ->leafs[nl]; + const demo3d_bsp_leaf* nleaf =  ->leafs[nl]; bool overlaps = false; if (dirs[d].dx != 0) { @@ -576,7 +557,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (cam_exterior) { vis_try_enqueue(world->vis_ptrs, world->vis_win_ptrs, - world->vis_queue, &tail, PXL8_VIS_MAX_QUEUE, + world->vis_queue, &tail, DEMO3D_VIS_MAX_QUEUE, (u16)nci, (u16)nl, full_screen); continue; } @@ -588,7 +569,7 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 if (!vr_valid(nw)) continue; vis_try_enqueue(world->vis_ptrs, world->vis_win_ptrs, - world->vis_queue, &tail, PXL8_VIS_MAX_QUEUE, + world->vis_queue, &tail, DEMO3D_VIS_MAX_QUEUE, (u16)nci, (u16)nl, nw); } } @@ -596,67 +577,76 @@ static void world_compute_visibility(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 } -void pxl8_world_render(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos) { +void demo3d_world_render(demo3d_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos) { if (!world || !gfx) return; - if (world->active_chunk && world->active_chunk->bsp) - pxl8_3d_set_bsp(gfx, world->active_chunk->bsp); - else - pxl8_3d_set_bsp(gfx, NULL); - world_compute_visibility(world, gfx, camera_pos); for (u32 i = 0; i < world->loaded_count; i++) { - pxl8_loaded_chunk* lc = &world->loaded[i]; + demo3d_loaded_chunk* lc = &world->loaded[i]; if (!lc->chunk || !lc->chunk->bsp || !lc->render_state) continue; - pxl8_bsp_render(gfx, lc->chunk->bsp, lc->render_state, NULL); + demo3d_bsp_render(gfx, lc->chunk->bsp, lc->render_state, NULL); } } -static void apply_shared_materials(pxl8_world* world, pxl8_bsp_render_state* rs) { +static void apply_shared_materials(demo3d_world* world, demo3d_bsp_render_state* rs) { for (u16 i = 0; i < 16; i++) { if (world->shared_material_set[i]) { - pxl8_bsp_set_material(rs, i, &world->shared_materials[i]); + demo3d_bsp_set_material(rs, i, &world->shared_materials[i]); } } } -void pxl8_world_sync(pxl8_world* world, pxl8_net* net) { +void demo3d_world_sync(demo3d_world* world, demo3d_net* net) { if (!world || !net) return; - if (!pxl8_net_has_chunk(net)) { + if (!demo3d_net_has_chunk(net)) { u32 old_count = world->loaded_count; world->loaded_count = 0; world->active_chunk = NULL; world->active_render_state = NULL; for (u32 i = 0; i < old_count; i++) { - pxl8_bsp_render_state_destroy(world->loaded[i].render_state); + demo3d_bsp_render_state_destroy(world->loaded[i].render_state); } return; } - i32 center_cx = pxl8_net_chunk_cx(net); - i32 center_cz = pxl8_net_chunk_cz(net); + i32 center_cx = demo3d_net_chunk_cx(net); + i32 center_cz = demo3d_net_chunk_cz(net); - pxl8_loaded_chunk old_loaded[PXL8_WORLD_MAX_LOADED_CHUNKS]; + demo3d_loaded_chunk old_loaded[DEMO3D_WORLD_MAX_LOADED_CHUNKS]; u32 old_count = world->loaded_count; memcpy(old_loaded, world->loaded, sizeof(old_loaded)); - pxl8_loaded_chunk new_loaded[PXL8_WORLD_MAX_LOADED_CHUNKS]; + demo3d_loaded_chunk new_loaded[DEMO3D_WORLD_MAX_LOADED_CHUNKS]; u32 new_count = 0; - pxl8_world_chunk* new_active_chunk = NULL; - pxl8_bsp_render_state* new_active_rs = NULL; + demo3d_chunk* new_active_chunk = NULL; + demo3d_bsp_render_state* new_active_rs = NULL; for (i32 dz = -2; dz <= 2; dz++) { for (i32 dx = -2; dx <= 2; dx++) { i32 cx = center_cx + dx; i32 cz = center_cz + dz; - u32 id = pxl8_chunk_hash(cx, cz); + u32 id = demo3d_chunk_hash(cx, cz); - pxl8_world_chunk* chunk = pxl8_world_chunk_cache_get_bsp(world->chunk_cache, id); - if (!chunk || !chunk->bsp) continue; + demo3d_chunk* chunk = demo3d_chunk_cache_get_bsp(world->chunk_cache, id); + if (!chunk || !chunk->bsp) { + for (u32 j = 0; j < old_count; j++) { + if (old_loaded[j].active && old_loaded[j].cx == cx && old_loaded[j].cz == cz) { + u32 idx = new_count++; + new_loaded[idx] = old_loaded[j]; + old_loaded[j].active = false; + if (dx == 0 && dz == 0) { + new_active_chunk = new_loaded[idx].chunk; + new_active_rs = new_loaded[idx].render_state; + } + break; + } + } + continue; + } - pxl8_bsp_render_state* rs = NULL; + demo3d_bsp_render_state* rs = NULL; for (u32 j = 0; j < old_count; j++) { if (old_loaded[j].active && old_loaded[j].cx == cx && old_loaded[j].cz == cz && old_loaded[j].chunk == chunk) { @@ -667,14 +657,14 @@ void pxl8_world_sync(pxl8_world* world, pxl8_net* net) { } if (!rs) { - rs = pxl8_bsp_render_state_create(chunk->bsp->num_faces); + rs = demo3d_bsp_render_state_create(chunk->bsp->num_faces); if (rs && rs->render_face_flags) memset(rs->render_face_flags, 1, rs->num_faces); apply_shared_materials(world, rs); } u32 idx = new_count++; - new_loaded[idx] = (pxl8_loaded_chunk){ + new_loaded[idx] = (demo3d_loaded_chunk){ .chunk = chunk, .render_state = rs, .cx = cx, @@ -690,19 +680,24 @@ void pxl8_world_sync(pxl8_world* world, pxl8_net* net) { } } + for (u32 j = 0; j < old_count; j++) { + if (!old_loaded[j].active) continue; + if (new_count < DEMO3D_WORLD_MAX_LOADED_CHUNKS && + old_loaded[j].chunk && old_loaded[j].chunk->bsp && + demo3d_chunk_cache_get_bsp(world->chunk_cache, old_loaded[j].chunk->id)) { + new_loaded[new_count++] = old_loaded[j]; + } else { + demo3d_bsp_render_state_destroy(old_loaded[j].render_state); + } + } + memcpy(world->loaded, new_loaded, sizeof(new_loaded)); world->active_chunk = new_active_chunk; world->active_render_state = new_active_rs; world->loaded_count = new_count; - - for (u32 j = 0; j < old_count; j++) { - if (old_loaded[j].active) { - pxl8_bsp_render_state_destroy(old_loaded[j].render_state); - } - } } -void pxl8_world_set_bsp_material(pxl8_world* world, u16 material_id, const pxl8_gfx_material* material) { +void demo3d_world_set_bsp_material(demo3d_world* world, u16 material_id, const pxl8_gfx_material* material) { if (!world || !material || material_id >= 16) return; world->shared_materials[material_id] = *material; @@ -710,23 +705,23 @@ void pxl8_world_set_bsp_material(pxl8_world* world, u16 material_id, const pxl8_ for (u32 i = 0; i < world->loaded_count; i++) { if (world->loaded[i].render_state) { - pxl8_bsp_set_material(world->loaded[i].render_state, material_id, material); + demo3d_bsp_set_material(world->loaded[i].render_state, material_id, material); } } } -void pxl8_world_set_sim_config(pxl8_world* world, const pxl8_sim_config* config) { +void demo3d_world_set_sim_config(demo3d_world* world, const demo3d_sim_config* config) { if (!world || !config) return; world->sim_config = *config; } -void pxl8_world_init_local_player(pxl8_world* world, f32 x, f32 y, f32 z) { +void demo3d_world_init_local_player(demo3d_world* world, f32 x, f32 y, f32 z) { if (!world) return; world->local_player.pos = (pxl8_vec3){x, y, z}; world->local_player.vel = (pxl8_vec3){0, 0, 0}; world->local_player.yaw = 0; world->local_player.pitch = 0; - world->local_player.flags = PXL8_SIM_FLAG_ALIVE | PXL8_SIM_FLAG_PLAYER | PXL8_SIM_FLAG_GROUNDED; + world->local_player.flags = DEMO3D_SIM_FLAG_ALIVE | DEMO3D_SIM_FLAG_PLAYER | DEMO3D_SIM_FLAG_GROUNDED; world->local_player.kind = 0; world->client_tick = 0; world->pointer_motion = (pxl8_vec2){0}; @@ -737,7 +732,7 @@ void pxl8_world_init_local_player(pxl8_world* world, f32 x, f32 y, f32 z) { #endif } -void pxl8_world_set_look(pxl8_world* world, f32 yaw, f32 pitch) { +void demo3d_world_set_look(demo3d_world* world, f32 yaw, f32 pitch) { if (!world) return; world->local_player.yaw = yaw; world->local_player.pitch = pitch; @@ -751,72 +746,72 @@ void pxl8_world_set_look(pxl8_world* world, f32 yaw, f32 pitch) { #endif } -pxl8_sim_entity* pxl8_world_local_player(pxl8_world* world) { +demo3d_sim_entity* demo3d_world_local_player(demo3d_world* world) { if (!world) return NULL; #ifdef PXL8_ASYNC_THREADS - const pxl8_sim_entity* state = pxl8_world_get_render_state(world); + const demo3d_sim_entity* state = demo3d_world_get_render_state(world); if (!state) return NULL; - if (!(state->flags & PXL8_SIM_FLAG_ALIVE)) return NULL; - return (pxl8_sim_entity*)state; + if (!(state->flags & DEMO3D_SIM_FLAG_ALIVE)) return NULL; + return (demo3d_sim_entity*)state; #else - if (!(world->local_player.flags & PXL8_SIM_FLAG_ALIVE)) return NULL; + if (!(world->local_player.flags & DEMO3D_SIM_FLAG_ALIVE)) return NULL; return &world->local_player; #endif } -void pxl8_world_predict(pxl8_world* world, pxl8_net* net, const pxl8_input_msg* input, f32 dt) { +void demo3d_world_predict(demo3d_world* world, demo3d_net* net, const demo3d_input_msg* input, f32 dt) { if (!world || !net || !input) return; - if (!(world->local_player.flags & PXL8_SIM_FLAG_ALIVE)) return; + if (!(world->local_player.flags & DEMO3D_SIM_FLAG_ALIVE)) return; - pxl8_sim_world sim = pxl8_world_sim_world(world, world->local_player.pos); - pxl8_sim_move_player(&world->local_player, input, &sim, &world->sim_config, dt); + demo3d_sim_world sim = demo3d_world_sim_world(world, world->local_player.pos); + demo3d_sim_move_player(&world->local_player, input, &sim, &world->sim_config, dt); world->client_tick++; - entity_to_userdata(&world->local_player, pxl8_net_predicted_state(net)); - pxl8_net_predicted_tick_set(net, world->client_tick); + entity_to_userdata(&world->local_player, demo3d_net_predicted_state(net)); + demo3d_net_predicted_tick_set(net, world->client_tick); } -void pxl8_world_reconcile(pxl8_world* world, pxl8_net* net, f32 dt) { +void demo3d_world_reconcile(demo3d_world* world, demo3d_net* net, f32 dt) { if (!world || !net) return; - if (!(world->local_player.flags & PXL8_SIM_FLAG_ALIVE)) return; - if (!pxl8_net_needs_correction(net)) return; + if (!(world->local_player.flags & DEMO3D_SIM_FLAG_ALIVE)) return; + if (!demo3d_net_needs_correction(net)) return; - u64 player_id = pxl8_net_player_id(net); - const u8* server_state = pxl8_net_entity_userdata(net, player_id); + u64 player_id = demo3d_net_player_id(net); + const u8* server_state = demo3d_net_entity_userdata(net, player_id); if (!server_state) return; - pxl8_sim_entity server_player = {0}; + demo3d_sim_entity server_player = {0}; userdata_to_entity(server_state, &server_player); - if (!(server_player.flags & PXL8_SIM_FLAG_ALIVE)) { + if (!(server_player.flags & DEMO3D_SIM_FLAG_ALIVE)) { return; } world->local_player = server_player; - const pxl8_snapshot_header* snap = pxl8_net_snapshot(net); + const demo3d_snapshot_header* snap = demo3d_net_snapshot(net); u64 server_tick = snap ? snap->tick : 0; for (u64 tick = server_tick + 1; tick <= world->client_tick; tick++) { - const pxl8_input_msg* input = pxl8_net_input_at(net, tick); + const demo3d_input_msg* input = demo3d_net_input_at(net, tick); if (!input) continue; - pxl8_sim_world sim = pxl8_world_sim_world(world, world->local_player.pos); - pxl8_sim_move_player(&world->local_player, input, &sim, &world->sim_config, dt); + demo3d_sim_world sim = demo3d_world_sim_world(world, world->local_player.pos); + demo3d_sim_move_player(&world->local_player, input, &sim, &world->sim_config, dt); } - entity_to_userdata(&world->local_player, pxl8_net_predicted_state(net)); + entity_to_userdata(&world->local_player, demo3d_net_predicted_state(net)); } #ifdef PXL8_ASYNC_THREADS #define SIM_TIMESTEP (1.0f / 60.0f) -static void pxl8_world_sim_tick(pxl8_world* world, f32 dt) { - bool alive = (world->local_player.flags & PXL8_SIM_FLAG_ALIVE) != 0; - pxl8_input_msg merged = {0}; - pxl8_input_msg* input = NULL; +static void demo3d_world_sim_tick(demo3d_world* world, f32 dt) { + bool alive = (world->local_player.flags & DEMO3D_SIM_FLAG_ALIVE) != 0; + demo3d_input_msg merged = {0}; + demo3d_input_msg* input = NULL; while ((input = pxl8_queue_pop(&world->input_queue))) { merged.look_dx += input->look_dx; @@ -841,7 +836,7 @@ static void pxl8_world_sim_tick(pxl8_world* world, f32 dt) { merged.timestamp = pxl8_get_ticks_ns(); merged.yaw = world->pointer_motion.yaw; if (world->net) { - pxl8_net_send_input(world->net, &merged); + demo3d_net_send_input(world->net, &merged); } world->local_player.yaw = world->pointer_motion.yaw; @@ -849,25 +844,25 @@ static void pxl8_world_sim_tick(pxl8_world* world, f32 dt) { merged.look_dx = 0; merged.look_dy = 0; - pxl8_sim_world sim = pxl8_world_sim_world(world, world->local_player.pos); - pxl8_sim_move_player(&world->local_player, &merged, &sim, &world->sim_config, dt); + demo3d_sim_world sim = demo3d_world_sim_world(world, world->local_player.pos); + demo3d_sim_move_player(&world->local_player, &merged, &sim, &world->sim_config, dt); if (world->net) { - entity_to_userdata(&world->local_player, pxl8_net_predicted_state(world->net)); - pxl8_net_predicted_tick_set(world->net, world->client_tick); + entity_to_userdata(&world->local_player, demo3d_net_predicted_state(world->net)); + demo3d_net_predicted_tick_set(world->net, world->client_tick); } world->client_tick++; } -static void pxl8_world_swap_buffers(pxl8_world* world) { +static void demo3d_world_swap_buffers(demo3d_world* world) { u32 back = atomic_load(&world->active_buffer) ^ 1; world->render_state[back] = world->local_player; atomic_store(&world->active_buffer, back); } -static int pxl8_world_sim_thread(void* data) { - pxl8_world* world = (pxl8_world*)data; +static int demo3d_world_sim_thread(void* data) { + demo3d_world* world = (demo3d_world*)data; u64 last_time = pxl8_get_ticks_ns(); while (atomic_load(&world->sim_running)) { @@ -887,31 +882,31 @@ static int pxl8_world_sim_thread(void* data) { world->sim_accumulator += dt; while (world->sim_accumulator >= SIM_TIMESTEP) { - pxl8_world_chunk_cache_tick(world->chunk_cache); + demo3d_chunk_cache_tick(world->chunk_cache); if (world->net) { pxl8_packet* pkt; - while ((pkt = pxl8_net_pop_packet(world->net))) { - pxl8_net_process_packet(world->net, pkt); + while ((pkt = pxl8_net_pop_packet(world->net->transport))) { + demo3d_net_dispatch_packet(world->net, pkt); pxl8_net_packet_free(pkt); } - pxl8_world_sync(world, world->net); - pxl8_world_reconcile(world, world->net, SIM_TIMESTEP); + demo3d_world_sync(world, world->net); + demo3d_world_reconcile(world, world->net, SIM_TIMESTEP); } - pxl8_world_sim_tick(world, SIM_TIMESTEP); + demo3d_world_sim_tick(world, SIM_TIMESTEP); world->sim_accumulator -= SIM_TIMESTEP; } - pxl8_world_swap_buffers(world); + demo3d_world_swap_buffers(world); pxl8_sleep_ms(1); } return 0; } -void pxl8_world_start_sim_thread(pxl8_world* world, pxl8_net* net) { +void demo3d_world_start_sim_thread(demo3d_world* world, demo3d_net* net) { if (!world || world->sim_thread) return; world->net = net; @@ -923,29 +918,29 @@ void pxl8_world_start_sim_thread(pxl8_world* world, pxl8_net* net) { world->render_state[0] = world->local_player; world->render_state[1] = world->local_player; - world->sim_thread = pxl8_thread_create(pxl8_world_sim_thread, "pxl8_sim", world); + world->sim_thread = pxl8_thread_create(demo3d_world_sim_thread, "pxl8_sim", world); } -void pxl8_world_stop_sim_thread(pxl8_world* world) { +void demo3d_world_stop_sim_thread(demo3d_world* world) { if (!world || !world->sim_thread) return; atomic_store(&world->sim_running, false); pxl8_thread_wait(world->sim_thread, NULL); world->sim_thread = NULL; - pxl8_input_msg* input; + demo3d_input_msg* input; while ((input = pxl8_queue_pop(&world->input_queue))) { pxl8_free(input); } } -void pxl8_world_pause_sim(pxl8_world* world, bool paused) { +void demo3d_world_pause_sim(demo3d_world* world, bool paused) { if (!world) return; if (paused) { atomic_store(&world->sim_paused, true); } else { - pxl8_input_msg* input; + demo3d_input_msg* input; while ((input = pxl8_queue_pop(&world->input_queue))) { pxl8_free(input); } @@ -954,7 +949,7 @@ void pxl8_world_pause_sim(pxl8_world* world, bool paused) { } } -void pxl8_world_push_input(pxl8_world* world, const pxl8_input_msg* input) { +void demo3d_world_push_input(demo3d_world* world, const demo3d_input_msg* input) { if (!world || !input) return; world->pointer_motion.yaw -= input->look_dx * 0.008f; @@ -963,7 +958,7 @@ void pxl8_world_push_input(pxl8_world* world, const pxl8_input_msg* input) { if (pitch < -world->sim_config.max_pitch) pitch = -world->sim_config.max_pitch; world->pointer_motion.pitch = pitch; - pxl8_input_msg* copy = pxl8_malloc(sizeof(pxl8_input_msg)); + demo3d_input_msg* copy = pxl8_malloc(sizeof(demo3d_input_msg)); if (copy) { *copy = *input; if (!pxl8_queue_push(&world->input_queue, copy)) { @@ -972,13 +967,13 @@ void pxl8_world_push_input(pxl8_world* world, const pxl8_input_msg* input) { } } -const pxl8_sim_entity* pxl8_world_get_render_state(const pxl8_world* world) { +const demo3d_sim_entity* demo3d_world_get_render_state(const demo3d_world* world) { if (!world) return NULL; - u32 front = atomic_load(&((pxl8_world*)world)->active_buffer); + u32 front = atomic_load(&((demo3d_world*)world)->active_buffer); return &world->render_state[front]; } -f32 pxl8_world_get_interp_alpha(const pxl8_world* world) { +f32 demo3d_world_get_interp_alpha(const demo3d_world* world) { if (!world) return 1.0f; return world->sim_accumulator / SIM_TIMESTEP; } diff --git a/demo3d/client/world/demo3d_world.h b/demo3d/client/world/demo3d_world.h new file mode 100644 index 0000000..f909021 --- /dev/null +++ b/demo3d/client/world/demo3d_world.h @@ -0,0 +1,71 @@ +#pragma once + +#include "demo3d_entity.h" +#include "pxl8_gfx.h" +#include "pxl8_gfx3d.h" +#include "pxl8_math.h" +#include "demo3d_net.h" +#include "demo3d_sim.h" +#include "pxl8_types.h" +#include "demo3d_chunk.h" +#include "demo3d_chunk_cache.h" +#include "demo3d_bsp_render.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEMO3D_WORLD_MAX_LOADED_CHUNKS 64 + +typedef struct { + u16 leafs[16]; + u8 count; +} demo3d_edge_leafs; + +typedef struct demo3d_loaded_chunk { + demo3d_chunk* chunk; + demo3d_bsp_render_state* render_state; + demo3d_edge_leafs edges[4]; + i32 cx; + i32 cz; + bool active; +} demo3d_loaded_chunk; + +typedef struct demo3d_world demo3d_world; + +demo3d_world* demo3d_world_create(void); +void demo3d_world_destroy(demo3d_world* world); + +demo3d_chunk_cache* demo3d_world_get_chunk_cache(demo3d_world* world); +demo3d_chunk* demo3d_world_active_chunk(demo3d_world* world); + +bool demo3d_world_point_solid(const demo3d_world* world, f32 x, f32 y, f32 z); +pxl8_ray demo3d_world_ray(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to); +pxl8_ray demo3d_world_sweep(const demo3d_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius); + +void demo3d_world_update(demo3d_world* world, f32 dt); +void demo3d_world_render(demo3d_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos); +void demo3d_world_sync(demo3d_world* world, demo3d_net* net); + +void demo3d_world_set_bsp_material(demo3d_world* world, u16 material_id, const pxl8_gfx_material* material); + +void demo3d_world_set_sim_config(demo3d_world* world, const demo3d_sim_config* config); +void demo3d_world_init_local_player(demo3d_world* world, f32 x, f32 y, f32 z); +void demo3d_world_set_look(demo3d_world* world, f32 yaw, f32 pitch); +demo3d_sim_entity* demo3d_world_local_player(demo3d_world* world); +demo3d_sim_world demo3d_world_sim_world(const demo3d_world* world, pxl8_vec3 pos); +void demo3d_world_predict(demo3d_world* world, demo3d_net* net, const demo3d_input_msg* input, f32 dt); +void demo3d_world_reconcile(demo3d_world* world, demo3d_net* net, f32 dt); + +#ifdef PXL8_ASYNC_THREADS +void demo3d_world_start_sim_thread(demo3d_world* world, demo3d_net* net); +void demo3d_world_stop_sim_thread(demo3d_world* world); +void demo3d_world_pause_sim(demo3d_world* world, bool paused); +void demo3d_world_push_input(demo3d_world* world, const demo3d_input_msg* input); +const demo3d_sim_entity* demo3d_world_get_render_state(const demo3d_world* world); +f32 demo3d_world_get_interp_alpha(const demo3d_world* world); +#endif + +#ifdef __cplusplus +} +#endif diff --git a/demo/mod/first_person3d.fnl b/demo3d/main.fnl similarity index 66% rename from demo/mod/first_person3d.fnl rename to demo3d/main.fnl index 68717d8..eec6858 100644 --- a/demo/mod/first_person3d.fnl +++ b/demo3d/main.fnl @@ -1,7 +1,10 @@ (local pxl8 (require :pxl8)) (local bit (require :bit)) +(local ffi (require :ffi)) +(local C ffi.C) +(local core (require :pxl8.core)) (local effects (require :pxl8.effects)) -(local net (require :pxl8.net)) +(local game-world (require :mod.world)) (local entities (require :mod.entities)) (local menu (require :mod.menu)) @@ -18,7 +21,7 @@ (local SIM_FLAG_GROUNDED 4) -(local sim-cfg (pxl8.sim_config {:move_speed 150 +(local sim-cfg (game-world.sim_config {:move_speed 150 :gravity 600 :jump_velocity 180 :player_radius 12 @@ -64,24 +67,22 @@ (fn preload [] (when (not network) - (set network (net.get)) - (when network - (network:spawn cam-x cam-y cam-z cam-yaw cam-pitch))) + (let [net (C.demo3d_get_net core.sys)] + (when (and (not= net nil) (C.demo3d_net_connected net)) + (set network net) + (C.demo3d_net_spawn net cam-x cam-y cam-z cam-yaw cam-pitch)))) (when (not world) - (set world (pxl8.get_world)) + (set world (game-world.World.get)) (when world (world:set_sim_config sim-cfg)))) -(fn is-connected [] - (and network (network:connected))) - (fn is-ready [] (if (not world) false (let [chunk (world:active_chunk)] (and chunk (chunk:ready))))) -(fn init [] +(fn game-init [] (pxl8.set_relative_mouse_mode true) (pxl8.load_palette "res/palettes/palette.ase") (for [i 0 7] @@ -102,6 +103,7 @@ (when (not lights) (set lights (pxl8.create_lights))) + (menu.init) (entities.init textures) (sky.generate-stars) (preload) @@ -113,9 +115,7 @@ (fn setup-materials [] (when (not world) (lua "return")) - (when (not network) (lua "return")) (when materials-set? (lua "return")) - (when (not (network:has_chunk)) (lua "return")) (let [chunk (world:active_chunk)] (when (not chunk) (lua "return")) (when (not (chunk:ready)) (lua "return")) @@ -154,7 +154,7 @@ (when (and auto-run-cancel-key (not (pxl8.key_down auto-run-cancel-key))) (set auto-run-cancel-key nil)) - (pxl8.make_input_msg + (game-world.make_input_msg {:move_x (+ (if (pxl8.key_down "d") 1 0) (if (pxl8.key_down "a") -1 0)) :move_y (+ (if (or (pxl8.key_down "w") auto-run?) 1 0) (if (and (pxl8.key_down "s") (not= auto-run-cancel-key "s")) -1 0)) @@ -162,8 +162,16 @@ :look_dy (pxl8.mouse_dy) :buttons (if (pxl8.key_down "space") 1 0)})) -(fn update [dt] +(global update (fn [dt] (set last-dt dt) + + (when (pxl8.key_pressed "escape") + (menu.toggle)) + + (when (menu.is-paused) + (menu.update) + (lua "return")) + (setup-materials) (when world @@ -198,85 +206,88 @@ (set day-time (% (+ day-time (/ dt day-length)) 1)) (set light-time (+ light-time (* dt 0.5))) - (set real-time (+ real-time dt))))) + (set real-time (+ real-time dt)))))) -(fn frame [] +(global frame (fn [] (pxl8.clear 1) + (preload) (when (or (not camera) (not world)) + (pxl8.text "Loading..." 280 180 1) (lua "return")) (let [chunk (when world (world:active_chunk)) ready (and chunk (chunk:ready))] + (when ready + (let [bob-offset (* (math.sin bob-time) bob-amount) + eye-y (+ cam-y player-eye-height bob-offset land-squash) + forward-x (- (math.sin cam-yaw)) + forward-z (- (math.cos cam-yaw)) + target-x (+ smooth-cam-x forward-x) + target-y (+ eye-y (math.sin cam-pitch)) + target-z (+ smooth-cam-z forward-z) + aspect (/ (pxl8.get_width) (pxl8.get_height))] - (when ready - (let [bob-offset (* (math.sin bob-time) bob-amount) - eye-y (+ cam-y player-eye-height bob-offset land-squash) - forward-x (- (math.sin cam-yaw)) - forward-z (- (math.cos cam-yaw)) - target-x (+ smooth-cam-x forward-x) - target-y (+ eye-y (math.sin cam-pitch)) - target-z (+ smooth-cam-z forward-z) - aspect (/ (pxl8.get_width) (pxl8.get_height))] + (camera:lookat [smooth-cam-x eye-y smooth-cam-z] + [target-x target-y target-z] + [0 1 0]) + (camera:set_perspective 1.047 aspect 1.0 4096.0) - (camera:lookat [smooth-cam-x eye-y smooth-cam-z] - [target-x target-y target-z] - [0 1 0]) - (camera:set_perspective 1.047 aspect 1.0 4096.0) + (let [light-x (+ 384 (* 50 (math.cos light-time))) + light-z (+ 324 (* 50 (math.sin light-time))) + light-y 80 + phase (+ (* light-x 0.01) 1.7) + f1 (* 0.08 (math.sin (+ (* real-time 2.5) phase))) + f2 (* 0.05 (math.sin (+ (* real-time 4.1) (* phase 0.7)))) + f3 (* 0.03 (math.sin (+ (* real-time 7.3) (* phase 1.2)))) + flicker (+ 0.92 f1 f2 f3) + light-intensity (math.floor (math.max 0 (math.min 255 (* 255 flicker)))) + r1 (* 0.06 (math.sin (+ (* real-time 1.8) (* phase 0.5)))) + r2 (* 0.04 (math.sin (+ (* real-time 3.2) phase))) + light-radius (* 150 (+ 0.95 r1 r2))] + (lights:clear) + (lights:add light-x light-y light-z 2 light-intensity light-radius) - (let [light-x (+ 384 (* 50 (math.cos light-time))) - light-z (+ 324 (* 50 (math.sin light-time))) - light-y 80 - phase (+ (* light-x 0.01) 1.7) - f1 (* 0.08 (math.sin (+ (* real-time 2.5) phase))) - f2 (* 0.05 (math.sin (+ (* real-time 4.1) (* phase 0.7)))) - f3 (* 0.03 (math.sin (+ (* real-time 7.3) (* phase 1.2)))) - flicker (+ 0.92 f1 f2 f3) - light-intensity (math.floor (math.max 0 (math.min 255 (* 255 flicker)))) - r1 (* 0.06 (math.sin (+ (* real-time 1.8) (* phase 0.5)))) - r2 (* 0.04 (math.sin (+ (* real-time 3.2) phase))) - light-radius (* 150 (+ 0.95 r1 r2))] - (lights:clear) - (lights:add light-x light-y light-z 2 light-intensity light-radius) + (pxl8.push_target) + (pxl8.begin_frame_3d camera lights { + :ambient 2 + :dither true + :fog_density 0.002 + :celestial_dir [0.5 -0.8 0.3] + :celestial_intensity 0.3}) + + (when (not (menu.is-wireframe)) + (sky.update-gradient 1 2 6 6 10 18)) + (sky.render smooth-cam-x eye-y smooth-cam-z (menu.is-wireframe)) + (pxl8.clear_depth) + + (pxl8.set_wireframe (menu.is-wireframe)) + (world:render [smooth-cam-x eye-y smooth-cam-z]) + + (when chunk + (entities.render-fireball light-x light-y light-z)) + + (pxl8.end_frame_3d) + + (when (not (menu.is-wireframe)) + (sky.render-stars smooth-cam-x eye-y smooth-cam-z day-time 0 last-dt)) + + (pxl8.pop_target)) (pxl8.push_target) - (pxl8.begin_frame_3d camera lights { - :ambient 2 - :dither true - :fog_density 0.002 - :celestial_dir [0.5 -0.8 0.3] - :celestial_intensity 0.3}) + (let [cx (/ (pxl8.get_width) 2) + cy (/ (pxl8.get_height) 2) + crosshair-size 4 + crosshair-color 240] + (pxl8.line (- cx crosshair-size) cy (+ cx crosshair-size) cy crosshair-color) + (pxl8.line cx (- cy crosshair-size) cx (+ cy crosshair-size) crosshair-color)) + (pxl8.pop_target)))) - (when (not (menu.is-wireframe)) - (sky.update-gradient 1 2 6 6 10 18)) - (sky.render smooth-cam-x eye-y smooth-cam-z (menu.is-wireframe)) - (pxl8.clear_depth) + (when (menu.is-paused) + (pxl8.push_target) + (menu.draw) + (pxl8.pop_target)))) - (pxl8.set_wireframe (menu.is-wireframe)) - (world:render [smooth-cam-x eye-y smooth-cam-z]) - - (when chunk - (entities.render-fireball light-x light-y light-z)) - - (pxl8.end_frame_3d) - - (when (not (menu.is-wireframe)) - (sky.render-stars smooth-cam-x eye-y smooth-cam-z day-time 0 last-dt)) - - (pxl8.pop_target)) - - (pxl8.push_target) - (let [cx (/ (pxl8.get_width) 2) - cy (/ (pxl8.get_height) 2) - crosshair-size 4 - crosshair-color 240] - (pxl8.line (- cx crosshair-size) cy (+ cx crosshair-size) cy crosshair-color) - (pxl8.line cx (- cy crosshair-size) cx (+ cy crosshair-size) crosshair-color)) - (pxl8.pop_target))))) - -{:preload preload - :is-connected is-connected - :is-ready is-ready - :init init - :update update - :frame frame} +(global init (fn [] + (preload) + (game-init))) diff --git a/demo/mod/entities.fnl b/demo3d/mod/entities.fnl similarity index 100% rename from demo/mod/entities.fnl rename to demo3d/mod/entities.fnl diff --git a/demo3d/mod/menu.fnl b/demo3d/mod/menu.fnl new file mode 100644 index 0000000..07b2d7c --- /dev/null +++ b/demo3d/mod/menu.fnl @@ -0,0 +1,172 @@ +(local pxl8 (require :pxl8)) + +(var paused false) +(var gui nil) +(var current-panel :main) +(var selected-item nil) +(var current-items []) +(var pending-action nil) + +(var baked-lighting true) +(var dynamic-lighting true) +(var textures true) +(var wireframe false) + +(fn init [] + (set gui (pxl8.create_gui))) + +(fn show [] + (set paused true) + (set current-panel :main) + (pxl8.set_relative_mouse_mode false) + (pxl8.center_cursor)) + +(fn hide [] + (set paused false) + (pxl8.set_relative_mouse_mode true)) + +(fn toggle [] + (when (not gui) (init)) + (if paused + (hide) + (show))) + +(fn select-next [] + (when (> (length current-items) 0) + (var found-idx nil) + (for [i 1 (length current-items)] + (when (= (. current-items i) selected-item) + (set found-idx i))) + (if found-idx + (let [next-idx (+ found-idx 1)] + (if (<= next-idx (length current-items)) + (set selected-item (. current-items next-idx)) + (set selected-item (. current-items 1)))) + (set selected-item (. current-items 1))))) + +(fn select-prev [] + (when (> (length current-items) 0) + (var found-idx nil) + (for [i 1 (length current-items)] + (when (= (. current-items i) selected-item) + (set found-idx i))) + (if found-idx + (let [prev-idx (- found-idx 1)] + (if (>= prev-idx 1) + (set selected-item (. current-items prev-idx)) + (set selected-item (. current-items (length current-items))))) + (set selected-item (. current-items (length current-items)))))) + +(fn update [] + (set pending-action nil) + + (when gui + (let [(mx my) (pxl8.get_mouse_pos)] + (gui:cursor_move mx my)) + + (when (pxl8.mouse_pressed 1) + (gui:cursor_down)) + + (when (pxl8.mouse_released 1) + (gui:cursor_up)) + + (when (or (pxl8.key_pressed "down") + (and (pxl8.key_pressed "tab") (not (pxl8.key_down "lshift")) (not (pxl8.key_down "rshift")))) + (select-next)) + + (when (or (pxl8.key_pressed "up") + (and (pxl8.key_pressed "tab") (or (pxl8.key_down "lshift") (pxl8.key_down "rshift")))) + (select-prev)) + + (when (or (pxl8.key_pressed "return") (pxl8.key_pressed "space")) + (when selected-item + (set pending-action selected-item))))) + +(fn menu-button [id x y w h label] + (table.insert current-items label) + (when (= selected-item nil) + (set selected-item label)) + (let [is-selected (= selected-item label)] + (when is-selected + (pxl8.rect (- x 3) (- y 3) (+ w 6) (+ h 6) (pxl8.gui_color 4))) + (let [clicked (gui:button id x y w h label)] + (when clicked + (set selected-item label)) + (or clicked (and is-selected (= pending-action label)))))) + +(fn draw-main-menu [] + (pxl8.gui_window 200 80 240 200 "pxl8 demo") + + (when (menu-button 1 215 127 210 30 "Resume") + (hide)) + + (when (menu-button 5 215 162 210 30 "GFX") + (set current-panel :gfx) + (set selected-item nil)) + + (when (menu-button 6 215 197 210 30 "SFX") + (set current-panel :sfx) + (set selected-item nil)) + + (when (menu-button 2 215 232 210 30 "Quit") + (pxl8.quit))) + +(fn draw-sfx-panel [] + (pxl8.gui_window 200 100 240 145 "SFX") + + (pxl8.gui_label 215 147 "Volume/Devices: TODO" (pxl8.gui_color 4)) + + (when (menu-button 20 215 180 210 30 "Back") + (set current-panel :main) + (set selected-item nil))) + +(fn draw-gfx-panel [] + (pxl8.gui_window 200 60 240 195 "GFX") + + (let [baked-label (if baked-lighting "Baked Lighting: On" "Baked Lighting: Off")] + (when (menu-button 40 215 107 210 24 baked-label) + (set baked-lighting (not baked-lighting)))) + + (let [dynamic-label (if dynamic-lighting "Dynamic Lighting: On" "Dynamic Lighting: Off")] + (when (menu-button 41 215 134 210 24 dynamic-label) + (set dynamic-lighting (not dynamic-lighting)))) + + (let [tex-label (if textures "Textures: On" "Textures: Off")] + (when (menu-button 42 215 161 210 24 tex-label) + (set textures (not textures)))) + + (let [wire-label (if wireframe "Wireframe: On" "Wireframe: Off")] + (when (menu-button 43 215 188 210 24 wire-label) + (set wireframe (not wireframe)))) + + (when (menu-button 32 215 218 210 24 "Back") + (set current-panel :main) + (set selected-item nil))) + +(fn draw [] + (set current-items []) + (when gui + (gui:begin_frame) + + (case current-panel + :main (draw-main-menu) + :sfx (draw-sfx-panel) + :gfx (draw-gfx-panel)) + + (if (gui:is_hovering) + (pxl8.set_cursor :hand) + (pxl8.set_cursor :arrow)) + + (gui:end_frame))) + +{:init init + :is-paused (fn [] paused) + :is-baked-lighting (fn [] baked-lighting) + :is-dynamic-lighting (fn [] dynamic-lighting) + :is-textures (fn [] textures) + :is-wireframe (fn [] wireframe) + :toggle toggle + :show show + :hide hide + :update update + :draw draw} diff --git a/demo/mod/sky.fnl b/demo3d/mod/sky.fnl similarity index 100% rename from demo/mod/sky.fnl rename to demo3d/mod/sky.fnl diff --git a/demo/mod/textures.fnl b/demo3d/mod/textures.fnl similarity index 100% rename from demo/mod/textures.fnl rename to demo3d/mod/textures.fnl diff --git a/src/lua/pxl8/world.lua b/demo3d/mod/world.lua similarity index 72% rename from src/lua/pxl8/world.lua rename to demo3d/mod/world.lua index f2eab50..591517e 100644 --- a/src/lua/pxl8/world.lua +++ b/demo3d/mod/world.lua @@ -8,19 +8,19 @@ local Bsp = {} Bsp.__index = Bsp function Bsp:face_count() - return C.pxl8_bsp_face_count(self._ptr) + return C.demo3d_bsp_face_count(self._ptr) end function Bsp:face_normal(face_id) - return C.pxl8_bsp_face_normal(self._ptr, face_id) + return C.demo3d_bsp_face_normal(self._ptr, face_id) end function Bsp:light_at(x, y, z, ambient) - return C.pxl8_bsp_light_at(self._ptr, x, y, z, ambient or 0) + return C.demo3d_bsp_light_at(self._ptr, x, y, z, ambient or 0) end function Bsp:face_set_material(face_id, material_id) - C.pxl8_bsp_face_set_material(self._ptr, face_id, material_id) + C.demo3d_bsp_face_set_material(self._ptr, face_id, material_id) end world.Bsp = Bsp @@ -49,69 +49,69 @@ local World = {} World.__index = World function World.get() - local w = C.pxl8_get_world(core.sys) + local w = C.demo3d_get_world(core.sys) if w == nil then return nil end return setmetatable({ _ptr = w }, World) end function World:active_chunk() - local ptr = C.pxl8_world_active_chunk(self._ptr) + local ptr = C.demo3d_world_active_chunk(self._ptr) if ptr == nil then return nil end return setmetatable({ _ptr = ptr }, Chunk) end function World:init_local_player(x, y, z) - C.pxl8_world_init_local_player(self._ptr, x, y, z) + C.demo3d_world_init_local_player(self._ptr, x, y, z) end function World:set_look(yaw, pitch) - C.pxl8_world_set_look(self._ptr, yaw, pitch or 0) + C.demo3d_world_set_look(self._ptr, yaw, pitch or 0) end function World:local_player() - local ptr = C.pxl8_world_local_player(self._ptr) + local ptr = C.demo3d_world_local_player(self._ptr) if ptr == nil then return nil end return ptr end function World:point_solid(x, y, z) - return C.pxl8_world_point_solid(self._ptr, x, y, z) + return C.demo3d_world_point_solid(self._ptr, x, y, z) end function World:ray(from_x, from_y, from_z, to_x, to_y, to_z) local from = ffi.new("pxl8_vec3", {x = from_x, y = from_y, z = from_z}) local to = ffi.new("pxl8_vec3", {x = to_x, y = to_y, z = to_z}) - return C.pxl8_world_ray(self._ptr, from, to) + return C.demo3d_world_ray(self._ptr, from, to) end function World:render(camera_pos) local vec = ffi.new("pxl8_vec3", {x = camera_pos[1], y = camera_pos[2], z = camera_pos[3]}) - C.pxl8_world_render(self._ptr, core.gfx, vec) + C.demo3d_world_render(self._ptr, core.gfx, vec) end function World:set_bsp_material(material_id, material) - C.pxl8_world_set_bsp_material(self._ptr, material_id, material._ptr) + C.demo3d_world_set_bsp_material(self._ptr, material_id, material._ptr) end function World:sweep(from_x, from_y, from_z, to_x, to_y, to_z, radius) local from = ffi.new("pxl8_vec3", {x = from_x, y = from_y, z = from_z}) local to = ffi.new("pxl8_vec3", {x = to_x, y = to_y, z = to_z}) - return C.pxl8_world_sweep(self._ptr, from, to, radius) + return C.demo3d_world_sweep(self._ptr, from, to, radius) end function World:set_sim_config(config) - C.pxl8_world_set_sim_config(self._ptr, config) + C.demo3d_world_set_sim_config(self._ptr, config) end function World:push_input(input_msg) - C.pxl8_world_push_input(self._ptr, input_msg) + C.demo3d_world_push_input(self._ptr, input_msg) end world.World = World function world.sim_config(opts) opts = opts or {} - return ffi.new("pxl8_sim_config", { + return ffi.new("demo3d_sim_config", { move_speed = opts.move_speed or 180.0, ground_accel = opts.ground_accel or 10.0, air_accel = opts.air_accel or 1.0, @@ -126,28 +126,28 @@ function world.sim_config(opts) end function world.sim_move_player(entity, input_msg, sim_world, config, dt) - C.pxl8_sim_move_player(entity, input_msg, sim_world, config, dt) + C.demo3d_sim_move_player(entity, input_msg, sim_world, config, dt) end function world.sim_trace(sim_world, from_x, from_y, from_z, to_x, to_y, to_z, radius, height) local from = ffi.new("pxl8_vec3", {x = from_x, y = from_y, z = from_z}) local to = ffi.new("pxl8_vec3", {x = to_x, y = to_y, z = to_z}) - return C.pxl8_sim_trace(sim_world, from, to, radius, height) + return C.demo3d_sim_trace(sim_world, from, to, radius, height) end function world.sim_check_ground(sim_world, x, y, z, radius) local pos = ffi.new("pxl8_vec3", {x = x, y = y, z = z}) - return C.pxl8_sim_check_ground(sim_world, pos, radius) + return C.demo3d_sim_check_ground(sim_world, pos, radius) end function World:sim_world(x, y, z) local pos = ffi.new("pxl8_vec3", {x = x, y = y, z = z}) - return C.pxl8_world_sim_world(self._ptr, pos) + return C.demo3d_world_sim_world(self._ptr, pos) end function world.make_input_msg(opts) opts = opts or {} - return ffi.new("pxl8_input_msg", { + return ffi.new("demo3d_input_msg", { move_x = opts.move_x or 0, move_y = opts.move_y or 0, look_dx = opts.look_dx or 0, diff --git a/demo3d/res/palettes/palette.ase b/demo3d/res/palettes/palette.ase new file mode 100644 index 0000000..1e4a8ef Binary files /dev/null and b/demo3d/res/palettes/palette.ase differ diff --git a/demo3d/res/textures/door.ase b/demo3d/res/textures/door.ase new file mode 100644 index 0000000..ecd2ad4 Binary files /dev/null and b/demo3d/res/textures/door.ase differ diff --git a/pxl8d/.cargo/config.toml b/demo3d/server/.cargo/config.toml similarity index 100% rename from pxl8d/.cargo/config.toml rename to demo3d/server/.cargo/config.toml diff --git a/pxl8d/.gitignore b/demo3d/server/.gitignore similarity index 100% rename from pxl8d/.gitignore rename to demo3d/server/.gitignore diff --git a/pxl8d/Cargo.lock b/demo3d/server/Cargo.lock similarity index 99% rename from pxl8d/Cargo.lock rename to demo3d/server/Cargo.lock index cf54719..ee9194e 100644 --- a/pxl8d/Cargo.lock +++ b/demo3d/server/Cargo.lock @@ -73,6 +73,17 @@ dependencies = [ "libloading", ] +[[package]] +name = "demo3d-server" +version = "0.1.0" +dependencies = [ + "bindgen", + "cc", + "libc", + "libm", + "windows-sys", +] + [[package]] name = "either" version = "1.15.0" @@ -169,17 +180,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "pxl8d" -version = "0.1.0" -dependencies = [ - "bindgen", - "cc", - "libc", - "libm", - "windows-sys", -] - [[package]] name = "quote" version = "1.0.43" diff --git a/pxl8d/Cargo.toml b/demo3d/server/Cargo.toml similarity index 90% rename from pxl8d/Cargo.toml rename to demo3d/server/Cargo.toml index 23bcb8c..6579eca 100644 --- a/pxl8d/Cargo.toml +++ b/demo3d/server/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "pxl8d" +name = "demo3d-server" version = "0.1.0" edition = "2024" [lib] -name = "pxl8d" +name = "demo3d_server" [build-dependencies] bindgen = "0.72" @@ -23,7 +23,7 @@ windows-sys = { version = "0.61", default-features = false, features = [ ] } [[bin]] -name = "pxl8d" +name = "demo3d-server" path = "src/main.rs" [profile.dev] diff --git a/demo3d/server/build.rs b/demo3d/server/build.rs new file mode 100644 index 0000000..424a648 --- /dev/null +++ b/demo3d/server/build.rs @@ -0,0 +1,68 @@ +use std::env; +use std::path::PathBuf; + +fn main() { + let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + let root = PathBuf::from(&manifest_dir).join("../.."); + let framework_src = root.join("src"); + let game_client = root.join("demo3d/client"); + + println!("cargo:rerun-if-changed=../client/bsp/demo3d_bsp.h"); + println!("cargo:rerun-if-changed=../client/protocol/demo3d_protocol.c"); + println!("cargo:rerun-if-changed=../client/protocol/demo3d_protocol.h"); + println!("cargo:rerun-if-changed=../client/sim/demo3d_sim.c"); + println!("cargo:rerun-if-changed=../client/sim/demo3d_sim.h"); + println!("cargo:rerun-if-changed=../../src/core/pxl8_log.c"); + println!("cargo:rerun-if-changed=../../src/core/pxl8_log.h"); + println!("cargo:rerun-if-changed=../../src/core/pxl8_types.h"); + println!("cargo:rerun-if-changed=../../src/math/pxl8_math.c"); + println!("cargo:rerun-if-changed=../../src/math/pxl8_math.h"); + + cc::Build::new() + .file(framework_src.join("core/pxl8_log.c")) + .file(framework_src.join("platform/pxl8_mem.c")) + .file(framework_src.join("math/pxl8_math.c")) + .file(framework_src.join("math/pxl8_noise.c")) + .file(game_client.join("sim/demo3d_sim.c")) + .include(framework_src.join("core")) + .include(framework_src.join("math")) + .include(framework_src.join("platform")) + .include(game_client.join("bsp")) + .include(game_client.join("net")) + .include(game_client.join("sim")) + .compile("pxl8"); + + let bindings = bindgen::Builder::default() + .header(framework_src.join("core/pxl8_log.h").to_str().unwrap()) + .header(framework_src.join("math/pxl8_noise.h").to_str().unwrap()) + .header(game_client.join("sim/demo3d_sim.h").to_str().unwrap()) + .clang_arg(format!("-I{}", framework_src.join("core").display())) + .clang_arg(format!("-I{}", framework_src.join("math").display())) + .clang_arg(format!("-I{}", framework_src.join("platform").display())) + .clang_arg(format!("-I{}", game_client.join("bsp").display())) + .clang_arg(format!("-I{}", game_client.join("net").display())) + .clang_arg(format!("-I{}", game_client.join("sim").display())) + .blocklist_item("FP_NAN") + .blocklist_item("FP_INFINITE") + .blocklist_item("FP_ZERO") + .blocklist_item("FP_SUBNORMAL") + .blocklist_item("FP_NORMAL") + .blocklist_type("pxl8_vec2") + .blocklist_type("pxl8_vec3") + .blocklist_type("pxl8_vec4") + .blocklist_type("pxl8_mat4") + .blocklist_item(".*_simd.*") + .blocklist_item("PXL8_SIMD.*") + .blocklist_type("__m128.*") + .blocklist_type(".*32x4_t|.*16x8_t") + .raw_line("pub use crate::math::{pxl8_vec2, pxl8_vec3, pxl8_vec4, pxl8_mat4};") + .use_core() + .rustified_enum(".*") + .generate() + .expect("Unable to generate bindings"); + + let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + bindings + .write_to_file(out_path.join("bindings.rs")) + .expect("Couldn't write bindings"); +} diff --git a/pxl8d/rust-toolchain.toml b/demo3d/server/rust-toolchain.toml similarity index 100% rename from pxl8d/rust-toolchain.toml rename to demo3d/server/rust-toolchain.toml diff --git a/pxl8d/src/allocator.rs b/demo3d/server/src/allocator.rs similarity index 100% rename from pxl8d/src/allocator.rs rename to demo3d/server/src/allocator.rs diff --git a/pxl8d/src/bsp.rs b/demo3d/server/src/bsp.rs similarity index 93% rename from pxl8d/src/bsp.rs rename to demo3d/server/src/bsp.rs index 9653d62..a7a3e20 100644 --- a/pxl8d/src/bsp.rs +++ b/demo3d/server/src/bsp.rs @@ -2,16 +2,16 @@ use alloc::boxed::Box; use alloc::vec::Vec; use crate::math::Vec3; -use crate::pxl8::*; +use crate::bindings::*; -pub type Vertex = pxl8_bsp_vertex; -pub type Edge = pxl8_bsp_edge; -pub type Face = pxl8_bsp_face; -pub type Plane = pxl8_bsp_plane; -pub type Node = pxl8_bsp_node; -pub type Leaf = pxl8_bsp_leaf; -pub type Portal = pxl8_bsp_portal; -pub type CellPortals = pxl8_bsp_cell_portals; +pub type Vertex = demo3d_bsp_vertex; +pub type Edge = demo3d_bsp_edge; +pub type Face = demo3d_bsp_face; +pub type Plane = demo3d_bsp_plane; +pub type Node = demo3d_bsp_node; +pub type Leaf = demo3d_bsp_leaf; +pub type Portal = demo3d_bsp_portal; +pub type CellPortals = demo3d_bsp_cell_portals; impl Default for Edge { fn default() -> Self { @@ -132,7 +132,7 @@ impl Clone for Vertex { } pub struct Bsp { - inner: pxl8_bsp, + inner: demo3d_bsp, pub cell_portals: Box<[CellPortals]>, pub edges: Box<[Edge]>, pub faces: Box<[Face]>, @@ -193,7 +193,7 @@ impl From for Bsp { let visdata = b.visdata.into_boxed_slice(); let heightfield = b.heightfield.into_boxed_slice(); - let inner = pxl8_bsp { + let inner = demo3d_bsp { cell_portals: if cell_portals.is_empty() { core::ptr::null_mut() } else { cell_portals.as_ptr() as *mut _ }, edges: if edges.is_empty() { core::ptr::null_mut() } else { edges.as_ptr() as *mut _ }, faces: if faces.is_empty() { core::ptr::null_mut() } else { faces.as_ptr() as *mut _ }, @@ -254,12 +254,12 @@ impl From for Bsp { } impl Bsp { - pub fn as_c_bsp(&self) -> &pxl8_bsp { + pub fn as_c_bsp(&self) -> &demo3d_bsp { &self.inner } pub fn trace(&self, from: Vec3, to: Vec3, radius: f32) -> Vec3 { - unsafe { pxl8_bsp_trace(&self.inner, from, to, radius) } + unsafe { demo3d_bsp_trace(&self.inner, from, to, radius) } } } diff --git a/pxl8d/src/chunk.rs b/demo3d/server/src/chunk.rs similarity index 100% rename from pxl8d/src/chunk.rs rename to demo3d/server/src/chunk.rs diff --git a/pxl8d/src/chunk/stream.rs b/demo3d/server/src/chunk/stream.rs similarity index 100% rename from pxl8d/src/chunk/stream.rs rename to demo3d/server/src/chunk/stream.rs diff --git a/pxl8d/src/lib.rs b/demo3d/server/src/lib.rs similarity index 86% rename from pxl8d/src/lib.rs rename to demo3d/server/src/lib.rs index 032aa31..ac7d5fa 100644 --- a/pxl8d/src/lib.rs +++ b/demo3d/server/src/lib.rs @@ -23,8 +23,8 @@ fn panic(_info: &PanicInfo) -> ! { } #[allow(dead_code, non_camel_case_types, non_snake_case, non_upper_case_globals)] -pub mod pxl8 { - include!(concat!(env!("OUT_DIR"), "/pxl8.rs")); +pub mod bindings { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } pub use bsp::*; @@ -32,7 +32,7 @@ pub use chunk::*; pub use chunk::stream::*; pub use math::*; pub use procgen::generate_chunk; -pub use pxl8::*; +pub use bindings::*; pub use sim::*; pub use transport::*; pub use world::*; diff --git a/pxl8d/src/log.rs b/demo3d/server/src/log.rs similarity index 89% rename from pxl8d/src/log.rs rename to demo3d/server/src/log.rs index f77ed0c..bd33e33 100644 --- a/pxl8d/src/log.rs +++ b/demo3d/server/src/log.rs @@ -1,9 +1,9 @@ -use crate::pxl8::{pxl8_log, pxl8_log_init}; +use crate::bindings::{pxl8_log, pxl8_log_init}; use core::ffi::c_char; static mut G_LOG: pxl8_log = pxl8_log { handler: None, - level: crate::pxl8::pxl8_log_level::PXL8_LOG_LEVEL_DEBUG, + level: crate::bindings::pxl8_log_level::PXL8_LOG_LEVEL_DEBUG, }; pub fn init() { @@ -20,7 +20,7 @@ macro_rules! pxl8_debug { let _ = ::core::write!(&mut buf, $($arg)*); buf.push(0); unsafe { - $crate::pxl8::pxl8_log_write_debug( + $crate::bindings::pxl8_log_write_debug( concat!(file!(), "\0").as_ptr() as *const ::core::ffi::c_char, line!() as ::core::ffi::c_int, c"%s".as_ptr() as *const ::core::ffi::c_char, @@ -38,7 +38,7 @@ macro_rules! pxl8_error { let _ = ::core::write!(&mut buf, $($arg)*); buf.push(0); unsafe { - $crate::pxl8::pxl8_log_write_error( + $crate::bindings::pxl8_log_write_error( concat!(file!(), "\0").as_ptr() as *const ::core::ffi::c_char, line!() as ::core::ffi::c_int, c"%s".as_ptr() as *const ::core::ffi::c_char, @@ -56,7 +56,7 @@ macro_rules! pxl8_info { let _ = ::core::write!(&mut buf, $($arg)*); buf.push(0); unsafe { - $crate::pxl8::pxl8_log_write_info( + $crate::bindings::pxl8_log_write_info( c"%s".as_ptr() as *const ::core::ffi::c_char, buf.as_ptr(), ); @@ -72,7 +72,7 @@ macro_rules! pxl8_trace { let _ = ::core::write!(&mut buf, $($arg)*); buf.push(0); unsafe { - $crate::pxl8::pxl8_log_write_trace( + $crate::bindings::pxl8_log_write_trace( concat!(file!(), "\0").as_ptr() as *const ::core::ffi::c_char, line!() as ::core::ffi::c_int, c"%s".as_ptr() as *const ::core::ffi::c_char, @@ -90,7 +90,7 @@ macro_rules! pxl8_warn { let _ = ::core::write!(&mut buf, $($arg)*); buf.push(0); unsafe { - $crate::pxl8::pxl8_log_write_warn( + $crate::bindings::pxl8_log_write_warn( concat!(file!(), "\0").as_ptr() as *const ::core::ffi::c_char, line!() as ::core::ffi::c_int, c"%s".as_ptr() as *const ::core::ffi::c_char, diff --git a/pxl8d/src/main.rs b/demo3d/server/src/main.rs similarity index 94% rename from pxl8d/src/main.rs rename to demo3d/server/src/main.rs index 2fb3993..be3910e 100644 --- a/pxl8d/src/main.rs +++ b/demo3d/server/src/main.rs @@ -4,11 +4,11 @@ extern crate alloc; use alloc::vec::Vec; -use pxl8d::*; -use pxl8d::chunk::ChunkId; -use pxl8d::chunk::stream::ClientChunkState; -use pxl8d::pxl8::pxl8_cmd_type::*; -use pxl8d::pxl8::pxl8_msg_type::*; +use demo3d_server::*; +use demo3d_server::chunk::ChunkId; +use demo3d_server::chunk::stream::ClientChunkState; +use demo3d_server::bindings::demo3d_cmd_type::*; +use demo3d_server::bindings::demo3d_msg_type::*; const TICK_RATE: u64 = 30; const TICK_NS: u64 = 1_000_000_000 / TICK_RATE; @@ -82,11 +82,11 @@ pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { let mut sequence: u32 = 0; let mut last_tick = get_time_ns(); - let mut entities_buf = [pxl8d::pxl8_entity_state { + let mut entities_buf = [demo3d_server::demo3d_entity_state { entity_id: 0, userdata: [0u8; 56], }; 64]; - let mut inputs_buf: [pxl8d::pxl8_input_msg; 16] = unsafe { core::mem::zeroed() }; + let mut inputs_buf: [demo3d_server::demo3d_input_msg; 16] = unsafe { core::mem::zeroed() }; loop { let now = get_time_ns(); @@ -96,15 +96,15 @@ pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { last_tick = now; let dt = (elapsed as f32) / 1_000_000_000.0; - let mut latest_input: Option = None; + let mut latest_input: Option = None; while let Some(msg_type) = transport.recv() { match msg_type { - x if x == PXL8_MSG_INPUT as u8 => { + x if x == DEMO3D_MSG_INPUT as u8 => { latest_input = Some(transport.get_input()); } - x if x == PXL8_MSG_COMMAND as u8 => { + x if x == DEMO3D_MSG_COMMAND as u8 => { let cmd = transport.get_command(); - if cmd.cmd_type == PXL8_CMD_SPAWN_ENTITY as u16 { + if cmd.cmd_type == DEMO3D_CMD_SPAWN_ENTITY as u16 { let (x, y, z, _yaw, _pitch) = extract_spawn_position(&cmd.payload); player_id = Some(sim.spawn_player(x, y, z) as u64); } @@ -129,7 +129,7 @@ pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { } }); - let header = pxl8d::pxl8_snapshot_header { + let header = demo3d_server::demo3d_snapshot_header { entity_count: count as u16, event_count: 0, player_id: player_id.unwrap_or(0), diff --git a/pxl8d/src/math.rs b/demo3d/server/src/math.rs similarity index 100% rename from pxl8d/src/math.rs rename to demo3d/server/src/math.rs diff --git a/pxl8d/src/procgen.rs b/demo3d/server/src/procgen.rs similarity index 99% rename from pxl8d/src/procgen.rs rename to demo3d/server/src/procgen.rs index eaadc9b..21a5281 100644 --- a/pxl8d/src/procgen.rs +++ b/demo3d/server/src/procgen.rs @@ -1401,7 +1401,7 @@ fn grid_to_bsp_exterior(bsp: &mut BspBuilder, grid: &RoomGrid, origin_x: f32, or let wx = origin_x + vx as f32 * CELL_SIZE; let wz = origin_z + vz as f32 * CELL_SIZE; let h = unsafe { - crate::pxl8::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) + crate::bindings::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) }; let blend = edge_blend(wx, wz, world_seed); corner_heights[vz as usize * vw + vx as usize] = h * 128.0 * blend; @@ -1878,7 +1878,7 @@ pub fn generate_rooms(params: &ProcgenParams, doorways: &[Doorway], entries: &[C for vx in 0..vw as i32 { let wx = params.origin_x + vx as f32 * CELL_SIZE; let wz = params.origin_z + vz as f32 * CELL_SIZE; - let h = unsafe { crate::pxl8::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) }; + let h = unsafe { crate::bindings::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) }; let blend = edge_blend(wx, wz, world_seed); bsp.heightfield[vz as usize * vw + vx as usize] = h * 128.0 * blend; } @@ -2046,7 +2046,7 @@ pub fn generate_courtyard(params: &ProcgenParams, entries: &[ChunkEntry], world_ for vx in 0..vw as i32 { let wx = params.origin_x + vx as f32 * CELL_SIZE; let wz = params.origin_z + vz as f32 * CELL_SIZE; - let h = unsafe { crate::pxl8::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) }; + let h = unsafe { crate::bindings::pxl8_fbm(wx * 0.002, wz * 0.002, world_seed + 5000, 4) }; let blend = edge_blend(wx, wz, world_seed); bsp.heightfield[vz as usize * vw + vx as usize] = h * 128.0 * blend; } @@ -2087,7 +2087,7 @@ pub fn select_biome(cx: i32, cz: i32, seed: u64) -> Biome { if cx == 0 && cz == 0 { return Biome::Dungeon; } if cx == 1 && cz == 0 { return Biome::Courtyard; } - let n = unsafe { crate::pxl8::pxl8_fbm(cx as f32 * 0.1, cz as f32 * 0.1, seed, 3) }; + let n = unsafe { crate::bindings::pxl8_fbm(cx as f32 * 0.1, cz as f32 * 0.1, seed, 3) }; if n < 0.4 { Biome::Dungeon } else { diff --git a/pxl8d/src/sim.rs b/demo3d/server/src/sim.rs similarity index 89% rename from pxl8d/src/sim.rs rename to demo3d/server/src/sim.rs index 01caf43..5131efc 100644 --- a/pxl8d/src/sim.rs +++ b/demo3d/server/src/sim.rs @@ -2,13 +2,13 @@ use alloc::vec::Vec; use crate::chunk::ChunkId; use crate::math::Vec3; -use crate::pxl8::*; +use crate::bindings::*; use crate::world::World; -pub type Entity = pxl8_sim_entity; +pub type Entity = demo3d_sim_entity; -const ALIVE: u32 = PXL8_SIM_FLAG_ALIVE; -const PLAYER: u32 = PXL8_SIM_FLAG_PLAYER; +const ALIVE: u32 = DEMO3D_SIM_FLAG_ALIVE; +const PLAYER: u32 = DEMO3D_SIM_FLAG_PLAYER; const MAX_ENTITIES: usize = 1024; @@ -95,7 +95,7 @@ impl Simulation { id } - pub fn step(&mut self, inputs: &[pxl8_input_msg], dt: f32) { + pub fn step(&mut self, inputs: &[demo3d_input_msg], dt: f32) { self.tick += 1; self.time += dt; @@ -106,8 +106,8 @@ impl Simulation { self.integrate(dt); } - fn sim_config() -> pxl8_sim_config { - pxl8_sim_config { + fn sim_config() -> demo3d_sim_config { + demo3d_sim_config { move_speed: 180.0, ground_accel: 10.0, air_accel: 1.0, @@ -121,12 +121,12 @@ impl Simulation { } } - fn make_sim_world(&self, player_pos: Vec3) -> pxl8_sim_world { + fn make_sim_world(&self, player_pos: Vec3) -> demo3d_sim_world { let chunk_size: f32 = 16.0 * 64.0; let center_cx = libm::floorf(player_pos.x / chunk_size) as i32; let center_cz = libm::floorf(player_pos.z / chunk_size) as i32; - let mut sim = pxl8_sim_world { + let mut sim = demo3d_sim_world { chunks: [core::ptr::null(); 9], center_cx, center_cz, @@ -160,12 +160,12 @@ impl Simulation { let world = self.make_sim_world(ent.pos); let ent = &mut self.entities[i]; unsafe { - pxl8_sim_integrate(ent, &world, &cfg, dt); + demo3d_sim_integrate(ent, &world, &cfg, dt); } } } - fn move_player(&mut self, input: &pxl8_input_msg, dt: f32) { + fn move_player(&mut self, input: &demo3d_input_msg, dt: f32) { let cfg = Self::sim_config(); let Some(id) = self.player else { return }; let ent = &self.entities[id as usize]; @@ -176,20 +176,20 @@ impl Simulation { let world = self.make_sim_world(ent.pos); let ent = &mut self.entities[id as usize]; unsafe { - pxl8_sim_move_player(ent, input, &world, &cfg, dt); + demo3d_sim_move_player(ent, input, &world, &cfg, dt); } } pub fn generate_snapshot(&self, mut writer: F) where - F: FnMut(&pxl8_entity_state), + F: FnMut(&demo3d_entity_state), { for (i, ent) in self.entities.iter().enumerate() { if ent.flags & ALIVE == 0 { continue; } - let mut state = pxl8_entity_state { + let mut state = demo3d_entity_state { entity_id: i as u64, userdata: [0u8; 56], }; diff --git a/pxl8d/src/transport.rs b/demo3d/server/src/transport.rs similarity index 91% rename from pxl8d/src/transport.rs rename to demo3d/server/src/transport.rs index d8451cd..fbd1e3e 100644 --- a/pxl8d/src/transport.rs +++ b/demo3d/server/src/transport.rs @@ -1,7 +1,7 @@ use alloc::vec; use alloc::vec::Vec; -use crate::pxl8::*; -use crate::pxl8::pxl8_msg_type::*; +use crate::bindings::*; +use crate::bindings::demo3d_msg_type::*; pub const DEFAULT_PORT: u16 = 7777; pub const CHUNK_MAX_PAYLOAD: usize = 1400; pub const CHUNK_FLAG_FINAL: u8 = 0x04; @@ -308,7 +308,7 @@ impl Transport { let mut addr: SockAddr = unsafe { core::mem::zeroed() }; let len = sys::recvfrom(self.socket, &mut self.recv_buf, &mut addr); - if len <= 0 || (len as usize) < size_of::() { + if len <= 0 || (len as usize) < size_of::() { return None; } @@ -319,18 +319,18 @@ impl Transport { Some(header.type_) } - pub fn get_input(&self) -> pxl8_input_msg { + pub fn get_input(&self) -> demo3d_input_msg { self.deserialize_input() } - pub fn get_command(&self) -> pxl8_command_msg { + pub fn get_command(&self) -> demo3d_command_msg { self.deserialize_command() } pub fn send_snapshot( &mut self, - header: &pxl8_snapshot_header, - entities: &[pxl8_entity_state], + header: &demo3d_snapshot_header, + entities: &[demo3d_entity_state], sequence: u32, ) { if !self.has_client { @@ -339,11 +339,11 @@ impl Transport { let mut offset = 0; - let msg_header = pxl8_msg_header { + let msg_header = demo3d_msg_header { sequence, size: 0, - type_: PXL8_MSG_SNAPSHOT as u8, - version: PXL8_PROTOCOL_VERSION as u8, + type_: DEMO3D_MSG_SNAPSHOT as u8, + version: DEMO3D_PROTOCOL_VERSION as u8, }; offset += self.serialize_header(&msg_header, offset); offset += self.serialize_snapshot_header(header, offset); @@ -362,11 +362,11 @@ impl Transport { let mut offset = 0; - let msg_header = pxl8_msg_header { + let msg_header = demo3d_msg_header { sequence, size: 0, - type_: PXL8_MSG_CHUNK as u8, - version: PXL8_PROTOCOL_VERSION as u8, + type_: DEMO3D_MSG_CHUNK as u8, + version: DEMO3D_PROTOCOL_VERSION as u8, }; offset += self.serialize_header(&msg_header, offset); offset += self.serialize_chunk_msg_header(msg, offset); @@ -385,11 +385,11 @@ impl Transport { let mut offset = 0; - let msg_header = pxl8_msg_header { + let msg_header = demo3d_msg_header { sequence, size: 0, - type_: PXL8_MSG_CHUNK_ENTER as u8, - version: PXL8_PROTOCOL_VERSION as u8, + type_: DEMO3D_MSG_CHUNK_ENTER as u8, + version: DEMO3D_PROTOCOL_VERSION as u8, }; offset += self.serialize_header(&msg_header, offset); @@ -418,7 +418,7 @@ impl Transport { 28 } - fn serialize_header(&mut self, h: &pxl8_msg_header, offset: usize) -> usize { + fn serialize_header(&mut self, h: &demo3d_msg_header, offset: usize) -> usize { let buf = &mut self.send_buf[offset..]; buf[0..4].copy_from_slice(&h.sequence.to_be_bytes()); buf[4..6].copy_from_slice(&h.size.to_be_bytes()); @@ -427,7 +427,7 @@ impl Transport { 8 } - fn serialize_snapshot_header(&mut self, h: &pxl8_snapshot_header, offset: usize) -> usize { + fn serialize_snapshot_header(&mut self, h: &demo3d_snapshot_header, offset: usize) -> usize { let buf = &mut self.send_buf[offset..]; buf[0..2].copy_from_slice(&h.entity_count.to_be_bytes()); buf[2..4].copy_from_slice(&h.event_count.to_be_bytes()); @@ -437,16 +437,16 @@ impl Transport { 24 } - fn serialize_entity_state(&mut self, e: &pxl8_entity_state, offset: usize) -> usize { + fn serialize_entity_state(&mut self, e: &demo3d_entity_state, offset: usize) -> usize { let buf = &mut self.send_buf[offset..]; buf[0..8].copy_from_slice(&e.entity_id.to_be_bytes()); buf[8..64].copy_from_slice(&e.userdata); 64 } - fn deserialize_header(&self) -> pxl8_msg_header { + fn deserialize_header(&self) -> demo3d_msg_header { let buf = &self.recv_buf; - pxl8_msg_header { + demo3d_msg_header { sequence: u32::from_be_bytes([buf[0], buf[1], buf[2], buf[3]]), size: u16::from_be_bytes([buf[4], buf[5]]), type_: buf[6], @@ -454,9 +454,9 @@ impl Transport { } } - fn deserialize_input(&self) -> pxl8_input_msg { + fn deserialize_input(&self) -> demo3d_input_msg { let buf = &self.recv_buf[8..]; - pxl8_input_msg { + demo3d_input_msg { buttons: u32::from_be_bytes([buf[0], buf[1], buf[2], buf[3]]), look_dx: f32::from_be_bytes([buf[4], buf[5], buf[6], buf[7]]), look_dy: f32::from_be_bytes([buf[8], buf[9], buf[10], buf[11]]), @@ -468,9 +468,9 @@ impl Transport { } } - fn deserialize_command(&self) -> pxl8_command_msg { + fn deserialize_command(&self) -> demo3d_command_msg { let buf = &self.recv_buf[8..]; - let mut cmd = pxl8_command_msg { + let mut cmd = demo3d_command_msg { cmd_type: u16::from_be_bytes([buf[0], buf[1]]), payload: [0u8; 64], payload_size: u16::from_be_bytes([buf[66], buf[67]]), diff --git a/pxl8d/src/world.rs b/demo3d/server/src/world.rs similarity index 100% rename from pxl8d/src/world.rs rename to demo3d/server/src/world.rs diff --git a/pxl8d/build.rs b/pxl8d/build.rs deleted file mode 100644 index 6f3a44c..0000000 --- a/pxl8d/build.rs +++ /dev/null @@ -1,64 +0,0 @@ -use std::env; -use std::path::PathBuf; - -fn main() { - let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let pxl8_src = PathBuf::from(&manifest_dir).join("../src"); - - println!("cargo:rerun-if-changed=../src/bsp/pxl8_bsp.h"); - println!("cargo:rerun-if-changed=../src/core/pxl8_log.c"); - println!("cargo:rerun-if-changed=../src/core/pxl8_log.h"); - println!("cargo:rerun-if-changed=../src/core/pxl8_types.h"); - println!("cargo:rerun-if-changed=../src/math/pxl8_math.c"); - println!("cargo:rerun-if-changed=../src/math/pxl8_math.h"); - println!("cargo:rerun-if-changed=../src/net/pxl8_protocol.c"); - println!("cargo:rerun-if-changed=../src/net/pxl8_protocol.h"); - println!("cargo:rerun-if-changed=../src/sim/pxl8_sim.c"); - println!("cargo:rerun-if-changed=../src/sim/pxl8_sim.h"); - cc::Build::new() - .file(pxl8_src.join("core/pxl8_log.c")) - .file(pxl8_src.join("hal/pxl8_mem.c")) - .file(pxl8_src.join("math/pxl8_math.c")) - .file(pxl8_src.join("math/pxl8_noise.c")) - .file(pxl8_src.join("sim/pxl8_sim.c")) - .include(pxl8_src.join("bsp")) - .include(pxl8_src.join("core")) - .include(pxl8_src.join("hal")) - .include(pxl8_src.join("math")) - .include(pxl8_src.join("net")) - .include(pxl8_src.join("sim")) - .compile("pxl8"); - - let bindings = bindgen::Builder::default() - .header(pxl8_src.join("core/pxl8_log.h").to_str().unwrap()) - .header(pxl8_src.join("math/pxl8_noise.h").to_str().unwrap()) - .header(pxl8_src.join("sim/pxl8_sim.h").to_str().unwrap()) - .clang_arg(format!("-I{}", pxl8_src.join("bsp").display())) - .clang_arg(format!("-I{}", pxl8_src.join("core").display())) - .clang_arg(format!("-I{}", pxl8_src.join("math").display())) - .clang_arg(format!("-I{}", pxl8_src.join("net").display())) - .clang_arg(format!("-I{}", pxl8_src.join("sim").display())) - .blocklist_item("FP_NAN") - .blocklist_item("FP_INFINITE") - .blocklist_item("FP_ZERO") - .blocklist_item("FP_SUBNORMAL") - .blocklist_item("FP_NORMAL") - .blocklist_type("pxl8_vec2") - .blocklist_type("pxl8_vec3") - .blocklist_type("pxl8_vec4") - .blocklist_type("pxl8_mat4") - .blocklist_item(".*_simd.*") - .blocklist_item("PXL8_SIMD.*") - .blocklist_type("__m128.*") - .blocklist_type(".*32x4_t|.*16x8_t") - .raw_line("pub use crate::math::{pxl8_vec2, pxl8_vec3, pxl8_vec4, pxl8_mat4};") - .use_core() - .rustified_enum(".*") - .generate() - .expect("Unable to generate bindings"); - - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - bindings - .write_to_file(out_path.join("pxl8.rs")) - .expect("Couldn't write bindings"); -} diff --git a/src/asset/pxl8_embed.h b/src/asset/pxl8_embed.h index b33b40d..e2584e7 100644 --- a/src/asset/pxl8_embed.h +++ b/src/asset/pxl8_embed.h @@ -67,10 +67,6 @@ static const char embed_pxl8_transition[] = { #embed "src/lua/pxl8/transition.lua" , 0 }; -static const char embed_pxl8_world[] = { -#embed "src/lua/pxl8/world.lua" -, 0 }; - #define PXL8_EMBED_ENTRY(var, name) {name, var, sizeof(var) - 1} typedef struct { const char* name; const char* data; u32 size; } pxl8_embed; @@ -92,7 +88,6 @@ static const pxl8_embed pxl8_embeds[] = { PXL8_EMBED_ENTRY(embed_pxl8_sfx, "pxl8.sfx"), PXL8_EMBED_ENTRY(embed_pxl8_tilemap, "pxl8.tilemap"), PXL8_EMBED_ENTRY(embed_pxl8_transition, "pxl8.transition"), - PXL8_EMBED_ENTRY(embed_pxl8_world, "pxl8.world"), {0} }; diff --git a/src/bsp/pxl8_bsp.h b/src/bsp/pxl8_bsp.h deleted file mode 100644 index 3fdb06b..0000000 --- a/src/bsp/pxl8_bsp.h +++ /dev/null @@ -1,162 +0,0 @@ -#pragma once - -#include "pxl8_math.h" -#include "pxl8_types.h" - -typedef struct pxl8_bsp_edge { - u16 vertex[2]; -} pxl8_bsp_edge; - -typedef struct pxl8_bsp_face { - u32 first_edge; - u32 lightmap_offset; - u16 num_edges; - u16 plane_id; - u16 side; - - u8 styles[4]; - u16 material_id; - - pxl8_vec3 aabb_min; - pxl8_vec3 aabb_max; -} pxl8_bsp_face; - -typedef struct pxl8_bsp_leaf { - u8 ambient_level[4]; - i32 contents; - - u16 first_marksurface; - i16 maxs[3]; - i16 mins[3]; - u16 num_marksurfaces; - - i32 visofs; -} pxl8_bsp_leaf; - -typedef struct pxl8_bsp_model { - i32 first_face; - i32 headnode[4]; - f32 maxs[3]; - f32 mins[3]; - i32 num_faces; - - pxl8_vec3 origin; - i32 visleafs; -} pxl8_bsp_model; - -typedef struct pxl8_bsp_node { - i32 children[2]; - - u16 first_face; - i16 maxs[3]; - i16 mins[3]; - u16 num_faces; - - u32 plane_id; -} pxl8_bsp_node; - -typedef struct pxl8_bsp_plane { - f32 dist; - pxl8_vec3 normal; - i32 type; -} pxl8_bsp_plane; - - -typedef struct pxl8_bsp_vertex { - pxl8_vec3 position; -} pxl8_bsp_vertex; - -typedef struct pxl8_bsp_lightmap { - u8 color[3]; - u8 height; - u32 offset; - u8 width; -} pxl8_bsp_lightmap; - -typedef struct pxl8_bsp_lightmap_sample { - u8 b; - u8 g; - u8 r; -} pxl8_bsp_lightmap_sample; - -typedef struct pxl8_bsp_pvs { - u8* data; - u32 size; -} pxl8_bsp_pvs; - -typedef struct pxl8_bsp_portal { - f32 x0, z0; - f32 x1, z1; - u32 target_leaf; -} pxl8_bsp_portal; - -typedef struct pxl8_bsp_cell_portals { - pxl8_bsp_portal portals[4]; - u8 num_portals; -} pxl8_bsp_cell_portals; - -typedef struct pxl8_bsp { - pxl8_bsp_cell_portals* cell_portals; - pxl8_bsp_edge* edges; - pxl8_bsp_face* faces; - pxl8_bsp_leaf* leafs; - u8* lightdata; - pxl8_bsp_lightmap* lightmaps; - u16* marksurfaces; - pxl8_bsp_model* models; - pxl8_bsp_node* nodes; - pxl8_bsp_plane* planes; - i32* surfedges; - u32* vertex_lights; - pxl8_bsp_vertex* vertices; - u8* visdata; - f32* heightfield; - - u32 lightdata_size; - u32 num_cell_portals; - u32 num_edges; - u32 num_faces; - u32 num_leafs; - u32 num_lightmaps; - u32 num_marksurfaces; - u32 num_models; - u32 num_nodes; - u32 num_planes; - u32 num_surfedges; - u32 num_vertex_lights; - u32 num_vertices; - u32 num_heightfield; - f32 heightfield_ox; - f32 heightfield_oz; - f32 heightfield_cell_size; - u16 heightfield_w; - u16 heightfield_h; - u32 visdata_size; - f32 bounds_min_x; - f32 bounds_min_z; - f32 bounds_max_x; - f32 bounds_max_z; -} pxl8_bsp; - -#ifdef __cplusplus -extern "C" { -#endif - -pxl8_bsp_pvs pxl8_bsp_decompress_pvs(const pxl8_bsp* bsp, i32 leaf); -void pxl8_bsp_destroy(pxl8_bsp* bsp); -u32 pxl8_bsp_face_count(const pxl8_bsp* bsp); -pxl8_vec3 pxl8_bsp_face_normal(const pxl8_bsp* bsp, u32 face_id); -void pxl8_bsp_face_set_material(pxl8_bsp* bsp, u32 face_id, u16 material_id); -i32 pxl8_bsp_find_leaf(const pxl8_bsp* bsp, pxl8_vec3 pos); -bool pxl8_bsp_is_leaf_visible(const pxl8_bsp* bsp, i32 leaf_from, i32 leaf_to); -pxl8_bsp_lightmap pxl8_bsp_lightmap_mapped(u8 width, u8 height, u32 offset); -pxl8_bsp_lightmap pxl8_bsp_lightmap_uniform(u8 r, u8 g, u8 b); -pxl8_result pxl8_bsp_load(const char* path, pxl8_bsp* bsp); -void pxl8_bsp_pvs_destroy(pxl8_bsp_pvs* pvs); -bool pxl8_bsp_pvs_is_visible(const pxl8_bsp_pvs* pvs, i32 leaf); -u8 pxl8_bsp_light_at(const pxl8_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient); -pxl8_bsp_lightmap_sample pxl8_bsp_sample_lightmap(const pxl8_bsp* bsp, u32 face_idx, f32 u, f32 v); - -#ifdef __cplusplus -} -#endif diff --git a/src/bsp/pxl8_bsp_render.h b/src/bsp/pxl8_bsp_render.h deleted file mode 100644 index 7002343..0000000 --- a/src/bsp/pxl8_bsp_render.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "pxl8_bsp.h" -#include "pxl8_gfx.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pxl8_bsp_render_state { - pxl8_gfx_material* materials; - u8* render_face_flags; - u32 num_materials; - u32 num_faces; - bool exterior; -} pxl8_bsp_render_state; - -pxl8_bsp_render_state* pxl8_bsp_render_state_create(u32 num_faces); -void pxl8_bsp_render_state_destroy(pxl8_bsp_render_state* state); - -void pxl8_bsp_render(pxl8_gfx* gfx, const pxl8_bsp* bsp, - pxl8_bsp_render_state* state, - const pxl8_gfx_draw_opts* opts); -void pxl8_bsp_set_material(pxl8_bsp_render_state* state, u16 material_id, - const pxl8_gfx_material* material); - -#ifdef __cplusplus -} -#endif diff --git a/src/core/pxl8.c b/src/core/pxl8.c index cca8f93..edd1d92 100644 --- a/src/core/pxl8.c +++ b/src/core/pxl8.c @@ -7,7 +7,7 @@ #include "pxl8_ase.h" #include "pxl8_game.h" -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_log.h" #include "pxl8_macros.h" #include "pxl8_mem.h" @@ -16,14 +16,13 @@ #include "pxl8_script.h" #include "pxl8_sfx.h" #include "pxl8_sys.h" -#include "pxl8_world.h" struct pxl8 { pxl8_cart* cart; pxl8_game* game; pxl8_repl* repl; pxl8_log log; - const pxl8_hal* hal; + const pxl8_platform* platform; void* platform_data; }; @@ -36,19 +35,19 @@ static void pxl8_audio_event_callback(u8 event_type, u8 context_id, u8 note, f32 } #endif -pxl8* pxl8_create(const pxl8_hal* hal) { +pxl8* pxl8_create(const pxl8_platform* platform) { pxl8* sys = (pxl8*)pxl8_calloc(1, sizeof(pxl8)); if (!sys) return NULL; pxl8_log_init(&sys->log); - if (!hal) { - pxl8_error("hal cannot be null"); + if (!platform) { + pxl8_error("platform cannot be null"); pxl8_free(sys); return NULL; } - sys->hal = hal; + sys->platform = platform; sys->game = (pxl8_game*)pxl8_calloc(1, sizeof(pxl8_game)); if (!sys->game) { @@ -65,7 +64,7 @@ void pxl8_destroy(pxl8* sys) { if (sys->game) pxl8_free(sys->game); if (sys->cart) pxl8_cart_destroy(sys->cart); - if (sys->hal && sys->platform_data) sys->hal->destroy(sys->platform_data); + if (sys->platform && sys->platform_data) sys->platform->destroy(sys->platform_data); pxl8_free(sys); } @@ -227,42 +226,35 @@ pxl8_result pxl8_init(pxl8* sys, i32 argc, char* argv[]) { pxl8_size window_size = pxl8_cart_get_window_size(sys->cart); pxl8_size render_size = pxl8_get_resolution_dimensions(resolution); - sys->platform_data = sys->hal->create(render_size.w, render_size.h, window_title, window_size.w, window_size.h); + sys->platform_data = sys->platform->create(render_size.w, render_size.h, window_title, window_size.w, window_size.h); if (!sys->platform_data) { pxl8_error("failed to create platform context"); return PXL8_ERROR_INITIALIZATION_FAILED; } - game->gfx = pxl8_gfx_create(sys->hal, sys->platform_data, resolution); + game->gfx = pxl8_gfx_create(sys->platform, sys->platform_data, resolution); if (!game->gfx) { pxl8_error("failed to create graphics context"); return PXL8_ERROR_INITIALIZATION_FAILED; } - game->mixer = pxl8_sfx_mixer_create(sys->hal); + game->mixer = pxl8_sfx_mixer_create(sys->platform); if (!game->mixer) { pxl8_error("failed to create audio mixer"); return PXL8_ERROR_INITIALIZATION_FAILED; } - pxl8_rng_seed(&game->rng, (u32)sys->hal->get_ticks()); + pxl8_rng_seed(&game->rng, (u32)sys->platform->get_ticks()); - game->world = pxl8_world_create(); - if (!game->world) { - pxl8_error("failed to create world"); - return PXL8_ERROR_INITIALIZATION_FAILED; - } - - pxl8_net_config net_cfg = { .address = "127.0.0.1", .port = 7777 }; - game->net = pxl8_net_create(&net_cfg); - if (game->net) { - pxl8_net_set_chunk_cache(game->net, pxl8_world_get_chunk_cache(game->world)); - pxl8_net_set_world(game->net, game->world); - pxl8_net_connect(game->net); + if (game->hooks.init) { + pxl8_result hook_result = game->hooks.init(game, game->hooks.userdata); + if (hook_result != PXL8_OK) { + return hook_result; + } } #ifndef NDEBUG - game->debug_stats = true; + game->debug_stats = false; game->debug_replay = pxl8_replay_create_buffer(60, 60); pxl8_sfx_mixer_set_event_callback(game->mixer, pxl8_audio_event_callback, game); #endif @@ -289,18 +281,9 @@ pxl8_result pxl8_init(pxl8* sys, i32 argc, char* argv[]) { } } - game->last_time = sys->hal->get_ticks(); + game->last_time = sys->platform->get_ticks(); game->running = true; -#ifdef PXL8_ASYNC_THREADS - if (game->net) { - pxl8_net_start_thread(game->net); - } - if (game->world) { - pxl8_world_start_sim_thread(game->world, game->net); - } -#endif - return PXL8_OK; } @@ -310,7 +293,7 @@ pxl8_result pxl8_update(pxl8* sys) { } pxl8_game* game = sys->game; - u64 current_time = sys->hal->get_ticks(); + u64 current_time = sys->platform->get_ticks(); f32 dt = (f32)(current_time - game->last_time) / 1000000000.0f; game->last_time = current_time; @@ -364,16 +347,9 @@ pxl8_result pxl8_update(pxl8* sys) { } } -#ifdef PXL8_ASYNC_THREADS - pxl8_net_update(game->net, dt); -#else - if (game->net) { - while (pxl8_net_poll(game->net)) {} - pxl8_net_update(game->net, dt); - pxl8_world_sync(game->world, game->net); + if (game->hooks.update) { + game->hooks.update(game, dt, game->hooks.userdata); } - pxl8_world_update(game->world, dt); -#endif pxl8_gfx_update(game->gfx, dt); pxl8_sfx_mixer_process(game->mixer); @@ -412,30 +388,10 @@ pxl8_result pxl8_frame(pxl8* sys) { if (game->debug_stats) { const pxl8_gfx_stats* stats = pxl8_gfx_get_stats(game->gfx); - char buf[64]; - i32 y = 4; - if (stats) { + char buf[32]; snprintf(buf, sizeof(buf), "FPS: %.0f", stats->fps); - pxl8_2d_text(game->gfx, buf, 4, y, 15); - y += 10; - - pxl8_sim_entity* player = pxl8_world_local_player(game->world); - if (player) { - snprintf(buf, sizeof(buf), "Pos: %.0f,%.0f,%.0f", - player->pos.x, player->pos.y, player->pos.z); - pxl8_2d_text(game->gfx, buf, 4, y, 15); - y += 10; - } - - snprintf(buf, sizeof(buf), "Draw: %llu Tri: %llu", - (unsigned long long)stats->draw_calls, - (unsigned long long)stats->triangles); - pxl8_2d_text(game->gfx, buf, 4, y, 15); - y += 10; - - snprintf(buf, sizeof(buf), "Raster: %.2fms", stats->raster_ms); - pxl8_2d_text(game->gfx, buf, 4, y, 15); + pxl8_2d_text(game->gfx, buf, 4, 4, 15); } } @@ -478,14 +434,9 @@ void pxl8_quit(pxl8* sys) { pxl8_info("Shutting down"); -#ifdef PXL8_ASYNC_THREADS - if (game->world) { - pxl8_world_stop_sim_thread(game->world); + if (game->hooks.quit) { + game->hooks.quit(game, game->hooks.userdata); } - if (game->net) { - pxl8_net_stop_thread(game->net); - } -#endif if (sys->cart) { pxl8_cart_unmount(sys->cart); @@ -495,9 +446,6 @@ void pxl8_quit(pxl8* sys) { pxl8_replay_destroy(game->debug_replay); #endif - if (game->net) pxl8_net_destroy(game->net); - if (game->world) pxl8_world_destroy(game->world); - pxl8_sfx_mixer_destroy(game->mixer); pxl8_gfx_destroy(game->gfx); pxl8_script_destroy(game->script); @@ -517,16 +465,16 @@ void pxl8_set_running(pxl8* sys, bool running) { } } -pxl8_world* pxl8_get_world(pxl8* sys) { - return (sys && sys->game) ? sys->game->world : NULL; -} - f32 pxl8_get_fps(const pxl8* sys) { if (!sys || !sys->game) return 0.0f; const pxl8_gfx_stats* stats = pxl8_gfx_get_stats(sys->game->gfx); return stats ? stats->fps : 0.0f; } +pxl8_game* pxl8_get_game(pxl8* sys) { + return sys ? sys->game : NULL; +} + pxl8_gfx* pxl8_get_gfx(const pxl8* sys) { return (sys && sys->game) ? sys->game->gfx : NULL; } @@ -535,27 +483,23 @@ pxl8_input_state* pxl8_get_input(const pxl8* sys) { return (sys && sys->game) ? &sys->game->input : NULL; } -pxl8_net* pxl8_get_net(const pxl8* sys) { - return (sys && sys->game) ? sys->game->net : NULL; -} - pxl8_sfx_mixer* pxl8_get_sfx_mixer(const pxl8* sys) { return (sys && sys->game) ? sys->game->mixer : NULL; } void pxl8_center_cursor(pxl8* sys) { - if (!sys || !sys->hal || !sys->hal->center_cursor) return; - sys->hal->center_cursor(sys->platform_data); + if (!sys || !sys->platform || !sys->platform->center_cursor) return; + sys->platform->center_cursor(sys->platform_data); } void pxl8_set_cursor(pxl8* sys, pxl8_cursor cursor) { - if (!sys || !sys->hal || !sys->hal->set_cursor) return; - sys->hal->set_cursor(sys->platform_data, cursor); + if (!sys || !sys->platform || !sys->platform->set_cursor) return; + sys->platform->set_cursor(sys->platform_data, cursor); } void pxl8_set_relative_mouse_mode(pxl8* sys, bool enabled) { - if (!sys || !sys->hal || !sys->hal->set_relative_mouse_mode) return; - sys->hal->set_relative_mouse_mode(sys->platform_data, enabled); + if (!sys || !sys->platform || !sys->platform->set_relative_mouse_mode) return; + sys->platform->set_relative_mouse_mode(sys->platform_data, enabled); if (sys->game) { sys->game->input.mouse_relative_mode = enabled; } @@ -573,3 +517,13 @@ pxl8_size pxl8_get_resolution_dimensions(pxl8_resolution resolution) { default: return (pxl8_size){640, 360}; } } + +__attribute__((weak)) void pxl8_register_game(pxl8* sys) { + (void)sys; +} + +void pxl8_set_game_hooks(pxl8* sys, pxl8_game_hooks hooks) { + if (sys && sys->game) { + sys->game->hooks = hooks; + } +} diff --git a/src/core/pxl8_game.h b/src/core/pxl8_game.h index 20faf14..be78440 100644 --- a/src/core/pxl8_game.h +++ b/src/core/pxl8_game.h @@ -1,15 +1,22 @@ #pragma once #include "pxl8_gfx.h" -#include "pxl8_net.h" #include "pxl8_rng.h" #include "pxl8_script.h" #include "pxl8_sfx.h" #include "pxl8_types.h" -#include "pxl8_world.h" typedef struct pxl8_replay pxl8_replay; +typedef struct pxl8_game pxl8_game; + +typedef struct pxl8_game_hooks { + pxl8_result (*init)(pxl8_game* game, void* userdata); + void (*update)(pxl8_game* game, f32 dt, void* userdata); + void (*quit)(pxl8_game* game, void* userdata); + void* userdata; +} pxl8_game_hooks; + typedef struct pxl8_game { #ifndef NDEBUG pxl8_replay* debug_replay; @@ -19,10 +26,10 @@ typedef struct pxl8_game { f32 dt; i32 frame_count; pxl8_gfx* gfx; + pxl8_game_hooks hooks; pxl8_input_state input; u64 last_time; pxl8_sfx_mixer* mixer; - pxl8_net* net; pxl8_input_state prev_input; bool repl_mode; bool repl_started; @@ -32,5 +39,5 @@ typedef struct pxl8_game { bool script_loaded; char script_path[256]; f32 time; - pxl8_world* world; + void* userdata; } pxl8_game; diff --git a/src/core/pxl8_sys.h b/src/core/pxl8_sys.h index ac791a5..8264944 100644 --- a/src/core/pxl8_sys.h +++ b/src/core/pxl8_sys.h @@ -1,9 +1,9 @@ #pragma once +#include "pxl8_game.h" #include "pxl8_gfx.h" -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_io.h" -#include "pxl8_net.h" #include "pxl8_sfx.h" #include "pxl8_types.h" @@ -13,7 +13,7 @@ typedef struct pxl8 pxl8; extern "C" { #endif -pxl8* pxl8_create(const pxl8_hal* hal); +pxl8* pxl8_create(const pxl8_platform* platform); void pxl8_destroy(pxl8* sys); pxl8_result pxl8_init(pxl8* sys, i32 argc, char* argv[]); @@ -22,15 +22,18 @@ pxl8_result pxl8_frame(pxl8* sys); void pxl8_quit(pxl8* sys); f32 pxl8_get_fps(const pxl8* sys); +pxl8_game* pxl8_get_game(pxl8* sys); pxl8_gfx* pxl8_get_gfx(const pxl8* sys); pxl8_input_state* pxl8_get_input(const pxl8* sys); -pxl8_net* pxl8_get_net(const pxl8* sys); pxl8_size pxl8_get_resolution_dimensions(pxl8_resolution resolution); pxl8_sfx_mixer* pxl8_get_sfx_mixer(const pxl8* sys); bool pxl8_is_running(const pxl8* sys); +void pxl8_register_game(pxl8* sys); + void pxl8_center_cursor(pxl8* sys); void pxl8_set_cursor(pxl8* sys, pxl8_cursor cursor); +void pxl8_set_game_hooks(pxl8* sys, pxl8_game_hooks hooks); void pxl8_set_relative_mouse_mode(pxl8* sys, bool enabled); void pxl8_set_running(pxl8* sys, bool running); diff --git a/src/gfx/pxl8_3d_camera.h b/src/gfx/pxl8_3d_camera.h deleted file mode 100644 index e3a9fc4..0000000 --- a/src/gfx/pxl8_3d_camera.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "pxl8_math.h" -#include "pxl8_types.h" - -typedef enum pxl8_3d_camera_mode { - PXL8_3D_CAMERA_ORTHO, - PXL8_3D_CAMERA_PERSPECTIVE -} pxl8_3d_camera_mode; - -typedef struct pxl8_3d_camera pxl8_3d_camera; - -#ifdef __cplusplus -extern "C" { -#endif - -pxl8_3d_camera* pxl8_3d_camera_create(void); -void pxl8_3d_camera_destroy(pxl8_3d_camera* cam); - -void pxl8_3d_camera_lookat(pxl8_3d_camera* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up); -void pxl8_3d_camera_set_ortho(pxl8_3d_camera* cam, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far); -void pxl8_3d_camera_set_perspective(pxl8_3d_camera* cam, f32 fov, f32 aspect, f32 near, f32 far); -void pxl8_3d_camera_set_position(pxl8_3d_camera* cam, pxl8_vec3 pos); -void pxl8_3d_camera_set_rotation(pxl8_3d_camera* cam, f32 pitch, f32 yaw, f32 roll); - -pxl8_vec3 pxl8_3d_camera_get_forward(const pxl8_3d_camera* cam); -pxl8_vec3 pxl8_3d_camera_get_position(const pxl8_3d_camera* cam); -pxl8_mat4 pxl8_3d_camera_get_projection(const pxl8_3d_camera* cam); -pxl8_vec3 pxl8_3d_camera_get_right(const pxl8_3d_camera* cam); -pxl8_vec3 pxl8_3d_camera_get_up(const pxl8_3d_camera* cam); -pxl8_mat4 pxl8_3d_camera_get_view(const pxl8_3d_camera* cam); - -void pxl8_3d_camera_blend(pxl8_3d_camera* dest, const pxl8_3d_camera* a, const pxl8_3d_camera* b, f32 t); -void pxl8_3d_camera_follow(pxl8_3d_camera* cam, pxl8_vec3 target, pxl8_vec3 offset, f32 smoothing, f32 dt); -pxl8_projected_point pxl8_3d_camera_world_to_screen(const pxl8_3d_camera* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height); -void pxl8_3d_camera_shake(pxl8_3d_camera* cam, f32 intensity, f32 duration); -void pxl8_3d_camera_update(pxl8_3d_camera* cam, f32 dt); - -#ifdef __cplusplus -} -#endif diff --git a/src/gfx/pxl8_render.c b/src/gfx/pxl8_blit3d.c similarity index 95% rename from src/gfx/pxl8_render.c rename to src/gfx/pxl8_blit3d.c index 2296bae..560536a 100644 --- a/src/gfx/pxl8_render.c +++ b/src/gfx/pxl8_blit3d.c @@ -1,8 +1,8 @@ -#include "pxl8_render.h" +#include "pxl8_blit3d.h" #include "pxl8_atlas.h" #include "pxl8_colormap.h" #include "pxl8_dither.h" -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_log.h" #include "pxl8_mem.h" #include "pxl8_mesh.h" @@ -794,7 +794,7 @@ typedef struct { bool active; } texture_slot; -struct pxl8_renderer { +struct pxl8_blit3d { u32 width; u32 height; u8* stencil; @@ -828,8 +828,8 @@ struct pxl8_gfx_cmdbuf { u32 count; }; -pxl8_renderer* pxl8_renderer_create(u32 width, u32 height) { - pxl8_renderer* r = pxl8_calloc(1, sizeof(pxl8_renderer)); +pxl8_blit3d* pxl8_blit3d_create(u32 width, u32 height) { + pxl8_blit3d* r = pxl8_calloc(1, sizeof(pxl8_blit3d)); r->width = width; r->height = height; r->stencil = pxl8_calloc(width * height, 1); @@ -840,7 +840,7 @@ pxl8_renderer* pxl8_renderer_create(u32 width, u32 height) { return r; } -void pxl8_renderer_destroy(pxl8_renderer* r) { +void pxl8_blit3d_destroy(pxl8_blit3d* r) { if (!r) return; for (u32 i = 0; i < PXL8_GFX_MAX_TEXTURES; i++) { if (r->textures[i].data) pxl8_free(r->textures[i].data); @@ -852,7 +852,7 @@ void pxl8_renderer_destroy(pxl8_renderer* r) { pxl8_free(r); } -void pxl8_renderer_update_stats(pxl8_renderer* r, f32 dt) { +void pxl8_blit3d_update_stats(pxl8_blit3d* r, f32 dt) { if (!r) return; r->stats.dt_accumulator += dt; @@ -870,7 +870,7 @@ void pxl8_renderer_update_stats(pxl8_renderer* r, f32 dt) { r->stats.triangles = 0; } -pxl8_gfx_stats* pxl8_renderer_get_stats(pxl8_renderer* r) { +pxl8_gfx_stats* pxl8_blit3d_get_stats(pxl8_blit3d* r) { return r ? &r->stats : NULL; } @@ -882,7 +882,7 @@ static u32 texture_byte_size(pxl8_gfx_texture_format fmt, u32 w, u32 h) { return 0; } -pxl8_gfx_texture pxl8_create_texture(pxl8_renderer* r, const pxl8_gfx_texture_desc* desc) { +pxl8_gfx_texture pxl8_create_texture(pxl8_blit3d* r, const pxl8_gfx_texture_desc* desc) { for (u32 i = 0; i < PXL8_GFX_MAX_TEXTURES; i++) { if (!r->textures[i].active) { texture_slot* s = &r->textures[i]; @@ -906,7 +906,7 @@ pxl8_gfx_texture pxl8_create_texture(pxl8_renderer* r, const pxl8_gfx_texture_de return (pxl8_gfx_texture){ PXL8_GFX_INVALID_ID }; } -pxl8_gfx_buffer pxl8_create_buffer(pxl8_renderer* r, const pxl8_gfx_buffer_desc* desc) { +pxl8_gfx_buffer pxl8_create_buffer(pxl8_blit3d* r, const pxl8_gfx_buffer_desc* desc) { for (u32 i = 0; i < PXL8_GFX_MAX_BUFFERS; i++) { if (!r->buffers[i].active) { buffer_slot* s = &r->buffers[i]; @@ -933,7 +933,7 @@ pxl8_gfx_buffer pxl8_create_buffer(pxl8_renderer* r, const pxl8_gfx_buffer_desc* return (pxl8_gfx_buffer){ PXL8_GFX_INVALID_ID }; } -pxl8_gfx_pipeline pxl8_create_pipeline(pxl8_renderer* r, const pxl8_gfx_pipeline_desc* desc) { +pxl8_gfx_pipeline pxl8_create_pipeline(pxl8_blit3d* r, const pxl8_gfx_pipeline_desc* desc) { u32 hash = pipeline_desc_hash(desc); u32 bucket = hash & (PXL8_PIPELINE_CACHE_SIZE - 1); pipeline_cache_entry* ce = &r->pipeline_cache[bucket]; @@ -974,7 +974,7 @@ pxl8_gfx_pipeline pxl8_create_pipeline(pxl8_renderer* r, const pxl8_gfx_pipeline return (pxl8_gfx_pipeline){ PXL8_GFX_INVALID_ID }; } -pxl8_gfx_bindings pxl8_create_bindings(pxl8_renderer* r, const pxl8_gfx_bindings_desc* desc) { +pxl8_gfx_bindings pxl8_create_bindings(pxl8_blit3d* r, const pxl8_gfx_bindings_desc* desc) { for (u32 i = 0; i < PXL8_GFX_MAX_BINDINGS; i++) { if (!r->bindings[i].active) { bindings_slot* s = &r->bindings[i]; @@ -988,7 +988,7 @@ pxl8_gfx_bindings pxl8_create_bindings(pxl8_renderer* r, const pxl8_gfx_bindings return (pxl8_gfx_bindings){ PXL8_GFX_INVALID_ID }; } -pxl8_gfx_pass pxl8_create_pass(pxl8_renderer* r, const pxl8_gfx_pass_desc* desc) { +pxl8_gfx_pass pxl8_create_pass(pxl8_blit3d* r, const pxl8_gfx_pass_desc* desc) { for (u32 i = 0; i < PXL8_GFX_MAX_PASSES; i++) { if (!r->passes[i].active) { pass_slot* s = &r->passes[i]; @@ -1022,7 +1022,7 @@ pxl8_gfx_pass pxl8_create_pass(pxl8_renderer* r, const pxl8_gfx_pass_desc* desc) r->bindings[SLOT_INDEX((h).id)].active && \ r->bindings[SLOT_INDEX((h).id)].generation == SLOT_GEN((h).id)) -void pxl8_destroy_texture(pxl8_renderer* r, pxl8_gfx_texture tex) { +void pxl8_destroy_texture(pxl8_blit3d* r, pxl8_gfx_texture tex) { if (!VALID_TEX(r, tex)) return; texture_slot* s = &r->textures[SLOT_INDEX(tex.id)]; pxl8_free(s->data); @@ -1030,7 +1030,7 @@ void pxl8_destroy_texture(pxl8_renderer* r, pxl8_gfx_texture tex) { s->active = false; } -void pxl8_destroy_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf) { +void pxl8_destroy_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf) { if (!VALID_BUF(r, buf)) return; buffer_slot* s = &r->buffers[SLOT_INDEX(buf.id)]; pxl8_free(s->data); @@ -1038,7 +1038,7 @@ void pxl8_destroy_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf) { s->active = false; } -void pxl8_destroy_pipeline(pxl8_renderer* r, pxl8_gfx_pipeline pip) { +void pxl8_destroy_pipeline(pxl8_blit3d* r, pxl8_gfx_pipeline pip) { u32 idx = SLOT_INDEX(pip.id); if (idx < PXL8_GFX_MAX_PIPELINES && r->pipelines[idx].generation == SLOT_GEN(pip.id)) { if (!r->pipelines[idx].cached) @@ -1046,28 +1046,28 @@ void pxl8_destroy_pipeline(pxl8_renderer* r, pxl8_gfx_pipeline pip) { } } -void pxl8_destroy_bindings(pxl8_renderer* r, pxl8_gfx_bindings bnd) { +void pxl8_destroy_bindings(pxl8_blit3d* r, pxl8_gfx_bindings bnd) { u32 idx = SLOT_INDEX(bnd.id); if (idx < PXL8_GFX_MAX_BINDINGS && r->bindings[idx].generation == SLOT_GEN(bnd.id)) { r->bindings[idx].active = false; } } -void pxl8_destroy_pass(pxl8_renderer* r, pxl8_gfx_pass pass) { +void pxl8_destroy_pass(pxl8_blit3d* r, pxl8_gfx_pass pass) { u32 idx = SLOT_INDEX(pass.id); if (idx < PXL8_GFX_MAX_PASSES && r->passes[idx].generation == SLOT_GEN(pass.id)) { r->passes[idx].active = false; } } -void pxl8_update_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data) { +void pxl8_update_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data) { if (!VALID_BUF(r, buf)) return; buffer_slot* s = &r->buffers[SLOT_INDEX(buf.id)]; u32 copy_size = data->size < s->size ? data->size : s->size; memcpy(s->data, data->ptr, copy_size); } -i32 pxl8_append_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data) { +i32 pxl8_append_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data) { if (!VALID_BUF(r, buf)) return -1; buffer_slot* s = &r->buffers[SLOT_INDEX(buf.id)]; if (s->append_pos + data->size > s->size) return -1; @@ -1077,7 +1077,7 @@ i32 pxl8_append_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf, const pxl8_gfx_ran return offset; } -void pxl8_update_texture(pxl8_renderer* r, pxl8_gfx_texture tex, const pxl8_gfx_range* data, u32 x, u32 y, u32 w, u32 h) { +void pxl8_update_texture(pxl8_blit3d* r, pxl8_gfx_texture tex, const pxl8_gfx_range* data, u32 x, u32 y, u32 w, u32 h) { if (!VALID_TEX(r, tex)) return; texture_slot* s = &r->textures[SLOT_INDEX(tex.id)]; u32 bpp = (s->format == PXL8_GFX_FORMAT_INDEXED8) ? 1 : @@ -1091,17 +1091,17 @@ void pxl8_update_texture(pxl8_renderer* r, pxl8_gfx_texture tex, const pxl8_gfx_ } } -void* pxl8_texture_get_data(pxl8_renderer* r, pxl8_gfx_texture tex) { +void* pxl8_texture_get_data(pxl8_blit3d* r, pxl8_gfx_texture tex) { if (!VALID_TEX(r, tex)) return NULL; return r->textures[SLOT_INDEX(tex.id)].data; } -u32 pxl8_texture_get_width(pxl8_renderer* r, pxl8_gfx_texture tex) { +u32 pxl8_texture_get_width(pxl8_blit3d* r, pxl8_gfx_texture tex) { if (!VALID_TEX(r, tex)) return 0; return r->textures[SLOT_INDEX(tex.id)].width; } -u32 pxl8_texture_get_height(pxl8_renderer* r, pxl8_gfx_texture tex) { +u32 pxl8_texture_get_height(pxl8_blit3d* r, pxl8_gfx_texture tex) { if (!VALID_TEX(r, tex)) return 0; return r->textures[SLOT_INDEX(tex.id)].height; } @@ -1198,7 +1198,7 @@ void pxl8_draw(pxl8_gfx_cmdbuf* cb, pxl8_gfx_buffer vb, pxl8_gfx_buffer ib, u32 } static void execute_draw( - pxl8_renderer* r, + pxl8_blit3d* r, const pxl8_gfx_cmd_draw* cmd ) { r->stats.draw_calls++; @@ -1416,7 +1416,7 @@ static void execute_draw( } } -void pxl8_gfx_submit(pxl8_renderer* r, pxl8_gfx_cmdbuf* cb) { +void pxl8_gfx_submit(pxl8_blit3d* r, pxl8_gfx_cmdbuf* cb) { for (u32 i = 0; i < cb->count; i++) { pxl8_gfx_cmd* cmd = &cb->commands[i]; switch (cmd->type) { @@ -1475,7 +1475,7 @@ void pxl8_gfx_submit(pxl8_renderer* r, pxl8_gfx_cmdbuf* cb) { r->frame_counter++; } -void pxl8_clear(pxl8_renderer* r, pxl8_gfx_texture target, u8 color) { +void pxl8_clear(pxl8_blit3d* r, pxl8_gfx_texture target, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format == PXL8_GFX_FORMAT_INDEXED8) { @@ -1483,7 +1483,7 @@ void pxl8_clear(pxl8_renderer* r, pxl8_gfx_texture target, u8 color) { } } -void pxl8_clear_depth(pxl8_renderer* r, pxl8_gfx_texture target) { +void pxl8_clear_depth(pxl8_blit3d* r, pxl8_gfx_texture target) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format == PXL8_GFX_FORMAT_DEPTH16) { @@ -1491,13 +1491,13 @@ void pxl8_clear_depth(pxl8_renderer* r, pxl8_gfx_texture target) { } } -void pxl8_clear_stencil(pxl8_renderer* r, u8 value) { +void pxl8_clear_stencil(pxl8_blit3d* r, u8 value) { if (!r || !r->stencil) return; memset(r->stencil, value, r->width * r->height); } -void pxl8_draw_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, u8 color) { +void pxl8_draw_pixel(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (x < 0 || y < 0 || (u32)x >= s->width || (u32)y >= s->height) return; @@ -1506,7 +1506,7 @@ void pxl8_draw_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, u8 } } -u8 pxl8_get_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y) { +u8 pxl8_get_pixel(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y) { if (!VALID_TEX(r, target)) return 0; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (x < 0 || y < 0 || (u32)x >= s->width || (u32)y >= s->height) return 0; @@ -1516,7 +1516,7 @@ u8 pxl8_get_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y) { return 0; } -void pxl8_draw_line(pxl8_renderer* r, pxl8_gfx_texture target, i32 x0, i32 y0, i32 x1, i32 y1, u8 color) { +void pxl8_draw_line(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x0, i32 y0, i32 x1, i32 y1, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format != PXL8_GFX_FORMAT_INDEXED8) return; @@ -1542,14 +1542,14 @@ void pxl8_draw_line(pxl8_renderer* r, pxl8_gfx_texture target, i32 x0, i32 y0, i } } -void pxl8_draw_rect(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color) { +void pxl8_draw_rect(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color) { pxl8_draw_line(r, target, x, y, x + w - 1, y, color); pxl8_draw_line(r, target, x + w - 1, y, x + w - 1, y + h - 1, color); pxl8_draw_line(r, target, x + w - 1, y + h - 1, x, y + h - 1, color); pxl8_draw_line(r, target, x, y + h - 1, x, y, color); } -void pxl8_draw_rect_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color) { +void pxl8_draw_rect_fill(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format != PXL8_GFX_FORMAT_INDEXED8) return; @@ -1568,7 +1568,7 @@ void pxl8_draw_rect_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y } } -void pxl8_draw_circle(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color) { +void pxl8_draw_circle(pxl8_blit3d* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format != PXL8_GFX_FORMAT_INDEXED8) return; @@ -1594,7 +1594,7 @@ void pxl8_draw_circle(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i32 cy, #undef PLOT } -void pxl8_draw_circle_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color) { +void pxl8_draw_circle_fill(pxl8_blit3d* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color) { if (!VALID_TEX(r, target)) return; texture_slot* s = &r->textures[SLOT_INDEX(target.id)]; if (s->format != PXL8_GFX_FORMAT_INDEXED8) return; @@ -1618,7 +1618,7 @@ void pxl8_draw_circle_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i3 } } -void pxl8_resolve_to_rgba(pxl8_renderer* r, pxl8_gfx_texture color, const u32* palette, u32* output) { +void pxl8_resolve_to_rgba(pxl8_blit3d* r, pxl8_gfx_texture color, const u32* palette, u32* output) { if (!VALID_TEX(r, color)) return; texture_slot* cs = &r->textures[SLOT_INDEX(color.id)]; diff --git a/src/gfx/pxl8_blit3d.h b/src/gfx/pxl8_blit3d.h new file mode 100644 index 0000000..9c7685d --- /dev/null +++ b/src/gfx/pxl8_blit3d.h @@ -0,0 +1,70 @@ +#pragma once + +#include "pxl8_colormap.h" +#include "pxl8_gfx.h" +#include "pxl8_blit3d_types.h" +#include "pxl8_shader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct pxl8_blit3d pxl8_blit3d; +typedef struct pxl8_gfx_cmdbuf pxl8_gfx_cmdbuf; + +pxl8_blit3d* pxl8_blit3d_create(u32 width, u32 height); +void pxl8_blit3d_destroy(pxl8_blit3d* r); + +pxl8_gfx_bindings pxl8_create_bindings(pxl8_blit3d* r, const pxl8_gfx_bindings_desc* desc); +pxl8_gfx_buffer pxl8_create_buffer(pxl8_blit3d* r, const pxl8_gfx_buffer_desc* desc); +pxl8_gfx_pass pxl8_create_pass(pxl8_blit3d* r, const pxl8_gfx_pass_desc* desc); +pxl8_gfx_pipeline pxl8_create_pipeline(pxl8_blit3d* r, const pxl8_gfx_pipeline_desc* desc); +pxl8_gfx_texture pxl8_create_texture(pxl8_blit3d* r, const pxl8_gfx_texture_desc* desc); + +void pxl8_destroy_bindings(pxl8_blit3d* r, pxl8_gfx_bindings bnd); +void pxl8_destroy_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf); +void pxl8_destroy_pass(pxl8_blit3d* r, pxl8_gfx_pass pass); +void pxl8_destroy_pipeline(pxl8_blit3d* r, pxl8_gfx_pipeline pip); +void pxl8_destroy_texture(pxl8_blit3d* r, pxl8_gfx_texture tex); + +void pxl8_update_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data); +i32 pxl8_append_buffer(pxl8_blit3d* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data); +void pxl8_update_texture(pxl8_blit3d* r, pxl8_gfx_texture tex, const pxl8_gfx_range* data, u32 x, u32 y, u32 w, u32 h); + +void* pxl8_texture_get_data(pxl8_blit3d* r, pxl8_gfx_texture tex); +u32 pxl8_texture_get_width(pxl8_blit3d* r, pxl8_gfx_texture tex); +u32 pxl8_texture_get_height(pxl8_blit3d* r, pxl8_gfx_texture tex); + +pxl8_gfx_cmdbuf* pxl8_cmdbuf_create(u32 capacity); +void pxl8_cmdbuf_destroy(pxl8_gfx_cmdbuf* cb); +void pxl8_cmdbuf_reset(pxl8_gfx_cmdbuf* cb); + +void pxl8_begin_pass(pxl8_gfx_cmdbuf* cb, pxl8_gfx_pass pass); +void pxl8_cmdbuf_clear_depth(pxl8_gfx_cmdbuf* cb, pxl8_gfx_texture texture); +void pxl8_end_pass(pxl8_gfx_cmdbuf* cb); +void pxl8_set_bindings(pxl8_gfx_cmdbuf* cb, pxl8_gfx_bindings bindings); +void pxl8_set_draw_params(pxl8_gfx_cmdbuf* cb, const pxl8_gfx_cmd_draw_params* p); +void pxl8_set_pipeline(pxl8_gfx_cmdbuf* cb, pxl8_gfx_pipeline pipeline); +void pxl8_set_scissor(pxl8_gfx_cmdbuf* cb, i32 x, i32 y, u32 w, u32 h); +void pxl8_set_viewport(pxl8_gfx_cmdbuf* cb, i32 x, i32 y, u32 w, u32 h); +void pxl8_draw(pxl8_gfx_cmdbuf* cb, pxl8_gfx_buffer vb, pxl8_gfx_buffer ib, u32 first, u32 count, u32 base_vertex); + +void pxl8_gfx_submit(pxl8_blit3d* r, pxl8_gfx_cmdbuf* cb); + +void pxl8_clear(pxl8_blit3d* r, pxl8_gfx_texture target, u8 color); +void pxl8_clear_depth(pxl8_blit3d* r, pxl8_gfx_texture target); +void pxl8_clear_stencil(pxl8_blit3d* r, u8 value); + +void pxl8_draw_pixel(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, u8 color); +u8 pxl8_get_pixel(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y); +void pxl8_draw_line(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x0, i32 y0, i32 x1, i32 y1, u8 color); +void pxl8_draw_rect(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color); +void pxl8_draw_rect_fill(pxl8_blit3d* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color); +void pxl8_draw_circle(pxl8_blit3d* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color); +void pxl8_draw_circle_fill(pxl8_blit3d* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color); + +void pxl8_resolve_to_rgba(pxl8_blit3d* r, pxl8_gfx_texture color, const u32* palette, u32* output); + +#ifdef __cplusplus +} +#endif diff --git a/src/gfx/pxl8_render_types.h b/src/gfx/pxl8_blit3d_types.h similarity index 100% rename from src/gfx/pxl8_render_types.h rename to src/gfx/pxl8_blit3d_types.h diff --git a/src/gfx/pxl8_3d_camera.c b/src/gfx/pxl8_camera3d.c similarity index 69% rename from src/gfx/pxl8_3d_camera.c rename to src/gfx/pxl8_camera3d.c index fc5429f..d1a64e7 100644 --- a/src/gfx/pxl8_3d_camera.c +++ b/src/gfx/pxl8_camera3d.c @@ -1,16 +1,16 @@ -#include "pxl8_3d_camera.h" +#include "pxl8_camera3d.h" #include "pxl8_mem.h" #include #include -struct pxl8_3d_camera { +struct pxl8_camera3d { pxl8_vec3 position; f32 pitch; f32 roll; f32 yaw; - pxl8_3d_camera_mode mode; + pxl8_camera3d_mode mode; f32 aspect; f32 far; @@ -28,8 +28,8 @@ struct pxl8_3d_camera { f32 shake_timer; }; -pxl8_3d_camera* pxl8_3d_camera_create(void) { - pxl8_3d_camera* cam = pxl8_calloc(1, sizeof(pxl8_3d_camera)); +pxl8_camera3d* pxl8_camera3d_create(void) { + pxl8_camera3d* cam = pxl8_calloc(1, sizeof(pxl8_camera3d)); if (!cam) return NULL; cam->position = (pxl8_vec3){0, 0, 0}; @@ -37,7 +37,7 @@ pxl8_3d_camera* pxl8_3d_camera_create(void) { cam->yaw = 0; cam->roll = 0; - cam->mode = PXL8_3D_CAMERA_PERSPECTIVE; + cam->mode = PXL8_CAMERA3D_PERSPECTIVE; cam->fov = 1.0f; cam->aspect = 16.0f / 9.0f; cam->near = 1.0f; @@ -46,11 +46,11 @@ pxl8_3d_camera* pxl8_3d_camera_create(void) { return cam; } -void pxl8_3d_camera_destroy(pxl8_3d_camera* cam) { +void pxl8_camera3d_destroy(pxl8_camera3d* cam) { pxl8_free(cam); } -void pxl8_3d_camera_lookat(pxl8_3d_camera* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up) { +void pxl8_camera3d_lookat(pxl8_camera3d* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up) { if (!cam) return; cam->position = eye; @@ -64,9 +64,9 @@ void pxl8_3d_camera_lookat(pxl8_3d_camera* cam, pxl8_vec3 eye, pxl8_vec3 target, (void)up; } -void pxl8_3d_camera_set_ortho(pxl8_3d_camera* cam, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far) { +void pxl8_camera3d_set_ortho(pxl8_camera3d* cam, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far) { if (!cam) return; - cam->mode = PXL8_3D_CAMERA_ORTHO; + cam->mode = PXL8_CAMERA3D_ORTHO; cam->ortho_left = left; cam->ortho_right = right; cam->ortho_bottom = bottom; @@ -75,28 +75,28 @@ void pxl8_3d_camera_set_ortho(pxl8_3d_camera* cam, f32 left, f32 right, f32 bott cam->far = far; } -void pxl8_3d_camera_set_perspective(pxl8_3d_camera* cam, f32 fov, f32 aspect, f32 near, f32 far) { +void pxl8_camera3d_set_perspective(pxl8_camera3d* cam, f32 fov, f32 aspect, f32 near, f32 far) { if (!cam) return; - cam->mode = PXL8_3D_CAMERA_PERSPECTIVE; + cam->mode = PXL8_CAMERA3D_PERSPECTIVE; cam->fov = fov; cam->aspect = aspect; cam->near = near; cam->far = far; } -void pxl8_3d_camera_set_position(pxl8_3d_camera* cam, pxl8_vec3 pos) { +void pxl8_camera3d_set_position(pxl8_camera3d* cam, pxl8_vec3 pos) { if (!cam) return; cam->position = pos; } -void pxl8_3d_camera_set_rotation(pxl8_3d_camera* cam, f32 pitch, f32 yaw, f32 roll) { +void pxl8_camera3d_set_rotation(pxl8_camera3d* cam, f32 pitch, f32 yaw, f32 roll) { if (!cam) return; cam->pitch = pitch; cam->yaw = yaw; cam->roll = roll; } -pxl8_vec3 pxl8_3d_camera_get_forward(const pxl8_3d_camera* cam) { +pxl8_vec3 pxl8_camera3d_get_forward(const pxl8_camera3d* cam) { if (!cam) return (pxl8_vec3){0, 0, -1}; f32 cp = cosf(cam->pitch); @@ -111,15 +111,15 @@ pxl8_vec3 pxl8_3d_camera_get_forward(const pxl8_3d_camera* cam) { }; } -pxl8_vec3 pxl8_3d_camera_get_position(const pxl8_3d_camera* cam) { +pxl8_vec3 pxl8_camera3d_get_position(const pxl8_camera3d* cam) { if (!cam) return (pxl8_vec3){0, 0, 0}; return pxl8_vec3_add(cam->position, cam->shake_offset); } -pxl8_mat4 pxl8_3d_camera_get_projection(const pxl8_3d_camera* cam) { +pxl8_mat4 pxl8_camera3d_get_projection(const pxl8_camera3d* cam) { if (!cam) return pxl8_mat4_identity(); - if (cam->mode == PXL8_3D_CAMERA_PERSPECTIVE) { + if (cam->mode == PXL8_CAMERA3D_PERSPECTIVE) { return pxl8_mat4_perspective(cam->fov, cam->aspect, cam->near, cam->far); } else { return pxl8_mat4_orthographic( @@ -130,7 +130,7 @@ pxl8_mat4 pxl8_3d_camera_get_projection(const pxl8_3d_camera* cam) { } } -pxl8_vec3 pxl8_3d_camera_get_right(const pxl8_3d_camera* cam) { +pxl8_vec3 pxl8_camera3d_get_right(const pxl8_camera3d* cam) { if (!cam) return (pxl8_vec3){1, 0, 0}; f32 cy = cosf(cam->yaw); @@ -139,27 +139,27 @@ pxl8_vec3 pxl8_3d_camera_get_right(const pxl8_3d_camera* cam) { return (pxl8_vec3){cy, 0, -sy}; } -pxl8_vec3 pxl8_3d_camera_get_up(const pxl8_3d_camera* cam) { +pxl8_vec3 pxl8_camera3d_get_up(const pxl8_camera3d* cam) { if (!cam) return (pxl8_vec3){0, 1, 0}; - pxl8_vec3 forward = pxl8_3d_camera_get_forward(cam); - pxl8_vec3 right = pxl8_3d_camera_get_right(cam); + pxl8_vec3 forward = pxl8_camera3d_get_forward(cam); + pxl8_vec3 right = pxl8_camera3d_get_right(cam); return pxl8_vec3_cross(forward, right); } -pxl8_mat4 pxl8_3d_camera_get_view(const pxl8_3d_camera* cam) { +pxl8_mat4 pxl8_camera3d_get_view(const pxl8_camera3d* cam) { if (!cam) return pxl8_mat4_identity(); - pxl8_vec3 pos = pxl8_3d_camera_get_position(cam); - pxl8_vec3 forward = pxl8_3d_camera_get_forward(cam); + pxl8_vec3 pos = pxl8_camera3d_get_position(cam); + pxl8_vec3 forward = pxl8_camera3d_get_forward(cam); pxl8_vec3 target = pxl8_vec3_add(pos, forward); pxl8_vec3 up = (pxl8_vec3){0, 1, 0}; return pxl8_mat4_lookat(pos, target, up); } -void pxl8_3d_camera_blend(pxl8_3d_camera* dest, const pxl8_3d_camera* a, const pxl8_3d_camera* b, f32 t) { +void pxl8_camera3d_blend(pxl8_camera3d* dest, const pxl8_camera3d* a, const pxl8_camera3d* b, f32 t) { if (!dest || !a || !b) return; dest->position = pxl8_vec3_lerp(a->position, b->position, t); @@ -175,7 +175,7 @@ void pxl8_3d_camera_blend(pxl8_3d_camera* dest, const pxl8_3d_camera* a, const p dest->mode = (t < 0.5f) ? a->mode : b->mode; } -void pxl8_3d_camera_follow(pxl8_3d_camera* cam, pxl8_vec3 target, pxl8_vec3 offset, f32 smoothing, f32 dt) { +void pxl8_camera3d_follow(pxl8_camera3d* cam, pxl8_vec3 target, pxl8_vec3 offset, f32 smoothing, f32 dt) { if (!cam) return; pxl8_vec3 desired = pxl8_vec3_add(target, offset); @@ -188,14 +188,14 @@ void pxl8_3d_camera_follow(pxl8_3d_camera* cam, pxl8_vec3 target, pxl8_vec3 offs cam->yaw = atan2f(-forward.x, -forward.z); } -void pxl8_3d_camera_shake(pxl8_3d_camera* cam, f32 intensity, f32 duration) { +void pxl8_camera3d_shake(pxl8_camera3d* cam, f32 intensity, f32 duration) { if (!cam) return; cam->shake_intensity = intensity; cam->shake_duration = duration; cam->shake_timer = duration; } -void pxl8_3d_camera_update(pxl8_3d_camera* cam, f32 dt) { +void pxl8_camera3d_update(pxl8_camera3d* cam, f32 dt) { if (!cam) return; if (cam->shake_timer > 0) { @@ -214,12 +214,12 @@ void pxl8_3d_camera_update(pxl8_3d_camera* cam, f32 dt) { } } -pxl8_projected_point pxl8_3d_camera_world_to_screen(const pxl8_3d_camera* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height) { +pxl8_projected_point pxl8_camera3d_world_to_screen(const pxl8_camera3d* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height) { pxl8_projected_point result = {0, 0, 0.0f, false}; if (!cam) return result; - pxl8_mat4 view = pxl8_3d_camera_get_view(cam); - pxl8_mat4 proj = pxl8_3d_camera_get_projection(cam); + pxl8_mat4 view = pxl8_camera3d_get_view(cam); + pxl8_mat4 proj = pxl8_camera3d_get_projection(cam); pxl8_mat4 vp = pxl8_mat4_multiply(proj, view); pxl8_vec4 clip = pxl8_mat4_multiply_vec4(vp, (pxl8_vec4){world_pos.x, world_pos.y, world_pos.z, 1.0f}); diff --git a/src/gfx/pxl8_camera3d.h b/src/gfx/pxl8_camera3d.h new file mode 100644 index 0000000..422d329 --- /dev/null +++ b/src/gfx/pxl8_camera3d.h @@ -0,0 +1,41 @@ +#pragma once + +#include "pxl8_math.h" +#include "pxl8_types.h" + +typedef enum pxl8_camera3d_mode { + PXL8_CAMERA3D_ORTHO, + PXL8_CAMERA3D_PERSPECTIVE +} pxl8_camera3d_mode; + +typedef struct pxl8_camera3d pxl8_camera3d; + +#ifdef __cplusplus +extern "C" { +#endif + +pxl8_camera3d* pxl8_camera3d_create(void); +void pxl8_camera3d_destroy(pxl8_camera3d* cam); + +void pxl8_camera3d_lookat(pxl8_camera3d* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up); +void pxl8_camera3d_set_ortho(pxl8_camera3d* cam, f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far); +void pxl8_camera3d_set_perspective(pxl8_camera3d* cam, f32 fov, f32 aspect, f32 near, f32 far); +void pxl8_camera3d_set_position(pxl8_camera3d* cam, pxl8_vec3 pos); +void pxl8_camera3d_set_rotation(pxl8_camera3d* cam, f32 pitch, f32 yaw, f32 roll); + +pxl8_vec3 pxl8_camera3d_get_forward(const pxl8_camera3d* cam); +pxl8_vec3 pxl8_camera3d_get_position(const pxl8_camera3d* cam); +pxl8_mat4 pxl8_camera3d_get_projection(const pxl8_camera3d* cam); +pxl8_vec3 pxl8_camera3d_get_right(const pxl8_camera3d* cam); +pxl8_vec3 pxl8_camera3d_get_up(const pxl8_camera3d* cam); +pxl8_mat4 pxl8_camera3d_get_view(const pxl8_camera3d* cam); + +void pxl8_camera3d_blend(pxl8_camera3d* dest, const pxl8_camera3d* a, const pxl8_camera3d* b, f32 t); +void pxl8_camera3d_follow(pxl8_camera3d* cam, pxl8_vec3 target, pxl8_vec3 offset, f32 smoothing, f32 dt); +pxl8_projected_point pxl8_camera3d_world_to_screen(const pxl8_camera3d* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height); +void pxl8_camera3d_shake(pxl8_camera3d* cam, f32 intensity, f32 duration); +void pxl8_camera3d_update(pxl8_camera3d* cam, f32 dt); + +#ifdef __cplusplus +} +#endif diff --git a/src/gfx/pxl8_gfx.c b/src/gfx/pxl8_gfx.c index 8960c43..6b97267 100644 --- a/src/gfx/pxl8_gfx.c +++ b/src/gfx/pxl8_gfx.c @@ -9,18 +9,18 @@ #include "pxl8_colormap.h" #include "pxl8_font.h" #include "pxl8_glows.h" -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_log.h" #include "pxl8_macros.h" #include "pxl8_math.h" #include "pxl8_mem.h" -#include "pxl8_render.h" +#include "pxl8_blit3d.h" #include "pxl8_shader_registry.h" #include "pxl8_sys.h" #include "pxl8_types.h" -void pxl8_renderer_update_stats(pxl8_renderer* r, f32 dt); -pxl8_gfx_stats* pxl8_renderer_get_stats(pxl8_renderer* r); +void pxl8_blit3d_update_stats(pxl8_blit3d* r, f32 dt); +pxl8_gfx_stats* pxl8_blit3d_get_stats(pxl8_blit3d* r); #define PXL8_MAX_TARGET_STACK 8 @@ -53,18 +53,17 @@ typedef struct pxl8_frame_resources { struct pxl8_gfx { pxl8_atlas* atlas; - pxl8_renderer* renderer; + pxl8_blit3d* renderer; pxl8_gfx_texture color_target; pxl8_gfx_texture depth_target; pxl8_gfx_cmdbuf* cmdbuf; pxl8_target_entry target_stack[PXL8_MAX_TARGET_STACK]; u32 target_stack_depth; - const pxl8_bsp* bsp; pxl8_colormap* colormap; i32 framebuffer_height; i32 framebuffer_width; pxl8_frustum frustum; - const pxl8_hal* hal; + const pxl8_platform* platform; bool initialized; u32* output; pxl8_palette* palette; @@ -170,7 +169,7 @@ i32 pxl8_gfx_load_palette(pxl8_gfx* gfx, const char* filepath) { } pxl8_gfx* pxl8_gfx_create( - const pxl8_hal* hal, + const pxl8_platform* platform, void* platform_data, pxl8_resolution resolution ) { @@ -182,7 +181,7 @@ pxl8_gfx* pxl8_gfx_create( return NULL; } - gfx->hal = hal; + gfx->platform = platform; gfx->platform_data = platform_data; pxl8_size size = pxl8_get_resolution_dimensions(resolution); @@ -197,7 +196,7 @@ pxl8_gfx* pxl8_gfx_create( gfx->palette = pxl8_palette_create(); - gfx->renderer = pxl8_renderer_create(gfx->framebuffer_width, gfx->framebuffer_height); + gfx->renderer = pxl8_blit3d_create(gfx->framebuffer_width, gfx->framebuffer_height); if (!gfx->renderer) { pxl8_error("Failed to create renderer"); pxl8_gfx_destroy(gfx); @@ -281,7 +280,7 @@ void pxl8_gfx_destroy(pxl8_gfx* gfx) { pxl8_palette_cube_destroy(gfx->palette_cube); pxl8_palette_destroy(gfx->palette); pxl8_free(gfx->sprite_cache); - pxl8_renderer_destroy(gfx->renderer); + pxl8_blit3d_destroy(gfx->renderer); pxl8_free(gfx); } @@ -393,10 +392,10 @@ pxl8_atlas* pxl8_gfx_get_atlas(pxl8_gfx* gfx) { } void pxl8_gfx_upload_framebuffer(pxl8_gfx* gfx) { - if (!gfx || !gfx->initialized || !gfx->hal) return; + if (!gfx || !gfx->initialized || !gfx->platform) return; pxl8_gfx_resolve(gfx); - gfx->hal->upload_texture( + gfx->platform->upload_texture( gfx->platform_data, gfx->output, gfx->framebuffer_width, @@ -407,9 +406,9 @@ void pxl8_gfx_upload_framebuffer(pxl8_gfx* gfx) { } void pxl8_gfx_present(pxl8_gfx* gfx) { - if (!gfx || !gfx->initialized || !gfx->hal) return; + if (!gfx || !gfx->initialized || !gfx->platform) return; - gfx->hal->present(gfx->platform_data); + gfx->platform->present(gfx->platform_data); } pxl8_viewport pxl8_gfx_viewport(pxl8_bounds bounds, i32 width, i32 height) { @@ -618,14 +617,14 @@ void pxl8_gfx_update(pxl8_gfx* gfx, f32 dt) { } } -static pxl8_3d_frame pxl8_3d_frame_from_camera(const pxl8_3d_camera* camera, const pxl8_shader_uniforms* uniforms) { +static pxl8_3d_frame pxl8_3d_frame_from_camera(const pxl8_camera3d* camera, const pxl8_shader_uniforms* uniforms) { pxl8_3d_frame frame = {0}; if (!camera) return frame; - frame.view = pxl8_3d_camera_get_view(camera); - frame.projection = pxl8_3d_camera_get_projection(camera); - frame.camera_pos = pxl8_3d_camera_get_position(camera); - frame.camera_dir = pxl8_3d_camera_get_forward(camera); + frame.view = pxl8_camera3d_get_view(camera); + frame.projection = pxl8_camera3d_get_projection(camera); + frame.camera_pos = pxl8_camera3d_get_position(camera); + frame.camera_dir = pxl8_camera3d_get_forward(camera); frame.near_clip = 1.0f; frame.far_clip = 4096.0f; @@ -636,16 +635,10 @@ static pxl8_3d_frame pxl8_3d_frame_from_camera(const pxl8_3d_camera* camera, con return frame; } -void pxl8_3d_set_bsp(pxl8_gfx* gfx, const pxl8_bsp* bsp) { - if (!gfx) return; - gfx->bsp = bsp; -} - -void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_3d_camera* camera, const pxl8_lights* lights, const pxl8_shader_uniforms* uniforms) { +void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_camera3d* camera, const pxl8_lights* lights, const pxl8_shader_uniforms* uniforms) { if (!gfx || !camera) return; pxl8_3d_frame frame = pxl8_3d_frame_from_camera(camera, uniforms); - frame.bsp = gfx->bsp; frame.uniforms.camera_pos = frame.camera_pos; frame.uniforms.lights = lights ? pxl8_lights_data(lights) : NULL; frame.uniforms.lights_count = lights ? pxl8_lights_count(lights) : 0; @@ -1102,9 +1095,9 @@ u8 pxl8_gfx_get_ambient(const pxl8_gfx* gfx) { } const pxl8_gfx_stats* pxl8_gfx_get_stats(const pxl8_gfx* gfx) { - return gfx ? pxl8_renderer_get_stats(gfx->renderer) : NULL; + return gfx ? pxl8_blit3d_get_stats(gfx->renderer) : NULL; } void pxl8_gfx_update_stats(pxl8_gfx* gfx, f32 dt) { - if (gfx) pxl8_renderer_update_stats(gfx->renderer, dt); + if (gfx) pxl8_blit3d_update_stats(gfx->renderer, dt); } diff --git a/src/gfx/pxl8_gfx.h b/src/gfx/pxl8_gfx.h index bbdb2be..7c74fa1 100644 --- a/src/gfx/pxl8_gfx.h +++ b/src/gfx/pxl8_gfx.h @@ -3,7 +3,7 @@ #include "pxl8_gfx2d.h" #include "pxl8_gfx3d.h" #include "pxl8_glows.h" -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_colormap.h" #include "pxl8_palette.h" #include "pxl8_types.h" @@ -36,7 +36,7 @@ typedef enum pxl8_gfx_effect { extern "C" { #endif -pxl8_gfx* pxl8_gfx_create(const pxl8_hal* hal, void* platform_data, pxl8_resolution resolution); +pxl8_gfx* pxl8_gfx_create(const pxl8_platform* platform, void* platform_data, pxl8_resolution resolution); void pxl8_gfx_destroy(pxl8_gfx* gfx); void pxl8_gfx_present(pxl8_gfx* gfx); diff --git a/src/gfx/pxl8_gfx3d.h b/src/gfx/pxl8_gfx3d.h index e462951..39277b7 100644 --- a/src/gfx/pxl8_gfx3d.h +++ b/src/gfx/pxl8_gfx3d.h @@ -1,18 +1,16 @@ #pragma once -#include "pxl8_3d_camera.h" +#include "pxl8_camera3d.h" #include "pxl8_lights.h" #include "pxl8_math.h" #include "pxl8_mesh.h" -#include "pxl8_render_types.h" +#include "pxl8_blit3d_types.h" #include "pxl8_shader.h" #include "pxl8_types.h" -typedef struct pxl8_bsp pxl8_bsp; typedef struct pxl8_gfx pxl8_gfx; typedef struct pxl8_3d_frame { - const pxl8_bsp* bsp; pxl8_vec3 camera_dir; pxl8_vec3 camera_pos; f32 far_clip; @@ -26,8 +24,7 @@ typedef struct pxl8_3d_frame { extern "C" { #endif -void pxl8_3d_set_bsp(pxl8_gfx* gfx, const pxl8_bsp* bsp); -void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_3d_camera* camera, const pxl8_lights* lights, const pxl8_shader_uniforms* uniforms); +void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_camera3d* camera, const pxl8_lights* lights, const pxl8_shader_uniforms* uniforms); void pxl8_3d_clear(pxl8_gfx* gfx, u8 color); void pxl8_3d_clear_depth(pxl8_gfx* gfx); void pxl8_3d_clear_stencil(pxl8_gfx* gfx, u8 value); diff --git a/src/gfx/pxl8_render.h b/src/gfx/pxl8_render.h deleted file mode 100644 index a66bdcb..0000000 --- a/src/gfx/pxl8_render.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include "pxl8_colormap.h" -#include "pxl8_gfx.h" -#include "pxl8_render_types.h" -#include "pxl8_shader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pxl8_renderer pxl8_renderer; -typedef struct pxl8_gfx_cmdbuf pxl8_gfx_cmdbuf; - -pxl8_renderer* pxl8_renderer_create(u32 width, u32 height); -void pxl8_renderer_destroy(pxl8_renderer* r); - -pxl8_gfx_bindings pxl8_create_bindings(pxl8_renderer* r, const pxl8_gfx_bindings_desc* desc); -pxl8_gfx_buffer pxl8_create_buffer(pxl8_renderer* r, const pxl8_gfx_buffer_desc* desc); -pxl8_gfx_pass pxl8_create_pass(pxl8_renderer* r, const pxl8_gfx_pass_desc* desc); -pxl8_gfx_pipeline pxl8_create_pipeline(pxl8_renderer* r, const pxl8_gfx_pipeline_desc* desc); -pxl8_gfx_texture pxl8_create_texture(pxl8_renderer* r, const pxl8_gfx_texture_desc* desc); - -void pxl8_destroy_bindings(pxl8_renderer* r, pxl8_gfx_bindings bnd); -void pxl8_destroy_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf); -void pxl8_destroy_pass(pxl8_renderer* r, pxl8_gfx_pass pass); -void pxl8_destroy_pipeline(pxl8_renderer* r, pxl8_gfx_pipeline pip); -void pxl8_destroy_texture(pxl8_renderer* r, pxl8_gfx_texture tex); - -void pxl8_update_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data); -i32 pxl8_append_buffer(pxl8_renderer* r, pxl8_gfx_buffer buf, const pxl8_gfx_range* data); -void pxl8_update_texture(pxl8_renderer* r, pxl8_gfx_texture tex, const pxl8_gfx_range* data, u32 x, u32 y, u32 w, u32 h); - -void* pxl8_texture_get_data(pxl8_renderer* r, pxl8_gfx_texture tex); -u32 pxl8_texture_get_width(pxl8_renderer* r, pxl8_gfx_texture tex); -u32 pxl8_texture_get_height(pxl8_renderer* r, pxl8_gfx_texture tex); - -pxl8_gfx_cmdbuf* pxl8_cmdbuf_create(u32 capacity); -void pxl8_cmdbuf_destroy(pxl8_gfx_cmdbuf* cb); -void pxl8_cmdbuf_reset(pxl8_gfx_cmdbuf* cb); - -void pxl8_begin_pass(pxl8_gfx_cmdbuf* cb, pxl8_gfx_pass pass); -void pxl8_cmdbuf_clear_depth(pxl8_gfx_cmdbuf* cb, pxl8_gfx_texture texture); -void pxl8_end_pass(pxl8_gfx_cmdbuf* cb); -void pxl8_set_bindings(pxl8_gfx_cmdbuf* cb, pxl8_gfx_bindings bindings); -void pxl8_set_draw_params(pxl8_gfx_cmdbuf* cb, const pxl8_gfx_cmd_draw_params* p); -void pxl8_set_pipeline(pxl8_gfx_cmdbuf* cb, pxl8_gfx_pipeline pipeline); -void pxl8_set_scissor(pxl8_gfx_cmdbuf* cb, i32 x, i32 y, u32 w, u32 h); -void pxl8_set_viewport(pxl8_gfx_cmdbuf* cb, i32 x, i32 y, u32 w, u32 h); -void pxl8_draw(pxl8_gfx_cmdbuf* cb, pxl8_gfx_buffer vb, pxl8_gfx_buffer ib, u32 first, u32 count, u32 base_vertex); - -void pxl8_gfx_submit(pxl8_renderer* r, pxl8_gfx_cmdbuf* cb); - -void pxl8_clear(pxl8_renderer* r, pxl8_gfx_texture target, u8 color); -void pxl8_clear_depth(pxl8_renderer* r, pxl8_gfx_texture target); -void pxl8_clear_stencil(pxl8_renderer* r, u8 value); - -void pxl8_draw_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, u8 color); -u8 pxl8_get_pixel(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y); -void pxl8_draw_line(pxl8_renderer* r, pxl8_gfx_texture target, i32 x0, i32 y0, i32 x1, i32 y1, u8 color); -void pxl8_draw_rect(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color); -void pxl8_draw_rect_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 x, i32 y, i32 w, i32 h, u8 color); -void pxl8_draw_circle(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color); -void pxl8_draw_circle_fill(pxl8_renderer* r, pxl8_gfx_texture target, i32 cx, i32 cy, i32 radius, u8 color); - -void pxl8_resolve_to_rgba(pxl8_renderer* r, pxl8_gfx_texture color, const u32* palette, u32* output); - -#ifdef __cplusplus -} -#endif diff --git a/src/lua/pxl8.lua b/src/lua/pxl8.lua index 079453d..4e8c641 100644 --- a/src/lua/pxl8.lua +++ b/src/lua/pxl8.lua @@ -12,7 +12,6 @@ local procgen = require("pxl8.procgen") local sfx = require("pxl8.sfx") local tilemap = require("pxl8.tilemap") local transition = require("pxl8.transition") -local world = require("pxl8.world") local pxl8 = {} core.init(pxl8_gfx, pxl8_input, pxl8_rng, pxl8_sfx, pxl8_sys) @@ -149,7 +148,7 @@ pxl8.mat4_rotate_z = math.mat4_rotate_z pxl8.mat4_scale = math.mat4_scale pxl8.mat4_translate = math.mat4_translate -pxl8.get_net = net.get +pxl8.net = net pxl8.pack_f32_be = bytes.pack_f32_be pxl8.pack_f32_le = bytes.pack_f32_le @@ -251,14 +250,4 @@ pxl8.STENCIL_NOTEQUAL = 5 pxl8.STENCIL_GEQUAL = 6 pxl8.STENCIL_ALWAYS = 7 -pxl8.Bsp = world.Bsp -pxl8.Chunk = world.Chunk -pxl8.World = world.World -pxl8.get_world = world.World.get -pxl8.sim_config = world.sim_config -pxl8.sim_move_player = world.sim_move_player -pxl8.sim_trace = world.sim_trace -pxl8.sim_check_ground = world.sim_check_ground -pxl8.make_input_msg = world.make_input_msg - return pxl8 diff --git a/src/lua/pxl8/gfx.lua b/src/lua/pxl8/gfx.lua index b4f9280..dae8b24 100644 --- a/src/lua/pxl8/gfx.lua +++ b/src/lua/pxl8/gfx.lua @@ -109,7 +109,7 @@ local Camera3D = {} Camera3D.__index = Camera3D function Camera3D.new() - local cam = C.pxl8_3d_camera_create() + local cam = C.pxl8_camera3d_create() if cam == nil then return nil end @@ -118,37 +118,37 @@ end function Camera3D:destroy() if self._ptr then - C.pxl8_3d_camera_destroy(self._ptr) + C.pxl8_camera3d_destroy(self._ptr) self._ptr = nil end end function Camera3D:get_forward() - local v = C.pxl8_3d_camera_get_forward(self._ptr) + local v = C.pxl8_camera3d_get_forward(self._ptr) return {v.x, v.y, v.z} end function Camera3D:get_position() - local v = C.pxl8_3d_camera_get_position(self._ptr) + local v = C.pxl8_camera3d_get_position(self._ptr) return {v.x, v.y, v.z} end function Camera3D:get_right() - local v = C.pxl8_3d_camera_get_right(self._ptr) + local v = C.pxl8_camera3d_get_right(self._ptr) return {v.x, v.y, v.z} end function Camera3D:get_up() - local v = C.pxl8_3d_camera_get_up(self._ptr) + local v = C.pxl8_camera3d_get_up(self._ptr) return {v.x, v.y, v.z} end function Camera3D:get_view() - return C.pxl8_3d_camera_get_view(self._ptr) + return C.pxl8_camera3d_get_view(self._ptr) end function Camera3D:get_projection() - return C.pxl8_3d_camera_get_projection(self._ptr) + return C.pxl8_camera3d_get_projection(self._ptr) end function Camera3D:lookat(eye, target, up) @@ -156,29 +156,29 @@ function Camera3D:lookat(eye, target, up) local eye_vec = ffi.new("pxl8_vec3", {x = eye[1], y = eye[2], z = eye[3]}) local target_vec = ffi.new("pxl8_vec3", {x = target[1], y = target[2], z = target[3]}) local up_vec = ffi.new("pxl8_vec3", {x = up[1], y = up[2], z = up[3]}) - C.pxl8_3d_camera_lookat(self._ptr, eye_vec, target_vec, up_vec) + C.pxl8_camera3d_lookat(self._ptr, eye_vec, target_vec, up_vec) end function Camera3D:set_perspective(fov, aspect, near, far) - C.pxl8_3d_camera_set_perspective(self._ptr, fov, aspect, near, far) + C.pxl8_camera3d_set_perspective(self._ptr, fov, aspect, near, far) end function Camera3D:set_position(x, y, z) local pos = ffi.new("pxl8_vec3", {x = x, y = y, z = z}) - C.pxl8_3d_camera_set_position(self._ptr, pos) + C.pxl8_camera3d_set_position(self._ptr, pos) end function Camera3D:set_rotation(pitch, yaw, roll) - C.pxl8_3d_camera_set_rotation(self._ptr, pitch, yaw or 0, roll or 0) + C.pxl8_camera3d_set_rotation(self._ptr, pitch, yaw or 0, roll or 0) end function Camera3D:update(dt) - C.pxl8_3d_camera_update(self._ptr, dt) + C.pxl8_camera3d_update(self._ptr, dt) end function Camera3D:world_to_screen(x, y, z, width, height) local pos = ffi.new("pxl8_vec3", {x = x, y = y, z = z}) - local result = C.pxl8_3d_camera_world_to_screen(self._ptr, pos, width, height) + local result = C.pxl8_camera3d_world_to_screen(self._ptr, pos, width, height) if result.visible then return {x = result.x, y = result.y, depth = result.depth} end diff --git a/src/lua/pxl8/net.lua b/src/lua/pxl8/net.lua index 36a3807..7ae2537 100644 --- a/src/lua/pxl8/net.lua +++ b/src/lua/pxl8/net.lua @@ -1,51 +1,41 @@ local ffi = require("ffi") local C = ffi.C -local core = require("pxl8.core") local net = {} local Net = {} Net.__index = Net -function net.get() - local ptr = C.pxl8_get_net(core.sys) +function net.create(config) + local cfg = ffi.new("pxl8_net_config") + cfg.address = config.address or "127.0.0.1" + cfg.port = config.port or 7777 + local ptr = C.pxl8_net_create(cfg) if ptr == nil then return nil end return setmetatable({ _ptr = ptr }, Net) end -function Net:chunk_cx() - return C.pxl8_net_chunk_cx(self._ptr) +function Net:destroy() + C.pxl8_net_destroy(self._ptr) + self._ptr = nil end -function Net:chunk_cz() - return C.pxl8_net_chunk_cz(self._ptr) -end - -function Net:has_chunk() - return C.pxl8_net_has_chunk(self._ptr) +function Net:connect() + return C.pxl8_net_connect(self._ptr) == 0 end function Net:connected() return C.pxl8_net_connected(self._ptr) end -function Net:send_input(input) - local msg = ffi.new("pxl8_input_msg") - msg.buttons = input.buttons or 0 - msg.look_dx = input.look_dx or 0 - msg.look_dy = input.look_dy or 0 - msg.move_x = input.move_x or 0 - msg.move_y = input.move_y or 0 - msg.yaw = input.yaw or 0 - msg.tick = input.tick or 0 - msg.timestamp = input.timestamp or 0 - return C.pxl8_net_send_input(self._ptr, msg) == 0 +function Net:disconnect() + C.pxl8_net_disconnect(self._ptr) end -function Net:spawn(x, y, z, yaw, pitch) - return C.pxl8_net_spawn(self._ptr, x or 0, y or 0, z or 0, yaw or 0, pitch or 0) == 0 +function Net:poll() + return C.pxl8_net_poll(self._ptr) end return net diff --git a/src/net/pxl8_net.c b/src/net/pxl8_net.c index 62093bb..f2bd6ee 100644 --- a/src/net/pxl8_net.c +++ b/src/net/pxl8_net.c @@ -3,18 +3,15 @@ #include #include -#include "pxl8_hal.h" +#include "pxl8_platform.h" #ifdef PXL8_ASYNC_THREADS #include #include "pxl8_queue.h" #endif -#include "pxl8_bytes.h" #include "pxl8_log.h" #include "pxl8_mem.h" -#include "pxl8_world.h" -#include "pxl8_world_chunk_cache.h" #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -37,7 +34,6 @@ #endif #define PXL8_NET_DEFAULT_PORT 7777 -#define PXL8_NET_TICK_RATE 30.0f struct pxl8_net { char address[256]; @@ -46,27 +42,6 @@ struct pxl8_net { struct sockaddr_in server_addr; socket_t sock; - pxl8_world_chunk_cache* chunk_cache; - i32 chunk_cx; - i32 chunk_cz; - bool has_chunk; - pxl8_world* world; - - u64 highest_tick; - f32 interp_time; - - pxl8_entity_state entities[PXL8_MAX_SNAPSHOT_ENTITIES]; - pxl8_entity_state prev_entities[PXL8_MAX_SNAPSHOT_ENTITIES]; - pxl8_snapshot_header prev_snapshot; - pxl8_snapshot_header snapshot; - - u64 input_head; - pxl8_input_msg input_history[PXL8_NET_INPUT_HISTORY_SIZE]; - u64 input_oldest_tick; - - u8 predicted_state[PXL8_NET_USERDATA_SIZE]; - u64 predicted_tick; - u8 recv_buf[4096]; u8 send_buf[4096]; @@ -77,13 +52,6 @@ struct pxl8_net { #endif }; -static const pxl8_entity_state* find_entity(const pxl8_entity_state* entities, u16 count, u64 id) { - for (u16 i = 0; i < count; i++) { - if (entities[i].entity_id == id) return &entities[i]; - } - return NULL; -} - pxl8_result pxl8_net_connect(pxl8_net* net) { if (!net) return PXL8_ERROR_INVALID_ARGUMENT; if (net->connected) return PXL8_OK; @@ -161,154 +129,11 @@ void pxl8_net_disconnect(pxl8_net* net) { net->connected = false; } -const pxl8_entity_state* pxl8_net_entities(const pxl8_net* net) { - if (!net) return NULL; - return net->entities; -} - -const u8* pxl8_net_entity_prev_userdata(const pxl8_net* net, u64 entity_id) { - if (!net) return NULL; - const pxl8_entity_state* e = find_entity(net->prev_entities, net->prev_snapshot.entity_count, entity_id); - return e ? e->userdata : NULL; -} - -const u8* pxl8_net_entity_userdata(const pxl8_net* net, u64 entity_id) { - if (!net) return NULL; - const pxl8_entity_state* e = find_entity(net->entities, net->snapshot.entity_count, entity_id); - return e ? e->userdata : NULL; -} - -const pxl8_input_msg* pxl8_net_input_at(const pxl8_net* net, u64 tick) { - if (!net) return NULL; - for (u64 i = 0; i < PXL8_NET_INPUT_HISTORY_SIZE; i++) { - if (net->input_history[i].tick == tick) { - return &net->input_history[i]; - } - } - return NULL; -} - -u64 pxl8_net_input_oldest_tick(const pxl8_net* net) { - if (!net) return 0; - return net->input_oldest_tick; -} - -void pxl8_net_input_push(pxl8_net* net, const pxl8_input_msg* input) { - if (!net || !input) return; - u64 idx = net->input_head % PXL8_NET_INPUT_HISTORY_SIZE; - net->input_history[idx] = *input; - net->input_head++; - if (net->input_oldest_tick == 0 || input->tick < net->input_oldest_tick) { - net->input_oldest_tick = input->tick; - } -} - -f32 pxl8_net_lerp_alpha(const pxl8_net* net) { - if (!net) return 1.0f; - f32 tick_duration = 1.0f / PXL8_NET_TICK_RATE; - f32 alpha = net->interp_time / tick_duration; - return alpha > 1.0f ? 1.0f : alpha; -} - -bool pxl8_net_needs_correction(const pxl8_net* net) { - if (!net) return false; - if (net->snapshot.tick == 0) return false; - if (net->predicted_tick == 0) return false; - if (net->snapshot.tick > net->predicted_tick) return true; - const u8* server = pxl8_net_entity_userdata(net, net->snapshot.player_id); - if (!server) return false; - return memcmp(server, net->predicted_state, PXL8_NET_USERDATA_SIZE) != 0; -} - -u64 pxl8_net_player_id(const pxl8_net* net) { - if (!net) return 0; - return net->snapshot.player_id; -} - -static bool dispatch_message(pxl8_net* net, const u8* data, usize len) { - if (len < sizeof(pxl8_msg_header)) return false; - - pxl8_msg_header hdr; - usize offset = pxl8_protocol_deserialize_header(data, len, &hdr); - - if (hdr.type == PXL8_MSG_CHUNK) { - if (!net->chunk_cache) return false; - - pxl8_chunk_msg_header chunk_hdr; - offset += pxl8_protocol_deserialize_chunk_msg_header(data + offset, len - offset, &chunk_hdr); - - const u8* payload = data + offset; - usize payload_len = chunk_hdr.payload_size; - if (payload_len > len - offset) { - payload_len = len - offset; - } - - pxl8_world_chunk_cache_receive(net->chunk_cache, &chunk_hdr, payload, payload_len); - return true; - } - - if (hdr.type == PXL8_MSG_CHUNK_ENTER) { - pxl8_chunk_enter_msg chunk_msg; - pxl8_protocol_deserialize_chunk_enter(data + offset, len - offset, &chunk_msg); - net->chunk_cx = chunk_msg.cx; - net->chunk_cz = chunk_msg.cz; - net->has_chunk = true; - pxl8_debug("[CLIENT] Received CHUNK_ENTER cx=%d cz=%d", chunk_msg.cx, chunk_msg.cz); - return true; - } - - if (hdr.type == PXL8_MSG_CHUNK_EXIT) { - net->has_chunk = false; - return true; - } - - if (hdr.type != PXL8_MSG_SNAPSHOT) return false; - - pxl8_snapshot_header snap; - offset += pxl8_protocol_deserialize_snapshot_header(data + offset, len - offset, &snap); - - if (snap.tick <= net->highest_tick) return false; - - memcpy(net->prev_entities, net->entities, sizeof(net->entities)); - net->prev_snapshot = net->snapshot; - - net->highest_tick = snap.tick; - net->snapshot = snap; - net->interp_time = 0.0f; - - u16 count = snap.entity_count; - if (count > PXL8_MAX_SNAPSHOT_ENTITIES) count = PXL8_MAX_SNAPSHOT_ENTITIES; - - for (u16 i = 0; i < count; i++) { - offset += pxl8_protocol_deserialize_entity_state( - data + offset, len - offset, &net->entities[i]); - } - - return true; -} - bool pxl8_net_poll(pxl8_net* net) { if (!net || !net->connected) return false; usize len = pxl8_net_recv(net, net->recv_buf, sizeof(net->recv_buf)); - u64 prev_tick = net->highest_tick; - if (!dispatch_message(net, net->recv_buf, len)) return false; - - if (net->highest_tick > prev_tick && net->world) { - pxl8_world_reconcile(net->world, net, 1.0f / 30.0f); - } - - return true; -} - -u8* pxl8_net_predicted_state(pxl8_net* net) { - if (!net) return NULL; - return net->predicted_state; -} - -void pxl8_net_predicted_tick_set(pxl8_net* net, u64 tick) { - if (!net) return; - net->predicted_tick = tick; + return len > 0; } usize pxl8_net_recv(pxl8_net* net, u8* buf, usize len) { @@ -330,103 +155,6 @@ pxl8_result pxl8_net_send(pxl8_net* net, const u8* data, usize len) { return (sent > 0) ? PXL8_OK : PXL8_ERROR_SYSTEM_FAILURE; } -pxl8_result pxl8_net_send_command(pxl8_net* net, const pxl8_command_msg* cmd) { - if (!net || !net->connected) return PXL8_ERROR_INVALID_ARGUMENT; - - u8 buf[sizeof(pxl8_msg_header) + sizeof(pxl8_command_msg)]; - pxl8_msg_header hdr = { - .type = PXL8_MSG_COMMAND, - .version = PXL8_PROTOCOL_VERSION, - .size = sizeof(pxl8_command_msg), - .sequence = 0 - }; - - usize offset = pxl8_protocol_serialize_header(&hdr, buf, sizeof(buf)); - offset += pxl8_protocol_serialize_command(cmd, buf + offset, sizeof(buf) - offset); - - return pxl8_net_send(net, buf, offset); -} - -pxl8_result pxl8_net_send_input(pxl8_net* net, const pxl8_input_msg* input) { - if (!net || !net->connected) return PXL8_ERROR_INVALID_ARGUMENT; - - pxl8_net_input_push(net, input); - - u8 buf[sizeof(pxl8_msg_header) + sizeof(pxl8_input_msg)]; - pxl8_msg_header hdr = { - .type = PXL8_MSG_INPUT, - .version = PXL8_PROTOCOL_VERSION, - .size = sizeof(pxl8_input_msg), - .sequence = 0 - }; - - usize offset = pxl8_protocol_serialize_header(&hdr, buf, sizeof(buf)); - offset += pxl8_protocol_serialize_input(input, buf + offset, sizeof(buf) - offset); - - return pxl8_net_send(net, buf, offset); -} - -const pxl8_snapshot_header* pxl8_net_snapshot(const pxl8_net* net) { - if (!net) return NULL; - return &net->snapshot; -} - -u64 pxl8_net_tick(const pxl8_net* net) { - if (!net) return 0; - return net->snapshot.tick; -} - -void pxl8_net_update(pxl8_net* net, f32 dt) { - if (!net) return; - net->interp_time += dt; -} - -void pxl8_net_set_chunk_cache(pxl8_net* net, pxl8_world_chunk_cache* cache) { - if (!net) return; - net->chunk_cache = cache; -} - -pxl8_world_chunk_cache* pxl8_net_chunk_cache(pxl8_net* net) { - if (!net) return NULL; - return net->chunk_cache; -} - -void pxl8_net_set_world(pxl8_net* net, pxl8_world* world) { - if (!net) return; - net->world = world; -} - -i32 pxl8_net_chunk_cx(const pxl8_net* net) { - if (!net) return 0; - return net->chunk_cx; -} - -i32 pxl8_net_chunk_cz(const pxl8_net* net) { - if (!net) return 0; - return net->chunk_cz; -} - -bool pxl8_net_has_chunk(const pxl8_net* net) { - if (!net) return false; - return net->has_chunk; -} - -pxl8_result pxl8_net_spawn(pxl8_net* net, f32 x, f32 y, f32 z, f32 yaw, f32 pitch) { - if (!net) return PXL8_ERROR_NULL_POINTER; - if (!net->connected) return PXL8_ERROR_NOT_CONNECTED; - - pxl8_command_msg cmd = {0}; - cmd.cmd_type = PXL8_CMD_SPAWN_ENTITY; - pxl8_pack_f32_be(cmd.payload, 0, x); - pxl8_pack_f32_be(cmd.payload, 4, y); - pxl8_pack_f32_be(cmd.payload, 8, z); - pxl8_pack_f32_be(cmd.payload, 12, yaw); - pxl8_pack_f32_be(cmd.payload, 16, pitch); - cmd.payload_size = 20; - - return pxl8_net_send_command(net, &cmd); -} - #ifdef PXL8_ASYNC_THREADS static int pxl8_net_recv_thread(void* data) { @@ -494,7 +222,9 @@ void pxl8_net_packet_free(pxl8_packet* pkt) { bool pxl8_net_process_packet(pxl8_net* net, const pxl8_packet* pkt) { if (!net || !pkt) return false; - return dispatch_message(net, pkt->data, pkt->len); + (void)net; + (void)pkt; + return false; } #endif diff --git a/src/net/pxl8_net.h b/src/net/pxl8_net.h index d470441..ab5b52a 100644 --- a/src/net/pxl8_net.h +++ b/src/net/pxl8_net.h @@ -1,19 +1,14 @@ #pragma once -#include "pxl8_protocol.h" #include "pxl8_types.h" #ifdef __cplusplus extern "C" { #endif -#define PXL8_NET_INPUT_HISTORY_SIZE 64 -#define PXL8_NET_USERDATA_SIZE 56 #define PXL8_NET_PACKET_MAX_SIZE 2048 typedef struct pxl8_net pxl8_net; -typedef struct pxl8_world pxl8_world; -typedef struct pxl8_world_chunk_cache pxl8_world_chunk_cache; typedef struct pxl8_packet { u8 data[PXL8_NET_PACKET_MAX_SIZE]; @@ -30,34 +25,9 @@ bool pxl8_net_connected(const pxl8_net* net); pxl8_net* pxl8_net_create(const pxl8_net_config* config); void pxl8_net_destroy(pxl8_net* net); void pxl8_net_disconnect(pxl8_net* net); -const pxl8_entity_state* pxl8_net_entities(const pxl8_net* net); -const u8* pxl8_net_entity_prev_userdata(const pxl8_net* net, u64 entity_id); -const u8* pxl8_net_entity_userdata(const pxl8_net* net, u64 entity_id); -const pxl8_input_msg* pxl8_net_input_at(const pxl8_net* net, u64 tick); -u64 pxl8_net_input_oldest_tick(const pxl8_net* net); -void pxl8_net_input_push(pxl8_net* net, const pxl8_input_msg* input); -f32 pxl8_net_lerp_alpha(const pxl8_net* net); -bool pxl8_net_needs_correction(const pxl8_net* net); -u64 pxl8_net_player_id(const pxl8_net* net); bool pxl8_net_poll(pxl8_net* net); -u8* pxl8_net_predicted_state(pxl8_net* net); -void pxl8_net_predicted_tick_set(pxl8_net* net, u64 tick); usize pxl8_net_recv(pxl8_net* net, u8* buf, usize len); pxl8_result pxl8_net_send(pxl8_net* net, const u8* data, usize len); -pxl8_result pxl8_net_send_command(pxl8_net* net, const pxl8_command_msg* cmd); -pxl8_result pxl8_net_send_input(pxl8_net* net, const pxl8_input_msg* input); -const pxl8_snapshot_header* pxl8_net_snapshot(const pxl8_net* net); -u64 pxl8_net_tick(const pxl8_net* net); -void pxl8_net_update(pxl8_net* net, f32 dt); -void pxl8_net_set_chunk_cache(pxl8_net* net, pxl8_world_chunk_cache* cache); -pxl8_world_chunk_cache* pxl8_net_chunk_cache(pxl8_net* net); -void pxl8_net_set_world(pxl8_net* net, pxl8_world* world); - -i32 pxl8_net_chunk_cx(const pxl8_net* net); -i32 pxl8_net_chunk_cz(const pxl8_net* net); -bool pxl8_net_has_chunk(const pxl8_net* net); - -pxl8_result pxl8_net_spawn(pxl8_net* net, f32 x, f32 y, f32 z, f32 yaw, f32 pitch); #ifdef PXL8_ASYNC_THREADS void pxl8_net_start_thread(pxl8_net* net); diff --git a/src/net/pxl8_protocol.h b/src/net/pxl8_protocol.h deleted file mode 100644 index 182c846..0000000 --- a/src/net/pxl8_protocol.h +++ /dev/null @@ -1,143 +0,0 @@ -#pragma once - -#include "pxl8_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PXL8_PROTOCOL_VERSION 1 -#define PXL8_MAX_SNAPSHOT_ENTITIES 256 -#define PXL8_MAX_SNAPSHOT_EVENTS 32 -#define PXL8_COMMAND_PAYLOAD_SIZE 64 -#define PXL8_EVENT_PAYLOAD_SIZE 15 - -typedef enum pxl8_msg_type { - PXL8_MSG_NONE = 0, - PXL8_MSG_CHUNK, - PXL8_MSG_CHUNK_ENTER, - PXL8_MSG_CHUNK_EXIT, - PXL8_MSG_COMMAND, - PXL8_MSG_CONNECT, - PXL8_MSG_DISCONNECT, - PXL8_MSG_EVENT, - PXL8_MSG_INPUT, - PXL8_MSG_SNAPSHOT -} pxl8_msg_type; - -typedef struct pxl8_msg_header { - u32 sequence; - u16 size; - u8 type; - u8 version; -} pxl8_msg_header; - -typedef enum pxl8_cmd_type { - PXL8_CMD_NONE = 0, - PXL8_CMD_SPAWN_ENTITY, -} pxl8_cmd_type; - -typedef struct pxl8_input_msg { - u32 buttons; - f32 look_dx; - f32 look_dy; - f32 move_x; - f32 move_y; - f32 yaw; - u64 tick; - u64 timestamp; -} pxl8_input_msg; - -typedef struct pxl8_command_msg { - u16 cmd_type; - u8 payload[PXL8_COMMAND_PAYLOAD_SIZE]; - u16 payload_size; - u64 tick; -} pxl8_command_msg; - -typedef struct pxl8_entity_state { - u64 entity_id; - u8 userdata[56]; -} pxl8_entity_state; - -typedef struct pxl8_event_msg { - u8 event_type; - u8 payload[PXL8_EVENT_PAYLOAD_SIZE]; -} pxl8_event_msg; - -typedef struct pxl8_snapshot_header { - u16 entity_count; - u16 event_count; - u64 player_id; - u64 tick; - f32 time; -} pxl8_snapshot_header; - -#define PXL8_CHUNK_TYPE_BSP 1 - -#define PXL8_CHUNK_FLAG_FINAL 0x04 -#define PXL8_CHUNK_MAX_PAYLOAD 1400 - -typedef struct pxl8_chunk_msg_header { - u8 chunk_type; - u8 flags; - u8 fragment_idx; - u8 fragment_count; - u32 id; - i32 cx, cy, cz; - u32 version; - u16 payload_size; - u16 reserved; -} pxl8_chunk_msg_header; - -typedef struct pxl8_bsp_wire_header { - u32 num_vertices; - u32 num_edges; - u32 num_faces; - u32 num_planes; - u32 num_nodes; - u32 num_leafs; - u32 num_surfedges; - u32 num_marksurfaces; - u32 num_cell_portals; - u32 visdata_size; - u32 num_vertex_lights; - u32 num_heightfield; -} pxl8_bsp_wire_header; - -usize pxl8_protocol_serialize_header(const pxl8_msg_header* msg, u8* buf, usize len); -usize pxl8_protocol_deserialize_header(const u8* buf, usize len, pxl8_msg_header* msg); - -usize pxl8_protocol_serialize_input(const pxl8_input_msg* msg, u8* buf, usize len); -usize pxl8_protocol_deserialize_input(const u8* buf, usize len, pxl8_input_msg* msg); - -usize pxl8_protocol_serialize_command(const pxl8_command_msg* msg, u8* buf, usize len); -usize pxl8_protocol_deserialize_command(const u8* buf, usize len, pxl8_command_msg* msg); - -usize pxl8_protocol_serialize_entity_state(const pxl8_entity_state* state, u8* buf, usize len); -usize pxl8_protocol_deserialize_entity_state(const u8* buf, usize len, pxl8_entity_state* state); - -usize pxl8_protocol_serialize_event(const pxl8_event_msg* msg, u8* buf, usize len); -usize pxl8_protocol_deserialize_event(const u8* buf, usize len, pxl8_event_msg* msg); - -usize pxl8_protocol_serialize_snapshot_header(const pxl8_snapshot_header* hdr, u8* buf, usize len); -usize pxl8_protocol_deserialize_snapshot_header(const u8* buf, usize len, pxl8_snapshot_header* hdr); - -usize pxl8_protocol_serialize_chunk_msg_header(const pxl8_chunk_msg_header* hdr, u8* buf, usize len); -usize pxl8_protocol_deserialize_chunk_msg_header(const u8* buf, usize len, pxl8_chunk_msg_header* hdr); - -usize pxl8_protocol_deserialize_bsp_wire_header(const u8* buf, usize len, pxl8_bsp_wire_header* hdr); - -typedef struct pxl8_chunk_enter_msg { - i32 cx; - i32 cz; -} pxl8_chunk_enter_msg; - -usize pxl8_protocol_serialize_chunk_enter(const pxl8_chunk_enter_msg* msg, u8* buf, usize len); -usize pxl8_protocol_deserialize_chunk_enter(const u8* buf, usize len, pxl8_chunk_enter_msg* msg); - -u32 pxl8_chunk_hash(i32 cx, i32 cz); - -#ifdef __cplusplus -} -#endif diff --git a/src/hal/pxl8_io_sdl3.c b/src/platform/pxl8_io_sdl3.c similarity index 100% rename from src/hal/pxl8_io_sdl3.c rename to src/platform/pxl8_io_sdl3.c diff --git a/src/hal/pxl8_mem.c b/src/platform/pxl8_mem.c similarity index 100% rename from src/hal/pxl8_mem.c rename to src/platform/pxl8_mem.c diff --git a/src/hal/pxl8_mem.h b/src/platform/pxl8_mem.h similarity index 100% rename from src/hal/pxl8_mem.h rename to src/platform/pxl8_mem.h diff --git a/src/hal/pxl8_mem_sdl3.c b/src/platform/pxl8_mem_sdl3.c similarity index 100% rename from src/hal/pxl8_mem_sdl3.c rename to src/platform/pxl8_mem_sdl3.c diff --git a/src/hal/pxl8_hal.h b/src/platform/pxl8_platform.h similarity index 97% rename from src/hal/pxl8_hal.h rename to src/platform/pxl8_platform.h index 94c934b..a2d5ff7 100644 --- a/src/hal/pxl8_hal.h +++ b/src/platform/pxl8_platform.h @@ -30,7 +30,7 @@ void pxl8_cond_wait(pxl8_cond* cond, pxl8_mutex* mutex); u64 pxl8_get_ticks_ns(void); void pxl8_sleep_ms(u32 ms); -typedef struct pxl8_hal { +typedef struct pxl8_platform { void* (*create)(i32 render_w, i32 render_h, const char* title, i32 win_w, i32 win_h); void (*destroy)(void* platform_data); @@ -48,4 +48,4 @@ typedef struct pxl8_hal { void (*audio_stop)(void* audio_handle); bool (*upload_audio)(void* audio_handle, const f32* stereo_samples, i32 sample_count); i32 (*audio_queued)(void* audio_handle); -} pxl8_hal; +} pxl8_platform; diff --git a/src/hal/pxl8_hal_sdl3.c b/src/platform/pxl8_platform_sdl3.c similarity index 98% rename from src/hal/pxl8_hal_sdl3.c rename to src/platform/pxl8_platform_sdl3.c index 58b8d33..4d7089a 100644 --- a/src/hal/pxl8_hal_sdl3.c +++ b/src/platform/pxl8_platform_sdl3.c @@ -1,4 +1,4 @@ -#include "pxl8_hal.h" +#include "pxl8_platform.h" #define SDL_MAIN_USE_CALLBACKS #include @@ -8,7 +8,7 @@ #include "pxl8_log.h" #include "pxl8_sys.h" -extern const pxl8_hal pxl8_hal_sdl3; +extern const pxl8_platform pxl8_platform_sdl3; typedef struct pxl8_sdl3_context { SDL_Texture* framebuffer; @@ -139,13 +139,15 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) { return SDL_APP_FAILURE; } - pxl8* sys = pxl8_create(&pxl8_hal_sdl3); + pxl8* sys = pxl8_create(&pxl8_platform_sdl3); if (!sys) { pxl8_error("Failed to create pxl8 system"); SDL_Quit(); return SDL_APP_FAILURE; } + pxl8_register_game(sys); + pxl8_result result = pxl8_init(sys, argc, argv); if (result != PXL8_OK) { pxl8_destroy(sys); @@ -395,7 +397,7 @@ static i32 sdl3_audio_queued(void* audio_handle) { return bytes / (audio->channels * sizeof(f32)); } -const pxl8_hal pxl8_hal_sdl3 = { +const pxl8_platform pxl8_platform_sdl3 = { .create = sdl3_create, .destroy = sdl3_destroy, .get_ticks = sdl3_get_ticks, diff --git a/src/hal/pxl8_thread_sdl3.c b/src/platform/pxl8_thread_sdl3.c similarity index 98% rename from src/hal/pxl8_thread_sdl3.c rename to src/platform/pxl8_thread_sdl3.c index 4eccdfb..9864101 100644 --- a/src/hal/pxl8_thread_sdl3.c +++ b/src/platform/pxl8_thread_sdl3.c @@ -1,4 +1,4 @@ -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include diff --git a/src/script/pxl8_script.c b/src/script/pxl8_script.c index 6a518fb..5f577fb 100644 --- a/src/script/pxl8_script.c +++ b/src/script/pxl8_script.c @@ -21,6 +21,8 @@ #include "pxl8_mem.h" #include "pxl8_script_ffi.h" +#define PXL8_SCRIPT_MAX_FFI_EXTENSIONS 8 + struct pxl8_script { lua_State* L; pxl8_gfx* gfx; @@ -32,6 +34,8 @@ struct pxl8_script { f64 latest_mod_time; int repl_env_ref; bool repl_mode; + const char* ffi_extensions[PXL8_SCRIPT_MAX_FFI_EXTENSIONS]; + u32 ffi_extension_count; }; #define PXL8_MAX_REPL_COMMAND_SIZE 4096 @@ -354,6 +358,33 @@ void pxl8_script_destroy(pxl8_script* script) { pxl8_free(script); } +void pxl8_script_add_ffi(pxl8_script* script, const char* cdefs) { + if (!script || !cdefs) return; + if (script->ffi_extension_count >= PXL8_SCRIPT_MAX_FFI_EXTENSIONS) return; + + script->ffi_extensions[script->ffi_extension_count++] = cdefs; + + if (script->L) { + lua_getglobal(script->L, "require"); + lua_pushstring(script->L, "ffi"); + if (lua_pcall(script->L, 1, 1, 0) != 0) { + pxl8_error("FFI require failed: %s", lua_tostring(script->L, -1)); + lua_pop(script->L, 1); + return; + } + + lua_getfield(script->L, -1, "cdef"); + lua_pushstring(script->L, cdefs); + if (lua_pcall(script->L, 1, 0, 0) != 0) { + pxl8_error("FFI extension cdef failed: %s", lua_tostring(script->L, -1)); + lua_pop(script->L, 1); + return; + } + + lua_pop(script->L, 1); + } +} + void pxl8_script_set_gfx(pxl8_script* script, pxl8_gfx* gfx) { if (!script) return; script->gfx = gfx; diff --git a/src/script/pxl8_script.h b/src/script/pxl8_script.h index 0e83c85..923586f 100644 --- a/src/script/pxl8_script.h +++ b/src/script/pxl8_script.h @@ -13,6 +13,7 @@ extern "C" { pxl8_script* pxl8_script_create(bool repl_mode); void pxl8_script_destroy(pxl8_script* script); +void pxl8_script_add_ffi(pxl8_script* script, const char* cdefs); const char* pxl8_script_get_last_error(pxl8_script* script); bool pxl8_script_is_incomplete_input(pxl8_script* script); diff --git a/src/script/pxl8_script_ffi.h b/src/script/pxl8_script_ffi.h index b85e4da..ea4dd24 100644 --- a/src/script/pxl8_script_ffi.h +++ b/src/script/pxl8_script_ffi.h @@ -238,27 +238,27 @@ static const char* pxl8_ffi_cdefs = " f32 time;\n" "} pxl8_3d_uniforms;\n" "\n" -"typedef struct pxl8_3d_camera pxl8_3d_camera;\n" -"pxl8_3d_camera* pxl8_3d_camera_create(void);\n" -"void pxl8_3d_camera_destroy(pxl8_3d_camera* cam);\n" -"void pxl8_3d_camera_set_perspective(pxl8_3d_camera* cam, f32 fov, f32 aspect, f32 near, f32 far);\n" -"void pxl8_3d_camera_set_position(pxl8_3d_camera* cam, pxl8_vec3 pos);\n" -"void pxl8_3d_camera_set_rotation(pxl8_3d_camera* cam, f32 pitch, f32 yaw, f32 roll);\n" -"void pxl8_3d_camera_lookat(pxl8_3d_camera* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up);\n" -"pxl8_vec3 pxl8_3d_camera_get_forward(const pxl8_3d_camera* cam);\n" -"pxl8_vec3 pxl8_3d_camera_get_position(const pxl8_3d_camera* cam);\n" -"pxl8_vec3 pxl8_3d_camera_get_right(const pxl8_3d_camera* cam);\n" -"pxl8_vec3 pxl8_3d_camera_get_up(const pxl8_3d_camera* cam);\n" -"pxl8_mat4 pxl8_3d_camera_get_view(const pxl8_3d_camera* cam);\n" -"pxl8_mat4 pxl8_3d_camera_get_projection(const pxl8_3d_camera* cam);\n" -"void pxl8_3d_camera_update(pxl8_3d_camera* cam, f32 dt);\n" +"typedef struct pxl8_camera3d pxl8_camera3d;\n" +"pxl8_camera3d* pxl8_camera3d_create(void);\n" +"void pxl8_camera3d_destroy(pxl8_camera3d* cam);\n" +"void pxl8_camera3d_set_perspective(pxl8_camera3d* cam, f32 fov, f32 aspect, f32 near, f32 far);\n" +"void pxl8_camera3d_set_position(pxl8_camera3d* cam, pxl8_vec3 pos);\n" +"void pxl8_camera3d_set_rotation(pxl8_camera3d* cam, f32 pitch, f32 yaw, f32 roll);\n" +"void pxl8_camera3d_lookat(pxl8_camera3d* cam, pxl8_vec3 eye, pxl8_vec3 target, pxl8_vec3 up);\n" +"pxl8_vec3 pxl8_camera3d_get_forward(const pxl8_camera3d* cam);\n" +"pxl8_vec3 pxl8_camera3d_get_position(const pxl8_camera3d* cam);\n" +"pxl8_vec3 pxl8_camera3d_get_right(const pxl8_camera3d* cam);\n" +"pxl8_vec3 pxl8_camera3d_get_up(const pxl8_camera3d* cam);\n" +"pxl8_mat4 pxl8_camera3d_get_view(const pxl8_camera3d* cam);\n" +"pxl8_mat4 pxl8_camera3d_get_projection(const pxl8_camera3d* cam);\n" +"void pxl8_camera3d_update(pxl8_camera3d* cam, f32 dt);\n" "typedef struct pxl8_projected_point { i32 x; i32 y; f32 depth; bool visible; } pxl8_projected_point;\n" -"pxl8_projected_point pxl8_3d_camera_world_to_screen(const pxl8_3d_camera* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height);\n" +"pxl8_projected_point pxl8_camera3d_world_to_screen(const pxl8_camera3d* cam, pxl8_vec3 world_pos, u32 screen_width, u32 screen_height);\n" "\n" "void pxl8_gfx_blend_tables_update(pxl8_gfx* gfx);\n" "void pxl8_gfx_colormap_update(pxl8_gfx* gfx);\n" "\n" -"void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_3d_camera* camera, const pxl8_lights* lights, const pxl8_3d_uniforms* uniforms);\n" +"void pxl8_3d_begin_frame(pxl8_gfx* gfx, const pxl8_camera3d* camera, const pxl8_lights* lights, const pxl8_3d_uniforms* uniforms);\n" "void pxl8_3d_clear(pxl8_gfx* gfx, u8 color);\n" "void pxl8_3d_clear_depth(pxl8_gfx* gfx);\n" "void pxl8_3d_clear_stencil(pxl8_gfx* gfx, uint8_t value);\n" @@ -408,50 +408,6 @@ static const char* pxl8_ffi_cdefs = "void pxl8_graph_set_seed(pxl8_graph* graph, u32 seed);\n" "void pxl8_graph_eval_texture(const pxl8_graph* graph, u8* buffer, i32 width, i32 height);\n" "\n" -"typedef struct pxl8_bsp pxl8_bsp;\n" -"\n" -"u32 pxl8_bsp_face_count(const pxl8_bsp* bsp);\n" -"pxl8_vec3 pxl8_bsp_face_normal(const pxl8_bsp* bsp, u32 face_id);\n" -"void pxl8_bsp_face_set_material(pxl8_bsp* bsp, u32 face_id, u16 material_id);\n" -"u8 pxl8_bsp_light_at(const pxl8_bsp* bsp, f32 x, f32 y, f32 z, u8 ambient);\n" -"\n" -"typedef struct pxl8_world_chunk {\n" -" u32 id;\n" -" u32 version;\n" -" pxl8_bsp* bsp;\n" -"} pxl8_world_chunk;\n" -"\n" -"typedef struct pxl8_world pxl8_world;\n" -"\n" -"typedef struct pxl8_ray {\n" -" pxl8_vec3 normal;\n" -" pxl8_vec3 point;\n" -" float fraction;\n" -" bool hit;\n" -"} pxl8_ray;\n" -"\n" -"pxl8_world* pxl8_get_world(pxl8* sys);\n" -"pxl8_world_chunk* pxl8_world_active_chunk(pxl8_world* world);\n" -"bool pxl8_world_point_solid(const pxl8_world* world, float x, float y, float z);\n" -"pxl8_ray pxl8_world_ray(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to);\n" -"pxl8_ray pxl8_world_sweep(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to, float radius);\n" -"void pxl8_world_render(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos);\n" -"void pxl8_world_set_bsp_material(pxl8_world* world, u16 material_id, const pxl8_gfx_material* material);\n" -"\n" -"typedef struct pxl8_sim_entity {\n" -" pxl8_vec3 pos;\n" -" pxl8_vec3 vel;\n" -" f32 yaw;\n" -" f32 pitch;\n" -" u32 flags;\n" -" u16 kind;\n" -" u16 _pad;\n" -"} pxl8_sim_entity;\n" -"\n" -"void pxl8_world_init_local_player(pxl8_world* world, f32 x, f32 y, f32 z);\n" -"void pxl8_world_set_look(pxl8_world* world, f32 yaw, f32 pitch);\n" -"pxl8_sim_entity* pxl8_world_local_player(pxl8_world* world);\n" -"\n" "typedef struct { i32 cursor_x; i32 cursor_y; bool cursor_down; bool cursor_clicked; u32 hot_id; u32 active_id; } pxl8_gui_state;\n" "pxl8_gui_state* pxl8_gui_state_create(void);\n" "void pxl8_gui_state_destroy(pxl8_gui_state* state);\n" @@ -533,95 +489,12 @@ static const char* pxl8_ffi_cdefs = "\n" "typedef struct pxl8_net pxl8_net;\n" "typedef struct pxl8_net_config { const char* address; u16 port; } pxl8_net_config;\n" -"typedef enum pxl8_cmd_type { PXL8_CMD_NONE = 0, PXL8_CMD_SPAWN_ENTITY } pxl8_cmd_type;\n" -"\n" -"typedef struct pxl8_command_msg {\n" -" u16 cmd_type;\n" -" u8 payload[64];\n" -" u16 payload_size;\n" -" u64 tick;\n" -"} pxl8_command_msg;\n" -"\n" -"typedef struct pxl8_input_msg {\n" -" u32 buttons;\n" -" f32 look_dx;\n" -" f32 look_dy;\n" -" f32 move_x;\n" -" f32 move_y;\n" -" f32 yaw;\n" -" u64 tick;\n" -" u64 timestamp;\n" -"} pxl8_input_msg;\n" -"\n" -"typedef struct pxl8_sim_config {\n" -" f32 move_speed;\n" -" f32 ground_accel;\n" -" f32 air_accel;\n" -" f32 stop_speed;\n" -" f32 friction;\n" -" f32 gravity;\n" -" f32 jump_velocity;\n" -" f32 player_radius;\n" -" f32 player_height;\n" -" f32 max_pitch;\n" -"} pxl8_sim_config;\n" -"\n" -"typedef struct pxl8_sim_world {\n" -" const pxl8_bsp* chunks[9];\n" -" i32 center_cx;\n" -" i32 center_cz;\n" -" f32 chunk_size;\n" -"} pxl8_sim_world;\n" -"\n" -"void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt);\n" -"void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt);\n" -"pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height);\n" -"bool pxl8_sim_check_ground(const pxl8_sim_world* world, pxl8_vec3 pos, f32 radius);\n" -"\n" -"pxl8_sim_world pxl8_world_sim_world(const pxl8_world* world, pxl8_vec3 pos);\n" -"void pxl8_world_set_sim_config(pxl8_world* world, const pxl8_sim_config* config);\n" -"void pxl8_world_push_input(pxl8_world* world, const pxl8_input_msg* input);\n" -"\n" -"typedef struct pxl8_entity_state {\n" -" u64 entity_id;\n" -" u8 userdata[56];\n" -"} pxl8_entity_state;\n" -"\n" -"typedef struct pxl8_snapshot_header {\n" -" u16 entity_count;\n" -" u16 event_count;\n" -" u64 player_id;\n" -" u64 tick;\n" -" f32 time;\n" -"} pxl8_snapshot_header;\n" -"\n" "i32 pxl8_net_connect(pxl8_net* net);\n" "bool pxl8_net_connected(const pxl8_net* net);\n" "pxl8_net* pxl8_net_create(const pxl8_net_config* config);\n" "void pxl8_net_destroy(pxl8_net* net);\n" "void pxl8_net_disconnect(pxl8_net* net);\n" -"const pxl8_entity_state* pxl8_net_entities(const pxl8_net* net);\n" -"const u8* pxl8_net_entity_prev_userdata(const pxl8_net* net, u64 entity_id);\n" -"const u8* pxl8_net_entity_userdata(const pxl8_net* net, u64 entity_id);\n" -"const pxl8_input_msg* pxl8_net_input_at(const pxl8_net* net, u64 tick);\n" -"u64 pxl8_net_input_oldest_tick(const pxl8_net* net);\n" -"void pxl8_net_input_push(pxl8_net* net, const pxl8_input_msg* input);\n" -"f32 pxl8_net_lerp_alpha(const pxl8_net* net);\n" -"bool pxl8_net_needs_correction(const pxl8_net* net);\n" -"u64 pxl8_net_player_id(const pxl8_net* net);\n" -"i32 pxl8_net_chunk_cx(const pxl8_net* net);\n" -"i32 pxl8_net_chunk_cz(const pxl8_net* net);\n" -"bool pxl8_net_has_chunk(const pxl8_net* net);\n" "bool pxl8_net_poll(pxl8_net* net);\n" -"u8* pxl8_net_predicted_state(pxl8_net* net);\n" -"void pxl8_net_predicted_tick_set(pxl8_net* net, u64 tick);\n" -"i32 pxl8_net_send_command(pxl8_net* net, const pxl8_command_msg* cmd);\n" -"i32 pxl8_net_send_input(pxl8_net* net, const pxl8_input_msg* input);\n" -"i32 pxl8_net_spawn(pxl8_net* net, f32 x, f32 y, f32 z, f32 yaw, f32 pitch);\n" -"const pxl8_snapshot_header* pxl8_net_snapshot(const pxl8_net* net);\n" -"u64 pxl8_net_tick(const pxl8_net* net);\n" -"void pxl8_net_update(pxl8_net* net, f32 dt);\n" -"pxl8_net* pxl8_get_net(const pxl8* sys);\n" "\n" "void pxl8_bit_clear(u32* val, u8 bit);\n" "u32 pxl8_bit_count(u32 val);\n" diff --git a/src/sfx/pxl8_sfx.c b/src/sfx/pxl8_sfx.c index 1d143d7..ab77bd1 100644 --- a/src/sfx/pxl8_sfx.c +++ b/src/sfx/pxl8_sfx.c @@ -3,7 +3,7 @@ #include #include -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_log.h" #include "pxl8_math.h" #include "pxl8_mem.h" @@ -140,7 +140,7 @@ struct pxl8_sfx_context { }; struct pxl8_sfx_mixer { - const pxl8_hal* hal; + const pxl8_platform* platform; void* audio_handle; pxl8_sfx_context* contexts[PXL8_SFX_MAX_CONTEXTS]; f32 master_volume; @@ -652,8 +652,8 @@ static void context_process_sample(pxl8_sfx_context* ctx, f32* out_left, f32* ou *out_right = right; } -pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_hal* hal) { - if (!hal || !hal->audio_create) return NULL; +pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_platform* platform) { + if (!platform || !platform->audio_create) return NULL; pxl8_sfx_mixer* mixer = (pxl8_sfx_mixer*)pxl8_calloc(1, sizeof(pxl8_sfx_mixer)); if (!mixer) return NULL; @@ -664,17 +664,17 @@ pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_hal* hal) { return NULL; } - mixer->hal = hal; + mixer->platform = platform; mixer->master_volume = 0.8f; - mixer->audio_handle = hal->audio_create(PXL8_SFX_SAMPLE_RATE, 2); + mixer->audio_handle = platform->audio_create(PXL8_SFX_SAMPLE_RATE, 2); if (!mixer->audio_handle) { pxl8_free(mixer->output_buffer); pxl8_free(mixer); return NULL; } - hal->audio_start(mixer->audio_handle); + platform->audio_start(mixer->audio_handle); pxl8_info("Audio mixer initialized: %d Hz, stereo, %d context slots", PXL8_SFX_SAMPLE_RATE, PXL8_SFX_MAX_CONTEXTS); return mixer; @@ -683,8 +683,8 @@ pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_hal* hal) { void pxl8_sfx_mixer_destroy(pxl8_sfx_mixer* mixer) { if (!mixer) return; - if (mixer->hal && mixer->audio_handle) { - mixer->hal->audio_destroy(mixer->audio_handle); + if (mixer->platform && mixer->audio_handle) { + mixer->platform->audio_destroy(mixer->audio_handle); } pxl8_free(mixer->output_buffer); @@ -692,9 +692,9 @@ void pxl8_sfx_mixer_destroy(pxl8_sfx_mixer* mixer) { } void pxl8_sfx_mixer_process(pxl8_sfx_mixer* mixer) { - if (!mixer || !mixer->hal || !mixer->audio_handle || !mixer->output_buffer) return; + if (!mixer || !mixer->platform || !mixer->audio_handle || !mixer->output_buffer) return; - i32 queued = mixer->hal->audio_queued(mixer->audio_handle); + i32 queued = mixer->platform->audio_queued(mixer->audio_handle); i32 target = PXL8_SFX_SAMPLE_RATE / 10; while (queued < target) { @@ -729,7 +729,7 @@ void pxl8_sfx_mixer_process(pxl8_sfx_mixer* mixer) { mixer->output_buffer[i * 2 + 1] = right; } - mixer->hal->upload_audio(mixer->audio_handle, mixer->output_buffer, samples_to_generate); + mixer->platform->upload_audio(mixer->audio_handle, mixer->output_buffer, samples_to_generate); queued += samples_to_generate; } } diff --git a/src/sfx/pxl8_sfx.h b/src/sfx/pxl8_sfx.h index 58520a0..a199ebf 100644 --- a/src/sfx/pxl8_sfx.h +++ b/src/sfx/pxl8_sfx.h @@ -1,6 +1,6 @@ #pragma once -#include "pxl8_hal.h" +#include "pxl8_platform.h" #include "pxl8_types.h" #define PXL8_SFX_BUFFER_SIZE 1024 @@ -115,7 +115,7 @@ typedef void (*pxl8_sfx_event_callback)(u8 event_type, u8 context_id, u8 note, f void pxl8_sfx_mixer_attach(pxl8_sfx_mixer* mixer, pxl8_sfx_context* ctx); void pxl8_sfx_mixer_clear(pxl8_sfx_mixer* mixer); -pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_hal* hal); +pxl8_sfx_mixer* pxl8_sfx_mixer_create(const pxl8_platform* platform); void pxl8_sfx_mixer_destroy(pxl8_sfx_mixer* mixer); void pxl8_sfx_mixer_detach(pxl8_sfx_mixer* mixer, pxl8_sfx_context* ctx); f32 pxl8_sfx_mixer_get_master_volume(const pxl8_sfx_mixer* mixer); diff --git a/src/sim/pxl8_sim.h b/src/sim/pxl8_sim.h deleted file mode 100644 index 7d05711..0000000 --- a/src/sim/pxl8_sim.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include "pxl8_bsp.h" -#include "pxl8_math.h" -#include "pxl8_protocol.h" -#include "pxl8_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PXL8_SIM_FLAG_ALIVE (1 << 0) -#define PXL8_SIM_FLAG_PLAYER (1 << 1) -#define PXL8_SIM_FLAG_GROUNDED (1 << 2) - -typedef struct pxl8_sim_config { - f32 move_speed; - f32 ground_accel; - f32 air_accel; - f32 stop_speed; - f32 friction; - f32 gravity; - f32 jump_velocity; - f32 player_radius; - f32 player_height; - f32 max_pitch; -} pxl8_sim_config; - -typedef struct pxl8_sim_entity { - pxl8_vec3 pos; - pxl8_vec3 vel; - f32 yaw; - f32 pitch; - u32 flags; - u16 kind; - u16 _pad; -} pxl8_sim_entity; - -typedef struct pxl8_sim_world { - const pxl8_bsp* chunks[9]; - i32 center_cx; - i32 center_cz; - f32 chunk_size; -} pxl8_sim_world; - -bool pxl8_bsp_point_solid(const pxl8_bsp* bsp, pxl8_vec3 pos); -pxl8_vec3 pxl8_bsp_trace(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius); - -pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height); -bool pxl8_sim_check_ground(const pxl8_sim_world* world, pxl8_vec3 pos, f32 radius); -void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt); -void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt); - -#ifdef __cplusplus -} -#endif diff --git a/src/world/pxl8_entity.h b/src/world/pxl8_entity.h deleted file mode 100644 index e66a05d..0000000 --- a/src/world/pxl8_entity.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "pxl8_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pxl8_entity_pool pxl8_entity_pool; - -typedef struct pxl8_entity { - u32 idx; - u32 gen; -} pxl8_entity; - -#define PXL8_ENTITY_INVALID ((pxl8_entity){0, 0}) - -typedef u32 pxl8_entity_component; -typedef u32 pxl8_entity_relationship; - -#define PXL8_ENTITY_COMPONENT_INVALID 0 -#define PXL8_ENTITY_RELATIONSHIP_INVALID 0 - -pxl8_entity_pool* pxl8_entity_pool_create(u32 capacity); -void pxl8_entity_pool_clear(pxl8_entity_pool* pool); -void pxl8_entity_pool_destroy(pxl8_entity_pool* pool); - -pxl8_entity pxl8_entity_spawn(pxl8_entity_pool* pool); -void pxl8_entity_despawn(pxl8_entity_pool* pool, pxl8_entity e); -bool pxl8_entity_alive(const pxl8_entity_pool* pool, pxl8_entity e); -u32 pxl8_entity_count(const pxl8_entity_pool* pool); - -pxl8_entity_component pxl8_entity_component_register(pxl8_entity_pool* pool, const char* name, u32 size); -pxl8_entity_component pxl8_entity_component_find(const pxl8_entity_pool* pool, const char* name); -const char* pxl8_entity_component_name(const pxl8_entity_pool* pool, pxl8_entity_component comp); - -void* pxl8_entity_component_add(pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp); -void* pxl8_entity_component_get(const pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp); -void pxl8_entity_component_remove(pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp); -bool pxl8_entity_component_has(const pxl8_entity_pool* pool, pxl8_entity e, pxl8_entity_component comp); - -pxl8_entity_relationship pxl8_entity_relationship_register(pxl8_entity_pool* pool, const char* name); -pxl8_entity_relationship pxl8_entity_relationship_find(const pxl8_entity_pool* pool, const char* name); -const char* pxl8_entity_relationship_name(const pxl8_entity_pool* pool, pxl8_entity_relationship rel); - -void pxl8_entity_relationship_add(pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object); -void pxl8_entity_relationship_remove(pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object); -bool pxl8_entity_relationship_has(const pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity object); - -u32 pxl8_entity_relationship_subjects(const pxl8_entity_pool* pool, pxl8_entity object, pxl8_entity_relationship rel, pxl8_entity* out, u32 max); -u32 pxl8_entity_relationship_objects(const pxl8_entity_pool* pool, pxl8_entity subject, pxl8_entity_relationship rel, pxl8_entity* out, u32 max); - -typedef void (*pxl8_entity_each_fn)(pxl8_entity_pool* pool, pxl8_entity e, void* ctx); -void pxl8_entity_each(pxl8_entity_pool* pool, pxl8_entity_component comp, pxl8_entity_each_fn fn, void* ctx); -void pxl8_entity_each_with(pxl8_entity_pool* pool, const pxl8_entity_component* comps, u32 count, pxl8_entity_each_fn fn, void* ctx); - -static inline bool pxl8_entity_valid(pxl8_entity e) { - return e.idx != 0 || e.gen != 0; -} - -static inline bool pxl8_entity_eq(pxl8_entity a, pxl8_entity b) { - return a.idx == b.idx && a.gen == b.gen; -} - -#ifdef __cplusplus -} -#endif diff --git a/src/world/pxl8_world.h b/src/world/pxl8_world.h deleted file mode 100644 index 55b2d02..0000000 --- a/src/world/pxl8_world.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include "pxl8_entity.h" -#include "pxl8_gfx.h" -#include "pxl8_gfx3d.h" -#include "pxl8_math.h" -#include "pxl8_net.h" -#include "pxl8_sim.h" -#include "pxl8_types.h" -#include "pxl8_world_chunk.h" -#include "pxl8_world_chunk_cache.h" -#include "pxl8_bsp_render.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PXL8_WORLD_MAX_LOADED_CHUNKS 25 - -typedef struct { - u16 leafs[16]; - u8 count; -} pxl8_edge_leafs; - -typedef struct pxl8_loaded_chunk { - pxl8_world_chunk* chunk; - pxl8_bsp_render_state* render_state; - pxl8_edge_leafs edges[4]; - i32 cx; - i32 cz; - bool active; -} pxl8_loaded_chunk; - -typedef struct pxl8_world pxl8_world; - -pxl8_world* pxl8_world_create(void); -void pxl8_world_destroy(pxl8_world* world); - -pxl8_world_chunk_cache* pxl8_world_get_chunk_cache(pxl8_world* world); -pxl8_world_chunk* pxl8_world_active_chunk(pxl8_world* world); - -bool pxl8_world_point_solid(const pxl8_world* world, f32 x, f32 y, f32 z); -pxl8_ray pxl8_world_ray(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to); -pxl8_ray pxl8_world_sweep(const pxl8_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius); - -void pxl8_world_update(pxl8_world* world, f32 dt); -void pxl8_world_render(pxl8_world* world, pxl8_gfx* gfx, pxl8_vec3 camera_pos); -void pxl8_world_sync(pxl8_world* world, pxl8_net* net); - -void pxl8_world_set_bsp_material(pxl8_world* world, u16 material_id, const pxl8_gfx_material* material); - -void pxl8_world_set_sim_config(pxl8_world* world, const pxl8_sim_config* config); -void pxl8_world_init_local_player(pxl8_world* world, f32 x, f32 y, f32 z); -void pxl8_world_set_look(pxl8_world* world, f32 yaw, f32 pitch); -pxl8_sim_entity* pxl8_world_local_player(pxl8_world* world); -pxl8_sim_world pxl8_world_sim_world(const pxl8_world* world, pxl8_vec3 pos); -void pxl8_world_predict(pxl8_world* world, pxl8_net* net, const pxl8_input_msg* input, f32 dt); -void pxl8_world_reconcile(pxl8_world* world, pxl8_net* net, f32 dt); - -#ifdef PXL8_ASYNC_THREADS -void pxl8_world_start_sim_thread(pxl8_world* world, pxl8_net* net); -void pxl8_world_stop_sim_thread(pxl8_world* world); -void pxl8_world_pause_sim(pxl8_world* world, bool paused); -void pxl8_world_push_input(pxl8_world* world, const pxl8_input_msg* input); -const pxl8_sim_entity* pxl8_world_get_render_state(const pxl8_world* world); -f32 pxl8_world_get_interp_alpha(const pxl8_world* world); -#endif - -#ifdef __cplusplus -} -#endif diff --git a/src/world/pxl8_world_chunk.c b/src/world/pxl8_world_chunk.c deleted file mode 100644 index be19fdc..0000000 --- a/src/world/pxl8_world_chunk.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "pxl8_world_chunk.h" - -#include "pxl8_bsp.h" -#include "pxl8_mem.h" - -pxl8_world_chunk* pxl8_world_chunk_create_bsp(u32 id) { - pxl8_world_chunk* chunk = pxl8_calloc(1, sizeof(pxl8_world_chunk)); - if (!chunk) return NULL; - chunk->id = id; - return chunk; -} - -void pxl8_world_chunk_destroy(pxl8_world_chunk* chunk) { - if (!chunk) return; - if (chunk->bsp) pxl8_bsp_destroy(chunk->bsp); - pxl8_free(chunk); -} diff --git a/src/world/pxl8_world_chunk.h b/src/world/pxl8_world_chunk.h deleted file mode 100644 index 3e9d8d3..0000000 --- a/src/world/pxl8_world_chunk.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "pxl8_bsp.h" -#include "pxl8_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pxl8_world_chunk { - u32 id; - u32 version; - pxl8_bsp* bsp; -} pxl8_world_chunk; - -pxl8_world_chunk* pxl8_world_chunk_create_bsp(u32 id); -void pxl8_world_chunk_destroy(pxl8_world_chunk* chunk); - -#ifdef __cplusplus -} -#endif diff --git a/src/world/pxl8_world_chunk_cache.h b/src/world/pxl8_world_chunk_cache.h deleted file mode 100644 index f3f73c2..0000000 --- a/src/world/pxl8_world_chunk_cache.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include "pxl8_mesh.h" -#include "pxl8_protocol.h" -#include "pxl8_types.h" -#include "pxl8_world_chunk.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PXL8_WORLD_CHUNK_CACHE_SIZE 512 -#define PXL8_WORLD_CHUNK_MAX_FRAGMENTS 255 -#define PXL8_WORLD_CHUNK_MAX_DATA_SIZE 131072 - -typedef struct pxl8_world_chunk_cache_entry { - pxl8_world_chunk* chunk; - u64 last_used; - bool valid; -} pxl8_world_chunk_cache_entry; - -typedef struct pxl8_world_chunk_assembly { - u32 id; - i32 cx, cy, cz; - u32 version; - u8 fragment_count; - u8 fragments_received; - u8* data; - u32 data_size; - u32 data_capacity; - bool active; - bool complete; -} pxl8_world_chunk_assembly; - -typedef struct pxl8_world_chunk_cache { - pxl8_world_chunk_cache_entry entries[PXL8_WORLD_CHUNK_CACHE_SIZE]; - pxl8_world_chunk_assembly assembly; - u32 entry_count; - u64 frame_counter; -} pxl8_world_chunk_cache; - -pxl8_world_chunk_cache* pxl8_world_chunk_cache_create(void); -void pxl8_world_chunk_cache_destroy(pxl8_world_chunk_cache* cache); - -pxl8_result pxl8_world_chunk_cache_receive(pxl8_world_chunk_cache* cache, - const pxl8_chunk_msg_header* hdr, - const u8* payload, usize len); - -pxl8_world_chunk* pxl8_world_chunk_cache_get_bsp(pxl8_world_chunk_cache* cache, u32 id); - -void pxl8_world_chunk_cache_tick(pxl8_world_chunk_cache* cache); - -#ifdef __cplusplus -} -#endif