From 565b39e5d6a567305b677ad847549e2fee63d12d Mon Sep 17 00:00:00 2001 From: Andrey Voitishin Date: Tue, 30 Dec 2014 09:04:45 -0500 Subject: [PATCH] + exported is_* (is_stalker, etc.) methods + exported additional methods for ini_file class to allow writing * changed w_vector2 and w vector to w_fvector2 and w_fvector3 --- src/xrGame/script_game_object.h | 40 +++ src/xrGame/script_game_object4.cpp | 296 ++++++++++++++++++ src/xrGame/script_game_object_script3.cpp | 40 +++ src/xrServerEntities/script_ini_file.cpp | 144 ++++++++- src/xrServerEntities/script_ini_file.h | 23 ++ .../script_ini_file_script.cpp | 9 +- 6 files changed, 547 insertions(+), 5 deletions(-) diff --git a/src/xrGame/script_game_object.h b/src/xrGame/script_game_object.h index 0ff1c180cda..55bee408c18 100644 --- a/src/xrGame/script_game_object.h +++ b/src/xrGame/script_game_object.h @@ -779,6 +779,46 @@ class CScriptGameObject bool is_door_blocked_by_npc() const; bool is_weapon_going_to_be_strapped(CScriptGameObject const* object) const; + //AVO: functions for object testing + bool isGameObject() const; + //bool isCar() const; + bool isHeli() const; + //bool isHolderCustom() const; + bool isEntityAlive() const; + bool isInventoryItem() const; + bool isInventoryOwner() const; + bool isActor() const; + bool isCustomMonster() const; + bool isWeapon() const; + bool isMedkit() const; + bool isEatableItem() const; + bool isAntirad() const; + bool isCustomOutfit() const; + bool isScope() const; + bool isSilencer() const; + bool isGrenadeLauncher() const; + bool isWeaponMagazined() const; + bool isSpaceRestrictor() const; + bool isStalker() const; + bool isAnomaly() const; + bool isMonster() const; + bool isExplosive() const; + bool isScriptZone() const; + bool isProjector() const; + bool isTrader() const; + bool isHudItem() const; + bool isFoodItem() const; + bool isArtefact() const; + bool isAmmo() const; + bool isMissile() const; + bool isPhysicsShellHolder() const; + bool isGrenade() const; + bool isBottleItem() const; + bool isTorch() const; + bool isWeaponGL() const; + bool isInventoryBox() const; + //end AVO + doors::door* m_door; }; diff --git a/src/xrGame/script_game_object4.cpp b/src/xrGame/script_game_object4.cpp index 66a2f1b9846..7f6d8725cdc 100644 --- a/src/xrGame/script_game_object4.cpp +++ b/src/xrGame/script_game_object4.cpp @@ -367,3 +367,299 @@ void CScriptGameObject::stop_particles(LPCSTR pname, LPCSTR bone) ai().script_engine().script_log( LuaMessageType::Error, "Cant stop particles, bone [%s] is not visible now", bone); } + +// AVO: functions for testing object class +// Credits: KD +//#include "Car.h" +#include "helicopter.h" +#include "Actor.h" +#include "CustomOutfit.h" +//#include "CustomZone.h" +#include "ai\Monsters\BaseMonster\base_monster.h" +#include "medkit.h" +#include "antirad.h" +#include "Scope.h" +#include "Silencer.h" +#include "Torch.h" +#include "GrenadeLauncher.h" +#include "searchlight.h" +//#include "WeaponAmmo.h" +#include "Grenade.h" +#include "BottleItem.h" +#include "WeaponMagazinedWGrenade.h" + +// Xottab_DUTY: commented this macro, because of substituting it +/* +#define TEST_OBJECT_CLASS(A, B)\ +bool A() const\ +{\ + auto l_tpEntity = smart_cast(&object());\ + if (!l_tpEntity)\ + return false;\ + return true;\ +}\ +*/ + +bool CScriptGameObject::isGameObject() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +/* +bool CScriptGameObject::isCar() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} +*/ + +bool CScriptGameObject::isHeli() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +/* +bool CScriptGameObject::isHolderCustom() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} +*/ + +bool CScriptGameObject::isEntityAlive() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isInventoryItem() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isInventoryOwner() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isActor() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isCustomMonster() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isWeapon() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isMedkit() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isEatableItem() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isAntirad() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isCustomOutfit() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isScope() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isSilencer() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isGrenadeLauncher() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isWeaponMagazined() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isSpaceRestrictor() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isStalker() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isAnomaly() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isMonster() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isExplosive() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isScriptZone() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isProjector() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isTrader() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isHudItem() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isFoodItem() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isArtefact() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isAmmo() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isMissile() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isPhysicsShellHolder() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isGrenade() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isBottleItem() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isTorch() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isWeaponGL() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} + +bool CScriptGameObject::isInventoryBox() const +{ + auto l_tpEntity = smart_cast(&object()); + if (!l_tpEntity) return false; + return true; +} +//end AVO diff --git a/src/xrGame/script_game_object_script3.cpp b/src/xrGame/script_game_object_script3.cpp index 1f540c5c68d..0ca1e277346 100644 --- a/src/xrGame/script_game_object_script3.cpp +++ b/src/xrGame/script_game_object_script3.cpp @@ -341,6 +341,46 @@ class_& script_register_game_object2(class_