From 287c711da4294d822390c501f26b62bca9d7347f Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 21 Sep 2024 04:17:00 -0400 Subject: [PATCH] Implement SetLineBlocking This could be done with Get/SetLineProperty just fine, but added just for completion's sake -- the Hexen instruction set is now fully implemented, minus SoundSequence which is for a feature we straight up don't have. --- src/acs/call-funcs.cpp | 31 +++++++++++++++++++++++++++++++ src/acs/call-funcs.hpp | 1 + src/acs/environment.cpp | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index 3283bb865..3175db90d 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -1147,6 +1147,37 @@ bool CallFunc_SetLineTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS return false; } +/*-------------------------------------------------- + bool CallFunc_SetLineBlocking(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) + + Changes a linedef's blocking flag. +--------------------------------------------------*/ +bool CallFunc_SetLineBlocking(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) +{ + mtag_t tag = 0; + UINT32 blocking = 0; + INT32 lineId = -1; + + tag = argV[0]; + + if (argV[1] != 0) + { + blocking = ML_IMPASSABLE; + } + + TAG_ITER_LINES(tag, lineId) + { + line_t *line = &lines[lineId]; + + if (line->flags & ML_TWOSIDED) // disallow changing this for 1-sided lines + { + line->flags = (line->flags & ~ML_IMPASSABLE) | blocking; + } + } + + return false; +} + /*-------------------------------------------------- bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC) diff --git a/src/acs/call-funcs.hpp b/src/acs/call-funcs.hpp index ba2dee6e8..4f79d6b6c 100644 --- a/src/acs/call-funcs.hpp +++ b/src/acs/call-funcs.hpp @@ -57,6 +57,7 @@ bool CallFunc_IsNetworkGame(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSV bool CallFunc_SectorSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_AmbientSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_SetLineTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); +bool CallFunc_SetLineBlocking(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_ThingSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 0a4939811..4cfb05d20 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -88,7 +88,7 @@ Environment::Environment() addCodeDataACS0( 95, {"", 2, addCallFunc(CallFunc_AmbientSound)}); addCodeDataACS0( 97, {"", 4, addCallFunc(CallFunc_SetLineTexture)}); - + addCodeDataACS0( 98, {"", 2, addCallFunc(CallFunc_SetLineBlocking)}); addCodeDataACS0( 99, {"", 7, addCallFunc(CallFunc_SetLineSpecial)}); addCodeDataACS0(100, {"", 3, addCallFunc(CallFunc_ThingSound)}); addCodeDataACS0(101, {"", 0, addCallFunc(CallFunc_EndPrintBold)});