Fork the vendored engine into the playable replica

Engine changes vs the vendored upstream (full ledger in
docs/upstream-patches.md):

- Assets: replace the encrypted FILE000N.GLB archives with a catalog of
  pre-decrypted loose files (data/INDEX); GLB_SlotItems() drives
  mission-pack / registered-version detection; payloads never run the
  GLB cipher at runtime.
- Platform: Linux/SDL2/ALSA only; Android, MSVC/MinGW, macOS packaging,
  bundled Windows SDL2 SDKs and the ENDOOM exit screen are gone;
  EXIT_Error now prints before exiting.
- Rendering: decouple presentation from simulation -- sim stays at the
  original 70/3 Hz, frames render interpolated at display rate (player,
  map scroll, enemies, shots, bonuses, anims, shadows); menus keep 70 Hz
  pacing; vsync with a delay-guard fallback.
- QoL: borderless window mode (Video/borderless), no menu cursor
  snapping onto default buttons.

Fix four regressions from the render split:

- Shield bars never redrew: RAP_ThinkStats latches g_oldshield each sim
  step before RAP_DisplayStats' dirty check could fire. Bars now draw
  unconditionally per rendered frame; g_oldsuper deleted, g_oldshield
  kept as sim-side damage-detection state only.
- Dying ships despawned without exploding: the render loop never called
  ANIMS_DisplayHigh(); most air-death explosions register HIGH_AIR.
  Restored between the player and enemy shots, as upstream orders it.
- Laser turret broke: reusing doneflag as a draw marker (it is
  hit/retire game state, and the turret retire path never frees its
  shot) hid the beam on hitting ticks and leaked one SHOTS pool slot
  per fire until no weapon could shoot. S_LINE tracers now carry an age
  counter: one Think pass, every render of their birth step, purged at
  the top of the next Think.
- Muzzle flash was cleared per rendered frame, making it invisible at
  display refresh rates; now cleared once per simulation step.
This commit is contained in:
raptorreplica committed 2026-08-26 18:45:07 +10:00
1 parent f7c9b7a02d
commit 214789fe87
667 files changed
+1490 -279572

No files matched your search

+98 -188
View File
@@ -1,188 +1,98 @@
cmake_minimum_required(VERSION 3.10)
set(EXECUTABLE_OUTPUT_PATH "bin")
set(CMAKE_CXX_FLAGS "-O3")
SET(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "-O3")
SET(CMAKE_C_STANDARD 11)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
project(raptor)
if(ANDROID)
include(FetchContent)
FetchContent_Declare(
SDL
URL https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.10.zip
SOURCE_DIR ${CMAKE_BINARY_DIR}/include/SDL2
)
set(BUILD_SHARED_LIBS ON)
set(SDL2_DISABLE_UNINSTALL ON CACHE BOOL "" FORCE)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(SDL2_DISABLE_SDL2MAIN ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(SDL)
set(SDL_ACTIVITY_FOLDER app/src/main/java/org/libsdl/app/)
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/android/${SDL_ACTIVITY_FOLDER})
file(COPY ${CMAKE_BINARY_DIR}/include/SDL2/android-project/${SDL_ACTIVITY_FOLDER} DESTINATION ${CMAKE_SOURCE_DIR}/android/${SDL_ACTIVITY_FOLDER})
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/android/app/src/main/assets)
file(COPY ${CMAKE_SOURCE_DIR}/include/TinySoundFont/LICENSE DESTINATION ${CMAKE_SOURCE_DIR}/android/app/src/main/assets/licenses)
file(RENAME ${CMAKE_SOURCE_DIR}/android/app/src/main/assets/licenses/LICENSE ${CMAKE_SOURCE_DIR}/android/app/src/main/assets/licenses/LICENSE.TSF)
file(COPY ${CMAKE_SOURCE_DIR}/pkg/android/license/LICENSE DESTINATION ${CMAKE_SOURCE_DIR}/android/app/src/main/assets/licenses)
elseif(WIN32)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
if(MSVC)
set(SDL2_DIR "include/SDL2-devel-2.28.2-VC/SDL2-2.28.2/cmake")
else()
set(SDL2_DIR "include/SDL2-devel-2.28.2-mingw/SDL2-2.28.2/cmake")
endif()
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
else()
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
endif()
include_directories(./include/textscreen/include/)
include_directories(./include/TinySoundFont/)
add_subdirectory(./include/textscreen/include)
set(SOURCE_FILES
src/tile.cpp
src/gssapi.cpp
src/objects.cpp
src/tile_a.cpp
src/windows.cpp
src/flame.cpp
src/i_lastscr.cpp
src/joyapi.cpp
src/kbdapi.cpp
src/glbapi.cpp
src/i_video.cpp
src/musapi.cpp
src/movie_a.cpp
src/ptrapi_a.cpp
src/swdapi.cpp
src/imsapi.cpp
src/store.cpp
src/i_oplmusic.cpp
src/bonus.cpp
src/anims.cpp
src/shadow.cpp
src/movie.cpp
src/m_misc.cpp
src/shots.cpp
src/opl3.cpp
src/eshot.cpp
src/gfxapi_a.cpp
src/dspapi.cpp
src/vmemapi.cpp
src/rap.cpp
src/demo.cpp
src/prefapi.cpp
src/gfxapi.cpp
src/intro.cpp
src/help.cpp
src/input.cpp
src/fx.cpp
src/ptrapi.cpp
src/loadsave.cpp
src/enemy.cpp
src/mpuwinmm.cpp
src/mputsf.cpp
src/mpualsa.cpp
src/mpucorea.cpp
src/mpucorem.cpp
)
set(SOURCE_SETUP_FILES
src/setup/input.cpp
src/setup/main.cpp
src/setup/music.cpp
src/setup/prefapi.cpp
src/setup/sound.cpp
src/setup/txt_joyinput.cpp
src/setup/txt_keyinput.cpp
src/setup/txt_mouseinput.cpp
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
add_library( ${PROJECT_NAME} SHARED ${SOURCE_FILES})
target_link_libraries(raptor
textscreen
SDL2::SDL2
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(ALSA REQUIRED)
add_executable( ${PROJECT_NAME} ${SOURCE_FILES} )
target_link_libraries(raptor
textscreen
asound
SDL2::SDL2main
SDL2::SDL2
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(AUDIO_TOOLBOX AudioToolbox)
find_library(AUDIO_UNIT AudioUnit)
find_library(FOUNDATION_LIBRARY Foundation)
find_library(COREMIDI_LIB CoreMIDI)
add_executable( ${PROJECT_NAME} ${SOURCE_FILES} )
target_link_libraries(raptor ${AUDIO_TOOLBOX} ${AUDIO_UNIT} ${FOUNDATION_LIBRARY} ${COREMIDI_LIB}
textscreen
SDL2::SDL2main
SDL2::SDL2
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_executable( ${PROJECT_NAME} ${SOURCE_FILES} )
target_sources(raptor PRIVATE rsrc/resource.rc)
target_link_libraries(raptor
winmm.lib
textscreen
SDL2::SDL2main
SDL2::SDL2
)
if(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo" OR ${CMAKE_BUILD_TYPE} MATCHES "Release")
if(MSVC)
target_link_options(raptor PRIVATE /subsystem:windows /ENTRY:mainCRTStartup)
else()
target_link_options(raptor PRIVATE -mwindows)
endif()
elseif(NOT MSVC)
target_link_options(raptor PRIVATE -mconsole)
endif()
else()
add_executable( ${PROJECT_NAME} ${SOURCE_FILES} )
target_link_libraries(raptor
textscreen
SDL2::SDL2main
SDL2::SDL2
)
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
add_executable( raptorsetup ${SOURCE_SETUP_FILES} )
if(WIN32)
target_sources(raptorsetup PRIVATE rsrc/setup/resource.rc)
endif()
target_link_libraries(raptorsetup
textscreen
SDL2::SDL2main
SDL2::SDL2
)
if(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo" OR ${CMAKE_BUILD_TYPE} MATCHES "Release")
if(MSVC)
target_link_options(raptorsetup PRIVATE /subsystem:windows /ENTRY:mainCRTStartup)
elseif(WIN32)
target_link_options(raptorsetup PRIVATE -mwindows)
endif()
elseif(WIN32 AND NOT MSVC)
target_link_options(raptorsetup PRIVATE -mconsole)
endif()
endif()
cmake_minimum_required(VERSION 3.10)
set(EXECUTABLE_OUTPUT_PATH "bin")
set(CMAKE_CXX_FLAGS "-O3")
SET(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "-O3")
SET(CMAKE_C_STANDARD 11)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
project(raptor)
# Linux-only build: SDL2 + ALSA (PipeWire serves ALSA). Windows/Android/OSX
# support was stripped from this fork — see ../PLAN.md.
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
include_directories(./include/textscreen/include/)
include_directories(./include/TinySoundFont/)
add_subdirectory(./include/textscreen/include)
set(SOURCE_FILES
src/tile.cpp
src/gssapi.cpp
src/objects.cpp
src/tile_a.cpp
src/windows.cpp
src/flame.cpp
src/joyapi.cpp
src/kbdapi.cpp
src/glbapi.cpp
src/i_video.cpp
src/musapi.cpp
src/movie_a.cpp
src/ptrapi_a.cpp
src/swdapi.cpp
src/imsapi.cpp
src/store.cpp
src/i_oplmusic.cpp
src/bonus.cpp
src/anims.cpp
src/shadow.cpp
src/movie.cpp
src/m_misc.cpp
src/shots.cpp
src/opl3.cpp
src/eshot.cpp
src/gfxapi_a.cpp
src/dspapi.cpp
src/vmemapi.cpp
src/rap.cpp
src/demo.cpp
src/prefapi.cpp
src/gfxapi.cpp
src/intro.cpp
src/help.cpp
src/input.cpp
src/fx.cpp
src/ptrapi.cpp
src/loadsave.cpp
src/enemy.cpp
src/mpuwinmm.cpp
src/mputsf.cpp
src/mpualsa.cpp
src/mpucorea.cpp
src/mpucorem.cpp
)
set(SOURCE_SETUP_FILES
src/setup/input.cpp
src/setup/main.cpp
src/setup/music.cpp
src/setup/prefapi.cpp
src/setup/sound.cpp
src/setup/txt_joyinput.cpp
src/setup/txt_keyinput.cpp
src/setup/txt_mouseinput.cpp
)
find_package(ALSA REQUIRED)
add_executable( ${PROJECT_NAME} ${SOURCE_FILES} )
target_link_libraries(raptor
textscreen
asound
SDL2::SDL2main
SDL2::SDL2
)
add_executable( raptorsetup ${SOURCE_SETUP_FILES} )
target_link_libraries(raptorsetup
textscreen
SDL2::SDL2main
SDL2::SDL2
)