Skip to content

Commit

Permalink
Merge branch 'OpenXRay:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
alsed authored Dec 23, 2024
2 parents c8066e9 + acbd404 commit 7ad00a2
Show file tree
Hide file tree
Showing 173 changed files with 2,697 additions and 1,149 deletions.
19 changes: 13 additions & 6 deletions src/Layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,15 @@ const xr_token qsmapsize_token[] =
{ nullptr, 0 }
};

u32 ps_r_ssao_mode = 2;
const xr_token qssao_mode_token[] = {{"disabled", 0}, {"default", 1}, {"hdao", 2}, {"hbao", 3}, {nullptr, 0}};
u32 ps_r_ssao_mode = ssao_mode_default;
const xr_token qssao_mode_token[] =
{
{ "disabled", ssao_mode_off },
{ "default", ssao_mode_default },
{ "hdao", ssao_mode_hdao },
{ "hbao", ssao_mode_hbao },
{ nullptr, 0 }
};

u32 ps_r_sun_shafts = 2;
const xr_token qsun_shafts_token[] = {{"st_opt_off", 0}, {"st_opt_low", 1}, {"st_opt_medium", 2}, {"st_opt_high", 3}, {nullptr, 0}};
Expand Down Expand Up @@ -477,14 +484,14 @@ class CCC_SSAO_Mode : public CCC_Token

switch (*value)
{
case 0:
case ssao_mode_off:
{
ps_r_ssao = 0;
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HBAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HDAO, 0);
break;
}
case 1:
case ssao_mode_default:
{
if (ps_r_ssao == 0)
{
Expand All @@ -495,7 +502,7 @@ class CCC_SSAO_Mode : public CCC_Token
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HALF_DATA, 0);
break;
}
case 2:
case ssao_mode_hdao:
{
if (ps_r_ssao == 0)
{
Expand All @@ -507,7 +514,7 @@ class CCC_SSAO_Mode : public CCC_Token
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HALF_DATA, 0);
break;
}
case 3:
case ssao_mode_hbao:
{
if (ps_r_ssao == 0)
{
Expand Down
8 changes: 8 additions & 0 deletions src/Layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ extern ECORE_API const xr_token qssao_token[];
extern ECORE_API u32 ps_r_ssao_mode;
extern ECORE_API const xr_token qssao_mode_token[];

enum
{
ssao_mode_off,
ssao_mode_default,
ssao_mode_hdao,
ssao_mode_hbao,
};

extern ECORE_API u32 ps_r_sun_quality; // = 0;
extern ECORE_API u32 ps_r_water_reflection; // = 0;
extern ECORE_API const xr_token qsun_quality_token[];
Expand Down
13 changes: 4 additions & 9 deletions src/Layers/xrRender_R2/r2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,10 @@ void CRender::create()
#endif

// TODO: fix hbao shader to allow to perform per-subsample effect!
o.hbao_vectorized = false;
if (o.ssao_hdao)
o.ssao_opt_data = false;
else if (o.ssao_hbao)
{
if (HW.Caps.id_vendor == 0x1002)
o.hbao_vectorized = true;
o.ssao_opt_data = true;
}
if (o.ssao_hbao && HW.Caps.id_vendor == 0x1002)
o.hbao_vectorized = true;
else
o.hbao_vectorized = false;

#if defined(USE_DX11)
o.dx11_sm4_1 = ps_r2_ls_flags.test((u32)R3FLAG_USE_DX10_1);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender_R2/r2_rendertarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ CRenderTarget::CRenderTarget()
}

// Check if SSAO Ultra is allowed
if (ps_r_ssao_mode != 2 /*hdao*/ || !options.ssao_ultra)
if (ps_r_ssao_mode != ssao_mode_hdao || !options.ssao_ultra)
ps_r_ssao = _min(ps_r_ssao, 3);

// HBAO
Expand Down
4 changes: 3 additions & 1 deletion src/xrCore/NET_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ void NET_Packet::w_seek(u32 pos, const void* p, u32 count)
void NET_Packet::r_seek(u32 pos)
{
INI_ASSERT(r_seek)
VERIFY(pos < B.count);
//AVO: changed changed condition to <= as all net packet script utils are using r_seek(0) to read the entire packet.
VERIFY(pos <= B.count);
//VERIFY(pos < B.count);
r_pos = pos;
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/Device_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void CRenderDevice::Create()
FS.update_path(fname, "$game_data$", "shaders.xr");
GEnv.Render->OnDeviceCreate(fname);
m_imgui_render = GEnv.RenderFactory->CreateImGuiRender();
m_imgui_render->OnDeviceCreate(Device.GetImGuiContext());
m_imgui_render->OnDeviceCreate(GetImGuiContext());
Statistic->OnDeviceCreate();
dwFrame = 0;
}
72 changes: 50 additions & 22 deletions src/xrGame/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@

#include "xrEngine/Rain.h"

//Alundaio
#include "script_hit.h"
//-Alundaio

//const u32 patch_frames = 50;
//const float respawn_delay = 1.f;
//const float respawn_auto = 7.f;
Expand All @@ -100,7 +104,8 @@ Flags32 psActorFlags =
AF_AUTOPICKUP |
AF_RUN_BACKWARD |
AF_IMPORTANT_SAVE |
AF_MULTI_ITEM_PICKUP
AF_MULTI_ITEM_PICKUP |
AF_USE_TRACERS
};
int psActorSleepTime = 1;

Expand Down Expand Up @@ -653,13 +658,35 @@ void CActor::Hit(SHit* pHDS)
{
HDS.power = 0.0f;
inherited::Hit(&HDS);
return;
}

float hit_power = HitArtefactsOnBelt(HDS.damage(), HDS.hit_type);
HDS.power = hit_power;
HDS.power = HitArtefactsOnBelt(HDS.damage(), HDS.hit_type);
HDS.add_wound = true;
if (g_Alive())
{
CScriptHit tLuaHit;

tLuaHit.m_fPower = HDS.power;
tLuaHit.m_fImpulse = HDS.impulse;
tLuaHit.m_tDirection = HDS.direction();
tLuaHit.m_tHitType = HDS.hit_type;
tLuaHit.m_tpDraftsman = smart_cast<const CGameObject*>(HDS.who)->lua_game_object();

luabind::functor<bool> funct;
if (GEnv.ScriptEngine->functor("_G.CActor__BeforeHitCallback", funct))
{
if (!funct(smart_cast<CGameObject*>(this->lua_game_object()), &tLuaHit, HDS.boneID))
return;
}

HDS.power = tLuaHit.m_fPower;
HDS.impulse = tLuaHit.m_fImpulse;
HDS.dir = tLuaHit.m_tDirection;
HDS.hit_type = (ALife::EHitType)(tLuaHit.m_tHitType);
//HDS.who = smart_cast<CObject*>(tLuaHit.m_tpDraftsman->object());
//HDS.whoID = tLuaHit.m_tpDraftsman->ID();

/* AVO: send script callback*/
callback(GameObject::eHit)(
this->lua_game_object(),
Expand Down Expand Up @@ -780,13 +807,13 @@ void CActor::HitMark(float P, Fvector dir, IGameObject* who_object, s16 element,

void CActor::HitSignal(float perc, Fvector& vLocalDir, IGameObject* who, s16 element)
{
//AVO: get bone names from IDs
//cpcstr bone_name = smart_cast<IKinematics*>(this->Visual())->LL_BoneName_dbg(element);
//Msg("Bone [%d]->[%s]", element, bone_name);
//-AVO

if (g_Alive())
{
/* AVO: to get bone names from IDs*/
/*Log("hit info");
Log("bone ID = %s", element);
Log("bone Name = %s", smart_cast<IKinematics*>(this->Visual())->LL_BoneName_dbg(element));
Log("hit info END");*/
// check damage bone
Fvector D;
XFORM().transform_dir(D, vLocalDir);
Expand Down Expand Up @@ -1541,7 +1568,7 @@ void CActor::shedule_Update(u32 DT)
}
else if (m_pVehicleWeLookingAt)
{
m_sDefaultObjAction = m_sCarCharacterUseAction;
m_sDefaultObjAction = m_pVehicleWeLookingAt->m_sUseAction != nullptr ? m_pVehicleWeLookingAt->m_sUseAction : m_sCarCharacterUseAction;
}
else if (m_pObjectWeLookingAt && m_pObjectWeLookingAt->cast_inventory_item() &&
m_pObjectWeLookingAt->cast_inventory_item()->CanTake())
Expand Down Expand Up @@ -1928,18 +1955,19 @@ void CActor::UpdateArtefactsOnBeltAndOutfit()
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
{
conditions().ChangeBleeding(artefact->m_fBleedingRestoreSpeed * f_update_time);
conditions().ChangeHealth(artefact->m_fHealthRestoreSpeed * f_update_time);
conditions().ChangePower(artefact->m_fPowerRestoreSpeed * f_update_time);
conditions().ChangeSatiety(artefact->m_fSatietyRestoreSpeed * f_update_time);
if (artefact->m_fRadiationRestoreSpeed > 0.0f)
const float art_cond = artefact->GetCondition();
conditions().ChangeBleeding((artefact->m_fBleedingRestoreSpeed * art_cond) * f_update_time);
conditions().ChangeHealth((artefact->m_fHealthRestoreSpeed * art_cond) * f_update_time);
conditions().ChangePower((artefact->m_fPowerRestoreSpeed * art_cond) * f_update_time);
conditions().ChangeSatiety((artefact->m_fSatietyRestoreSpeed * art_cond) * f_update_time);
if (artefact->m_fRadiationRestoreSpeed * art_cond > 0.0f)
{
float val = artefact->m_fRadiationRestoreSpeed - conditions().GetBoostRadiationImmunity();
float val = (artefact->m_fRadiationRestoreSpeed * art_cond) - conditions().GetBoostRadiationImmunity();
clamp(val, 0.0f, val);
conditions().ChangeRadiation(val * f_update_time);
}
else
conditions().ChangeRadiation(artefact->m_fRadiationRestoreSpeed * f_update_time);
conditions().ChangeRadiation((artefact->m_fRadiationRestoreSpeed * art_cond) * f_update_time);
}
}

Expand Down Expand Up @@ -1986,7 +2014,7 @@ float CActor::GetProtection_ArtefactsOnBelt(ALife::EHitType hit_type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
sum += artefact->m_ArtefactHitImmunities.AffectHit(1.0f, hit_type);
sum += artefact->m_ArtefactHitImmunities.AffectHit(1.0f, hit_type) * artefact->GetCondition();
}
return sum;
}
Expand Down Expand Up @@ -2141,7 +2169,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
res += artefact->m_fHealthRestoreSpeed;
res += artefact->m_fHealthRestoreSpeed * artefact->GetCondition();
}

const auto outfit = GetOutfit();
Expand All @@ -2156,7 +2184,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
res += artefact->m_fRadiationRestoreSpeed;
res += artefact->m_fRadiationRestoreSpeed * artefact->GetCondition();
}

const auto outfit = GetOutfit();
Expand All @@ -2173,7 +2201,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
res += artefact->m_fSatietyRestoreSpeed;
res += artefact->m_fSatietyRestoreSpeed * artefact->GetCondition();
}

const auto outfit = GetOutfit();
Expand All @@ -2190,7 +2218,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
res += artefact->m_fPowerRestoreSpeed;
res += artefact->m_fPowerRestoreSpeed * artefact->GetCondition();
}
auto outfit = GetOutfit();
if (outfit)
Expand All @@ -2212,7 +2240,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
{
const auto artefact = smart_cast<CArtefact*>(it);
if (artefact)
res += artefact->m_fBleedingRestoreSpeed;
res += artefact->m_fBleedingRestoreSpeed * artefact->GetCondition();
}

const auto outfit = GetOutfit();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class CActor : public CEntityAlive,
void detach_Vehicle();
void steer_Vehicle(float angle);
void attach_Vehicle(CHolderCustom* vehicle);
bool use_MountedWeapon(CHolderCustom* object);
bool use_HolderEx(CHolderCustom* object, bool bForce);
virtual bool can_attach(const CInventoryItem* inventory_item) const;

protected:
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/ActorInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ bool CActor::use_Holder(CHolderCustom* holder)

if (smart_cast<CCar*>(holderGO))
b = use_Vehicle(0);
else if (holderGO->CLS_ID == CLSID_OBJECT_W_STATMGUN)
b = use_MountedWeapon(0);
else if (holderGO->CLS_ID == CLSID_OBJECT_W_STATMGUN || holderGO->CLS_ID==CLSID_OBJECT_HOLDER_ENT)
b = use_HolderEx(0, false);

if (inventory().ActiveItem())
{
Expand All @@ -596,8 +596,8 @@ bool CActor::use_Holder(CHolderCustom* holder)
if (smart_cast<CCar*>(holder))
b = use_Vehicle(holder);

if (holderGO->CLS_ID == CLSID_OBJECT_W_STATMGUN)
b = use_MountedWeapon(holder);
if (holderGO->CLS_ID == CLSID_OBJECT_W_STATMGUN || holderGO->CLS_ID==CLSID_OBJECT_HOLDER_ENT)
b = use_HolderEx(holder, false);

if (b)
{ // used succesfully
Expand Down
Loading

0 comments on commit 7ad00a2

Please sign in to comment.