├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── Makefile.mgw ├── README.md ├── TODO.md ├── appveyor.yml ├── buildres_mgw64.bat ├── cmake └── Modules │ ├── FindSDL2.cmake │ └── FindSDL2_mixer.cmake ├── data ├── BoosterChar.bmp ├── BoosterChar.pbm ├── CREDITS.txt ├── ChakoChar.bmp ├── ChakoChar.pbm ├── ColonChar.bmp ├── ColonChar.pbm ├── CrownChar.bmp ├── CrownChar.pbm ├── CurlyChar.bmp ├── CurlyChar.pbm ├── DrGeroChar.bmp ├── DrGeroChar.pbm ├── HumanSueChar.bmp ├── HumanSueChar.pbm ├── JackChar.bmp ├── JackChar.pbm ├── JenkaChar.bmp ├── JenkaChar.pbm ├── KingChar.bmp ├── KingChar.pbm ├── NurseHasumiChar.bmp ├── NurseHasumiChar.pbm ├── PuppyChar.bmp ├── PuppyChar.pbm ├── PuppyChar2.bmp ├── RootChar.bmp ├── RootChar.pbm ├── SantaChar.bmp ├── SantaChar.pbm ├── SoldierChar.bmp ├── SoldierChar.pbm ├── SoraChar.bmp ├── SoraChar.pbm ├── SueChar.bmp ├── SueChar.pbm ├── SuguriChar.bmp ├── SuguriChar.pbm ├── TorokoChar.bmp ├── TorokoChar.pbm ├── bkFog480fix.pbm ├── bkMoon480fix.pbm ├── endpic │ ├── credit01m.bmp │ ├── credit02m.bmp │ └── credit03m.bmp ├── font_1.fnt ├── font_1_0.png ├── font_2.fnt ├── font_2_0.png ├── font_3.fnt ├── font_3_0.png ├── font_4.fnt ├── font_4_0.png ├── font_5.fnt ├── font_5_0.png ├── sprites.sif ├── sprites2x.sif ├── system.json └── tilekey.dat ├── deps ├── json.hpp ├── spdlog │ ├── async.h │ ├── async_logger.h │ ├── common.h │ ├── details │ │ ├── async_logger_impl.h │ │ ├── circular_q.h │ │ ├── console_globals.h │ │ ├── file_helper.h │ │ ├── fmt_helper.h │ │ ├── log_msg.h │ │ ├── logger_impl.h │ │ ├── mpmc_blocking_q.h │ │ ├── null_mutex.h │ │ ├── os.h │ │ ├── pattern_formatter.h │ │ ├── periodic_worker.h │ │ ├── registry.h │ │ └── thread_pool.h │ ├── fmt │ │ ├── bin_to_hex.h │ │ ├── bundled │ │ │ ├── LICENSE.rst │ │ │ ├── chrono.h │ │ │ ├── color.h │ │ │ ├── core.h │ │ │ ├── format-inl.h │ │ │ ├── format.h │ │ │ ├── locale.h │ │ │ ├── ostream.h │ │ │ ├── posix.h │ │ │ ├── printf.h │ │ │ ├── ranges.h │ │ │ └── time.h │ │ ├── fmt.h │ │ └── ostr.h │ ├── formatter.h │ ├── logger.h │ ├── sinks │ │ ├── android_sink.h │ │ ├── ansicolor_sink.h │ │ ├── base_sink.h │ │ ├── basic_file_sink.h │ │ ├── daily_file_sink.h │ │ ├── dist_sink.h │ │ ├── msvc_sink.h │ │ ├── null_sink.h │ │ ├── ostream_sink.h │ │ ├── rotating_file_sink.h │ │ ├── sink.h │ │ ├── stdout_color_sinks.h │ │ ├── stdout_sinks.h │ │ ├── syslog_sink.h │ │ └── wincolor_sink.h │ ├── spdlog.h │ ├── tweakme.h │ └── version.h ├── utf8.h └── utf8 │ ├── checked.h │ ├── core.h │ └── unchecked.h ├── nx.sln ├── osx ├── Info.plist ├── bg.png └── icons.icns ├── platform └── win32 │ ├── ext │ ├── include │ │ ├── SDL.h │ │ ├── SDL_assert.h │ │ ├── SDL_atomic.h │ │ ├── SDL_audio.h │ │ ├── SDL_bits.h │ │ ├── SDL_blendmode.h │ │ ├── SDL_clipboard.h │ │ ├── SDL_config.h │ │ ├── SDL_config_android.h │ │ ├── SDL_config_iphoneos.h │ │ ├── SDL_config_macosx.h │ │ ├── SDL_config_minimal.h │ │ ├── SDL_config_pandora.h │ │ ├── SDL_config_psp.h │ │ ├── SDL_config_windows.h │ │ ├── SDL_config_winrt.h │ │ ├── SDL_config_wiz.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_egl.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_filesystem.h │ │ ├── SDL_gamecontroller.h │ │ ├── SDL_gesture.h │ │ ├── SDL_haptic.h │ │ ├── SDL_hints.h │ │ ├── SDL_image.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keycode.h │ │ ├── SDL_loadso.h │ │ ├── SDL_locale.h │ │ ├── SDL_log.h │ │ ├── SDL_main.h │ │ ├── SDL_messagebox.h │ │ ├── SDL_metal.h │ │ ├── SDL_misc.h │ │ ├── SDL_mixer.h │ │ ├── SDL_mouse.h │ │ ├── SDL_mutex.h │ │ ├── SDL_name.h │ │ ├── SDL_opengl.h │ │ ├── SDL_opengl_glext.h │ │ ├── SDL_opengles.h │ │ ├── SDL_opengles2.h │ │ ├── SDL_opengles2_gl2.h │ │ ├── SDL_opengles2_gl2ext.h │ │ ├── SDL_opengles2_gl2platform.h │ │ ├── SDL_opengles2_khrplatform.h │ │ ├── SDL_pixels.h │ │ ├── SDL_platform.h │ │ ├── SDL_power.h │ │ ├── SDL_quit.h │ │ ├── SDL_rect.h │ │ ├── SDL_render.h │ │ ├── SDL_revision.h │ │ ├── SDL_rwops.h │ │ ├── SDL_scancode.h │ │ ├── SDL_sensor.h │ │ ├── SDL_shape.h │ │ ├── SDL_stdinc.h │ │ ├── SDL_surface.h │ │ ├── SDL_system.h │ │ ├── SDL_syswm.h │ │ ├── SDL_test.h │ │ ├── SDL_test_assert.h │ │ ├── SDL_test_common.h │ │ ├── SDL_test_compare.h │ │ ├── SDL_test_crc32.h │ │ ├── SDL_test_font.h │ │ ├── SDL_test_fuzzer.h │ │ ├── SDL_test_harness.h │ │ ├── SDL_test_images.h │ │ ├── SDL_test_log.h │ │ ├── SDL_test_md5.h │ │ ├── SDL_test_memory.h │ │ ├── SDL_test_random.h │ │ ├── SDL_thread.h │ │ ├── SDL_timer.h │ │ ├── SDL_touch.h │ │ ├── SDL_types.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ ├── SDL_vulkan.h │ │ ├── begin_code.h │ │ ├── close_code.h │ │ ├── png.h │ │ ├── pngconf.h │ │ ├── pnglibconf.h │ │ ├── zconf.h │ │ └── zlib.h │ ├── lib │ │ ├── x64 │ │ │ ├── SDL2.lib │ │ │ ├── SDL2_image.lib │ │ │ ├── SDL2_mixer.lib │ │ │ ├── SDL2main.lib │ │ │ ├── SDL2test.lib │ │ │ └── libpng16.lib │ │ └── x86 │ │ │ ├── SDL2.lib │ │ │ ├── SDL2_image.lib │ │ │ ├── SDL2_mixer.lib │ │ │ ├── SDL2main.lib │ │ │ ├── SDL2test.lib │ │ │ └── libpng16.lib │ └── runtime │ │ └── x64 │ │ ├── SDL2.dll │ │ ├── SDL2_image.dll │ │ ├── SDL2_mixer.dll │ │ ├── libFLAC-8.dll │ │ ├── libjpeg-9.dll │ │ ├── libmodplug-1.dll │ │ ├── libmpg123-0.dll │ │ ├── libogg-0.dll │ │ ├── libopus-0.dll │ │ ├── libopusfile-0.dll │ │ ├── libpng16-16.dll │ │ ├── libpng16.dll │ │ ├── libtiff-5.dll │ │ ├── libvorbis-0.dll │ │ ├── libvorbisfile-3.dll │ │ ├── libwebp-7.dll │ │ └── zlib1.dll │ ├── extract │ ├── extract.vcxproj │ ├── extract.vcxproj.filters │ └── extract.vcxproj.user │ ├── nx │ ├── nx.aps │ ├── nx.rc │ ├── nx.vcxproj │ ├── nx.vcxproj.filters │ ├── nx.vcxproj.user │ ├── nx_mgw_built.res │ └── resource.h │ └── nx64x64.ico ├── screenshot.png ├── src ├── NetPlayer.cpp ├── NetPlayer.h ├── Networking.cpp ├── Networking.h ├── ObjManager.cpp ├── ObjManager.h ├── ResourceManager.cpp ├── ResourceManager.h ├── Singleton.h ├── TextBox │ ├── ItemImage.cpp │ ├── ItemImage.h │ ├── SaveSelect.cpp │ ├── SaveSelect.h │ ├── StageSelect.cpp │ ├── StageSelect.h │ ├── TextBox.cpp │ ├── TextBox.h │ ├── YesNoPrompt.cpp │ └── YesNoPrompt.h ├── Utils │ ├── Common.h │ ├── Logger.cpp │ └── Logger.h ├── ai │ ├── IrregularBBox.cpp │ ├── IrregularBBox.h │ ├── ai.cpp │ ├── ai.h │ ├── almond │ │ ├── almond.cpp │ │ └── almond.h │ ├── balrog_common.cpp │ ├── balrog_common.h │ ├── boss │ │ ├── balfrog.cpp │ │ ├── balfrog.h │ │ ├── ballos.cpp │ │ ├── ballos.h │ │ ├── core.cpp │ │ ├── core.h │ │ ├── heavypress.cpp │ │ ├── heavypress.h │ │ ├── ironhead.cpp │ │ ├── ironhead.h │ │ ├── omega.cpp │ │ ├── omega.h │ │ ├── sisters.cpp │ │ ├── sisters.h │ │ ├── undead_core.cpp │ │ ├── undead_core.h │ │ ├── x.cpp │ │ └── x.h │ ├── egg │ │ ├── egg.cpp │ │ ├── egg.h │ │ ├── egg2.cpp │ │ ├── egg2.h │ │ ├── igor.cpp │ │ └── igor.h │ ├── final_battle │ │ ├── balcony.cpp │ │ ├── balcony.h │ │ ├── doctor.cpp │ │ ├── doctor.h │ │ ├── doctor_common.cpp │ │ ├── doctor_common.h │ │ ├── doctor_frenzied.cpp │ │ ├── doctor_frenzied.h │ │ ├── final_misc.cpp │ │ ├── final_misc.h │ │ ├── misery.cpp │ │ ├── misery.h │ │ ├── sidekicks.cpp │ │ └── sidekicks.h │ ├── first_cave │ │ ├── first_cave.cpp │ │ └── first_cave.h │ ├── hell │ │ ├── ballos_misc.cpp │ │ ├── ballos_misc.h │ │ ├── ballos_priest.cpp │ │ ├── ballos_priest.h │ │ ├── hell.cpp │ │ └── hell.h │ ├── last_cave │ │ ├── last_cave.cpp │ │ └── last_cave.h │ ├── maze │ │ ├── balrog_boss_missiles.cpp │ │ ├── balrog_boss_missiles.h │ │ ├── critter_purple.cpp │ │ ├── critter_purple.h │ │ ├── gaudi.cpp │ │ ├── gaudi.h │ │ ├── labyrinth_m.cpp │ │ ├── labyrinth_m.h │ │ ├── maze.cpp │ │ ├── maze.h │ │ ├── pooh_black.cpp │ │ └── pooh_black.h │ ├── npc │ │ ├── balrog.cpp │ │ ├── balrog.h │ │ ├── curly.cpp │ │ ├── curly.h │ │ ├── curly_ai.cpp │ │ ├── curly_ai.h │ │ ├── misery.cpp │ │ ├── misery.h │ │ ├── npcguest.cpp │ │ ├── npcguest.h │ │ ├── npcplayer.cpp │ │ ├── npcplayer.h │ │ ├── npcregu.cpp │ │ └── npcregu.h │ ├── oside │ │ ├── oside.cpp │ │ └── oside.h │ ├── plantation │ │ ├── plantation.cpp │ │ └── plantation.h │ ├── sand │ │ ├── curly_boss.cpp │ │ ├── curly_boss.h │ │ ├── puppy.cpp │ │ ├── puppy.h │ │ ├── sand.cpp │ │ ├── sand.h │ │ ├── toroko_frenzied.cpp │ │ └── toroko_frenzied.h │ ├── stdai.h │ ├── sym │ │ ├── smoke.cpp │ │ ├── smoke.h │ │ ├── sym.cpp │ │ └── sym.h │ ├── village │ │ ├── balrog_boss_running.cpp │ │ ├── balrog_boss_running.h │ │ ├── ma_pignon.cpp │ │ ├── ma_pignon.h │ │ ├── village.cpp │ │ └── village.h │ ├── weapons │ │ ├── blade.cpp │ │ ├── blade.h │ │ ├── bubbler.cpp │ │ ├── bubbler.h │ │ ├── fireball.cpp │ │ ├── fireball.h │ │ ├── missile.cpp │ │ ├── missile.h │ │ ├── nemesis.cpp │ │ ├── nemesis.h │ │ ├── polar_mgun.cpp │ │ ├── polar_mgun.h │ │ ├── snake.cpp │ │ ├── snake.h │ │ ├── spur.cpp │ │ ├── spur.h │ │ ├── weapons.cpp │ │ ├── weapons.h │ │ ├── whimstar.cpp │ │ └── whimstar.h │ └── weed │ │ ├── balrog_boss_flying.cpp │ │ ├── balrog_boss_flying.h │ │ ├── frenzied_mimiga.cpp │ │ ├── frenzied_mimiga.h │ │ ├── weed.cpp │ │ └── weed.h ├── autogen │ ├── AssignSprites.cpp │ ├── AssignSprites.h │ ├── objnames.h │ └── sprites.h ├── caret.cpp ├── caret.h ├── chat.cpp ├── chat.h ├── common │ ├── InitList.cpp │ ├── InitList.h │ ├── basics.h │ ├── bufio.h │ ├── glob.cpp │ ├── glob.h │ ├── llist.h │ ├── misc.cpp │ ├── misc.h │ ├── myfnmatch.cpp │ └── myfnmatch.h ├── config.h ├── console.cpp ├── console.h ├── debug.cpp ├── debug.h ├── endgame │ ├── CredReader.cpp │ ├── CredReader.h │ ├── credits.cpp │ ├── credits.h │ ├── island.cpp │ ├── island.h │ ├── misc.cpp │ └── misc.h ├── extract │ ├── crc.cpp │ ├── crc.h │ ├── extractfiles.cpp │ ├── extractfiles.h │ ├── extractpxt.cpp │ ├── extractpxt.h │ ├── extractstages.cpp │ ├── extractstages.h │ └── main.cpp ├── floattext.cpp ├── floattext.h ├── game.cpp ├── game.h ├── graphics │ ├── Renderer.cpp │ ├── Renderer.h │ ├── Surface.cpp │ ├── Surface.h │ ├── font.cpp │ ├── font.h │ ├── nx_icon.h │ ├── pngfuncs.cpp │ ├── pngfuncs.h │ ├── sprites.cpp │ ├── sprites.h │ ├── tileset.cpp │ ├── tileset.h │ ├── types.h │ ├── zoom.cpp │ └── zoom.h ├── i18n │ ├── minibidi.cpp │ ├── minibidi.h │ ├── translate.cpp │ └── translate.h ├── input.cpp ├── input.h ├── intro │ ├── intro.cpp │ ├── intro.h │ ├── title.cpp │ └── title.h ├── inventory.cpp ├── inventory.h ├── ipfuncs.cpp ├── ipfuncs.h ├── main.cpp ├── map.cpp ├── map.h ├── map_system.cpp ├── map_system.h ├── maprecord.h ├── niku.cpp ├── niku.h ├── nx.h ├── object.cpp ├── object.h ├── p_arms.cpp ├── p_arms.h ├── pause │ ├── dialog.cpp │ ├── dialog.h │ ├── message.cpp │ ├── message.h │ ├── mods.cpp │ ├── mods.h │ ├── objects.cpp │ ├── objects.h │ ├── options.cpp │ ├── options.h │ ├── pause.cpp │ └── pause.h ├── player.cpp ├── player.h ├── playerstats.cpp ├── playerstats.h ├── profile.cpp ├── profile.h ├── screeneffect.cpp ├── screeneffect.h ├── settings.cpp ├── settings.h ├── siflib │ ├── sectSprites.cpp │ ├── sectSprites.h │ ├── sectStringArray.cpp │ ├── sectStringArray.h │ ├── sif.cpp │ ├── sif.h │ ├── sifloader.cpp │ └── sifloader.h ├── slope.cpp ├── slope.h ├── sound │ ├── Ogg.cpp │ ├── Ogg.h │ ├── Organya.cpp │ ├── Organya.h │ ├── Pixtone.cpp │ ├── Pixtone.h │ ├── SoundManager.cpp │ └── SoundManager.h ├── stageboss.cpp ├── stageboss.h ├── stagedata.cpp ├── stagedata.h ├── statusbar.cpp ├── statusbar.h ├── trig.cpp ├── trig.h ├── tsc.cpp ├── tsc.h └── version.h └── travis ├── linux.install.sh ├── osx.install.sh └── osx.package.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{c++,cc,cpp,cxx,h,h++,hh,hpp,hxx,inl,ipp,tlh,tli}] 4 | 5 | indent_style = space 6 | indent_size = 2 7 | cpp_space_pointer_reference_alignment = right -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | tools/ 3 | bin/ 4 | platform/win32/extract/Debug/ 5 | platform/win32/extract/x64/ 6 | platform/win32/.vs/ 7 | platform/win32/nx/Win32/Debug/ 8 | platform/win32/nx/Win32/Release/ 9 | platform/win32/nx/x64/Debug/ 10 | platform/win32/nx/x64/Release/ 11 | .vs/ 12 | platform/win32/nx/playerconfig.dat 13 | platform/win32/nx/chatlog.txt 14 | platform/win32/extract/Release -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | 3 | matrix: 4 | include: 5 | - os: linux 6 | sudo: required 7 | dist: trusty 8 | compiler: gcc 9 | env: 10 | - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" 11 | - INSTALLGCC=1 12 | 13 | - os: linux 14 | compiler: clang 15 | sudo: required 16 | dist: trusty 17 | 18 | - os: osx 19 | compiler: clang 20 | osx_image: xcode7.3 21 | 22 | 23 | script: 24 | - cmake -DCMAKE_BUILD_TYPE=Release . 25 | - make 26 | 27 | before_install: 28 | - eval "${MATRIX_EVAL}" 29 | 30 | install: 31 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then source ./travis/linux.install.sh; fi 32 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then source ./travis/osx.install.sh; fi 33 | 34 | before_deploy: 35 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then source ./travis/osx.package.sh; fi 36 | 37 | deploy: 38 | provider: releases 39 | api_key: 40 | secure: "Vsz4MVbXr6bf3yr0WLKZvqNVdRKr6l/GMxW/9REDpipBeG1HePyPuyFVYzUgfSVYVcJyqOuUQEp8VxQie3nP+C+8FCxhrb6kP7Auvq3rrIBoo8/gsNYTwuUzLla3pvwppYZVsgmWledzcO/78OlpygXgUI8MB3qfVnNQAhR601I=" 41 | file_glob: true 42 | file: NXEngine*.dmg 43 | skip_cleanup: true 44 | overwrite: true 45 | draft: true 46 | on: 47 | tags: true 48 | condition: "$TRAVIS_OS_NAME = osx" -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | 4 | include(CheckCXXCompilerFlag) 5 | 6 | project(nx) 7 | 8 | set (nx_VERSION_MAJOR 2) 9 | set (nx_VERSION_MINOR 6) 10 | 11 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") 12 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) 13 | 14 | find_package(SDL2 REQUIRED) 15 | 16 | include_directories(${SDL2_INCLUDE_DIR}) 17 | 18 | 19 | file(GLOB APP_SOURCES "src/[a-zA-Z]*.cpp") 20 | file(GLOB TB_SOURCES "src/TextBox/[a-zA-Z]*.cpp") 21 | file(GLOB_RECURSE AI_SOURCES "src/ai/[a-zA-Z]*.cpp") 22 | file(GLOB AG_SOURCES "src/autogen/[a-zA-Z]*.cpp") 23 | file(GLOB CM_SOURCES "src/common/[a-zA-Z]*.cpp") 24 | file(GLOB EG_SOURCES "src/endgame/[a-zA-Z]*.cpp") 25 | file(GLOB GR_SOURCES "src/graphics/[a-zA-Z]*.cpp") 26 | file(GLOB IN_SOURCES "src/intro/[a-zA-Z]*.cpp") 27 | file(GLOB PA_SOURCES "src/pause/[a-zA-Z]*.cpp") 28 | file(GLOB SL_SOURCES "src/siflib/[a-zA-Z]*.cpp") 29 | file(GLOB SN_SOURCES "src/sound/[a-zA-Z]*.cpp") 30 | file(GLOB I18N_SOURCES "src/i18n/[a-zA-Z]*.cpp") 31 | file(GLOB EXTR_SOURCES "src/extract/[a-zA-Z]*.cpp") 32 | set(EXTR_SOURCES 33 | ${EXTR_SOURCES} 34 | "src/common/misc.cpp" 35 | "src/common/stat.cpp" 36 | "src/stagedata.cpp" 37 | ) 38 | 39 | include_directories(${nx_SOURCE_DIR}) 40 | 41 | set(SOURCES 42 | ${APP_SOURCES} 43 | ${TB_SOURCES} 44 | ${AI_SOURCES} 45 | ${AG_SOURCES} 46 | ${CM_SOURCES} 47 | ${EG_SOURCES} 48 | ${GR_SOURCES} 49 | ${IN_SOURCES} 50 | ${PA_SOURCES} 51 | ${SL_SOURCES} 52 | ${SN_SOURCES} 53 | ${I18N_SOURCES} 54 | ) 55 | 56 | IF(CMAKE_BUILD_TYPE MATCHES Debug) 57 | message("debug mode") 58 | add_definitions(-DTRACE_SCRIPT) 59 | add_definitions(-DDEBUG) 60 | ENDIF() 61 | 62 | add_definitions("-Wall -std=c++11") 63 | add_executable(nx ${SOURCES}) 64 | target_link_libraries(nx ${SDL2_LIBRARY} ) 65 | 66 | add_executable(extract ${EXTR_SOURCES}) 67 | 68 | 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetXEngine 2 | 3 | A version of NXEngine designed to add online multiplayer. Based off of the [NXEngine-Evo refactor.](https://github.com/nxengine/nxengine-evo) 4 | Currently only for Windows, XP and up. 5 | 6 | ## Features 7 | 8 | * The ability to host, or join, online games 9 | * Various skins you can use on your character online 10 | * Support for Cave Story+ graphics 11 | * Support for Cave Story Switch music 12 | 13 | ## Compiling 14 | NetXEngine can be compiled on Visual Studio 2017 and up, MinGW-w64 (tested with TDM-GCC version 10.3.0), and MinGW32. 15 | 16 | ### Visual Studio 17 | Follow the instructions on [nxengine-evo's wiki.](https://github.com/nxengine/nxengine-evo/wiki/Building-on-Windows) 18 | 19 | ### TDM-GCC / MinGW-w64 20 | Enter the base directory in command line, then run `mingw32-make --file=Makefile.mgw` to build. Add DEBUG=1 to create a debug build for use with gdb. 21 | ### MinGW32 22 | Follow the instructions for w64, but add USE_MINGW32=1 onto the mingw32-make command. 23 | * Builds using 32 will lack debug logging. 24 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | * get rid of fopen and cleanup widen/narrow mess 2 | * drop out sif and use original data 3 | * make compatible with nicalis version 4 | * use wavs for drums? 5 | * rewrite renderer using modern OpenGL(ES) 6 | * Unify Ogg and Ogg11 -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 2.6.3.{build} 2 | 3 | pull_requests: 4 | do_not_increment_build_number: true 5 | 6 | configuration: Release 7 | 8 | platform: 9 | - x86 10 | - x64 11 | 12 | build: 13 | project: win32/nx.sln 14 | verbosity: minimal 15 | 16 | before_deploy: 17 | - ps: .\win32\win.package.ps1 18 | 19 | deploy: 20 | - provider: GitHub 21 | release: $(APPVEYOR_REPO_TAG_NAME) 22 | tag: $(APPVEYOR_REPO_TAG_NAME) 23 | description: '' 24 | auth_token: 25 | secure: UNAaCG+KMRMqZqVEHpSgXTXZOJlqEQ/7nySQ6U/LutHjXnuqVNpYDxoqIW1hufI+ 26 | artifact: /NXEngine-.*\.zip/ 27 | draft: true 28 | force_update: true 29 | prerelease: false 30 | on: 31 | appveyor_repo_tag: true 32 | -------------------------------------------------------------------------------- /buildres_mgw64.bat: -------------------------------------------------------------------------------- 1 | windres platform\win32\nx\nx.rc --target=pe-i386 -O coff -o platform\win32\nx\nx_mgw_built.res -------------------------------------------------------------------------------- /data/BoosterChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/BoosterChar.bmp -------------------------------------------------------------------------------- /data/BoosterChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/BoosterChar.pbm -------------------------------------------------------------------------------- /data/CREDITS.txt: -------------------------------------------------------------------------------- 1 | Jiink: Human Sue & Santa 2 | CharStorm/16BitWonder: Chako, Toroko, Puppy, Dr. Gero, Nurse Hasumi, Jenka 3 | Pluto: Mimiga Soldier -------------------------------------------------------------------------------- /data/ChakoChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/ChakoChar.bmp -------------------------------------------------------------------------------- /data/ChakoChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/ChakoChar.pbm -------------------------------------------------------------------------------- /data/ColonChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/ColonChar.bmp -------------------------------------------------------------------------------- /data/ColonChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/ColonChar.pbm -------------------------------------------------------------------------------- /data/CrownChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/CrownChar.bmp -------------------------------------------------------------------------------- /data/CrownChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/CrownChar.pbm -------------------------------------------------------------------------------- /data/CurlyChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/CurlyChar.bmp -------------------------------------------------------------------------------- /data/CurlyChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/CurlyChar.pbm -------------------------------------------------------------------------------- /data/DrGeroChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/DrGeroChar.bmp -------------------------------------------------------------------------------- /data/DrGeroChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/DrGeroChar.pbm -------------------------------------------------------------------------------- /data/HumanSueChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/HumanSueChar.bmp -------------------------------------------------------------------------------- /data/HumanSueChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/HumanSueChar.pbm -------------------------------------------------------------------------------- /data/JackChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/JackChar.bmp -------------------------------------------------------------------------------- /data/JackChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/JackChar.pbm -------------------------------------------------------------------------------- /data/JenkaChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/JenkaChar.bmp -------------------------------------------------------------------------------- /data/JenkaChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/JenkaChar.pbm -------------------------------------------------------------------------------- /data/KingChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/KingChar.bmp -------------------------------------------------------------------------------- /data/KingChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/KingChar.pbm -------------------------------------------------------------------------------- /data/NurseHasumiChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/NurseHasumiChar.bmp -------------------------------------------------------------------------------- /data/NurseHasumiChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/NurseHasumiChar.pbm -------------------------------------------------------------------------------- /data/PuppyChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/PuppyChar.bmp -------------------------------------------------------------------------------- /data/PuppyChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/PuppyChar.pbm -------------------------------------------------------------------------------- /data/PuppyChar2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/PuppyChar2.bmp -------------------------------------------------------------------------------- /data/RootChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/RootChar.bmp -------------------------------------------------------------------------------- /data/RootChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/RootChar.pbm -------------------------------------------------------------------------------- /data/SantaChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SantaChar.bmp -------------------------------------------------------------------------------- /data/SantaChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SantaChar.pbm -------------------------------------------------------------------------------- /data/SoldierChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SoldierChar.bmp -------------------------------------------------------------------------------- /data/SoldierChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SoldierChar.pbm -------------------------------------------------------------------------------- /data/SoraChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SoraChar.bmp -------------------------------------------------------------------------------- /data/SoraChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SoraChar.pbm -------------------------------------------------------------------------------- /data/SueChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SueChar.bmp -------------------------------------------------------------------------------- /data/SueChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SueChar.pbm -------------------------------------------------------------------------------- /data/SuguriChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SuguriChar.bmp -------------------------------------------------------------------------------- /data/SuguriChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/SuguriChar.pbm -------------------------------------------------------------------------------- /data/TorokoChar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/TorokoChar.bmp -------------------------------------------------------------------------------- /data/TorokoChar.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/TorokoChar.pbm -------------------------------------------------------------------------------- /data/bkFog480fix.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/bkFog480fix.pbm -------------------------------------------------------------------------------- /data/bkMoon480fix.pbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/bkMoon480fix.pbm -------------------------------------------------------------------------------- /data/endpic/credit01m.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/endpic/credit01m.bmp -------------------------------------------------------------------------------- /data/endpic/credit02m.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/endpic/credit02m.bmp -------------------------------------------------------------------------------- /data/endpic/credit03m.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/endpic/credit03m.bmp -------------------------------------------------------------------------------- /data/font_1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/font_1_0.png -------------------------------------------------------------------------------- /data/font_2_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/font_2_0.png -------------------------------------------------------------------------------- /data/font_3_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/font_3_0.png -------------------------------------------------------------------------------- /data/font_4_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/font_4_0.png -------------------------------------------------------------------------------- /data/font_5_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/font_5_0.png -------------------------------------------------------------------------------- /data/sprites.sif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/sprites.sif -------------------------------------------------------------------------------- /data/sprites2x.sif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/sprites2x.sif -------------------------------------------------------------------------------- /data/system.json: -------------------------------------------------------------------------------- 1 | { 2 | "english": "English" 3 | } 4 | 5 | -------------------------------------------------------------------------------- /data/tilekey.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/data/tilekey.dat -------------------------------------------------------------------------------- /deps/spdlog/details/circular_q.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | // cirucal q view of std::vector. 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace spdlog { 12 | namespace details { 13 | template 14 | class circular_q 15 | { 16 | public: 17 | using item_type = T; 18 | 19 | explicit circular_q(size_t max_items) 20 | : max_items_(max_items + 1) // one item is reserved as marker for full q 21 | , v_(max_items_) 22 | { 23 | } 24 | 25 | // push back, overrun (oldest) item if no room left 26 | void push_back(T &&item) 27 | { 28 | v_[tail_] = std::move(item); 29 | tail_ = (tail_ + 1) % max_items_; 30 | 31 | if (tail_ == head_) // overrun last item if full 32 | { 33 | head_ = (head_ + 1) % max_items_; 34 | ++overrun_counter_; 35 | } 36 | } 37 | 38 | // Pop item from front. 39 | // If there are no elements in the container, the behavior is undefined. 40 | void pop_front(T &popped_item) 41 | { 42 | popped_item = std::move(v_[head_]); 43 | head_ = (head_ + 1) % max_items_; 44 | } 45 | 46 | bool empty() 47 | { 48 | return tail_ == head_; 49 | } 50 | 51 | bool full() 52 | { 53 | // head is ahead of the tail by 1 54 | return ((tail_ + 1) % max_items_) == head_; 55 | } 56 | 57 | size_t overrun_counter() const 58 | { 59 | return overrun_counter_; 60 | } 61 | 62 | private: 63 | size_t max_items_; 64 | typename std::vector::size_type head_ = 0; 65 | typename std::vector::size_type tail_ = 0; 66 | 67 | std::vector v_; 68 | 69 | size_t overrun_counter_ = 0; 70 | }; 71 | } // namespace details 72 | } // namespace spdlog 73 | -------------------------------------------------------------------------------- /deps/spdlog/details/console_globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #include "spdlog/details/null_mutex.h" 8 | #include 9 | #include 10 | 11 | #ifdef _WIN32 12 | 13 | #ifndef NOMINMAX 14 | #define NOMINMAX // prevent windows redefining min/max 15 | #endif 16 | 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif 20 | 21 | #include 22 | #endif 23 | 24 | namespace spdlog { 25 | namespace details { 26 | struct console_stdout 27 | { 28 | static std::FILE *stream() 29 | { 30 | return stdout; 31 | } 32 | #ifdef _WIN32 33 | static HANDLE handle() 34 | { 35 | return ::GetStdHandle(STD_OUTPUT_HANDLE); 36 | } 37 | #endif 38 | }; 39 | 40 | struct console_stderr 41 | { 42 | static std::FILE *stream() 43 | { 44 | return stderr; 45 | } 46 | #ifdef _WIN32 47 | static HANDLE handle() 48 | { 49 | return ::GetStdHandle(STD_ERROR_HANDLE); 50 | } 51 | #endif 52 | }; 53 | 54 | struct console_mutex 55 | { 56 | using mutex_t = std::mutex; 57 | static mutex_t &mutex() 58 | { 59 | static mutex_t s_mutex; 60 | return s_mutex; 61 | } 62 | }; 63 | 64 | struct console_nullmutex 65 | { 66 | using mutex_t = null_mutex; 67 | static mutex_t &mutex() 68 | { 69 | static mutex_t s_mutex; 70 | return s_mutex; 71 | } 72 | }; 73 | } // namespace details 74 | } // namespace spdlog 75 | -------------------------------------------------------------------------------- /deps/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/common.h" 9 | #include "spdlog/details/os.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace spdlog { 15 | namespace details { 16 | struct log_msg 17 | { 18 | 19 | log_msg(source_loc loc, const std::string *loggers_name, level::level_enum lvl, string_view_t view) 20 | : logger_name(loggers_name) 21 | , level(lvl) 22 | #ifndef SPDLOG_NO_DATETIME 23 | , time(os::now()) 24 | #endif 25 | 26 | #ifndef SPDLOG_NO_THREAD_ID 27 | , thread_id(os::thread_id()) 28 | #endif 29 | , source(loc) 30 | , payload(view) 31 | { 32 | } 33 | 34 | log_msg(const std::string *loggers_name, level::level_enum lvl, string_view_t view) 35 | : log_msg(source_loc{}, loggers_name, lvl, view) 36 | { 37 | } 38 | 39 | log_msg(const log_msg &other) = default; 40 | 41 | const std::string *logger_name{nullptr}; 42 | level::level_enum level{level::off}; 43 | log_clock::time_point time; 44 | size_t thread_id{0}; 45 | size_t msg_id{0}; 46 | 47 | // wrapping the formatted text with color (updated by pattern_formatter). 48 | mutable size_t color_range_start{0}; 49 | mutable size_t color_range_end{0}; 50 | 51 | source_loc source; 52 | const string_view_t payload; 53 | }; 54 | } // namespace details 55 | } // namespace spdlog 56 | -------------------------------------------------------------------------------- /deps/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | // null, no cost dummy "mutex" and dummy "atomic" int 10 | 11 | namespace spdlog { 12 | namespace details { 13 | struct null_mutex 14 | { 15 | void lock() {} 16 | void unlock() {} 17 | bool try_lock() 18 | { 19 | return true; 20 | } 21 | }; 22 | 23 | struct null_atomic_int 24 | { 25 | int value; 26 | null_atomic_int() = default; 27 | 28 | explicit null_atomic_int(int val) 29 | : value(val) 30 | { 31 | } 32 | 33 | int load(std::memory_order) const 34 | { 35 | return value; 36 | } 37 | 38 | void store(int val) 39 | { 40 | value = val; 41 | } 42 | }; 43 | 44 | } // namespace details 45 | } // namespace spdlog 46 | -------------------------------------------------------------------------------- /deps/spdlog/details/periodic_worker.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #pragma once 8 | 9 | // periodic worker thread - periodically executes the given callback function. 10 | // 11 | // RAII over the owned thread: 12 | // creates the thread on construction. 13 | // stops and joins the thread on destruction (if the thread is executing a callback, wait for it to finish first). 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | namespace spdlog { 21 | namespace details { 22 | 23 | class periodic_worker 24 | { 25 | public: 26 | periodic_worker(const std::function &callback_fun, std::chrono::seconds interval) 27 | { 28 | active_ = (interval > std::chrono::seconds::zero()); 29 | if (!active_) 30 | { 31 | return; 32 | } 33 | 34 | worker_thread_ = std::thread([this, callback_fun, interval]() { 35 | for (;;) 36 | { 37 | std::unique_lock lock(this->mutex_); 38 | if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) 39 | { 40 | return; // active_ == false, so exit this thread 41 | } 42 | callback_fun(); 43 | } 44 | }); 45 | } 46 | 47 | periodic_worker(const periodic_worker &) = delete; 48 | periodic_worker &operator=(const periodic_worker &) = delete; 49 | 50 | // stop the worker thread and join it 51 | ~periodic_worker() 52 | { 53 | if (worker_thread_.joinable()) 54 | { 55 | { 56 | std::lock_guard lock(mutex_); 57 | active_ = false; 58 | } 59 | cv_.notify_one(); 60 | worker_thread_.join(); 61 | } 62 | } 63 | 64 | private: 65 | bool active_; 66 | std::thread worker_thread_; 67 | std::mutex mutex_; 68 | std::condition_variable cv_; 69 | }; 70 | } // namespace details 71 | } // namespace spdlog 72 | -------------------------------------------------------------------------------- /deps/spdlog/fmt/bundled/LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2016, Victor Zverovich 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /deps/spdlog/fmt/fmt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Include a bundled header-only copy of fmtlib or an external one. 10 | // By default spdlog include its own copy. 11 | // 12 | 13 | #if !defined(SPDLOG_FMT_EXTERNAL) 14 | #ifndef FMT_HEADER_ONLY 15 | #define FMT_HEADER_ONLY 16 | #endif 17 | #ifndef FMT_USE_WINDOWS_H 18 | #define FMT_USE_WINDOWS_H 0 19 | #endif 20 | #include "bundled/core.h" 21 | #include "bundled/format.h" 22 | #else // external fmtlib 23 | #include 24 | #include 25 | #endif 26 | -------------------------------------------------------------------------------- /deps/spdlog/fmt/ostr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's ostream support 9 | // 10 | #if !defined(SPDLOG_FMT_EXTERNAL) 11 | #ifndef FMT_HEADER_ONLY 12 | #define FMT_HEADER_ONLY 13 | #endif 14 | #include "bundled/ostream.h" 15 | #include "fmt.h" 16 | #else 17 | #include 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "fmt/fmt.h" 9 | #include "spdlog/details/log_msg.h" 10 | 11 | namespace spdlog { 12 | 13 | class formatter 14 | { 15 | public: 16 | virtual ~formatter() = default; 17 | virtual void format(const details::log_msg &msg, fmt::memory_buffer &dest) = 0; 18 | virtual std::unique_ptr clone() const = 0; 19 | }; 20 | } // namespace spdlog 21 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or real) 9 | // concrete implementation should override the sink_it_() and flush_() methods. 10 | // locking is taken care of in this class - no locking needed by the 11 | // implementers.. 12 | // 13 | 14 | #include "spdlog/common.h" 15 | #include "spdlog/details/log_msg.h" 16 | #include "spdlog/formatter.h" 17 | #include "spdlog/sinks/sink.h" 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | template 22 | class base_sink : public sink 23 | { 24 | public: 25 | base_sink() = default; 26 | base_sink(const base_sink &) = delete; 27 | base_sink &operator=(const base_sink &) = delete; 28 | 29 | void log(const details::log_msg &msg) final 30 | { 31 | std::lock_guard lock(mutex_); 32 | sink_it_(msg); 33 | } 34 | 35 | void flush() final 36 | { 37 | std::lock_guard lock(mutex_); 38 | flush_(); 39 | } 40 | 41 | void set_pattern(const std::string &pattern) final 42 | { 43 | std::lock_guard lock(mutex_); 44 | set_pattern_(pattern); 45 | } 46 | 47 | void set_formatter(std::unique_ptr sink_formatter) final 48 | { 49 | std::lock_guard lock(mutex_); 50 | set_formatter_(std::move(sink_formatter)); 51 | } 52 | 53 | protected: 54 | virtual void sink_it_(const details::log_msg &msg) = 0; 55 | virtual void flush_() = 0; 56 | 57 | virtual void set_pattern_(const std::string &pattern) 58 | { 59 | set_formatter_(details::make_unique(pattern)); 60 | } 61 | 62 | virtual void set_formatter_(std::unique_ptr sink_formatter) 63 | { 64 | formatter_ = std::move(sink_formatter); 65 | } 66 | Mutex mutex_; 67 | }; 68 | } // namespace sinks 69 | } // namespace spdlog 70 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/basic_file_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/file_helper.h" 13 | #include "spdlog/details/null_mutex.h" 14 | #include "spdlog/sinks/base_sink.h" 15 | 16 | #include 17 | #include 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | /* 22 | * Trivial file sink with single file as target 23 | */ 24 | template 25 | class basic_file_sink final : public base_sink 26 | { 27 | public: 28 | explicit basic_file_sink(const filename_t &filename, bool truncate = false) 29 | { 30 | file_helper_.open(filename, truncate); 31 | } 32 | 33 | protected: 34 | void sink_it_(const details::log_msg &msg) override 35 | { 36 | fmt::memory_buffer formatted; 37 | sink::formatter_->format(msg, formatted); 38 | file_helper_.write(formatted); 39 | } 40 | 41 | void flush_() override 42 | { 43 | file_helper_.flush(); 44 | } 45 | 46 | private: 47 | details::file_helper file_helper_; 48 | }; 49 | 50 | using basic_file_sink_mt = basic_file_sink; 51 | using basic_file_sink_st = basic_file_sink; 52 | 53 | } // namespace sinks 54 | 55 | // 56 | // factory functions 57 | // 58 | template 59 | inline std::shared_ptr basic_logger_mt(const std::string &logger_name, const filename_t &filename, bool truncate = false) 60 | { 61 | return Factory::template create(logger_name, filename, truncate); 62 | } 63 | 64 | template 65 | inline std::shared_ptr basic_logger_st(const std::string &logger_name, const filename_t &filename, bool truncate = false) 66 | { 67 | return Factory::template create(logger_name, filename, truncate); 68 | } 69 | 70 | } // namespace spdlog 71 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/msvc_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Alexander Dalshov. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #if defined(_WIN32) 13 | 14 | #include "spdlog/details/null_mutex.h" 15 | #include "spdlog/sinks/base_sink.h" 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | namespace spdlog { 23 | namespace sinks { 24 | /* 25 | * MSVC sink (logging using OutputDebugStringA) 26 | */ 27 | template 28 | class msvc_sink : public base_sink 29 | { 30 | public: 31 | explicit msvc_sink() {} 32 | 33 | protected: 34 | void sink_it_(const details::log_msg &msg) override 35 | { 36 | 37 | fmt::memory_buffer formatted; 38 | sink::formatter_->format(msg, formatted); 39 | OutputDebugStringA(fmt::to_string(formatted).c_str()); 40 | } 41 | 42 | void flush_() override {} 43 | }; 44 | 45 | using msvc_sink_mt = msvc_sink; 46 | using msvc_sink_st = msvc_sink; 47 | 48 | using windebug_sink_mt = msvc_sink_mt; 49 | using windebug_sink_st = msvc_sink_st; 50 | 51 | } // namespace sinks 52 | } // namespace spdlog 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | 17 | namespace spdlog { 18 | namespace sinks { 19 | 20 | template 21 | class null_sink : public base_sink 22 | { 23 | protected: 24 | void sink_it_(const details::log_msg &) override {} 25 | void flush_() override {} 26 | }; 27 | 28 | using null_sink_mt = null_sink; 29 | using null_sink_st = null_sink; 30 | 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr null_logger_mt(const std::string &logger_name) 35 | { 36 | auto null_logger = Factory::template create(logger_name); 37 | null_logger->set_level(level::off); 38 | return null_logger; 39 | } 40 | 41 | template 42 | inline std::shared_ptr null_logger_st(const std::string &logger_name) 43 | { 44 | auto null_logger = Factory::template create(logger_name); 45 | null_logger->set_level(level::off); 46 | return null_logger; 47 | } 48 | 49 | } // namespace spdlog 50 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | template 21 | class ostream_sink final : public base_sink 22 | { 23 | public: 24 | explicit ostream_sink(std::ostream &os, bool force_flush = false) 25 | : ostream_(os) 26 | , force_flush_(force_flush) 27 | { 28 | } 29 | ostream_sink(const ostream_sink &) = delete; 30 | ostream_sink &operator=(const ostream_sink &) = delete; 31 | 32 | protected: 33 | void sink_it_(const details::log_msg &msg) override 34 | { 35 | fmt::memory_buffer formatted; 36 | sink::formatter_->format(msg, formatted); 37 | ostream_.write(formatted.data(), static_cast(formatted.size())); 38 | if (force_flush_) 39 | { 40 | ostream_.flush(); 41 | } 42 | } 43 | 44 | void flush_() override 45 | { 46 | ostream_.flush(); 47 | } 48 | 49 | std::ostream &ostream_; 50 | bool force_flush_; 51 | }; 52 | 53 | using ostream_sink_mt = ostream_sink; 54 | using ostream_sink_st = ostream_sink; 55 | 56 | } // namespace sinks 57 | } // namespace spdlog 58 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/details/log_msg.h" 9 | #include "spdlog/details/pattern_formatter.h" 10 | #include "spdlog/formatter.h" 11 | 12 | namespace spdlog { 13 | namespace sinks { 14 | class sink 15 | { 16 | public: 17 | sink() 18 | : level_(level::trace) 19 | , formatter_(new pattern_formatter()) 20 | { 21 | } 22 | 23 | explicit sink(std::unique_ptr formatter) 24 | : level_(level::trace) 25 | , formatter_(std::move(formatter)) 26 | { 27 | } 28 | 29 | virtual ~sink() = default; 30 | virtual void log(const details::log_msg &msg) = 0; 31 | virtual void flush() = 0; 32 | virtual void set_pattern(const std::string &pattern) = 0; 33 | virtual void set_formatter(std::unique_ptr sink_formatter) = 0; 34 | 35 | bool should_log(level::level_enum msg_level) const 36 | { 37 | return msg_level >= level_.load(std::memory_order_relaxed); 38 | } 39 | 40 | void set_level(level::level_enum log_level) 41 | { 42 | level_.store(log_level); 43 | } 44 | 45 | level::level_enum level() const 46 | { 47 | return static_cast(level_.load(std::memory_order_relaxed)); 48 | } 49 | 50 | protected: 51 | // sink log level - default is all 52 | level_t level_; 53 | 54 | // sink formatter - default is full format 55 | std::unique_ptr formatter_; 56 | }; 57 | 58 | } // namespace sinks 59 | } // namespace spdlog 60 | -------------------------------------------------------------------------------- /deps/spdlog/sinks/stdout_color_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 spdlog 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #ifdef _WIN32 13 | #include "spdlog/sinks/wincolor_sink.h" 14 | #else 15 | #include "spdlog/sinks/ansicolor_sink.h" 16 | #endif 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | #ifdef _WIN32 21 | using stdout_color_sink_mt = wincolor_stdout_sink_mt; 22 | using stdout_color_sink_st = wincolor_stdout_sink_st; 23 | using stderr_color_sink_mt = wincolor_stderr_sink_mt; 24 | using stderr_color_sink_st = wincolor_stderr_sink_st; 25 | #else 26 | using stdout_color_sink_mt = ansicolor_stdout_sink_mt; 27 | using stdout_color_sink_st = ansicolor_stdout_sink_st; 28 | using stderr_color_sink_mt = ansicolor_stderr_sink_mt; 29 | using stderr_color_sink_st = ansicolor_stderr_sink_st; 30 | #endif 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr stdout_color_mt(const std::string &logger_name) 35 | { 36 | return Factory::template create(logger_name); 37 | } 38 | 39 | template 40 | inline std::shared_ptr stdout_color_st(const std::string &logger_name) 41 | { 42 | return Factory::template create(logger_name); 43 | } 44 | 45 | template 46 | inline std::shared_ptr stderr_color_mt(const std::string &logger_name) 47 | { 48 | return Factory::template create(logger_name); 49 | } 50 | 51 | template 52 | inline std::shared_ptr stderr_color_st(const std::string &logger_name) 53 | { 54 | return Factory::template create(logger_name); 55 | } 56 | } // namespace spdlog 57 | -------------------------------------------------------------------------------- /deps/spdlog/version.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #define SPDLOG_VER_MAJOR 1 9 | #define SPDLOG_VER_MINOR 3 10 | #define SPDLOG_VER_PATCH 1 11 | 12 | #define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH) 13 | -------------------------------------------------------------------------------- /deps/utf8.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006 Nemanja Trifunovic 2 | 3 | /* 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 28 | #define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 29 | 30 | #include "utf8/checked.h" 31 | #include "utf8/unchecked.h" 32 | 33 | #endif // header guard 34 | -------------------------------------------------------------------------------- /nx.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nx", "platform\win32\nx\nx.vcxproj", "{CECC2B34-F07A-41D9-B7D8-F0FA79366710}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "extract", "platform\win32\extract\extract.vcxproj", "{42C0C7A1-1243-4FF3-AAA5-12C0485EA811}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Debug|x64.ActiveCfg = Debug|x64 19 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Debug|x64.Build.0 = Debug|x64 20 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Debug|x86.ActiveCfg = Debug|Win32 21 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Debug|x86.Build.0 = Debug|Win32 22 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Release|x64.ActiveCfg = Release|x64 23 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Release|x64.Build.0 = Release|x64 24 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Release|x86.ActiveCfg = Release|Win32 25 | {CECC2B34-F07A-41D9-B7D8-F0FA79366710}.Release|x86.Build.0 = Release|Win32 26 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Debug|x64.ActiveCfg = Debug|x64 27 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Debug|x64.Build.0 = Debug|x64 28 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Debug|x86.ActiveCfg = Debug|Win32 29 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Debug|x86.Build.0 = Debug|Win32 30 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Release|x64.ActiveCfg = Release|x64 31 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Release|x64.Build.0 = Release|x64 32 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Release|x86.ActiveCfg = Release|Win32 33 | {42C0C7A1-1243-4FF3-AAA5-12C0485EA811}.Release|x86.Build.0 = Release|Win32 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /osx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | NXEngine 7 | CFBundleIconFile 8 | icons.icns 9 | CFBundleInfoDictionaryVersion 10 | 1.0 11 | CFBundlePackageType 12 | APPL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 2.6.3 17 | 18 | 19 | -------------------------------------------------------------------------------- /osx/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/osx/bg.png -------------------------------------------------------------------------------- /osx/icons.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/osx/icons.icns -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* SDL_clipboard_h_ */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-14525:e52d96ea04fc" 2 | #define SDL_REVISION_NUMBER 14525 3 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /platform/win32/ext/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /platform/win32/ext/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/SDL2.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/SDL2_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/SDL2_image.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/SDL2_mixer.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/SDL2_mixer.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/SDL2main.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/SDL2test.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x64/libpng16.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x64/libpng16.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/SDL2.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/SDL2_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/SDL2_image.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/SDL2_mixer.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/SDL2_mixer.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/SDL2main.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/SDL2test.lib -------------------------------------------------------------------------------- /platform/win32/ext/lib/x86/libpng16.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/lib/x86/libpng16.lib -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/SDL2.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/SDL2_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/SDL2_image.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/SDL2_mixer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/SDL2_mixer.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libFLAC-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libFLAC-8.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libjpeg-9.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libjpeg-9.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libmodplug-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libmodplug-1.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libmpg123-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libmpg123-0.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libogg-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libogg-0.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libopus-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libopus-0.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libopusfile-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libopusfile-0.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libpng16-16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libpng16-16.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libpng16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libpng16.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libtiff-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libtiff-5.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libvorbis-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libvorbis-0.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libvorbisfile-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libvorbisfile-3.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/libwebp-7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/libwebp-7.dll -------------------------------------------------------------------------------- /platform/win32/ext/runtime/x64/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/ext/runtime/x64/zlib1.dll -------------------------------------------------------------------------------- /platform/win32/extract/extract.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /platform/win32/nx/nx.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/nx/nx.aps -------------------------------------------------------------------------------- /platform/win32/nx/nx.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Английский (США) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | 21 | #ifdef APSTUDIO_INVOKED 22 | ///////////////////////////////////////////////////////////////////////////// 23 | // 24 | // TEXTINCLUDE 25 | // 26 | 27 | 1 TEXTINCLUDE 28 | BEGIN 29 | "resource.h\0" 30 | END 31 | 32 | 2 TEXTINCLUDE 33 | BEGIN 34 | "#include ""winres.h""\r\n" 35 | "\0" 36 | END 37 | 38 | 3 TEXTINCLUDE 39 | BEGIN 40 | "\r\n" 41 | "\0" 42 | END 43 | 44 | #endif // APSTUDIO_INVOKED 45 | 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // 49 | // Icon 50 | // 51 | 52 | // Icon with lowest ID value placed first to ensure application icon 53 | // remains consistent on all systems. 54 | IDI_ICON1 ICON "..\\nx64x64.ico" 55 | 56 | #endif // Английский (США) resources 57 | ///////////////////////////////////////////////////////////////////////////// 58 | 59 | 60 | 61 | #ifndef APSTUDIO_INVOKED 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Generated from the TEXTINCLUDE 3 resource. 65 | // 66 | 67 | 68 | ///////////////////////////////////////////////////////////////////////////// 69 | #endif // not APSTUDIO_INVOKED 70 | 71 | -------------------------------------------------------------------------------- /platform/win32/nx/nx.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WindowsLocalDebugger 7 | 8 | -------------------------------------------------------------------------------- /platform/win32/nx/nx_mgw_built.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/nx/nx_mgw_built.res -------------------------------------------------------------------------------- /platform/win32/nx/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | #define IDI_ICON1 101 3 | 4 | // Next default values for new objects 5 | // 6 | #ifdef APSTUDIO_INVOKED 7 | #ifndef APSTUDIO_READONLY_SYMBOLS 8 | #define _APS_NEXT_RESOURCE_VALUE 102 9 | #define _APS_NEXT_COMMAND_VALUE 40001 10 | #define _APS_NEXT_CONTROL_VALUE 1001 11 | #define _APS_NEXT_SYMED_VALUE 101 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /platform/win32/nx64x64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/platform/win32/nx64x64.ico -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yackerw/NetXEngine/0e9166e1bf471dbcf9b4fae9709aa861ca81f6ff/screenshot.png -------------------------------------------------------------------------------- /src/NetPlayer.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETPLAYER 2 | #define _NETPLAYER 3 | #include "object.h" 4 | #include "player.h" 5 | #include "Networking.h" 6 | 7 | extern int nameevent; 8 | extern char name[15]; //player name 9 | extern char names[MAXCLIENTS][15]; //player names 10 | 11 | extern bool netpinputs[32][INPUT_COUNT]; 12 | extern bool netlastpinputs[32][INPUT_COUNT]; 13 | extern Player *players; 14 | extern int PlayerUpdateEvent; 15 | extern int PlayerShotEvent; 16 | extern int PlayerMissileEvent; 17 | extern int PlayerBladeEvent; 18 | extern int PlayerSkinUpdateEvent; 19 | extern int MGunEvent; 20 | extern char pskin; 21 | 22 | #define numskins 16 23 | 24 | #define truenumskins 19 // Includes dev skins 25 | 26 | // Data syncing structs 27 | typedef struct { 28 | int x; 29 | int y; 30 | int xinertia; 31 | int yinertia; 32 | int curweapon; 33 | char dir; 34 | bool inputs[INPUT_COUNT]; 35 | } PlayerStepSync; 36 | 37 | Player netInitPlayer(); 38 | void netHandlePlayer(int pl); 39 | void netHandlePlayer_am(int pl); 40 | void netPDoPhysics(Player *p); 41 | void netPHandleAttributes(Player *p); 42 | void netDoWaterCurrents(Player *p); 43 | void netPDoWalking(int pl); 44 | void netPDoFalling(int pl); 45 | void netPDoLooking(int pl); 46 | //void netPStartBooster(void); 47 | void netPDoBooster(Player *p); 48 | void netPBoosterSmokePuff(Player *p); 49 | void netPHandleSolidBrickObjects(Player *p); 50 | void netPHandleSolidMushyObjects(Player *p); 51 | void netPRunSolidMushy(Object *o, Player *p); 52 | //void netkillplayer(int script); 53 | //void netPHandleZeroG(Player *p); 54 | void netPDoRepel(Player *p); 55 | //void netPTryActivateScript(); 56 | void netPDoHurtFlash(Player *p); 57 | void netPSelectFrame(Player *p); 58 | int netPSelectSprite(Player *p); 59 | //void netGetSpriteForGun(int wpn, int look, int *spr, int *frame); 60 | void netGetPlayerShootPoint(Player *p, int *x_out, int *y_out); 61 | void netDrawPlayer(Player *p); 62 | void netUpdateBlockstates(Player *o); 63 | void SetupNetPlayerFuncs(); 64 | #endif 65 | -------------------------------------------------------------------------------- /src/ResourceManager.h: -------------------------------------------------------------------------------- 1 | #ifndef _RESOURCEMANAGER_H 2 | #define _RESOURCEMANAGER_H 3 | 4 | #include "Singleton.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | typedef struct { 13 | std::string dir; 14 | std::string name; 15 | bool skip_intro; 16 | } Mod; 17 | 18 | class ResourceManager 19 | { 20 | 21 | public: 22 | static ResourceManager *getInstance(); 23 | static bool fileExists(const std::string &filename); 24 | 25 | /** 26 | * Returns the base path to binary 27 | */ 28 | std::string getBasePath(); 29 | 30 | /** 31 | * Returns the path to the directory where user-data resides 32 | */ 33 | std::string getUserPrefPath(); 34 | 35 | void shutdown(); 36 | std::string getPath(const std::string &filename, bool localized = true); 37 | 38 | std::string getPrefPath(const std::string &filename); 39 | 40 | std::string getPathForDir(const std::string &dir); 41 | 42 | std::vector &languages(); 43 | Mod& mod(std::string& name); 44 | void setMod(std::string name); 45 | Mod& mod(); 46 | bool isMod(); 47 | std::map &mods(); 48 | protected: 49 | friend class Singleton; 50 | 51 | ResourceManager(); 52 | ~ResourceManager(); 53 | ResourceManager(const ResourceManager &) = delete; 54 | ResourceManager &operator=(const ResourceManager &) = delete; 55 | std::string _language; 56 | void findLanguages(); 57 | std::vector _languages; 58 | std::string _mod = ""; 59 | void findMods(); 60 | std::map _mods; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/Singleton.h: -------------------------------------------------------------------------------- 1 | #ifndef _BASE_SINGLETON_H 2 | #define _BASE_SINGLETON_H 3 | 4 | #include 5 | 6 | template class Singleton 7 | { 8 | private: 9 | // Classes using the Singleton pattern should declare a getInstance() 10 | // method and call Singleton::get() from within that. 11 | friend Type *Type::getInstance(); 12 | 13 | static Type *get() 14 | { 15 | if (!_instance) 16 | { 17 | _instance = new Type(); 18 | } 19 | 20 | return _instance; 21 | } 22 | 23 | static Type *_instance; 24 | }; 25 | 26 | template Type *Singleton::_instance = nullptr; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/TextBox/ItemImage.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | The powerup display for textboxes. 4 | E.g. when you get a life capsule or new weapon and 5 | it shows you a picture of it. 6 | */ 7 | 8 | #include "ItemImage.h" 9 | 10 | #include "../graphics/Renderer.h" 11 | using namespace NXE::Graphics; 12 | #include "TextBox.h" 13 | 14 | #define ITEMBOX_W 76 15 | #define ITEMBOX_H 32 16 | 17 | #define ITEMBOX_X (Renderer::getInstance()->screenWidth / 2) - 32 18 | #define ITEMBOX_Y (Renderer::getInstance()->screenHeight / 2) 19 | 20 | /* 21 | void c------------------------------() {} 22 | */ 23 | 24 | void TB_ItemImage::ResetState() 25 | { 26 | fVisible = false; 27 | } 28 | 29 | void TB_ItemImage::SetVisible(bool enable) 30 | { 31 | fVisible = enable; 32 | } 33 | 34 | void TB_ItemImage::SetSprite(int sprite, int frame) 35 | { 36 | fSprite = sprite; 37 | fFrame = frame; 38 | fYOffset = 1; 39 | } 40 | 41 | /* 42 | void c------------------------------() {} 43 | */ 44 | 45 | void TB_ItemImage::Tick(void) 46 | { 47 | } 48 | 49 | void TB_ItemImage::Draw(void) 50 | { 51 | if (!fVisible) 52 | return; 53 | 54 | // animate moving item downwards into box 55 | int desty = (ITEMBOX_H / 2) - (Renderer::getInstance()->sprites.sprites[fSprite].th / 2); 56 | if (++fYOffset > desty) 57 | fYOffset = desty; 58 | 59 | // draw the box frame 60 | TextBox::DrawFrame(ITEMBOX_X, ITEMBOX_Y, ITEMBOX_W, ITEMBOX_H); 61 | 62 | // draw the item 63 | int x = ITEMBOX_X + ((ITEMBOX_W / 2) - (Renderer::getInstance()->sprites.sprites[fSprite].tw / 2)); 64 | if (Renderer::getInstance()->sprites.sprites[fSprite].tw == 14) 65 | x--; // hack for ArmsIcons 66 | 67 | Renderer::getInstance()->sprites.drawSprite(x, ITEMBOX_Y + fYOffset, fSprite, fFrame); 68 | } 69 | -------------------------------------------------------------------------------- /src/TextBox/ItemImage.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ITEMIMAGE_H 3 | #define _ITEMIMAGE_H 4 | 5 | class TB_ItemImage 6 | { 7 | public: 8 | void ResetState(); 9 | void Draw(); 10 | void Tick(); 11 | 12 | void SetVisible(bool enable); 13 | void SetSprite(int sprite, int frame); 14 | 15 | private: 16 | bool fVisible; 17 | int fSprite, fFrame; 18 | int fYOffset; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/TextBox/SaveSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SAVESELECT_H 3 | #define _SAVESELECT_H 4 | 5 | #define SS_LOADING 0 6 | #define SS_SAVING 1 7 | #define MAX_SAVE_SLOTS 5 8 | 9 | class TB_SaveSelect 10 | { 11 | public: 12 | TB_SaveSelect(); 13 | 14 | void ResetState(); 15 | void SetVisible(bool enable, bool saving = SS_LOADING); 16 | 17 | bool IsVisible(); 18 | bool Aborted(); 19 | void Draw(); 20 | void Tick(); 21 | 22 | private: 23 | void Run_Input(); 24 | void DrawProfile(int x, int y, int index); 25 | void DrawExtendedInfo(); 26 | 27 | bool fVisible; 28 | bool fSaving; 29 | bool fAborted; 30 | int fCurSel; 31 | int fNumFiles; 32 | 33 | struct 34 | { 35 | int x, y, w, h; 36 | } fCoords; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/TextBox/StageSelect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGESELECT_H 3 | #define _STAGESELECT_H 4 | 5 | #include 6 | 7 | #define NUM_TELEPORTER_SLOTS 8 8 | 9 | struct Teleporter_Slot 10 | { 11 | int slotno; // which slot # this is (first param to PS+) 12 | int scriptno; // which script is run when selected (2nd param to PS+) 13 | }; 14 | 15 | class TB_StageSelect 16 | { 17 | public: 18 | TB_StageSelect(); 19 | 20 | void ResetState(); 21 | void SetVisible(bool enable); 22 | 23 | void SetSlot(int slotno, int scriptno); 24 | void ClearSlots(); 25 | bool GetSlotByIndex(int index, int *slotno_out = NULL, int *scriptno_out = NULL); 26 | int CountActiveSlots(); 27 | 28 | bool IsVisible(); 29 | void Draw(); 30 | void Tick(); 31 | 32 | private: 33 | void HandleInput(); 34 | void MoveSelection(int dir); 35 | void UpdateText(); 36 | 37 | bool fVisible; 38 | int fSlots[NUM_TELEPORTER_SLOTS]; // scripts used for slots 39 | 40 | int fWarpY; 41 | 42 | int fSelectionIndex; 43 | int fSelectionFrame; 44 | 45 | bool fMadeSelection; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/TextBox/YesNoPrompt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _YESNOPROMPT_H 3 | #define _YESNOPROMPT_H 4 | 5 | enum YNJResult 6 | { 7 | NO, 8 | YES 9 | }; 10 | 11 | class TB_YNJPrompt 12 | { 13 | public: 14 | void SetVisible(bool enable); 15 | void ResetState(); 16 | 17 | void Draw(); 18 | void Tick(); 19 | 20 | bool IsVisible() 21 | { 22 | return fVisible; 23 | } 24 | bool ResultReady(); // returns true if the user has selected a result 25 | int GetResult(); // returns YES or NO 26 | 27 | private: 28 | bool fVisible; 29 | struct 30 | { 31 | int y; 32 | } fCoords; 33 | 34 | int fState; 35 | int fTimer; 36 | 37 | int fAnswer; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/Utils/Common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H 2 | #define _COMMON_H 3 | 4 | template 5 | constexpr const T& clamp(const T& val, const T& min, const T& max) 6 | { 7 | return (val <= min) ? min : (max <= val) ? max : val; 8 | } 9 | 10 | #endif -------------------------------------------------------------------------------- /src/Utils/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Logger.h" 2 | 3 | //On MinGW32 spdlog will fail to compile due to lacking the c++ thread model, so don't use it on that compiler and stub the function below 4 | #if !defined(NETX_MINGW32) 5 | #include 6 | #include 7 | #endif 8 | 9 | #include "../common/misc.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace NXE 16 | { 17 | namespace Utils 18 | { 19 | namespace Logger 20 | { 21 | #if defined(NETX_MINGW32) 22 | void init(std::string filename) { 23 | 24 | } 25 | #else 26 | static const char *LOG_PATTERN = "%^[%H:%M:%S.%e] [%l] [%@ %!]: %v%$"; 27 | std::vector sinks; 28 | 29 | void init(std::string filename) { 30 | sinks.push_back(std::make_shared()); 31 | sinks.push_back(std::make_shared(widen(filename), true)); 32 | 33 | spdlog::set_default_logger(std::make_shared("nxe logger", begin(sinks), end(sinks))); 34 | 35 | spdlog::set_pattern(LOG_PATTERN); 36 | 37 | spdlog::set_error_handler([](const std::string &msg) { 38 | std::cerr << "spdlog error: " << msg << std::endl; 39 | }); 40 | 41 | spdlog::flush_on(spdlog::level::debug); 42 | #if defined(DEBUG) 43 | spdlog::set_level(spdlog::level::trace); 44 | #else 45 | spdlog::set_level(spdlog::level::info); 46 | #endif 47 | } 48 | #endif 49 | 50 | 51 | } // namespace Logger 52 | } // namespace Utils 53 | } // namespace NXE 54 | -------------------------------------------------------------------------------- /src/Utils/Logger.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOGGER_H 2 | 3 | //On MinGW32 spdlog will fail to compile due to lacking the c++ thread model, so don't use it on that compiler and remove the functions using empty defines below 4 | #if !defined(NETX_MINGW32) 5 | #include 6 | #endif 7 | 8 | #include 9 | 10 | namespace NXE 11 | { 12 | namespace Utils 13 | { 14 | 15 | namespace Logger 16 | { 17 | 18 | void init(std::string filename); 19 | 20 | #if defined(NETX_MINGW32) 21 | #define LOG_TRACE 22 | #define LOG_DEBUG 23 | #define LOG_INFO 24 | #define LOG_WARN 25 | #define LOG_ERROR 26 | #define LOG_CRITICAL 27 | #else 28 | #define LOG_TRACE SPDLOG_TRACE 29 | #define LOG_DEBUG SPDLOG_DEBUG 30 | #define LOG_INFO SPDLOG_INFO 31 | #define LOG_WARN SPDLOG_WARN 32 | #define LOG_ERROR SPDLOG_ERROR 33 | #define LOG_CRITICAL SPDLOG_CRITICAL 34 | #endif 35 | 36 | } // namespace Logger 37 | } // namespace Utils 38 | } // namespace NXE 39 | 40 | #endif //_LOGGER_H -------------------------------------------------------------------------------- /src/ai/IrregularBBox.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRREGULARBBOX_H 3 | #define _IRREGULARBBOX_H 4 | #include "../object.h" 5 | 6 | #define IB_MAX_BBOXES 4 7 | 8 | class IrregularBBox 9 | { 10 | public: 11 | bool init(Object *associatedObject, int max_rectangles); 12 | void destroy(); 13 | 14 | void set_damage(int dmg); 15 | void transmit_hits(); 16 | 17 | void place(void (*placefunc)(void *userparm), void *userparm); 18 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 19 | 20 | private: 21 | Object *bbox[IB_MAX_BBOXES]; 22 | int num_bboxes; 23 | Object *assoc_object; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/ai/almond/almond.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ALMOND_H 3 | #define _ALMOND_H 4 | #include "../../object.h" 5 | 6 | // states to control the water-level object 7 | #define WL_CALM 10 // calm and slow at set point 8 | 9 | #define WL_CYCLE 20 // cycles between set point and top of screen 10 | #define WL_DOWN 21 // in cycle--currently down 11 | #define WL_UP 22 // in cycle--currently up 12 | 13 | #define WL_STAY_UP 30 // goes to top of screen and doesn't come back down 14 | 15 | void ai_waterlevel(Object *o); 16 | void ai_shutter(Object *o); 17 | void ai_shutter_big(Object *o); 18 | void ai_almond_lift(Object *o); 19 | void ai_shutter_stuck(Object *o); 20 | void ai_almond_robot(Object *o); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/ai/balrog_common.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALROG_COMMON_H 3 | #define _BALROG_COMMON_H 4 | #include "../object.h" 5 | 6 | void balrog_grab_player(Object *o); 7 | bool balrog_toss_player_away(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/boss/balfrog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALFROG_H 3 | #define _BALFROG_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | #include "../IrregularBBox.h" 7 | 8 | // Struct for syncing 9 | typedef struct { 10 | int x; 11 | int y; 12 | short state; 13 | short substate; 14 | bool invisible; 15 | char dir; 16 | short sprite; 17 | int hp; 18 | int flags; 19 | int timer; 20 | int xinertia; 21 | int yinertia; 22 | } BalfrogSync; 23 | 24 | class BalfrogBoss : public StageBoss 25 | { 26 | public: 27 | void OnMapEntry(); 28 | void Run(); 29 | 30 | void place_bboxes(); 31 | 32 | char *Sync(); 33 | void SyncRecv(char*); 34 | 35 | private: 36 | void RunDeathAnim(); 37 | void RunEntryAnim(); 38 | 39 | void RunFighting(); 40 | void RunJumping(); 41 | void RunShooting(); 42 | 43 | void SetJumpingSprite(bool enable); 44 | void SpawnFrogs(int objtype, int count); 45 | 46 | void set_bbox(int index, int x, int y, int w, int h, uint32_t flags); 47 | void transmit_bbox_hits(Object *box); 48 | 49 | Object *o; 50 | 51 | struct 52 | { 53 | int shakeflash; 54 | 55 | int orighp; 56 | int shots_fired; 57 | int attackcounter; 58 | 59 | Object *balrog; // balrog puppet for death scene 60 | 61 | // our group of multiple bboxes to simulate our irregular bounding box. 62 | IrregularBBox bboxes; 63 | int bbox_mode; 64 | 65 | } frog; 66 | }; 67 | 68 | void ondeath_balfrog(Object *o); 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/ai/boss/ballos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BALLOS_H 3 | #define _BALLOS_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | #define NUM_EYES 2 8 | enum TRIGDIR 9 | { 10 | LESS_THAN = 0, 11 | GREATER_THAN = 1 12 | }; 13 | 14 | class BallosBoss : public StageBoss 15 | { 16 | public: 17 | void OnMapEntry(); 18 | void Run(); 19 | void RunAftermove(); 20 | 21 | private: 22 | void RunForm1(Object *o); 23 | void RunForm2(Object *o); 24 | void RunForm3(Object *o); 25 | void RunComeDown(Object *o); 26 | void RunDefeated(Object *o); 27 | 28 | void run_eye(int index); 29 | void place_eye(int index); 30 | void SetEyeStates(int newstate); 31 | 32 | bool passed_xcoord(bool ltgt, int xcoord, bool reset = false); 33 | bool passed_ycoord(bool ltgt, int ycoord, bool reset = false); 34 | 35 | Object *main; 36 | Object *body; 37 | Object *eye[NUM_EYES]; 38 | Object *shield; // top shield to cover eyes from above 39 | }; 40 | 41 | void ondeath_ballos(Object *o); 42 | void ai_ballos_rotator(Object *o); 43 | void aftermove_ballos_rotator(Object *o); 44 | void ai_ballos_platform(Object *o); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/ai/boss/core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _COREBOSS_H 3 | #define _COREBOSS_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | 8 | typedef struct { 9 | int x; 10 | int y; 11 | int state; 12 | int substate; 13 | int sprite; 14 | int flags; 15 | int invisible; 16 | int frame; 17 | int xinertia; 18 | int yinertia; 19 | } CorePartsSync_t; 20 | 21 | typedef struct { 22 | CorePartsSync_t pc[7]; 23 | int hp; 24 | int timer; 25 | CorePartsSync_t m; 26 | } CoreSync_t; 27 | 28 | class CoreBoss : public StageBoss 29 | { 30 | public: 31 | void OnMapEntry(); 32 | void OnMapExit(); 33 | void Run(); 34 | char *Sync(); 35 | void SyncRecv(char *buff); 36 | int SyncSize; 37 | 38 | private: 39 | void RunOpenMouth(); 40 | 41 | void StartWaterStream(void); 42 | void StopWaterStream(void); 43 | 44 | Object *o; 45 | Object *pieces[8]; 46 | int hittimer; 47 | }; 48 | 49 | void ai_core_front(Object *o); 50 | void ai_core_back(Object *o); 51 | void ai_minicore(Object *o); 52 | void ai_minicore_shot(Object *o); 53 | void ai_core_ghostie(Object *o); 54 | void ai_core_blast(Object *o); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/ai/boss/heavypress.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HEAVYPRESS_H 3 | #define _HEAVYPRESS_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | class HeavyPress : public StageBoss 8 | { 9 | public: 10 | void OnMapEntry(); 11 | void Run(); 12 | 13 | private: 14 | void run_defeated(); 15 | void run_passageway(); 16 | 17 | Object *o; 18 | Object *shield_left, *shield_right; 19 | 20 | int uncover_left, uncover_right; 21 | int uncover_y; 22 | 23 | SIFRect fullwidth_bbox; 24 | SIFRect center_bbox; 25 | }; 26 | 27 | void ai_hp_lightning(Object *o); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ai/boss/ironhead.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IRONHEAD_H 3 | #define _IRONHEAD_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | typedef struct { 8 | int state; 9 | int x; 10 | int y; 11 | int xinertia; 12 | int yinertia; 13 | int hp; 14 | } IronheadSync; 15 | 16 | class IronheadBoss : public StageBoss 17 | { 18 | public: 19 | void OnMapEntry(); 20 | void OnMapExit(); 21 | void Run(); 22 | 23 | char *Sync(); 24 | void SyncRecv(char *buff); 25 | int SyncSize; 26 | 27 | private: 28 | Object *o; 29 | int hittimer; 30 | }; 31 | 32 | void ondeath_ironhead(Object *o); 33 | void ai_ironh_fishy(Object *o); 34 | void ai_ironh_shot(Object *o); 35 | void ai_brick_spawner(Object *o); 36 | void ai_ironh_brick(Object *o); 37 | void ai_ikachan_spawner(Object *o); 38 | void ai_ikachan(Object *o); 39 | void ai_motion_wall(Object *o); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/ai/boss/omega.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OMEGA_H 3 | #define _OMEGA_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | typedef struct { 8 | int x; 9 | int y; 10 | int legx[4]; 11 | int legy[4]; 12 | int xinertia; 13 | int yinertia; 14 | int state; 15 | int sprite; 16 | int hp; 17 | } OmegaSync_t; 18 | 19 | class OmegaBoss : public StageBoss 20 | { 21 | public: 22 | 23 | char *Sync(); 24 | void SyncRecv(char *buff); 25 | void OnMapEntry(); 26 | void OnMapExit(); 27 | 28 | void Run(); 29 | 30 | int SyncSize; 31 | 32 | private: 33 | Object *pieces[4]; 34 | 35 | struct 36 | { 37 | int timer; 38 | int animtimer; 39 | 40 | int movedir, movetime; 41 | int nextstate; 42 | 43 | int form; 44 | 45 | int firefreq, startfiring, stopfiring, endfirestate, shotxspd; 46 | int firecounter; 47 | 48 | int leg_descend; 49 | 50 | int orgx, orgy; 51 | 52 | int shaketimer; 53 | int lasthp; 54 | 55 | bool defeated; 56 | } omg; 57 | }; 58 | 59 | void ondeath_omega_body(Object *o); 60 | void ai_omega_shot(Object *o); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/ai/boss/sisters.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SISTERS_H 3 | #define _SISTERS_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | // although you will need to add additional copies of the head sprites 8 | // for it to work properly, just try setting this number to something 9 | // like 10 and running the fight! 10 | #define NUM_SISTERS 2 11 | 12 | typedef struct { 13 | int hp; 14 | int xmark; 15 | int ymark; 16 | int mainangle; 17 | int bodystate[NUM_SISTERS]; 18 | int headstate[NUM_SISTERS]; 19 | int timer; 20 | int timer2; 21 | } SistersSync; 22 | 23 | class SistersBoss : public StageBoss 24 | { 25 | public: 26 | void OnMapEntry(); 27 | void OnMapExit(); 28 | void Run(); 29 | char *Sync(); 30 | void SyncRecv(char *buff); 31 | int SyncSize; 32 | 33 | private: 34 | void run_head(int index); 35 | void head_set_bbox(int index); 36 | void run_body(int index); 37 | 38 | void SetHeadStates(int newstate); 39 | void SetBodyStates(int newstate); 40 | 41 | void SpawnScreenSmoke(int count); 42 | 43 | int mainangle; 44 | 45 | Object *main; 46 | Object *head[NUM_SISTERS]; 47 | Object *body[NUM_SISTERS]; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/ai/boss/undead_core.h: -------------------------------------------------------------------------------- 1 | #ifndef _UNDEADCORE_BOSS_H 2 | #define _UNDEADCORE_BOSS_H 3 | 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | #define NUM_ROTATORS 4 8 | enum BBoxes 9 | { 10 | BB_UPPER, 11 | BB_BACK, 12 | BB_LOWER, 13 | BB_TARGET, 14 | NUM_BBOXES 15 | }; 16 | 17 | enum UD_Faces 18 | { 19 | FACE_SKULL, 20 | FACE_TEETH, 21 | FACE_MOUTH, 22 | FACE_MOUTH_LIT, 23 | FACE_NONE 24 | }; 25 | 26 | class UDCoreBoss : public StageBoss 27 | { 28 | public: 29 | void OnMapEntry(); 30 | void OnMapExit(); 31 | void Run(); 32 | void RunAftermove(); 33 | 34 | private: 35 | bool RunDefeated(); 36 | void SpawnFaceSmoke(); 37 | void SpawnPellet(int dir); 38 | void RunHurtFlash(int timer); 39 | 40 | void run_front(Object *o); 41 | void run_face(Object *o); 42 | void run_back(Object *o); 43 | 44 | void move_bboxes(); 45 | void set_bbox_shootable(bool enable); 46 | 47 | Object *create_rotator(int angle, int front); 48 | void run_rotator(Object *o); 49 | void SetRotatorStates(int newstate); 50 | 51 | Object *main; 52 | Object *front, *back; 53 | Object *face; 54 | 55 | Object *rotator[NUM_ROTATORS]; 56 | Object *bbox[NUM_BBOXES]; 57 | }; 58 | 59 | void onspawn_ud_minicore_idle(Object *o); 60 | void ai_udmini_platform(Object *o); 61 | void ai_ud_pellet(Object *o); 62 | void ai_ud_smoke(Object *o); 63 | void ai_ud_spinner(Object *o); 64 | void ai_ud_spinner_trail(Object *o); 65 | void ai_ud_blast(Object *o); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/ai/boss/x.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _XBOSS_H 3 | #define _XBOSS_H 4 | #include "../../object.h" 5 | #include "../../stageboss.h" 6 | 7 | typedef struct { 8 | int x; 9 | int y; 10 | int state; 11 | int sprite; 12 | int substate; 13 | int dir; 14 | int flags; 15 | int hp; 16 | bool invisible; 17 | } XSyncPart_t; 18 | // Sync struct 19 | typedef struct { 20 | XSyncPart_t mainobj; 21 | /*XSyncPart_t body[4]; 22 | XSyncPart_t treads[4]; 23 | XSyncPart_t internals; 24 | XSyncPart_t doors[2]; 25 | XSyncPart_t targets[4]; 26 | XSyncPart_t fishspawners[4];*/ 27 | XSyncPart_t pieces[20]; 28 | } XSync_t; 29 | 30 | enum XBDir 31 | { 32 | UL, 33 | UR, 34 | LL, 35 | LR 36 | }; 37 | 38 | class XBoss : public StageBoss 39 | { 40 | public: 41 | void OnMapEntry(); 42 | void OnMapExit(); 43 | void Run(); 44 | void RunAftermove(); 45 | char *Sync(); 46 | void SyncRecv(char *buff); 47 | int SyncSize; 48 | 49 | private: 50 | void run_tread(int index); 51 | void run_body(int index); 52 | void run_door(int index); 53 | void run_target(int index); 54 | void run_fishy_spawner(int index); 55 | void run_internals(); 56 | 57 | bool AllTargetsDestroyed(); 58 | void Init(); 59 | Object *CreateTread(int x, int y, int sprite); 60 | Object *CreatePiece(int x, int y, int type); 61 | 62 | void SetStates(Object *objects[], int nobjects, int state); 63 | void SetDirs(Object *objects[], int nobjects, int dir); 64 | 65 | void DeleteMonster(); 66 | 67 | Object *mainobject; 68 | Object *body[4]; 69 | Object *treads[4]; 70 | Object *internals; 71 | Object *doors[2]; 72 | Object *targets[4]; 73 | Object *fishspawners[4]; 74 | 75 | Object *piecelist[24]; 76 | int npieces; 77 | 78 | struct 79 | { 80 | bool initilized; 81 | } X; 82 | }; 83 | 84 | void ondeath_x_mainobject(Object *internals); 85 | void ondeath_x_target(Object *o); 86 | void ai_x_fishy_missile(Object *o); 87 | void ai_x_defeated(Object *o); 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/ai/egg/egg.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIEGG_H_ 2 | #define __AIEGG_H_ 3 | #include "../../object.h" 4 | 5 | void ai_basil(Object *o); 6 | void ai_behemoth(Object *o); 7 | void ai_beetle_horiz(Object *o); 8 | void ai_beetle_freefly(Object *o); 9 | void ai_giant_beetle(Object *o); 10 | void ai_egg_elevator(Object *o); 11 | void ai_forcefield(Object *o); 12 | 13 | #endif -------------------------------------------------------------------------------- /src/ai/egg/egg2.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIEGG2_H_ 2 | #define __AIEGG2_H_ 3 | #include "../../object.h" 4 | 5 | void ai_dragon_zombie(Object *o); 6 | void ai_falling_spike_small(Object *o); 7 | void ai_falling_spike_large(Object *o); 8 | void ai_counter_bomb(Object *o); 9 | void ai_counter_bomb_number(Object *o); 10 | 11 | #endif -------------------------------------------------------------------------------- /src/ai/egg/igor.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIIGOR_H_ 2 | #define __AIIGOR_H_ 3 | #include "../../object.h" 4 | 5 | void ai_npc_igor(Object *o); 6 | void ai_boss_igor(Object *o); 7 | void ai_boss_igor_defeated(Object *o); 8 | static void smoke_puff(Object *o, bool initial); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/final_battle/balcony.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALCONY_H_ 2 | #define __AIBALCONY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_helicopter(Object *o); 6 | void ai_helicopter_blade(Object *o); 7 | void ai_igor_balcony(Object *o); 8 | void ai_falling_block_spawner(Object *o); 9 | void ai_falling_block(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/final_battle/doctor.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOCTOR_H 2 | #define _DOCTOR_H 3 | #include "../../object.h" 4 | 5 | extern int crystal_xmark, crystal_ymark; 6 | extern bool crystal_tofront; 7 | 8 | void ai_boss_doctor(Object *o); 9 | void ai_doctor_shot(Object *o); 10 | void ai_doctor_shot_trail(Object *o); 11 | void ai_doctor_blast(Object *o); 12 | void aftermove_red_crystal(Object *o); 13 | void ai_doctor_crowned(Object *o); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/ai/final_battle/doctor_common.cpp: -------------------------------------------------------------------------------- 1 | #include "doctor_common.h" 2 | 3 | #include "../../ObjManager.h" 4 | #include "../../game.h" 5 | #include "../../graphics/Renderer.h" 6 | #include "../../sound/SoundManager.h" 7 | #include "../stdai.h" 8 | 9 | using namespace NXE::Graphics; 10 | 11 | int crystal_xmark, crystal_ymark; 12 | bool crystal_tofront; 13 | 14 | Object *dr_create_red_crystal(int x, int y) 15 | { 16 | Object *upper_xtal; 17 | 18 | // we have to create these with the one which will bring itself to front 19 | // already having higher zorder (create it 2nd), because the code to 20 | // run aftermoves currently doesn't create a list first and so running 21 | // BringToFront from an aftermove can cause it's AI to be executed twice. 22 | CreateObject(x, y, OBJ_RED_CRYSTAL)->dir = RIGHT; 23 | (upper_xtal = CreateObject(x, y, OBJ_RED_CRYSTAL))->dir = LEFT; 24 | 25 | return upper_xtal; 26 | } 27 | 28 | /* 29 | void c------------------------------() {} 30 | */ 31 | 32 | void dr_tp_out_init(Object *o) 33 | { 34 | o->ResetClip(); 35 | o->clip_enable = true; 36 | 37 | NXE::Sound::SoundManager::getInstance()->playSfx(NXE::Sound::SFX::SND_TELEPORT); 38 | o->shaketime = 0; // show any waiting damage numbers NOW 39 | } 40 | 41 | bool dr_tp_out(Object *o) 42 | { 43 | o->clipy1 += 2; 44 | o->clipy2 -= 2; 45 | 46 | if (o->clipy1 >= o->clipy2) 47 | { 48 | o->clip_enable = false; 49 | o->invisible = true; 50 | 51 | return true; 52 | } 53 | 54 | return false; 55 | } 56 | 57 | /* 58 | void c------------------------------() {} 59 | */ 60 | 61 | void dr_tp_in_init(Object *o) 62 | { 63 | o->clipy1 = o->clipy2 = (Renderer::getInstance()->sprites.sprites[o->sprite].h / 2); 64 | o->clip_enable = true; 65 | o->invisible = false; 66 | } 67 | 68 | bool dr_tp_in(Object *o) 69 | { 70 | o->clipy1 -= 2; 71 | o->clipy2 += 2; 72 | 73 | if (o->clipy1 <= 0 || o->clipy2 >= Renderer::getInstance()->sprites.sprites[o->sprite].h) 74 | { 75 | o->clip_enable = false; 76 | o->ResetClip(); 77 | return true; 78 | } 79 | 80 | return false; 81 | } 82 | -------------------------------------------------------------------------------- /src/ai/final_battle/doctor_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIDOCTORCOM_H_ 2 | #define __AIDOCTORCOM_H_ 3 | #include "../../object.h" 4 | 5 | Object *dr_create_red_crystal(int x, int y); 6 | void dr_tp_out_init(Object *o); 7 | bool dr_tp_out(Object *o); 8 | void dr_tp_in_init(Object *o); 9 | bool dr_tp_in(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/final_battle/doctor_frenzied.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIDOCTORFRE_H_ 2 | #define __AIDOCTORFRE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_boss_doctor_frenzied(Object *o); 6 | void ai_doctor_bat(Object *o); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/ai/final_battle/final_misc.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIFINMISC_H_ 2 | #define __AIFINMISC_H_ 3 | #include "../../object.h" 4 | 5 | void ai_doctor_ghost(Object *o); 6 | void ai_red_energy(Object *o); 7 | void ai_mimiga_caged(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/final_battle/misery.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIFINMISERY_H_ 2 | #define __AIFINMISERY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_boss_misery(Object *o); 6 | static void run_spells(Object *o); 7 | static void run_teleport(Object *o); 8 | static void run_intro(Object *o); 9 | static void run_defeated(Object *o); 10 | static Object *CreateRing(Object *o, uint8_t angle); 11 | void ai_misery_ring(Object *o); 12 | void aftermove_misery_ring(Object *o); 13 | void ai_misery_phase(Object *o); 14 | void ai_misery_ball(Object *o); 15 | void ai_black_lightning(Object *o); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ai/final_battle/sidekicks.h: -------------------------------------------------------------------------------- 1 | #ifndef __AISIDEKICKS_H_ 2 | #define __AISIDEKICKS_H_ 3 | #include "../../object.h" 4 | 5 | void ai_misery_frenzied(Object *o); 6 | static Object *fm_spawn_missile(Object *o, int angindex); 7 | void ai_misery_critter(Object *o); 8 | void ai_misery_bat(Object *o); 9 | void ai_misery_missile(Object *o); 10 | void ai_sue_frenzied(Object *o); 11 | static void sue_somersault(Object *o); 12 | static void sue_dash(Object *o); 13 | static void set_ignore_solid(Object *o); 14 | static void sidekick_run_defeated(Object *o, int health); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ai/first_cave/first_cave.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIFC_H_ 2 | #define __AIFC_H_ 3 | #include "../../object.h" 4 | 5 | void ai_bat_up_down(Object *o); 6 | void ai_hermit_gunsmith(Object *o); 7 | void ai_door_enemy(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/hell/ballos_misc.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALLOSMISC_H_ 2 | #define __AIBALLOSMISC_H_ 3 | #include "../../object.h" 4 | 5 | void ai_ballos_skull(Object *o); 6 | void ai_ballos_spikes(Object *o); 7 | void ai_green_devil_spawner(Object *o); 8 | void ai_green_devil(Object *o); 9 | void ai_bute_sword_red(Object *o); 10 | void ai_bute_archer_red(Object *o); 11 | void ai_wall_collapser(Object *o); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/ai/hell/ballos_priest.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALLOSPRIEST_H_ 2 | #define __AIBALLOSPRIEST_H_ 3 | #include "../../object.h" 4 | 5 | void ai_ballos_priest(Object *o); 6 | // static void run_flight(Object *o); 7 | // static void spawn_bones(Object *o, int dir); 8 | // static void run_lightning(Object *o); 9 | // static void run_intro(Object *o); 10 | // static void run_defeated(Object *o); 11 | void ai_ballos_target(Object *o); 12 | void ai_ballos_bone_spawner(Object *o); 13 | void ai_ballos_bone(Object *o); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/ai/hell/hell.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIHELL_H_ 2 | #define __AIHELL_H_ 3 | #include "../../object.h" 4 | 5 | void ai_bute_flying(Object *o); 6 | void ai_bute_spawner(Object *o); 7 | void ai_bute_falling(Object *o); 8 | void ai_bute_sword(Object *o); 9 | void ai_bute_archer(Object *o); 10 | void ai_bute_arrow(Object *o); 11 | void ai_bute_dying(Object *o); 12 | static bool run_bute_defeated(Object *o, int hp); 13 | void ai_mesa(Object *o); 14 | void ai_mesa_block(Object *o); 15 | void ai_deleet(Object *o); 16 | void ai_rolling(Object *o); 17 | void ai_statue_base(Object *o); 18 | void ai_statue(Object *o); 19 | void ai_puppy_ghost(Object *o); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/ai/last_cave/last_cave.h: -------------------------------------------------------------------------------- 1 | #ifndef __AILC_H_ 2 | #define __AILC_H_ 3 | #include "../../object.h" 4 | 5 | void ai_proximity_press_vert(Object *o); 6 | void ai_critter_hopping_red(Object *o); 7 | void ai_lava_drip_spawner(Object *o); 8 | void ai_lava_drip(Object *o); 9 | void ai_red_bat_spawner(Object *o); 10 | void ai_red_bat(Object *o); 11 | void ai_red_demon(Object *o); 12 | void ai_press_vert(Object *o); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/ai/maze/balrog_boss_missiles.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALROGMISS_H_ 2 | #define __AIBALROGMISS_H_ 3 | #include "../../object.h" 4 | 5 | void ai_balrog_boss_missiles(Object *o); 6 | void ondeath_balrog_boss_missiles(Object *o); 7 | static void walking_animation(Object *o); 8 | void ai_balrog_missile(Object *o); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/maze/critter_purple.h: -------------------------------------------------------------------------------- 1 | #ifndef __AICRITTERPURPLE_H_ 2 | #define __AICRITTERPURPLE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_critter_shooting_purple(Object *o); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/ai/maze/gaudi.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIGAUDI_H_ 2 | #define __AIGAUDI_H_ 3 | #include "../../object.h" 4 | 5 | void ai_gaudi(Object *o); 6 | void ai_gaudi_dying(Object *o); 7 | void ai_gaudi_flying(Object *o); 8 | void ai_gaudi_armored(Object *o); 9 | void ai_gaudi_armored_shot(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/maze/labyrinth_m.h: -------------------------------------------------------------------------------- 1 | #ifndef __AILABY_H_ 2 | #define __AILABY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_firewhirr(Object *o); 6 | void ai_firewhirr_shot(Object *o); 7 | void ai_gaudi_egg(Object *o); 8 | void ai_fuzz_core(Object *o); 9 | void ai_fuzz(Object *o); 10 | void aftermove_fuzz(Object *o); 11 | void ai_buyobuyo_base(Object *o); 12 | void ai_buyobuyo(Object *o); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/ai/maze/maze.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIMAZE_H_ 2 | #define __AIMAZE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_block_moveh(Object *o); 6 | void ai_block_movev(Object *o); 7 | void ai_boulder(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/maze/pooh_black.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIPOOH_H_ 2 | #define __AIPOOH_H_ 3 | #include "../../object.h" 4 | 5 | void ai_pooh_black(Object *o); 6 | void ai_pooh_black_bubble(Object *o); 7 | void ai_pooh_black_dying(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/npc/balrog.h: -------------------------------------------------------------------------------- 1 | #ifndef __AINPCBALROG_H_ 2 | #define __AINPCBALROG_H_ 3 | #include "../../object.h" 4 | 5 | void onspawn_balrog(Object *o); 6 | void ai_balrog(Object *o); 7 | void ai_balrog_drop_in(Object *o); 8 | void ai_balrog_bust_in(Object *o); 9 | void balrog_walk_init(Object *o); 10 | void balrog_walk_animation(Object *o); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/ai/npc/curly.h: -------------------------------------------------------------------------------- 1 | #ifndef __AICURLY_H_ 2 | #define __AICURLY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_curly(Object *o); 6 | void ai_curly_collapsed(Object *o); 7 | void aftermove_curly_carried(Object *o); 8 | void ai_curly_carried_shooting(Object *o); 9 | void ai_ccs_gun(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/npc/curly_ai.h: -------------------------------------------------------------------------------- 1 | #ifndef __AICURLYAI_H_ 2 | #define __AICURLYAI_H_ 3 | #include "../../object.h" 4 | 5 | void ai_curly_ai(Object *o); 6 | static void CaiJUMP(Object *o); 7 | void ai_cai_gun(Object *o); 8 | void aftermove_cai_gun(Object *o); 9 | void aftermove_cai_watershield(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/npc/misery.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIMISERY_H_ 2 | #define __AIMISERY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_misery_float(Object *o); 6 | void ai_miserys_bubble(Object *o); 7 | static Object *mbubble_find_target(void); 8 | void ai_misery_stand(Object *o); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/npc/npcguest.cpp: -------------------------------------------------------------------------------- 1 | #include "npcguest.h" 2 | 3 | #include "../../game.h" 4 | #include "../../graphics/Tileset.h" 5 | #include "../../player.h" 6 | #include "../ai.h" 7 | #include "../stdai.h" 8 | //#include "../../map.h" 9 | 10 | INITFUNC(AIRoutines) 11 | { 12 | ONTICK(OBJ_MAHIN, ai_npc_mahin); 13 | 14 | ONSPAWN(OBJ_YAMASHITA_FLOWERS, onspawn_set_frame_from_id2); 15 | ONTICK(OBJ_YAMASHITA_PAVILION, ai_yamashita_pavilion); 16 | 17 | ONTICK(OBJ_CHTHULU, ai_chthulu); 18 | 19 | GENERIC_NPC_NOFACEPLAYER(OBJ_DR_GERO); 20 | GENERIC_NPC_NOFACEPLAYER(OBJ_NURSE_HASUMI); 21 | } 22 | 23 | /* 24 | void c------------------------------() {} 25 | */ 26 | 27 | void ai_chthulu(Object *o) 28 | { 29 | if (!o->state) 30 | { 31 | o->SnapToGround(); 32 | o->state = 1; 33 | } 34 | 35 | // open eyes when player comes near 36 | o->frame = (pdistlx((48 * CSFI)) && pdistly2((48 * CSFI), (16 * CSFI))) ? 1 : 0; 37 | } 38 | 39 | // fat mimiga from village 40 | void ai_npc_mahin(Object *o) 41 | { 42 | switch (o->state) 43 | { 44 | case 0: 45 | o->SnapToGround(); 46 | o->state = 1; 47 | o->frame = 2; 48 | 49 | case 1: // facing away 50 | break; 51 | 52 | case 2: // talking to player 53 | o->frame = 0; 54 | randblink(o); 55 | break; 56 | } 57 | } 58 | 59 | /* 60 | void c------------------------------() {} 61 | */ 62 | 63 | // Sandaime's Pavilion from Yamashita Farm 64 | void ai_yamashita_pavilion(Object *o) 65 | { 66 | if (!o->state) 67 | { 68 | if (o->dir == LEFT) 69 | { // Sandaime present 70 | o->state = 1; 71 | } 72 | else 73 | { // Sandaime gone 74 | o->x -= (TILE_W * CSFI); 75 | o->state = 2; 76 | o->frame = 2; 77 | } 78 | } 79 | 80 | if (o->state == 1) 81 | { 82 | o->frame = 0; 83 | randblink(o); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/ai/npc/npcguest.h: -------------------------------------------------------------------------------- 1 | #ifndef __AINPCGUEST_H_ 2 | #define __AINPCGUEST_H_ 3 | #include "../../object.h" 4 | 5 | void ai_chthulu(Object *o); 6 | void ai_npc_mahin(Object *o); 7 | void ai_yamashita_pavilion(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/npc/npcplayer.h: -------------------------------------------------------------------------------- 1 | #ifndef __AINPCPLAYER_H_ 2 | #define __AINPCPLAYER_H_ 3 | #include "../../object.h" 4 | 5 | void ai_npc_player(Object *o); 6 | void ai_ptelin(Object *o); 7 | void ai_ptelout(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/npc/npcregu.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIREGU_H_ 2 | #define __AIREGU_H_ 3 | #include "../../object.h" 4 | 5 | void ai_jenka(Object *o); 6 | void ai_doctor(Object *o); 7 | void ai_toroko(Object *o); 8 | void ai_toroko_teleport_in(Object *o); 9 | void ai_npc_sue(Object *o); 10 | void aftermove_npc_sue(Object *o); 11 | void onspawn_npc_sue(Object *o); 12 | void ai_sue_teleport_in(Object *o); 13 | void ai_king(Object *o); 14 | void ai_blue_robot(Object *o); 15 | void ai_kanpachi_fishing(Object *o); 16 | void ai_professor_booster(Object *o); 17 | void ai_booster_falling(Object *o); 18 | void ai_npc_at_computer(Object *o); 19 | void ai_santa(Object *o); 20 | void ai_chaco(Object *o); 21 | void ai_jack(Object *o); 22 | 23 | void onspawn_generic_npc(Object *o); 24 | void ai_generic_npc(Object *o); 25 | void ai_generic_npc_nofaceplayer(Object *o); 26 | void npc_generic_walk(Object *o, int basestate); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/ai/oside/oside.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIOSIDE_H_ 2 | #define __AIOSIDE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_night_spirit(Object *o); 6 | void ai_night_spirit_shot(Object *o); 7 | void ai_hoppy(Object *o); 8 | void ai_sky_dragon(Object *o); 9 | void ai_pixel_cat(Object *o); 10 | void ai_little_family(Object *o); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/ai/plantation/plantation.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIPLANT_H_ 2 | #define __AIPLANT_H_ 3 | #include "../../caret.h" 4 | #include "../../object.h" 5 | 6 | void ai_stumpy(Object *o); 7 | void ai_midorin(Object *o); 8 | void ai_orangebell(Object *o); 9 | void ai_orangebell_baby(Object *o); 10 | void ai_gunfish(Object *o); 11 | void ai_gunfish_shot(Object *o); 12 | void ai_droll(Object *o); 13 | void ai_droll_shot(Object *o); 14 | void ai_droll_guard(Object *o); 15 | void ai_mimiga_farmer(Object *o); 16 | void onspawn_mimiga_cage(Object *o); 17 | void ai_npc_itoh(Object *o); 18 | void ai_kanpachi_standing(Object *o); 19 | void ai_npc_momorin(Object *o); 20 | void ai_proximity_press_hoz(Object *o); 21 | void ai_rocket(Object *o); 22 | void ai_numahachi(Object *o); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/ai/sand/curly_boss.h: -------------------------------------------------------------------------------- 1 | #ifndef __AICURLYBOSS_H_ 2 | #define __AICURLYBOSS_H_ 3 | #include "../../object.h" 4 | 5 | void ai_curly_boss(Object *o); 6 | static void curlyboss_fire(Object *o, int dir); 7 | void ai_curlyboss_shot(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/sand/puppy.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIPUPPY_H_ 2 | #define __AIPUPPY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_puppy_wag(Object *o); 6 | void ai_puppy_bark(Object *o); 7 | void ai_zzzz_spawner(Object *o); 8 | void ai_puppy_run(Object *o); 9 | void aftermove_puppy_carry(Object *o); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/ai/sand/sand.h: -------------------------------------------------------------------------------- 1 | #ifndef __AISAND_H_ 2 | #define __AISAND_H_ 3 | #include "../../object.h" 4 | 5 | void ai_polish(Object *o); 6 | void ondeath_polish(Object *o); 7 | void ai_polishbaby(Object *o); 8 | void ai_sandcroc(Object *o); 9 | void ai_sunstone(Object *o); 10 | void ai_crow(Object *o); 11 | void ai_crowwithskull(Object *o); 12 | void ai_skullhead(Object *o); 13 | void ai_skullhead_carried(Object *o); 14 | void aftermove_skullhead_carried(Object *o); 15 | void ai_skeleton_shot(Object *o); 16 | void ai_armadillo(Object *o); 17 | void ai_skullstep(Object *o); 18 | void ai_skullstep_foot(Object *o); 19 | void skullstep_do_step(Object *o, Object *skull, int angle); 20 | void ai_skeleton(Object *o); 21 | void ai_curlys_mimigas(Object *o); 22 | void ai_beetle_horizwait(Object *o); 23 | 24 | #endif -------------------------------------------------------------------------------- /src/ai/sand/toroko_frenzied.h: -------------------------------------------------------------------------------- 1 | #ifndef __AITOROKO_H_ 2 | #define __AITOROKO_H_ 3 | #include "../../object.h" 4 | 5 | void ai_toroko_frenzied(Object *o); 6 | void ai_toroko_block(Object *o); 7 | void aftermove_toroko_block(Object *o); 8 | void ai_toroko_flower(Object *o); 9 | 10 | #endif -------------------------------------------------------------------------------- /src/ai/stdai.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STDAI_H 3 | #define _STDAI_H 4 | 5 | #include "../common/InitList.h" 6 | #include "../nx.h" 7 | #include "../object.h" 8 | 9 | extern InitList AIRoutines; 10 | 11 | #define ONTICK(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.ontick = FUNCTION; 12 | #define ONDEATH(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.ondeath = FUNCTION; 13 | #define AFTERMOVE(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.aftermove = FUNCTION; 14 | #define ONSPAWN(OBJTYPE, FUNCTION) objprop[OBJTYPE].ai_routines.onspawn = FUNCTION; 15 | 16 | #define GENERIC_NPC(O) \ 17 | { \ 18 | ONSPAWN(O, onspawn_generic_npc); \ 19 | ONTICK(O, ai_generic_npc); \ 20 | } 21 | 22 | #define GENERIC_NPC_NOFACEPLAYER(O) \ 23 | { \ 24 | ONSPAWN(O, onspawn_generic_npc); \ 25 | ONTICK(O, ai_generic_npc_nofaceplayer); \ 26 | } 27 | 28 | void aftermove_StickToLinkedActionPoint(Object *o); 29 | void onspawn_set_frame_from_id2(Object *o); 30 | void onspawn_snap_to_ground(Object *o); 31 | void ai_generic_angled_shot(Object *o); 32 | 33 | void ai_generic_npc(Object *o); 34 | void ai_generic_npc_nofaceplayer(Object *o); 35 | void onspawn_generic_npc(Object *o); 36 | 37 | void ai_animate1(Object *o); 38 | void ai_animate2(Object *o); 39 | void ai_animate3(Object *o); 40 | void ai_animate4(Object *o); 41 | void ai_animate5(Object *o); 42 | 43 | void KillObjectsOfType(int type); 44 | void DeleteObjectsOfType(int type); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/ai/sym/smoke.h: -------------------------------------------------------------------------------- 1 | #ifndef __SMOKE_H_ 2 | #define __SMOKE_H_ 3 | #include "../../object.h" 4 | Object *SmokePuff(int x, int y); 5 | void SmokeClouds(Object *o, int nclouds, int rangex = 0, int rangey = 0, Object *pushbehind = NULL); 6 | void SmokeXY(int x, int y, int nclouds, int rangex = 0, int rangey = 0, Object *pushbehind = NULL); 7 | void SmokeSide(Object *o, int nclouds, int dir); 8 | void SmokeCloudsSlow(int x, int y, int nclouds); 9 | void SmokeBoomUp(Object *o, int count = 8); 10 | void ai_smokecloud(Object *o); 11 | 12 | #endif -------------------------------------------------------------------------------- /src/ai/sym/sym.h: -------------------------------------------------------------------------------- 1 | #ifndef __AISYM_H_ 2 | #define __AISYM_H_ 3 | #include "../../object.h" 4 | 5 | void ai_null(Object *o); 6 | void ai_hvtrigger(Object *o); 7 | void ai_xp(Object *o); 8 | void ai_powerup(Object *o); 9 | bool Handle_Falling_Left(Object *o); 10 | void ai_hidden_powerup(Object *o); 11 | void ai_xp_capsule(Object *o); 12 | void ai_save_point(Object *o); 13 | void ai_recharge(Object *o); 14 | void ai_chest_closed(Object *o); 15 | void ai_chest_open(Object *o); 16 | void ai_lightning(Object *o); 17 | void ai_teleporter(Object *o); 18 | void ai_door(Object *o); 19 | void ai_largedoor(Object *o); 20 | void ai_press(Object *o); 21 | void ai_terminal(Object *o); 22 | void ai_fan_vert(Object *o); 23 | void ai_fan_hoz(Object *o); 24 | void ai_fan_droplet(Object *o); 25 | void ai_sprinkler(Object *o); 26 | void ai_droplet_spawner(Object *o); 27 | void ai_water_droplet(Object *o); 28 | void ai_bubble_spawner(Object *o); 29 | void ai_chinfish(Object *o); 30 | void ai_fireplace(Object *o); 31 | void ai_straining(Object *o); 32 | void ai_smoke_dropper(Object *o); 33 | void ai_scroll_controller(Object *o); 34 | void ai_quake(Object *o); 35 | void ai_generic_angled_shot(Object *o); 36 | void onspawn_spike_small(Object *o); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/ai/village/balrog_boss_running.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALROGRUN_H_ 2 | #define __AIBALROGRUN_H_ 3 | #include "../../object.h" 4 | 5 | void ai_balrog_boss_running(Object *o); 6 | static void walking_animation(Object *o); 7 | void ondeath_balrog_boss_running(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/village/ma_pignon.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIMAPIGNON_H_ 2 | #define __AIMAPIGNON_H_ 3 | #include "../../object.h" 4 | 5 | void ai_ma_pignon(Object *o); 6 | void ai_ma_pignon_rock(Object *o); 7 | void ai_ma_pignon_clone(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/village/village.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIVILLAGE_H_ 2 | #define __AIVILLAGE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_toroko_shack(Object *o); 6 | void ai_mushroom_enemy(Object *o); 7 | void ai_gravekeeper(Object *o); 8 | void ai_cage(Object *o); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/weapons/blade.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBLADE_H_ 2 | #define __AIBLADE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_blade_l3_shot(Object *o); 6 | void aftermove_blade_slash(Object *o); 7 | void ai_blade_slash(Object *o); 8 | void aftermove_blade_l12_shot(Object *o); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/weapons/bubbler.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBUBBLER_H_ 2 | #define __AIBUBBLER_H_ 3 | #include "../../object.h" 4 | 5 | void ai_bubbler_l12(Object *o); 6 | void ai_bubbler_l3(Object *o); 7 | void ai_bubbler_sharp(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/weapons/fireball.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIFIREBALL_H_ 2 | #define __AIFIREBALL_H_ 3 | #include "../../object.h" 4 | 5 | void ai_fireball(Object *o); 6 | void ai_fireball_level_23(Object *o); 7 | Object *create_fire_trail(Object *o, int objtype, int level); 8 | void ai_fireball_trail(Object *o); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/weapons/missile.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIMISSILE_H_ 2 | #define __AIMISSILE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_missile_shot(Object *o); 6 | void ai_missile_boom_spawner(Object *o); 7 | void ai_missile_boom_spawner_tick(Object *o); 8 | static void missilehitsmoke(int x, int y, int range); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ai/weapons/nemesis.h: -------------------------------------------------------------------------------- 1 | #ifndef __AINEMESIS_H_ 2 | #define __AINEMESIS_H_ 3 | #include "../../object.h" 4 | 5 | void ai_nemesis_shot(Object *o); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/ai/weapons/polar_mgun.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIPOLARM_H_ 2 | #define __AIPOLARM_H_ 3 | #include "../../object.h" 4 | 5 | void ai_polar_shot(Object *o); 6 | void ai_mgun_trail(Object *o); 7 | void ai_mgun_spawner(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/weapons/snake.h: -------------------------------------------------------------------------------- 1 | #ifndef __AISNAKE_H_ 2 | #define __AISNAKE_H_ 3 | #include "../../object.h" 4 | 5 | void ai_snake(Object *o); 6 | void ai_snake_23(Object *o); 7 | void ai_snake_trail(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/weapons/spur.h: -------------------------------------------------------------------------------- 1 | #ifndef __AISPUR_H_ 2 | #define __AISPUR_H_ 3 | #include "../../object.h" 4 | 5 | void ai_spur_shot(Object *o); 6 | static void spur_spawn_trail(Object *o); 7 | void ai_spur_trail(Object *o); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/ai/weapons/weapons.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WEAPONS_H 3 | #define _WEAPONS_H 4 | #include "../../caret.h" 5 | #include "../../object.h" 6 | #include "../stdai.h" 7 | 8 | uint8_t run_shot(Object *o, bool destroys_blocks); 9 | enum run_shot_result 10 | { 11 | RS_NONE = 0, 12 | RS_HIT_ENEMY, 13 | RS_HIT_WALL, 14 | RS_TTL_EXPIRED 15 | }; 16 | 17 | Object *check_hit_enemy(Object *o, uint32_t flags_to_exclude = 0); 18 | Object *damage_enemies(Object *o, uint32_t flags_to_exclude = 0); 19 | int damage_multiple_enemies(Object *o, uint32_t flags_to_exclude = 0); 20 | int damage_all_enemies_in_bb(Object *o, uint32_t flags_to_exclude, int x, int y, int range); 21 | 22 | void shot_spawn_effect(Object *o, int effectno); 23 | void shot_dissipate(Object *o, int effectno = EFFECT_STARPOOF); 24 | bool shot_destroy_blocks(Object *o); 25 | 26 | bool IsBlockedInShotDir(Object *o); 27 | 28 | // --------------------------------------- 29 | 30 | // from Fireball code, shared with Snake 31 | Object *create_fire_trail(Object *o, int objtype, int level); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/ai/weapons/whimstar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WHIMSTAR_H 3 | #define _WHIMSTAR_H 4 | 5 | #include "../../object.h" 6 | 7 | #define MAX_WHIMSTARS 3 8 | 9 | struct Whimstar 10 | { 11 | int x, y; 12 | int xinertia, yinertia; 13 | }; 14 | 15 | struct WhimsicalStar 16 | { 17 | Whimstar stars[MAX_WHIMSTARS]; 18 | int nstars; 19 | int stariter; 20 | }; 21 | 22 | void init_whimstar(WhimsicalStar *wh); 23 | void add_whimstar(WhimsicalStar *wh); 24 | void remove_whimstar(WhimsicalStar *wh); 25 | void run_whimstar(WhimsicalStar *wh); 26 | void draw_whimstars(WhimsicalStar *wh); 27 | void ai_whimsical_star(Object *o); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ai/weed/balrog_boss_flying.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIBALLROGFLY_H_ 2 | #define __AIBALLROGFLY_H_ 3 | #include "../../object.h" 4 | 5 | void ai_balrog_boss_flying(Object *o); 6 | void ondeath_balrog_boss_flying(Object *o); 7 | void ai_balrog_shot_bounce(Object *o); 8 | 9 | #endif -------------------------------------------------------------------------------- /src/ai/weed/frenzied_mimiga.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIFRENZIEDMIMI_H_ 2 | #define __AIFRENZIEDMIMI_H_ 3 | #include "../../object.h" 4 | 5 | void ai_frenzied_mimiga(Object *o); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/ai/weed/weed.h: -------------------------------------------------------------------------------- 1 | #ifndef __AIWEED_H_ 2 | #define __AIWEED_H_ 3 | #include "../../object.h" 4 | 5 | void ai_critter(Object *o); 6 | void ai_bat_hang(Object *o); 7 | void ai_bat_circle(Object *o); 8 | void ai_jelly(Object *o); 9 | void ai_giant_jelly(Object *o); 10 | void ai_mannan(Object *o); 11 | void ai_mannan_shot(Object *o); 12 | void ai_frog(Object *o); 13 | void ai_hey_spawner(Object *o); 14 | void ai_motorbike(Object *o); 15 | void ai_malco(Object *o); 16 | void ai_malco_broken(Object *o); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/autogen/AssignSprites.h: -------------------------------------------------------------------------------- 1 | #ifndef __ASSIGN_SPRITES_H 2 | #define __ASSIGN_SPRITES_H 3 | 4 | void AssignSprites(void); 5 | #endif -------------------------------------------------------------------------------- /src/chat.h: -------------------------------------------------------------------------------- 1 | //made by root 2 | #include 3 | #include "ipfuncs.h" 4 | 5 | #ifndef __CHAT__ 6 | #define __CHAT__ 7 | 8 | #define CHATMSGSIZE 64 9 | 10 | extern FILE* chatlogfile; 11 | 12 | typedef struct { 13 | char msg[CHATMSGSIZE + 17]; //message + <14 char player name> + identifier (host/admin) 14 | unsigned char flags; 15 | //^: 16 | //bit 0=player message or server/event message (EX:xXcritterslayah69Xx has changed name to thelegend27) 17 | //bit 1=/me 18 | } chatmsg_t; 19 | 20 | typedef struct { 21 | unsigned short timer; //>=1:display chat 0=don't 22 | unsigned char msgamount; //amount of messages on screen 23 | unsigned char typing; //whaddya think 24 | char msg[CHATMSGSIZE]; //the message you're typing 25 | } chatstate_t; 26 | 27 | extern chatmsg_t chatmsgs[5]; 28 | 29 | extern chatstate_t chatstate; 30 | 31 | void Chat_WriteToLog(char* str); 32 | 33 | void Chat_Init(); 34 | 35 | void Chat_SetMessage(char* str, unsigned char flags); 36 | 37 | char* Chat_SendMessage(); 38 | 39 | void Chat_ReceiveMessage(unsigned char* msg, int node); 40 | 41 | void Chat_EnterMessage(); 42 | 43 | void Chat_AddChar(int ch); 44 | 45 | void Chat_Step(); 46 | 47 | void Chat_Display(); 48 | 49 | void SavePlayerConfig(); 50 | 51 | void LoadPlayerConfig(); 52 | #endif 53 | -------------------------------------------------------------------------------- /src/common/InitList.cpp: -------------------------------------------------------------------------------- 1 | 2 | // this is a combination of some C++ and preprocessor magic which allows a 3 | // group of initilization functions to be declared across many different 4 | // source files and then at the appropriate time all can be called at once. 5 | // The "trick" is that it automatically works for all modules linked to the 6 | // program so you don't have to keep a handmade list anywhere of the names 7 | // of the initilization functions. This is used by the AI functions to initilize 8 | // all the function pointers etc for the various creatures. 9 | #include "InitList.h" 10 | 11 | #include "../Utils/Logger.h" 12 | 13 | void InitList::AddFunction(void (*func)(void)) 14 | { 15 | AddFunction((void *)func); 16 | } 17 | 18 | void InitList::AddFunction(bool (*func)(void)) 19 | { 20 | AddFunction((void *)func); 21 | } 22 | 23 | void InitList::AddFunction(void *func) 24 | { 25 | // stat("AddFunction (void)%08x [%d]", func, fCount); 26 | if (fCount >= MAX_INIT_RECORDS) 27 | return; 28 | 29 | fFunctions[fCount++] = (void *)func; 30 | } 31 | 32 | /* 33 | void c------------------------------() {} 34 | */ 35 | 36 | bool InitList::CallFunctions() 37 | { 38 | int i; 39 | 40 | if (fCount >= MAX_INIT_RECORDS) 41 | { 42 | LOG_DEBUG("InitList::CallFunctions({:#08x}): too many initializers", (intptr_t)this); 43 | return 1; 44 | } 45 | 46 | LOG_DEBUG("InitList::CallFunctions({:#08x}): executing {} functions...", (intptr_t)this, fCount); 47 | 48 | for (i = 0; i < fCount; i++) 49 | { 50 | void (*func)(void) = (void (*)())fFunctions[i]; 51 | (*func)(); 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /src/common/InitList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INITLIST_H 3 | #define _INITLIST_H 4 | 5 | #define MAX_INIT_RECORDS 100 6 | 7 | class InitList 8 | { 9 | public: 10 | void AddFunction(void (*func)(void)); 11 | void AddFunction(bool (*func)(void)); 12 | void AddFunction(void *func); 13 | bool CallFunctions(); 14 | 15 | private: 16 | void *fFunctions[MAX_INIT_RECORDS]; 17 | int fCount; // counting on behavior of auto-initilization to 0 18 | }; 19 | 20 | class InitAdder 21 | { 22 | public: 23 | InitAdder(InitList *initlist, void (*func)(void)) 24 | { 25 | initlist->AddFunction(func); 26 | } 27 | InitAdder(InitList *initlist, bool (*func)(void)) 28 | { 29 | initlist->AddFunction(func); 30 | } 31 | InitAdder(InitList &initlist, void (*func)(void)) 32 | { 33 | initlist.AddFunction(func); 34 | } 35 | InitAdder(InitList &initlist, bool (*func)(void)) 36 | { 37 | initlist.AddFunction(func); 38 | } 39 | }; 40 | 41 | #define INITFUNC(TARGET) \ 42 | static void __InitFunc(void); \ 43 | static InitAdder _ia(TARGET, __InitFunc); \ 44 | static void __InitFunc(void) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/common/basics.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BASICS_H 3 | #define _BASICS_H 4 | 5 | #include 6 | 7 | #if defined(__APPLE__) || defined(_WIN32) 8 | #define MAXPATHLEN 256 9 | #else 10 | #include // MAXPATHLEN 11 | #endif 12 | 13 | #ifndef PATH_MAX 14 | #define PATH_MAX 259 15 | #endif 16 | 17 | #include "../Utils/Logger.h" 18 | 19 | #define ASSERT(X) \ 20 | { \ 21 | if (!(X)) \ 22 | { \ 23 | LOG_CRITICAL("** ASSERT FAILED: '%s' at %s(%d)", #X, __FILE__, __LINE__); \ 24 | exit(1); \ 25 | } \ 26 | } 27 | 28 | #define SWAP(A, B) \ 29 | { \ 30 | A ^= B; \ 31 | B ^= A; \ 32 | A ^= B; \ 33 | } 34 | 35 | #ifndef MIN 36 | #define MIN(A, B) (((A) < (B)) ? (A) : (B)) 37 | #endif 38 | 39 | #ifndef MAX 40 | #define MAX(A, B) (((A) > (B)) ? (A) : (B)) 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/common/bufio.h: -------------------------------------------------------------------------------- 1 | #ifndef _BUFIO_H 2 | #define _BUFIO_H 3 | #include "../Utils/Logger.h" 4 | 5 | #include 6 | 7 | static uint8_t read_U8(const uint8_t **data, const uint8_t *data_end) 8 | { 9 | if (*data > data_end) 10 | { 11 | LOG_ERROR("read_U8: read past end of buffer: *data > data_end"); 12 | return 0xfe; 13 | } 14 | 15 | return *(*data)++; 16 | } 17 | 18 | static uint16_t read_U16(const uint8_t **data, const uint8_t *data_end) 19 | { 20 | const uint8_t *ptr = *data; 21 | 22 | if ((ptr + 1) > data_end) 23 | { 24 | LOG_ERROR("read_U16: read past end of buffer: *data + 1 > data_end"); 25 | return 0xfefe; 26 | } 27 | 28 | *data = (ptr + 2); 29 | // we should not just cast to a uint16_t, as some processors 30 | // e.g. ARM would have alignment issues then, plus endian issues on others. 31 | return (ptr[1] << 8) | ptr[0]; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/common/glob.cpp: -------------------------------------------------------------------------------- 1 | #ifndef _WIN32 2 | #include "myfnmatch.h" 3 | #include 4 | #endif 5 | #include "glob.h" 6 | 7 | #include 8 | 9 | static std::pair SplitPath(const std::string &path) 10 | { 11 | std::string::size_type last_sep = path.find_last_of("/"); 12 | if (last_sep != std::string::npos) 13 | { 14 | return std::make_pair(std::string(path.begin(), path.begin() + last_sep), 15 | std::string(path.begin() + last_sep + 1, path.end())); 16 | } 17 | return std::make_pair(".", path); 18 | } 19 | 20 | #ifdef _WIN32 21 | 22 | Glob::Glob(const std::string &pattern) 23 | : ok_(false) 24 | , find_handle_(INVALID_HANDLE_VALUE) 25 | { 26 | std::pair dir_and_mask = SplitPath(pattern); 27 | _base = dir_and_mask.first; 28 | 29 | find_handle_ = FindFirstFile(widen(pattern).c_str(), &find_data_); 30 | ok_ = find_handle_ != INVALID_HANDLE_VALUE; 31 | } 32 | 33 | Glob::~Glob() 34 | { 35 | if (find_handle_ != INVALID_HANDLE_VALUE) 36 | { 37 | FindClose(find_handle_); 38 | } 39 | } 40 | 41 | bool Glob::Next() 42 | { 43 | while (ok_ = (FindNextFile(find_handle_, &find_data_) != 0)) 44 | { 45 | if (strcmp(narrow(find_data_.cFileName).c_str(), ".") != 0 46 | && strcmp(narrow(find_data_.cFileName).c_str(), "..") != 0) 47 | break; 48 | } 49 | return ok_; 50 | } 51 | 52 | #else 53 | 54 | Glob::Glob(const std::string &pattern) 55 | : dir_(0) 56 | , dir_entry_(0) 57 | { 58 | std::pair dir_and_mask = SplitPath(pattern); 59 | _base = dir_and_mask.first; 60 | dir_ = opendir(dir_and_mask.first.c_str()); 61 | pattern_ = dir_and_mask.second; 62 | 63 | if (dir_ != 0) 64 | { 65 | Next(); 66 | } 67 | } 68 | 69 | Glob::~Glob() 70 | { 71 | if (dir_ != 0) 72 | { 73 | closedir(dir_); 74 | } 75 | } 76 | 77 | bool Glob::Next() 78 | { 79 | while ((dir_entry_ = readdir(dir_)) != 0) 80 | { 81 | if 82 | ( 83 | !myfnmatch(pattern_.c_str(), dir_entry_->d_name) 84 | && strcmp(dir_entry_->d_name, ".") != 0 85 | && strcmp(dir_entry_->d_name, "..") !=0 86 | ) 87 | { 88 | // printf("%s\n", dir_entry_->d_name); 89 | return true; 90 | } 91 | } 92 | return false; 93 | } 94 | 95 | #endif -------------------------------------------------------------------------------- /src/common/glob.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLOB_H_ 2 | #define _GLOB_H_ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef _WIN32 8 | #include "misc.h" 9 | 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | class Glob 16 | { 17 | public: 18 | Glob(const std::string &pattern); 19 | ~Glob(); 20 | 21 | bool Next(); 22 | 23 | private: 24 | Glob(const Glob &); 25 | void operator=(const Glob &); 26 | std::string _base; 27 | 28 | public: 29 | #ifdef _WIN32 30 | std::string GetFileName() const 31 | { 32 | assert(ok_); 33 | return _base + "/" + narrow(find_data_.cFileName); 34 | } 35 | 36 | operator bool() const 37 | { 38 | return ok_; 39 | } 40 | 41 | private: 42 | bool ok_; 43 | HANDLE find_handle_; 44 | WIN32_FIND_DATA find_data_; 45 | #else 46 | std::string GetFileName() const 47 | { 48 | assert(dir_entry_ != 0); 49 | return _base + "/" + std::string(dir_entry_->d_name); 50 | } 51 | 52 | operator bool() const 53 | { 54 | return dir_entry_ != 0; 55 | } 56 | 57 | private: 58 | std::string pattern_; 59 | DIR *dir_; 60 | struct dirent *dir_entry_; 61 | #endif 62 | }; 63 | 64 | #endif -------------------------------------------------------------------------------- /src/common/myfnmatch.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_MY_FNMATCH_H 2 | #define HEADER_MY_FNMATCH_H 3 | 4 | #define MY_FNMATCH_MATCH 0 5 | #define MY_FNMATCH_NOMATCH 1 6 | #define MY_FNMATCH_FAIL 2 7 | 8 | int myfnmatch(const char *pattern, const char *string); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIG_H 2 | #define _CONFIG_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /src/console.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CONSOLE_H 3 | #define _CONSOLE_H 4 | 5 | #define CONSOLE_MAXCMDLEN 48 6 | #define CONSOLE_MAXRESPONSELEN 48 7 | 8 | // how many commands to remember in the backbuffer 9 | #define CONSOLE_MAX_BACK 8 10 | #include 11 | #include 12 | #include 13 | 14 | struct CommandEntry 15 | { 16 | std::string name; 17 | void (*handler)(std::vector *args, int num); 18 | unsigned int minArgs, maxArgs; 19 | std::string help; 20 | }; 21 | 22 | class DebugConsole 23 | { 24 | public: 25 | DebugConsole(); 26 | 27 | void SetVisible(bool newstate); 28 | bool IsVisible(); 29 | 30 | bool HandleKey(int key); 31 | void HandleKeyRelease(int key); 32 | void Draw(); 33 | 34 | bool Execute(std::string& line); 35 | 36 | template void Print(const std::string& format, Args... args) 37 | { 38 | fResponse.push_back(fmt::format(format, args...)); 39 | fResponseTimer = 60; 40 | } 41 | 42 | std::vector& getCommands() 43 | { 44 | return commands; 45 | } 46 | 47 | private: 48 | void DrawDebugText(const std::string& text, int y = 16); 49 | void MatchCommand(const std::string& cmd, std::vector& matches); 50 | std::string SplitCommand(const std::string& line_in, std::vector& args); 51 | void ExpandCommand(); 52 | 53 | std::string fLine = ""; 54 | int fKeyDown = 0; 55 | int fRepeatTimer = 0; 56 | 57 | std::string fLineToExpand = ""; 58 | bool fBrowsingExpansion; 59 | unsigned int fExpandIndex; 60 | 61 | std::vector fResponse; 62 | int fResponseTimer = 0; 63 | 64 | int fCursorTimer = 0; 65 | bool fVisible = false; 66 | 67 | // up-down last-command buffer 68 | int fBackIndex; 69 | std::vector fBackBuffer; 70 | std::vector commands; 71 | }; 72 | 73 | extern DebugConsole console; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/debug.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DEBUG_H 3 | #define _DEBUG_H 4 | 5 | #define DM_PIXEL 0 6 | #define DM_CROSSHAIR 1 7 | #define DM_XLINE 2 8 | #define DM_YLINE 3 9 | #define DM_BOX 4 10 | 11 | #include 12 | 13 | void DrawDebug(void); 14 | void DrawBoundingBoxes(); 15 | void DrawAttrPoints(); 16 | void debug(const char *fmt, ...); 17 | void debug_draw(void); 18 | void debug_clear(); 19 | const char *DescribeObjectType(int type); 20 | int ObjectNameToType(const char *name_in); 21 | const char *DescribeDir(int dir); 22 | const char *strhex(int value); 23 | void DrawDebugMarks(void); 24 | void AddDebugMark(int x, int y, int x2, int y2, char type, uint8_t r, uint8_t g, uint8_t b); 25 | void DebugPixel(int x, int y, uint8_t r, uint8_t g, uint8_t b); 26 | void DebugCrosshair(int x, int y, uint8_t r, uint8_t g, uint8_t b); 27 | void crosshair(int x, int y); 28 | void DebugPixelNonCSF(int x, int y, uint8_t r, uint8_t g, uint8_t b); 29 | void DebugCrosshairNonCSF(int x, int y, uint8_t r, uint8_t g, uint8_t b); 30 | void debugVline(int x, uint8_t r, uint8_t g, uint8_t b); 31 | void debugHline(int y, uint8_t r, uint8_t g, uint8_t b); 32 | void debugbox(int x1, int y1, int x2, int y2, uint8_t r, uint8_t g, uint8_t b); 33 | void debugtile(int x, int y, uint8_t r, uint8_t g, uint8_t b); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/endgame/CredReader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CREDITS_READER_H 3 | #define _CREDITS_READER_H 4 | 5 | #include 6 | 7 | enum CC 8 | { 9 | CC_TEXT = '[', 10 | CC_SET_XOFF = '+', 11 | CC_BLANK_SPACE = '-', 12 | 13 | CC_JUMP = 'j', 14 | CC_FLAGJUMP = 'f', 15 | CC_LABEL = 'l', 16 | 17 | CC_MUSIC = '!', 18 | CC_FADE_MUSIC = '~', 19 | CC_END = '/' 20 | }; 21 | 22 | // represents a command from the .tsc 23 | struct CredCommand 24 | { 25 | char type = 0; 26 | int parm, parm2 = 0; 27 | std::string text = ""; 28 | 29 | void DumpContents(); 30 | }; 31 | 32 | class CredReader 33 | { 34 | public: 35 | CredReader(); 36 | bool OpenFile(); 37 | void CloseFile(); 38 | bool ReadCommand(CredCommand *cmd); 39 | void Rewind(); 40 | 41 | private: 42 | int ReadNumber(); 43 | char get(); 44 | void unget(); 45 | char peek(); 46 | 47 | std::string data; 48 | int dataindex, datalen; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/endgame/credits.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CREDITS_H 3 | #define _CREDITS_H 4 | 5 | #define MAX_BIGIMAGES 20 6 | #define CRED_MAX_TEXT 80 7 | #include "../graphics/Surface.h" 8 | #include "CredReader.h" 9 | 10 | #include 11 | 12 | // a currently displayed line of text 13 | struct CredLine 14 | { 15 | std::string text = ""; 16 | int image = 0; 17 | int x, y = 0; 18 | bool remove = false; 19 | }; 20 | 21 | class BigImage 22 | { 23 | public: 24 | bool Init(); 25 | ~BigImage(); 26 | 27 | void Set(int num); 28 | void Clear(); 29 | void Draw(); 30 | 31 | private: 32 | int imagex, state; 33 | int imgno; 34 | NXE::Graphics::Surface *images[MAX_BIGIMAGES]; 35 | }; 36 | 37 | class Credits 38 | { 39 | public: 40 | bool Init(); 41 | void Tick(); 42 | void Draw(); 43 | ~Credits(); 44 | 45 | BigImage bigimage; // current "SIL" big left-hand image 46 | 47 | private: 48 | void RunNextCommand(); 49 | bool Jump(int label); 50 | 51 | void DrawLine(CredLine& line); 52 | 53 | int spawn_y; // position of next line relative to top of roll 54 | int scroll_y; // CSFd roll position 55 | 56 | int xoffset; // x position of next line 57 | 58 | // turns off scrolling and further script execution when "/" command hit at end 59 | bool roll_running; 60 | 61 | CredReader script; 62 | std::vector lines; 63 | }; 64 | 65 | bool credit_init(int parameter); 66 | void credit_tick(); 67 | void credit_set_image(int imgno); 68 | void credit_clear_image(); 69 | void credit_close(); 70 | void credit_draw(); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/endgame/island.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ISLAND_H 3 | #define _ISLAND_H 4 | 5 | bool island_init(int survives); 6 | void island_tick(); 7 | void island_draw(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/endgame/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef __EMISC_H_ 2 | #define __EMISC_H_ 3 | #include "../object.h" 4 | 5 | void ai_cloud_spawner(Object *o); 6 | void ai_cloud(Object *o); 7 | void ai_balrog_flying(Object *o); 8 | void aftermove_balrog_passenger(Object *o); 9 | void ai_balrog_medic(Object *o); 10 | void ai_gaudi_patient(Object *o); 11 | void ai_baby_puppy(Object *o); 12 | void ai_turning_human(Object *o); 13 | void ai_ahchoo(Object *o); 14 | void ai_misery_wind(Object *o); 15 | void ai_the_cast(Object *o); 16 | 17 | #endif -------------------------------------------------------------------------------- /src/extract/crc.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "crc.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | static uint32_t CRC_Table[256]; 9 | static const uint32_t poly = 0x04c11db7; 10 | 11 | uint32_t reflect(uint32_t value, int size) 12 | { 13 | uint32_t newbits = 0; 14 | int i; 15 | 16 | for (i = 1; i <= size; i++) 17 | { 18 | if (value & 1) 19 | newbits |= (1 << (size - i)); 20 | 21 | value >>= 1; 22 | } 23 | 24 | return newbits; 25 | } 26 | 27 | void crc_init(void) 28 | { 29 | int i, j; 30 | 31 | for (i = 0; i < 256; i++) 32 | { 33 | CRC_Table[i] = reflect(i, 8) << 24; 34 | 35 | for (j = 0; j < 8; j++) 36 | CRC_Table[i] = (CRC_Table[i] << 1) ^ ((CRC_Table[i] & (1 << 31)) ? poly : 0); 37 | 38 | CRC_Table[i] = reflect(CRC_Table[i], 32); 39 | } 40 | } 41 | 42 | uint32_t crc_calc(uint8_t *buf, uint32_t size) 43 | { 44 | uint32_t crc = 0xFFFFFFFF; 45 | 46 | while (size) 47 | { 48 | crc = (crc >> 8) ^ CRC_Table[(crc & 0xFF) ^ *buf++]; 49 | size--; 50 | } 51 | 52 | return (crc ^ 0xFFFFFFFF); 53 | } 54 | -------------------------------------------------------------------------------- /src/extract/crc.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC_H_ 2 | #define __CRC_H_ 3 | 4 | #include 5 | 6 | void crc_init(void); 7 | uint32_t crc_calc(uint8_t *buf, uint32_t size); 8 | 9 | #endif -------------------------------------------------------------------------------- /src/extract/extractfiles.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXTRACTFILES_H_ 2 | #define __EXTRACTFILES_H_ 3 | 4 | #include 5 | 6 | bool extract_files(FILE *exefp); 7 | 8 | #endif -------------------------------------------------------------------------------- /src/extract/extractpxt.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXTRACTPXT_H_ 2 | #define __EXTRACTPXT_H_ 3 | 4 | #include 5 | 6 | bool extract_pxt(FILE *fp); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/extract/extractstages.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXTRACTSTAGES_H_ 2 | #define __EXTRACTSTAGES_H_ 3 | 4 | #include 5 | 6 | bool extract_stages(FILE *exefp); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/extract/main.cpp: -------------------------------------------------------------------------------- 1 | #include "extractfiles.h" 2 | #include "extractpxt.h" 3 | #include "extractstages.h" 4 | 5 | #include 6 | #include 7 | 8 | static const char *filename = "Doukutsu.exe"; 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | FILE *fp; 13 | 14 | fp = fopen(filename, "rb"); 15 | if (!fp) 16 | { 17 | printf("Can't open Doukutsu.exe!\n"); 18 | return 1; 19 | } 20 | 21 | if (extract_pxt(fp)) 22 | return 1; 23 | if (extract_files(fp)) 24 | return 1; 25 | if (extract_stages(fp)) 26 | return 1; 27 | fclose(fp); 28 | printf("Sucessfully extracted.\n"); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /src/floattext.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLOATTEXT_H 2 | #define _FLOATTEXT_H 3 | class Object; 4 | #include 5 | #define FT_Y_START -4 // this starts it exactly centered, since the font is 8px tall 6 | #define FT_Y_HOLD -19 7 | #define FT_Y_RISEAWAY (FT_Y_HOLD - 8) 8 | 9 | enum FloatTextStates 10 | { 11 | FT_IDLE, 12 | FT_RISE, 13 | FT_HOLD, 14 | FT_SCROLL_AWAY, 15 | }; 16 | 17 | class FloatText 18 | { 19 | public: 20 | FloatText(int sprite); 21 | ~FloatText(); 22 | void Reset(); 23 | 24 | void AddQty(int amt); 25 | bool IsScrollingAway(); 26 | 27 | void UpdatePos(Object *assoc_object); 28 | 29 | static void DrawAll(); 30 | static void UpdateAll(); 31 | static void DeleteAll(); 32 | static void ResetAll(void); 33 | 34 | bool ObjectDestroyed; 35 | 36 | private: 37 | void Draw(); 38 | void Update(); 39 | 40 | uint8_t state; 41 | 42 | int yoff; // how much we've risen 43 | int shownAmount; 44 | int sprite; // allows selecting font 45 | int timer; 46 | 47 | int objX, objY; // the center pixel of the associated object (de-CSFd) 48 | 49 | FloatText *next, *prev; 50 | static FloatText *first, *last; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/graphics/Surface.cpp: -------------------------------------------------------------------------------- 1 | #include "Surface.h" 2 | #include "Renderer.h" 3 | #include "../Utils/Logger.h" 4 | #include "zoom.h" 5 | 6 | namespace NXE 7 | { 8 | namespace Graphics 9 | { 10 | 11 | Surface::Surface() 12 | : _texture(nullptr) 13 | , _width(0) 14 | , _height(0) 15 | { 16 | } 17 | 18 | Surface::~Surface() 19 | { 20 | cleanup(); 21 | } 22 | 23 | // load the surface from a .pbm or bitmap file 24 | bool Surface::loadImage(const std::string &pbm_name, bool use_colorkey) 25 | { 26 | cleanup(); 27 | 28 | SDL_Surface *image = SDL_LoadBMP(pbm_name.c_str()); 29 | if (!image) 30 | { 31 | LOG_ERROR("Surface::LoadImage: load failed of '{}'! {}", pbm_name, SDL_GetError()); 32 | return false; 33 | } 34 | 35 | _width = image->w * Renderer::getInstance()->scale; 36 | _height = image->h * Renderer::getInstance()->scale; 37 | 38 | SDL_Surface *image_scaled = SDL_ZoomSurface(image, Renderer::getInstance()->scale); 39 | SDL_FreeSurface(image); 40 | 41 | if (use_colorkey) 42 | { 43 | SDL_SetColorKey(image_scaled, SDL_TRUE, SDL_MapRGB(image_scaled->format, 0, 0, 0)); 44 | } 45 | 46 | _texture = SDL_CreateTextureFromSurface(Renderer::getInstance()->renderer(), image_scaled); 47 | 48 | SDL_FreeSurface(image_scaled); 49 | 50 | if (!_texture) 51 | { 52 | LOG_ERROR("Surface::LoadImage: SDL_CreateTextureFromSurface failed: {}", SDL_GetError()); 53 | return false; 54 | } 55 | 56 | return true; 57 | } 58 | 59 | Surface *Surface::fromFile(const std::string &pbm_name, bool use_colorkey) 60 | { 61 | Surface *sfc = new Surface; 62 | if (!sfc->loadImage(pbm_name, use_colorkey)) 63 | { 64 | delete sfc; 65 | return nullptr; 66 | } 67 | 68 | return sfc; 69 | } 70 | 71 | int Surface::width() 72 | { 73 | return _width / Renderer::getInstance()->scale; 74 | } 75 | 76 | int Surface::height() 77 | { 78 | return _height / Renderer::getInstance()->scale; 79 | } 80 | 81 | SDL_Texture* Surface::texture() 82 | { 83 | return _texture; 84 | } 85 | 86 | void Surface::cleanup() 87 | { 88 | if (_texture) 89 | { 90 | SDL_DestroyTexture(_texture); 91 | _texture = nullptr; 92 | } 93 | } 94 | 95 | }; // namespace Graphics 96 | }; // namespace NXE 97 | -------------------------------------------------------------------------------- /src/graphics/Surface.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SURFACE_H 3 | #define _SURFACE_H 4 | 5 | #include "../common/basics.h" 6 | 7 | #include 8 | #include 9 | #include "types.h" 10 | 11 | namespace NXE 12 | { 13 | namespace Graphics 14 | { 15 | 16 | class Surface 17 | { 18 | public: 19 | Surface(); 20 | ~Surface(); 21 | 22 | bool loadImage(const std::string &pbm_name, bool use_colorkey = false); 23 | static Surface *fromFile(const std::string &pbm_name, bool use_colorkey = false); 24 | 25 | int width(); 26 | int height(); 27 | SDL_Texture* texture(); 28 | 29 | private: 30 | void cleanup(); 31 | 32 | SDL_Texture *_texture; 33 | int _width; 34 | int _height; 35 | 36 | public: 37 | int alpha = 255; 38 | }; 39 | 40 | }; // namespace Graphics 41 | }; // namespace NXE 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/graphics/font.h: -------------------------------------------------------------------------------- 1 | #ifndef _BMFONT_H 2 | #define _BMFONT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace NXE 10 | { 11 | namespace Graphics 12 | { 13 | 14 | class Font 15 | { 16 | public: 17 | struct Glyph 18 | { 19 | uint32_t glyph_id; 20 | uint32_t atlasid; 21 | uint32_t x; 22 | uint32_t y; 23 | uint32_t w; 24 | uint32_t h; 25 | uint32_t xadvance; 26 | uint32_t xoffset; 27 | uint32_t yoffset; 28 | }; 29 | 30 | Font(); 31 | ~Font(); 32 | bool load(); 33 | void cleanup(); 34 | const Font::Glyph &glyph(uint32_t codepoint); 35 | SDL_Texture *atlas(uint32_t idx); 36 | uint32_t draw(int x, int y, const std::string &text, uint32_t color = 0xFFFFFF, bool isShaded = false); 37 | uint32_t drawLTR(int x, int y, const std::string &text, uint32_t color = 0xFFFFFF, bool isShaded = false); 38 | uint32_t getWidth(const std::string &text); 39 | uint32_t getHeight() const; 40 | uint32_t getBase() const; 41 | 42 | 43 | private: 44 | std::vector _atlases; 45 | std::map _glyphs; 46 | uint32_t _height; 47 | uint32_t _base; 48 | uint32_t _upscale; 49 | bool _rendering = true; 50 | const uint8_t _shadowOffset = 1; 51 | }; 52 | 53 | }; // namespace NXE 54 | }; // namespace Graphics 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/graphics/pngfuncs.h: -------------------------------------------------------------------------------- 1 | /* SaveSurf: an example on how to save a SDLSurface in PNG 2 | Copyright (C) 2006 Angelo "Encelo" Theodorou 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | NOTE: 19 | 20 | This program is part of "Mars, Land of No Mercy" SDL examples, 21 | you can find other examples on http://marsnomercy.org 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | int png_save_surface(const std::string& filename, SDL_Surface *surf); 28 | SDL_Surface *png_load_surface(const std::string& filename); 29 | -------------------------------------------------------------------------------- /src/graphics/sprites.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SPRITES_H 3 | #define _SPRITES_H 4 | 5 | #define MAX_SPRITESHEETS 256 6 | #define MAX_SPRITES 1024 7 | 8 | #include "../siflib/sif.h" 9 | #include "Surface.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace NXE 16 | { 17 | namespace Graphics 18 | { 19 | 20 | class Sprites 21 | { 22 | public: 23 | Sprites(); 24 | ~Sprites(); 25 | 26 | bool init(); 27 | void close(); 28 | void flushSheets(); 29 | 30 | void blitSprite(int x, int y, int s, int frame, uint8_t dir, int xoff, int yoff, int wd, int ht, int tw, int th, int alpha = 255); 31 | void blitSpriteMirrored(int x, int y, int s, int frame, uint8_t dir, int xoff, int yoff, int wd, int ht, int tw, int th, int alpha = 255); 32 | 33 | void drawSprite(int x, int y, int s, int frame = 0, uint8_t dir = 0); 34 | void drawSpriteMirrored(int x, int y, int s, int frame = 0, uint8_t dir = 0); 35 | void drawSpriteAtDp(int x, int y, int s, int frame = 0, uint8_t dir = 0); 36 | void drawSpriteClipped(int x, int y, int s, int frame, uint8_t dir, int clipx1, int clipx2, int clipy1, int clipy2); 37 | void drawSpriteClipWidth(int x, int y, int s, int frame, int wd); 38 | void drawSpriteChopped(int x, int y, int s, int frame, int wd, int repeat_at, int alpha = 255); 39 | void drawSpriteRepeatingX(int x, int y, int s, int frame, int wd); 40 | 41 | SIFSprite sprites[MAX_SPRITES]; 42 | 43 | private: 44 | Surface *_spritesheets[MAX_SPRITESHEETS]; 45 | int _num_spritesheets = 0; 46 | int _num_sprites = 0; 47 | std::vector _sheetfiles; 48 | 49 | void _offset_by_draw_points(); 50 | void _expand_single_dir_sprites(); 51 | void _create_slope_boxes(); 52 | bool _load_sif(const std::string &fname); 53 | void _loadSheetIfNeeded(int sheetno); 54 | void _initializeSkinSprites(); 55 | }; 56 | }; // namespace Graphics 57 | }; // namespace NXE 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/graphics/tileset.cpp: -------------------------------------------------------------------------------- 1 | // manages the tileset 2 | #include "Tileset.h" 3 | 4 | #include "../ResourceManager.h" 5 | #include "../config.h" 6 | #include "../nx.h" 7 | #include "Surface.h" 8 | #include "Renderer.h" 9 | 10 | #include 11 | #include 12 | 13 | extern const char *tileset_names[]; // from stagedata.cpp 14 | 15 | namespace NXE 16 | { 17 | namespace Graphics 18 | { 19 | 20 | Tileset::Tileset() {} 21 | 22 | Tileset::~Tileset() 23 | { 24 | delete _tileset; 25 | } 26 | 27 | // load the given tileset into memory, replacing any other tileset. 28 | bool Tileset::load(int new_tileset) 29 | { 30 | char fname[MAXPATHLEN]; 31 | 32 | if (new_tileset != _current_tileset) 33 | { 34 | if (_tileset) 35 | { 36 | delete _tileset; 37 | _current_tileset = -1; 38 | } 39 | 40 | if (RESSCALE == 1) { 41 | sprintf(fname, "Stage/Prt%s.pbm", tileset_names[new_tileset]); 42 | } 43 | else { 44 | sprintf(fname, "Stage/Prt%s.bmp", tileset_names[new_tileset]); 45 | } 46 | 47 | _tileset = Surface::fromFile(ResourceManager::getInstance()->getPath(fname), true); 48 | if (!_tileset) 49 | { 50 | return false; 51 | } 52 | 53 | _current_tileset = new_tileset; 54 | } 55 | 56 | return true; 57 | } 58 | 59 | // draw the given tile from the current tileset to the screen 60 | void Tileset::drawTile(int x, int y, int t) 61 | { 62 | // 16 tiles per row on all tilesheet 63 | int srcx = (t % 16) * TILE_W; 64 | int srcy = (t / 16) * TILE_H; 65 | 66 | Renderer::getInstance()->drawSurface(_tileset, x, y, srcx * RESSCALE, srcy * RESSCALE, TILE_W * RESSCALE, TILE_H * RESSCALE, TILE_W, TILE_H); 67 | } 68 | 69 | void Tileset::reload() 70 | { 71 | if (_current_tileset != -1) 72 | { 73 | int tileset = _current_tileset; 74 | _current_tileset = -1; 75 | load(tileset); 76 | } 77 | } 78 | 79 | }; //namespace Graphics 80 | }; //namespace NXE -------------------------------------------------------------------------------- /src/graphics/tileset.h: -------------------------------------------------------------------------------- 1 | #ifndef _TILESET_H 2 | #define _TILESET_H 3 | 4 | #include "Surface.h" 5 | 6 | #define TILE_W 16 7 | #define TILE_H 16 8 | 9 | namespace NXE 10 | { 11 | namespace Graphics 12 | { 13 | 14 | class Tileset 15 | { 16 | public: 17 | Tileset(); 18 | ~Tileset(); 19 | bool init(); 20 | void close(); 21 | 22 | bool load(int new_tileset); 23 | void reload(); 24 | 25 | void drawTile(int x, int y, int t); 26 | private: 27 | Surface *_tileset = nullptr; 28 | int _current_tileset = -1; 29 | }; 30 | 31 | }; // namespace Graphics 32 | }; // namespace Tileset 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/graphics/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _G_TYPES_H 2 | #define _G_TYPES_H 3 | 4 | #include 5 | #include 6 | 7 | struct NXColor 8 | { 9 | uint8_t r, g, b; 10 | 11 | NXColor() 12 | : r(0) 13 | , g(0) 14 | , b(0) 15 | { 16 | } 17 | 18 | NXColor(uint8_t rr, uint8_t gg, uint8_t bb) 19 | : r(rr) 20 | , g(gg) 21 | , b(bb) 22 | { 23 | } 24 | 25 | NXColor(uint32_t hexcolor) 26 | { 27 | r = hexcolor >> 16; 28 | g = hexcolor >> 8; 29 | b = hexcolor; 30 | } 31 | 32 | inline bool operator==(const NXColor& rhs) const 33 | { 34 | return (this->r == rhs.r && this->g == rhs.g && this->b == rhs.b); 35 | } 36 | 37 | inline bool operator!=(const NXColor& rhs) const 38 | { 39 | return (this->r != rhs.r || this->g != rhs.g || this->b != rhs.b); 40 | } 41 | }; 42 | 43 | typedef SDL_Rect NXRect; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/graphics/zoom.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZOOM_H 2 | #define _ZOOM_H 3 | 4 | #include "SDL.h" 5 | 6 | #include 7 | 8 | SDL_Surface *SDL_ZoomSurface(SDL_Surface *src, double zoom); 9 | 10 | #endif /* _SDL2_rotozoom_h */ -------------------------------------------------------------------------------- /src/i18n/minibidi.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * $Id$ 3 | * 4 | * ------------ 5 | * Description: 6 | * ------------ 7 | * This is an implemention of Unicode's Bidirectional Algorithm 8 | * (known as UAX #9). 9 | * 10 | * http://www.unicode.org/reports/tr9/ 11 | * 12 | * Author: Ahmad Khalifa 13 | * 14 | * ----------------- 15 | * Revision Details: (Updated by Revision Control System) 16 | * ----------------- 17 | * $Date$ 18 | * $Author$ 19 | * $Revision$ 20 | * $Source$ 21 | * 22 | * (www.arabeyes.org - under MIT license) 23 | * 24 | ************************************************************************/ 25 | #include 26 | 27 | #define BLOCKTYPE uint32_t* 28 | #define CHARTYPE uint32_t 29 | #define bidi_char uint32_t 30 | 31 | //int doBidi(BLOCKTYPE line, int count, bool applyShape, bool reorderCombining); 32 | int doBidi(bidi_char* line, int count, bool applyShape, bool reorderCombining); 33 | -------------------------------------------------------------------------------- /src/i18n/translate.cpp: -------------------------------------------------------------------------------- 1 | #include "translate.h" 2 | 3 | #include "../ResourceManager.h" 4 | #include "../common/misc.h" 5 | #include "../Utils/Logger.h" 6 | #include "minibidi.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | I18N::I18N() 13 | : _strings() 14 | { 15 | } 16 | 17 | I18N::~I18N() {} 18 | 19 | bool I18N::load() 20 | { 21 | std::string path = ResourceManager::getInstance()->getPath("system.json"); 22 | std::ifstream fl; 23 | _strings.clear(); 24 | fl.open(widen(path).c_str(), std::ifstream::in | std::ifstream::binary); 25 | if (fl.is_open()) 26 | { 27 | nlohmann::json langfile = nlohmann::json::parse(fl); 28 | 29 | _rtl = langfile.value("rtl", false); 30 | 31 | for (auto it = langfile.begin(); it != langfile.end(); ++it) 32 | { 33 | if (it.key() != "rtl") 34 | { 35 | std::string result = it.value(); 36 | std::vector utf32result; 37 | utf8::utf8to32(result.begin(), result.end(), std::back_inserter(utf32result)); 38 | doBidi(&utf32result[0], utf32result.size(), true, false); 39 | result.clear(); 40 | utf8::utf32to8(utf32result.begin(), utf32result.end(), std::back_inserter(result)); 41 | LOG_DEBUG("{}: {}", it.key(), result); 42 | 43 | _strings[ it.key() ] = std::move(result); 44 | } 45 | } 46 | return true; 47 | } 48 | return false; 49 | } 50 | 51 | const std::string &I18N::translate(const std::string &key) 52 | { 53 | if (_strings.find(key) != _strings.end()) 54 | { 55 | return _strings.at(key); 56 | } 57 | else 58 | { 59 | return key; 60 | } 61 | } 62 | 63 | const bool I18N::isRTL() 64 | { 65 | return _rtl; 66 | } -------------------------------------------------------------------------------- /src/i18n/translate.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSLATE_H_ 2 | #define _TRANSLATE_H_ 3 | 4 | #include 5 | #include 6 | 7 | class I18N 8 | { 9 | public: 10 | I18N(); 11 | ~I18N(); 12 | bool load(); 13 | const std::string &translate(const std::string &key); 14 | const bool isRTL(); 15 | 16 | private: 17 | std::map _strings; 18 | bool _rtl = false; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/input.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INPUT_H 3 | #define _INPUT_H 4 | #include 5 | #include 6 | 7 | typedef struct 8 | { 9 | int32_t key; 10 | int32_t jbut; 11 | int32_t jhat; 12 | int32_t jhat_value; 13 | int32_t jaxis; 14 | int32_t jaxis_value; 15 | } in_action; 16 | 17 | enum INPUTS 18 | { 19 | LEFTKEY, 20 | RIGHTKEY, 21 | UPKEY, 22 | DOWNKEY, 23 | JUMPKEY, 24 | FIREKEY, 25 | STRAFEKEY, 26 | PREVWPNKEY, 27 | NEXTWPNKEY, 28 | INVENTORYKEY, 29 | MAPSYSTEMKEY, 30 | 31 | ESCKEY, 32 | F1KEY, 33 | F2KEY, 34 | F3KEY, 35 | F4KEY, 36 | F5KEY, 37 | F6KEY, 38 | F7KEY, 39 | F8KEY, 40 | F9KEY, 41 | F10KEY, 42 | F11KEY, 43 | F12KEY, 44 | 45 | FREEZE_FRAME_KEY, 46 | FRAME_ADVANCE_KEY, 47 | DEBUG_FLY_KEY, 48 | ENTERKEY, 49 | 50 | INPUT_COUNT 51 | }; 52 | 53 | #define LASTCONTROLKEY MAPSYSTEMKEY 54 | 55 | #define DEBUG_GOD_KEY F1KEY 56 | #define DEBUG_MOVE_KEY F2KEY 57 | #define DEBUG_SAVE_KEY F4KEY 58 | #define FFWDKEY F5KEY 59 | 60 | extern bool inputs[INPUT_COUNT]; 61 | extern bool lastinputs[INPUT_COUNT]; 62 | extern in_action last_sdl_action; 63 | extern SDL_Joystick *joy; 64 | extern int ACCEPT_BUTTON; 65 | extern int DECLINE_BUTTON; 66 | 67 | bool input_init(void); 68 | void input_remap(int keyindex, in_action sdl_key); 69 | in_action input_get_mapping(int keyindex); 70 | const std::string input_get_name(int index); 71 | void input_set_mappings(in_action *array); 72 | void input_poll(void); 73 | void input_close(void); 74 | bool buttondown(void); 75 | bool buttonjustpushed(void); 76 | bool justpushed(int k); 77 | void rumble(float str, uint32_t len); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/intro/intro.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INTRO_H 3 | #define _INTRO_H 4 | 5 | bool intro_init(int param); 6 | void intro_tick(); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/intro/title.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TITLE_H 3 | #define _TITLE_H 4 | 5 | bool title_init(int param); 6 | void title_tick(); 7 | 8 | extern char Multiplayer; 9 | extern char IPAddress[128]; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/inventory.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _INVENTORY_H 3 | #define _INVENTORY_H 4 | 5 | #include "sound/SoundManager.h" 6 | 7 | #define MAXLISTLEN 100 8 | 9 | struct stSelector 10 | { 11 | uint8_t flashstate, animtimer; 12 | 13 | int spacing_x, spacing_y; 14 | int cursel, lastsel; 15 | int sprite; 16 | int nitems; 17 | NXE::Sound::SFX sound; 18 | int rowlen; 19 | 20 | int scriptbase; 21 | int items[MAXLISTLEN]; 22 | }; 23 | 24 | struct stInventory 25 | { 26 | int x, y, w, h; 27 | 28 | stSelector armssel; 29 | stSelector itemsel; 30 | stSelector *curselector; 31 | 32 | char lockinput; 33 | }; 34 | 35 | bool inventory_init(int param); 36 | void inventory_tick(void); 37 | int RefreshInventoryScreen(void); 38 | void UnlockInventoryInput(void); 39 | void DrawInventory(void); 40 | 41 | enum INVENTORY 42 | { 43 | ITEM_ARTHURS_KEY = 1, 44 | ITEM_MAP_SYSTEM, 45 | ITEM_STANTAS_KEY, 46 | ITEM_SILVER_LOCKET, 47 | ITEM_BEAST_FANG, 48 | ITEM_LIFE_CAPSULE, 49 | ITEM_ID_CARD, 50 | ITEM_JELLYFISH_JUICE, 51 | ITEM_RUSTY_KEY, 52 | ITEM_GUM_KEY, 53 | ITEM_GUM_BASE, 54 | ITEM_CHARCOAL, 55 | ITEM_EXPLOSIVE, 56 | ITEM_PUPPY, 57 | ITEM_LIFE_POT, 58 | ITEM_CUREALL, 59 | ITEM_CLINIC_KEY, 60 | ITEM_BOOSTER08, 61 | ITEM_ARMS_BARRIER, 62 | ITEM_TURBOCHARGE, 63 | ITEM_AIRTANK, 64 | ITEM_COUNTER, 65 | ITEM_BOOSTER20, 66 | ITEM_MIMIGA_MASK, 67 | ITEM_TELEPORTER_KEY, 68 | ITEM_SUES_LETTER, 69 | ITEM_CONTROLLER, 70 | ITEM_BROKEN_SPRINKLER, 71 | ITEM_SPRINKLER, 72 | ITEM_TOW_ROPE, 73 | ITEM_CLAY_FIGURE_MEDAL, 74 | ITEM_LITTLE_MAN, 75 | ITEM_MUSHROOM_BADGE, 76 | ITEM_MA_PIGNON, 77 | ITEM_CURLYS_UNDERWEAR, 78 | ITEM_ALIEN_MEDAL, 79 | ITEM_CHACOS_LIPSTICK, 80 | ITEM_WHIMSICAL_STAR, 81 | ITEM_IRON_BOND 82 | }; 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/ipfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int inet_pton_clone(const int family, char *instring, unsigned long *addr) { 4 | unsigned char ip[4]; 5 | char ipnum[4]; 6 | 7 | unsigned char i = 0; 8 | unsigned char i2 = 0; 9 | unsigned char i3 = 0; 10 | ipnum[3] = 0; 11 | while (i2 < 4) { 12 | i3 = 0; 13 | while (instring[i] != 0x2E && instring[i] != 0) { 14 | ipnum[i3] = instring[i]; 15 | i3++; 16 | i++; 17 | } 18 | i++; 19 | ipnum[i3] = 0; 20 | ip[i2] = atoi(ipnum); 21 | i2++; 22 | } 23 | int *retval = (int*)(ip); 24 | addr[0] = *retval; 25 | return *retval; 26 | } 27 | 28 | char* inet_ntop_clone(const int family, IN_ADDR* addr, char *stringbuff, int stringbuffsize) { 29 | unsigned char* addr2 = (unsigned char*)&addr; 30 | sprintf(stringbuff, "%i.%i.%i.%i", addr2[0], addr2[1], addr2[2], addr2[3]); 31 | return stringbuff; 32 | } 33 | -------------------------------------------------------------------------------- /src/ipfuncs.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef inet_pton 3 | #ifndef inet_ntop 4 | int inet_pton_clone(const int family, char *instring, unsigned long *addr); 5 | char* inet_ntop_clone(const int family, IN_ADDR* addr, char *stringbuff, int stringbuffsize); 6 | 7 | #define inet_pton inet_pton_clone 8 | #define inet_ntop inet_ntop_clone 9 | #define InetPtonA inet_pton_clone 10 | #define InetNtopA inet_ntop_clone 11 | #endif 12 | #endif -------------------------------------------------------------------------------- /src/map_system.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAPSYSTEM_H 2 | #define _MAPSYSTEM_H 3 | 4 | bool ms_init(int param); 5 | void ms_tick(void); 6 | void ms_close(void); 7 | void ms_draw(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/maprecord.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MAPRECORD_H 3 | #define _MAPRECORD_H 4 | 5 | #include 6 | 7 | #define MAX_STAGES 120 8 | struct MapRecord 9 | { 10 | char filename[32]; 11 | char stagename[35]; 12 | 13 | uint8_t tileset; 14 | uint8_t bg_no; 15 | uint8_t scroll_type; 16 | uint8_t bossNo; 17 | uint8_t NPCset1; 18 | uint8_t NPCset2; 19 | }; 20 | extern MapRecord stages[MAX_STAGES]; 21 | extern int num_stages; 22 | 23 | #define STAGE_SAND 10 24 | #define STAGE_START_POINT 13 25 | #define STAGE_IRONH 31 26 | #define STAGE_BOULDER_CHAMBER 44 27 | #define STAGE_MAZE_M 45 28 | #define STAGE_ALMOND 47 29 | #define STAGE_WATERWAY 48 30 | #define STAGE_KINGS_TABLE 65 31 | #define STAGE_HELL1 80 32 | #define STAGE_HELL2 81 33 | #define STAGE_HELL3 82 34 | #define STAGE_HELL4 84 35 | #define STAGE_HELL42 85 36 | #define STAGE_STATUE_CHAMBER 86 37 | #define STAGE_SEAL_CHAMBER 87 38 | #define STAGE_SEAL_CHAMBER_2 92 39 | #define STAGE_CORRIDOR 88 40 | #define STAGE_KINGS 72 // intro 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/niku.h: -------------------------------------------------------------------------------- 1 | #ifndef __NIKU_H_ 2 | #define __NIKU_H_ 3 | #include 4 | 5 | uint32_t niku_load(); 6 | bool niku_save(uint32_t value); 7 | 8 | #endif -------------------------------------------------------------------------------- /src/nx.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _NX_H 3 | #define _NX_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | //#include 10 | #include "common/basics.h" 11 | #include "config.h" 12 | #include "version.h" 13 | 14 | #include 15 | 16 | //#define CSF 9 17 | // eh, okay. this is scale for sub-pixel movement. original nxengine used this and bitshifts 18 | // guess it's short for common scale factor 19 | // but, there were many places, where negative values were shifted. And guess what: modern compilers can optimize 20 | // mul/sub so, we are using mul/div directly. for readability and no UB 21 | #define CSFI 512 22 | 23 | const char *strhex(int value); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/pause/dialog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DIALOG_H 3 | #define _DIALOG_H 4 | 5 | #include "options.h" 6 | 7 | #include 8 | namespace Options 9 | { 10 | 11 | struct ODItem; 12 | 13 | enum OD_TYPES 14 | { 15 | OD_ACTIVATED, 16 | OD_SEPARATOR, 17 | OD_DISMISS, 18 | OD_CHOICE, 19 | OD_DISABLED, 20 | }; 21 | 22 | class Dialog : public FocusHolder 23 | { 24 | public: 25 | Dialog(); 26 | ~Dialog(); 27 | 28 | int DLG_X; 29 | int DLG_Y; 30 | int DLG_W; 31 | int DLG_H; 32 | 33 | ODItem *AddItem(const char *text, void (*activate)(ODItem *, int) = NULL, void (*update)(ODItem *) = NULL, 34 | int id = -1, int type = OD_ACTIVATED); 35 | ODItem *AddSeparator(); 36 | ODItem *AddDisabledItem(const char *text); 37 | ODItem *AddDismissalItem(const char *text = NULL); 38 | 39 | void Draw(); 40 | void RunInput(); 41 | void Dismiss(); 42 | void Clear(); 43 | void Refresh(); 44 | 45 | void UpdateSizePos(); 46 | void SetSize(int w, int h); 47 | void offset(int xd, int yd); 48 | 49 | void SetSelection(int sel); 50 | unsigned int GetSelection() 51 | { 52 | return fCurSel; 53 | } 54 | void ShowFull() 55 | { 56 | fNumShown = 99; 57 | } 58 | 59 | void (*onclear)(); 60 | void (*ondismiss)(); 61 | std::vector &Items(); 62 | 63 | private: 64 | void DrawItem(int x, int y, ODItem *item); 65 | 66 | int fCurSel; 67 | unsigned int fNumShown; // for text-draw animation on entry 68 | int fRepeatTimer; 69 | std::vector fItems; 70 | 71 | struct 72 | { 73 | int x, y, w, h; 74 | } fCoords; 75 | int fTextX; 76 | }; 77 | 78 | struct ODItem 79 | { 80 | char text[100]; 81 | char suffix[32]; 82 | char righttext[64]; 83 | char raligntext[32]; 84 | int type, id; 85 | 86 | void (*update)(ODItem *item); 87 | void (*activate)(ODItem *item, int dir); 88 | }; 89 | 90 | } // namespace Options 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/pause/message.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MESSAGE_H 3 | #define _MESSAGE_H 4 | 5 | #include "../input.h" 6 | #include "options.h" 7 | 8 | #include 9 | namespace Options 10 | { 11 | 12 | class Message : public FocusHolder 13 | { 14 | public: 15 | Message(const std::string &msg, const std::string &msg2 = ""); 16 | ~Message(); 17 | 18 | void Draw(); 19 | void RunInput(); 20 | 21 | in_action *rawKeyReturn; 22 | void (*on_dismiss)(Message *msg); 23 | 24 | private: 25 | std::string fMsg, fMsg2; 26 | int fMsgX, fMsgY; 27 | int fMsg2X, fMsg2Y; 28 | 29 | int fShowDelay; 30 | int MESSAGE_X, MESSAGE_Y; 31 | }; 32 | 33 | } // namespace Options 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/pause/mods.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "pause.h" 3 | 4 | #include "../autogen/sprites.h" 5 | #include "../game.h" 6 | #include "../map.h" 7 | #include "../graphics/Renderer.h" 8 | #include "../input.h" 9 | #include "../nx.h" 10 | #include "../ResourceManager.h" 11 | 12 | using namespace NXE::Graphics; 13 | 14 | #include "dialog.h" 15 | using namespace Options; 16 | 17 | Dialog *moddlg; 18 | std::vector _mods; 19 | extern std::vector optionstack; 20 | 21 | void _mod_run(ODItem *item, int dir) 22 | { 23 | ResourceManager::getInstance()->setMod(_mods.at(item->id)); 24 | game.tsc->Close(); 25 | load_stages(); 26 | game.tsc->Init(); 27 | game.reset(); 28 | } 29 | 30 | void _mod_reset(ODItem *item, int dir) 31 | { 32 | ResourceManager::getInstance()->setMod(""); 33 | game.tsc->Close(); 34 | load_stages(); 35 | game.tsc->Init(); 36 | game.reset(); 37 | } 38 | 39 | void _mod_return(ODItem *item, int dir) 40 | { 41 | game.pause(false); 42 | } 43 | 44 | bool mods_init(int param) 45 | { 46 | memset(lastinputs, 1, sizeof(lastinputs)); 47 | moddlg = new Dialog(); 48 | moddlg->AddItem("Original game", _mod_reset); 49 | int i = 0; 50 | for (auto &kv: ResourceManager::getInstance()->mods()) 51 | { 52 | moddlg->AddItem(kv.second.name.c_str(), _mod_run, NULL, i); 53 | _mods.push_back(kv.second.dir); 54 | i++; 55 | } 56 | 57 | moddlg->AddSeparator(); 58 | moddlg->AddItem("Return", _mod_return); 59 | moddlg->SetSelection(0); 60 | moddlg->ShowFull(); 61 | int maxsize = 0; 62 | for (auto &item : moddlg->Items()) 63 | { 64 | int x = Renderer::getInstance()->font.getWidth(_(item->text)); 65 | if (x > maxsize) 66 | maxsize = x; 67 | } 68 | // moddlg->SetSize(maxsize + 60, 70); 69 | return 0; 70 | } 71 | 72 | void mods_tick() 73 | { 74 | if (moddlg != NULL) { 75 | Renderer::getInstance()->clearScreen(BLACK); 76 | moddlg->Draw(); 77 | moddlg->RunInput(); 78 | } 79 | } 80 | 81 | void mods_close() 82 | { 83 | optionstack.clear(); 84 | delete moddlg; 85 | moddlg = NULL; 86 | } -------------------------------------------------------------------------------- /src/pause/mods.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MODS_H 3 | #define _MODS_H 4 | 5 | bool mods_init(int retmode); 6 | void mods_tick(void); 7 | void mods_close(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/pause/objects.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBJECTS_H_ 2 | #define __OBJECTS_H_ 3 | 4 | #include "../object.h" 5 | 6 | static void ai_oc_controller(Object *o); 7 | static void ai_oc_quote(Object *o); 8 | static void ai_oc_ikachan(Object *o); 9 | 10 | #endif -------------------------------------------------------------------------------- /src/pause/options.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OPTIONS_H 3 | #define _OPTIONS_H 4 | #include "../object.h" 5 | 6 | namespace Options 7 | { 8 | // class for something like a dialog box that can hold the focus. 9 | // there is a stack of them. everyone in the stack is drawn, 10 | // and the topmost one receives HandleKey events. 11 | class FocusHolder 12 | { 13 | public: 14 | virtual ~FocusHolder() {} 15 | 16 | virtual void Draw() = 0; 17 | virtual void RunInput() = 0; 18 | }; 19 | 20 | void init_objects(); 21 | void close_objects(); 22 | void run_and_draw_objects(void); 23 | Object *create_object(int x, int y, int type); 24 | 25 | }; // namespace Options 26 | 27 | bool options_init(int param); 28 | void options_tick(void); 29 | void options_close(void); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/pause/pause.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "pause.h" 3 | 4 | #include "../autogen/sprites.h" 5 | #include "../game.h" 6 | #include "../graphics/Renderer.h" 7 | #include "../input.h" 8 | #include "../nx.h" 9 | #include "../screeneffect.h" 10 | #include "../endgame/credits.h" 11 | #include "../endgame/island.h" 12 | #include "../inventory.h" 13 | #include "../map_system.h" 14 | using namespace NXE::Graphics; 15 | #include "dialog.h" 16 | using namespace Options; 17 | 18 | Dialog *dlg; 19 | unsigned int mm_cursel; 20 | 21 | void _resume(ODItem *item, int dir) 22 | { 23 | lastinputs[F1KEY] = true; 24 | game.pause(false); 25 | delete dlg; 26 | dlg = nullptr; 27 | } 28 | 29 | void _options(ODItem *item, int dir) 30 | { 31 | game.pause(GP_OPTIONS); 32 | } 33 | 34 | void _reset(ODItem *item, int dir) 35 | { 36 | lastinputs[F2KEY] = true; 37 | game.reset(); 38 | delete dlg; 39 | dlg = nullptr; 40 | } 41 | 42 | void _exit(ODItem *item, int dir) 43 | { 44 | lastinputs[ESCKEY] = true; 45 | game.running = false; 46 | } 47 | 48 | bool pause_init(int param) 49 | { 50 | memset(lastinputs, 1, sizeof(lastinputs)); 51 | dlg = new Dialog(); 52 | dlg->AddItem("Resume", _resume); 53 | dlg->AddItem("Options", _options); 54 | dlg->AddItem("Reset", _reset); 55 | dlg->AddItem("Quit", _exit); 56 | dlg->SetSelection(mm_cursel); 57 | dlg->ShowFull(); 58 | int maxsize = 0; 59 | for (auto &item : dlg->Items()) 60 | { 61 | int x = Renderer::getInstance()->font.getWidth(_(item->text)); 62 | if (x > maxsize) 63 | maxsize = x; 64 | } 65 | dlg->SetSize(maxsize + 60, 70); 66 | return 0; 67 | } 68 | 69 | void pause_tick() 70 | { 71 | if (dlg == nullptr) return; 72 | DrawScene(); 73 | if (game.mode == GM_NORMAL) 74 | DrawStatusBar(); 75 | if (game.mode == GM_INVENTORY) 76 | DrawInventory(); 77 | if (game.mode == GM_MAP_SYSTEM) 78 | ms_draw(); 79 | 80 | fade.Draw(); 81 | 82 | textbox.Draw(); 83 | 84 | if (game.mode == GM_CREDITS) 85 | { 86 | credit_draw(); 87 | } 88 | 89 | if (game.mode == GM_ISLAND) 90 | { 91 | island_draw(); 92 | } 93 | 94 | Renderer::getInstance()->tintScreen(); 95 | 96 | dlg->RunInput(); 97 | if (dlg == nullptr) return; 98 | dlg->Draw(); 99 | 100 | if (justpushed(ESCKEY)) 101 | { 102 | _resume(NULL, 0); 103 | return; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/pause/pause.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PAUSE_H 3 | #define _PAUSE_H 4 | 5 | bool pause_init(int retmode); 6 | void pause_tick(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/playerstats.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLAYERSTATS_H_ 2 | #define __PLAYERSTATS_H_ 3 | 4 | void AddHealth(int hp); 5 | void AddXP(int xp, bool quiet = false); 6 | void SubXP(int xp, bool quiet = false); 7 | void AddInventory(int item); 8 | void DelInventory(int item); 9 | int FindInventory(int item); 10 | int CheckInventoryList(int item, int *list, int nitems); 11 | void GetWeapon(int wpn, int ammo); 12 | void LoseWeapon(int wpn); 13 | void TradeWeapon(int oldwpn, int newwpn, int ammo); 14 | void AddAmmo(int wpn, int ammo); 15 | void RefillAllAmmo(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/profile.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PROFILE_H 3 | #define _PROFILE_H 4 | #include "game.h" 5 | #include "p_arms.h" 6 | #include "player.h" 7 | #include 8 | 9 | // how many bytes of data long a profile.dat is. 10 | #define PROFILE_LENGTH 0x604 11 | 12 | struct Profile 13 | { 14 | int stage = 0; 15 | int songno = 0; 16 | int px, py, pdir = 0; 17 | int hp, maxhp, num_whimstars = 0; 18 | uint32_t equipmask = 0; 19 | 20 | int curWeapon = 0; 21 | struct 22 | { 23 | bool hasWeapon = false; 24 | int level = 0; 25 | int xp = 0; 26 | int ammo, maxammo = 0; 27 | } weapons[WPN_COUNT]; 28 | 29 | std::vector wpnOrder = {}; 30 | 31 | int inventory[MAX_INVENTORY] = { 0 }; 32 | int ninventory = 0; 33 | 34 | bool flags[NUM_GAMEFLAGS] = { false }; 35 | 36 | struct 37 | { 38 | int slotno = 0; 39 | int scriptno = 0; 40 | } teleslots[NUM_TELEPORTER_SLOTS]; 41 | int num_teleslots = 0; 42 | }; 43 | 44 | bool profile_load(const char *pfname, Profile *file); 45 | bool profile_save(const char *pfname, Profile *file); 46 | char *GetProfileName(int num); 47 | bool ProfileExists(int num); 48 | bool AnyProfileExists(); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/screeneffect.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SCREENEFFECT_H 3 | #define _SCREENEFFECT_H 4 | #include "autogen/sprites.h" 5 | 6 | // screeneffects are a simple draw overlay used w/ things such as flashes and such. 7 | class ScreenEffect 8 | { 9 | public: 10 | ScreenEffect() 11 | { 12 | enabled = false; 13 | } 14 | virtual ~ScreenEffect() {} 15 | virtual void Draw() = 0; 16 | 17 | bool enabled; 18 | 19 | protected: 20 | int state; 21 | int timer; 22 | }; 23 | 24 | // FlashScreen simply flashes the screen white several times, 25 | // and is used in various places such as when Misery casts spells. 26 | struct SE_FlashScreen : public ScreenEffect 27 | { 28 | void Start(); 29 | void Draw(); 30 | 31 | int flashes_left; 32 | bool flashstate; 33 | }; 34 | 35 | // Starflash is a full-screen white explosion in the shape of a '+', 36 | // used when some bosses are defeated. 37 | struct SE_Starflash : public ScreenEffect 38 | { 39 | void Start(int x, int y); 40 | void Draw(); 41 | 42 | int centerx, centery; 43 | int size, speed; 44 | }; 45 | 46 | // Fade is the fade-in/out used on every stage transistion/TRA. 47 | struct SE_Fade : public ScreenEffect 48 | { 49 | SE_Fade(); 50 | 51 | void Start(int fadedir, int dir, int spr = SPR_FADE_DIAMOND); 52 | void Draw(void); 53 | void set_full(int dir); 54 | int getstate(void); 55 | 56 | struct 57 | { 58 | int fadedir; 59 | int sweepdir; 60 | int curframe; 61 | int sprite; 62 | } fade; 63 | }; 64 | 65 | #define FADE_IN 0 66 | #define FADE_OUT 1 67 | 68 | // these directions correspond to the FAI/FAO parameters. 69 | #define FADE_LEFT 0 70 | #define FADE_UP 1 71 | #define FADE_RIGHT 2 72 | #define FADE_DOWN 3 73 | #define FADE_CENTER 4 74 | 75 | #define FS_NO_FADE 0 // no fade is active 76 | #define FS_FADING 1 // currently fading in or out 77 | #define FS_FADED_OUT 2 // completely faded out 78 | 79 | namespace ScreenEffects 80 | { 81 | void Draw(void); 82 | void Stop(); 83 | }; // namespace ScreenEffects 84 | 85 | extern SE_FlashScreen flashscreen; 86 | extern SE_Starflash starflash; 87 | extern SE_Fade fade; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/settings.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SETTINGS_H 3 | #define _SETTINGS_H 4 | 5 | #include "input.h" 6 | 7 | struct Settings 8 | { 9 | uint32_t version; 10 | int resolution; 11 | int last_save_slot; 12 | bool show_fps; 13 | bool fullscreen; 14 | 15 | bool sound_enabled; 16 | int music_enabled; 17 | uint8_t new_music; 18 | 19 | bool skip_intro; 20 | bool rumble; 21 | bool strafing; 22 | bool animated_facepics; 23 | bool lights; 24 | bool control_scheme; 25 | int16_t sfx_volume; 26 | int16_t music_volume; 27 | int8_t music_interpolation; 28 | 29 | in_action input_mappings[INPUT_COUNT]; 30 | char language[256]; 31 | }; 32 | 33 | bool settings_load(Settings *settings = NULL); 34 | bool settings_save(Settings *settings = NULL); 35 | 36 | extern Settings *settings; 37 | extern Settings normal_settings; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/siflib/sectSprites.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SECT_SPRITES_H 3 | #define _SECT_SPRITES_H 4 | 5 | // this decodes and encodes the main sprites[] array of SIFSprite structures. 6 | 7 | #include "sif.h" 8 | 9 | class SIFSpritesSect 10 | { 11 | public: 12 | // get how many sprites are in the file. You can call this first if you need 13 | // to know how big to make the array. 14 | static int GetSpriteCount(const uint8_t *data, int datalen); 15 | 16 | // decode from a SIF_SECTION_SPRITES and use the resultant data to fill in 17 | // an array of SIFSprite structures pointed to by sprites. 18 | static bool Decode(const uint8_t *data, int datalen, SIFSprite *sprites, int *nsprites_out, int maxsprites); 19 | 20 | private: 21 | static void LoadRect(SIFRect *rect, const uint8_t **data, const uint8_t *data_end); 22 | static void LoadPoint(SIFPoint *pt, const uint8_t **data, const uint8_t *data_end); 23 | static void LoadPointRaw(SIFPoint *pt, const uint8_t **data, const uint8_t *data_end); 24 | static void LoadPointList(SIFPointList *lst, const uint8_t **data, const uint8_t *data_end); 25 | static bool LoadFrame(SIFFrame *frame, int ndirs, const uint8_t **data, const uint8_t *data_end); 26 | }; 27 | 28 | // field types within SIFDir which are optional 29 | enum 30 | { 31 | S_DIR_END, // ends section list 32 | 33 | S_DIR_DRAW_POINT, // default is [0,0] 34 | S_DIR_ACTION_POINT, // default is [0,0] 35 | S_DIR_ACTION_POINT_2, // default is [0,0] 36 | S_DIR_PF_BBOX // default is no per-frame bbox, or rather [0,0]-[0,0] 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/siflib/sectStringArray.cpp: -------------------------------------------------------------------------------- 1 | #include "sectStringArray.h" 2 | 3 | #include "../common/bufio.h" 4 | #include "../Utils/Logger.h" 5 | 6 | // decode the raw section data into the given tringList object 7 | bool SIFStringArraySect::Decode(const uint8_t *data, int datalen, std::vector *out) 8 | { 9 | const uint8_t *data_end = data + (datalen - 1); 10 | int i, nstrings; 11 | 12 | nstrings = read_U16(&data, data_end); 13 | for (i = 0; i < nstrings; i++) 14 | { 15 | if (data > data_end) 16 | { 17 | LOG_ERROR("SIFStringArraySect::Decode: section corrupt: overran end of data"); 18 | return 1; 19 | } 20 | 21 | std::string string; 22 | ReadPascalString(&data, data_end, &string); 23 | 24 | out->push_back(std::string(string.c_str())); 25 | } 26 | 27 | return 0; 28 | } 29 | 30 | void SIFStringArraySect::ReadPascalString(const uint8_t **data, const uint8_t *data_end, std::string *out) 31 | { 32 | int len = read_U8(data, data_end); 33 | if (len == 255) 34 | len = read_U16(data, data_end); 35 | 36 | out->clear(); 37 | for (int i = 0; i < len; i++) 38 | { 39 | *out += read_U8(data, data_end); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/siflib/sectStringArray.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SECT_STRINGARRAY_H 3 | #define _SECT_STRINGARRAY_H 4 | #include 5 | #include 6 | #include 7 | 8 | // the SectStringArray handler decodes sif sections which consist of an array 9 | // of pascal strings. This includes SIF_SECTION_SHEETS and SIF_SECTION_DIRECTORY. 10 | 11 | class SIFStringArraySect 12 | { 13 | public: 14 | static bool Decode(const uint8_t *data, int datalen, std::vector *out); 15 | static void ReadPascalString(const uint8_t **data, const uint8_t *data_end, std::string *out); 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/slope.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SLOPE_H 3 | #define _SLOPE_H 4 | #include "graphics/Tileset.h" 5 | #include "object.h" 6 | #include "siflib/sif.h" 7 | 8 | // slope types 9 | #define SLOPE_CEIL_FWD1 1 10 | #define SLOPE_CEIL_FWD2 2 11 | #define SLOPE_CEIL_BACK1 3 12 | #define SLOPE_CEIL_BACK2 4 13 | 14 | #define SLOPE_BACK1 5 15 | #define SLOPE_BACK2 6 16 | #define SLOPE_FWD1 7 17 | #define SLOPE_FWD2 8 18 | 19 | #define SLOPE_LAST 8 20 | 21 | struct SlopeTable 22 | { 23 | uint8_t table[TILE_W][TILE_H]; 24 | }; 25 | bool initslopetable(void); 26 | uint8_t ReadSlopeTable(int x, int y); 27 | bool IsSlopeAtPointList(Object *o, SIFPointList *points); 28 | int CheckStandOnSlope(Object *o); 29 | int CheckBoppedHeadOnSlope(Object *o); 30 | bool movehandleslope(Object *o, int xinertia); 31 | void DrawSlopeTablesOnTiles(); 32 | void DrawSlopeTableOnTile(int table, int tile); 33 | void dumpslopetable(int t); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/sound/Ogg.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OGG11_H 3 | #define _OGG11_H 4 | 5 | #include "../Singleton.h" 6 | 7 | #include 8 | #include 9 | 10 | typedef void (*music_finished_cb)(void); 11 | 12 | namespace NXE 13 | { 14 | namespace Sound 15 | { 16 | 17 | struct oggSong 18 | { 19 | Mix_Music *intro = nullptr; 20 | Mix_Music *loop = nullptr; 21 | bool playing = false; 22 | int volume = 75; 23 | 24 | bool fading = false; 25 | uint32_t last_fade_time = 0; 26 | uint32_t last_pos = 0; 27 | bool doloop = false; 28 | }; 29 | 30 | class Ogg 31 | { 32 | public: 33 | static Ogg *getInstance(); 34 | 35 | protected: 36 | friend class Singleton; 37 | 38 | Ogg(); 39 | ~Ogg(); 40 | Ogg(const Ogg &) = delete; 41 | Ogg &operator=(const Ogg &) = delete; 42 | 43 | public: 44 | bool load(const std::string &fname, const std::string &dir, bool doloop); 45 | bool start(const std::string &fname, const std::string &dir, int startbeat, bool loop, bool doloop); 46 | uint32_t stop(void); 47 | bool isPlaying(void); 48 | void fade(void); 49 | void setVolume(int newvolume); 50 | void runFade(void); 51 | void pause(); 52 | void resume(); 53 | void musicFinished(); 54 | bool looped(); 55 | void updateVolume(); 56 | 57 | private: 58 | oggSong _song; 59 | bool _do_loop = false; 60 | bool _looped = false; 61 | }; 62 | 63 | }; // namespace Sound 64 | }; // namespace NXE 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/stageboss.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGEBOSS_H 3 | #define _STAGEBOSS_H 4 | 5 | #include "object.h" 6 | 7 | // Stage Bosses are "big" boss enemies used in some stages. 8 | // 9 | // The stage boss class runs at a conceptual level "above" 10 | // normal AI routines, more like at the level of the game loop. 11 | // 12 | // This gives these complex bosses a good way to control more 13 | // things than just a single object (some bosses for example have 14 | // multiple parts which need to be coordinated, such as Omega). 15 | // 16 | // A pointer to the "main" object of a stage boss is stored by 17 | // the derived class at game.stageboss.object. 18 | // 19 | // The script command 5 | 6 | const char *backdrop_names[] = {"bk0", "bkBlue", "bkGreen", "bkBlack", "bkGard", "bkMaze", "bkGray", "bkRed", 7 | "bkWater", "bkMoon", "bkFog", "bkFall", "bkLight", "bkSunset", "bkHellish", NULL}; 8 | 9 | const char *tileset_names[] 10 | = {"0", "Pens", "Eggs", "EggX", "EggIn", "Store", "Weed", "Barr", "Maze", "Sand", "Mimi", "Cave", 11 | "River", "Gard", "Almond", "Oside", "Cent", "Jail", "White", "Fall", "Hell", "Labo", NULL}; 12 | -------------------------------------------------------------------------------- /src/stagedata.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STAGEDATA_H 3 | #define _STAGEDATA_H 4 | 5 | //#define NMAPS 120 6 | // extern MapRecord stages[NMAPS]; 7 | 8 | #define NUM_BACKDROPS 12 9 | #define NUM_TILESETS 22 10 | 11 | extern const char *backdrop_names[]; 12 | extern const char *tileset_names[]; 13 | 14 | #define NPCSET_GUEST 0 15 | #define NPCSET_0 1 16 | #define NPCSET_EGGS1 2 17 | #define NPCSET_RAVIL 3 18 | #define NPCSET_WEED 4 19 | #define NPCSET_MAZE 5 20 | #define NPCSET_SAND 6 21 | #define NPCSET_OMG 7 22 | #define NPCSET_CEMET 8 23 | #define NPCSET_BLLG 9 24 | #define NPCSET_PLANT 10 25 | #define NPCSET_FROG 11 26 | #define NPCSET_CURLY 12 27 | #define NPCSET_STREAM 13 28 | #define NPCSET_IRONH 14 29 | #define NPCSET_TORO 15 30 | #define NPCSET_X 16 31 | #define NPCSET_DARK 17 32 | #define NPCSET_ALMO1 18 33 | #define NPCSET_EGGS2 19 34 | #define NPCSET_TWIND 20 35 | #define NPCSET_MOON 21 36 | #define NPCSET_CENT 22 37 | #define NPCSET_HERI 23 38 | #define NPCSET_RED 24 39 | #define NPCSET_MIZA 25 40 | #define NPCSET_DR 26 41 | #define NPCSET_ALMO2 27 42 | #define NPCSET_KINGS 28 43 | #define NPCSET_HELL 29 44 | #define NPCSET_PRESS 30 45 | #define NPCSET_PRIEST 31 46 | #define NPCSET_BALLOS 32 47 | #define NPCSET_ISLAND 33 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/statusbar.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _STATUSBAR_H 3 | #define _STATUSBAR_H 4 | 5 | struct PercentBar 6 | { 7 | int displayed_value; 8 | int dectimer; 9 | }; 10 | 11 | struct StatusBar 12 | { 13 | int xpflashcount; 14 | int xpflashstate; 15 | }; 16 | 17 | extern StatusBar statusbar; 18 | void niku_draw(int value, bool force_white = false); 19 | 20 | void stat_PrevWeapon(bool quiet = false); 21 | void stat_NextWeapon(bool quiet = false); 22 | 23 | bool statusbar_init(void); 24 | void DrawStatusBar(void); 25 | void DrawAirLeft(int x, int y); 26 | void DrawWeaponAmmo(int x, int y, int wpn); 27 | void DrawWeaponLevel(int x, int y, int wpn); 28 | void weapon_slide(int dir, int newwpn); 29 | void weapon_introslide(); 30 | void InitPercentBar(PercentBar *bar, int starting_value); 31 | void RunPercentBar(PercentBar *bar, int current_value); 32 | void DrawPercentBar(PercentBar *bar, int x, int y, int curvalue, int maxvalue, int width); 33 | void DrawNumber(int x, int y, int num); 34 | void DrawPercentage(int x, int y, int fill_sprite, int fsframe, int curvalue, int maxvalue, int width_at_max); 35 | void DrawNumberRAlign(int x, int y, int s, int num); 36 | void DrawTwoDigitNumber(int x, int y, int num); 37 | void DrawDigit(int x, int y, int digit); 38 | void niku_run(); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/trig.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRIG_H_ 2 | #define __TRIG_H_ 3 | 4 | #include "object.h" 5 | 6 | #include 7 | extern signed int sin_table[256]; 8 | char trig_init(void); 9 | void vector_from_angle(uint8_t angle, int speed, int *xs, int *ys); 10 | int xinertia_from_angle(uint8_t angle, int speed); 11 | int yinertia_from_angle(uint8_t angle, int speed); 12 | uint8_t GetAngle(int curx, int cury, int tgtx, int tgty); 13 | void EmFireAngledShot(Object *o, int objtype, int rand_variance, int speed); 14 | void ThrowObjectAtPlayer(Object *o, int rand_variance, int speed); 15 | void ThrowObject(Object *o, int destx, int desty, int rand_variance, int speed); 16 | void ThrowObjectAtAngle(Object *o, uint8_t angle, int speed); 17 | 18 | #endif -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef __VERSION_H_ 2 | #define __VERSION_H_ 3 | 4 | #define NXVERSION "NXEngine-evo 2.6.5" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /travis/linux.install.sh: -------------------------------------------------------------------------------- 1 | # sdl2 2 | sudo add-apt-repository ppa:zoogie/sdl2-snapshots -y 3 | # gcc 4 | [[ -z "${INSTALLGCC}" ]] || sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y 5 | 6 | sudo apt-get update -qq 7 | sudo apt-get install -qq libsdl2-dev 8 | sudo apt-get install -qq libsdl2-mixer-dev 9 | sudo apt-get install -qq libpng-dev 10 | [[ -z "${INSTALLGCC}" ]] || sudo apt-get install -qq g++-6 11 | -------------------------------------------------------------------------------- /travis/osx.install.sh: -------------------------------------------------------------------------------- 1 | brew update 2 | brew install sdl2 3 | brew install sdl2_mixer 4 | #brew install libpng 5 | -------------------------------------------------------------------------------- /travis/osx.package.sh: -------------------------------------------------------------------------------- 1 | brew install dylibbundler --HEAD 2 | 3 | #langs 4 | wget https://github.com/nxengine/translations/releases/download/v1.2/all.zip 5 | unzip all.zip 6 | 7 | #prepare 8 | mkdir release 9 | cd release 10 | wget http://www.cavestory.org/downloads/cavestoryen.zip 11 | unzip cavestoryen.zip 12 | rm cavestoryen.zip 13 | mkdir NXEngine.app 14 | mkdir NXEngine.app/Contents 15 | mkdir NXEngine.app/Contents/MacOS 16 | mkdir NXEngine.app/Contents/Resources 17 | 18 | #prepare and copy data 19 | cp ../bin/extract CaveStory/ 20 | cp ../bin/nx NXEngine.app/Contents/MacOS/NXEngine 21 | cd CaveStory 22 | ./extract 23 | cd .. 24 | cp -r CaveStory/data NXEngine.app/Contents/Resources 25 | cp -r ../data NXEngine.app/Contents/Resources 26 | cp ../osx/icons.icns NXEngine.app/Contents/Resources 27 | cp ../osx/Info.plist NXEngine.app/Contents/ 28 | rm -rf CaveStory 29 | 30 | #bundle libs 31 | dylibbundler -b -x NXEngine.app/Contents/MacOS/NXEngine -d NXEngine.app/Contents/libs-intel -od -p @executable_path/../libs-intel 32 | 33 | #create dmg 34 | cd .. 35 | #git clone https://github.com/andreyvit/create-dmg 36 | git clone https://github.com/isage/create-dmg 37 | cd create-dmg 38 | ./create-dmg --volname "NXEngine" --window-size 640 480 --app-drop-link 380 205 --background ../osx/bg.png --icon-size 96 --icon "NXEngine.app" 110 205 "../NXEngine-$TRAVIS_TAG.dmg" ../release/ 39 | #curl --upload-file "../NXEngine-$TRAVIS_TAG.dmg" https://transfer.sh/NXEngine.dmg 40 | 41 | #upload 42 | #cd ../release 43 | #zip -r "NXEngine-$TRAVIS_TAG.zip" NXEngine.app 44 | #curl --upload-file "NXEngine-$TRAVIS_TAG.zip" https://transfer.sh/NXEngine.zip 45 | cd .. 46 | ls --------------------------------------------------------------------------------