Skip to content

Commit

Permalink
+ Teleport actor to demo cam when you press Enter while in demo_record
Browse files Browse the repository at this point in the history
~ activate car PPhysicsShell when it spawns so that it collides with ground properly
+ Added support for a third ammo type static. YOU MUST HAVE <static_third_ammo> in your maingame.xml and maingame_16.xml

+ added:

game_object:get_attached_vehicle() {return game_object}
game_object:add_upgrade(section) {void}
game_object:has_upgrade(section) {return bool}
game_object:iterate_installed_upgrades(lua_function,game_object)
game_object:play_hud_motion(anim_section,bMixIn,game_object:get_stat()) {return number} -- animation length
game_object:switch_state(number)
game_object:get_state() {return number}
game_object:activate_hud_item()
game_object:deactivate_hud_item()
game_object:is_actor_indoors() {return bool}
game_object:is_npc_indoors() {return bool}

+ Added 5 custom slots. IMPORTANT YOU MUST set system.ltx [inventory] properly now. There should be 17 slots!
  • Loading branch information
revolucas authored and Xottab-DUTY committed Dec 16, 2017
1 parent 0fe21c1 commit 99a2538
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 95 deletions.
4 changes: 2 additions & 2 deletions src/xrEngine/FDemoRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void CDemoRecord::IR_OnKeyboardPress(int dik)
if (dik == DIK_ESCAPE)
fLifeTime = -1;

#ifndef MASTER_GOLD
#ifdef DEBUG // ndef MASTER_GOLD // Xottab_DUTY: Teleport to demo cam in Debug configuration
if (dik == DIK_RETURN)
{
if (g_pGameLevel->CurrentEntity())
Expand All @@ -432,7 +432,7 @@ void CDemoRecord::IR_OnKeyboardPress(int dik)
fLifeTime = -1;
}
}
#endif // #ifndef MASTER_GOLD
#endif

if (dik == DIK_PAUSE)
Device.Pause(!Device.Paused(), TRUE, TRUE, "demo_record");
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ void CCar::CreateSkeleton(CSE_Abstract* po)
m_pPhysicsShell->SetAirResistance(0.f, 0.f);
m_pPhysicsShell->SetPrefereExactIntegration();
*/
m_pPhysicsShell = P_build_Shell(this, true, &bone_map);
m_pPhysicsShell = P_build_Shell(this, false, &bone_map);
//-Alundaio

ApplySpawnIniToPhysicShell(&po->spawn_ini(), m_pPhysicsShell, false);
Expand Down
30 changes: 13 additions & 17 deletions src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1338,34 +1338,30 @@ bool CWeaponMagazined::GetBriefInfo(II_BriefInfo& info)
GetSuitableAmmoTotal(); // update m_BriefInfo_CalcFrame
info.grenade = "";

u32 at_size = m_ammoTypes.size();
const u32 at_size = m_ammoTypes.size();
if (unlimited_ammo() || at_size == 0)
{
info.fmj_ammo._set("--");
info.ap_ammo._set("--");
info.third_ammo._set("--"); //Alundaio
}
else
{
// GetSuitableAmmoTotal(); //mp = all type
//Alundaio: Added third ammo type and cleanup
info.fmj_ammo._set("");
info.ap_ammo._set("");
info.third_ammo._set("");

xr_sprintf(int_str, "%d", GetAmmoCount(0)); // !!!!!!!!!!! == 0 temp
if (m_ammoType == 0)
info.fmj_ammo = int_str;
else
info.ap_ammo = int_str;
xr_sprintf(int_str, "%d", GetAmmoCount(m_ammoType));

if (at_size == 2)
{
xr_sprintf(int_str, "%d", GetAmmoCount(1));
if (m_ammoType == 0)
info.ap_ammo = int_str;
else
info.fmj_ammo = int_str;
}
if (m_ammoType == 0)
info.fmj_ammo._set(int_str);
else if (m_ammoType == 1)
info.ap_ammo._set(int_str);
else
{
info.ap_ammo = "";
}
info.third_ammo._set(int_str);
//-Alundaio
}

if (ae != 0 && m_magazine.size() != 0)
Expand Down
27 changes: 13 additions & 14 deletions src/xrGame/WeaponMagazinedWGrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,26 +926,25 @@ bool CWeaponMagazinedWGrenade::GetBriefInfo(II_BriefInfo& info)
{
info.fmj_ammo._set("--");
info.ap_ammo._set("--");
info.third_ammo._set("--"); //Alundaio
}
else
{
u8 ammo_type = m_bGrenadeMode ? m_ammoType2 : m_ammoType;
xr_sprintf(int_str, "%d", m_bGrenadeMode ? GetAmmoCount2(0) : GetAmmoCount(0));
if (ammo_type == 0)
//Alundaio: Added third ammo type and cleanup
info.fmj_ammo._set("");
info.ap_ammo._set("");
info.third_ammo._set("");

const u8 ammo_type = m_bGrenadeMode ? m_ammoType2 : m_ammoType;
xr_sprintf(int_str, "%d", m_bGrenadeMode ? GetAmmoCount2(ammo_type) : GetAmmoCount(ammo_type));

if (m_ammoType == 0)
info.fmj_ammo._set(int_str);
else
else if (m_ammoType == 1)
info.ap_ammo._set(int_str);

if (at_size == 2)
{
xr_sprintf(int_str, "%d", m_bGrenadeMode ? GetAmmoCount2(1) : GetAmmoCount(1));
if (ammo_type == 0)
info.ap_ammo._set(int_str);
else
info.fmj_ammo._set(int_str);
}
else
info.ap_ammo._set("");
info.third_ammo._set(int_str);
//-Alundaio
}

if (ae != 0 && m_magazine.size() != 0)
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/inventory_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class CInventoryItem : public CAttachableItem,
bool has_upgrade_group(const shared_str& upgrade_group_id);
void add_upgrade(const shared_str& upgrade_id, bool loading);
bool get_upgrades_str(string2048& res) const;
Upgrades_type get_upgrades() { return m_upgrades; } //Alundaio

bool equal_upgrades(Upgrades_type const& other_upgrades) const;

Expand Down
11 changes: 6 additions & 5 deletions src/xrGame/script_game_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ bool CScriptGameObject::invulnerable() const
return (false);
}

return (monster->invulnerable());
return monster->invulnerable();
}

void CScriptGameObject::invulnerable(bool invulnerable)
Expand All @@ -578,22 +578,23 @@ void CScriptGameObject::invulnerable(bool invulnerable)

monster->invulnerable(invulnerable);
}
LPCSTR CScriptGameObject::get_smart_cover_description() const

pcstr CScriptGameObject::get_smart_cover_description() const
{
smart_cover::object* smart_cover_object = smart_cast<smart_cover::object*>(&object());
if (!smart_cover_object)
{
ai().script_engine().script_log(
LuaMessageType::Error, "smart_cover::object : cannot access class member get_smart_cover_description!");
return (0);
return nullptr;
}
return smart_cover_object->cover().description()->table_id().c_str();
}

void CScriptGameObject::set_visual_name(LPCSTR visual) { object().cNameVisual_set(visual); }
LPCSTR CScriptGameObject::get_visual_name() const { return object().cNameVisual().c_str(); }

bool CScriptGameObject::IsActorOutdoors() const
bool CScriptGameObject::IsActorIndoors() const
{
// Check to make sure all the params are available (we're in game and such).
if (!g_pGameLevel)
Expand All @@ -606,4 +607,4 @@ bool CScriptGameObject::IsActorOutdoors() const
// Now do the real check! This is a copy out of another section of code that is also hard coded.
// I don't know what the proper limit for this is supposed to be, but this seems good enough.
return e->renderable_ROS()->get_luminocity_hemi() > 0.05f;
}
}
23 changes: 20 additions & 3 deletions src/xrGame/script_game_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,29 @@ class CScriptGameObject
int Weapon_Silencer_Status();

//Alundaio
//Weapon
void Weapon_AddonAttach(CScriptGameObject* item);
void Weapon_AddonDetach(pcstr item_section);

//Weapon & Outfit
bool HasUpgrade(pcstr upgrade) const;
void AddUpgrade(pcstr upgrade);
void IterateInstalledUpgrades(luabind::functor<void> functor);

//Car
CScriptGameObject* GetAttachedVehicle();
void AttachVehicle(CScriptGameObject* veh);
void DetachVehicle();
void ForceSetPosition(Fvector3 pos);

//Any class that has PPhysicsShell
void ForceSetPosition(Fvector3 pos, bool bActivate);

//Any class that is derived from CHudItem
u32 PlayHudMotion(pcstr M, bool mixIn, u32 state);
void SwitchState(u32 state);
u32 GetState();
void ActivateHudItem();
void DeactivateHudItem();
//-Alundaio

LPCSTR ProfileName();
Expand Down Expand Up @@ -705,7 +722,7 @@ class CScriptGameObject

bool invulnerable() const;
void invulnerable(bool invulnerable);
LPCSTR get_smart_cover_description() const;
pcstr get_smart_cover_description() const;
void set_visual_name(LPCSTR visual);
LPCSTR get_visual_name() const;

Expand Down Expand Up @@ -842,7 +859,7 @@ class CScriptGameObject
bool isTorch() const;
bool isWeaponGL() const;
bool isInventoryBox() const;
bool IsActorOutdoors() const;
bool IsActorIndoors() const;
void SetHealthEx(float hp);
//-AVO

Expand Down
Loading

0 comments on commit 99a2538

Please sign in to comment.