From 7c5dded24fe5b5a9f2f89fddb2a4dcf18d8dc86b Mon Sep 17 00:00:00 2001 From: Karjala22 <78927981+Karjala22@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:03:15 -0500 Subject: [PATCH 1/2] Adding rotate 180 option for purple. --- TheForceEngine/TFE_DarkForces/mission.cpp | 5 +++++ TheForceEngine/TFE_DarkForces/player.cpp | 5 +++++ TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp | 1 + TheForceEngine/TFE_Input/inputMapping.cpp | 4 ++++ TheForceEngine/TFE_Input/inputMapping.h | 3 +++ TheForceEngine/TFE_Jedi/Math/fixedPoint.h | 1 + 6 files changed, 19 insertions(+) diff --git a/TheForceEngine/TFE_DarkForces/mission.cpp b/TheForceEngine/TFE_DarkForces/mission.cpp index 25766ad7d..1c6615d05 100644 --- a/TheForceEngine/TFE_DarkForces/mission.cpp +++ b/TheForceEngine/TFE_DarkForces/mission.cpp @@ -1386,6 +1386,11 @@ namespace TFE_DarkForces TFE_FrontEndUI::toggleEnhancements(); } + if (inputMapping_getActionState(IADF_ROTATE_PLAYER) == STATE_PRESSED) + { + rotate180(); + } + if (inputMapping_getActionState(IADF_AUTOMOUNT_TOGGLE) == STATE_PRESSED) { s_config.wpnAutoMount = ~s_config.wpnAutoMount; diff --git a/TheForceEngine/TFE_DarkForces/player.cpp b/TheForceEngine/TFE_DarkForces/player.cpp index 704939ae8..63bc1937c 100644 --- a/TheForceEngine/TFE_DarkForces/player.cpp +++ b/TheForceEngine/TFE_DarkForces/player.cpp @@ -3036,6 +3036,11 @@ namespace TFE_DarkForces } } + void rotate180() + { + s_playerYaw = (s_playerYaw + ANGLE_HALF) & ANGLE_MASK; + } + void player_sector(const ConsoleArgList& args) { RSector* sector = s_playerObject->sector; diff --git a/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp b/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp index 855b9c3e8..9efff07d8 100644 --- a/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp +++ b/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp @@ -2219,6 +2219,7 @@ namespace TFE_FrontEndUI inputMapping("Look Up", IADF_LOOK_UP); inputMapping("Look Down", IADF_LOOK_DN); inputMapping("Center View", IADF_CENTER_VIEW); + inputMapping("Rotate 180", IADF_ROTATE_PLAYER); inputMapping("Run", IADF_RUN); inputMapping("Walk Slowly", IADF_SLOW); inputMapping("Crouch", IADF_CROUCH); diff --git a/TheForceEngine/TFE_Input/inputMapping.cpp b/TheForceEngine/TFE_Input/inputMapping.cpp index 49614a352..e6bbd09d2 100644 --- a/TheForceEngine/TFE_Input/inputMapping.cpp +++ b/TheForceEngine/TFE_Input/inputMapping.cpp @@ -94,6 +94,9 @@ namespace TFE_Input { IADF_SCREENSHOT, ITYPE_KEYBOARD, KEY_PRINTSCREEN }, { IADF_GIF_RECORD, ITYPE_KEYBOARD, KEY_F2, KEYMOD_ALT}, { IADF_GIF_RECORD_NO_COUNTDOWN, ITYPE_KEYBOARD, KEY_F2, KEYMOD_CTRL}, + + //Player Rotation + { IADF_ROTATE_PLAYER, ITYPE_KEYBOARD, KEY_K } }; static InputBinding s_defaultControllerBinds[] = @@ -271,6 +274,7 @@ namespace TFE_Input inputMapping_addBinding(&s_defaultKeyboardBinds[IADF_SCREENSHOT]); inputMapping_addBinding(&s_defaultKeyboardBinds[IADF_GIF_RECORD]); inputMapping_addBinding(&s_defaultKeyboardBinds[IADF_GIF_RECORD_NO_COUNTDOWN]); + inputMapping_addBinding(&s_defaultKeyboardBinds[IADF_ROTATE_PLAYER]); } return true; diff --git a/TheForceEngine/TFE_Input/inputMapping.h b/TheForceEngine/TFE_Input/inputMapping.h index f8d35f81d..3b5ec0498 100644 --- a/TheForceEngine/TFE_Input/inputMapping.h +++ b/TheForceEngine/TFE_Input/inputMapping.h @@ -85,6 +85,9 @@ namespace TFE_Input IADF_GIF_RECORD, IADF_GIF_RECORD_NO_COUNTDOWN, + // 180 Rotation + IADF_ROTATE_PLAYER, + IA_COUNT, IAS_COUNT = IAS_SYSTEM_MENU + 1, }; diff --git a/TheForceEngine/TFE_Jedi/Math/fixedPoint.h b/TheForceEngine/TFE_Jedi/Math/fixedPoint.h index 398f00fa2..6125cbad8 100644 --- a/TheForceEngine/TFE_Jedi/Math/fixedPoint.h +++ b/TheForceEngine/TFE_Jedi/Math/fixedPoint.h @@ -18,6 +18,7 @@ namespace TFE_Jedi #define HALF_16 0x8000 #define ONE_16 0x10000 #define ANGLE_MASK 0x3fff + #define ANGLE_HALF 0x1fff #define ANGLE_MAX 0x4000 #define FRAC_BITS_16 16ll From 2418a3b1c9f29527e6df26add57c46bb022e116f Mon Sep 17 00:00:00 2001 From: Karjala22 <78927981+Karjala22@users.noreply.github.com> Date: Thu, 7 Nov 2024 19:16:50 -0500 Subject: [PATCH 2/2] Forgot to commit the H file. --- TheForceEngine/TFE_DarkForces/player.h | 1 + 1 file changed, 1 insertion(+) diff --git a/TheForceEngine/TFE_DarkForces/player.h b/TheForceEngine/TFE_DarkForces/player.h index 11eb02013..0ef3dc447 100644 --- a/TheForceEngine/TFE_DarkForces/player.h +++ b/TheForceEngine/TFE_DarkForces/player.h @@ -150,6 +150,7 @@ namespace TFE_DarkForces fixed16_16 player_getSquaredDistance(SecObject* obj); void player_setupCamera(); void player_applyDamage(fixed16_16 healthDmg, fixed16_16 shieldDmg, JBool playHitSound); + void rotate180(); JBool player_hasWeapon(s32 weaponIndex); JBool player_hasItem(s32 itemIndex);