Permalink
Browse files

Merge branch 'master' into fast_lookup_byindex

  • Loading branch information...
codenulls committed Dec 13, 2018
2 parents 41592d1 + 3b154bc commit d17619f9bf6ec017fca0e1ef828095845ecec314
Showing with 4,226 additions and 375 deletions.
  1. +8 −8 Client/core/CCore.cpp
  2. +12 −5 Client/core/CGraphStats.cpp
  3. +15 −15 Client/mods/deathmatch/logic/CClientGame.cpp
  4. +2 −2 Client/mods/deathmatch/logic/CClientGame.h
  5. +1 −47 Client/multiplayer_sa/CMultiplayerSA.cpp
  6. +2 −1 Client/multiplayer_sa/CMultiplayerSA.h
  7. +6 −5 Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp
  8. +91 −0 Client/multiplayer_sa/CMultiplayerSA_VehicleWeapons.cpp
  9. +15 −5 Client/sdk/multiplayer/CMultiplayer.h
  10. +2 −1 Server/mods/deathmatch/logic/CResourceChecker.Data.h
  11. +1 −1 Shared/XML/CXMLFileImpl.cpp
  12. +6 −6 Shared/data/MTA San Andreas/MTA/locale/ar/client.po
  13. +4 −4 Shared/data/MTA San Andreas/MTA/locale/el/client.po
  14. +4 −5 Shared/data/MTA San Andreas/MTA/locale/hr/client.po
  15. +5 −4 Shared/data/MTA San Andreas/MTA/locale/id/client.po
  16. +4 −4 Shared/data/MTA San Andreas/MTA/locale/ja/client.po
  17. +63 −55 Shared/data/MTA San Andreas/MTA/locale/lt/client.po
  18. +13 −12 Shared/data/MTA San Andreas/MTA/locale/mk/client.po
  19. +9 −9 Shared/data/MTA San Andreas/MTA/locale/nl/client.po
  20. +4 −3 Shared/data/MTA San Andreas/MTA/locale/pl/client.po
  21. +3 −3 Shared/data/MTA San Andreas/MTA/locale/pt_BR/client.po
  22. +11 −5 Shared/data/MTA San Andreas/MTA/locale/ru/client.po
  23. BIN Shared/data/MTA San Andreas/MTA/locale/sk/menu_about.png
  24. BIN Shared/data/MTA San Andreas/MTA/locale/sk/menu_browse_servers.png
  25. BIN Shared/data/MTA San Andreas/MTA/locale/sk/menu_quick_connect.png
  26. BIN Shared/data/MTA San Andreas/MTA/locale/sk/menu_settings.png
  27. +192 −147 Shared/data/MTA San Andreas/MTA/locale/sv/client.po
  28. +17 −10 Shared/data/MTA San Andreas/MTA/locale/tr/client.po
  29. +12 −6 Shared/data/MTA San Andreas/MTA/locale/uk/client.po
  30. +3,208 −0 Shared/data/MTA San Andreas/MTA/locale/vi/client.po
  31. BIN Shared/data/MTA San Andreas/MTA/locale/vi/flag.png
  32. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_about.png
  33. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_browse_servers.png
  34. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_disconnect.png
  35. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_host_game.png
  36. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_map_editor.png
  37. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_quick_connect.png
  38. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_quit.png
  39. BIN Shared/data/MTA San Andreas/MTA/locale/vi/menu_settings.png
  40. +3 −3 Shared/data/MTA San Andreas/MTA/locale/zh_CN/client.po
  41. +9 −5 Shared/installer/locale/lt.po
  42. +500 −0 Shared/installer/locale/vi.po
  43. +1 −1 utils/buildactions/install_cef.lua
  44. +2 −2 utils/pull_pootle_catalogs_main.bat
  45. +1 −1 utils/pull_pootle_menu_pics_main.bat
@@ -1801,15 +1801,15 @@ void CCore::ApplyFrameRateLimit(uint uiOverrideRate)

uint uiUseRate = uiOverrideRate != -1 ? uiOverrideRate : m_uiFrameRateLimit;

if (uiUseRate < 1)
return DoReliablePulse();

// Apply previous frame rate if is hasn't been done yet
ApplyQueuedFrameRateLimit();
if (uiUseRate > 0)
{
// Apply previous frame rate if is hasn't been done yet
ApplyQueuedFrameRateLimit();

// Limit is usually applied in OnGameTimerUpdate
m_uiQueuedFrameRate = uiUseRate;
m_bQueuedFrameRateValid = true;
// Limit is usually applied in OnGameTimerUpdate
m_uiQueuedFrameRate = uiUseRate;
m_bQueuedFrameRateValid = true;
}

DoReliablePulse();

@@ -207,12 +207,14 @@ void CGraphStats::Draw(void)
uint uiSizeY = 150;
uint uiRangeY = 100; // 100ms
float fLineScale = 1 / 1000.f / uiRangeY * uiSizeY;
float fHalfLineHeight = pGraphics->GetDXFontHeight() / 2;
float fLineHeight = pGraphics->GetDXFontHeight();

// Backgroung box
pGraphics->DrawRectQueued(uiOriginX, uiOriginY - uiSizeY, uiSizeX, uiSizeY, SColorRGBA(0, 0, 0, 128), true);

// Draw data line.
// Draw data lines
float fLabelX = uiOriginX + uiSizeX + 22;
float fLabelY = uiOriginY - m_LineList.size() * fLineHeight;
for (const auto& dataLine : m_LineList)
{
const SGraphStatLine& line = dataLine.second;
@@ -230,10 +232,15 @@ void CGraphStats::Draw(void)
iDataPos = GRAPHSTAT_HISTORY_SIZE - 1;

pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, uiOriginX + i, uiOriginY - fY1, 1, line.color, true);

if (i == uiSizeX - 1)
{
// Line from graph to label
pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, fLabelX - 2, fLabelY + fLineHeight / 2, 1, line.color, true);
}
}

float fX = uiOriginX + uiSizeX + 2;
float fY = uiOriginY - line.dataHistory[line.iDataPos] * fLineScale - fHalfLineHeight;
pGraphics->DrawStringQueued(fX, fY, fX, fY, line.color, line.strName.c_str(), 1.0f, 1.0f, DT_NOCLIP, nullptr, true);
pGraphics->DrawStringQueued(fLabelX, fLabelY, fLabelX, fLabelY, line.color, line.strName.c_str(), 1.0f, 1.0f, DT_NOCLIP, nullptr, true);
fLabelY += fLineHeight;
}
}
@@ -283,7 +283,7 @@ CClientGame::CClientGame(bool bLocalPlay)
g_pMultiplayer->SetFxSystemDestructionHandler(CClientGame::StaticFxSystemDestructionHandler);
g_pMultiplayer->SetDrivebyAnimationHandler(CClientGame::StaticDrivebyAnimationHandler);
g_pMultiplayer->SetPedStepHandler(CClientGame::StaticPedStepHandler);
g_pMultiplayer->SetWaterCannonHitWorldHandler(CClientGame::StaticWaterCannonHitWorldHandler);
g_pMultiplayer->SetVehicleWeaponHitHandler(CClientGame::StaticVehicleWeaponHitHandler);
g_pGame->SetPreWeaponFireHandler(CClientGame::PreWeaponFire);
g_pGame->SetPostWeaponFireHandler(CClientGame::PostWeaponFire);
g_pGame->SetTaskSimpleBeHitHandler(CClientGame::StaticTaskSimpleBeHitHandler);
@@ -445,7 +445,7 @@ CClientGame::~CClientGame(void)
g_pMultiplayer->SetGameEntityRenderHandler(NULL);
g_pMultiplayer->SetDrivebyAnimationHandler(nullptr);
g_pMultiplayer->SetPedStepHandler(nullptr);
g_pMultiplayer->SetWaterCannonHitWorldHandler(nullptr);
g_pMultiplayer->SetVehicleWeaponHitHandler(nullptr);
g_pGame->SetPreWeaponFireHandler(NULL);
g_pGame->SetPostWeaponFireHandler(NULL);
g_pGame->SetTaskSimpleBeHitHandler(NULL);
@@ -2752,7 +2752,6 @@ void CClientGame::AddBuiltInEvents(void)
m_Events.AddEvent("onClientElementStreamIn", "", NULL, false);
m_Events.AddEvent("onClientElementStreamOut", "", NULL, false);
m_Events.AddEvent("onClientElementDestroy", "", NULL, false);
m_Events.AddEvent("onClientElementHitByWaterCannon", "vehicle, hitX, hitY, hitZ, normalX, normalY, normalZ, model, materialID", nullptr, false);

// Player events
m_Events.AddEvent("onClientPlayerJoin", "", NULL, false);
@@ -2803,6 +2802,7 @@ void CClientGame::AddBuiltInEvents(void)
m_Events.AddEvent("onClientVehicleCollision", "collidedelement, damageImpulseMag, bodypart, x, y, z, velX, velY, velZ", NULL, false);
m_Events.AddEvent("onClientVehicleDamage", "attacker, weapon, loss, x, y, z, tyre", NULL, false);
m_Events.AddEvent("onClientVehicleNitroStateChange", "activated", NULL, false);
m_Events.AddEvent("onClientVehicleWeaponHit", "weaponType, hitElement, hitX, hitY, hitZ, model, materialID", nullptr, false);

// GUI events
m_Events.AddEvent("onClientGUIClick", "button, state, absoluteX, absoluteY", NULL, false);
@@ -3814,9 +3814,9 @@ void CClientGame::StaticPedStepHandler(CPedSAInterface* pPed, bool bFoot)
return g_pClientGame->PedStepHandler(pPed, bFoot);
}

void CClientGame::StaticWaterCannonHitWorldHandler(SWaterCannonHitEvent& event)
void CClientGame::StaticVehicleWeaponHitHandler(SVehicleWeaponHitEvent& event)
{
g_pClientGame->WaterCannonHitWorldHandler(event);
g_pClientGame->VehicleWeaponHitHandler(event);
}

void CClientGame::DrawRadarAreasHandler(void)
@@ -6901,7 +6901,7 @@ void CClientGame::PedStepHandler(CPedSAInterface* pPedSA, bool bFoot)
}
}

void CClientGame::WaterCannonHitWorldHandler(SWaterCannonHitEvent& event)
void CClientGame::VehicleWeaponHitHandler(SVehicleWeaponHitEvent& event)
{
CPools* pPools = g_pGame->GetPools();
SClientEntity<CVehicleSA>* pVehicleEntity = pPools->GetVehicle((DWORD*)event.pGameVehicle);
@@ -6918,18 +6918,18 @@ void CClientGame::WaterCannonHitWorldHandler(SWaterCannonHitEvent& event)

CClientEntity* pEntity = event.pHitGameEntity ? pPools->GetClientEntity((DWORD*)event.pHitGameEntity) : nullptr;

if (!pEntity)
pEntity = m_pRootEntity;

CLuaArguments arguments;
arguments.PushElement(pVehicle);
arguments.PushNumber(static_cast<int>(event.weaponType));

if (pEntity)
arguments.PushElement(pEntity);
else
arguments.PushBoolean(false);

arguments.PushNumber(event.vecPosition.fX);
arguments.PushNumber(event.vecPosition.fY);
arguments.PushNumber(event.vecPosition.fZ);
arguments.PushNumber(event.vecNormal.fX);
arguments.PushNumber(event.vecNormal.fY);
arguments.PushNumber(event.vecNormal.fZ);
arguments.PushNumber(event.iModel);
arguments.PushNumber(event.ucColSurface);
pEntity->CallEvent("onClientElementHitByWaterCannon", arguments, false);
arguments.PushNumber(event.iColSurface);
pVehicle->CallEvent("onClientVehicleWeaponHit", arguments, false);
}
@@ -525,7 +525,7 @@ class CClientGame
static void StaticTaskSimpleBeHitHandler(CPedSAInterface* pPedAttacker, ePedPieceTypes hitBodyPart, int hitBodySide, int weaponId);
static void StaticFxSystemDestructionHandler(void* pFxSAInterface);
static void StaticPedStepHandler(CPedSAInterface* pPed, bool bFoot);
static void StaticWaterCannonHitWorldHandler(SWaterCannonHitEvent& event);
static void StaticVehicleWeaponHitHandler(SVehicleWeaponHitEvent& event);

static AnimationId StaticDrivebyAnimationHandler(AnimationId animGroup, AssocGroupId animId);

@@ -616,7 +616,7 @@ class CClientGame
void RemoveAnimationAssociationFromMap(CAnimBlendAssociationSAInterface* pAnimAssociation);

void PedStepHandler(CPedSAInterface* pPed, bool bFoot);
void WaterCannonHitWorldHandler(SWaterCannonHitEvent& event);
void VehicleWeaponHitHandler(SVehicleWeaponHitEvent& event);

private:
eStatus m_Status;
@@ -291,9 +291,6 @@ DWORD dwFUNC_CAEVehicleAudioEntity__ProcessAIProp = FUNC_CAEVehicleAudioEntity__
#define HOOKPOS_CTaskSimpleSwim_ProcessSwimmingResistance 0x68A4EF
DWORD RETURN_CTaskSimpleSwim_ProcessSwimmingResistance = 0x68A50E;

#define HOOKPOS_CWaterCannon__Render 0x72932A
static DWORD CONTINUE_CWaterCannon__Render = 0x72932F;

CPed* pContextSwitchedPed = 0;
CVector vecCenterOfWorld;
FLOAT fFalseHeading;
@@ -360,7 +357,6 @@ ObjectDamageHandler* m_pObjectDamageHandler = NULL;
ObjectBreakHandler* m_pObjectBreakHandler = NULL;
FxSystemDestructionHandler* m_pFxSystemDestructionHandler = NULL;
DrivebyAnimationHandler* m_pDrivebyAnimationHandler = NULL;
WaterCannonHitWorldHandler* m_pWaterCannonHitWorldHandler = nullptr;

CEntitySAInterface* dwSavedPlayerPointer = 0;
CEntitySAInterface* activeEntityForStreaming = 0; // the entity that the streaming system considers active
@@ -512,8 +508,6 @@ void HOOK_CAEVehicleAudioEntity__ProcessDummyProp();

void HOOK_CTaskSimpleSwim_ProcessSwimmingResistance();

static void HOOK_CWaterCannon__Render();

CMultiplayerSA::CMultiplayerSA()
{
// Unprotect all of the GTASA code at once and leave it that way
@@ -735,8 +729,6 @@ void CMultiplayerSA::InitHooks()
// Fix GTA:SA swimming speed problem on higher fps
HookInstall(HOOKPOS_CTaskSimpleSwim_ProcessSwimmingResistance, (DWORD)HOOK_CTaskSimpleSwim_ProcessSwimmingResistance, 6);

HookInstall(HOOKPOS_CWaterCannon__Render, (DWORD)HOOK_CWaterCannon__Render, 5);

// Disable GTA setting g_bGotFocus to false when we minimize
MemSet((void*)ADDR_GotFocus, 0x90, pGameInterface->GetGameVersion() == VERSION_EU_10 ? 6 : 10);

@@ -1502,6 +1494,7 @@ void CMultiplayerSA::InitHooks()
InitHooks_FixLineOfSightArgs();
InitHooks_VehicleDamage();
InitHooks_VehicleLights();
InitHooks_VehicleWeapons();
}

// Used to store copied pointers for explosions in the FxSystem
@@ -2272,11 +2265,6 @@ void CMultiplayerSA::SetDrivebyAnimationHandler(DrivebyAnimationHandler* pHandle
m_pDrivebyAnimationHandler = pHandler;
}

void CMultiplayerSA::SetWaterCannonHitWorldHandler(WaterCannonHitWorldHandler* pHandler)
{
m_pWaterCannonHitWorldHandler = pHandler;
}

// What we do here is check if the idle handler has been set
bool CMultiplayerSA::IsConnected(void)
{
@@ -6790,37 +6778,3 @@ void _declspec(naked) HOOK_CTaskSimpleSwim_ProcessSwimmingResistance()
jmp RETURN_CTaskSimpleSwim_ProcessSwimmingResistance
}
}

static void __cdecl WaterCannonHitWorld(CVehicleSAInterface* pGameVehicle, CColPointSAInterface* pColPoint, CEntitySAInterface** ppGameEntity)
{
if (m_pWaterCannonHitWorldHandler)
{
CEntitySAInterface* const pGameEntity = ppGameEntity ? *ppGameEntity : nullptr;
const int iModel = pGameEntity ? pGameEntity->m_nModelIndex : -1;

SWaterCannonHitEvent event = {
pGameVehicle, pGameEntity, pColPoint->Position, pColPoint->Normal, iModel, pColPoint->ucSurfaceTypeB,
};

m_pWaterCannonHitWorldHandler(event);
}
}

static void _declspec(naked) HOOK_CWaterCannon__Render()
{
_asm
{
pushad
mov eax, [ebx] // CVehicleSAInterface* CWaterCannon::m_pVehicle
lea ebx, [esp + 100h - 54h] // CColPointSAInterface*
lea ecx, [esp + 100h - 58h] // CEntitySAInterface**
push ecx // ppGameEntity
push ebx // pColPoint
push eax // pGameVehicle
call WaterCannonHitWorld
add esp, 12
popad
push 3E4CCCCDh
jmp CONTINUE_CWaterCannon__Render
}
}
@@ -71,6 +71,7 @@ class CMultiplayerSA : public CMultiplayer
void InitHooks_LicensePlate(void);
void InitHooks_VehicleLights(void);
void InitHooks_VehicleDamage(void);
void InitHooks_VehicleWeapons();
void InitHooks_Direct3D(void);
void InitHooks_FixLineOfSightArgs(void);
CRemoteDataStorage* CreateRemoteDataStorage();
@@ -135,7 +136,7 @@ class CMultiplayerSA : public CMultiplayer
void SetFxSystemDestructionHandler(FxSystemDestructionHandler* pHandler);
void SetDrivebyAnimationHandler(DrivebyAnimationHandler* pHandler);
void SetPedStepHandler(PedStepHandler* pHandler);
void SetWaterCannonHitWorldHandler(WaterCannonHitWorldHandler* pHandler);
void SetVehicleWeaponHitHandler(VehicleWeaponHitHandler* pHandler) override;

void AllowMouseMovement(bool bAllow);
void DoSoundHacksOnLostFocus(bool bLostFocus);
@@ -18,18 +18,19 @@ CAnimBlendAssocGroupSAInterface* getAnimAssocGroupInterface(AssocGroupId animGro
// Check for anims that will crash and change to one that wont. (The new anim will be wrong and look crap though)
int _cdecl OnCAnimBlendAssocGroupCopyAnimation_FixBadAnim(AssocGroupId* pAnimGroup, int* pAnimId)
{
// if we exceed total animGroup then it means crash is about to happen
if (*pAnimGroup >= TOTAL_ANIM_GROUPS)
CAnimBlendAssocGroupSAInterface* pGroup = getAnimAssocGroupInterface(*pAnimGroup);

DWORD * pInterface = reinterpret_cast<DWORD*>(pGroup);
if (pInterface == (DWORD*)0x50 || pInterface == (DWORD*)0xA0)
{
LogEvent(534, "CopyAnimation", "Incorrect Group ID", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId));
LogEvent(534, "CopyAnimation", "Incorrect Group Interface", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId), 534);

// switch to idle animation
*pAnimGroup = ANIM_GROUP_DEFAULT;
*pAnimId = 3;
pGroup = getAnimAssocGroupInterface(*pAnimGroup);
}

auto pGroup = getAnimAssocGroupInterface(*pAnimGroup);

// Apply offset
int iUseAnimId = *pAnimId - pGroup->iIDOffset;

@@ -0,0 +1,91 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* LICENSE: See LICENSE in the top level directory
* FILE: multiplayer_sa/CMultiplayerSA_VehicleWeapons.cpp
*
* Multi Theft Auto is available from https://www.multitheftauto.com/
*
*****************************************************************************/
#include "StdInc.h"

VehicleWeaponHitHandler* pVehicleWeaponHitHandler = nullptr;

void CMultiplayerSA::SetVehicleWeaponHitHandler(VehicleWeaponHitHandler* pHandler)
{
pVehicleWeaponHitHandler = pHandler;
}

static void TriggerVehicleWeaponHitEvent(EVehicleWeaponType weaponType, CVehicleSAInterface* pGameVehicle, CEntitySAInterface* pHitGameEntity, CVector& vecPosition, int iModel, int iSurfaceType)
{
if (!pVehicleWeaponHitHandler)
return;

SVehicleWeaponHitEvent event = {
weaponType,
pGameVehicle,
pHitGameEntity,
vecPosition,
iModel,
iSurfaceType,
};

pVehicleWeaponHitHandler(event);
}

//////////////////////////////////////////////////////////////////////////////////////////
//
// CWaterCannon::Render()
//
// Calculates the destination of the water stream, renders the splash fx there and
// informs the water cannon audio entity.
//
//////////////////////////////////////////////////////////////////////////////////////////
// 0x729324 | 0F 84 1C 02 00 00 | jz 0x729546
// >>> 0x72932A | 68 CD CC 4C 3E | push 3E4CCCCDh
// 0x72932F | 68 00 00 80 3F | push 3F800000h
#define HOOKPOS_CWaterCannon__Render 0x72932A
#define HOOKSIZE_CWaterCannon__Render 5
static DWORD CONTINUE_CWaterCannon__Render = 0x72932F;

static void HandleWaterCannonHit(CVehicleSAInterface* pGameVehicle, CColPointSAInterface* pColPoint, CEntitySAInterface** ppHitGameEntity)
{
if (!pVehicleWeaponHitHandler)
return;

CEntitySAInterface* const pHitGameEntity = ppHitGameEntity ? *ppHitGameEntity : nullptr;
const int iModel = pHitGameEntity ? pHitGameEntity->m_nModelIndex : -1;

TriggerVehicleWeaponHitEvent(EVehicleWeaponType::WATER_CANNON, pGameVehicle, pHitGameEntity, pColPoint->Position, iModel, pColPoint->ucSurfaceTypeB);
}

static void _declspec(naked) HOOK_CWaterCannon__Render()
{
_asm
{
pushad
mov eax, [ebx] // CVehicleSAInterface* CWaterCannon::m_pVehicle
lea ebx, [esp + 100h - 54h] // CColPointSAInterface*
lea ecx, [esp + 100h - 58h] // CEntitySAInterface**
push ecx // ppHitGameEntity
push ebx // pColPoint
push eax // pGameVehicle
call HandleWaterCannonHit
add esp, 12
popad
push 3E4CCCCDh
jmp CONTINUE_CWaterCannon__Render
}
}

//////////////////////////////////////////////////////////////////////////////////////////
//
// CMultiplayerSA::InitHooks_VehicleWeapons
//
// Setup hooks for vehicle weapon related events
//
//////////////////////////////////////////////////////////////////////////////////////////
void CMultiplayerSA::InitHooks_VehicleWeapons(void)
{
EZHookInstall(CWaterCannon__Render);
}
Oops, something went wrong.

0 comments on commit d17619f

Please sign in to comment.