diff -uwrN source/scripts/ConstructionYard.dox sourceold/scripts/ConstructionYard.dox --- source/scripts/ConstructionYard.dox 2014-02-22 16:19:09.631835900 +1000 +++ sourceold/scripts/ConstructionYard.dox 1970-01-01 10:00:00.000000000 +1000 @@ -1,25 +0,0 @@ -/*! -* \page page_tutorial_constructionYard Using a Construction Yard building controller -* \author jonwil -* \since 4.1 -* -* To create a working construction yard, place an appropriate building on your terrain. Then create a building controller of type construction yard. -* -* The following settings are specific to construction yard objects: -* \param RepairRate -* The rate to use when repairing buildings, in seconds -* \param VehicleRepairRate -* The rate to use when repairing buildings set up as vehicles, in seconds) -* \param RepairAmount -* The amount to repair -* \param LowPowerRepairAmount -* The amount to repair when the power is down -* \param RepairWarhead -* The warhead to use to do the repairs -* -* The way it works is that every RepairRate seconds, it will apply repair damage to all buildings of the correct team that are still alive, using RepairAmount or LowPowerRepairAmount and RepairWarhead. -* For vehicles it uses VehicleRepairRate and it will repair any vehicles of the correct team that have their Encyclopedia Type set to Building in LevelEdit. (it made sense as a convenient way to tell the construction yard logic what to repair and what not to repair) -* -* \note -* The construction yard object will not repair itself. -*/ \ No newline at end of file diff -uwrN source/scripts/Defines.h sourceold/scripts/Defines.h --- source/scripts/Defines.h 2014-02-22 16:19:10.222656200 +1000 +++ sourceold/scripts/Defines.h 2014-02-09 10:10:15.913734400 +1000 @@ -68,9 +68,16 @@ // unreachable code # ifdef DEBUG -# define TT_UNREACHABLE TT_INTERRUPT +# define TT_ASSUME_UNREACHABLE TT_INTERRUPT # else -# define TT_UNREACHABLE __assume(false); +# define TT_ASSUME_UNREACHABLE __assume(false); +# endif + +// unreachable code +# ifdef DEBUG +# define TT_ASSERT_UNREACHABLE TT_INTERRUPT +# else +# define TT_ASSERT_UNREACHABLE # endif #define TT_UNIMPLEMENTED TT_INTERRUPT diff -uwrN source/scripts/DefinitionMgrClass.h sourceold/scripts/DefinitionMgrClass.h --- source/scripts/DefinitionMgrClass.h 2014-02-22 16:19:10.273437500 +1000 +++ sourceold/scripts/DefinitionMgrClass.h 2013-10-30 23:16:11.890625000 +1000 @@ -23,13 +23,18 @@ class DefinitionClass; class ChunkSaveClass; class ChunkLoadClass; +class DefinitionMgrDelegate +{ +public: + virtual void onFreeDefinitions() = 0; +}; class DefinitionMgrClass : public SaveLoadSubSystemClass { private: #ifndef TTLE_EXPORTS static HashTemplateClass *>* DefinitionHash; static int _MaxDefinitionCount; - SHARED_API static DefinitionClass **_SortedDefinitionArray; + static DefinitionClass **_SortedDefinitionArray; static int _DefinitionCount; #endif public: @@ -38,30 +43,24 @@ ID_CLASS = 1, ID_SUPERCLASS = 2, }; - static unsigned long Get_New_ID(uint32 class_id); -#ifndef TTLE_EXPORTS - SHARED_API static DefinitionClass* Find_Definition(uint32 id, bool twiddle); - SHARED_API static DefinitionClass* Find_Named_Definition(const char* name, bool twiddle); - SHARED_API static DefinitionClass* Find_Typed_Definition(const char* name, uint32 class_id, bool twiddle); - SHARED_API static void Register_Definition(DefinitionClass *definition); - SHARED_API static void Unregister_Definition(DefinitionClass *definition); -#else static DefinitionClass* Find_Definition(uint32 id, bool twiddle); static DefinitionClass* Find_Named_Definition(const char* name, bool twiddle); static DefinitionClass* Find_Typed_Definition(const char* name, uint32 class_id, bool twiddle); + static void List_Available_Definitions(int superclass_id); + static void List_Available_Definitions(); + static unsigned long Get_New_ID(uint32 class_id); static void Register_Definition(DefinitionClass *definition); static void Unregister_Definition(DefinitionClass *definition); -#endif - SHARED_API static DefinitionClass *Get_First(uint32 id,ID_TYPE type = ID_CLASS); + static DefinitionClass *Get_First(uint32 id,ID_TYPE type = ID_CLASS); #ifndef TTLE_EXPORTS static DefinitionClass *Get_First() { return _SortedDefinitionArray[0]; } #endif - SHARED_API static DefinitionClass *Get_Next(DefinitionClass* curr_def,uint32 id,ID_TYPE type = ID_CLASS); - SHARED_API static DefinitionClass *Get_Next(DefinitionClass* curr_def); - SHARED_API static void Free_Definitions(); + static DefinitionClass *Get_Next(DefinitionClass* curr_def,uint32 id,ID_TYPE type = ID_CLASS); + static DefinitionClass *Get_Next(DefinitionClass* curr_def); + static void Free_Definitions(); static void Prepare_Definition_Array(); static int fnCompareDefinitionsCallback(const void* elem1, const void* elem2); DefinitionMgrClass(); diff -uwrN source/scripts/RenderObjClass.h sourceold/scripts/RenderObjClass.h --- source/scripts/RenderObjClass.h 2014-02-22 16:19:12.736328100 +1000 +++ sourceold/scripts/RenderObjClass.h 2013-11-11 08:45:20.515804800 +1000 @@ -261,8 +261,8 @@ void Set_Sub_Objects_Match_LOD(int onoff) { if (onoff) { Bits |= SUBOBJS_MATCH_LOD; } else { Bits &= ~SUBOBJS_MATCH_LOD; } } int Is_Sub_Objects_Match_LOD_Enabled(void) { return Bits & SUBOBJS_MATCH_LOD; } void Set_Sub_Object_Transforms_Dirty(bool onoff) { if (onoff) { Bits |= SUBOBJ_TRANSFORMS_DIRTY; } else { Bits &= ~SUBOBJ_TRANSFORMS_DIRTY; } } - bool Are_Sub_Object_Transforms_Dirty(void); - bool Bounding_Volumes_Valid(void) const; + bool Are_Sub_Object_Transforms_Dirty(void) { return (Bits & SUBOBJ_TRANSFORMS_DIRTY) != 0; } + bool Bounding_Volumes_Valid(void) const { return (Bits & BOUNDING_VOLUMES_VALID) != 0; } void Invalidate_Cached_Bounding_Volumes(void) const { Bits &= ~BOUNDING_VOLUMES_VALID; } void Validate_Cached_Bounding_Volumes(void) const { Bits |= BOUNDING_VOLUMES_VALID; } void Save_Sub_Object_User_Lighting(ChunkSaveClass & csave,RenderObjClass * sub_obj,int bone_index); @@ -275,14 +275,14 @@ TT_INLINE const SphereClass & RenderObjClass::Get_Bounding_Sphere(void) const { - if (!Bounding_Volumes_Valid()) { + if (!(Bits & BOUNDING_VOLUMES_VALID)) { Update_Cached_Bounding_Volumes(); } return CachedBoundingSphere; } TT_INLINE const AABoxClass & RenderObjClass::Get_Bounding_Box(void) const { - if (!Bounding_Volumes_Valid()) { + if (!(Bits & BOUNDING_VOLUMES_VALID)) { Update_Cached_Bounding_Volumes(); } return CachedBoundingBox; diff -uwrN source/scripts/Tutorials.dox sourceold/scripts/Tutorials.dox --- source/scripts/Tutorials.dox 2014-02-22 16:19:13.294921800 +1000 +++ sourceold/scripts/Tutorials.dox 1970-01-01 10:00:00.000000000 +1000 @@ -1,8 +0,0 @@ -/*! -* \page page_tutorials Tutorials -* -* The following tutorials have been written by members of the TT team to provide guidance on the -* usage of new features in scripts.dll -* -* \subpage page_tutorial_constructionYard -*/ \ No newline at end of file diff -uwrN source/scripts/VisTableMgrClass.h sourceold/scripts/VisTableMgrClass.h --- source/scripts/VisTableMgrClass.h 2014-02-22 16:19:13.382812500 +1000 +++ sourceold/scripts/VisTableMgrClass.h 2013-10-30 23:16:12.278320300 +1000 @@ -20,7 +20,7 @@ { public: SimpleVecClass Cache; //0 - MultiListClass tablelist; //C + RefMultiListClass tablelist; //C int timestamp; //24 VisDecompressionCacheClass() { diff -uwrN source/scripts/cinematics.dox sourceold/scripts/cinematics.dox --- source/scripts/cinematics.dox 2014-02-23 09:42:18.846070300 +1000 +++ sourceold/scripts/cinematics.dox 2013-11-07 17:16:06.259765600 +1000 @@ -40,8 +40,6 @@ * animations, you should use the value 0 for the event time. * * -* -* * \section page_cinematics_slots Slots * Many of the commands in the cinematics system use the concept of slots to refer to actual objects * within the game. There are a total of 40 slots available for using starting from index 0, making @@ -56,9 +54,6 @@ * with the message ID 10000 + the number of the slot to be populated. The ID of the object to be * added must be sent as the parameter for the custom message. * -* -* -* * \section page_cinematics_commands Commands * The following commands are available for use in cinematic scripts. Optional parameters for a * command are enclosed within [square brackets] and do not need to be specified for the command @@ -70,7 +65,6 @@ * Creates a fake cinematic object with the specified model and adds it to the slot. You should * not include the .w3d extension at the end of the model name. * -* * \subsection page_cinematics_commands_create_real_object Create_Real_Object * Parameters: slot, preset, [attachToSlot, attachToBone] * @@ -85,140 +79,101 @@ * the object outside of the cinematic and attaching it using a custom message or the * \ref page_cinematics_commands_add_object command * -* * \subsection page_cinematics_commands_add_object Add_Object -* Parameters: slot, preset -* -* Finds the closest instance of the specified preset and adds it the cinematic slot. Uses the -* position of the object the cinematic is attached to as the reference point for distance. +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_create_explosion Create_Exploision -* Parameters: explosionPreset, slot, bone -* -* Creates an instance of the specified explosion preset at the named bone on the object which -* is currently in the cinematic slot identified in the parameters -* -* \note -* The bone name is not optional, if you don't care where the explosion occurs use "origin" -* for the bone parameter +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_destroy_object Destroy_Object -* Parameters: slot -* -* Destroys the cinematic or real game object which is currently in the specified cinematic slot +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_play_animation Play_Animation -* Parameters: slot, animation, [loop, subobject, blended] -* -* Plays the named animation on the object currently in the identified cinematic slot. If the -* loop parameter is set to a non zero value it will replay the animation indefinitely until a -* new animation is set on the object, otherwise it will play the animation once. -* -* \note -* Blended mode only works on soldier objects and defaults to off. To use a blended animation -* set the value to 1. +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_play_complete_animation Play_Complete_Animation -* Parameters: slot, animation -* -* Plays the named animation on the object currently in the identified cinematic slot once from -* start to finish. +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_stop_animation Stop_Animation -* Parameters: slot -* -* Stops any current animation on the object in the identified cinematic slot +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_play_audio Play_Audio -* Parameters: preset, [slot, bone] -* -* Creates an instance of the specified sound preset. If the optional slot parameter is not -* specified this will be a 2D sound which is heard by all players in the game at full volume, -* otherwise it is a 3D sound at the location a bone on the the object currently in that slot. -* -* \note -* The bone name is not optional if slot is specified, if you don't care where on the object -* the sound occurs use "origin" for the bone parameter +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_control_camera Control_Camera -* Parameters: slot -* -* \todo Document the effects of this command +* Parameters: \todo Document Parameters * +* \todo Document Command * * \subsection page_cinematics_commands_send_custom Send_Custom * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_attach_to_bone Attach_To_Bone * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_attach_script Attach_Script * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_set_primary Set_Primary * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_move_slot Move_Slot * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_sniper_control Sniper_Control * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_shake_camera Shake_Camera * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_enable_shadow Enable_Shadow * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_enable_letterbox Enable_Letterbox * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_set_screen_fade_color Set_Screen_Fade_Color * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_set_screen_fade_opacity Set_Screen_Fade_Opacity * Parameters: \todo Document Parameters * * \todo Document Command * -* * \subsection page_cinematics_commands_show_message Show_Message * Parameters: \todo Document Parameters * diff -uwrN source/scripts/dllmain.cpp sourceold/scripts/dllmain.cpp --- source/scripts/dllmain.cpp 2014-02-22 16:19:10.378906200 +1000 +++ sourceold/scripts/dllmain.cpp 2013-10-30 23:16:12.424804600 +1000 @@ -285,8 +285,6 @@ Send_Shader_Param_Obj = (sspo)Address(tt,"Send_Shader_Param_Obj"); Set_GDI_Soldier_Name = (ssn)Address(tt,"Set_GDI_Soldier_Name"); Set_Nod_Soldier_Name = (ssn)Address(tt,"Set_Nod_Soldier_Name"); - Get_GDI_Soldier_Name = (gsnx)Address(tt,"Get_GDI_Soldier_Name"); - Get_Nod_Soldier_Name = (gsnx)Address(tt,"Get_Nod_Soldier_Name"); Get_IP_Address = (Get_IP_Addressx)Address(tt,"Get_IP_Address"); Get_IP_Port = (Get_IP_Portx)Address(tt,"Get_IP_Port"); Get_IP = (Get_IPx)Address(tt,"Get_IP"); diff -uwrN source/scripts/dp88_custom_timer_defines.h sourceold/scripts/dp88_custom_timer_defines.h --- source/scripts/dp88_custom_timer_defines.h 2014-02-22 16:19:10.479492100 +1000 +++ sourceold/scripts/dp88_custom_timer_defines.h 2014-02-08 06:34:48.011718700 +1000 @@ -45,15 +45,14 @@ #define CUSTOM_UNITSOUNDS_HEALDECREMENT (DP88_CUSTOM|MISC|0x02) //!< Used by dp88_unitSounds to track the amount of healing a unit has recieved over a time period #define CUSTOM_ROCKETEER_VEHICLEKILLED (DP88_CUSTOM|MISC|0x03) //!< Used by dp88_AR_Rocketeer to notify itself when the flight vehicle dies (via JFW_Death_Send_Custom) -#define TIMER_MISC_TICK (DP88_TIMER|MISC|0x01) //!< Miscellaneous tick timer for generic use by scripts that implement on-tick events -#define TIMER_RANDOMWEATHER (DP88_TIMER|MISC|0x02) //!< Used by dp88_randomWeather to do a weather update -#define TIMER_SPAWNVEHICLEPART (DP88_TIMER|MISC|0x03) //!< Used by dp88_spawnVehiclePart -#define TIMER_MIRAGE_CHECKMOVEMENT (DP88_TIMER|MISC|0x04) //!< Used by dp88_AR_MirageTank to test for movement to toggle mirage mode -#define TIMER_TURRETSOUND (DP88_TIMER|MISC|0x05) //!< Used by dp88_turretSound to test for turret rotation -#define TIMER_ROCKETEER_ENTERVEHICLE (DP88_TIMER|MISC|0x06) //!< Used by dp88_AR_Rocketeer to enter the flight vehicle -#define TIMER_PARADROP_CHECKFALLRATE (DP88_TIMER|MISC|0x07) //!< Used by dp88_AR_Paradrop to check if the falling speed drops (ie: landed) -#define TIMER_AMMO_ANIMATION (DP88_TIMER|MISC|0x08) //!< Used by dp88_Ammo_Animation to check for changes in ammo count -#define TIMER_CHECK_BASE_POWER_STATE (DP88_TIMER|MISC|0x09) //!< Used by any scripts which need to check if a base is still powered +#define TIMER_RANDOMWEATHER (DP88_TIMER|MISC|0x01) //!< Used by dp88_randomWeather to do a weather update +#define TIMER_SPAWNVEHICLEPART (DP88_TIMER|MISC|0x02) //!< Used by dp88_spawnVehiclePart +#define TIMER_MIRAGE_CHECKMOVEMENT (DP88_TIMER|MISC|0x03) //!< Used by dp88_AR_MirageTank to test for movement to toggle mirage mode +#define TIMER_TURRETSOUND (DP88_TIMER|MISC|0x04) //!< Used by dp88_turretSound to test for turret rotation +#define TIMER_ROCKETEER_ENTERVEHICLE (DP88_TIMER|MISC|0x05) //!< Used by dp88_AR_Rocketeer to enter the flight vehicle +#define TIMER_PARADROP_CHECKFALLRATE (DP88_TIMER|MISC|0x06) //!< Used by dp88_AR_Paradrop to check if the falling speed drops (ie: landed) +#define TIMER_AMMO_ANIMATION (DP88_TIMER|MISC|0x07) //!< Used by dp88_Ammo_Animation to check for changes in ammo count +#define TIMER_CHECK_BASE_POWER_STATE (DP88_TIMER|MISC|0x08) //!< Used by any scripts which need to check if a base is still powered // ------------------------------------------------------------------------------------------------- // Veterancy group @@ -173,6 +172,7 @@ #define TIMER_CLEG_CHECKRELEASETARGET 10055224 #define TIMER_LINKHEALTH 10055235 #define TIMER_LINKVETPOINTS 10055236 +#define TIMER_HEALTHARMOURREGENTICK 10055239 // Timers for prism towers and tesla coils #define TIMER_TESLACOIL_DECREMENT_CHARGE 2244040002 diff -uwrN source/scripts/dp88_misc.cpp sourceold/scripts/dp88_misc.cpp --- source/scripts/dp88_misc.cpp 2014-02-22 16:19:10.501953100 +1000 +++ sourceold/scripts/dp88_misc.cpp 2014-02-03 06:32:47.697078100 +1000 @@ -2413,108 +2413,3 @@ "dp88_Set_Team_On_Custom", "Message:int" ); - - - - - - - - - - -// ------------------------------------------------------------------------------------------------- -// Health regeneration script -// ------------------------------------------------------------------------------------------------- - -void dp88_RegenerateHitpoints::Created(GameObject *obj) -{ - m_amount = Get_Float_Parameter("Hitpoints"); - m_maxPercent = Get_Int_Parameter("Max_Percent")/100.0f; - m_interval = (float)Get_Int_Parameter("Interval"); - - m_lastDamage = time(NULL); - m_lastDamageTimeout = Get_Int_Parameter("Damage_Timeout"); - - m_warheadId = -1; - - const char* warhead = Get_Parameter("Warhead"); - if (Is_Valid_Warhead_Type(warhead)) - m_warheadId = ArmorWarheadManager::Get_Warhead_Type(warhead); - - Commands->Start_Timer(obj, this, m_interval, TIMER_MISC_TICK); -} - -// ------------------------------------------------------------------------------------------------- - -void dp88_RegenerateHitpoints::Timer_Expired(GameObject *obj, int number) -{ - // Only process this if we are not dead and are not inside the combat timeout - if (Commands->Get_Health(obj) > 0.0f && m_amount > 0 && m_lastDamageTimeout <= time(NULL)-m_lastDamage ) - { - float hp = Get_Hitpoints(obj); - float maxhp = Get_Max_Hitpoints(obj); - - if ( hp < maxhp ) - { - float regenCap = (maxhp*m_maxPercent); - float amount = min(m_amount,regenCap); - - if ( hp < regenCap ) - { - if ( m_warheadId != -1 ) - { - Commands->Apply_Damage(obj, m_amount, ArmorWarheadManager::Get_Armor_Name(m_warheadId), NULL); - } - else - { - float health = Commands->Get_Health(obj); - float hrepair = min(amount,Commands->Get_Max_Health(obj)-health); - Commands->Set_Health(obj, health+hrepair); - - float armour = Commands->Get_Shield_Strength(obj); - float arepair = min(amount-hrepair,Commands->Get_Max_Shield_Strength(obj)-armour); - Commands->Set_Shield_Strength(obj, armour+arepair); - } - } - } - } - - Commands->Start_Timer(obj, this, m_interval, TIMER_MISC_TICK); -} - -// ------------------------------------------------------------------------------------------------- - -void dp88_RegenerateHitpoints::Damaged(GameObject *obj, GameObject *damager, float amount) -{ - if (amount > 0.0f) - m_lastDamage = time(NULL); -} - -// ------------------------------------------------------------------------------------------------- - -void dp88_RegenerateHitpoints::Custom ( GameObject* pObj, int type, int param, GameObject* pSender ) -{ - if ( type == CUSTOM_VETERANCY_PROMOTED ) - { - if (2==param) - m_amount = Get_Float_Parameter("Hitpoints_Elite"); - else if (1==param) - m_amount = Get_Float_Parameter("Hitpoints_Veteran"); - else - m_amount = Get_Float_Parameter("Hitpoints"); - } -} - -// ------------------------------------------------------------------------------------------------- - -ScriptRegistrant dp88_RegenerateHitpoints_Registrant( - "dp88_RegenerateHitpoints", - "Hitpoints:float," - "Interval=1:int," - "Warhead:string," - "Max_Percent=100:int," - "Damage_Timeout=0:int," - "Hitpoints_Veteran:float," - "Hitpoints_Elite:float" -); \ No newline at end of file diff -uwrN source/scripts/dp88_misc.h sourceold/scripts/dp88_misc.h --- source/scripts/dp88_misc.h 2014-02-22 16:19:10.504882800 +1000 +++ sourceold/scripts/dp88_misc.h 2013-11-10 21:15:22.172226500 +1000 @@ -982,66 +982,3 @@ public: void Custom ( GameObject* pObj, int type, int param, GameObject* pSender ); }; - -// ------------------------------------------------------------------------------------------------- - -/*! -* \brief Health Regeneration -* \author Daniel Paul (danpaul88@yahoo.co.uk) -* -* Attach this script to a unit to enable it to regenerate health and armour hitpoints, up to a -* configurable % of its maximum hitpoints. Additionally it can also be configured to only repair -* hitpoints when not in combat, forcing the player to escape from battle or defeat their opponent -* before they begin regenerating their hitpoints. -* -* This script is compatible with the \ref dp88_veterancyUnit script and includes settings for -* alternative regeneration rates at higher veterancy levels, although it also works as a standalone -* script. -* -* \param Hitpoints -* The amount of hitpoints to repair each interval -* \param Interval -* The number of seconds between each repair interval -* \param Warhead -* The warhead to use when applying repair damage. If this is not set it will apply raw repairs -* without any warhead scaling. Note that the warhead must have a negative rating vs the unit skin -* and armour types otherwise the unit will actually take damage every interval -* \param Max_Percent -* The maximum percentage of the units total hitpoints that can be repaired, set this to 100 to -* allow the unit to be repaired completely -* \param Damage_Timeout -* The number of seconds to wait after the last damage event before regeneration is allowed. Set -* this to 0 to allow regeneration whilst in combat -* \param Hitpoints_Veteran -* The amount of hitpoints to repair when the unit is promoted to veteran. Only applicable when -* used alongside the \ref dp88_veterancyUnit script -* \param Hitpoints_Elite -* The amount of hitpoints to repair when the unit is promoted to veteran. Only applicable when -* used alongside the \ref dp88_veterancyUnit script -* -* \note -* This script treats all hitpoints as equal and the maximum percentage cap is based on the health -* and armour hitpoints added together. If you only want to repair health set the percentage cap to -* the percentage of total hitpoints represented by health, for example 50% if the unit has 50 -* health and 50 armour or 25% if the unit has 25 health and 75 armour -*/ -class dp88_RegenerateHitpoints : public ScriptImpClass -{ - void Created( GameObject *obj ); - void Timer_Expired( GameObject *obj, int number ); - void Damaged ( GameObject *obj, GameObject *damager, float amount ); - void Custom( GameObject *obj, int type, int param, GameObject *sender ); - -private: - /*! Time of the last non-repair damage event */ - time_t m_lastDamage; - - /*! \name Cached Script Parameters */ - /*! @{ */ - float m_amount; - float m_interval; - float m_maxPercent; - int m_warheadId; - int m_lastDamageTimeout; - /*! @} */ -}; \ No newline at end of file diff -uwrN source/scripts/dp88_veterancy.cpp sourceold/scripts/dp88_veterancy.cpp --- source/scripts/dp88_veterancy.cpp 2014-02-22 16:19:10.507812500 +1000 +++ sourceold/scripts/dp88_veterancy.cpp 2014-02-08 06:34:48.033203100 +1000 @@ -1109,6 +1109,121 @@ // ------------------------------------------------------------------------------------------------- +// Veterancy - Regeneration +// ------------------------------------------------------------------------------------------------- + +void dp88_veterancyRegeneration::Created( GameObject *obj ) +{ + veterancyLevel = 0; + Commands->Start_Timer ( obj, this, 1.0f, TIMER_HEALTHARMOURREGENTICK ); + + m_regenAmount = Get_Int_Parameter("rookie_regenAmount"); + m_bRepairArmour = (Get_Int_Parameter("rookie_repairArmour")==1); +} + +// ------------------------------------------------------------------------------------------------- + +void dp88_veterancyRegeneration::Timer_Expired( GameObject *obj, int number ) +{ + // Only process this if we are not dead... + float hitpoints = Commands->Get_Health(obj); + if ( hitpoints > 0.0f && m_regenAmount > 0 ) + { + float regenAmount = (float)m_regenAmount; + + // First try to heal some of our health, but don't go beyond the maximum + float max = Commands->Get_Max_Health(obj); + if ( hitpoints < max ) + { + hitpoints += regenAmount; + regenAmount = 0; + + if ( hitpoints > max ) + { + regenAmount = max-hitpoints; + hitpoints = max; + } + + Commands->Set_Health( obj, hitpoints ); + } + + + // If we have any leftover regeneration then apply it to our armour, if enabled + if ( m_bRepairArmour && regenAmount > 0 ) + { + hitpoints = Commands->Get_Shield_Strength(obj); + max = Commands->Get_Max_Shield_Strength(obj); + + if ( hitpoints < max ) + { + hitpoints += regenAmount; + + if ( hitpoints > max ) + hitpoints = max; + } + + Commands->Set_Shield_Strength( obj, hitpoints ); + } + } + + // Restart the timer + Commands->Start_Timer ( obj, this, 1.0f, TIMER_HEALTHARMOURREGENTICK ); +} + +// ------------------------------------------------------------------------------------------------- + +void dp88_veterancyRegeneration::Custom( GameObject *obj, int type, int param, GameObject *sender ) +{ + if ( type == CUSTOM_VETERANCY_PROMOTED ) + { + veterancyLevel = param; + if ( veterancyLevel == 2 ) + { + m_regenAmount = Get_Int_Parameter("elite_regenAmount"); + m_bRepairArmour = (Get_Int_Parameter("elite_repairArmour")==1); + } + else if ( veterancyLevel == 1 ) + { + m_regenAmount = Get_Int_Parameter("veteran_regenAmount"); + m_bRepairArmour = (Get_Int_Parameter("veteran_repairArmour")==1); + } + else + { + m_regenAmount = Get_Int_Parameter("rookie_regenAmount"); + m_bRepairArmour = (Get_Int_Parameter("rookie_repairArmour")==1); + } + } +} + +// ------------------------------------------------------------------------------------------------- + +ScriptRegistrant dp88_veterancyRegeneration_Registrant( + "dp88_veterancyRegeneration", + "rookie_regenAmount=0:int," + "rookie_repairArmour=1:int," + "veteran_regenAmount=0:int," + "veteran_repairArmour=1:int," + "elite_regenAmount=1:int," + "elite_repairArmour=1:int"); + +// Legacy registrant for existing AR presets +ScriptRegistrant dp88_AR_Veterancy_HealthArmourRegen_Registrant( + "dp88_AR_Veterancy_HealthArmourRegen", + "rookie_healthRegenAmount=0:int," + "rookie_armourRegenAmount=0:int," + "veteran_healthRegenAmount=1:int," + "veteran_armourRegenAmount=0:int," + "elite_healthRegenAmount=3:int," + "elite_armourRegenAmount=2:int"); + + + + + + + + +// ------------------------------------------------------------------------------------------------- // Veterancy - Grant Powerup // ------------------------------------------------------------------------------------------------- diff -uwrN source/scripts/dp88_veterancy.h sourceold/scripts/dp88_veterancy.h --- source/scripts/dp88_veterancy.h 2014-02-22 16:19:10.509765600 +1000 +++ sourceold/scripts/dp88_veterancy.h 2014-02-03 06:32:47.701960900 +1000 @@ -154,6 +154,45 @@ // ------------------------------------------------------------------------------------------------- /*! +* \brief Veterancy - Regeneration +* \author Daniel Paul (danpaul88@yahoo.co.uk) +* +* This is a companion script for dp88_veterancyUnit which grants health regeneration to a unit based +* upon it's current promotion level (rookie, veteran, elite). It can optionally also repair their +* armour, but only once their health has been fully restored and at the same speed. +* +* \param rookie_regenAmount +* Number of hitpoints to heal, per second, whilst this unit is at rookie level +* \param rookie_repairArmour +* Whether to repair armour as well as health, whilst this unit is at rookie level. 1 to enable +* armour repairs, 0 to disable and only restore health +* \param veteran_regenAmount +* Number of hitpoints to heal, per second, whilst this unit is at veteran level +* \param veteran_repairArmour +* Whether to repair armour as well as health, whilst this unit is at veteran level. 1 to enable +* armour repairs, 0 to disable and only restore health +* \param elite_regenAmount +* Number of hitpoints to heal, per second, whilst this unit is at elite level +* \param elite_repairArmour +* Whether to repair armour as well as health, whilst this unit is at elite level. 1 to enable +* armour repairs, 0 to disable and only restore health +*/ +class dp88_veterancyRegeneration : public ScriptImpClass +{ + void Created( GameObject *obj ); + void Timer_Expired( GameObject *obj, int number ); + void Custom( GameObject *obj, int type, int param, GameObject *sender ); + +private: + int veterancyLevel; + + int m_regenAmount; + bool m_bRepairArmour; +}; + +// ------------------------------------------------------------------------------------------------- + +/*! * \brief Veterancy - Grant Weapon * \author Daniel Paul (danpaul88@yahoo.co.uk) * diff -uwrN source/scripts/engine_common.cpp sourceold/scripts/engine_common.cpp --- source/scripts/engine_common.cpp 2014-02-22 16:19:10.579101500 +1000 +++ sourceold/scripts/engine_common.cpp 2014-02-09 10:10:15.902992200 +1000 @@ -57,7 +57,7 @@ case 0: function = a; break; case 1: function = b; break; case 4: function = c; break; - default: TT_UNREACHABLE; + default: TT_ASSUME_UNREACHABLE; } TT_ASSERT(function != nullptr); diff -uwrN source/scripts/engine_io.cpp sourceold/scripts/engine_io.cpp --- source/scripts/engine_io.cpp 2014-02-22 16:19:10.624023400 +1000 +++ sourceold/scripts/engine_io.cpp 2013-11-11 08:45:20.529476700 +1000 @@ -300,16 +300,10 @@ strcpy(sectionName, line); while (!isLastLine) { - int count = Read_Line(cacheStraw, line, 512, isLastLine); + Read_Line(cacheStraw, line, 512, isLastLine); if (line[0] == '[' && strchr(line, ']')) break; Strip_Comments(line); - if (count) - { - if (line[0] != ';') - { - if (line[0] != '=') - { char* delimiter = strchr(line, '='); if (delimiter) { @@ -331,9 +325,6 @@ } } } - } - } - } else { while (!isLastLine) @@ -350,17 +341,11 @@ } while (!isLastLine) { - int count = Read_Line(cacheStraw, line, 512, isLastLine); + Read_Line(cacheStraw, line, 512, isLastLine); if (line[0] == '[' && strchr(line, ']')) break; Strip_Comments(line); char* delimiter = strchr(line, '='); - if (count) - { - if (line[0] != ';') - { - if (line[0] != '=') - { if (delimiter) { *delimiter = '\0'; @@ -389,9 +374,6 @@ } } } - } - } - } if (section->EntryList.Is_Empty()) { delete section; diff -uwrN source/scripts/engine_obj2.cpp sourceold/scripts/engine_obj2.cpp --- source/scripts/engine_obj2.cpp 2014-02-22 16:19:10.761718700 +1000 +++ sourceold/scripts/engine_obj2.cpp 2014-02-08 06:34:48.054687500 +1000 @@ -654,7 +654,7 @@ SCRIPTS_API GameObject* Create_Object_Attach_To_Object(GameObject* host, const char* preset, const char* bone = NULL) { - GameObject* obj = Commands->Create_Object_At_Bone(host, preset, (NULL != bone) ? bone : "origin"); + GameObject* obj = Commands->Create_Object_At_Bone(host, "preset", (NULL != bone) ? bone : "origin"); if ( NULL != obj ) { Commands->Set_Facing(obj, Commands->Get_Facing(host)); diff -uwrN source/scripts/engine_obj2.h sourceold/scripts/engine_obj2.h --- source/scripts/engine_obj2.h 2014-02-22 16:19:10.763671800 +1000 +++ sourceold/scripts/engine_obj2.h 2014-02-08 06:34:48.059570300 +1000 @@ -53,7 +53,6 @@ /*! * \brief Create an object and attach it to a bone * \author Daniel Paul (danpaul88@yahoo.co.uk) -* \ingroup api_objects * * Creates a new instance of the named preset and attaches it to a specific bone on the specified * object, or the origin of the object if no bone is specified. diff -uwrN source/scripts/engine_string.h sourceold/scripts/engine_string.h --- source/scripts/engine_string.h 2014-02-22 16:19:10.948242100 +1000 +++ sourceold/scripts/engine_string.h 2013-11-11 08:45:20.554867300 +1000 @@ -167,7 +167,7 @@ bool StartsWithI(const char* string) { - return _strnicmp(m_Buffer, string, strlen(string)) == 0; + return strncmp(m_Buffer, string, strlen(string)) == 0; } uint GetHash() const diff -uwrN source/scripts/engine_tt.cpp sourceold/scripts/engine_tt.cpp --- source/scripts/engine_tt.cpp 2014-02-22 16:19:10.981445300 +1000 +++ sourceold/scripts/engine_tt.cpp 2013-11-21 17:09:50.637695300 +1000 @@ -141,8 +141,6 @@ SCRIPTS_API sspo Send_Shader_Param_Obj; SCRIPTS_API ssn Set_GDI_Soldier_Name; SCRIPTS_API ssn Set_Nod_Soldier_Name; -SCRIPTS_API gsnx Get_GDI_Soldier_Name; -SCRIPTS_API gsnx Get_Nod_Soldier_Name; SCRIPTS_API Get_IP_Addressx Get_IP_Address; SCRIPTS_API Get_IP_Portx Get_IP_Port; SCRIPTS_API Get_IPx Get_IP; @@ -994,6 +992,18 @@ AT2(0x00740D50,0x007405F0); RENEGADE_FUNCTION +DefinitionClass* DefinitionMgrClass::Find_Definition(uint32 id, bool twiddle) +AT3(0x00526760,0x00526000,0x007166AD); + +RENEGADE_FUNCTION +DefinitionClass* DefinitionMgrClass::Find_Named_Definition(const char* name, bool twiddle) +AT3(0x00526860,0x00526100,0x007168A7); + +RENEGADE_FUNCTION +DefinitionClass* DefinitionMgrClass::Find_Typed_Definition(const char* name, uint32 class_id, bool twiddle) +AT3(0x005268E0,0x00526180,0x00716981); + +RENEGADE_FUNCTION SCRIPTS_API bool PhysicsSceneClass::Cast_Ray(PhysRayCollisionTestClass & raytest,bool use_collision_region) AT3(0x00631460,0x00630D00,0x006B0100); diff -uwrN source/scripts/engine_tt.h sourceold/scripts/engine_tt.h --- source/scripts/engine_tt.h 2014-02-22 16:19:11.029296800 +1000 +++ sourceold/scripts/engine_tt.h 2013-11-07 17:16:06.532226500 +1000 @@ -98,7 +98,6 @@ typedef void (*sspo) (const char* parameter,const char* value,GameObject* obj); typedef void (*sspop) (GameObject* player,const char* parameter,const char* value,GameObject* obj); typedef void (*ssn) (const char *name); -typedef const char *(*gsnx) (); typedef void (*addConnectionAcceptanceFilterType)(ConnectionAcceptanceFilter* connectionAcceptanceFilters); typedef bool (*removeConnectionAcceptanceFilterType)(ConnectionAcceptanceFilter* connectionAcceptanceFilters); typedef const char *(*Get_IP_Addressx) (int PlayerID); @@ -255,8 +254,6 @@ SCRIPTS_API extern sspo Send_Shader_Param_Obj; //dont use, use the other calls below instead SCRIPTS_API extern ssn Set_GDI_Soldier_Name; SCRIPTS_API extern ssn Set_Nod_Soldier_Name; -SCRIPTS_API extern gsnx Get_GDI_Soldier_Name; -SCRIPTS_API extern gsnx Get_Nod_Soldier_Name; SCRIPTS_API extern Get_IP_Addressx Get_IP_Address; SCRIPTS_API extern Get_IP_Portx Get_IP_Port; SCRIPTS_API extern Get_IPx Get_IP; diff -uwrN source/scripts/gmgame.cpp sourceold/scripts/gmgame.cpp --- source/scripts/gmgame.cpp 2014-02-22 16:19:11.155273400 +1000 +++ sourceold/scripts/gmgame.cpp 2013-11-21 19:00:49.221679600 +1000 @@ -494,14 +494,8 @@ } WeaponDrops.Remove_All(); VehicleWreckages.Remove_All(); - if (GDISpawnChar) - { delete[] GDISpawnChar; - } - if (NodSpawnChar) - { delete[] NodSpawnChar; - } for (int i = 0;i < RegisteredEvents[EVENT_GLOBAL_INI].Count();i++) { RegisteredEvents[EVENT_GLOBAL_INI][i]->OnFreeData(); @@ -525,6 +519,12 @@ if (SSGMIni) { + StringClass GDISpawnCharx; + StringClass NodSpawnCharx; + SSGMIni->Get_String(GDISpawnCharx,"General","GDISpawnChar","CnC_GDI_MiniGunner_0"); + SSGMIni->Get_String(NodSpawnCharx,"General","NodSpawnChar","CnC_Nod_Minigunner_0"); + GDISpawnChar = newstr(GDISpawnCharx); + NodSpawnChar = newstr(NodSpawnCharx); InvincibleBuildings = SSGMIni->Get_Bool("General","InvincibleBuildings",false); ForceTeam = SSGMIni->Get_Int("General","ForceTeam",-1); RefillLimit = SSGMIni->Get_Int("General","RefillLimit",0); @@ -621,20 +621,17 @@ RegisteredEvents[EVENT_GLOBAL_INI][i]->OnLoadGlobalINISettings(SSGMIni); } } + else + { + GDISpawnChar = newstr("CnC_GDI_MiniGunner_0"); + NodSpawnChar = newstr("CnC_Nod_MiniGunner_0"); + } if ( freeIni ) Release_INI(SSGMIni); } void SSGMGameManager::ReadMapConfig() { - if (GDISpawnChar) - { - delete[] GDISpawnChar; - } - if (NodSpawnChar) - { - delete[] NodSpawnChar; - } INIClass *SSGMIni = 0; RawFileClass file("SSGM.ini"); if (file.Is_Available(0)) @@ -643,12 +640,6 @@ } if (SSGMIni) { - StringClass GDISpawnCharx; - StringClass NodSpawnCharx; - SSGMIni->Get_String(GDISpawnCharx,"General","GDISpawnChar",Get_GDI_Soldier_Name()); - SSGMIni->Get_String(NodSpawnCharx,"General","NodSpawnChar",Get_Nod_Soldier_Name()); - GDISpawnChar = newstr(GDISpawnCharx); - NodSpawnChar = newstr(NodSpawnCharx); int count2 = SSGMIni->Entry_Count("PresetDisable"); for (int i = 0;i < count2;i++) { @@ -699,11 +690,6 @@ } delete[] s; } - else - { - GDISpawnChar = newstr(Get_GDI_Soldier_Name()); - NodSpawnChar = newstr(Get_Nod_Soldier_Name()); - } Release_INI(SSGMIni); } diff -uwrN source/scripts/gmsoldier.cpp sourceold/scripts/gmsoldier.cpp --- source/scripts/gmsoldier.cpp 2014-02-22 16:19:11.174804600 +1000 +++ sourceold/scripts/gmsoldier.cpp 2013-10-30 23:16:13.637695300 +1000 @@ -134,6 +134,13 @@ void SSGM_Soldier::Destroyed(GameObject *obj) { + DynamicVectorClass *weapons = WeaponDrops.Get(Commands->Get_Preset_Name(obj),0); + if (weapons) + { + GameObject *pup = Commands->Create_Object((*weapons)[Commands->Get_Random_Int(0,weapons->Count())],Commands->Get_Position(obj)); + Attach_Script_Once(pup,"SSGM_Powerup_Expire",""); + } + Vector3 pos = Commands->Get_Position(obj); SSGMGameLog::Log_Gamelog("DESTROYED;SOLDIER;%d;%s;%d;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y), int(pos.X), int(pos.Z), int(Commands->Get_Points(obj))); Unbind_Vehicle(obj, true); @@ -352,14 +359,6 @@ Commands->Create_2D_WAV_Sound("humiliation.wav"); } } - - // Weapon drops - DynamicVectorClass *weapons = WeaponDrops.Get(Commands->Get_Preset_Name(obj),0); - if (weapons) - { - GameObject *pup = Commands->Create_Object((*weapons)[Commands->Get_Random_Int(0,weapons->Count())],Commands->Get_Position(obj)); - Attach_Script_Once(pup,"SSGM_Powerup_Expire",""); - } } ScriptRegistrant SSGM_Soldier_Registrant("SSGM_Soldier",""); diff -uwrN source/scripts/scripts.vcxproj sourceold/scripts/scripts.vcxproj --- source/scripts/scripts.vcxproj 2014-02-22 16:19:12.920898400 +1000 +++ sourceold/scripts/scripts.vcxproj 2014-02-08 06:34:48.069335900 +1000 @@ -835,12 +835,32 @@ - + - + + + + + + + + + + + + + + + + + + + + + diff -uwrN source/scripts/scripts.vcxproj.filters sourceold/scripts/scripts.vcxproj.filters --- source/scripts/scripts.vcxproj.filters 2014-02-22 16:19:12.931640600 +1000 +++ sourceold/scripts/scripts.vcxproj.filters 2014-02-08 06:34:48.072265600 +1000 @@ -18,9 +18,6 @@ {5e366579-cb1f-4e1c-ad6d-4be536adb3f3} - - {46b4dd7a-1d86-4d73-a589-98c1a0f207c6} - @@ -1215,9 +1212,75 @@ + + Documentation + Documentation + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + + + Documentation + Documentation @@ -1230,11 +1293,5 @@ Documentation - - Documentation\Tutorials - - - Documentation\Tutorials - \ No newline at end of file diff -uwrN source/shared/shared.vcxproj sourceold/shared/shared.vcxproj --- source/shared/shared.vcxproj 2014-02-22 16:19:13.500976500 +1000 +++ sourceold/shared/shared.vcxproj 2014-02-08 06:34:13.611328100 +1000 @@ -194,7 +194,6 @@ - diff -uwrN source/shared/shared.vcxproj.filters sourceold/shared/shared.vcxproj.filters --- source/shared/shared.vcxproj.filters 2014-02-22 16:19:13.505859300 +1000 +++ sourceold/shared/shared.vcxproj.filters 2013-10-30 23:16:15.401367100 +1000 @@ -52,8 +52,5 @@ 01. Sources - - 01. Sources - \ No newline at end of file