diff --git a/src/core/static_vec.hpp b/src/core/static_vec.hpp index 36962d591..b774f7705 100644 --- a/src/core/static_vec.hpp +++ b/src/core/static_vec.hpp @@ -15,6 +15,50 @@ namespace srb2 { +template +class StaticVec; + +// Silly hack to avoid GCC standard library algorithms bogus compile warnings +template +class StaticVecIter +{ + T* p_; + + StaticVecIter(T* p) noexcept : p_(p) {} + + friend class StaticVec; + friend class StaticVec::type, Limit>; + +public: + using difference_type = ptrdiff_t; + using value_type = T; + using pointer = T*; + using reference = T&; + using iterator_category = std::random_access_iterator_tag; + + T& operator*() const noexcept { return *p_; } + T* operator->() const noexcept { return p_; } + StaticVecIter& operator++() noexcept { p_++; return *this; } + StaticVecIter operator++(int) noexcept { StaticVecIter copy = *this; ++(*this); return copy; } + StaticVecIter& operator--() noexcept { p_--; return *this; } + StaticVecIter operator--(int) noexcept { StaticVecIter copy = *this; --(*this); return copy; } + StaticVecIter& operator+=(ptrdiff_t ofs) noexcept { p_ += ofs; return *this; } + StaticVecIter& operator-=(ptrdiff_t ofs) noexcept { p_ -= ofs; return *this; } + T& operator[](ptrdiff_t ofs) noexcept { return *(p_ + ofs); } + + friend ptrdiff_t operator+(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return lhs.p_ + rhs.p_; } + friend ptrdiff_t operator-(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return lhs.p_ - rhs.p_; } + friend StaticVecIter operator+(const StaticVecIter& lhs, ptrdiff_t rhs) noexcept { return lhs.p_ + rhs; } + friend StaticVecIter operator-(const StaticVecIter& lhs, ptrdiff_t rhs) noexcept { return lhs.p_ - rhs; } + + friend bool operator==(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return lhs.p_ == rhs.p_; } + friend bool operator!=(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return !(lhs.p_ == rhs.p_); } + friend bool operator>(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return lhs.p_ > rhs.p_; } + friend bool operator<=(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return !(lhs.p_ > rhs.p_); } + friend bool operator<(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return lhs.p_ < rhs.p_; } + friend bool operator>=(const StaticVecIter& lhs, const StaticVecIter& rhs) noexcept { return !(lhs.p_ < rhs.p_); } +}; + template class StaticVec { @@ -138,25 +182,25 @@ public: size_ = 0; } - constexpr T* begin() noexcept { return &arr_[0]; } + constexpr StaticVecIter begin() noexcept { return &arr_[0]; } - constexpr const T* begin() const noexcept { return cbegin(); } + constexpr StaticVecIter begin() const noexcept { return cbegin(); } - constexpr const T* cbegin() const noexcept { return &arr_[0]; } + constexpr StaticVecIter cbegin() const noexcept { return &arr_[0]; } - constexpr T* end() noexcept { return &arr_[size_]; } + constexpr StaticVecIter end() noexcept { return &arr_[size_]; } - constexpr const T* end() const noexcept { return cend(); } + constexpr StaticVecIter end() const noexcept { return cend(); } - constexpr const T* cend() const noexcept { return &arr_[size_]; } + constexpr StaticVecIter cend() const noexcept { return &arr_[size_]; } - constexpr std::reverse_iterator rbegin() noexcept { return &arr_[size_]; } + constexpr std::reverse_iterator> rbegin() noexcept { return &arr_[size_]; } - constexpr std::reverse_iterator crbegin() const noexcept { return &arr_[size_]; } + constexpr std::reverse_iterator> crbegin() const noexcept { return &arr_[size_]; } - constexpr std::reverse_iterator rend() noexcept { return &arr_[0]; } + constexpr std::reverse_iterator> rend() noexcept { return &arr_[0]; } - constexpr std::reverse_iterator crend() const noexcept { return &arr_[0]; } + constexpr std::reverse_iterator> crend() const noexcept { return &arr_[0]; } constexpr bool empty() const noexcept { return size_ == 0; } diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e5dde4921..d5023265f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5170,8 +5170,14 @@ static void HandlePacketFromPlayer(SINT8 node) || netbuffer->packettype == PT_NODEKEEPALIVEMIS) break; + // If we already received a ticcmd for this tic, just submit it for the next one. + tic_t faketic = maketic; + + if (!!(netcmds[maketic % BACKUPTICS][netconsole].flags & TICCMD_RECEIVED)) + faketic++; + // Copy ticcmd - G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1); + G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1); // Check ticcmd for "speed hacks" if (CheckForSpeedHacks((UINT8)netconsole)) @@ -5183,7 +5189,7 @@ static void HandlePacketFromPlayer(SINT8 node) || (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)) && (nodetoplayer2[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]], + G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer2[node]], &netbuffer->u.client2pak.cmd2, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer2[node])) @@ -5194,7 +5200,7 @@ static void HandlePacketFromPlayer(SINT8 node) || (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)) && (nodetoplayer3[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]], + G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer3[node]], &netbuffer->u.client3pak.cmd3, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer3[node])) @@ -5204,7 +5210,7 @@ static void HandlePacketFromPlayer(SINT8 node) if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS) && (nodetoplayer4[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]], + G_MoveTiccmd(&netcmds[faketic%BACKUPTICS][(UINT8)nodetoplayer4[node]], &netbuffer->u.client4pak.cmd4, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer4[node])) diff --git a/src/deh_tables.c b/src/deh_tables.c index 323bf3bc0..aca1d66d4 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3303,6 +3303,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_INSTAWHIP_RECHARGE2", "S_INSTAWHIP_RECHARGE3", "S_INSTAWHIP_RECHARGE4", + "S_INSTAWHIP_REJECT", "S_BLOCKRING", "S_BLOCKBODY", @@ -3998,6 +3999,40 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_LAMPPOST", "S_MOSSYTREE", + // Lost Colony symbol signs + "S_SYMBOL_0", + "S_SYMBOL_1", + "S_SYMBOL_2", + "S_SYMBOL_3", + "S_SYMBOL_4", + "S_SYMBOL_5", + "S_SYMBOL_6", + "S_SYMBOL_7", + "S_SYMBOL_8", + "S_SYMBOL_9", + "S_SYMBOL_A", + "S_SYMBOL_B", + "S_SYMBOL_C", + "S_SYMBOL_D", + "S_SYMBOL_E", + "S_SYMBOL_F", + "S_SYMBOL_G", + "S_SYMBOL_H", + "S_SYMBOL_I", + "S_SYMBOL_J", + "S_SYMBOL_K", + "S_SYMBOL_L", + "S_SYMBOL_M", + "S_SYMBOL_N", + "S_SYMBOL_O", + "S_SYMBOL_P", + "S_SYMBOL_Q", + "S_SYMBOL_R", + "S_SYMBOL_S", + "S_SYMBOL_T", + "S_SYMBOL_U", + "S_SYMBOL_V", + "S_BUMP1", "S_BUMP2", "S_BUMP3", @@ -4571,6 +4606,8 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_HITLAG_6", "S_HITLAG_8", "S_HITLAG_9", + "S_HITLAG_10", + // Broly Ki Orb "S_BROLY1", @@ -5373,6 +5410,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_INSTAWHIP", "MT_INSTAWHIP_RECHARGE", + "MT_INSTAWHIP_REJECT", "MT_BLOCKRING", "MT_BLOCKBODY", @@ -5539,6 +5577,8 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_LAMPPOST", "MT_MOSSYTREE", + "MT_SYMBOL", + "MT_BUMP", "MT_FLINGENERGY", diff --git a/src/hwr2/pass.hpp b/src/hwr2/pass.hpp index a745bd12b..3cf73c841 100644 --- a/src/hwr2/pass.hpp +++ b/src/hwr2/pass.hpp @@ -26,10 +26,10 @@ public: /// @param rhi virtual void prepass(rhi::Rhi& rhi) = 0; - /// @brief Upload contents for needed GPU resources. + /// @brief Upload contents for needed GPU resources. Passes must implement but this will be removed soon. /// @param rhi /// @param ctx - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) = 0; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) = 0; /// @brief Issue draw calls. /// @param rhi diff --git a/src/hwr2/pass_blit_postimg_screens.cpp b/src/hwr2/pass_blit_postimg_screens.cpp index 7fe485faf..da3b317eb 100644 --- a/src/hwr2/pass_blit_postimg_screens.cpp +++ b/src/hwr2/pass_blit_postimg_screens.cpp @@ -141,7 +141,7 @@ static Rect get_screen_viewport(uint32_t screen, uint32_t screens, uint32_t w, u return {0, 0, w, h}; } -void BlitPostimgScreens::transfer(Rhi& rhi, Handle ctx) +void BlitPostimgScreens::transfer(Rhi& rhi, Handle ctx) { // Upload needed buffers if (upload_quad_buffer_) diff --git a/src/hwr2/pass_blit_postimg_screens.hpp b/src/hwr2/pass_blit_postimg_screens.hpp index 47893476a..382995d58 100644 --- a/src/hwr2/pass_blit_postimg_screens.hpp +++ b/src/hwr2/pass_blit_postimg_screens.hpp @@ -72,7 +72,7 @@ public: virtual ~BlitPostimgScreens(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_blit_rect.cpp b/src/hwr2/pass_blit_rect.cpp index 38f0cf5cf..89971b456 100644 --- a/src/hwr2/pass_blit_rect.cpp +++ b/src/hwr2/pass_blit_rect.cpp @@ -124,7 +124,7 @@ void BlitRectPass::prepass(Rhi& rhi) } } -void BlitRectPass::transfer(Rhi& rhi, Handle ctx) +void BlitRectPass::transfer(Rhi& rhi, Handle ctx) { if (quad_vbo_needs_upload_ && quad_vbo_) { diff --git a/src/hwr2/pass_blit_rect.hpp b/src/hwr2/pass_blit_rect.hpp index 010583c3e..f0719b70e 100644 --- a/src/hwr2/pass_blit_rect.hpp +++ b/src/hwr2/pass_blit_rect.hpp @@ -51,7 +51,7 @@ public: virtual ~BlitRectPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_imgui.cpp b/src/hwr2/pass_imgui.cpp index 3707a4a3d..9cbb87ad7 100644 --- a/src/hwr2/pass_imgui.cpp +++ b/src/hwr2/pass_imgui.cpp @@ -127,7 +127,7 @@ void ImguiPass::prepass(Rhi& rhi) } } -void ImguiPass::transfer(Rhi& rhi, Handle ctx) +void ImguiPass::transfer(Rhi& rhi, Handle ctx) { ImGuiIO& io = ImGui::GetIO(); diff --git a/src/hwr2/pass_imgui.hpp b/src/hwr2/pass_imgui.hpp index 91d2afe20..b2a7cc99c 100644 --- a/src/hwr2/pass_imgui.hpp +++ b/src/hwr2/pass_imgui.hpp @@ -50,7 +50,7 @@ public: virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; diff --git a/src/hwr2/pass_manager.cpp b/src/hwr2/pass_manager.cpp index a6bc386a7..ab0e60b21 100644 --- a/src/hwr2/pass_manager.cpp +++ b/src/hwr2/pass_manager.cpp @@ -32,7 +32,7 @@ public: virtual ~LambdaPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; }; @@ -63,7 +63,7 @@ void LambdaPass::prepass(Rhi& rhi) } } -void LambdaPass::transfer(Rhi&, Handle) +void LambdaPass::transfer(Rhi&, Handle) { } @@ -137,7 +137,7 @@ void PassManager::prepass(Rhi& rhi) } } -void PassManager::transfer(Rhi& rhi, Handle ctx) +void PassManager::transfer(Rhi& rhi, Handle ctx) { for (auto& pass : passes_) { @@ -179,11 +179,8 @@ void PassManager::render(Rhi& rhi) prepass(rhi); - Handle tc = rhi.begin_transfer(); - transfer(rhi, tc); - rhi.end_transfer(tc); - Handle gc = rhi.begin_graphics(); + transfer(rhi, gc); graphics(rhi, gc); rhi.end_graphics(gc); diff --git a/src/hwr2/pass_manager.hpp b/src/hwr2/pass_manager.hpp index c462dd395..7734e0a43 100644 --- a/src/hwr2/pass_manager.hpp +++ b/src/hwr2/pass_manager.hpp @@ -43,7 +43,7 @@ public: PassManager& operator=(PassManager&&) = delete; virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_postprocess.cpp b/src/hwr2/pass_postprocess.cpp index a35dea645..0f2eefdc2 100644 --- a/src/hwr2/pass_postprocess.cpp +++ b/src/hwr2/pass_postprocess.cpp @@ -175,7 +175,7 @@ void PostprocessWipePass::prepass(Rhi& rhi) }); } -void PostprocessWipePass::transfer(Rhi& rhi, Handle ctx) +void PostprocessWipePass::transfer(Rhi& rhi, Handle ctx) { if (wipe_tex_ == kNullHandle) { diff --git a/src/hwr2/pass_postprocess.hpp b/src/hwr2/pass_postprocess.hpp index ced81975c..f0deb7ff9 100644 --- a/src/hwr2/pass_postprocess.hpp +++ b/src/hwr2/pass_postprocess.hpp @@ -49,7 +49,7 @@ public: virtual ~PostprocessWipePass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_resource_managers.cpp b/src/hwr2/pass_resource_managers.cpp index 550f5a015..99a05ca26 100644 --- a/src/hwr2/pass_resource_managers.cpp +++ b/src/hwr2/pass_resource_managers.cpp @@ -128,7 +128,7 @@ void FramebufferManager::prepass(Rhi& rhi) } } -void FramebufferManager::transfer(Rhi& rhi, Handle ctx) +void FramebufferManager::transfer(Rhi& rhi, Handle ctx) { } @@ -169,7 +169,7 @@ void MainPaletteManager::prepass(Rhi& rhi) } } -void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) { std::array palette_32; for (std::size_t i = 0; i < kPaletteSize; i++) @@ -179,7 +179,7 @@ void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) rhi.update_texture(ctx, palette_, {0, 0, kPaletteSize, 1}, PixelFormat::kRGBA8, tcb::as_bytes(tcb::span(palette_32))); } -void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ctx) { if (colormaps != nullptr) { @@ -206,7 +206,7 @@ void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ct } } -void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) { std::array data; for (std::size_t i = 0; i < kPaletteSize; i++) @@ -216,7 +216,7 @@ void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_colormaps(Rhi& rhi, Handle ctx) { for (auto to_upload : colormaps_to_upload_) { @@ -279,7 +279,7 @@ rhi::Handle MainPaletteManager::find_extra_lighttable(srb2::NotNul return lighttables_.at(lighttable); } -void MainPaletteManager::transfer(Rhi& rhi, Handle ctx) +void MainPaletteManager::transfer(Rhi& rhi, Handle ctx) { upload_palette(rhi, ctx); upload_lighttables(rhi, ctx); @@ -327,7 +327,7 @@ void CommonResourcesManager::prepass(Rhi& rhi) } } -void CommonResourcesManager::transfer(Rhi& rhi, Handle ctx) +void CommonResourcesManager::transfer(Rhi& rhi, Handle ctx) { if (!init_) { @@ -382,7 +382,7 @@ void FlatTextureManager::prepass(Rhi& rhi) { } -void FlatTextureManager::transfer(Rhi& rhi, Handle ctx) +void FlatTextureManager::transfer(Rhi& rhi, Handle ctx) { std::vector> flat_data; for (auto flat_lump : to_upload_) diff --git a/src/hwr2/pass_resource_managers.hpp b/src/hwr2/pass_resource_managers.hpp index 11e7fad95..ff7cce2d2 100644 --- a/src/hwr2/pass_resource_managers.hpp +++ b/src/hwr2/pass_resource_managers.hpp @@ -37,7 +37,7 @@ public: virtual ~FramebufferManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -83,17 +83,17 @@ class MainPaletteManager final : public Pass std::vector colormaps_to_upload_; std::vector lighttables_to_upload_; - void upload_palette(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_lighttables(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_default_colormap(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_colormaps(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_palette(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_lighttables(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_default_colormap(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_colormaps(rhi::Rhi& rhi, rhi::Handle ctx); public: MainPaletteManager(); virtual ~MainPaletteManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -120,7 +120,7 @@ public: virtual ~CommonResourcesManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -153,7 +153,7 @@ public: virtual ~FlatTextureManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_screenshot.cpp b/src/hwr2/pass_screenshot.cpp index 059b07c85..cff5cc99a 100644 --- a/src/hwr2/pass_screenshot.cpp +++ b/src/hwr2/pass_screenshot.cpp @@ -40,7 +40,7 @@ void ScreenshotPass::prepass(Rhi& rhi) doing_screenshot_ = takescreenshot || moviemode != MM_OFF; } -void ScreenshotPass::transfer(Rhi& rhi, Handle ctx) +void ScreenshotPass::transfer(Rhi& rhi, Handle ctx) { } diff --git a/src/hwr2/pass_screenshot.hpp b/src/hwr2/pass_screenshot.hpp index 79de8b654..36c386a29 100644 --- a/src/hwr2/pass_screenshot.hpp +++ b/src/hwr2/pass_screenshot.hpp @@ -32,7 +32,7 @@ public: virtual ~ScreenshotPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_software.cpp b/src/hwr2/pass_software.cpp index 0a514cd9b..1b9cde048 100644 --- a/src/hwr2/pass_software.cpp +++ b/src/hwr2/pass_software.cpp @@ -77,7 +77,7 @@ void SoftwarePass::prepass(Rhi& rhi) } } -void SoftwarePass::transfer(Rhi& rhi, Handle ctx) +void SoftwarePass::transfer(Rhi& rhi, Handle ctx) { // Upload screen tcb::span screen_span; diff --git a/src/hwr2/pass_software.hpp b/src/hwr2/pass_software.hpp index 4e7b02405..ae733a816 100644 --- a/src/hwr2/pass_software.hpp +++ b/src/hwr2/pass_software.hpp @@ -34,7 +34,7 @@ public: virtual ~SoftwarePass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_twodee.cpp b/src/hwr2/pass_twodee.cpp index ed30706df..0281737fa 100644 --- a/src/hwr2/pass_twodee.cpp +++ b/src/hwr2/pass_twodee.cpp @@ -498,7 +498,7 @@ void TwodeePass::prepass(Rhi& rhi) } } -void TwodeePass::transfer(Rhi& rhi, Handle ctx) +void TwodeePass::transfer(Rhi& rhi, Handle ctx) { if (!ctx_ || !data_) { diff --git a/src/hwr2/pass_twodee.hpp b/src/hwr2/pass_twodee.hpp index 8c72fc92e..da5c2f66f 100644 --- a/src/hwr2/pass_twodee.hpp +++ b/src/hwr2/pass_twodee.hpp @@ -97,7 +97,7 @@ struct TwodeePass final : public Pass virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; diff --git a/src/hwr2/patch_atlas.cpp b/src/hwr2/patch_atlas.cpp index fe5f6229c..26e35ca4b 100644 --- a/src/hwr2/patch_atlas.cpp +++ b/src/hwr2/patch_atlas.cpp @@ -348,7 +348,7 @@ void PatchAtlasCache::prepass(Rhi& rhi) } } -void PatchAtlasCache::transfer(Rhi& rhi, Handle ctx) +void PatchAtlasCache::transfer(Rhi& rhi, Handle ctx) { SRB2_ASSERT(ready_for_lookup()); diff --git a/src/hwr2/patch_atlas.hpp b/src/hwr2/patch_atlas.hpp index 9707074b2..85b3b1162 100644 --- a/src/hwr2/patch_atlas.hpp +++ b/src/hwr2/patch_atlas.hpp @@ -125,7 +125,7 @@ public: PatchAtlas* find_patch(srb2::NotNull patch); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; }; diff --git a/src/info.c b/src/info.c index 8a1f4e29e..749b2a6af 100644 --- a/src/info.c +++ b/src/info.c @@ -558,6 +558,7 @@ char sprnames[NUMSPRITES + 1][5] = "IWHP", // Instawhip "WPRE", // Instawhip Recharge + "WPRJ", // Instawhip Reject "GRNG", // Guard ring "GBDY", // Guard body @@ -581,6 +582,7 @@ char sprnames[NUMSPRITES + 1][5] = "HFX6", // Hitlag stage 6 "HFX8", // Hitlag stage 8 "HFX9", // Hitlag stage 9 + "HFXX", // Hitlag stage 10 // Kart Items "RSHE", // Rocket sneaker @@ -644,6 +646,40 @@ char sprnames[NUMSPRITES + 1][5] = "CRAB", // Crystal Abyss mobs "BRNG", // Chaotix Big Ring + // Lost Colony symbol signs + "SYM0", + "SYM1", + "SYM2", + "SYM3", + "SYM4", + "SYM5", + "SYM6", + "SYM7", + "SYM8", + "SYM9", + "SYMA", + "SYMB", + "SYMC", + "SYMD", + "SYME", + "SYMF", + "SYMG", + "SYMH", + "SYMI", + "SYMJ", + "SYMK", + "SYML", + "SYMM", + "SYMN", + "SYMO", + "SYMP", + "SYMQ", + "SYMR", + "SYMS", + "SYMT", + "SYMU", + "SYMV", + "BUMP", // Player/shell bump "FLEN", // Shell hit graphics stuff "CLAS", // items clash @@ -3988,6 +4024,7 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3ka0, 2, S_INSTAWHIP_RECHARGE3}, // S_INSTAWHIP_RECHARGE2 {SPR_WPRE, FF_FULLBRIGHT|FF_FLOORSPRITE|FF_ANIMATE|0, 36, {NULL}, 17, 2, S_INSTAWHIP_RECHARGE4}, // S_INSTAWHIP_RECHARGE3 {SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3k7c, 2, S_NULL}, // S_INSTAWHIP_RECHARGE4 + {SPR_WPRJ, FF_ANIMATE, 9, {NULL}, 8, 1, S_NULL}, // S_INSTAWHIP_REJECT {SPR_GRNG, FF_FULLBRIGHT|FF_PAPERSPRITE|0, -1, {NULL}, 0, 0, S_NULL}, // S_BLOCKRING {SPR_GBDY, FF_FULLBRIGHT|FF_ANIMATE|0, -1, {NULL}, 4, 2, S_NULL}, // S_BLOCKBODY @@ -4639,6 +4676,40 @@ state_t states[NUMSTATES] = {SPR_CRAB, 10, -1, {NULL}, 0, 0, S_NULL}, // S_LAMPPOST {SPR_CRAB, 11, -1, {NULL}, 0, 0, S_NULL}, // S_MOSSYTREE + // Lost Colony symbol signs + {SPR_SYM0, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_0 + {SPR_SYM1, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_1 + {SPR_SYM2, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_2 + {SPR_SYM3, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_3 + {SPR_SYM4, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_4 + {SPR_SYM5, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_5 + {SPR_SYM6, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_6 + {SPR_SYM7, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_7 + {SPR_SYM8, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_8 + {SPR_SYM9, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_9 + {SPR_SYMA, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_A + {SPR_SYMB, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_B + {SPR_SYMC, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_C + {SPR_SYMD, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_D + {SPR_SYME, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_E + {SPR_SYMF, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_F + {SPR_SYMG, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_G + {SPR_SYMH, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_H + {SPR_SYMI, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_I + {SPR_SYMJ, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_J + {SPR_SYMK, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_K + {SPR_SYML, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_L + {SPR_SYMM, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_M + {SPR_SYMN, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_N + {SPR_SYMO, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_O + {SPR_SYMP, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_P + {SPR_SYMQ, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_Q + {SPR_SYMR, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_R + {SPR_SYMS, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_S + {SPR_SYMT, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_T + {SPR_SYMU, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_U + {SPR_SYMV, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 15, 2, S_NULL}, // S_SYMBOL_V + {SPR_BUMP, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_BUMP2}, // S_BUMP1 {SPR_BUMP, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_BUMP3}, // S_BUMP2 {SPR_BUMP, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_NULL}, // S_BUMP3 @@ -5252,6 +5323,7 @@ state_t states[NUMSTATES] = {SPR_HFX6, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 6, {NULL}, 5, 1, S_NULL}, // S_HITLAG_6 {SPR_HFX8, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 8, {NULL}, 7, 1, S_NULL}, // S_HITLAG_8 {SPR_HFX9, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 9, {NULL}, 8, 1, S_NULL}, // S_HITLAG_9 + {SPR_HFXX, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 10, {NULL}, 9, 1, S_NULL}, // S_HITLAG_10 // Broly Ki Orb {SPR_LSSJ, FF_REVERSESUBTRACT|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_BROLY2}, // S_BROLY1 @@ -22793,6 +22865,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_INSTAWHIP_RECHARGE3 // raisestate }, + { // MT_INSTAWHIP_REJECT + -1, // doomednum + S_INSTAWHIP_REJECT, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 90*FRACUNIT, // radius + 90*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_BLOCKRING -1, // doomednum S_BLOCKRING, // spawnstate @@ -26222,6 +26321,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_SYMBOL + 4094, // doomednum + S_SYMBOL_0, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 43*FRACUNIT, // radius + 100*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_SCENERY|MF_NOCLIP|MF_DRAWFROMFARAWAY|MF_NOCLIPTHING|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_BUMP -1, // doomednum S_BUMP1, // spawnstate diff --git a/src/info.h b/src/info.h index c52ec8541..f8258fadd 100644 --- a/src/info.h +++ b/src/info.h @@ -1109,6 +1109,7 @@ typedef enum sprite SPR_IWHP, // Instawhip SPR_WPRE, // Instawhip Recharge + SPR_WPRJ, // Instawhip Reject SPR_GRNG, // Guard ring SPR_GBDY, // Guard body @@ -1132,6 +1133,7 @@ typedef enum sprite SPR_HFX6, // Hitlag stage 6 SPR_HFX8, // Hitlag stage 8 SPR_HFX9, // Hitlag stage 9 + SPR_HFXX, // Hitlag stage 10 // Kart Items SPR_RSHE, // Rocket sneaker @@ -1195,6 +1197,40 @@ typedef enum sprite SPR_CRAB, // Crystal Abyss mobs SPR_BRNG, // Chaotix Big Ring + // Lost Colony symbol signs + SPR_SYM0, + SPR_SYM1, + SPR_SYM2, + SPR_SYM3, + SPR_SYM4, + SPR_SYM5, + SPR_SYM6, + SPR_SYM7, + SPR_SYM8, + SPR_SYM9, + SPR_SYMA, + SPR_SYMB, + SPR_SYMC, + SPR_SYMD, + SPR_SYME, + SPR_SYMF, + SPR_SYMG, + SPR_SYMH, + SPR_SYMI, + SPR_SYMJ, + SPR_SYMK, + SPR_SYML, + SPR_SYMM, + SPR_SYMN, + SPR_SYMO, + SPR_SYMP, + SPR_SYMQ, + SPR_SYMR, + SPR_SYMS, + SPR_SYMT, + SPR_SYMU, + SPR_SYMV, + SPR_BUMP, // Player/shell bump SPR_FLEN, // Shell hit graphics stuff SPR_CLAS, // items clash @@ -4398,6 +4434,7 @@ typedef enum state S_INSTAWHIP_RECHARGE2, S_INSTAWHIP_RECHARGE3, S_INSTAWHIP_RECHARGE4, + S_INSTAWHIP_REJECT, S_BLOCKRING, S_BLOCKBODY, @@ -5092,6 +5129,40 @@ typedef enum state S_LAMPPOST, S_MOSSYTREE, + // Lost Colony symbol signs + S_SYMBOL_0, + S_SYMBOL_1, + S_SYMBOL_2, + S_SYMBOL_3, + S_SYMBOL_4, + S_SYMBOL_5, + S_SYMBOL_6, + S_SYMBOL_7, + S_SYMBOL_8, + S_SYMBOL_9, + S_SYMBOL_A, + S_SYMBOL_B, + S_SYMBOL_C, + S_SYMBOL_D, + S_SYMBOL_E, + S_SYMBOL_F, + S_SYMBOL_G, + S_SYMBOL_H, + S_SYMBOL_I, + S_SYMBOL_J, + S_SYMBOL_K, + S_SYMBOL_L, + S_SYMBOL_M, + S_SYMBOL_N, + S_SYMBOL_O, + S_SYMBOL_P, + S_SYMBOL_Q, + S_SYMBOL_R, + S_SYMBOL_S, + S_SYMBOL_T, + S_SYMBOL_U, + S_SYMBOL_V, + S_BUMP1, S_BUMP2, S_BUMP3, @@ -5682,6 +5753,7 @@ typedef enum state S_HITLAG_6, S_HITLAG_8, S_HITLAG_9, + S_HITLAG_10, // Broly Ki Orb S_BROLY1, @@ -6503,6 +6575,7 @@ typedef enum mobj_type MT_INSTAWHIP, MT_INSTAWHIP_RECHARGE, + MT_INSTAWHIP_REJECT, MT_BLOCKRING, MT_BLOCKBODY, @@ -6669,6 +6742,8 @@ typedef enum mobj_type MT_LAMPPOST, MT_MOSSYTREE, + MT_SYMBOL, // Lost Colony symbol signs + MT_BUMP, MT_FLINGENERGY, diff --git a/src/k_hitlag.h b/src/k_hitlag.h index 02dedfc2a..cace7a964 100644 --- a/src/k_hitlag.h +++ b/src/k_hitlag.h @@ -22,7 +22,7 @@ extern "C" { #define MAXHITLAGTICS (30) #define HITLAGJITTERS (FRACUNIT / 20) -#define NUM_HITLAG_STATES (8) +#define NUM_HITLAG_STATES (9) /*-------------------------------------------------- void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage); diff --git a/src/k_objects.h b/src/k_objects.h index 92477ca4d..e00b4813f 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -178,6 +178,11 @@ void Obj_BattleUFOBeamThink(mobj_t *beam); void Obj_SpawnPowerUpAura(player_t* player); void Obj_PowerUpAuraThink(mobj_t* mobj); +/* Lost Colony symbol signs */ +void Obj_SymbolSpawn(mobj_t *mobj); +void Obj_SymbolSetup(mobj_t *mobj, mapthing_t *mthing); +void Obj_SymbolThink(mobj_t *mobj); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/objects/CMakeLists.txt b/src/objects/CMakeLists.txt index 0aa872933..ca07bc1eb 100644 --- a/src/objects/CMakeLists.txt +++ b/src/objects/CMakeLists.txt @@ -24,4 +24,5 @@ target_sources(SRB2SDL2 PRIVATE super-flicky.cpp battle-ufo.cpp powerup-aura.cpp + symbol.c ) diff --git a/src/objects/symbol.c b/src/objects/symbol.c new file mode 100644 index 000000000..155d18886 --- /dev/null +++ b/src/objects/symbol.c @@ -0,0 +1,43 @@ +#include "../p_local.h" +#include "../k_objects.h" + +#define SYMBOL_SCALE (2<extravalue1 = mobj->z; + mobj->extravalue2 = FixedMul(mobj->x + mobj->y, mapobjectscale); +} + +void Obj_SymbolSetup(mobj_t *mobj, mapthing_t *mthing) +{ + fixed_t oldHeight = mobj->height; + statenum_t stateNum = mobj->info->spawnstate + (mthing->args[0] % SYMBOL_OPTIONS); + + mobj->angle += ANGLE_90; + P_SetScale(mobj, mobj->destscale = 4 * FixedMul(mobj->scale, SYMBOL_SCALE)); + mobj->z += 4 * FixedMul(mapobjectscale, SYMBOL_ZOFFSET) * P_MobjFlip(mobj); + + if (mthing->options & MTF_OBJECTFLIP) + { + mobj->z += oldHeight - mobj->height; + } + + mobj->extravalue1 = mobj->old_z = mobj->z; + P_SetMobjState(mobj, stateNum); +} + +void Obj_SymbolThink(mobj_t *mobj) +{ + fixed_t offset = FixedMul(mapobjectscale, + FixedMul(SYMBOL_BOBRANGE, + FixedMul(FINESINE(FixedAngle(leveltime * SYMBOL_BOBSPEED + mobj->extravalue2) >> ANGLETOFINESHIFT) + FRACUNIT, FRACUNIT >> 1) + ) + ); + + mobj->z = mobj->extravalue1 + P_MobjFlip(mobj) * offset; +} diff --git a/src/p_mobj.c b/src/p_mobj.c index 0c02af316..ae19e7844 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6712,6 +6712,9 @@ static void P_MobjSceneryThink(mobj_t *mobj) return; } break; + case MT_SYMBOL: + Obj_SymbolThink(mobj); + break; case MT_VWREF: case MT_VWREB: { @@ -10974,6 +10977,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_BATTLEUFO: Obj_SpawnBattleUFOLegs(mobj); break; + case MT_SYMBOL: + Obj_SymbolSpawn(mobj); + break; default: break; } @@ -13493,6 +13499,11 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj) Obj_LinkBattleUFOSpawner(mobj); break; } + case MT_SYMBOL: + { + Obj_SymbolSetup(mobj, mthing); + break; + } default: break; } diff --git a/src/p_setup.c b/src/p_setup.c index f6f587e1b..27b771df1 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7202,6 +7202,14 @@ static void P_ConvertBinaryThingTypes(void) case CEILING_SLOPE_THING: mapthings[i].args[0] = mapthings[i].extrainfo; break; + case 4094: // MT_SYMBOL + mapthings[i].args[0] = mapthings[i].extrainfo; + if (mapthings[i].options & MTF_OBJECTSPECIAL) + { + // Special = add 16 to the symbol type + mapthings[i].args[0] += 16; + } + break; default: break; } diff --git a/src/p_user.c b/src/p_user.c index b6750eed8..74b5d6231 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2380,7 +2380,24 @@ static void P_UpdatePlayerAngle(player_t *player) INT16 targetsteering = K_UpdateSteeringValue(player->steering, player->cmd.turning); angleChange = K_GetKartTurnValue(player, targetsteering) << TICCMD_REDUCE; - if (!K_PlayerUsesBotMovement(player)) + if (K_PlayerUsesBotMovement(player)) + { + // You're a bot. Go where you're supposed to go + player->steering = targetsteering; + } + else if ((!(player->cmd.flags & TICCMD_RECEIVED)) && (!!(player->oldcmd.flags && TICCMD_RECEIVED))) + { + // Missed a single tic. This ticcmd is copied from their previous one + // (less the TICCMD_RECEIVED flag), so it will include an old angle, and + // steering towards that will turn unambitiously. A better guess is to + // assume their inputs are the same, and turn based on those for 1 tic. + player->steering = targetsteering; + // "Why not use this for multiple consecutive dropped tics?" Oversimplification: + // Clients have default netticbuffer 1, so missing more than 1 tic will freeze + // your client, and with it, your local camera. Our goal then becomes not to + // steer PAST the angle you can see, so the default turn solver behavior is best. + } + else { // With a full slam on the analog stick, how far could we steer in either direction? INT16 steeringRight = K_UpdateSteeringValue(player->steering, KART_FULLTURN); @@ -2431,11 +2448,6 @@ static void P_UpdatePlayerAngle(player_t *player) angleChange = targetDelta; } } - else - { - // You're a bot. Go where you're supposed to go - player->steering = targetsteering; - } if (p == UINT8_MAX) { diff --git a/src/rhi/gl3_core/gl3_core_rhi.cpp b/src/rhi/gl3_core/gl3_core_rhi.cpp index 7d6481f6d..b8144788f 100644 --- a/src/rhi/gl3_core/gl3_core_rhi.cpp +++ b/src/rhi/gl3_core/gl3_core_rhi.cpp @@ -568,8 +568,6 @@ GlCoreRhi::~GlCoreRhi() = default; rhi::Handle GlCoreRhi::create_render_pass(const rhi::RenderPassDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - // GL has no formal render pass object GlCoreRenderPass pass; pass.desc = desc; @@ -578,15 +576,11 @@ rhi::Handle GlCoreRhi::create_render_pass(const rhi::RenderPass void GlCoreRhi::destroy_render_pass(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - render_pass_slab_.remove(handle); } rhi::Handle GlCoreRhi::create_texture(const rhi::TextureDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLenum internal_format = map_internal_texture_format(desc.format); SRB2_ASSERT(internal_format != GL_ZERO); GLenum format = GL_RGBA; @@ -615,8 +609,6 @@ rhi::Handle GlCoreRhi::create_texture(const rhi::TextureDesc& desc void GlCoreRhi::destroy_texture(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(texture_slab_.is_valid(handle) == true); GlCoreTexture casted = texture_slab_.remove(handle); GLuint name = casted.texture; @@ -624,16 +616,14 @@ void GlCoreRhi::destroy_texture(rhi::Handle handle) } void GlCoreRhi::update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); if (data.empty()) { @@ -678,8 +668,6 @@ void GlCoreRhi::update_texture( rhi::Handle GlCoreRhi::create_buffer(const rhi::BufferDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLenum target = map_buffer_type(desc.type); SRB2_ASSERT(target != GL_ZERO); @@ -704,10 +692,7 @@ rhi::Handle GlCoreRhi::create_buffer(const rhi::BufferDesc& desc) void GlCoreRhi::destroy_buffer(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(buffer_slab_.is_valid(handle) == true); - SRB2_ASSERT(graphics_context_active_ == false); GlCoreBuffer casted = buffer_slab_.remove(handle); GLuint name = casted.buffer; @@ -715,15 +700,14 @@ void GlCoreRhi::destroy_buffer(rhi::Handle handle) } void GlCoreRhi::update_buffer( - rhi::Handle ctx, + rhi::Handle ctx, rhi::Handle handle, uint32_t offset, tcb::span data ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); if (data.empty()) { @@ -753,11 +737,10 @@ void GlCoreRhi::update_buffer( } rhi::Handle -GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi::CreateUniformSetInfo& info) +GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi::CreateUniformSetInfo& info) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); GlCoreUniformSet uniform_set; @@ -770,14 +753,13 @@ GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi:: } rhi::Handle GlCoreRhi::create_binding_set( - rhi::Handle ctx, + rhi::Handle ctx, Handle pipeline, const rhi::CreateBindingSetInfo& info ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); SRB2_ASSERT(pipeline_slab_.is_valid(pipeline) == true); auto& pl = pipeline_slab_[pipeline]; @@ -842,8 +824,6 @@ rhi::Handle GlCoreRhi::create_binding_set( rhi::Handle GlCoreRhi::create_renderbuffer(const rhi::RenderbufferDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLuint name = 0; gl_->GenRenderbuffers(1, &name); @@ -876,8 +856,6 @@ rhi::Handle GlCoreRhi::create_renderbuffer(const rhi::Renderb void GlCoreRhi::destroy_renderbuffer(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(renderbuffer_slab_.is_valid(handle) == true); GlCoreRenderbuffer casted = renderbuffer_slab_.remove(handle); GLuint name = casted.renderbuffer; @@ -1192,8 +1170,6 @@ rhi::Handle GlCoreRhi::create_pipeline(const PipelineDesc& desc) void GlCoreRhi::destroy_pipeline(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(pipeline_slab_.is_valid(handle) == true); GlCorePipeline casted = pipeline_slab_.remove(handle); GLuint vertex_shader = casted.vertex_shader; @@ -1222,25 +1198,6 @@ void GlCoreRhi::end_graphics(rhi::Handle handle) GL_ASSERT; } -rhi::Handle GlCoreRhi::begin_transfer() -{ - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == false); - - transfer_context_generation_ += 1; - transfer_context_active_ = true; - - return rhi::Handle(0, transfer_context_generation_); -} - -void GlCoreRhi::end_transfer(rhi::Handle ctx) -{ - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - - transfer_context_active_ = false; -} - void GlCoreRhi::present() { SRB2_ASSERT(platform_ != nullptr); @@ -1269,7 +1226,7 @@ void GlCoreRhi::begin_default_render_pass(Handle ctx, bool clea gl_->ClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl_->ClearDepth(1.0f); gl_->ClearStencil(0); - gl_->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gl_->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); GL_ASSERT; } @@ -1661,7 +1618,6 @@ void GlCoreRhi::bind_binding_set(Handle ctx, Handle void GlCoreRhi::bind_index_buffer(Handle ctx, Handle buffer) { - SRB2_ASSERT(transfer_context_active_ == false); SRB2_ASSERT(graphics_context_active_ == true && graphics_context_generation_ == ctx.generation()); SRB2_ASSERT(current_render_pass_.has_value() == true && current_pipeline_.has_value() == true); diff --git a/src/rhi/gl3_core/gl3_core_rhi.hpp b/src/rhi/gl3_core/gl3_core_rhi.hpp index b5f499422..1284ea77d 100644 --- a/src/rhi/gl3_core/gl3_core_rhi.hpp +++ b/src/rhi/gl3_core/gl3_core_rhi.hpp @@ -123,10 +123,6 @@ struct GlCoreGraphicsContext : public rhi::GraphicsContext { }; -struct GlCoreTransferContext : public rhi::TransferContext -{ -}; - struct GlCoreActiveUniform { uint32_t type; @@ -159,10 +155,8 @@ class GlCoreRhi final : public Rhi std::optional> current_pipeline_; PrimitiveType current_primitive_type_ = PrimitiveType::kPoints; bool graphics_context_active_ = false; - bool transfer_context_active_ = false; uint32_t graphics_context_generation_ = 0; uint32_t index_buffer_offset_ = 0; - uint32_t transfer_context_generation_ = 0; uint8_t stencil_front_reference_ = 0; uint8_t stencil_front_compare_mask_ = 0xFF; @@ -193,26 +187,23 @@ public: virtual Rect get_renderbuffer_size(Handle renderbuffer) override; virtual uint32_t get_buffer_size(Handle buffer) override; - virtual Handle begin_transfer() override; - virtual void end_transfer(Handle handle) override; - virtual void update_buffer( - Handle ctx, + Handle ctx, Handle buffer, uint32_t offset, tcb::span data ) override; virtual void update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) override; virtual Handle - create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) override; + create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) override; virtual Handle - create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) + create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) override; virtual Handle begin_graphics() override; diff --git a/src/rhi/rhi.hpp b/src/rhi/rhi.hpp index 20f0bb7ae..3587e2b26 100644 --- a/src/rhi/rhi.hpp +++ b/src/rhi/rhi.hpp @@ -569,9 +569,6 @@ struct BindingSet { }; -struct TransferContext -{ -}; struct GraphicsContext { }; @@ -607,26 +604,22 @@ struct Rhi virtual Rect get_renderbuffer_size(Handle renderbuffer) = 0; virtual uint32_t get_buffer_size(Handle buffer) = 0; - virtual Handle begin_transfer() = 0; - virtual void end_transfer(Handle handle) = 0; - - // Transfer Context functions virtual void update_buffer( - Handle ctx, + Handle ctx, Handle buffer, uint32_t offset, tcb::span data ) = 0; virtual void update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) = 0; - virtual Handle create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) = 0; + virtual Handle create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) = 0; virtual Handle - create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) = 0; + create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) = 0; virtual Handle begin_graphics() = 0; virtual void end_graphics(Handle ctx) = 0;