Autor Tema: Custom Monsters without NPC Animation BUG 1.04e - By LTP-Team.com  (Leído 1417 veces)

ltpteam

This code has been used in my server files for about 1 year and has no bugs.
Have a good day =)

Código

#define sub_969C50_Addr ((int(__thiscall*)(int This, signed int a2)) 0x969C50)
#define pOpenMonsterModel ((void(__cdecl*)(int MonsterID)) 0x61FDE0)
#define pLoadModel ((void(__cdecl*)(int ResourceID, char * Path, char * File, int Arg4)) 0x614D10)
#define pLoadTexture ((void(__cdecl*)(int TextureID, char * Folder, int GLREPEAT, int GLNEAREST, int GLTRUE)) 0x614710)
#define pGetViewStruct ((lpViewObj(__cdecl*)(int a1, signed int a2, unsigned __int8 a3, unsigned __int8 a4, float a5)) 0x57EEC0)
#define pShowMonster ((lpViewObj(__cdecl*)(int MonsterID, int X, int Y, int a4)) 0x580FC0)

lpViewObj cCustomMonsters::ShowMonster(int MonsterID, int a2, int a3, int a4)
{
CUSTOMMONSTERS_DATA* lpInfo = gCustomMonsters.GetInfoByMonsterID(MonsterID);

if (lpInfo == nullptr)
{
return pShowMonster(MonsterID, a2, a3, a4);
}

if (lpInfo->Type == 0)
{
int ModelID = MonsterID + MONSTER_MODEL;
int BMD = sub_969C50_Addr(sub_4CDA10_Addr(), ModelID);

pLoadModel(ModelID, lpInfo->Dir, lpInfo->BMDFile, -1);
pLoadTexture(ModelID, lpInfo->Folder, 0x2901, 0x2600, 1);

for ( int m = 0; ; ++m )
{
if ( m >= *(signed __int16 *)(BMD + 38) )
break;
*(float *)(*(DWORD *)(BMD + 48) + 16 * m + 4) = 0.25;
}
}
else
{
pOpenMonsterModel(MonsterID);
}

lpViewObj Object = pGetViewStruct(a4, MonsterID + MONSTER_MODEL, a2, a3, 0.0);

if ( Object == nullptr )
{
return pShowMonster(MonsterID, a2, a3, a4);
}
// ----
memcpy(Object->Name, lpInfo->Name, sizeof(lpInfo->Name));
// ----
if(lpInfo->Type == 0)
{
Object->m_Model.ObjectType = emNPC;
}
else
{
Object->m_Model.ObjectType = emMonster;
}

Object->m_Model.Scale = lpInfo->Size;
Object->ID = MonsterID;

cCustomMonsters::SetMainAttribute(Object, MonsterID);

return Object;
}

Gracias:


 

.