Skip to content

Commit

Permalink
Merged DavideRei PR: Read mobtypes.txt and handle standard and custom…
Browse files Browse the repository at this point in the history
… creatures animations #1266
  • Loading branch information
cbnolok committed Aug 10, 2024
1 parent 7a9a90c commit cef9cc2
Show file tree
Hide file tree
Showing 17 changed files with 1,662 additions and 153 deletions.
50 changes: 50 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3808,3 +3808,53 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
New values:
SPELLFLAG_FIELD_RANDOMDECAY 02000
SPELLFLAG_NO_ELEMENTALENGINE 04000

10-08-2024, DavideRei
- Added: read mobtypes.txt (if available among mul files) and cache it to check animations type when using creatures animations
- Added: alert anim on NPCs when they start combat, pillage anim when they loot something (items on ground or in bodies) and "summon" anim when they are summoned or added
- Modified: now standard anims (SEA_MONSTER, ANIMAL, MONSTER) and UOP anims are handled correctly depending on which actions anim they have on anim files (checked on last client version).
Please note that some actions are handled by the client (for example walk, run, fly, getHit while flying, die) and they could not work depending on which client you are using.
- Added: missing/new actions to be used with .ANIM command.
ANIM_ALERT = 35,
ANIM_THROW = 36,
ANIM_PILLAGE = 37,
ANIM_STOMP = 38,
ANIM_FLY = 39,
ANIM_LAND = 40,
ANIM_GETHIT_AIR = 41,
ANIM_SUMMON = 42,
ANIM_SPECIAL = 43, //UOP anims
ANIM_BOSS_SPECIAL_1 = 44, //Only few UOP anims: Order Variant, Chaos Variant, Stygian Dragon, Scalis
ANIM_BOSS_SPECIAL_2 = 45, //Only few UOP anims: Order Variant, Chaos Variant, Stygian Dragon, Scalis

- Modified: now custom anims can be handled by scripts using ANIM command under CHARDEF, to set which anim actions they have/don't have, using the following flags.
MONSTER (H slot) default configuration is with actions: 0 (Walk), 1 (Stand), 2 (Die1), 3 (Die2), 4 (Attack1), 5 (Attack2), 6 (Attack3), 10 (GetHit), 11 (Pillage), 15 (Block Right), 16 (Block Left), 17 (Idle), 18 (Fidget)
No DIE2 action = 01,
No ATTACK1 action = 02,
No ATTACK2 action = 04,
No ATTACK3 action = 08,
No GETHIT action = 010,
No PILLAGE action = 020,
STOMP action = 040,
CAST2 action = 080,
CAST3 action = 0100,
No BLOCKR action = 0200,
No BLOCKL action = 0400,
No FIDGET1 action = 0800,
No FIDGET2 action = 01000,
FLY action = 02000,
Anims with Attacks 1-2-3 in actions 9,10,11 and with GetHit in action 20 (there are many custom WOW anims with this configuration) = 0x10000

ANIMAL (L slot) default configuration is with all actions: 1 - 12
No EAT action = 01,
No ALERT action = 02,
No ATTACK2 action = 04,
No GETHIT action = 08,
No FIDGET1 action = 010,
No FIDGET2 action = 020,
No LIEDOWN action = 040,
No DIE2 action = 080

So for example if you have a MONSTER (H slot) flying custom anim, with Cast2 action but not Pillage action you can set ANIM=020A0
If you have a custom anim with default configuration, you don't need to set ANIM=

2 changes: 2 additions & 0 deletions src/CMakeSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ src/game/uo_files/CUOMapList.h
src/game/uo_files/CUOMapList.cpp
src/game/uo_files/CUOMapMeter.h
src/game/uo_files/CUOMapMeter.cpp
src/game/uo_files/CUOMobtypes.h
src/game/uo_files/CUOMobtypes.cpp
src/game/uo_files/CUOMultiItemRec.h
src/game/uo_files/CUOMultiItemRec.cpp
src/game/uo_files/CUOStaticItemRec.h
Expand Down
5 changes: 5 additions & 0 deletions src/common/CUOInstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,11 @@ VERFILE_TYPE CUOInstall::OpenFiles( ullong ullMask )

m_tiledata.Load();

if (g_Cfg.m_fUseMobTypes)
{
m_mobtypes.Load();
}

return (VERFILE_TYPE)i;
}

Expand Down
3 changes: 3 additions & 0 deletions src/common/CUOInstall.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "../game/uo_files/CUOTiledata.h"
#include "../game/uo_files/CUOIndexRec.h"
#include "../game/uo_files/CUOMapList.h"
#include "../game/uo_files/CUOMobtypes.h"
#include "sphere_library/CSFile.h"
#include "CSVFile.h"

Expand Down Expand Up @@ -52,6 +53,8 @@ extern struct CUOInstall

CSVFile m_CsvFiles[8]; // doors.txt, stairs.txt (x2), roof.txt, misc.txt, teleprts.txt, floors.txt, walls.txt

CUOMobTypes m_mobtypes;

public:
CSString GetFullExePath( lpctstr pszName = nullptr ) const;
CSString GetFullCDPath( lpctstr pszName = nullptr ) const;
Expand Down
3 changes: 3 additions & 0 deletions src/game/CServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CServerConfig::CServerConfig()
_iMapCacheTime = 2ll * 60 * MSECS_PER_SEC;
_iSectorSleepDelay = 10ll * 60 * MSECS_PER_SEC;
m_fUseMapDiffs = false;
m_fUseMobTypes = false;

m_iDebugFlags = 0; //DEBUGF_NPC_EMOTE
m_fSecure = true;
Expand Down Expand Up @@ -707,6 +708,7 @@ enum RC_TYPE
RC_USEEXTRABUFFER, // m_fUseExtraBuffer
RC_USEHTTP, // m_fUseHTTP
RC_USEMAPDIFFS, // m_fUseMapDiffs
RC_USEMOBTYPES, // m_fUseMobTypes
RC_USENOCRYPT, // m_Usenocrypt
RC_USEPACKETPRIORITY, // m_fUsePacketPriorities
RC_VENDORMARKUP, // m_iVendorMarkup
Expand Down Expand Up @@ -992,6 +994,7 @@ const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY + 1]
{ "USEEXTRABUFFER", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fUseExtraBuffer) }},
{ "USEHTTP", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_fUseHTTP) }},
{ "USEMAPDIFFS", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fUseMapDiffs) }},
{ "USEMOBTYPES", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fUseMobTypes) } },
{ "USENOCRYPT", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fUsenocrypt) }}, // we don't want no-crypt clients
{ "USEPACKETPRIORITY", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fUsePacketPriorities) }},
{ "VENDORMARKUP", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iVendorMarkup) }},
Expand Down
1 change: 1 addition & 0 deletions src/game/CServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ extern class CServerConfig : public CResourceHolder
int64 _iMapCacheTime; // Time in sec to keep unused map data..
int64 _iSectorSleepDelay; // The mask for how long sectors will sleep.
bool m_fUseMapDiffs; // Whether or not to use map diff files.
bool m_fUseMobTypes; // Whether or not to use mobtypes.txt file.

CSString m_sWorldBaseDir; // save\" = world files go here.
CSString m_sAcctBaseDir; // Where do the account files go/come from ?
Expand Down
Loading

0 comments on commit cef9cc2

Please sign in to comment.