From 60113bb0b8defadbff7eeb5dd8807cd43dae66be Mon Sep 17 00:00:00 2001 From: staphen Date: Sun, 30 Jun 2024 17:09:01 -0400 Subject: [PATCH] Fix brightness of whu casting animations --- CMake/Assets.cmake | 3 +++ Source/engine/trn.cpp | 12 ++++++++++++ Source/engine/trn.hpp | 1 + Source/player.cpp | 10 +++++++--- assets/plrgfx/warrior/whu/whufm.trn | Bin 0 -> 256 bytes assets/plrgfx/warrior/whu/whulm.trn | Bin 0 -> 256 bytes assets/plrgfx/warrior/whu/whuqm.trn | Bin 0 -> 256 bytes 7 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 assets/plrgfx/warrior/whu/whufm.trn create mode 100644 assets/plrgfx/warrior/whu/whulm.trn create mode 100644 assets/plrgfx/warrior/whu/whuqm.trn diff --git a/CMake/Assets.cmake b/CMake/Assets.cmake index 66d6dbd0d..4af5991a6 100644 --- a/CMake/Assets.cmake +++ b/CMake/Assets.cmake @@ -148,6 +148,9 @@ set(devilutionx_assets nlevels/cutl6w.clx nlevels/l5data/cornerstone.dun nlevels/l5data/uberroom.dun + plrgfx/warrior/whu/whufm.trn + plrgfx/warrior/whu/whulm.trn + plrgfx/warrior/whu/whuqm.trn txtdata/Experience.tsv txtdata/classes/barbarian/attributes.tsv txtdata/classes/bard/attributes.tsv diff --git a/Source/engine/trn.cpp b/Source/engine/trn.cpp index 051353672..578bc3dbc 100644 --- a/Source/engine/trn.cpp +++ b/Source/engine/trn.cpp @@ -65,4 +65,16 @@ std::optional> GetClassTRN(Player &player) return std::nullopt; } +std::optional> GetPlayerGraphicTRN(const char *pszName) +{ + char path[MaxMpqPathSize]; + *BufCopy(path, pszName, ".trn") = '\0'; + + std::array trn; + if (LoadOptionalFileInMem(path, &trn[0], 256)) { + return trn; + } + return std::nullopt; +} + } // namespace devilution diff --git a/Source/engine/trn.hpp b/Source/engine/trn.hpp index 3f682a742..42f379c82 100644 --- a/Source/engine/trn.hpp +++ b/Source/engine/trn.hpp @@ -16,5 +16,6 @@ uint8_t *GetInfravisionTRN(); uint8_t *GetStoneTRN(); uint8_t *GetPauseTRN(); std::optional> GetClassTRN(Player &player); +std::optional> GetPlayerGraphicTRN(const char *pszName); } // namespace devilution diff --git a/Source/player.cpp b/Source/player.cpp index fdd78b0a3..45fb5e26d 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2134,9 +2134,13 @@ void LoadPlrGFX(Player &player, player_graphic graphic) *fmt::format_to(pszName, R"(plrgfx\{0}\{1}\{1}{2})", path, std::string_view(prefix, 3), szCel) = 0; const uint16_t animationWidth = GetPlayerSpriteWidth(cls, graphic, animWeaponId); animationData.sprites = LoadCl2Sheet(pszName, animationWidth); - std::optional> trn = GetClassTRN(player); - if (trn) { - ClxApplyTrans(*animationData.sprites, trn->data()); + std::optional> graphicTRN = GetPlayerGraphicTRN(pszName); + if (graphicTRN) { + ClxApplyTrans(*animationData.sprites, graphicTRN->data()); + } + std::optional> classTRN = GetClassTRN(player); + if (classTRN) { + ClxApplyTrans(*animationData.sprites, classTRN->data()); } } diff --git a/assets/plrgfx/warrior/whu/whufm.trn b/assets/plrgfx/warrior/whu/whufm.trn new file mode 100644 index 0000000000000000000000000000000000000000..34b6a5cf9a14339f1d39a88268c788a35408c05c GIT binary patch literal 256 zcmV+b0ssC00RjUA1qKHQ2?`4g4Gs?w5fT#=6&4p585$cL9UdPbAtECrB_<~*DJm;0 zEiNxGF)}kWH8wXmIXXK$Jw87`K|(`BMMg(RNlHshO-@fxQBqS>RaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUxcfPsU9gM^2OiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)>C|NsC0|FE!tvb46iy1l-@!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dY|NsC0|Nrsw^Y!=n G`~Cl2?SYp7 literal 0 HcmV?d00001 diff --git a/assets/plrgfx/warrior/whu/whulm.trn b/assets/plrgfx/warrior/whu/whulm.trn new file mode 100644 index 0000000000000000000000000000000000000000..34b6a5cf9a14339f1d39a88268c788a35408c05c GIT binary patch literal 256 zcmV+b0ssC00RjUA1qKHQ2?`4g4Gs?w5fT#=6&4p585$cL9UdPbAtECrB_<~*DJm;0 zEiNxGF)}kWH8wXmIXXK$Jw87`K|(`BMMg(RNlHshO-@fxQBqS>RaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUxcfPsU9gM^2OiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)>C|NsC0|FE!tvb46iy1l-@!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dY|NsC0|Nrsw^Y!=n G`~Cl2?SYp7 literal 0 HcmV?d00001 diff --git a/assets/plrgfx/warrior/whu/whuqm.trn b/assets/plrgfx/warrior/whu/whuqm.trn new file mode 100644 index 0000000000000000000000000000000000000000..34b6a5cf9a14339f1d39a88268c788a35408c05c GIT binary patch literal 256 zcmV+b0ssC00RjUA1qKHQ2?`4g4Gs?w5fT#=6&4p585$cL9UdPbAtECrB_<~*DJm;0 zEiNxGF)}kWH8wXmIXXK$Jw87`K|(`BMMg(RNlHshO-@fxQBqS>RaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUxcfPsU9gM^2OiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)>C|NsC0|FE!tvb46iy1l-@!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dY|NsC0|Nrsw^Y!=n G`~Cl2?SYp7 literal 0 HcmV?d00001