Skip to content

Commit

Permalink
Merge pull request #242 from qweasdd136963/xd_dev_dev
Browse files Browse the repository at this point in the history
Fixes and changes
  • Loading branch information
Xottab-DUTY authored Sep 29, 2018
2 parents b7b3401 + 78f104d commit 3aa80f1
Show file tree
Hide file tree
Showing 42 changed files with 275 additions and 479 deletions.
15 changes: 11 additions & 4 deletions src/Layers/xrRenderDX10/3DFluid/dx103DFluidData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@

namespace
{
const xr_token simulation_type_token[] = {{"Fog", dx103DFluidData::ST_FOG}, {"Fire", dx103DFluidData::ST_FIRE}, {0, 0}};
const xr_token simulation_type_token[] = {
{"Fog", dx103DFluidData::ST_FOG},
{"Fire", dx103DFluidData::ST_FIRE},
{0, 0}
};

const xr_token emitter_type_token[] = {{"SimpleGaussian", dx103DFluidEmitters::ET_SimpleGausian},
{"SimpleDraught", dx103DFluidEmitters::ET_SimpleDraught}, {0, 0}};
const xr_token emitter_type_token[] = {
{"SimpleGaussian", dx103DFluidEmitters::ET_SimpleGausian},
{"SimpleDraught", dx103DFluidEmitters::ET_SimpleDraught},
{0, 0}
};
}

DXGI_FORMAT dx103DFluidData::m_VPRenderTargetFormats[VP_NUM_TARGETS] = {
Expand All @@ -20,7 +27,7 @@ DXGI_FORMAT dx103DFluidData::m_VPRenderTargetFormats[VP_NUM_TARGETS] = {
dx103DFluidData::dx103DFluidData()
{
D3D_TEXTURE3D_DESC desc;
desc.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET;
desc.BindFlags = D3D_BIND_SHADER_RESOURCE | D3D_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
desc.MipLevels = 1;
desc.MiscFlags = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderDX10/3DFluid/dx103DFluidManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void dx103DFluidManager::Initialize(int width, int height, int depth)
InitShaders();

D3D_TEXTURE3D_DESC desc;
desc.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET;
desc.BindFlags = D3D_BIND_SHADER_RESOURCE | D3D_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
desc.MipLevels = 1;
desc.MiscFlags = 0;
Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRenderDX10/Blender_Recorder_R3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ void CBlender_Compile::r_Pass(LPCSTR _vs, LPCSTR _gs, LPCSTR _ps, bool bFog, BOO
#ifdef USE_DX11
dest.hs = RImplementation.Resources->_CreateHS("null");
dest.ds = RImplementation.Resources->_CreateDS("null");
dest.cs = RImplementation.Resources->_CreateCS("null");
#endif
ctable.merge(&ps->constants);
ctable.merge(&vs->constants);
Expand Down
2 changes: 1 addition & 1 deletion src/editors/xrEditor/entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int entry_point(pcstr commandLine)
splash->Show();

splash->SetStatus("Loading xrDebug...");
xrDebug::Initialize(false);
xrDebug::Initialize();

splash->SetStatus("Loading Core...");
thread_spawn(UIThreadProc, "OpenXRay Editor UI Thread", 0, nullptr);
Expand Down
26 changes: 0 additions & 26 deletions src/xrGame/F1.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions src/xrGame/F1.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class CF1 : public CGrenade
typedef CGrenade inherited;

public:
CF1(void);
virtual ~CF1(void);
CF1() {}
virtual ~CF1() {}
};
80 changes: 19 additions & 61 deletions src/xrGame/PHCommander.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "stdafx.h"
#include "PHCommander.h"

#include "phsimplecalls.h"
#ifdef DEBUG

// extern CPHWorld *ph_world;
#ifdef DEBUG
#include "xrPhysics/IPHWorld.h"
#endif

Expand All @@ -19,7 +17,7 @@ CPHCall::~CPHCall()
xr_delete(m_action);
xr_delete(m_condition);
}
bool CPHCall::obsolete() { return m_action->obsolete() || m_condition->obsolete(); }
bool CPHCall::obsolete() { return !m_action || m_action->obsolete() || !m_condition || m_condition->obsolete(); }
void CPHCall::check()
{
if (m_condition && m_condition->is_true() && m_action)
Expand Down Expand Up @@ -50,14 +48,6 @@ void CPHCommander::clear()
{
remove_call(m_calls.end() - 1);
}
while (m_calls_as_add_buffer.size())
{
remove_call(m_calls_as_add_buffer.end() - 1);
}
while (m_calls_as_remove_buffer.size())
{
remove_call(m_calls_as_remove_buffer.end() - 1);
}
}

void CPHCommander::update()
Expand Down Expand Up @@ -96,12 +86,13 @@ void CPHCommander::add_call_threadsafety(CPHCondition* condition, CPHAction* act
add_call(condition, action);
lock.Leave();
}
void CPHCommander::add_call(CPHCondition* condition, CPHAction* action, PHCALL_STORAGE& cs)

void CPHCommander::add_call(CPHCondition* condition, CPHAction* action)
{
cs.push_back(new CPHCall(condition, action));
m_calls.push_back(new CPHCall(condition, action));
}
void CPHCommander::add_call(CPHCondition* condition, CPHAction* action) { add_call(condition, action, m_calls); }
void CPHCommander::remove_call(PHCALL_I i, PHCALL_STORAGE& cs)

void CPHCommander::remove_call(PHCALL_I i)
{
#ifdef DEBUG
const CPHCallOnStepCondition* esc = smart_cast<const CPHCallOnStepCondition*>((*i)->condition());
Expand All @@ -117,10 +108,9 @@ void CPHCommander::remove_call(PHCALL_I i, PHCALL_STORAGE& cs)
}
#endif
delete_call(*i);
cs.erase(i);
m_calls.erase(i);
}

void CPHCommander::remove_call(PHCALL_I i) { remove_call(i, m_calls); }
struct SFEqualPred
{
CPHReqComparerV *cmp_condition, *cmp_action;
Expand Down Expand Up @@ -150,46 +140,33 @@ struct SFRemovePred2
}
};

PHCALL_I CPHCommander::find_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs)
{
return std::find_if(cs.begin(), cs.end(), SFEqualPred(cmp_condition, cmp_action));
}

PHCALL_I CPHCommander::find_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action)
{
return find_call(cmp_condition, cmp_action, m_calls);
return std::find_if(m_calls.begin(), m_calls.end(), SFEqualPred(cmp_condition, cmp_action));
}

bool CPHCommander::has_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action)
{
return find_call(cmp_condition, cmp_action) != m_calls.end();
}

void CPHCommander::remove_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs)
{
cs.erase(std::remove_if(cs.begin(), cs.end(), SFRemovePred2(cmp_condition, cmp_action)), cs.end());
}

void CPHCommander::remove_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action)
{
remove_call(cmp_condition, cmp_action, m_calls);
m_calls.erase(
std::remove_if(m_calls.begin(), m_calls.end(), SFRemovePred2(cmp_condition, cmp_action)), m_calls.end());
}

bool CPHCommander::add_call_unique(CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action,
CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs)
bool CPHCommander::add_call_unique(
CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action, CPHReqComparerV* cmp_action)
{
if (cs.end() == find_call(cmp_condition, cmp_action, cs))
if (m_calls.end() == find_call(cmp_condition, cmp_action))
{
add_call(condition, action, cs);
add_call(condition, action);
return true;
}
return false;
}
bool CPHCommander::add_call_unique(
CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action, CPHReqComparerV* cmp_action)
{
return add_call_unique(condition, cmp_condition, action, cmp_action, m_calls);
}

struct SRemoveRped
{
CPHReqComparerV* cmp_object;
Expand All @@ -206,37 +183,18 @@ struct SRemoveRped
}
};

void CPHCommander::remove_calls(CPHReqComparerV* cmp_object, PHCALL_STORAGE& cs)
{
cs.erase(std::remove_if(cs.begin(), cs.end(), SRemoveRped(cmp_object)), cs.end());
}
void CPHCommander::remove_calls_threadsafety(CPHReqComparerV* cmp_object)
{
lock.Enter();
remove_calls(cmp_object);
lock.Leave();
}
void CPHCommander::remove_calls(CPHReqComparerV* cmp_object) { remove_calls(cmp_object, m_calls); }
void CPHCommander::add_call_unique_as(
CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action, CPHReqComparerV* cmp_action)
{
add_call_unique(condition, cmp_condition, action, cmp_action, m_calls_as_add_buffer);
}
void CPHCommander::add_call_as(CPHCondition* condition, CPHAction* action)
{
add_call(condition, action, m_calls_as_add_buffer);
}

PHCALL_I CPHCommander::find_call_as(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action)
{
return find_call(cmp_condition, cmp_action, m_calls);
}
void CPHCommander::remove_call_as(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action)
void CPHCommander::remove_calls(CPHReqComparerV* cmp_object)
{
remove_call(cmp_condition, cmp_action, m_calls_as_add_buffer);
m_calls.erase(std::remove_if(m_calls.begin(), m_calls.end(), SRemoveRped(cmp_object)), m_calls.end());
}
void CPHCommander::remove_calls_as(CPHReqComparerV* cmp_object) {}
void CPHCommander::update_as() {}

void CPHCommander::phys_shell_relcase(CPhysicsShell* sh)
{
CPHReqComparerHasShell c(sh);
Expand Down
25 changes: 1 addition & 24 deletions src/xrGame/PHCommander.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ class CPHCommander : public IPHWorldUpdateCallbck
{
Lock lock;
PHCALL_STORAGE m_calls;
PHCALL_STORAGE m_calls_as_add_buffer;
PHCALL_STORAGE m_calls_as_remove_buffer;

public:
~CPHCommander();
Expand All @@ -94,30 +92,9 @@ class CPHCommander : public IPHWorldUpdateCallbck

void update();
void update_threadsafety();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void add_call_unique_as(
CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action, CPHReqComparerV* cmp_action);
void add_call_as(CPHCondition* condition, CPHAction* action);

void remove_call_as(PHCALL_I i);
PHCALL_I find_call_as(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action);
void remove_call_as(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action);
void remove_calls_as(CPHReqComparerV* cmp_object);

void update_as();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void clear();

private:
IC bool add_call_unique(CPHCondition* condition, CPHReqComparerV* cmp_condition, CPHAction* action,
CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs);
IC void add_call(CPHCondition* condition, CPHAction* action, PHCALL_STORAGE& cs);

IC void remove_call(PHCALL_I i, PHCALL_STORAGE& cs);
IC PHCALL_I find_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs);
IC void remove_call(CPHReqComparerV* cmp_condition, CPHReqComparerV* cmp_action, PHCALL_STORAGE& cs);
IC void remove_calls(CPHReqComparerV* cmp_object, PHCALL_STORAGE& cs);

private:
virtual void update_step() { update_threadsafety(); }
virtual void phys_shell_relcase(CPhysicsShell* sh);
Expand Down
16 changes: 6 additions & 10 deletions src/xrGame/PHScriptCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#include "script_callback_ex.h"
#include "xrEngine/xr_object.h"

// template<>
// IC bool compare_safe(const functor<>& f1,const functor<>& f2)
//{
// f1.typ
//}

class CPHScriptCondition : public CPHCondition, public CPHReqComparerV
{
luabind::functor<bool>* m_lua_function;
Expand All @@ -24,10 +18,12 @@ class CPHScriptCondition : public CPHCondition, public CPHReqComparerV
virtual bool is_true();
virtual bool obsolete() const;
virtual bool compare(const CPHReqComparerV* v) const { return v->compare(this); }
// XXX: compare values instead of pointers?
virtual bool compare(const CPHScriptCondition* v) const { return v->m_lua_function == m_lua_function; }
/// virtual bool is_equal (CPHReqBase* v) ;
// virtual bool is_relative (CPHReqBase* v) ;
virtual bool compare(const CPHScriptCondition* v) const
{
const auto& lhs = static_cast<const luabind::adl::object&>(*m_lua_function);
const auto& rhs = static_cast<const luabind::adl::object&>(*v->m_lua_function);
return lhs == rhs;
}
};

class CPHScriptAction : public CPHAction, public CPHReqComparerV
Expand Down
9 changes: 0 additions & 9 deletions src/xrGame/RGD5.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions src/xrGame/RGD5.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "grenade.h"
#include "Grenade.h"

class CRGD5 : public CGrenade
{
typedef CGrenade inherited;

public:
CRGD5(void);
virtual ~CRGD5(void);
CRGD5() {}
virtual ~CRGD5() {}
};
7 changes: 1 addition & 6 deletions src/xrGame/WeaponAK74.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include "pch_script.h"
#include "stdafx.h"
#include "WeaponAK74.h"
#include "xrScriptEngine/ScriptExporter.hpp"

CWeaponAK74::CWeaponAK74(ESoundTypes eSoundType) : CWeaponMagazinedWGrenade(eSoundType) {}
CWeaponAK74::~CWeaponAK74() {}
using namespace luabind;

SCRIPT_EXPORT(CWeaponAK74, (CGameObject),
{ module(luaState)[class_<CWeaponAK74, CGameObject>("CWeaponAK74").def(constructor<>())]; });
8 changes: 0 additions & 8 deletions src/xrGame/WeaponBinoculars_script.cpp

This file was deleted.

7 changes: 1 addition & 6 deletions src/xrGame/WeaponFN2000.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include "pch_script.h"
#include "stdafx.h"
#include "WeaponFN2000.h"
#include "xrScriptEngine/ScriptExporter.hpp"

CWeaponFN2000::CWeaponFN2000() : CWeaponMagazined(SOUND_TYPE_WEAPON_SNIPERRIFLE) {}
CWeaponFN2000::~CWeaponFN2000() {}
using namespace luabind;

SCRIPT_EXPORT(CWeaponFN2000, (CGameObject),
{ module(luaState)[class_<CWeaponFN2000, CGameObject>("CWeaponFN2000").def(constructor<>())]; });
10 changes: 0 additions & 10 deletions src/xrGame/WeaponFORT.cpp

This file was deleted.

Loading

0 comments on commit 3aa80f1

Please sign in to comment.