diff -uwr source/scripts/AirFactoryGameObjDef.h sourceold/scripts/AirFactoryGameObjDef.h --- source/scripts/AirFactoryGameObjDef.h 2015-10-11 13:18:52.072461000 +1000 +++ sourceold/scripts/AirFactoryGameObjDef.h 2015-02-25 22:57:18.441406200 +1000 @@ -33,7 +33,6 @@ int DropCinematicDefId; int CinematicSlotIndex; float CinematicTimer; - bool DefaultEngineEnable; friend class AirFactoryGameObj; friend class PresetDump; }; diff -uwr source/scripts/ArmedGameObj.h sourceold/scripts/ArmedGameObj.h --- source/scripts/ArmedGameObj.h 2015-10-11 13:18:52.088086000 +1000 +++ sourceold/scripts/ArmedGameObj.h 2015-02-25 22:57:18.454101500 +1000 @@ -27,7 +27,6 @@ virtual bool Save( ChunkSaveClass & csave ); virtual bool Load( ChunkLoadClass & cload ); virtual void On_Post_Load( void ); - virtual void Export_Creation( BitStreamClass & packet ); virtual void Import_Frequent( BitStreamClass & packet ); virtual void Export_Frequent( BitStreamClass & packet ); virtual void Import_State_Cs( BitStreamClass & packet ); Only in source/scripts: ConversationClass.h diff -uwr source/scripts/DialogueClass.h sourceold/scripts/DialogueClass.h --- source/scripts/DialogueClass.h 2015-10-11 13:18:52.244336000 +1000 +++ sourceold/scripts/DialogueClass.h 2015-02-25 22:57:18.708007800 +1000 @@ -31,7 +31,6 @@ int Get_Conversation_ID() const {return Conversation_ID;} float Get_Weight() const {return Weight;} void Set_Conversation_ID(int id) {Conversation_ID = id;} - void Set_Weight(float weight) {Weight = weight;} }; class DialogueClass { @@ -48,9 +47,6 @@ void Load_Variables(ChunkLoadClass& cload); void Free_Options(); int Get_Conversation(); - DynamicVectorClass &Get_Option_List() {return DialogueOptions;} - float Get_Silence_Weight() {return SilenceWeight;} - void Set_Silence_Weight(float weight) {SilenceWeight = weight;} }; // size: 32 enum DialogueTypes { Only in source/scripts: JMGRenetBuster.h Only in source/scripts: JMGRenetBusters.cpp diff -uwr source/scripts/PhysDefClass.h sourceold/scripts/PhysDefClass.h --- source/scripts/PhysDefClass.h 2015-10-11 13:18:52.416211000 +1000 +++ sourceold/scripts/PhysDefClass.h 2015-02-25 22:57:18.879882800 +1000 @@ -27,10 +27,10 @@ TERRAIN_AND_BULLET_COLLISION_GROUP, // collides with terrain and bullets BULLET_ONLY_COLLISION_GROUP, // collides only with bullets SOLDIER_COLLISION_GROUP, // collides with everything (but only soldiers use it) - SOLDIER_GHOST_COLLISION_GROUP, // behaves like SOLDIER but doesn't collide with unit groups + SOLDIER_GHOST_COLLISION_GROUP, // collides with everything but soldiers // new collision groups here, 8 - 14 - C4_COLLISION_GROUP, // behaves like DEFAULT but collides with SOLDIER_GHOST and doesn't collide with WATER_EDGE or UNDERGROUND_TRANSITION + C4_COLLISION_GROUP, // behaves like DEFAULT but doesn't collide with any custom collision groups besides itself UNDERGROUND_COLLISION_GROUP, // collides with TERRAIN and itself SOLDIER_ONLY_COLLISION_GROUP, // collides only with SOLDIER and SOLDIER_GHOST SOLDIER_BULLET_COLLISION_GROUP, // collides with C4, BULLET, SOLDIER and SOLDIER_GHOST @@ -51,11 +51,6 @@ DEFAULT_AND_SOLDIER_ONLY_COLLISION_GROUP, // collides with DEFAULT, SOLDIER, and SOLDIER_GHOST - PLAYER_BUILDING_COLLISION_GROUP, // behaves like a mix of TERRAIN/DEFAULT but doesn't collde with PLAYER_BUILDING_GHOST - PLAYER_BUILDING_GHOST_COLLISION_GROUP, // behaves like DEFAULT but doesn't collde with PLAYER_BUILDING - TRAIN_COLLISION_GROUP, // behaves like DEFAULT but collides with TRAIN_TRACK and doesn't collide with WATER_EDGE - TRAIN_TRACK_COLLISION_GROUP, // collides only with TRAIN - COLLISION_GROUP_MAX = 32, // not a collision group } Collision_Group_Type; @@ -86,10 +81,6 @@ case AMPHIBIOUS_UNIT_FLOOR_COLLISION_GROUP: return "Amphibious Unit Floor"; case UNDERGROUND_TRANSITION_COLLISION_GROUP:return "Underground Transition"; case DEFAULT_AND_SOLDIER_ONLY_COLLISION_GROUP: return "Default and Soldier only"; - case PLAYER_BUILDING_COLLISION_GROUP: return "Player Building"; - case PLAYER_BUILDING_GHOST_COLLISION_GROUP: return "Player Building Ghost"; - case TRAIN_COLLISION_GROUP: return "Train"; - case TRAIN_TRACK_COLLISION_GROUP: return "Train Track"; default: return NULL; // NULL == do not add to friendly name list }; }; diff -uwr source/scripts/ScriptableGameObj.h sourceold/scripts/ScriptableGameObj.h --- source/scripts/ScriptableGameObj.h 2015-10-11 13:18:52.541211000 +1000 +++ sourceold/scripts/ScriptableGameObj.h 2015-02-25 22:57:19.064453100 +1000 @@ -52,7 +52,6 @@ const SimpleDynVecClass & Get_Observers( void ) { return Observers; } void SCRIPTS_API Insert_Observer( GameObjObserverClass * observer ); void Start_Observer_Timer( int observer_id, float duration, int timer_id ); - void Stop_Observer_Timer( int timer_id ); void Start_Custom_Timer( ScriptableGameObj * from, float delay, int type, int param ); virtual ScriptableGameObj *As_ScriptableGameObj( void ) { return this; }; virtual DamageableGameObj *As_DamageableGameObj( void ) { return NULL; }; diff -uwr source/scripts/SoldierGameObj.h sourceold/scripts/SoldierGameObj.h --- source/scripts/SoldierGameObj.h 2015-10-11 13:18:52.572461000 +1000 +++ sourceold/scripts/SoldierGameObj.h 2015-05-31 07:05:27.725609300 +1000 @@ -193,13 +193,6 @@ bool Is_Frozen() {return Freeze;} void Lock_Collision_Mode(bool lockCollisionGroup,Collision_Group_Type lock); Collision_Group_Type *Get_Locked_Collision_Mode(); - void Set_Can_Play_Damage_Animations(bool onoff) {CanPlayDamageAnimations = onoff;Set_Object_Dirty_Bit(BIT_RARE, true);} - bool Can_Play_Damage_Animations() {return CanPlayDamageAnimations;} - void Set_Scale_Across_Network(float scale){NetworkRescale = scale;Set_Object_Dirty_Bit(BIT_RARE, true);} - float Get_Scale_Across_Network(){return NetworkRescale;} - void Set_Movement_Loiters_Allowed(bool allowed){movementLoitersAllowed = allowed;}; - bool Get_Movement_Loiter_Allowed(){return movementLoitersAllowed;}; - bool Get_Use_Stock_Ghost_Behavior(){return useStockGhostBehavior;} protected: RenderObjClass * WeaponRenderModel; //2416 RenderObjClass * BackWeaponRenderModel; //2420 @@ -263,11 +256,6 @@ void Update_Healing_Effect( void ); int head_bone; int neck_bone; - bool CanPlayDamageAnimations; - float NetworkRescale; - float LastScale; - bool movementLoitersAllowed; - bool useStockGhostBehavior; TT_DEPRECATED("Do not use") int Check(void); }; // size: 3404 diff -uwr source/scripts/SoldierGameObjDef.h sourceold/scripts/SoldierGameObjDef.h --- source/scripts/SoldierGameObjDef.h 2015-10-11 13:18:52.572461000 +1000 +++ sourceold/scripts/SoldierGameObjDef.h 2015-02-25 22:57:19.093750000 +1000 @@ -38,7 +38,6 @@ float Get_Skeleton_Width() const {return SkeletonWidth;}; bool Is_Spy() const {return IsSpy;} bool Can_Refill() const { return CanRefill; } - bool Is_Unsquishable() const { return IsUnsquishable; } protected: float TurnRate; float JumpVelocity; diff -uwr source/scripts/VehicleFactoryGameObj.h sourceold/scripts/VehicleFactoryGameObj.h --- source/scripts/VehicleFactoryGameObj.h 2015-10-11 13:18:52.666211000 +1000 +++ sourceold/scripts/VehicleFactoryGameObj.h 2015-02-25 22:57:19.168945300 +1000 @@ -32,7 +32,7 @@ void On_Destroyed (void); void On_Revived (void); void Think (void); - bool Is_Available (void) const { return !IsBusy && !IsDestroyed && !IsDisabled && !GeneratingVehicleID && !Vehicle; } + bool Is_Available (void) const { return (IsBusy == false) && (IsDestroyed == false) && (IsDisabled == false); } bool Is_Available_For_Purchase (void) const; bool Is_Busy (void) const { return IsBusy; } bool Is_Disabled (void) const { return IsDisabled != 0; } diff -uwr source/scripts/VehicleGameObj.h sourceold/scripts/VehicleGameObj.h --- source/scripts/VehicleGameObj.h 2015-10-11 13:18:52.681836000 +1000 +++ sourceold/scripts/VehicleGameObj.h 2015-05-12 19:41:14.735351500 +1000 @@ -124,7 +124,7 @@ bool Get_Scripts_Can_Fire() { return CanFire; }; void Set_Allow_Stealth_While_Empty(bool onoff) { AllowStealthWhileEmpty = onoff; Set_Object_Dirty_Bit(BIT_RARE, true); }; bool Get_Allow_Stealth_While_Empty() const { return AllowStealthWhileEmpty; }; - void Damage_Meshes_Update() { DamageMeshesUpdate = true; DamageMeshesNetworkUpdate = true; Set_Object_Dirty_Bit(NetworkObjectClass::BIT_FREQUENT, true); } + void Damage_Meshes_Update() {DamageMeshesUpdate = true; Set_Object_Dirty_Bit(NetworkObjectClass::BIT_FREQUENT,true);} void Set_Occupant(int seat, SoldierGameObj *occupant) {SeatOccupants[seat] = occupant;} bool Is_Underground() { return Peek_Physical_Object()->Get_Collision_Group() == UNDERGROUND_COLLISION_GROUP; } SCRIPTS_API void Set_Immovable(bool b); @@ -233,7 +233,6 @@ ReferencerClass Owner; //Owner for SSGM vehicle locking. When this is set, only this player can enter the vehicle. bool HasUpdatedTargeting; bool CanDrive; //used to identify if it should apply analog control or not, for EMP purposes - bool DamageMeshesNetworkUpdate; void Remove_Transitions( TransitionDataClass::StyleType transition_type ); void Create_New_Transitions( TransitionDataClass::StyleType transition_type ); diff -uwr source/scripts/WeaponBagClass.h sourceold/scripts/WeaponBagClass.h --- source/scripts/WeaponBagClass.h 2015-10-11 13:18:52.697461000 +1000 +++ sourceold/scripts/WeaponBagClass.h 2015-02-25 22:57:19.187500000 +1000 @@ -51,16 +51,13 @@ void HUD_Reset_Changed( void ) { HUDIsChanged = false; } bool Move_Contents( WeaponBagClass * source ); void Store_Inventory( InventoryClass * ); - void Owner_Initialized(bool b) {OwnerInitialized = b;} - bool Is_Owner_Initialized() {return OwnerInitialized;} private: - ArmedGameObj *Owner; //0 - DynamicVectorClass WeaponList; //4 - int WeaponIndex; //1C - bool IsChanged; //20 - bool HUDIsChanged; //21 - bool OwnerInitialized; //22 + ArmedGameObj *Owner; + DynamicVectorClass WeaponList; + int WeaponIndex; + bool IsChanged; + bool HUDIsChanged; WeaponClass * Find_Weapon( const WeaponDefinitionClass * def ); void Mark_Owner_Dirty( void ); bool Should_Skip_Weapon(WeaponClass* weapon); diff -uwr source/scripts/WeaponClass.h sourceold/scripts/WeaponClass.h --- source/scripts/WeaponClass.h 2015-10-11 13:18:52.697461000 +1000 +++ sourceold/scripts/WeaponClass.h 2015-04-22 05:53:37.949218700 +1000 @@ -159,9 +159,7 @@ bool Fire_Beacon( const AmmoDefinitionClass *ammo_def ); void Fire_Bullet( const AmmoDefinitionClass *ammo_def, bool primary ); void clientReloadingSync(); - void cleintReloadAmmoSync(); void sendReloadNetworkCall(int reloadingObjectId,int originatingClientId); - void sendClientAmmoAcrossNetwork(int originalPlayerId,int reloadingObjectId,int weaponId,int clipRounds,int backpackRounds); const WeaponDefinitionClass* Definition; // 0000 ReferencerClass Owner; // 0004 @@ -207,8 +205,6 @@ void Unignore_Owner( void ); AudibleSoundClass *GlobalFiringSound; bool tiltGunWhileReloading; -public: - static void Set_Ammo_By_WeaponId_No_Networking(GameObject *obj,int weaponId,int clipBullets,int inventoryRounds); }; // 00AC #endif \ No newline at end of file diff -uwr source/scripts/dllmain.cpp sourceold/scripts/dllmain.cpp --- source/scripts/dllmain.cpp 2015-10-11 13:18:52.791211000 +1000 +++ sourceold/scripts/dllmain.cpp 2015-05-31 07:05:27.725609300 +1000 @@ -353,9 +353,6 @@ Set_Object_Visibility = (sov)Address(tt,"Set_Object_Visibility"); Lock_Soldier_Collision_Group = (lscg)Address(tt,"Lock_Soldier_Collision_Group"); Unlock_Soldier_Collision_Group = (ulscg)Address(tt,"Unlock_Soldier_Collision_Group"); - Unlock_Soldier_Collision_Group = (ulscg)Address(tt,"Unlock_Soldier_Collision_Group"); - Stop_Timer = (ss)Address(tt,"Stop_Timer"); - Create_2D_Wave_Sound_Dialog_Player = (cwsdp)Address(tt,"Create_2D_Wave_Sound_Dialog_Player"); #ifdef SSGM SSGMGameManager::Init(); #endif diff -uwr source/scripts/dp88_custom_timer_defines.h sourceold/scripts/dp88_custom_timer_defines.h --- source/scripts/dp88_custom_timer_defines.h 2015-10-11 13:18:52.853711000 +1000 +++ sourceold/scripts/dp88_custom_timer_defines.h 2015-05-17 10:48:03.122836000 +1000 @@ -45,7 +45,6 @@ #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 CUSTOM_VEHICLE_DEPLOY (DP88_CUSTOM|MISC|0x04) //!< Used by deployable vehicle scripts to notify other scripts of a change in the deployment state, 0 = undeployed, 1 = deploying, 2 = deployed, 3 = undeploying -#define CUSTOM_RADAR_JAM (DP88_CUSTOM|MISC|0x05) //!< Used by new Radar Jammer scripts to switch radar off and on and also play jamming sounds, 0 = radar off, 1 = radar on #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 diff -uwr source/scripts/dp88_misc.cpp sourceold/scripts/dp88_misc.cpp --- source/scripts/dp88_misc.cpp 2015-10-11 13:18:52.853711000 +1000 +++ sourceold/scripts/dp88_misc.cpp 2015-05-31 21:43:40.656273400 +1000 @@ -1702,8 +1702,6 @@ if ( m_captureState == targetState && Get_Object_Type(pObj) != team ) { // Send control taken message - ChangeOwner(pObj, team); - int stringId = Get_String_ID_By_Desc(Get_Parameter("CapturedString")); if ( stringId != 0 ) { @@ -1714,6 +1712,8 @@ DisplayMessage(pObj, StringClass("A conquest zone has been captured by %OWNINGTEAM%")); } + ChangeOwner(pObj, team); + // \todo Give capture points if ( !m_bTickRunning ) @@ -1726,8 +1726,6 @@ && Get_Object_Type(pObj) != 2 ) { // Send neutral message - ChangeOwner(pObj, 2); - int stringId = Get_String_ID_By_Desc(Get_Parameter("NeutralString")); if ( stringId != 0 ) { @@ -1737,6 +1735,8 @@ { DisplayMessage(pObj, StringClass("A conquest zone has become neutral")); } + + ChangeOwner(pObj, 2); } @@ -1817,8 +1817,6 @@ message.Replace("%TICKPOINTS%", StringClass::getFormattedString("%d",Get_Int_Parameter("TickPoints")), false); message.Replace("%TICKINTERVAL%", StringClass::getFormattedString("%d",Get_Int_Parameter("TickInterval")), false); - message.Replace("%ZONENAME%", Get_Translated_Preset_Name(pObj), false); - if (2 == sendtoteam) Send_Message(50,200,50,message); else @@ -2602,12 +2600,6 @@ { ApplyNonWarheadRepairs(obj, amount, bHealth, bArmour); } - - // Trigger update for built-in engine damage bones - if (obj->As_VehicleGameObj()) - { - obj->As_VehicleGameObj()->Damage_Meshes_Update(); - } } } } diff -uwr source/scripts/dp88_misc.h sourceold/scripts/dp88_misc.h --- source/scripts/dp88_misc.h 2015-10-11 13:18:52.853711000 +1000 +++ sourceold/scripts/dp88_misc.h 2015-05-31 21:43:30.122093700 +1000 @@ -663,7 +663,6 @@ * %%CAPTUREPOINTS% The value of CapturePoints * %%TICKPOINTS% The value of TickPoints * %%TICKINTERVAL% The value of TickInterval -* %%ZONENAME% The translated name of the object this script is attached to * */ class dp88_conquestControlZone : public ScriptImpClass diff -uwr source/scripts/engine_obj2.cpp sourceold/scripts/engine_obj2.cpp --- source/scripts/engine_obj2.cpp 2015-10-11 13:18:52.916211000 +1000 +++ sourceold/scripts/engine_obj2.cpp 2015-02-25 22:57:19.338867100 +1000 @@ -600,15 +600,6 @@ return false; } -bool SCRIPTS_API Is_Unsquishable(GameObject *obj) -{ - if (obj && obj->As_SoldierGameObj()) - { - return obj->As_SoldierGameObj()->Get_Definition().Is_Unsquishable(); - } - return true; -} - SCRIPTS_API bool Is_Stealth_Enabled(GameObject *obj) { if (obj && obj->As_SoldierGameObj()) diff -uwr source/scripts/engine_obj2.h sourceold/scripts/engine_obj2.h --- source/scripts/engine_obj2.h 2015-10-11 13:18:52.916211000 +1000 +++ sourceold/scripts/engine_obj2.h 2015-02-25 22:57:19.340820300 +1000 @@ -50,7 +50,6 @@ SCRIPTS_API int Get_Object_Count_In_Zone(GameObject *obj,int Team); //Get the object count in a zone SCRIPTS_API bool Is_Stealth_Enabled(GameObject *obj); //Is stealth enabled int SCRIPTS_API Get_Occupant_Seat(GameObject *vehicle,GameObject *occupant); //returns the seat that the occupant is sitting in or -1 if they aren't in the vehicle -bool SCRIPTS_API Is_Unsquishable(GameObject *obj); //Is this soldier unsquishable /*! * \brief Create an object and attach it to a bone diff -uwr source/scripts/engine_string.h sourceold/scripts/engine_string.h --- source/scripts/engine_string.h 2015-10-11 13:18:52.963086000 +1000 +++ sourceold/scripts/engine_string.h 2015-02-25 22:57:19.362304600 +1000 @@ -1067,45 +1067,6 @@ return (string.Copy_Wide (m_Buffer)); } -struct hash_istring: public std::unary_function -{ - size_t operator()(const char* str) const - { - // djb2 - unsigned long hash = 5381; - while (int c = tolower(*str++)) hash = hash * 33 + c; - return hash; - } - - size_t operator()(const StringClass& str) const - { - return (*this)(str.Peek_Buffer()); - } -}; - -struct equals_istring: public std::binary_function -{ - bool operator()(const char* a, const char* b) const - { - return _stricmp(a, b) == 0; - } - - size_t operator()(const StringClass& a, const StringClass& b) const - { - return _stricmp(a.Peek_Buffer(), b.Peek_Buffer()) == 0; - } - - size_t operator()(const StringClass& a, const char* b) const - { - return _stricmp(a.Peek_Buffer(), b) == 0; - } - - size_t operator()(const char* a, const StringClass& b) const - { - return _stricmp(a, b.Peek_Buffer()) == 0; - } -}; - SCRIPTS_API const wchar_t *CharToWideChar(const char *str); //convert a char to a wide char SCRIPTS_API const char *WideCharToChar(const wchar_t *wcs); //convert a wide char to a char SCRIPTS_API char *newstr(const char *str); //duplicate a character string diff -uwr source/scripts/engine_tdb.cpp sourceold/scripts/engine_tdb.cpp --- source/scripts/engine_tdb.cpp 2015-10-11 13:18:52.963086000 +1000 +++ sourceold/scripts/engine_tdb.cpp 2015-02-25 22:57:19.364257800 +1000 @@ -141,38 +141,6 @@ return newstr("Neutral"); } -SCRIPTS_API StringClass Get_Short_Team_Name(int Team) -{ - StringClass Return; - if (!Team) - { - Return = Get_Wide_Translated_String(7198); - } - else if (Team == 1) - { - Return = Get_Wide_Translated_String(7199); - } - else - { - Return = "Neutral"; - } - Return.cropTo(3); - return Return; -} - -SCRIPTS_API const wchar_t *Get_Wide_Team_Name(int Team) -{ - if (!Team) - { - return Get_Wide_Translated_String(7198); - } - else if (Team == 1) - { - return Get_Wide_Translated_String(7199); - } - return L"Neutral"; -} - SCRIPTS_API const wchar_t *Get_Wide_Vehicle_Name(GameObject *obj) { if (!obj) diff -uwr source/scripts/engine_tdb.h sourceold/scripts/engine_tdb.h --- source/scripts/engine_tdb.h 2015-10-11 13:18:52.963086000 +1000 +++ sourceold/scripts/engine_tdb.h 2015-02-25 22:57:19.366210900 +1000 @@ -80,24 +80,6 @@ /*! * \ingroup api_translations * -* Get the first 3 characters of the translated name of the specified team -* -* \param[in] Team ID of the team to get the translated name of -*/ -SCRIPTS_API StringClass Get_Short_Team_Name(int Team); - -/*! -* \ingroup api_translations -* -* Get the translated name of the specified team -* -* \param[in] Team ID of the team to get the translated name of -*/ -SCRIPTS_API const wchar_t *Get_Wide_Team_Name(int Team); - -/*! -* \ingroup api_translations -* * Get the translated name of a specified vehicle, as shown in the HUD display * * \param[in] obj VehicleGameObject to get the translated name of diff -uwr source/scripts/engine_tt.cpp sourceold/scripts/engine_tt.cpp --- source/scripts/engine_tt.cpp 2015-10-11 13:18:52.978711000 +1000 +++ sourceold/scripts/engine_tt.cpp 2015-05-31 07:05:27.725609300 +1000 @@ -204,8 +204,6 @@ SCRIPTS_API sov Set_Object_Visibility; SCRIPTS_API lscg Lock_Soldier_Collision_Group; SCRIPTS_API ulscg Unlock_Soldier_Collision_Group; -SCRIPTS_API ss Stop_Timer; -SCRIPTS_API cwsdp Create_2D_Wave_Sound_Dialog_Player; SCRIPTS_API bool Can_Team_Build_Vehicle(int Team) { diff -uwr source/scripts/engine_tt.h sourceold/scripts/engine_tt.h --- source/scripts/engine_tt.h 2015-10-11 13:18:52.978711000 +1000 +++ sourceold/scripts/engine_tt.h 2015-05-31 07:05:27.741234300 +1000 @@ -160,7 +160,6 @@ typedef void (*sov) (int objectId,bool visible); typedef void (*lscg) (GameObject *obj,Collision_Group_Type collisionGroupType); typedef void (*ulscg) (GameObject *obj); -typedef int (*cwsdp) (GameObject *obj,const char *soundname); SCRIPTS_API extern gpl Get_Player_List; SCRIPTS_API extern gcmi Get_Current_Map_Index; SCRIPTS_API extern gm Get_Map; @@ -323,8 +322,6 @@ SCRIPTS_API extern sov Set_Object_Visibility; SCRIPTS_API extern lscg Lock_Soldier_Collision_Group; SCRIPTS_API extern ulscg Unlock_Soldier_Collision_Group; -SCRIPTS_API extern ss Stop_Timer; -SCRIPTS_API extern cwsdp Create_2D_Wave_Sound_Dialog_Player; class SCRIPTS_API JFW_Key_Hook_Base : public ScriptImpClass { public: diff -uwr source/scripts/jfwcust.cpp sourceold/scripts/jfwcust.cpp --- source/scripts/jfwcust.cpp 2015-10-11 13:18:53.041211000 +1000 +++ sourceold/scripts/jfwcust.cpp 2015-02-25 22:57:19.575195300 +1000 @@ -1593,16 +1593,6 @@ } } -void JFW_Send_Message_On_Key::Created(GameObject *obj) -{ - InstallHook(Get_Parameter("Key"), obj); -} - -void JFW_Send_Message_On_Key::KeyHook() -{ - Send_Message_Player(Owner(),Get_Int_Parameter("Red"), Get_Int_Parameter("Green"), Get_Int_Parameter("Blue"), Get_Parameter("Message")); -} - void JFW_Startup_Custom_Self::Created(GameObject *obj) { int msg = Get_Int_Parameter("Message"); @@ -1721,7 +1711,6 @@ ScriptRegistrant JFW_Shader_Custom_Poke_Registrant("JFW_Shader_Custom_Poke","Number:int,Number2:float"); ScriptRegistrant JFW_Kill_All_Buildings_Customs_Registrant("JFW_Kill_All_Buildings_Customs","Message:int,Count:int,Player_Type:int"); ScriptRegistrant JFW_Send_Self_Custom_On_Key_Registrant("JFW_Send_Self_Custom_On_Key","Key=Key:string,Message=0:int,Once=1:int"); -ScriptRegistrant JFW_Send_Message_On_Key_Registrant("JFW_Send_Message_On_Key", "Key:string,Message:string,Red:int,Green:int,Blue:int"); ScriptRegistrant JFW_Custom_Send_Random_Custom_Registrant("JFW_Custom_Send_Random_Custom", "RecieveMessage:int,SendMessage:int,SendParam:int,SendID:int,Percentage:int"); ScriptRegistrant JFW_Startup_Custom_Self_Registrant("JFW_Startup_Custom_Self","Message:int,Param=0:int,Delay=0:int"); ScriptRegistrant JFW_Set_Skin_Custom_Registrant("JFW_Set_Skin_Custom","Message:int,Armour:string"); diff -uwr source/scripts/jfwcust.h sourceold/scripts/jfwcust.h --- source/scripts/jfwcust.h 2015-10-11 13:18:53.041211000 +1000 +++ sourceold/scripts/jfwcust.h 2015-02-25 22:57:19.577148400 +1000 @@ -474,11 +474,6 @@ void KeyHook(); }; -class JFW_Send_Message_On_Key : public JFW_Key_Hook_Base { - void Created(GameObject *obj); - void KeyHook(); -}; - /*! * \brief Send a custom to itself * \author jonwil diff -uwr source/scripts/jfwhook.cpp sourceold/scripts/jfwhook.cpp --- source/scripts/jfwhook.cpp 2015-10-11 13:18:53.072461000 +1000 +++ sourceold/scripts/jfwhook.cpp 2015-05-20 22:09:56.882812500 +1000 @@ -773,213 +773,6 @@ Auto_Save_Variable(&enabled,1,1); } -void JFW_Jetpack_Timer_No_Fly::Detach(GameObject *obj) -{ - if (Exe != 4) - { - if (Get_Fly_Mode(obj)) - { - Toggle_Fly_Mode(obj); - } - } - JFW_Key_Hook_Base::Detach(obj); -} - -void JFW_Jetpack_Timer_No_Fly::Created(GameObject *obj) -{ - enabled = true; - hookid = 0; - k = 0; - time = true; - nofly = false; - InstallHook("Jetpack",obj); -} - -void JFW_Jetpack_Timer_No_Fly::Custom(GameObject *obj,int type,int param,GameObject *sender) -{ - if (type == Get_Int_Parameter("EnableMessage")) - { - enabled = true; - } - if (type == Get_Int_Parameter("DisableMessage")) - { - enabled = false; - } - if (type == Get_Int_Parameter("NoFlyOn")) - { - nofly = true; - if (Get_Fly_Mode(obj)) - { - obj->As_PhysicalGameObj()->Clear_Animation(); - Toggle_Fly_Mode(obj); - time = false; - Stop_Timer(Owner(),1); - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("Timer"),1); - } - } - if (type == Get_Int_Parameter("NoFlyOff")) - { - nofly = false; - } -} - -void JFW_Jetpack_Timer_No_Fly::KeyHook() -{ - if (!nofly) - { - if (enabled && !Get_Vehicle(Owner())) - { - if (time) - { - if(!Get_Fly_Mode(Owner())) - { - Commands->Set_Animation(Owner(), Get_Parameter("OnAnimation"), true, 0, 0, -1, true); - } - else - { - Owner()->As_PhysicalGameObj()->Clear_Animation(); - } - Toggle_Fly_Mode(Owner()); - time = false; - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("Timer"),1); - } - else - { - unsigned int red; - unsigned int green; - unsigned int blue; - Get_Team_Color(Get_Player_Type(Owner()),&red,&green,&blue); - Send_Message_Player(Owner(),red,green,blue,Get_Parameter("Message")); - } - } - } - else - { - unsigned int red; - unsigned int green; - unsigned int blue; - Get_Team_Color(Get_Player_Type(Owner()),&red,&green,&blue); - Send_Message_Player(Owner(),red,green,blue,Get_Parameter("NoFlyMessage")); - } -} - -void JFW_Jetpack_Timer_No_Fly::Timer_Expired(GameObject *obj,int number) -{ - time = true; -} - -void JFW_Limited_Jetpack_Timer_No_Fly::Detach(GameObject *obj) -{ - if (Exe != 4) - { - if (Get_Fly_Mode(obj)) - { - Toggle_Fly_Mode(obj); - } - } - JFW_Key_Hook_Base::Detach(obj); -} - -void JFW_Limited_Jetpack_Timer_No_Fly::Created(GameObject *obj) -{ - enabled = true; - hookid = 0; - k = 0; - timeon = true; - timeoff = true; - nofly = false; - InstallHook("Jetpack",obj); -} - -void JFW_Limited_Jetpack_Timer_No_Fly::Custom(GameObject *obj,int type,int param,GameObject *sender) -{ - if (type == Get_Int_Parameter("EnableMessage")) - { - enabled = true; - } - if (type == Get_Int_Parameter("DisableMessage")) - { - enabled = false; - } - if (type == Get_Int_Parameter("NoFlyOn")) - { - nofly = true; - if (Get_Fly_Mode(obj)) - { - obj->As_PhysicalGameObj()->Clear_Animation(); - Toggle_Fly_Mode(obj); - timeoff = true; - Stop_Timer(obj,1); - Stop_Timer(obj,3); - timeon = false; - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("TimerOn"),2); - } - } - if (type == Get_Int_Parameter("NoFlyOff")) - { - nofly = false; - } -} - -void JFW_Limited_Jetpack_Timer_No_Fly::KeyHook() -{ - if (!nofly) - { - if (enabled && !Get_Vehicle(Owner())) - { - if ((!Get_Fly_Mode(Owner()) && timeon) || (Get_Fly_Mode(Owner()) && timeoff)) - { - if(!Get_Fly_Mode(Owner())) - { - Commands->Set_Animation(Owner(), Get_Parameter("OnAnimation"), true, 0, 0, -1, true); - timeoff = false; - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("TimerOff"),1); - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("TimerUse"),3); - } - else - { - Owner()->As_PhysicalGameObj()->Clear_Animation(); - timeon = false; - Commands->Start_Timer(Owner(),this,Get_Float_Parameter("TimerOn"),2); - } - Toggle_Fly_Mode(Owner()); - } - else - { - unsigned int red; - unsigned int green; - unsigned int blue; - Get_Team_Color(Get_Player_Type(Owner()),&red,&green,&blue); - Send_Message_Player(Owner(),red,green,blue,Get_Parameter("Message")); - } - } - } - else - { - unsigned int red; - unsigned int green; - unsigned int blue; - Get_Team_Color(Get_Player_Type(Owner()),&red,&green,&blue); - Send_Message_Player(Owner(),red,green,blue,Get_Parameter("NoFlyMessage")); - } -} - -void JFW_Limited_Jetpack_Timer_No_Fly::Timer_Expired(GameObject *obj,int number) -{ - if (number == 1) - { - timeoff = true; - } - else if (number == 2) - { - timeon = true; - } - else if ((number == 3) && Get_Fly_Mode(Owner())) - { - KeyHook(); - } -} - ScriptRegistrant JFW_Attach_Script_Preset_Created_Registrant("JFW_Attach_Script_Preset_Created","Script:string,Params:string,Delim:string,Preset:string,Player_Type:int"); ScriptRegistrant JFW_Attach_Script_Type_Created_Registrant("JFW_Attach_Script_Type_Created","Script:string,Params:string,Delim:string,Type:int,Player_Type:int"); ScriptRegistrant JFW_Attach_Script_Player_Created_Registrant("JFW_Attach_Script_Player_Created","Script:string,Params:string,Delim:string,Player_Type:int"); @@ -992,5 +785,3 @@ ScriptRegistrant JFW_Jetpack_Model_Registrant("JFW_Jetpack_Model","DisableMessage:int,EnableMessage:int,OnModel:string,OffModel:string,OnAnimation=null.null:string"); ScriptRegistrant JFW_Suicide_Bomber_Registrant("JFW_Suicide_Bomber","Explosion:string"); ScriptRegistrant JFW_Sidebar_Key_2_Registrant("JFW_Sidebar_Key_2","Key=Sidebar:string,Enable_Custom=0:int,Disable_Custom=0:int,Sound:string"); -ScriptRegistrant JFW_Jetpack_Timer_No_Fly_Registrant("JFW_Jetpack_Timer_No_Fly","DisableMessage:int,EnableMessage:int,OnAnimation=null.null:string,timer:float,Message:string,NoFlyOn:int,NoFlyOff:int,NoFlyMessage:string"); -ScriptRegistrant JFW_Limited_Jetpack_Timer_No_Fly_Registrant("JFW_Limited_Jetpack_Timer_No_Fly","DisableMessage:int,EnableMessage:int,OnAnimation=null.null:string,TimerOff:float,TimerOn:Float,TimerUse:float,Message:string,NoFlyOn:int,NoFlyOff:int,NoFlyMessage:string"); diff -uwr source/scripts/jfwhook.h sourceold/scripts/jfwhook.h --- source/scripts/jfwhook.h 2015-10-11 13:18:53.072461000 +1000 +++ sourceold/scripts/jfwhook.h 2015-05-18 14:24:50.056054700 +1000 @@ -102,27 +102,3 @@ class JFW_Sidebar_Key_2 : public ScriptImpClass { }; - -class JFW_Jetpack_Timer_No_Fly : public JFW_Key_Hook_Base { - bool enabled; - bool time; - bool time2; - bool nofly; - void Detach(GameObject *obj); - void Created(GameObject *obj); - void Custom(GameObject *obj,int type,int param,GameObject *sender); - void Timer_Expired(GameObject *obj,int number); - void KeyHook(); -}; - -class JFW_Limited_Jetpack_Timer_No_Fly : public JFW_Key_Hook_Base { - bool enabled; - bool timeon; - bool timeoff; - bool nofly; - void Detach(GameObject *obj); - void Created(GameObject *obj); - void Custom(GameObject *obj,int type,int param,GameObject *sender); - void Timer_Expired(GameObject *obj,int number); - void KeyHook(); -}; diff -uwr source/scripts/jfwmisc.cpp sourceold/scripts/jfwmisc.cpp --- source/scripts/jfwmisc.cpp 2015-10-11 13:18:53.088086000 +1000 +++ sourceold/scripts/jfwmisc.cpp 2015-05-18 08:46:00.237695300 +1000 @@ -1291,39 +1291,6 @@ Destroy_Script(); } -void JFW_SoldierFactory_Disable::Created(GameObject *obj) -{ - count = 0; -} - -void JFW_SoldierFactory_Disable::Custom(GameObject *obj,int type,int param,GameObject *sender) -{ - if (obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_SoldierFactoryGameObj()) - { - if (type == Get_Int_Parameter("Disable_Custom")) - { - if (count == 0) - { - Set_Can_Generate_Soldiers(Commands->Get_Player_Type(obj),false); - } - count++; - } - if (type == Get_Int_Parameter("Enable_Custom")) - { - count--; - if (count == 0) - { - Set_Can_Generate_Soldiers(Commands->Get_Player_Type(obj),true); - } - } - } -} - -void JFW_SoldierFactory_Disable::Killed(GameObject *obj,GameObject *killer) -{ - Destroy_Script(); -} - void JFW_Engineer_Hack::Created(GameObject *obj) { Warhead = ArmorWarheadManager::Get_Warhead_Type(Get_Parameter("Hack_Warhead")); @@ -1479,7 +1446,7 @@ void JFW_EMP_Mine::Enemy_Seen(GameObject *obj, GameObject *enemy) { - if ((Is_Script_Attached(enemy,"JFW_EMP") || Is_Script_Attached(enemy,"JFW_EMP_Indicator")) && !DisableEmp) + if (Is_Script_Attached(enemy,"JFW_EMP") && !DisableEmp) { bool fire = false; VehicleGameObj *o = enemy->As_VehicleGameObj(); @@ -2761,62 +2728,6 @@ } } -void JFW_EMP_Indicator::Created(GameObject *obj) -{ - id = 0; - Warhead = ArmorWarheadManager::Get_Warhead_Type(Get_Parameter("Warhead")); -} - -void JFW_EMP_Indicator::Damaged(GameObject *obj,GameObject *damager,float amount) -{ - if (Warhead == Get_Damage_Warhead() && !DisableEmp) - { - VehicleGameObj *o = obj->As_VehicleGameObj(); - if (o && o->Get_Is_Scripts_Visible() && o->Get_Scripts_Can_Fire() && o->Can_Drive()) - { - Commands->Enable_Engine(obj,false); - o->Set_Can_Drive(false); - o->Set_Scripts_Can_Fire(false); - o->Set_Stealth_Active(false); - Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),1); - GameObject *indicator = Commands->Create_Object_At_Bone(obj,Get_Parameter("Preset"),Get_Parameter("Bone")); - Commands->Attach_To_Object_Bone(indicator,obj,Get_Parameter("Bone")); - id = Commands->Get_ID(indicator); - obj->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true); - } - SoldierGameObj *s = obj->As_SoldierGameObj(); - if (s && !s->Is_Frozen() && s->Is_Visible()) - { - s->Set_Freeze(true); - Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),1); - } - } -} - -void JFW_EMP_Indicator::Timer_Expired(GameObject *obj,int number) -{ - VehicleGameObj *o = obj->As_VehicleGameObj(); - if (o) - { - o->Clear_Animation(); - obj->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true); - o->Set_Can_Drive(true); - o->Set_Stealth_Active(true); - Commands->Enable_Engine(obj,true); - o->Set_Scripts_Can_Fire(true); - GameObject *indicator = Commands->Find_Object(id); - if (indicator) - { - Commands->Destroy_Object(indicator); - } - } - SoldierGameObj *s = obj->As_SoldierGameObj(); - if (s) - { - s->Set_Freeze(false); - } -} - ScriptRegistrant JFW_Tech_Level_Timer_Registrant("JFW_Tech_Level_Timer", "Display_Message:string,Red:int,Blue:int,Green:int,Sound:string,Time:float,Tech_Level:int"); ScriptRegistrant JFW_Tech_Level_Startup_Registrant("JFW_Tech_Level_Startup","Tech_Level:int"); ScriptRegistrant JFW_Tech_Level_Custom_Registrant("JFW_Tech_Level_Custom","Message:int,Tech_Level:int"); @@ -2886,8 +2797,7 @@ ScriptRegistrant JFW_VehicleFactory_Disable_Registrant("JFW_VehicleFactory_Disable","Disable_Custom:int,Enable_Custom:int"); ScriptRegistrant JFW_AirFactory_Disable_Registrant("JFW_AirFactory_Disable","Disable_Custom:int,Enable_Custom:int"); ScriptRegistrant JFW_NavalFactory_Disable_Registrant("JFW_NavalFactory_Disable","Disable_Custom:int,Enable_Custom:int"); -ScriptRegistrant JFW_SoldierFactory_Disable_Registrant("JFW_SoldierFactory_Disable","Disable_Custom:int,Enable_Custom:int"); -ScriptRegistrant JFW_EMP_Registrant("JFW_EMP","Warhead:string,Time:float,Animation:string"); +ScriptRegistrant JFW_EMP_Registrant("JFW_EMP","Warhead:string,Time:fload,Animation:string"); ScriptRegistrant JFW_EMP_Mine_Registrant("JFW_EMP_Mine","Mine_Manager_ID:int,Explosion:string,Time:float"); ScriptRegistrant JFW_EMP_Mine_Manager_Registrant("JFW_EMP_Mine_Manager","Mine_Preset:string,Mine_Limit:int,Mine_Reload:string,Mine_Z_Offset:float,Mine_Distance:float"); ScriptRegistrant JFW_EMP_Mine_Manager_2_Registrant("JFW_EMP_Mine_Manager_2","Mine_Preset:string,Mine_Limit:int,Mine_Reload:string,Throw_Velocity:float"); @@ -2920,4 +2830,3 @@ ScriptRegistrant JFW_Airstrike_Cinematic_Registrant("JFW_Airstrike_Cinematic", "Script_Name:string,Message:int"); ScriptRegistrant JFW_Spy_Disguise_Target_Registrant("JFW_Spy_Disguise_Target", "Model:string,Warhead:string"); ScriptRegistrant JFW_Spawner_Delay_Registrant("JFW_Spawner_Delay", "ID:int,time:float"); -ScriptRegistrant JFW_EMP_Indicator_Registrant("JFW_EMP_Indicator","Warhead:string,Time:float,Preset:string,Bone:string"); diff -uwr source/scripts/jfwmisc.h sourceold/scripts/jfwmisc.h --- source/scripts/jfwmisc.h 2015-10-11 13:18:53.088086000 +1000 +++ sourceold/scripts/jfwmisc.h 2015-05-18 08:46:00.241601600 +1000 @@ -474,13 +474,6 @@ unsigned int count; }; -class JFW_SoldierFactory_Disable : public ScriptImpClass { - void Created(GameObject *obj); - void Custom(GameObject *obj,int type,int param,GameObject *sender); - void Killed(GameObject *obj,GameObject *killer); - unsigned int count; -}; - class JFW_Engineer_Hack : public ScriptImpClass { unsigned int Warhead; int IndcatorID; @@ -693,11 +686,3 @@ void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); }; - -class JFW_EMP_Indicator : public ScriptImpClass { - unsigned int Warhead; - unsigned int id; - void Created(GameObject *obj); - void Damaged(GameObject *obj,GameObject *damager,float amount); - void Timer_Expired(GameObject *obj,int number); -}; diff -uwr source/scripts/jfwobj.cpp sourceold/scripts/jfwobj.cpp --- source/scripts/jfwobj.cpp 2015-10-11 13:18:53.088086000 +1000 +++ sourceold/scripts/jfwobj.cpp 2015-06-09 08:36:06.653320300 +1000 @@ -2583,25 +2583,25 @@ { obj->As_VehicleGameObj()->Set_Immovable(true); mode = 1; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,1,0); Commands->Set_Model(obj,dmodel); Commands->Set_Animation(obj,deployanim,false,0,0,-1,0); Commands->Control_Enable(sender,false); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("DeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 1, 0); } } else if (mode == 2) { mode = 3; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,3,0); Commands->Set_Model(obj,dmodel); Commands->Set_Animation(obj,deployanim,false,0,Get_Float_Parameter("Last_Deploy_Frame"),0,0); Commands->Control_Enable(sender,false); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("UndeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 3, 0); } } } @@ -2615,26 +2615,26 @@ if (!_stricmp(animation_name,deployanim) && (mode == 1)) { mode = 2; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,2,0); Commands->Set_Model(obj,deployedmodel); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj,false); Commands->Enable_Vehicle_Transitions(obj,true); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 2, 0); return; } if (!_stricmp(animation_name,deployanim) && (mode == 3)) { obj->As_VehicleGameObj()->Set_Immovable(false); mode = 0; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,0,0); Commands->Set_Model(obj,model); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj,true); Commands->Enable_Vehicle_Transitions(obj,true); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 0, 0); return; } } @@ -3246,19 +3246,20 @@ if (!_stricmp(animation_name,deployanim) && (mode == 1)) { mode = 2; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,2,0); Commands->Set_Model(obj,deployedmodel); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj,false); Commands->Enable_Vehicle_Transitions(obj,true); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 2, 0); return; } if (!_stricmp(animation_name,deployanim) && (mode == 3)) { obj->As_VehicleGameObj()->Set_Immovable(false); mode = 0; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,0,0); Commands->Set_Model(obj,model); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Control_Enable(Commands->Find_Object(PilotID),true); @@ -3271,7 +3272,6 @@ ypos = 0; zpos = 0; enabled = false; - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 0, 0); return; } char text[512]; @@ -3495,6 +3495,7 @@ obj->As_VehicleGameObj()->Set_Immovable(true); Mode = 2; mode = 1; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,1,0); Commands->Set_Model(obj,dmodel); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Set_Animation(obj,deployanim,false,0,0,-1,0); @@ -3502,12 +3503,12 @@ obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("DeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 1, 0); } } else if (mode == 2) { mode = 3; + Commands->Send_Custom_Event(obj,obj,CUSTOM_VEHICLE_DEPLOY,3,0); Commands->Set_Model(obj,dmodel); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Set_Animation(obj,deployanim,false,0,Get_Float_Parameter("Last_Deploy_Frame"),0,0); @@ -3515,7 +3516,6 @@ obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("UndeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Send_Custom_Event(obj, obj, CUSTOM_VEHICLE_DEPLOY, 3, 0); } } } @@ -3612,23 +3612,6 @@ }; REGISTER_SCRIPT(JFW_Sabotage_Beacon, "Target_Preset:string,Sabotage_On_Custom:int,Sabotage_Off_Custom:int"); -class JFW_Sabotage_Beacon_2 : public ScriptImpClass -{ - void Created(GameObject *obj) - { - Vector3 pos = Commands->Get_Position(obj); - GameObject *target = Find_Closest_Building(pos); - Commands->Send_Custom_Event(obj,target,Get_Int_Parameter("Sabotage_On_Custom"),0,0); - } - void Destroyed(GameObject *obj) - { - Vector3 pos = Commands->Get_Position(obj); - GameObject *target = Find_Closest_Building(pos); - Commands->Send_Custom_Event(obj,target,Get_Int_Parameter("Sabotage_Off_Custom"),0,0); - } -}; -REGISTER_SCRIPT(JFW_Sabotage_Beacon_2, "Sabotage_On_Custom:int,Sabotage_Off_Custom:int"); - class JFW_Veteran_Help_Text : public ScriptImpClass { void Created(GameObject *obj) @@ -3921,264 +3904,6 @@ } }; REGISTER_SCRIPT(JFW_Object_Spawn,"Object:string"); -class JFW_Object_Spawn_At_Bone : public ScriptImpClass { -public: - int id; - void Created(GameObject *obj) - { - id = 0; - GameObject *o = Commands->Create_Object_At_Bone(obj,Get_Parameter("Object"),Get_Parameter("Bone")); - if (o) - { - Commands->Attach_To_Object_Bone(o,obj,Get_Parameter("Bone")); - id = Commands->Get_ID(o); - } - } - void Destroyed(GameObject *obj) - { - if (id) - { - GameObject *o = Commands->Find_Object(id); - if (o) - { - Commands->Destroy_Object(o); - } - } - } -}; -REGISTER_SCRIPT(JFW_Object_Spawn_At_Bone,"Object:string,Bone:String"); -#define PTTEAM(t) (t?0:1) //Convert a normal team into a PT team -class JFW_Deployable_Jammer : public ScriptImpClass -{ - int DeployState; - int Jamming; - int PlayerType; - void Created(GameObject *obj) - { - DeployState = 0; - Jamming = false; - PlayerType = -2; - Commands->Start_Timer(obj, this, Get_Float_Parameter("Time"), 1); - } - void Custom(GameObject *obj, int type, int param, GameObject *sender) - { - if (type == CUSTOM_VEHICLE_DEPLOY) - { - if (DeployState == 3 || DeployState == 1) - { - StringClass str; - const char *c = Get_Model(obj); - str.Format("%s.%s", c, c); - Commands->Set_Animation(obj, str, true, 0, 0, -1, false); - } - DeployState = param; - } - if (type == CUSTOM_EVENT_VEHICLE_ENTERED) - { - if (DeployState == 0) - { - StringClass str; - const char *c = Get_Model(obj); - str.Format("%s.%s", c, c); - Commands->Set_Animation(obj, str, true, 0, 0, -1, false); - } - if (PlayerType != Commands->Get_Player_Type(sender) && DeployState == 2) - { - if (Jamming) - { - Jamming = false; - GameObject *o = Find_Com_Center(PTTEAM(PlayerType)); - if (o) - { - Commands->Send_Custom_Event(obj, o, CUSTOM_RADAR_JAM, 0, 0); - } - } - Commands->Set_Player_Type(obj, Commands->Get_Player_Type(sender)); - } - PlayerType = Commands->Get_Player_Type(sender); - } - if (type == CUSTOM_EVENT_VEHICLE_EXITED) - { - if (DeployState == 0) - { - PlayerType = Commands->Get_Player_Type(sender); - obj->As_PhysicalGameObj()->Clear_Animation(); - } - else if (DeployState == 2) - { - Update_Network_Object(obj); - Commands->Set_Player_Type(obj, Commands->Get_Player_Type(sender)); - PlayerType = Commands->Get_Player_Type(sender); - } - } - } - void Destroyed(GameObject *obj) - { - if (Jamming) - { - Jamming = false; - GameObject *o = Find_Com_Center(PTTEAM(PlayerType)); - if (o) - { - Commands->Send_Custom_Event(obj, o, CUSTOM_RADAR_JAM, 0, 0); - } - } - } - void Timer_Expired(GameObject *obj, int number) - { - if (number == 1) - { - GameObject *o = Find_Com_Center(PTTEAM(PlayerType)); - if (o) - { - bool active = false; - if (DeployState == 2) - { - active = true; - } - if (DeployState == 0 && Get_Vehicle_Occupant_Count(obj)) - { - active = true; - } - int param = 0; - if (active && (Commands->Get_Distance(Commands->Get_Position(o), Commands->Get_Position(obj)) < Get_Float_Parameter("Range"))) - { - param = 1; - } - if (Jamming != param || param == 1) - { - Jamming = param; - Commands->Send_Custom_Event(obj, o, CUSTOM_RADAR_JAM, param, 0); - } - } - Commands->Start_Timer(obj, this, Get_Float_Parameter("Time"), 1); - } - } -}; -REGISTER_SCRIPT(JFW_Deployable_Jammer, "Time:float,Range:float"); - -class JFW_Jammer : public ScriptImpClass -{ - int Jamming; - int PlayerType; - void Created(GameObject *obj) - { - Jamming = false; - PlayerType = -2; - Commands->Start_Timer(obj, this, Get_Float_Parameter("Time"), 1); - } - void Destroyed(GameObject *obj) - { - if (Jamming) - { - Jamming = false; - GameObject *o = Find_Com_Center(PTTEAM(PlayerType)); - if (o) - { - Commands->Send_Custom_Event(obj, o, CUSTOM_RADAR_JAM, 0, 0); - } - } - } - void Custom(GameObject *obj, int type, int param, GameObject *sender) - { - if (type == CUSTOM_EVENT_VEHICLE_ENTERED) - { - PlayerType = Commands->Get_Player_Type(sender); - } - if (type == CUSTOM_EVENT_VEHICLE_EXITED) - { - PlayerType = Commands->Get_Player_Type(sender); - } - } - void Timer_Expired(GameObject *obj, int number) - { - if (number == 1) - { - GameObject *o = Find_Com_Center(PTTEAM(PlayerType)); - if (o) - { - int param = 0; - if (Get_Vehicle_Occupant_Count(obj) && (Commands->Get_Distance(Commands->Get_Position(o), Commands->Get_Position(obj)) < Get_Float_Parameter("Range"))) - { - param = 1; - } - if (Jamming != param || param == 1) - { - Jamming = param; - Commands->Send_Custom_Event(obj, o, CUSTOM_RADAR_JAM, param, 0); - } - } - Commands->Start_Timer(obj, this, Get_Float_Parameter("Time"), 1); - } - } -}; -REGISTER_SCRIPT(JFW_Jammer, "Time:float,Range:float"); - -class JFW_Jammer_Building : public ScriptImpClass -{ - bool radaron; - void Created(GameObject *obj) - { - radaron = true; - } - void Killed(GameObject *obj, GameObject *killer) - { - Destroy_Script(); - } - void Custom(GameObject *obj, int type, int param, GameObject *sender) - { - if (type == CUSTOM_RADAR_JAM) - { - if (Is_Base_Powered(Get_Object_Type(obj))) - { - if (param) - { - if (radaron) - { - Create_2D_Sound_Team(Get_Parameter("StartSound1"), Get_Object_Type(obj)); - Create_2D_Sound_Team(Get_Parameter("StartSound2"), PTTEAM(Get_Object_Type(obj))); - radaron = false; - Enable_Base_Radar(Get_Object_Type(obj), false); - } - } - else - { - if (!radaron) - { - Create_2D_Sound_Team(Get_Parameter("StopSound1"), Get_Object_Type(obj)); - Create_2D_Sound_Team(Get_Parameter("StopSound2"), PTTEAM(Get_Object_Type(obj))); - radaron = true; - Enable_Base_Radar(Get_Object_Type(obj), true); - } - } - } - } - } -}; -REGISTER_SCRIPT(JFW_Jammer_Building, "StartSound1:string,StopSound1:string,StartSound2:string,StopSound2:string"); -class JFW_Disable_Engine : public ScriptImpClass -{ - void Created(GameObject *obj) - { - Commands->Enable_Engine(obj,false); - Destroy_Script(); - } -}; -REGISTER_SCRIPT(JFW_Disable_Engine,""); -class JFW_Hide_Object : public ScriptImpClass -{ - void Created(GameObject *obj) - { - Commands->Set_Is_Rendered(obj,false); - Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),1); - } - void Timer_Expired(GameObject *obj, int number) - { - Commands->Set_Is_Rendered(obj,true); - Destroy_Script(); - } -}; -REGISTER_SCRIPT(JFW_Hide_Object,"Time:float"); ScriptRegistrant JFW_Add_Objective_Registrant("JFW_Add_Objective", "Type:int,TypeVal:int,Objective_Num:int,Objective_Type:int,Title_ID:int,Unknown:int,Sound_Name:string,Description_ID:int,Timer_Custom:int,Trigger:int"); ScriptRegistrant JFW_Remove_Objective_Registrant("JFW_Remove_Objective","Type:int,TypeVal:int,Objective_Num:int,Timer_Custom:int"); ScriptRegistrant JFW_Set_Objective_Status_Registrant("JFW_Set_Objective_Status","Type:int,TypeVal:int,Objective_Num:int,Status:int,Timer_Custom:int"); diff -uwr source/scripts/jfwveh.cpp sourceold/scripts/jfwveh.cpp --- source/scripts/jfwveh.cpp 2015-10-11 13:18:53.119336000 +1000 +++ sourceold/scripts/jfwveh.cpp 2015-04-21 18:40:46.251953100 +1000 @@ -547,16 +547,6 @@ } } -void JFW_Visible_Person_Settings_2::Custom(GameObject *obj, int type, int param, GameObject *sender) -{ - if (type == Get_Int_Parameter("Message")) - { - GameObject *object = Commands->Find_Object(param); - Commands->Set_Model(object, Get_Parameter("ModelName")); - Commands->Set_Animation_Frame(object, Get_Parameter("Animation"), Get_Int_Parameter("Frame")); - } -} - void JFW_Vechicle_Animation_2::Timer_Expired(GameObject *obj,int number) { Vector3 position = Commands->Get_Position(obj); @@ -1305,88 +1295,7 @@ GameObject *o = Commands->Find_Object(SoldierObjects[i].ModelID); if (o) { - Commands->Set_Is_Rendered(o, !stealth); - } - } - } - } - Commands->Start_Timer(obj, this, 1, 1); -} - -void JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2::Created(GameObject *obj) -{ - SoldierObjects.Resize(Get_Vehicle_Seat_Count(obj)); - stealth = false; - Commands->Start_Timer(obj, this, 1, 1); -} - -void JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2::Custom(GameObject *obj,int type,int param,GameObject *sender) -{ - if (type == CUSTOM_EVENT_VEHICLE_ENTERED) - { - int seat = Get_Occupant_Seat(obj,sender); - if ((seat >= Get_Int_Parameter("FirstSeat")) && (seat <= Get_Int_Parameter("LastSeat"))) - { - StringClass bone; - bone.Format("SEAT%d",seat); - Vector3 position = Commands->Get_Bone_Position(obj,bone); - GameObject *object = Commands->Create_Object("Invisible_Object",position); - Commands->Attach_To_Object_Bone(object,obj,bone); - Commands->Send_Custom_Event(obj,sender,Get_Int_Parameter("Message"),Commands->Get_ID(object),0); - SoldierObjects[seat].ModelID = Commands->Get_ID(object); - Commands->Set_Is_Rendered(object, !stealth); - SoldierObjects[seat].SoldierID = Commands->Get_ID(sender); - } - } - if (type == CUSTOM_EVENT_VEHICLE_EXITED) - { - for (int i = Get_Int_Parameter("FirstSeat");i <= Get_Int_Parameter("LastSeat");i++) - { - int senderid = Commands->Get_ID(sender); - if (senderid == SoldierObjects[i].SoldierID) - { - if (SoldierObjects[i].ModelID) - { - GameObject *o = Commands->Find_Object(SoldierObjects[i].ModelID); - if (o) - { - Commands->Destroy_Object(o); - } - } - } - } - } -} - -void JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2::Killed(GameObject *obj,GameObject *killer) -{ - for (int i = Get_Int_Parameter("FirstSeat");i <= Get_Int_Parameter("LastSeat");i++) - { - if (SoldierObjects[i].ModelID) - { - GameObject *o = Commands->Find_Object(SoldierObjects[i].ModelID); - if (o) - { - Commands->Destroy_Object(o); - } - } - } -} - -void JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2::Timer_Expired(GameObject *obj, int number) -{ - bool b = Is_Stealth(obj); - if (stealth != b) - { - stealth = b; - for (int i = Get_Int_Parameter("FirstSeat");i <= Get_Int_Parameter("LastSeat");i++) - { - if (SoldierObjects[i].ModelID) - { - GameObject *o = Commands->Find_Object(SoldierObjects[i].ModelID); - if (o) - { - Commands->Set_Is_Rendered(o, !stealth); + Commands->Set_Is_Rendered(o, stealth); } } } @@ -1408,7 +1317,6 @@ ScriptRegistrant JFW_Per_Preset_Visible_Person_In_Vechicle_Registrant("JFW_Per_Preset_Visible_Person_In_Vechicle","BoneName:string,Message:int"); ScriptRegistrant JFW_Per_Preset_Visible_People_In_Vechicle_Registrant("JFW_Per_Preset_Visible_People_In_Vechicle","BoneName1:string,BoneName2:string,Message1:int,Message2:int"); ScriptRegistrant JFW_Visible_Person_Settings_Registrant("JFW_Visible_Person_Settings","Message:int,ModelName:string,Animation:string,SubObject:string,FirstFrame:float,LastFrame:float,Blended:int"); -ScriptRegistrant JFW_Visible_Person_Settings_Registrant_2("JFW_Visible_Person_Settings_2", "Message:int,ModelName:string,Animation:string,Frame:float"); ScriptRegistrant JFW_Aircraft_Fuel_Registrant("JFW_Aircraft_Fuel", "Time:float,TimerNum:int,Explosion:string,Refuel_Message:int"); ScriptRegistrant JFW_Vehicle_Block_Preset_Registrant("JFW_Vehicle_Block_Preset","Preset:string"); ScriptRegistrant JFW_Vehicle_Extra_Registrant("JFW_Vehicle_Extra","Extra_Preset:string,Bone_Name:string"); @@ -1424,4 +1332,3 @@ ScriptRegistrant JFW_Empty_Vehicle_Timer_Registrant("JFW_Empty_Vehicle_Timer","Time:float,TimerNum:int"); ScriptRegistrant JFW_Vehicle_Visible_Weapon_Registrant("JFW_Vehicle_Visible_Weapon","Animation:string"); ScriptRegistrant JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_Registrant("JFW_Per_Preset_Visible_Multiple_People_In_Vehicle","Message:int"); -ScriptRegistrant JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2_Registrant("JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2","Message:int,FirstSeat:int,LastSeat:int"); diff -uwr source/scripts/jfwveh.h sourceold/scripts/jfwveh.h --- source/scripts/jfwveh.h 2015-10-11 13:18:53.119336000 +1000 +++ sourceold/scripts/jfwveh.h 2015-02-26 23:23:35.012695300 +1000 @@ -122,10 +122,6 @@ void Custom(GameObject *obj,int type,int param,GameObject *sender); }; -class JFW_Visible_Person_Settings_2 : public ScriptImpClass { - void Custom(GameObject *obj, int type, int param, GameObject *sender); -}; - class JFW_Vechicle_Animation_2 : public ScriptImpClass { bool enabled; float xpos; @@ -256,15 +252,6 @@ VectorClass SoldierObjects; bool stealth; void Created(GameObject *obj); - void Custom(GameObject *obj,int type,int param,GameObject *sender); - void Killed(GameObject *obj,GameObject *killer); - void Timer_Expired(GameObject *obj, int number); -}; - -class JFW_Per_Preset_Visible_Multiple_People_In_Vehicle_2 : public ScriptImpClass { - VectorClass SoldierObjects; - bool stealth; - void Created(GameObject *obj); void Custom(GameObject *obj,int type,int param,GameObject *sender); void Killed(GameObject *obj,GameObject *killer); void Timer_Expired(GameObject *obj, int number); diff -uwr source/scripts/jfwws.cpp sourceold/scripts/jfwws.cpp --- source/scripts/jfwws.cpp 2015-10-11 13:18:53.134961000 +1000 +++ sourceold/scripts/jfwws.cpp 2015-02-25 22:57:19.647460900 +1000 @@ -99,12 +99,6 @@ Destroy_Script(); } -void JFW_Enable_Transition::Created(GameObject *obj) -{ - Commands->Enable_Vehicle_Transitions(obj, true); - Destroy_Script(); -} - void JFW_Permanent_No_Falling_Damage::Created(GameObject *obj) { health = Commands->Get_Health(obj); @@ -700,8 +694,6 @@ ScriptRegistrant M00_PCT_Pokable_Registrant("M00_PCT_Pokable_DAK",""); ScriptRegistrant JFW_Vechicle_Regen_Registrant("JFW_Vechicle_Regen",""); ScriptRegistrant JFW_Disable_Transition_Registrant("JFW_Disable_Transition",""); -ScriptRegistrant JFW_Enable_Transition_Registrant("JFW_Enable_Transition", ""); -ScriptRegistrant M00_Disable_Transition_Registrant("M00_Disable_Transition", ""); ScriptRegistrant JFW_Permanent_No_Falling_Damage_Registrant("JFW_Permanent_No_Falling_Damage",""); ScriptRegistrant JFW_Death_Powerup_Registrant("JFW_Death_Powerup",""); ScriptRegistrant JFW_GrantPowerup_Created_Registrant("JFW_GrantPowerup_Created","WeaponDef:string"); diff -uwr source/scripts/jfwws.h sourceold/scripts/jfwws.h --- source/scripts/jfwws.h 2015-10-11 13:18:53.134961000 +1000 +++ sourceold/scripts/jfwws.h 2015-02-25 22:57:19.649414000 +1000 @@ -43,10 +43,6 @@ void Created(GameObject *obj); }; -class JFW_Enable_Transition : public ScriptImpClass { - void Created(GameObject *obj); -}; - class JFW_Permanent_No_Falling_Damage : public ScriptImpClass { float health; void Created(GameObject *obj); diff -uwr source/scripts/jmgBearHunter.cpp sourceold/scripts/jmgBearHunter.cpp --- source/scripts/jmgBearHunter.cpp 2015-10-11 13:18:53.150586000 +1000 +++ sourceold/scripts/jmgBearHunter.cpp 2015-05-31 11:22:00.900414000 +1000 @@ -90,16 +90,6 @@ if (JMG_Bear_Hunter_Game_Control::bearTransition && JMG_Bear_Hunter_Game_Control::bearTransition < 100) Commands->Start_Timer(obj,this,0.1f,7); Commands->Start_Timer(obj,this,0.1f,1); - if ((JMG_Bear_Hunter_Game_Control::gameState != JMG_Bear_Hunter_Game_Control::BossArrive || JMG_Bear_Hunter_Game_Control::remainingLives[playerId] >= 0) && Get_Player_Name(obj) && _wcsicmp(WideStringClass(Get_Player_Name(obj)), The_Game()->Get_Mvp_Name()) == 0) - switch (The_Game()->Get_Mvp_Count()) - { - case 0:break; - case 1:Commands->Set_Model(obj,"FAWN_");break; - case 2:Commands->Set_Model(obj,"DOE_");break; - case 3:Commands->Set_Model(obj,"STAG_");break; - case 4:Commands->Set_Model(obj,"BUCK_");break; - default:Commands->Set_Model(obj,"_Moose");break; - } Attach_Script_Once(obj,"JFW_Send_Self_Custom_On_Key","VehBind,454269,0"); Commands->Attach_Script(obj,"JMG_Rp2_Dedicated_Server_Sound_Emulator",""); Commands->Start_Timer(obj,this,2.5f,8); @@ -527,7 +517,6 @@ Commands->Attach_Script(obj,"JMG_Bear_Hunter_Wolf_Pack_Definition","2,Wild_Wolf,10,420.0 -1.14 0.59,50.0,240,30,60.0,15.0,1.5,1"); Commands->Attach_Script(obj,"JMG_Bear_Hunter_Wolf_Pack_Definition","3,Wild_Wolf,3,-400.0 230.0 -0.11,50.0,120,30,60.0,15.0,1.5,1"); Commands->Attach_Script(obj,"JMG_Bear_Hunter_Wolf_Pack_Controller",""); - Commands->Attach_Script(obj,"JMG_Utility_Dynamic_Clock_Control",""); } void JMG_Bear_Hunter_Game_Control::Timer_Expired(GameObject *obj,int number) { @@ -589,7 +578,7 @@ for (int x = 0;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; if (!playerAlive[x]) continue; @@ -648,7 +637,7 @@ for (int x = 1;x < 128 && !playerInRange;x++) { GameObject *player = Get_GameObj(x); - if (!player || !Commands->Get_Health(player) || Get_Player_Type(player) == -4) + if (!player || !Commands->Get_Health(player)) continue; if (JmgUtility::SimpleFlatDistance(Commands->Get_Position(player),Vector3(16.235f,0.0f,0.0f)) < 22500) playerInRange = true; @@ -698,7 +687,7 @@ for (int j = 1;j < 128;j++) { GameObject *player = Get_GameObj(j); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; if (JmgUtility::SimpleDistance(switchPos,Commands->Get_Position(player)) < 22500) { @@ -740,10 +729,10 @@ for (int x = 0;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4 || JmgUtility::SimpleDistance(Commands->Get_Position(switchObj),Commands->Get_Position(player)) >= 22500) + if (!player || JmgUtility::SimpleDistance(Commands->Get_Position(switchObj),Commands->Get_Position(player)) >= 22500) continue; JmgUtility::DisplayChatMessage(player,127,127,255,"Bear Rug Co: Great work holding those bears off, here is a small bonus!"); - Commands->Give_Money(player,250.0f,0); + Commands->Give_Money(player,1000.0f,0); BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(x); if (node) node->SurvivedAlarm++; @@ -761,7 +750,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; if (JmgUtility::SimpleFlatDistance(Commands->Get_Position(player),centerOfBase) > 34225.0f) { @@ -837,8 +826,6 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player) - continue; Set_Screen_Fade_Color_Player(player,0.0f,0.0f,0.0f,0.0f); Set_Screen_Fade_Opacity_Player(player,0.15f,250.0f); } @@ -1030,8 +1017,6 @@ NewObjectiveSystemControl.Remove_Objective(21); } } - if (gameTime == 150) - JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Oh god, is that a moose? What are they doing out here… Never mind, defend the President of Corperate America!"); if ((gameTime == 600 || gameTime == 300) || (!(gameTime % 60) && gameTime > 0 && gameTime < 300)) { char timeMsg[220]; @@ -1074,8 +1059,7 @@ for (int x = bearObjectListControl.objectCount;x < normalBears;x++) { Vector3 pos = BearHunterGameControlSystem.LookupNearestPosition(Vector2(Commands->Get_Random(-500.0f,500.0f),Commands->Get_Random(-350.0f,500.0f))); - bool isBlackBear = Commands->Get_Random(0.0f,1.0f) < 0.1 ? true : false; - GameObject *ai = isBlackBear ? Commands->Create_Object("Bear_Black",pos) : Commands->Create_Object("Normal_Bear",pos); + GameObject *ai = Commands->Get_Random(0.0f,1.0f) < 0.1 ? Commands->Create_Object("Bear_Black",pos) : Commands->Create_Object("Normal_Bear",pos); Commands->Set_Facing(ai,Commands->Get_Random(-180,180)); MoveablePhysClass *mphys = ai->As_PhysicalGameObj() ? ai->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; if (mphys) @@ -1137,11 +1121,8 @@ return; bool isOver = true; for (int x = 0;x < 128;x++) - { - GameObject *player = Get_GameObj(x); - if (JMG_Bear_Hunter_Game_Control::remainingLives[x] && (!player || (player && Get_Player_Type(player) != -4))) + if (JMG_Bear_Hunter_Game_Control::remainingLives[x]) isOver = false; - } if (isOver && gameState == JMG_Bear_Hunter_Game_Control::BossArrive) NewObjectiveSystemControl.Set_Objective_Status(12,NewObjectiveSystem::Failed); winWait++; @@ -1194,7 +1175,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; BearHunterScoreSystem::BHScoreNode *playerScoreNode = bearHunterScoreSystem.Get_Current_Player_Score_Node(x); if (playerScoreNode) @@ -1223,9 +1204,6 @@ const char *weap = Get_Current_Weapon(o); if (o->As_VehicleGameObj() && weap && _stricmp(weap,"Weapon_Super_Repair")) { - PhysClass *vpc = o->As_PhysicalGameObj()->Peek_Physical_Object(); - if (vpc && (vpc->As_WheeledVehicleClass() || vpc->As_MotorcycleClass() || vpc->As_TrackedVehicleClass() || vpc->As_VTOLVehicleClass())) - continue; if (!Is_Script_Attached(o,"JMG_Bear_Hunter_AI_Ignore_Up_To_25_Meters")) Commands->Attach_Script(o,"JMG_Bear_Hunter_AI_Ignore_Up_To_25_Meters",""); if (Has_Weapon(o,"Weapon_Super_Repair")) @@ -1241,9 +1219,9 @@ } if (winWait == 23) { - if (spawnKarma <= 1) + if (!spawnKarma) JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Haha, its a good thing this isn't a video game, otherwise I'd have expected some sort of super mutant boss."); - else if (spawnKarma <= 3) + else if (spawnKarma < 3) JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Haha, its a good thing this isn't a video game, otherwise I'd have expected some sort of super mutant boss, with maybe some support bosses because you did so well."); else JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: However, it is a good thing you people are not cheaters, otherwise karma would try to find a way to balance the odds."); @@ -1256,7 +1234,6 @@ { JmgUtility::MessageAllPlayers(127,127,255,"Bear Rug Co: Well, we should have seen this coming, hurry guys, kill it and we'll call it a day!"); Commands->Create_Object("Mutant_Rabbit_Boss",Vector3(0.0f,0.0f,0.0f)); - if (spawnKarma >= 2) for (int x = 0;x < spawnKarma;x++) Commands->Create_Object("Giant_Deer_Blue",Vector3(0.0f,0.0f,0.0f)); Commands->Start_Timer(obj,this,0.1f,17); @@ -1280,8 +1257,8 @@ { if (bearTransition == 75) { - Commands->Fade_Background_Music("Action 05 00.mp3",62500,62500); - sprintf(currentSong,"Action 05 00.mp3"); + Commands->Fade_Background_Music("Mutants.mp3",62500,62500); + sprintf(currentSong,"Mutants.mp3"); } if (gameTime < 1200 && bearTransition < 100) { @@ -1373,9 +1350,9 @@ Commands->Action_Goto(ai,params); Commands->Attach_Script(ai,"JMG_Bear_Hunter_Engineer_AI","Weapon_RepairGun_Player,Weapon_Pistol_Player"); entineersReturned++; - float money = 125; + float money = 250; if (entineersReturned == 5) - money = 500; + money = 2500; JMG_Bear_Hunter_Game_Control::ObjectiveCompleteReward(money); GameObject *guide = Get_GameObj(JMG_Bear_Hunter_Engineer_Follow_Player_When_Near::followPlayerId[x]); if (guide) @@ -1455,7 +1432,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; if (JmgUtility::SimpleFlatDistance(Vector3(50.0f,-685.0f,0),Commands->Get_Position(player)) > 2500.0f) { @@ -1542,11 +1519,11 @@ if (JMG_Bear_Hunter_Game_Control::gameState == JMG_Bear_Hunter_Game_Control::BossArrive) for (int x = 1;x < 128;x++) { + if (JMG_Bear_Hunter_Game_Control::remainingLives[x] >= 0) + continue; GameObject *player = Get_GameObj(x); if (!player) continue; - if (JMG_Bear_Hunter_Game_Control::remainingLives[x] >= 0 && Get_Player_Type(player) != -4) - continue; if (!Has_Weapon(player,"Weapon_Empty_Hands")) { Commands->Destroy_Object(player); @@ -1630,7 +1607,7 @@ for (int j = 1;j < 128;j++) { GameObject *player = Get_GameObj(j); - if (!player || Get_Player_Type(player) == -4) + if (!player) continue; if (JmgUtility::SimpleDistance(pos,Commands->Get_Position(player)) < distance) return true; @@ -1655,7 +1632,7 @@ spawnGroup = 0; objective = 0; entineersReturned = 0; - sprintf(currentSong,"SpecForce_Sneak_01.mp3"); + sprintf(currentSong,"06-onyourfeet.mp3"); for (int x = 0;x < maxTotalBearHunterPlayerAssistAI;x++) { GameObject *ai = Commands->Find_Object(JMG_Bear_Hunter_Player_Assist_AI::aiIds[x]); @@ -1704,12 +1681,10 @@ preset = (Commands->Get_Random(0.0f,1.0f)<0.333) ? "Mutant_Bear" : (Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer" : "Mutant_Dog"; else if (gameTime > 330)//cat preset = (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Bear" : "Mutant_Cat") : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer" : "Mutant_Dog"); - else if (gameTime > 210)//ion cats + else if (gameTime > 180)//ion cats preset = (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Bear" : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : "Mutant_Cat_Blue")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer" : "Mutant_Dog"); - else if (gameTime > 150)// nuke cats + else// nuke cats preset = (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Bear" : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer" : "Mutant_Dog"); - else - preset = ((Commands->Get_Random(0.0,1.0f)<0.05f) ? "Mutant_Moose" : (Commands->Get_Random(0.0f,1.0f)<0.25) ? ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Bear" : ((Commands->Get_Random(0.0,1.0f)<0.6) ? "Mutant_Cat" : (Commands->Get_Random(0.0,1.0)<0.8) ? "Mutant_Cat_Blue" : "Mutant_Cat_Crazy")) : ((Commands->Get_Random(0.0,1.0f)<0.5f) ? "Mutant_Deer" : "Mutant_Dog")); Vector3 pos = BearHunterGameControlSystem.LookupNearestPosition(Vector2(Commands->Get_Random(-500.0f,500.0f),Commands->Get_Random(JmgUtility::MathClamp(CreatePositionZ-250,-600,500),CreatePositionZ))); GameObject *ai = Commands->Create_Object(preset,pos); Commands->Set_Facing(ai,Commands->Get_Random(-180,180)); @@ -1787,7 +1762,7 @@ { if (message == 91185423) { - GameObject *Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + GameObject *Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) return; ActionParamsStruct params; @@ -1936,7 +1911,7 @@ if (PlayerEmulatedSoundList[x].SoundType) { GameObject *Player = Get_GameObj(x); - if (!Player || !Commands->Get_Health(Player) || Get_Player_Type(Player) == -4) + if (!Player || !Commands->Get_Health(Player)) continue; Vector3 Pos = Commands->Get_Position(Player); if (JmgUtility::SimpleDistance(Pos,myPos) <= PlayerEmulatedSoundList[x].Range) @@ -1956,7 +1931,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Vehicle(player) || Get_Player_Type(player) == -4) + if (!player || Get_Vehicle(player)) continue; if (JmgUtility::SimpleFlatDistance(pos,Commands->Get_Position(player)) <= 0.25 && JmgUtility::SimpleDistance(pos,Commands->Get_Position(player)) <= 25) Commands->Apply_Damage(player,9999.9f,"None",obj); @@ -2086,19 +2061,8 @@ int playerId = JmgUtility::JMG_Get_Player_ID(seen); if (playerId && JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[JmgUtility::JMG_Get_Player_ID(seen)]) return; - int SeenID = Commands->Get_ID(seen); + myNode->enemyId = Commands->Get_ID(seen); targetUpdate = 40; - if (!myNode->enemyId) - { - LastSeen = seen->As_VehicleGameObj() && seen->As_VehicleGameObj()->Peek_Physical_Object()->As_DecorationPhysClass() ? -1 : 60; - myNode->enemyId = SeenID; - } - else if (myNode->enemyId == SeenID) - LastSeen = seen->As_VehicleGameObj() && seen->As_VehicleGameObj()->Peek_Physical_Object()->As_DecorationPhysClass() ? -1 : 60; - if (myNode->enemyId && !secondaryEnemyId && SeenID != myNode->enemyId) - secondaryEnemyId = SeenID; - if (SeenID == secondaryEnemyId) - lastSeenSecondary = 12; } void JMG_Bear_Hunt_Mutant_Attacker::Timer_Expired(GameObject *obj,int number) { @@ -2112,12 +2076,7 @@ { myNode->enemyId = 0; GameObject *mainObject = NULL; - if (Commands->Get_Random(0.0f,1.0f) < Get_Player_Count()*0.05) - { - mainObject = Commands->Find_Object(JMG_Bear_Hunter_Radio_Tower_Switch::supportId); - myNode->enemyId = Commands->Get_ID(mainObject); - } - else if (Commands->Get_Random(0.0f,1.0f) < JMG_Bear_Hunter_Game_Control::attackSubstationChance) + if (Commands->Get_Random(0.0f,1.0f) < JMG_Bear_Hunter_Game_Control::attackSubstationChance) { mainObject = Commands->Find_Object(Commands->Get_Random(0.0f,1.0f) < 0.9f ? JMG_Bear_Hunter_Power_Transformer::mctIds[0] : JMG_Bear_Hunter_Power_Transformer::mctIds[1]); myNode->enemyId = Commands->Get_ID(mainObject); @@ -2163,34 +2122,6 @@ stuckCount = 0; lastPos = pos; } - if (LastSeen > 0) - { - LastSeen--; - if (!LastSeen && myNode->enemyId) - { - Commands->Action_Reset(obj,10); - myNode->enemyId = 0; - GameObject *secondaryEnemy = Commands->Find_Object(secondaryEnemyId); - if (secondaryEnemy && Commands->Get_Health(secondaryEnemy)) - { - myNode->enemyId = secondaryEnemyId; - secondaryEnemyId = 0; - ActionParamsStruct params; - Commands->Get_Action_Params(obj,params); - params.Set_Movement(secondaryEnemy,1.0,1.4f,false); - params.MovePathfind = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(secondaryEnemy)) < 25.0 ? false : true; - Commands->Action_Goto(obj,params); - params.Set_Basic(this,999,10); - LastSeen = lastSeenSecondary; - } - } - } - if (lastSeenSecondary) - { - lastSeenSecondary--; - if (!lastSeenSecondary) - secondaryEnemyId = 0; - } Commands->Start_Timer(obj,this,0.25f,1); } if (number == 2) @@ -2611,8 +2542,6 @@ int playerId = JmgUtility::JMG_Get_Player_ID(poker); if (!playerId) return; - if (Commands->Get_Player_Type(poker) == -4) - return; if (Is_Script_Attached(poker,"JMG_Prez_Medical_Needle_Player_Control")) { NewObjectiveSystemControl.Set_Objective_Status(22,NewObjectiveSystem::Accomplished); @@ -2636,7 +2565,7 @@ regenTime = 5; return; } - if ((PlayerData.players[playerId]->talkToPrezTime && difftime(clock(),PlayerData.players[playerId]->talkToPrezTime) < 10000.0f) || (JMG_Bear_Hunter_Game_Control::gameState == JMG_Bear_Hunter_Game_Control::BossArrive && !JMG_Bear_Hunter_Game_Control::playerAlive[playerId])) + if ((PlayerData.players[playerId]->talkToPrezTime && difftime(clock(),PlayerData.players[playerId]->talkToPrezTime) < 10000.0f) || !JMG_Bear_Hunter_Game_Control::playerAlive[playerId]) return; PlayerData.players[playerId]->talkToPrezTime = clock(); @@ -3105,8 +3034,6 @@ } void JMG_Bear_Hunt_Final_Boss::Created(GameObject *obj) { - moveSpeed = 0.5; - rabbitSize = 1.0f; bossPos = Commands->Get_Position(obj); JMG_Bear_Hunter_Game_Control::gameState = JMG_Bear_Hunter_Game_Control::BossArrive; NewObjectiveSystemControl.Add_Objective(8,NewObjectiveSystem::Primary,NewObjectiveSystem::Pending,12728,"",12728,obj); @@ -3261,13 +3188,6 @@ JmgUtility::MessageAllPlayers(255,255,0,deathMsg); PlayerData.players[playerId]->displayedKillMessage = true; Commands->Apply_Damage(target,9999.9f,"BlamoKiller",obj); - Commands->Apply_Damage(obj,-100.0f,"None",target); - moveSpeed = JmgUtility::MathClamp(moveSpeed+0.05f,0.5f,1.0f); - rabbitSize = JmgUtility::MathClamp(rabbitSize+0.1f,1.0f,2.0f); - obj->As_SoldierGameObj()->Set_Scale_Across_Network(rabbitSize); - BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(target)); - if (node) - node->EatenByRabbit++; } } Commands->Start_Timer(obj,this,0.25f,2); @@ -3365,7 +3285,7 @@ Commands->Action_Reset(obj,10); targetedId = tempId; ActionParamsStruct params; - params.Set_Movement(target,moveSpeed,target->As_SoldierGameObj() ? 0.0f : 5.0f,false); + params.Set_Movement(target,1.0f,5.0f,false); params.MovePathfind = true; Commands->Action_Goto(obj,params); if ((distance < 40000.0f && JMG_Bear_Hunter_Game_Control::mutantTargetId != targetedId) || distance < 625) @@ -3412,7 +3332,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[x] || !Commands->Get_Health(player) || Get_Player_Type(player) == -4) + if (!player || JMG_Bear_Hunter_Game_Control::aiIgnorePlayers[x] || !Commands->Get_Health(player)) continue; if (!inRange(player)) { @@ -3581,7 +3501,7 @@ if (aiState != FollowPlayer) GotoLocation(obj,NULL); else - GotoLocation(obj,JmgUtility::FindNearestPlayer(Commands->Get_Position(obj))); + GotoLocation(obj,Commands->Get_A_Star(Commands->Get_Position(obj))); Commands->Start_Timer(obj,this,0.1f,1); } if (number == 2) @@ -4127,8 +4047,6 @@ { if (waitingToDeactivate) return; - if (Commands->Get_Player_Type(poker) == -4) - return; if (Get_Int_Parameter("DeactivateTime")) { waitingToDeactivate = true; @@ -4209,7 +4127,7 @@ if (number == 1) { Vector3 myPos = Commands->Get_Position(obj); - GameObject *player = JmgUtility::FindNearestPlayer(myPos); + GameObject *player = Commands->Get_A_Star(myPos); int tempPlayerId = JmgUtility::JMG_Get_Player_ID(player); float playerDistance = JmgUtility::SimpleDistance(myPos,Commands->Get_Position(player)); if (player && playerId ? (playerDistance < followMaxDistance) : (playerDistance < followDistance)) @@ -4372,7 +4290,7 @@ if (number == 1) { Vector3 myPos = Commands->Get_Position(obj); - GameObject *player = JmgUtility::FindNearestPlayer(myPos); + GameObject *player = Commands->Get_A_Star(myPos); GameObject *playerVehicle = Get_Vehicle(player); if (Get_Vehicle(obj)) { @@ -4833,15 +4751,13 @@ Commands->Give_Money(player,0.15f,false); } for (int x = 0;x < maxTotalBearHunterPlayerAssistAI;x++) - JMG_Bear_Hunter_Player_Assist_AI::cash[x] += 0.3f; + JMG_Bear_Hunter_Player_Assist_AI::cash[x] += 0.15f; } Commands->Start_Timer(obj,this,0.1f,1); } } void JMG_Bear_Hunter_Oil_Rig::Poked(GameObject *obj, GameObject *poker) { - if (Commands->Get_Player_Type(poker) == -4) - return; if (!active) { Commands->Enable_HUD_Pokable_Indicator(obj,false); @@ -4928,8 +4844,6 @@ } void JMG_Complete_Objective_On_Poke::Poked(GameObject *obj, GameObject *poker) { - if (Commands->Get_Player_Type(poker) == -4) - return; if (!(NewObjectiveSystemControl.Get_Objective_Status(Get_Int_Parameter("ObjectiveId")) == NewObjectiveSystem::Pending || NewObjectiveSystemControl.Get_Objective_Status(Get_Int_Parameter("ObjectiveId")) == NewObjectiveSystem::Hidden)) return; NewObjectiveSystemControl.Set_Objective_Status(Get_Int_Parameter("ObjectiveId"),NewObjectiveSystem::Accomplished); @@ -5120,7 +5034,7 @@ { if (message == 91185423) { - GameObject *Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + GameObject *Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) return; ActionParamsStruct params; @@ -5307,7 +5221,6 @@ case 1000001794:node->WolfKilled++;break; case 1000001809:node->MutantDogKilled++;break; case 1000001845:node->BlueDeerKilled++;break; - case 1000001959:node->MooseKilled++;break; default:node->KilledHumanAi++;break; } } @@ -5345,8 +5258,6 @@ } void JMG_Bear_Hunter_Increase_Score_On_Poke::Poked(GameObject *obj, GameObject *poker) { - if (Commands->Get_Player_Type(poker) == -4) - return; BearHunterScoreSystem::BHScoreNode *node = bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(poker)); switch (Get_Int_Parameter("ScoreType")) { @@ -5418,8 +5329,6 @@ { if (activated) return; - if (Commands->Get_Player_Type(poker) == -4) - return; if (NewObjectiveSystemControl.Get_Objective_Status(21) == NewObjectiveSystem::NotDefined) { JmgUtility::DisplayChatMessage(poker,127,127,255,"Bear Rug Co: We have the Communications Tower turned off right now because it was scaring off the wild life, leave it off!"); @@ -5444,12 +5353,10 @@ } bearHunterScoreSystem.Get_Current_Player_Score_Node(JmgUtility::JMG_Get_Player_ID(poker))->ActivatedCommTower++; GameObject *defendPoint = Commands->Create_Object("Radio_Tower_Base_Support",Vector3(-507.953f,-273.623f,0.91f)); - JMG_Bear_Hunter_Radio_Tower_Switch::supportId = Commands->Get_ID(defendPoint); Commands->Attach_Script(defendPoint,"JMG_Bear_Hunter_Radio_Tower_Support",""); } void JMG_Bear_Hunter_Radio_Tower_Support::Killed(GameObject *obj,GameObject *killer) { - JMG_Bear_Hunter_Radio_Tower_Switch::supportId = 0; GameObject *radioTower = Commands->Find_Object(JMG_Bear_Hunter_Radio_Tower_Control::radioTowerId); if (!radioTower) return; @@ -5705,7 +5612,7 @@ void JMG_Bear_Hunter_Defense_Gun_Beacon::Created(GameObject *obj) { GameObject *Player = NULL; - Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) { Commands->Destroy_Object(obj); @@ -5723,7 +5630,7 @@ { Count = 0; GameObject *Player = NULL; - Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) { Commands->Destroy_Object(obj); @@ -5977,8 +5884,6 @@ { if (!enabled) return; - if (Commands->Get_Player_Type(poker) == -4) - return; int PlayerID = JmgUtility::JMG_Get_Player_ID(poker); if (PlayerID != Get_Int_Parameter("PlayerID")) { @@ -6163,11 +6068,6 @@ int presetId = Commands->Get_Preset_ID(o); if (presetId == 1000001055 || presetId == 1000001536 || presetId == 1000001820) Commands->Send_Custom_Event(o,o,2411911,enabled,0); - if (presetId == 1000001176) - if (enabled) - Commands->Select_Weapon(o,"Weapon_Ramjet_Turret"); - else - Commands->Select_Weapon(o,"Weapon_Ramjet_Turret_Lowpower"); if (presetId == 1000001820) if (enabled) Commands->Set_Model(o,"SearchLight"); @@ -6283,7 +6183,7 @@ { if (message == 91185423) { - GameObject *Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + GameObject *Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) return; ActionParamsStruct params; @@ -6437,7 +6337,7 @@ if (PlayerEmulatedSoundList[x].SoundType) { GameObject *Player = Get_GameObj(x); - if (!Player || Get_Player_Type(Player) == -4 || !Commands->Get_Health(Player)) + if (!Player || !Commands->Get_Health(Player)) continue; Vector3 Pos = Commands->Get_Position(Player); if (JmgUtility::SimpleDistance(Pos,myPos) <= PlayerEmulatedSoundList[x].Range) @@ -6863,7 +6763,7 @@ { if (message == 91185423) { - GameObject *Player = JmgUtility::FindNearestPlayer(Commands->Get_Position(obj)); + GameObject *Player = Commands->Get_A_Star(Commands->Get_Position(obj)); if (!Player) return; ActionParamsStruct params; @@ -7030,7 +6930,7 @@ if (PlayerEmulatedSoundList[x].SoundType) { GameObject *Player = Get_GameObj(x); - if (!Player || Get_Player_Type(Player) == -4 || !Commands->Get_Health(Player)) + if (!Player || !Commands->Get_Health(Player)) continue; Vector3 Pos = Commands->Get_Position(Player); if (JmgUtility::SimpleDistance(Pos,myPos) <= PlayerEmulatedSoundList[x].Range) @@ -7050,7 +6950,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4 || Get_Vehicle(player)) + if (!player || Get_Vehicle(player)) continue; if (JmgUtility::SimpleFlatDistance(pos,Commands->Get_Position(player)) <= 0.25 && JmgUtility::SimpleDistance(pos,Commands->Get_Position(player)) <= 25) Commands->Apply_Damage(player,9999.9f,"None",obj); @@ -7196,12 +7096,12 @@ {// You're doing to good if you see these guys Set_Skin(obj,"Blamo"); Commands->Set_Shield_Type(obj,"Blamo"); - Set_Max_Health(obj,JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*10.37f); - Commands->Set_Health(obj,JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*10.37f); - if (JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*10.37f >= 2000.0f) + Set_Max_Health(obj,JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*83.0f);//was 41.5f + Commands->Set_Health(obj,JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*83.0f);//was 41.5f + if (JmgUtility::MathClampInt(Get_Player_Count()+1,1,64)*83.0f >= 2000.0f) { - Set_Max_Shield_Strength(obj,JmgUtility::MathClampInt(Get_Player_Count()-64,0,64)*10.37f); - Commands->Set_Shield_Strength(obj,JmgUtility::MathClampInt(Get_Player_Count()-64,0,64)*10.37f); + Set_Max_Shield_Strength(obj,JmgUtility::MathClampInt(Get_Player_Count()-64,0,64)*83.0f); + Commands->Set_Shield_Strength(obj,JmgUtility::MathClampInt(Get_Player_Count()-64,0,64)*83.0f); } else Set_Max_Shield_Strength(obj,0.0f); @@ -7269,33 +7169,6 @@ lastHealth = Commands->Get_Health(obj); lastArmor = Commands->Get_Shield_Strength(obj); } -bool JMG_Utility_AI_Vehicle::GetRandomPosition(Vector3 *position) -{ - Rp2SimplePositionSystem::SimplePositionNode *node = NULL; - if (Get_Int_Parameter("WanderingAIGroupID") != -1) - node = JMG_Wandering_AI_Controller::wanderPoints.GetRandomFromGroup(Get_Int_Parameter("WanderingAIGroupID")); - if (!node) - { - Console_Input("msg JMG_Utility_AI_Vehicle ERROR: No wander points could be found for that group!"); - *position = Vector3(); - return false; - } - *position = node->position; - return true; -} -bool JMG_Utility_AI_Vehicle::GetRandomPositionOutsideOfRange(Vector3 *position) -{ - Rp2SimplePositionSystem::SimplePositionNode *node = NULL; - if (Get_Int_Parameter("WanderingAIGroupID") != -1) - node = JMG_Wandering_AI_Controller::wanderPoints.GetRandomOutsideOfRangeInGroup(Get_Int_Parameter("WanderingAIGroupID"),Get_Float_Parameter("MinAttackRange")*Get_Float_Parameter("MinAttackRange"),*position); - if (!node) - { - *position = Vector3(); - return false; - } - *position = node->position; - return true; -} ScriptRegistrant JMG_Bear_Hunter_Player_Soldier_Registrant("JMG_Bear_Hunter_Player_Soldier",""); ScriptRegistrant JMG_Rp2_Dedicated_Server_Sound_Emulator_Registrant("JMG_Rp2_Dedicated_Server_Sound_Emulator",""); ScriptRegistrant JMG_Bear_Hunter_Game_Control_Registrant("JMG_Bear_Hunter_Game_Control","PositionFile=DhSwampDeerPositions.ecw:string"); diff -uwr source/scripts/jmgBearHunter.h sourceold/scripts/jmgBearHunter.h --- source/scripts/jmgBearHunter.h 2015-10-11 13:18:53.166211000 +1000 +++ sourceold/scripts/jmgBearHunter.h 2015-05-30 06:50:00.266601500 +1000 @@ -1,7 +1,6 @@ #pragma once #include "jmgUtility.h" -#include "direct.h" NewObjectiveSystem NewObjectiveSystemControl = NewObjectiveSystem(1); #define PI 3.14159265f #define PI180 PI/180 @@ -400,12 +399,10 @@ return current; current = current->next; if (!current) - { current = SimplePositionNodeList; if (originalRandom == random) random = 0; } - } return NULL; } SimplePositionNode *GetRandomOutsideOfRange(float range,Vector3 pos) @@ -422,34 +419,10 @@ return current; current = current->next; if (!current) - { current = SimplePositionNodeList; if (originalRandom == random) random = 0; } - } - return NULL; - } - SimplePositionNode *GetRandomOutsideOfRangeInGroup(int value,float range,Vector3 pos) - { - range *= range; - SimplePositionNode *current = SimplePositionNodeList; - int random = Commands->Get_Random_Int(0,ObjectCount*2)+1; - int originalRandom = random; - while (current) - { - if (current->value == value && JmgUtility::SimpleDistance(current->position,pos) > range && random) - random--; - if (!random) - return current; - current = current->next; - if (!current) - { - current = SimplePositionNodeList; - if (originalRandom == random) - random = 0; - } - } return NULL; } SimplePositionNode *GetLowestValueFurthestFromSpot(Vector3 pos) @@ -500,12 +473,10 @@ } current = current->next; if (!current) - { current = SimplePositionNodeList; if (originalRandom == random) random = 0; } - } return NULL; } void DecreaseValue() @@ -1206,7 +1177,7 @@ bool JMG_Bear_Hunter_Game_Control::gameOver = false; int JMG_Bear_Hunter_Game_Control::gameTime = 0; int JMG_Bear_Hunter_Game_Control::spawnGroup = 0; -char JMG_Bear_Hunter_Game_Control::currentSong[256] = {"SpecForce_Sneak_01.mp3"}; +char JMG_Bear_Hunter_Game_Control::currentSong[256] = {"06-onyourfeet.mp3"}; int JMG_Bear_Hunter_Game_Control::objective = 0; int JMG_Bear_Hunter_Game_Control::bearTransition = 0; bool JMG_Bear_Hunter_Game_Control::hasGotTurrets = false; @@ -1241,7 +1212,7 @@ struct BearHunterScoreSystem { public: - #define BHHighScoreListCount 78 + #define BHHighScoreListCount 76 struct BHScoreNode { char PlayerName[256]; @@ -1321,8 +1292,6 @@ unsigned long SurvivedAlarm; unsigned long CheatedRounds; unsigned long NeverInjured; - unsigned long MooseKilled; - unsigned long EatenByRabbit; bool startedRound; @@ -1413,8 +1382,6 @@ SurvivedAlarm = 0; CheatedRounds = 0; NeverInjured = 0; - MooseKilled = 0; - EatenByRabbit = 0; startedRound = JMG_Bear_Hunter_Game_Control::gameState >= JMG_Bear_Hunter_Game_Control::HuntBears ? true : false; totalObjectivesCompleted = 0; @@ -1428,7 +1395,6 @@ } }; private: - char savePath[256]; bool hasLoaded; int selectRandomMatchingScore; BHScoreNode *BHScoreNodeList; @@ -1463,10 +1429,6 @@ lastDispalyedHighScore = -1; BHScoreNodeList = NULL; BHScoreNodeEmptyNode = new BHScoreNode("\0"); - if (Exe != EXE_LEVELEDIT) - { - sprintf(savePath, "%s\\Save\\", Get_File_Path()); - } for (int x = 0;x < 128;x++) BHPlayerHighScoreNodes[x] = BHScoreNodeEmptyNode; }; @@ -1514,13 +1476,8 @@ } FILE *SaveScores; FILE *SaveScores2; - char tempPath[256],textPath[256],realPath[256]; - _mkdir(savePath); - sprintf(tempPath,"%sBearHunterPlayerRecords.tmp",savePath); - sprintf(realPath,"%sBearHunterPlayerRecords.dat",savePath); - sprintf(textPath,"%sBearHunterPlayerRecords.txt",savePath); - SaveScores = fopen(tempPath,"w"); - SaveScores2 = fopen(textPath,"w"); + SaveScores = fopen("data\\save\\BearHunterPlayerRecords.tmp","w"); + SaveScores2 = fopen("data\\save\\BearHunterPlayerRecords.txt","w"); BHScoreNode *Current = BHScoreNodeList; while (Current) { @@ -1529,7 +1486,7 @@ if (!JMG_Bear_Hunter_Game_Control::hasBeenInjured) Current->NeverInjured++; char EncryptString[2048]; - sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->PreGameTime,Current->IdleTime,Current->RoundsPlayed,Current->RoundsCompleted,Current->RoundsQuit,Current->RoundsWon,Current->RoundsLost,Current->MostKillsInARound,Current->MostDeathsInARound,Current->MostBonusObjectivesCompletedInARound,Current->Deaths,Current->Kills,Current->VehicleKills,Current->KilledSelf,Current->KilledPlayers,Current->KilledPresident,Current->KilledTurrets,Current->KilledBears,Current->KilledBlackBears,Current->KilledMutantBears,Current->KilledMutantDeer,Current->KilledMutantCats,Current->KilledMutantCatsB,Current->KilledMutantCatsR,Current->KilledMutantRabbits,Current->ObjectiveActivatedAlarm,Current->ObjectiveTurretTruck,Current->ObjectiveTurretTruckAlarm,Current->ObjectiveOilRigsActivated,Current->ObjectiveOilRigsRepaired,Current->ObjectiveEngineersSaved,Current->ObjectiveWeaponsFound,Current->ObjectiveWeaponsReturned,Current->ObjectivePlasmaRifleReturned,Current->BonusObjectivesCompleted,Current->PickedupHealthPowerups,Current->PickedupArmorPowerups,Current->PickedupCashPowerups,Current->PickedupAmmoPowerups,Current->PickedupHealthTotal,Current->PickedupArmorTotal,Current->PickedupCashTotal,Current->PickedupAmmoTotal,Current->PickedupTotalPowerups,Current->PickedupTotalPowerupsInARound,Current->KilledHumanAi,Current->VehiclesDestroyed,Current->VehiclesLost,Current->JazzsLost,Current->CleasansLost,Current->TrucksLost,Current->TanksLost,Current->TurretTruckLost,Current->C4VestPowerups,Current->ActivatedCommTower,Current->PlayedGamesWithDefenseTurrets,Current->PlayedGamesWithGuardianHelicopter,Current->TimesDrown,Current->TimesFallen,Current->KillsWithSentryTurret,Current->KilledSentryTurrets,Current->SentryTurretsPlaced,Current->SentryTurretsLost,Current->PickedUpMedicalNeedle,Current->ReturnedMedicalNeedle,Current->RepairedSubstation,Current->SubstationOnLineAtEnd,Current->SubstationNotDamaged,Current->GiantDeerKilled,Current->SurvivedAlarm,Current->WolfKilled,Current->MutantDogKilled,Current->BlueDeerKilled,Current->CheatedRounds,Current->NeverInjured,Current->MooseKilled,Current->MooseKilled,Current->EatenByRabbit,Current->EatenByRabbit); + sprintf(EncryptString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu 0",Current->PlayTime,Current->PreGameTime,Current->IdleTime,Current->RoundsPlayed,Current->RoundsCompleted,Current->RoundsQuit,Current->RoundsWon,Current->RoundsLost,Current->MostKillsInARound,Current->MostDeathsInARound,Current->MostBonusObjectivesCompletedInARound,Current->Deaths,Current->Kills,Current->VehicleKills,Current->KilledSelf,Current->KilledPlayers,Current->KilledPresident,Current->KilledTurrets,Current->KilledBears,Current->KilledBlackBears,Current->KilledMutantBears,Current->KilledMutantDeer,Current->KilledMutantCats,Current->KilledMutantCatsB,Current->KilledMutantCatsR,Current->KilledMutantRabbits,Current->ObjectiveActivatedAlarm,Current->ObjectiveTurretTruck,Current->ObjectiveTurretTruckAlarm,Current->ObjectiveOilRigsActivated,Current->ObjectiveOilRigsRepaired,Current->ObjectiveEngineersSaved,Current->ObjectiveWeaponsFound,Current->ObjectiveWeaponsReturned,Current->ObjectivePlasmaRifleReturned,Current->BonusObjectivesCompleted,Current->PickedupHealthPowerups,Current->PickedupArmorPowerups,Current->PickedupCashPowerups,Current->PickedupAmmoPowerups,Current->PickedupHealthTotal,Current->PickedupArmorTotal,Current->PickedupCashTotal,Current->PickedupAmmoTotal,Current->PickedupTotalPowerups,Current->PickedupTotalPowerupsInARound,Current->KilledHumanAi,Current->VehiclesDestroyed,Current->VehiclesLost,Current->JazzsLost,Current->CleasansLost,Current->TrucksLost,Current->TanksLost,Current->TurretTruckLost,Current->C4VestPowerups,Current->ActivatedCommTower,Current->PlayedGamesWithDefenseTurrets,Current->PlayedGamesWithGuardianHelicopter,Current->TimesDrown,Current->TimesFallen,Current->KillsWithSentryTurret,Current->KilledSentryTurrets,Current->SentryTurretsPlaced,Current->SentryTurretsLost,Current->PickedUpMedicalNeedle,Current->ReturnedMedicalNeedle,Current->RepairedSubstation,Current->SubstationOnLineAtEnd,Current->SubstationNotDamaged,Current->GiantDeerKilled,Current->SurvivedAlarm,Current->WolfKilled,Current->MutantDogKilled,Current->BlueDeerKilled,Current->CheatedRounds,Current->NeverInjured); fprintf(SaveScores2,"%s\n%s\n",Current->PlayerName,EncryptString); fprintf(SaveScores,"%s\n%s",JmgUtility::Rp2Encrypt(Current->PlayerName,25,5),JmgUtility::Rp2Encrypt2(EncryptString,Current->PlayerName[0],Current->PlayerName[1])); fprintf(SaveScores,"\n%s",JmgUtility::Rp2Encrypt(EncryptString,Current->PlayerName[1],Current->PlayerName[0])); @@ -1539,17 +1496,15 @@ } fclose(SaveScores); fclose(SaveScores2); - remove(realPath); - rename(tempPath,realPath); + remove("data\\save\\BearHunterPlayerRecords.dat"); + rename("data\\save\\BearHunterPlayerRecords.tmp","data\\save\\BearHunterPlayerRecords.dat"); } void LoadData() { hasLoaded = true; char PlayerName[256]; FILE *LoadScores; - char realPath[256]; - sprintf(realPath,"%sBearHunterPlayerRecords.dat",savePath); - LoadScores = fopen(realPath,"r"); + LoadScores = fopen("data\\save\\BearHunterPlayerRecords.dat","r"); if (LoadScores) { while (!feof(LoadScores)) @@ -1581,7 +1536,7 @@ break; } if (match) - sscanf(decryptedString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",&Current->PlayTime,&Current->PreGameTime,&Current->IdleTime,&Current->RoundsPlayed,&Current->RoundsCompleted,&Current->RoundsQuit,&Current->RoundsWon,&Current->RoundsLost,&Current->MostKillsInARound,&Current->MostDeathsInARound,&Current->MostBonusObjectivesCompletedInARound,&Current->Deaths,&Current->Kills,&Current->VehicleKills,&Current->KilledSelf,&Current->KilledPlayers,&Current->KilledPresident,&Current->KilledTurrets,&Current->KilledBears,&Current->KilledBlackBears,&Current->KilledMutantBears,&Current->KilledMutantDeer,&Current->KilledMutantCats,&Current->KilledMutantCatsB,&Current->KilledMutantCatsR,&Current->KilledMutantRabbits,&Current->ObjectiveActivatedAlarm,&Current->ObjectiveTurretTruck,&Current->ObjectiveTurretTruckAlarm,&Current->ObjectiveOilRigsActivated,&Current->ObjectiveOilRigsRepaired,&Current->ObjectiveEngineersSaved,&Current->ObjectiveWeaponsFound,&Current->ObjectiveWeaponsReturned,&Current->ObjectivePlasmaRifleReturned,&Current->BonusObjectivesCompleted,&Current->PickedupHealthPowerups,&Current->PickedupArmorPowerups,&Current->PickedupCashPowerups,&Current->PickedupAmmoPowerups,&Current->PickedupHealthTotal,&Current->PickedupArmorTotal,&Current->PickedupCashTotal,&Current->PickedupAmmoTotal,&Current->PickedupTotalPowerups,&Current->PickedupTotalPowerupsInARound,&Current->KilledHumanAi,&Current->VehiclesDestroyed,&Current->VehiclesLost,&Current->JazzsLost,&Current->CleasansLost,&Current->TrucksLost,&Current->TanksLost,&Current->TurretTruckLost,&Current->C4VestPowerups,&Current->ActivatedCommTower,&Current->PlayedGamesWithDefenseTurrets,&Current->PlayedGamesWithGuardianHelicopter,&Current->TimesDrown,&Current->TimesFallen,&Current->KillsWithSentryTurret,&Current->KilledSentryTurrets,&Current->SentryTurretsPlaced,&Current->SentryTurretsLost,&Current->PickedUpMedicalNeedle,&Current->ReturnedMedicalNeedle,&Current->RepairedSubstation,&Current->SubstationOnLineAtEnd,&Current->SubstationNotDamaged,&Current->GiantDeerKilled,&Current->SurvivedAlarm,&Current->WolfKilled,&Current->MutantDogKilled,&Current->BlueDeerKilled,&Current->CheatedRounds,&Current->NeverInjured,&Current->MooseKilled,&Current->MooseKilled,&Current->EatenByRabbit,&Current->EatenByRabbit); + sscanf(decryptedString,"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",&Current->PlayTime,&Current->PreGameTime,&Current->IdleTime,&Current->RoundsPlayed,&Current->RoundsCompleted,&Current->RoundsQuit,&Current->RoundsWon,&Current->RoundsLost,&Current->MostKillsInARound,&Current->MostDeathsInARound,&Current->MostBonusObjectivesCompletedInARound,&Current->Deaths,&Current->Kills,&Current->VehicleKills,&Current->KilledSelf,&Current->KilledPlayers,&Current->KilledPresident,&Current->KilledTurrets,&Current->KilledBears,&Current->KilledBlackBears,&Current->KilledMutantBears,&Current->KilledMutantDeer,&Current->KilledMutantCats,&Current->KilledMutantCatsB,&Current->KilledMutantCatsR,&Current->KilledMutantRabbits,&Current->ObjectiveActivatedAlarm,&Current->ObjectiveTurretTruck,&Current->ObjectiveTurretTruckAlarm,&Current->ObjectiveOilRigsActivated,&Current->ObjectiveOilRigsRepaired,&Current->ObjectiveEngineersSaved,&Current->ObjectiveWeaponsFound,&Current->ObjectiveWeaponsReturned,&Current->ObjectivePlasmaRifleReturned,&Current->BonusObjectivesCompleted,&Current->PickedupHealthPowerups,&Current->PickedupArmorPowerups,&Current->PickedupCashPowerups,&Current->PickedupAmmoPowerups,&Current->PickedupHealthTotal,&Current->PickedupArmorTotal,&Current->PickedupCashTotal,&Current->PickedupAmmoTotal,&Current->PickedupTotalPowerups,&Current->PickedupTotalPowerupsInARound,&Current->KilledHumanAi,&Current->VehiclesDestroyed,&Current->VehiclesLost,&Current->JazzsLost,&Current->CleasansLost,&Current->TrucksLost,&Current->TanksLost,&Current->TurretTruckLost,&Current->C4VestPowerups,&Current->ActivatedCommTower,&Current->PlayedGamesWithDefenseTurrets,&Current->PlayedGamesWithGuardianHelicopter,&Current->TimesDrown,&Current->TimesFallen,&Current->KillsWithSentryTurret,&Current->KilledSentryTurrets,&Current->SentryTurretsPlaced,&Current->SentryTurretsLost,&Current->PickedUpMedicalNeedle,&Current->ReturnedMedicalNeedle,&Current->RepairedSubstation,&Current->SubstationOnLineAtEnd,&Current->SubstationNotDamaged,&Current->GiantDeerKilled,&Current->SurvivedAlarm,&Current->WolfKilled,&Current->MutantDogKilled,&Current->BlueDeerKilled,&Current->CheatedRounds,&Current->NeverInjured); } fclose(LoadScores); } @@ -1680,8 +1635,6 @@ case 73: return EveluateHighestScore(High->BlueDeerKilled,Current->BlueDeerKilled,High,Current); case 74: return EveluateHighestScore(High->CheatedRounds,Current->CheatedRounds,High,Current); case 75: return EveluateHighestScore(High->NeverInjured,Current->NeverInjured,High,Current); - case 76: return EveluateHighestScore(High->MooseKilled,Current->MooseKilled,High,Current); - case 77: return EveluateHighestScore(High->EatenByRabbit,Current->EatenByRabbit,High,Current); default: return High; } } @@ -1767,8 +1720,6 @@ case 73: return Node->BlueDeerKilled ? true : false; case 74: return Node->CheatedRounds ? true : false; case 75: return Node->NeverInjured ? true : false; - case 76: return Node->MooseKilled ? true : false; - case 77: return Node->EatenByRabbit ? true : false; default: Console_Input("msg SCORE SYSTEM ERROR: Out of bounds!");return false; } } @@ -1855,8 +1806,6 @@ case 73: sprintf(RetChar,"Server Record: %s has killed %s Karma Deer.",High->PlayerName,JmgUtility::formatDigitGrouping(High->BlueDeerKilled));return RetChar; case 74: sprintf(RetChar,"Server Record: %s has been in %s games that were won unbelievably well.",High->PlayerName,JmgUtility::formatDigitGrouping(High->CheatedRounds));return RetChar; case 75: sprintf(RetChar,"Server Record: %s has been in %s games without the president getting hurt by mutants.",High->PlayerName,JmgUtility::formatDigitGrouping(High->NeverInjured));return RetChar; - case 76: sprintf(RetChar,"Server Record: %s has killed %s Moose.",High->PlayerName,JmgUtility::formatDigitGrouping(High->MooseKilled));return RetChar; - case 77: sprintf(RetChar,"Server Record: %s has been eaten by the rabbit %s times.",High->PlayerName,JmgUtility::formatDigitGrouping(High->EatenByRabbit));return RetChar; default: sprintf(RetChar,"Server Record ERROR: Record index out of bounds!"); return RetChar; } } @@ -2022,9 +1971,6 @@ class JMG_Bear_Hunt_Mutant_Attacker : public ScriptImpClass { Rp2SimpleObjectList::SimpleObjectNode *myNode; - int LastSeen; - int secondaryEnemyId; - int lastSeenSecondary; int targetedId; float targetDistance; int targetUpdate; @@ -2162,8 +2108,6 @@ void Entered(GameObject *obj,GameObject *enterer); }; class JMG_Bear_Hunt_Final_Boss : public ScriptImpClass { - float moveSpeed; - float rabbitSize; int actionUpdate; int enemyId; int jumperId; @@ -2624,10 +2568,7 @@ bool activated; void Created(GameObject *obj); void Poked(GameObject *obj, GameObject *poker); -public: - static int supportId; }; -int JMG_Bear_Hunter_Radio_Tower_Switch::supportId = 0; class JMG_Bear_Hunter_Radio_Tower_Support : public ScriptImpClass { void Killed(GameObject *obj,GameObject *killer); diff -uwr source/scripts/jmgMetroid.h sourceold/scripts/jmgMetroid.h --- source/scripts/jmgMetroid.h 2015-10-11 13:18:53.166211000 +1000 +++ sourceold/scripts/jmgMetroid.h 2015-04-20 16:12:43.579101500 +1000 @@ -12,19 +12,18 @@ */ #pragma once #include "jmgUtility.h" -#include "direct.h" #define PI 3.14159265f #define PI180 PI/180 NewObjectiveSystem MetroidObjectiveSystemControl = NewObjectiveSystem(1,true,"mObjective","null","null"); NewObjectiveSystem MetroidRoomObjectives = NewObjectiveSystem(1,false,"mObjective","null","null"); -bool PerkSystemIncreasePlayerPerkUnlockAmount(GameObject *obj,int PerkID,unsigned int IncreaseAmount); -void AddPerkTypes(); +bool PerkSystemIncreasePlayerPerkUnlockAmount(GameObject *obj,int PerkID,unsigned int IncreaseAmount){return true;}; +void AddPerkTypes(){}; void SavePlayerPerkData(){}; void FindPlayerPerkList(GameObject *obj,bool Display){}; void ClearPlayerSelectedPerks(GameObject *obj){}; -bool CheckIfPlayerHasPerkUnlocked(GameObject *obj,int PerkID); +bool CheckIfPlayerHasPerk(GameObject *obj,int PerkID){return true;}; void IncreasePlayerPerkSlotCount(GameObject *poker){}; struct MetroidScoreSystem { @@ -32,7 +31,7 @@ int selectRandomMatchingScore; bool saveInProgress; #define MetroidHIGHSCORELISTCOUNT 155 - char metroidSavePath[256]; + char metroidSavePath[32]; public: struct MetroidHighScoresNode { @@ -416,10 +415,7 @@ { saveInProgress = false; hasLoaded = false; - if (Exe != EXE_LEVELEDIT) - { - sprintf(metroidSavePath, "%s\\Save\\", Get_File_Path()); - } + sprintf(metroidSavePath,"Data/save/"); MetroidHighScoresNodeList = NULL; MetroidHighScoresNodeEmptyNode = NULL; for (int x = 0;x < 128;x++) @@ -490,13 +486,12 @@ saveInProgress = true; FILE *SaveScores; FILE *SaveScores2; - char tempFileName[256],finalFileName[256],textFileName[256]; - _mkdir(metroidSavePath); - sprintf(finalFileName,"%sBetaMetroidPlayerRecords.Rp2",metroidSavePath); - sprintf(textFileName,"%sMetroidPlayerRecords.txt",metroidSavePath); - sprintf(tempFileName,"%sBetaMetroidPlayerRecords.tmp",metroidSavePath); - SaveScores = fopen(tempFileName,"w"); - SaveScores2 = fopen(textFileName,"w"); + char FileName[64]; + char FileName2[64]; + sprintf(FileName,"%sBetaMetroidPlayerRecords.tmp",metroidSavePath); + SaveScores = fopen(FileName,"w"); + sprintf(FileName,"%sMetroidPlayerRecords.txt",metroidSavePath); + SaveScores2 = fopen(FileName,"w"); MetroidHighScoresNode *Current = MetroidHighScoresNodeList; while (Current) { @@ -515,8 +510,11 @@ } fclose(SaveScores); fclose(SaveScores2); - remove(finalFileName); - rename(tempFileName,finalFileName); + sprintf(FileName,"%sBetaMetroidPlayerRecords.Rp2",metroidSavePath); + remove(FileName); + sprintf(FileName,"%sBetaMetroidPlayerRecords.tmp",metroidSavePath); + sprintf(FileName2,"%sBetaMetroidPlayerRecords.Rp2",metroidSavePath); + rename(FileName,FileName2); saveInProgress = false; } void LoadData() @@ -2492,7 +2490,7 @@ JmgUtility::DisplayChatMessage(obj,220,220,220,chpmsg); if (msNode->Chapter1Completed && msNode->Chapter2Completed && msNode->Chapter3Completed && msNode->Chapter4Completed && msNode->Chapter5Completed && msNode->Chapter6Completed && msNode->Chapter7Completed && msNode->Chapter8Completed && msNode->Chapter9Completed) { - if (!CheckIfPlayerHasPerkUnlocked(obj,79)) + if (!CheckIfPlayerHasPerk(obj,79)) { PerkSystemIncreasePlayerPerkUnlockAmount(obj,79,1); IncreasePlayerPerkSlotCount(obj); diff -uwr source/scripts/jmgUtility.cpp sourceold/scripts/jmgUtility.cpp --- source/scripts/jmgUtility.cpp 2015-10-11 13:18:53.181836000 +1000 +++ sourceold/scripts/jmgUtility.cpp 2015-05-31 11:29:49.797875000 +1000 @@ -188,12 +188,10 @@ return; Commands->Set_Animation(obj,Get_Parameter("Animation"),loop,0,start,end,false); } -void JMG_Utility_Display_HUD_Info_Text_All_Players_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +void JMG_Utility_Display_HUD_Info_Text_To_All_Players_On_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) { if (message == Get_Int_Parameter("Custom")) JmgUtility::SetHUDHelpText(Get_Int_Parameter("StringId"),Get_Vector3_Parameter("ColorRGB")); - if (!Get_Int_Parameter("Repeatable")) - Destroy_Script(); } void JMG_Utility_Display_HUD_Info_Text_To_Sender_On_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) { @@ -204,8 +202,6 @@ if (tempPlayer) player = tempPlayer; Set_HUD_Help_Text_Player(player,Get_Int_Parameter("StringId"),Get_Vector3_Parameter("ColorRGB")); - if (!Get_Int_Parameter("Repeatable")) - Destroy_Script(); } } void JMG_Utility_Soldier_Transition_On_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) @@ -708,939 +704,12 @@ Set_Object_Visibility_For_Player(Get_GameObj(Get_Int_Parameter("PlayerID")),Commands->Get_ID(obj),Get_Int_Parameter("Visible") ? true : false); } } -void JMG_Utility_AI_Vehicle::Created(GameObject *obj) -{ - const char *weap = Get_Current_Weapon(obj); - if (weap) - { - primary = DefineAmmo(Get_Weapon_Ammo_Definition(weap,true)); - secondary = DefineAmmo(Get_Weapon_Ammo_Definition(weap,true)); - } - minDistanceSquared = Get_Float_Parameter("MinAttackRange")*Get_Float_Parameter("MinAttackRange"); - retreatTime = 0; - lastHealth = 0; - moving = false; - attacking = false; - reverseTime = 0; - stuckCount = 0; - drivingBackward = false; - badDestAttempt = 0; - doNotUsePathfind = 0; - currentAction.position = retreatPos = homepos = Commands->Get_Position(obj); - myteam = Commands->Get_Player_Type(obj); - Commands->Enable_Enemy_Seen(obj,true); - if (obj->As_VehicleGameObj()) - { - Commands->Innate_Enable(obj); - if (Get_Int_Parameter("EnableTransitions")) - Commands->Enable_Vehicle_Transitions(obj,true); - else - Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Enable_Engine(obj,true); - Commands->Enable_Hibernation(obj,false); - } - else - { - Commands->Innate_Enable(obj); - Commands->Enable_Enemy_Seen(obj,true); - Commands->Enable_Hibernation(obj,false); - } - Commands->Start_Timer(obj,this,1.0,1); - if (Get_Int_Parameter("WanderingAIGroupID") != -1) - Commands->Start_Timer(obj,this,Get_Float_Parameter("MinRandWander") == Get_Float_Parameter("MaxRandWander") ? Get_Float_Parameter("MaxRandWander") : Commands->Get_Random(Get_Float_Parameter("MinRandWander"),Get_Float_Parameter("MaxRandWander")),2); - Commands->Start_Timer(obj,this,5.0,3); - Commands->Start_Timer(obj,this,0.1f,8); -} -void JMG_Utility_AI_Vehicle::Custom(GameObject *obj,int message,int param,GameObject *sender) -{ - if (message == CUSTOM_EVENT_VEHICLE_ENTERED) - { - attacking = false; - moving = false; - int testTeam = Commands->Get_Player_Type(sender); - if(testTeam != Commands->Get_Player_Type(obj)) - Commands->Start_Timer(obj,this,0.5,4); - } - if (message == CUSTOM_EVENT_VEHICLE_EXITED) - { - Commands->Set_Player_Type(obj,myteam); - } -} -void JMG_Utility_AI_Vehicle::Action_Complete(GameObject *obj,int action,ActionCompleteReason reason) -{ - if (reason == ACTION_COMPLETE_PATH_BAD_START) - { - bool refreshAction = false; - if (!doNotUsePathfind) - refreshAction = true; - doNotUsePathfind = 3; - if (refreshAction) - Commands->Start_Timer(obj,this,0.1f,7); - } - if (reason == ACTION_COMPLETE_PATH_BAD_DEST) - { - if (!badDestAttempt) - Commands->Start_Timer(obj,this,0.25f,5); - else - Commands->Start_Timer(obj,this,0.25f,6); - } - if (action == 10) - moving = false; - Commands->Action_Reset(obj,action*1.0f); - Commands->Action_Reset(obj,100*1.0f); -} -void JMG_Utility_AI_Vehicle::Damaged(GameObject *obj,GameObject *damager,float damage) -{ - if (damage <= 0 || Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) - return; - if(!attacking) - RunAttack(obj,SetTarget(damager)); - else - RunAttack(obj,SelectTarget(obj,damager)); - lastSeenCount = Commands->Get_Random_Int(6,15); -} -void JMG_Utility_AI_Vehicle::Enemy_Seen(GameObject *obj,GameObject *seen) -{ - float dist = JmgUtility::SimpleDistance(Commands->Get_Position(obj),Commands->Get_Position(seen)); - if (Get_Float_Parameter("MinAttackRange") && dist < minDistanceSquared) - return; - if (seen->As_SmartGameObj() && seen->As_SmartGameObj()->Is_Stealthed()) - if (seen->As_SoldierGameObj() && dist > seen->As_SoldierGameObj()->Get_Stealth_Fade_Distance()*seen->As_SoldierGameObj()->Get_Stealth_Fade_Distance()) - return; - else if (seen->As_VehicleGameObj() && dist > seen->As_VehicleGameObj()->Get_Stealth_Fade_Distance()*seen->As_VehicleGameObj()->Get_Stealth_Fade_Distance()) - return; - else if (dist > seen->As_SmartGameObj()->Get_Stealth_Fade_Distance()*seen->As_SmartGameObj()->Get_Stealth_Fade_Distance()) - return; - if (Commands->Get_ID(seen) == currentAction.targetId) - lastSeenCount = Commands->Get_Random_Int(3,16); - if(!attacking) - RunAttack(obj,SetTarget(seen)); - else - RunAttack(obj,SelectTarget(obj,seen)); -} -void JMG_Utility_AI_Vehicle::Timer_Expired(GameObject *obj,int number) -{ - if (number == 1) - { - StuckCheck(obj); - if (lastSeenCount) - lastSeenCount--; - if (retreatTime) - retreatTime--; - if (doNotUsePathfind) - doNotUsePathfind--; - Commands->Start_Timer(obj,this,1.0,1); - } - if (number == 2) - { - Vector3 wanderPos = Vector3(); - if (GetRandomPosition(&wanderPos) && (!Get_Int_Parameter("FollowTarget") || !currentAction.targetId)) - { - moving = true; - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,wanderPos,currentAction.useAmmo,0.0f,false,2.5f); - } - Commands->Start_Timer(obj,this,Get_Float_Parameter("MinRandWander") == Get_Float_Parameter("MaxRandWander") ? Get_Float_Parameter("MaxRandWander") : Commands->Get_Random(Get_Float_Parameter("MinRandWander"),Get_Float_Parameter("MaxRandWander")),2); - } - if (number == 3) - { - if (retreatTime) - { - GameObject *target = Commands->Find_Object(currentAction.targetId); - if(target) - { - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,currentAction.position,currentAction.useAmmo,0.0f,false,2.5f); - Commands->Start_Timer(obj,this,1.0f,3); - } - return; - } - if(attacking) - { - attacking = false; - if (!lastSeenCount && currentAction.targetId) - currentAction.targetId = 0; - GameObject *target = Commands->Find_Object(currentAction.targetId); - if(target) - RunAttack(obj,SetTarget(target)); - else - { - currentAction.useAmmo = 1; - currentAction.targetId = 0; - if (Get_Int_Parameter("ReturnHome") && !retreatTime) - ReturnHome(obj); - else - AttackMove(obj,NULL,false,currentAction.position,currentAction.useAmmo,0.0f,false,2.5f); - } - } - else - if (Get_Int_Parameter("ReturnHome") && !retreatTime) - ReturnHome(obj); - else - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,currentAction.position,currentAction.useAmmo,0.0f,false,2.5f); - } - if (number == 4) - { - if (Get_Vehicle_Occupant_Count(obj)) - Force_Occupants_Exit(obj); - } - if (number == 5) - { - badDestAttempt = 1; - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,Commands->Get_Position(obj),currentAction.useAmmo,0.0f,false,2.5f); - } - if (number == 6) - { - badDestAttempt = 0; - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,homepos,currentAction.useAmmo,0.0f,false,2.5f); - } - if (number == 7) - { - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,currentAction.position,currentAction.useAmmo,0.0f,true,2.5f); - } - if (number == 8) - { - if (attacking || currentAction.targetId) - { - GameObject *target = Commands->Find_Object(currentAction.targetId); - if ((attacking && !target) || (target && !Commands->Get_Health(target))) - { - lastSeenCount = 0; - attacking = false; - currentAction.targetId = 0; - Vector3 wanderPos = Vector3(); - if (Get_Int_Parameter("WanderingAIGroupID") != -1 && GetRandomPosition(&wanderPos) && (!Get_Int_Parameter("FollowTarget") || !currentAction.targetId)) - { - moving = true; - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,wanderPos,currentAction.useAmmo,0.0f,false,2.5f); - } - else - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,homepos,currentAction.useAmmo,0.0f,false,2.5f); - } - } - Commands->Start_Timer(obj,this,0.1f,8); - } -} -void JMG_Utility_AI_Vehicle::ReturnHome(GameObject * obj) -{ - currentAction = JMGVehicleAction(); - lastHealth = 0; - attacking = false; - moving = true; - Vector3 pos; - pos = mypos = Commands->Get_Position(obj); - if (retreatTime && Commands->Find_Object(lastAction.targetId) && JmgUtility::SimpleDistance(Commands->Get_Position(Commands->Find_Object(lastAction.targetId)),retreatPos) > minDistanceSquared) - AttackMove(obj,Commands->Find_Object(lastAction.targetId),false,retreatPos,lastAction.useAmmo,0.0f,true,2.5f); - else if (GetRandomPositionOutsideOfRange(&pos)) - AttackMove(obj,Commands->Find_Object(lastAction.targetId),false,pos,lastAction.useAmmo,0.0f,false,2.5f); - else - AttackMove(obj,Commands->Find_Object(lastAction.targetId),false,homepos,lastAction.useAmmo,0.0f,false,2.5f); -} -void JMG_Utility_AI_Vehicle::RunAttack(GameObject *obj,GameObject *target) -{ - if(target) - { - if (retreatTime) - { - AttackMove(obj,Commands->Find_Object(currentAction.targetId),false,currentAction.position,currentAction.useAmmo,0.0f,false,2.5f); - return; - } - int ammo = SelectAmmo(target); - if (ammo == -1) - { - attacking = false; - useAmmo = 1; - currentAction.targetId = 0; - return; - } - if (ammo == 2) - { - if (lastHealth == Commands->Get_Health(target)) - useAmmo = useAmmo == 1 ? 0 : 1; - ammo = useAmmo; - } - useAmmo = ammo; - lastHealth = Commands->Get_Health(target); - attacking = true; - Vector3 pos = Commands->Get_Position(target); - Vector3 mypos = Commands->Get_Position(obj); - if (Get_Int_Parameter("FollowTarget")) - { - moving = true; - ActionParamsStruct params; - AttackMove(obj,target,true,Vector3(),useAmmo,0.0f,false,Get_Float_Parameter("MaxRange")); - } - else - { - moving = false; - ActionParamsStruct params; - AttackMove(obj,target,false,currentAction.position,useAmmo,0.0f,false,Get_Float_Parameter("MaxRange")); - } - Commands->Start_Timer(obj,this,1.0f,3); - } - else - { - moving = false; - attacking = false; - useAmmo = 1; - AttackMove(obj,NULL,false,currentAction.position,useAmmo,0.0f,false,currentAction.arriveDistance); - return; - } -} -int JMG_Utility_AI_Vehicle::GetThreatRating(GameObject * obj) -{ - if (obj == NULL) - return 0; - int rating=0; - if(Commands->Is_A_Star(obj)) - { - rating += 1; - GameObject *vehicle = Get_Vehicle(obj); - if (vehicle) - rating += 3; - } - if (obj->As_SoldierGameObj()) - rating += 1; - if (obj->As_VehicleGameObj()) - rating += 3; - return rating; -} -GameObject * JMG_Utility_AI_Vehicle::GetAttackObject(GameObject * obj) -{ - if (obj == NULL) - return NULL; - if(Commands->Is_A_Star(obj)) - { - GameObject *vehicle = Get_Vehicle(obj); - if(vehicle) - return vehicle; - else - return obj; - } - return obj; -} -GameObject *JMG_Utility_AI_Vehicle::SelectTarget(GameObject *obj,GameObject *target) -{ - GameObject *old = currentAction.targetId ? Commands->Find_Object(currentAction.targetId) : NULL; - if (!target || !Commands->Get_ID(target)) - return GetAttackObject(old); - if (!old) - { - currentAction.targetId = Commands->Get_ID(target); - return GetAttackObject(target); - } - int trOld = GetThreatRating(old); - int trNew = GetThreatRating(target); - if (trOld > trNew) - return GetAttackObject(old); - if (trNew > trOld) - { - currentAction.targetId = Commands->Get_ID(target); - return GetAttackObject(target); - } - GameObject * closest = GetClosest(obj,target,old); - currentAction.targetId = Commands->Get_ID(closest); - return GetAttackObject(closest); -} -GameObject *JMG_Utility_AI_Vehicle::SetTarget(GameObject *target) -{ - currentAction.targetId = Commands->Get_ID(target); - if(!attacking) - return GetAttackObject(target); - return 0; -} -GameObject *JMG_Utility_AI_Vehicle::GetClosest(GameObject *obj,GameObject *new_target,GameObject *old_target) -{ - Vector3 obj_pos = Commands->Get_Position(obj); - Vector3 target1_pos = Commands->Get_Position(new_target); - Vector3 target2_pos = Commands->Get_Position(old_target); - float dist1 = JmgUtility::SimpleDistance(obj_pos,target1_pos); - float dist2 = JmgUtility::SimpleDistance(obj_pos,target2_pos); - if(dist1 < dist2) - return new_target; - else - return old_target; -} -int JMG_Utility_AI_Vehicle::SelectAmmo(GameObject *target) -{ - if(target) - { - if(target->As_SoldierGameObj()) - return Get_Int_Parameter("vsSoldier"); - if(target->As_VehicleGameObj()) - { - if(Is_VTOL(target)) - return Get_Int_Parameter("vsAircraft"); - return Get_Int_Parameter("vsVehicle"); - } - } - return -1; -} -void JMG_Utility_AI_Vehicle::StuckCheck(GameObject *obj) -{ - if (!moving) - { - drivingBackward= false; - return; - } - Vector3 current = Commands->Get_Position(obj); - if (reverseTime) - { - reverseTime--; - stuckCount = 0; - mypos = current; - drivingBackward = false; - AttackMove(obj,Commands->Find_Object(lastAction.targetId),lastAction.following,lastAction.position,lastAction.useAmmo,0.0f,true,currentAction.arriveDistance); - return; - } - if(JmgUtility::SimpleDistance(mypos,current) < 1.0f) - { - if(stuckCount > 2) - { - reverseTime = Commands->Get_Random_Int(1,6); - stuckCount = 0; - drivingBackward = true; - AttackMove(obj,Commands->Find_Object(lastAction.targetId),lastAction.following,lastAction.position,lastAction.useAmmo,0.0f,true,currentAction.arriveDistance); - } - stuckCount++; - } - else - { - stuckCount = 0; - mypos = current; - } -} -void JMG_Utility_AI_Vehicle::AttackMove(GameObject *obj,GameObject *target,bool followTarget,Vector3 targetLocation,int fireMode,float weaponError,bool forceUpdate,float arriveDistance) -{ - Vector3 mypos = Commands->Get_Position(obj); - float dist = 9999.9f; - if (target) - if (followTarget) - dist = JmgUtility::SimpleDistance(Commands->Get_Position(target),mypos); - else - dist = JmgUtility::SimpleDistance(currentAction.position,mypos); - if (dist > minDistanceSquared+1089.0f) - retreatPos = mypos; - if (dist < minDistanceSquared && !(Get_Int_Parameter("SquishInfantry") && target->As_SoldierGameObj())) - { - if (retreatTime) - return; - retreatTime = 5; - lastSeenCount = 7; - ReturnHome(obj); - return; - } - currentAction.useAmmo = fireMode; - currentAction.following = followTarget; - currentAction.backward = drivingBackward; - currentAction.arriveDistance = arriveDistance; - if (!followTarget) - currentAction.position = targetLocation; - if (lastAction == currentAction && !forceUpdate) - return; - lastAction = currentAction; - bool canSquish = false; - bool isMoving = moving; - Commands->Action_Reset(obj,10.0f); - moving = isMoving; - ActionParamsStruct params; - params.Set_Basic(this,10,10); - if (target) - { - JMGVehicleAmmo ammo = (fireMode ? primary : secondary); - float weaponError = 0.0f; - if (Get_Float_Parameter("WeaponError") != -1.00f) - weaponError = Get_Float_Parameter("WeaponError"); - else if (ammo.allowError) - weaponError = JmgUtility::SimpleDistance(Commands->Get_Position(target),mypos)/ammo.speed*5.0f; - params.Set_Attack(target,ammo.range,weaponError,fireMode ? true : false); - if (Get_Int_Parameter("ForceFire")) - { - params.AttackCheckBlocked = false; - params.AttackForceFire = true; - } - if (Get_Int_Parameter("SquishInfantry") && target->As_SoldierGameObj() && !Is_Unsquishable(target)) - canSquish = true; - Commands->Action_Attack(obj,params); - } - if (followTarget) - if (Is_VTOL(obj) && Get_Float_Parameter("VTOLHover") && !canSquish) - { - if (target) - { - targetLocation = Commands->Get_Position(target); - targetLocation.Z += Get_Float_Parameter("VTOLHover"); - } - params.Set_Movement(targetLocation,JmgUtility::MathClamp(dist,1.0f,100.0f),arriveDistance,false); - params.MoveFollow = false; - } - else - params.Set_Movement(target,JmgUtility::MathClamp(dist,1.0f,100.0f),canSquish ? 1.0f : arriveDistance,false); - else - { - if (Is_VTOL(obj) && Get_Float_Parameter("VTOLHover") && !canSquish) - targetLocation.Z += Get_Float_Parameter("VTOLHover"); - params.Set_Movement(targetLocation,JmgUtility::MathClamp(dist,1.0f,100.0f),canSquish ? 1.0f : arriveDistance,false); - } - params.MoveBackup = currentAction.backward; - if (Is_VTOL(obj)) - params.MovePathfind = false; - else - { - if (Get_Int_Parameter("DisableEngineOnArrival")) - params.ShutdownEngineOnArrival = true; - params.MovePathfind = !doNotUsePathfind && Get_Int_Parameter("UsePathfind") ? true : false; - } - Commands->Action_Goto(obj,params); - if (target) - Commands->Action_Attack(obj,params); -} -JMGVehicleAmmo JMG_Utility_AI_Vehicle::DefineAmmo(const AmmoDefinitionClass *ammo) -{ - JMGVehicleAmmo theammo; - if (ammo) - { - theammo.range = ammo->Range; - if (ammo->Velocity >= 400.0f || (ammo->IsTracking && ammo->TurnRate)) - theammo.allowError = false; - else - theammo.allowError = true; - theammo.speed = ammo->Velocity*ammo->Velocity; - } - return theammo; -} -DynamicClockSystem DynamicClockSystemControl = DynamicClockSystem(); -void JMG_Utility_Dynamic_Clock_Control::Created(GameObject *obj) -{ - Commands->Start_Timer(obj,this,1.0,1); -} -void JMG_Utility_Dynamic_Clock_Control::Timer_Expired(GameObject *obj,int number) -{ - if (number == 1) - { - if (lastMinute != getMinute()) - { - lastMinute = getMinute(); - DynamicClockSystemControl.updateClocks(); - } - Commands->Start_Timer(obj,this,1.0,1); - } -} -void JMG_Utility_Dynamic_Clock_Control::Destroyed(GameObject *obj) -{ - DynamicClockSystemControl.emptyList(); -} -int JMG_Utility_Dynamic_Clock_Control::getMinute() -{ - time_t rawtime; - struct tm * ptm; - time (&rawtime); - ptm = gmtime (&rawtime); - return ptm->tm_min; -} -void JMG_Utility_Dynamic_Clock_Object::Created(GameObject *obj) -{ - DynamicClockSystemControl += obj; -} -void JMG_Utility_Dynamic_Clock_Object::Destroyed(GameObject *obj) -{ - DynamicClockSystemControl -= obj; -} -void JMG_Utility_Change_Screen_Color_While_In_Zone::Entered(GameObject *obj,GameObject *enterer) -{ - if (Commands->Is_A_Star(enterer)) - { - Set_Screen_Fade_Color_Player(enterer,Get_Vector3_Parameter("Color[Red|Green|Blue]").X,Get_Vector3_Parameter("Color[Red|Green|Blue]").Y,Get_Vector3_Parameter("Color[Red|Green|Blue]").Z,Get_Float_Parameter("EnterFadeInTime")); - Set_Screen_Fade_Opacity_Player(enterer,Get_Float_Parameter("Opacity"),Get_Float_Parameter("EnterFadeInTime")); - Attach_Script_Once(enterer,"JMG_Utility_Reset_Screen_Color_When_Destroyed",""); - } -} -void JMG_Utility_Change_Screen_Color_While_In_Zone::Exited(GameObject *obj,GameObject *exiter) -{ - if (Commands->Is_A_Star(exiter)) - { - Set_Screen_Fade_Color_Player(exiter,0.0f,0.0f,0.0f,Get_Float_Parameter("ExitFadeOutTime")); - Set_Screen_Fade_Opacity_Player(exiter,0.0f,Get_Float_Parameter("ExitFadeOutTime")); - if (Is_Script_Attached(exiter,"JMG_Utility_Reset_Screen_Color_When_Destroyed")) - Remove_Script(exiter,"JMG_Utility_Reset_Screen_Color_When_Destroyed"); - } -} -void JMG_Utility_Reset_Screen_Color_When_Destroyed::Destroyed(GameObject *obj) -{ - if (!Commands->Is_A_Star(obj)) - return; - Set_Screen_Fade_Color_Player(obj,0.0f,0.0f,0.0f,0.0f); - Set_Screen_Fade_Opacity_Player(obj,0.0f,0.0f); -} -char JMG_Utility_Play_Music_On_Join_Controller::musicFileName[256] = {"null.mp3"}; -bool JMG_Utility_Play_Music_On_Join_Controller::controllerPlaced = false; -void JMG_Utility_Play_Music_On_Join_Controller::Created(GameObject *obj) -{ - if (controllerPlaced) - { - Console_Input("msg JMG_Utility_Play_Music_On_Join_Controller ERROR: Only place one controller on each map!"); - return; - } - controllerPlaced = true; - sprintf(JMG_Utility_Play_Music_On_Join_Controller::musicFileName,"%s",Get_Parameter("Music")); - for (int x = 1;x < 128;x++) - playingMusic[x] = false; - Commands->Start_Timer(obj,this,1.0,1); -} -void JMG_Utility_Play_Music_On_Join_Controller::Timer_Expired(GameObject *obj,int number) -{ - if (number == 1) - { - for (int x = 1;x < 128;x++) - { - GameObject *player = Get_GameObj(x); - if (player && !playingMusic[x]) - { - playingMusic[x] = true; - Set_Background_Music_Player(player,JMG_Utility_Play_Music_On_Join_Controller::musicFileName); - } - if (!player && playingMusic[x]) - playingMusic[x] = false; - } - Commands->Start_Timer(obj,this,1.0,1); - } -} -void JMG_Utility_Play_Music_On_Join_Controller::Destroyed(GameObject *obj) -{ - controllerPlaced = false; -} -void JMG_Utility_Play_Music_On_Join_Controller::Set_Music(const char *musicFilName,int fadeOut,int fadeIn) -{ - sprintf(JMG_Utility_Play_Music_On_Join_Controller::musicFileName,"%s",musicFilName); - if (fadeOut && fadeIn) - Commands->Fade_Background_Music(musicFilName,fadeOut,fadeIn); - else - Commands->Set_Background_Music(musicFilName); -} -void JMG_Utility_Play_Music_On_Join_Change_Music::Created(GameObject *obj) -{ - if (!JMG_Utility_Play_Music_On_Join_Controller::controllerPlaced) - { - Console_Input("msg JMG_Utility_Play_Music_On_Join_Change_Music ERROR: You need to place JMG_Utility_Play_Music_On_Join_Controller on an object in order to use this script!"); - return; - } - JMG_Utility_Play_Music_On_Join_Controller::Set_Music(Get_Parameter("Music"),Get_Int_Parameter("FadeOut"),Get_Int_Parameter("FadeIn")); - Destroy_Script(); -} -void JMG_Utility_Toggle_Door::Created(GameObject *obj) -{ - preDamagedFrame = 0.0f; - sprintf(originalModel,"%s",Get_Model(obj)); - enabled = true; - open = false; - Commands->Enable_HUD_Pokable_Indicator(obj,true); - if (_stricmp(Get_Parameter("SwitchAnimation"),"null")) - Commands->Set_Animation(obj,Get_Parameter("SwitchAnimation"),false,0,0.0f,0.0f,false); -} -void JMG_Utility_Toggle_Door::Poked(GameObject *obj,GameObject *poker) -{ - GameObject *theDoor = Commands->Find_Object(Get_Int_Parameter("DoorID")); - if (poker != obj) - { - if (!theDoor) - { - if (_stricmp(Get_Parameter("NoDoorMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("NoDoorMessage")); - if (_stricmp(Get_Parameter("SwitchBlockedSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchBlockedSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,6); - return; - } - if (!enabled) - { - if (_stricmp(Get_Parameter("SwitchDamagedPokeMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("SwitchDamagedPokeMessage")); - if (_stricmp(Get_Parameter("SwitchDamagedPokeSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchDamagedPokeSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,5); - return; - } - if ((Get_Int_Parameter("Key") && !Commands->Has_Key(poker,Get_Int_Parameter("Key")))) - { - if (_stricmp(Get_Parameter("WrongKeyMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("WrongKeyMessage")); - if (_stricmp(Get_Parameter("WrongKeySound"),"null")) - Commands->Create_Sound(Get_Parameter("WrongKeySound"),Commands->Get_Position(obj),obj); - SendCustom(obj,4); - return; - } - if (CheckPlayerType(poker,Get_Int_Parameter("PlayerType"))) - { - if (_stricmp(Get_Parameter("WrongPlayerTypeMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("WrongPlayerTypeMessage")); - if (_stricmp(Get_Parameter("WrongPlayerTypeSound"),"null")) - Commands->Create_Sound(Get_Parameter("WrongPlayerTypeSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,3); - return; - } - } - if (!enabled) - return; - if (!open) - { - open = true; - if (Get_Animation_Frame(theDoor) == 0.0f) - { - Commands->Set_Animation(theDoor,Get_Parameter("Animation"),false,0,0.0f,Get_Float_Parameter("LastFrame"),false); - if (_stricmp(Get_Parameter("GotoLastFrameMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("GotoLastFrameMessage")); - if (_stricmp(Get_Parameter("SwitchAnimation"),"null")) - Commands->Set_Animation(obj,Get_Parameter("SwitchAnimation"),false,0,0.0f,Get_Float_Parameter("SwitchLastFrame"),false); - if (_stricmp(Get_Parameter("DoorSound"),"null")) - Commands->Create_Sound(Get_Parameter("DoorSound"),Commands->Get_Position(theDoor),theDoor); - if (_stricmp(Get_Parameter("SwitchSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,1); - - } - else - { - if (_stricmp(Get_Parameter("ActionBlockedMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("ActionBlockedMessage")); - if (_stricmp(Get_Parameter("SwitchBlockedSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchBlockedSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,2); - } - - } - else - { - open = false; - if (Get_Animation_Frame(theDoor) == Get_Float_Parameter("LastFrame")) - { - Commands->Set_Animation(theDoor,Get_Parameter("Animation"),false,0,Get_Float_Parameter("LastFrame"),0.0f,false); - if (_stricmp(Get_Parameter("GotoFirstFrameMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("GotoFirstFrameMessage")); - if (_stricmp(Get_Parameter("SwitchAnimation"),"null")) - Commands->Set_Animation(obj,Get_Parameter("SwitchAnimation"),false,0,Get_Float_Parameter("SwitchLastFrame"),0.0f,false); - if (_stricmp(Get_Parameter("DoorSound"),"null")) - Commands->Create_Sound(Get_Parameter("DoorSound"),Commands->Get_Position(theDoor),theDoor); - if (_stricmp(Get_Parameter("SwitchSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,0); - } - else - { - if (_stricmp(Get_Parameter("ActionBlockedMessage"),"null")) - JmgUtility::DisplayChatMessage(poker,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").X,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Y,(int)Get_Vector3_Parameter("TextColor[Red|Green|Blue]").Z,Get_Parameter("ActionBlockedMessage")); - if (_stricmp(Get_Parameter("SwitchBlockedSound"),"null")) - Commands->Create_Sound(Get_Parameter("SwitchBlockedSound"),Commands->Get_Position(obj),obj); - SendCustom(obj,2); - } - } -} -void JMG_Utility_Toggle_Door::Damaged(GameObject *obj,GameObject *damager,float damage) -{ - if (!damage || !Get_Int_Parameter("DisableSwitchWhenNoShield")) - return; - if (enabled && Commands->Get_Shield_Strength(obj) <= 0) - { - enabled = false; - if (_stricmp(Get_Parameter("SwitchAnimation"),"null")) - preDamagedFrame = Get_Animation_Frame(obj); - if (_stricmp(Get_Parameter("SwitchDisabledModel"),"null")) - Commands->Set_Model(obj,Get_Parameter("SwitchDisabledModel")); - char animation[32]; - sprintf(animation,"%s.%s",Get_Parameter("SwitchDisabledModel"),Get_Parameter("SwitchDisabledModel")); - Commands->Set_Animation(obj,animation,false,0,0,0,false); - - } - if (!enabled && Commands->Get_Shield_Strength(obj) >= Commands->Get_Max_Shield_Strength(obj)) - { - enabled = true; - if (_stricmp(Get_Parameter("SwitchDisabledModel"),"null")) - Commands->Set_Model(obj,originalModel); - if (_stricmp(Get_Parameter("SwitchAnimation"),"null")) - Commands->Set_Animation(obj,Get_Parameter("SwitchAnimation"),false,0,preDamagedFrame,preDamagedFrame,false); - } -} -void JMG_Utility_Toggle_Door::Custom(GameObject *obj,int message,int param,GameObject *sender) -{ - if (message == Get_Int_Parameter("DoorControlCustom") && Get_Int_Parameter("DoorControlCustom")) - { - if (param == 1 && !open) - Poked(obj,obj); - if (param == 0 && open) - Poked(obj,obj); - } -} -void JMG_Utility_Toggle_Door::SendCustom(GameObject *obj,int param) -{ - if (!Get_Int_Parameter("SendCustom") || !Get_Int_Parameter("SendCustomId")) - return; - GameObject *sendObj = Commands->Find_Object(Get_Int_Parameter("SendCustomId")); - if (sendObj) - Commands->Send_Custom_Event(obj,sendObj,Get_Int_Parameter("SendCustom"),param,0); -} -void JMG_Utility_Set_Animation_Frame_On_Creation::Created(GameObject *obj) -{ - Commands->Set_Animation(obj,Get_Parameter("Animation"),false,0,Get_Float_Parameter("Frame"),Get_Float_Parameter("Frame"),false); -} -void JMG_Utility_Set_Model_On_Damage_Percent_3_States::Created(GameObject *obj) -{ - healthThresholds[0] = 0.0f; - healthThresholds[1] = Commands->Get_Max_Shield_Strength(obj)*0.5f; - healthThresholds[2] = Commands->Get_Max_Shield_Strength(obj); - damageState = 2; - if (Commands->Get_Shield_Strength(obj) != Commands->Get_Max_Shield_Strength(obj)) - { - damageState = 1; - Commands->Set_Model(obj,Get_Parameter("HalfShieldModel")); - SetModel(obj); - } -} -void JMG_Utility_Set_Model_On_Damage_Percent_3_States::Damaged(GameObject *obj,GameObject *damager,float damage) -{ - if (!damage) - return; - SetModel(obj); -} -void JMG_Utility_Set_Model_On_Damage_Percent_3_States::SetModel(GameObject *obj) -{ - if (Commands->Get_Shield_Strength(obj) >= healthThresholds[2] && damageState != 2) - { - damageState = 2; - Commands->Set_Model(obj,Get_Parameter("FullShieldModel")); - } - if (Commands->Get_Shield_Strength(obj) <= healthThresholds[0] && damageState != 0) - { - damageState = 0; - Commands->Set_Model(obj,Get_Parameter("NoShieldModel")); - } - if ((!damageState && Commands->Get_Shield_Strength(obj) >= healthThresholds[1]) || (damageState == 2 && Commands->Get_Shield_Strength(obj) <= healthThresholds[1])) - { - damageState = 1; - Commands->Set_Model(obj,Get_Parameter("HalfShieldModel")); - } -} -void JMG_Utility_Set_Model_On_Damage_Percent_4_States::Created(GameObject *obj) -{ - healthThresholds[0] = 0.0f; - healthThresholds[1] = Commands->Get_Max_Shield_Strength(obj)*0.33f; - healthThresholds[2] = Commands->Get_Max_Shield_Strength(obj)*0.66f; - healthThresholds[3] = Commands->Get_Max_Shield_Strength(obj); - damageState = 3; - if (Commands->Get_Shield_Strength(obj) != Commands->Get_Max_Shield_Strength(obj)) - { - damageState = 1; - Commands->Set_Model(obj,Get_Parameter("HalfShieldModel")); - SetModel(obj); - } -} -void JMG_Utility_Set_Model_On_Damage_Percent_4_States::Damaged(GameObject *obj,GameObject *damager,float damage) -{ - if (!damage) - return; - SetModel(obj); -} -void JMG_Utility_Set_Model_On_Damage_Percent_4_States::SetModel(GameObject *obj) -{ - if (Commands->Get_Shield_Strength(obj) >= healthThresholds[3] && damageState != 3) - { - damageState = 3; - Commands->Set_Model(obj,Get_Parameter("FullShieldModel")); - } - if (Commands->Get_Shield_Strength(obj) <= healthThresholds[0] && damageState != 0) - { - damageState = 0; - Commands->Set_Model(obj,Get_Parameter("NoShieldModel")); - } - if ((!damageState && Commands->Get_Shield_Strength(obj) >= healthThresholds[1]) || (damageState == 2 && Commands->Get_Shield_Strength(obj) <= healthThresholds[1])) - { - damageState = 1; - Commands->Set_Model(obj,Get_Parameter("ThirdShieldModel")); - } - if ((damageState == 1 && Commands->Get_Shield_Strength(obj) >= healthThresholds[2]) || (damageState == 3 && Commands->Get_Shield_Strength(obj) <= healthThresholds[2])) - { - damageState = 2; - Commands->Set_Model(obj,Get_Parameter("TwoThirdsShieldModel")); - } -} -int JMG_Utility_PCT::pctInaccessible[128] = {0}; -void JMG_Utility_PCT::Created(GameObject *obj) -{ - Commands->Enable_HUD_Pokable_Indicator(obj,true); -} -void JMG_Utility_PCT::Poked(GameObject *obj,GameObject *poker) -{ - if (Commands->Get_Player_Type(poker) != Commands->Get_Player_Type(obj)) - { - char displayMsg[220]; - sprintf(displayMsg,"pamsg %d %s",JmgUtility::JMG_Get_Player_ID(poker),Get_Translated_String(8780)); - Console_Input(displayMsg); - return; - } - if (JMG_Utility_PCT::pctInaccessible[JmgUtility::JMG_Get_Player_ID(poker)]) - { - char displayMsg[220]; - sprintf(displayMsg,"pamsg %d You cannot access this terminal from your current location.",JmgUtility::JMG_Get_Player_ID(poker)); - Console_Input(displayMsg); - return; - } - if (!Commands->Get_Player_Type(poker)) - Display_NOD_Player_Terminal_Player(poker); - else - Display_GDI_Player_Terminal_Player(poker); -} -void JMG_Utility_PCT_Inaccessible_Zone::Entered(GameObject *obj,GameObject *enterer) -{ - if (Commands->Is_A_Star(enterer)) - { - JMG_Utility_PCT::pctInaccessible[JmgUtility::JMG_Get_Player_ID(enterer)]++; - Attach_Script_Once(enterer,"JMG_Utility_PCT_Inaccessible_Zone_Attach",""); - } -} -void JMG_Utility_PCT_Inaccessible_Zone::Exited(GameObject *obj,GameObject *exiter) -{ - if (Commands->Is_A_Star(exiter) && JMG_Utility_PCT::pctInaccessible[JmgUtility::JMG_Get_Player_ID(exiter)]) - JMG_Utility_PCT::pctInaccessible[JmgUtility::JMG_Get_Player_ID(exiter)]--; -} -void JMG_Utility_PCT_Inaccessible_Zone_Attach::Destroyed(GameObject *obj) -{ - JMG_Utility_PCT::pctInaccessible[JmgUtility::JMG_Get_Player_ID(obj)] = 0; -} -void JMG_Utility_Display_HUD_Info_Text_All_Players_Custom_Replace_String::Custom(GameObject *obj,int message,int param,GameObject *sender) -{ - if (message == Get_Int_Parameter("Custom")) - JmgUtility::SetHUDHelpText(Get_Int_Parameter("StringId"),Get_Parameter("ReplaceString"),Get_Vector3_Parameter("ColorRGB")); - if (!Get_Int_Parameter("Repeatable")) - Destroy_Script(); -} -void JMG_Utility_Display_Text_Message_To_All_Players_On_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) -{ - if (message == Get_Int_Parameter("Custom")) - JmgUtility::MessageAllPlayers((int)Get_Vector3_Parameter("ColorRGB").X,(int)Get_Vector3_Parameter("ColorRGB").Y,(int)Get_Vector3_Parameter("ColorRGB").Z,Get_Parameter("Message")); - if (!Get_Int_Parameter("Repeatable")) - Destroy_Script(); -} -void JMG_Utility_Set_Team_On_Create::Created(GameObject *obj) -{ - if (!Get_Float_Parameter("Delay")) - { - Commands->Set_Player_Type(obj,Get_Int_Parameter("PlayerType")); - Destroy_Script(); - return; - } - Commands->Start_Timer(obj,this,Get_Float_Parameter("Delay"),1); -} -void JMG_Utility_Set_Team_On_Create::Timer_Expired(GameObject *obj,int number) -{ - if (1 == number) - { - Commands->Set_Player_Type(obj,Get_Int_Parameter("PlayerType")); - Destroy_Script(); - } -} - ScriptRegistrant JMG_Utility_Check_If_Script_Is_In_Library_Registrant("JMG_Utility_Check_If_Script_Is_In_Library","ScriptName:string,CppName:string"); ScriptRegistrant JMG_Send_Custom_When_Custom_Sequence_Matched_Registrant("JMG_Send_Custom_When_Custom_Sequence_Matched","Success_Custom=0:int,Correct_Step_Custom=0:int,Partial_Failure_Custom=0:int,Failure_Custom=0:int,Send_To_ID=0:int,Custom_0=0:int,Custom_1=0:int,Custom_2=0:int,Custom_3=0:int,Custom_4=0:int,Custom_5=0:int,Custom_6=0:int,Custom_7=0:int,Custom_8=0:int,Custom_9=0:int,Disable_On_Success=1:int,Disable_On_Failure=0:int,Starts_Enabled=1:int,Enable_Custom=0:int,Correct_Step_Safty=0:int,Failure_Safty=1:int,Max_Failures=1:int"); ScriptRegistrant JMG_Utility_Change_Model_On_Timer_Registrant("JMG_Utility_Change_Model_On_Timer","Model=null:string,Time=0:float"); ScriptRegistrant JMG_Utility_Emulate_DamageableStaticPhys_Registrant("JMG_Utility_Emulate_DamageableStaticPhys","Animation=null:string,Killed_Explosion=null:string,Live_Loop_Start=-1.0:float,Live_Loop_End=-1.0:float,Live_Twitch_Start=-1.0:float,Live_Twitch_End=-1.0:float,Death_Transition_Start=-1.0:float,Death_Transition_End=-1.0:float,Death_Loop_Start=-1.0:float,Death_Loop_End=-1.0:float,Death_Twitch_Start=-1.0:float,Death_Twitch_End=-1.0:float,Live_Transition_Start=-1.0:float,Live_Transition_End=-1.0:float,Repaired_Explosion=null:string,Play_Twitches_To_Completion:int,Send_To_ID:int,Death_Message:int,Repaired_Message:int,Damage_Points:float,Death_Points:float,Heal_Points:float,Repair_Points:float,Neutral_When_Dead:int,Disable_Collision_When_Dead:int"); -ScriptRegistrant JMG_Utility_Display_HUD_Info_Text_To_All_Players_On_Custom_Registrant("JMG_Utility_Display_HUD_Info_Text_All_Players_Custom","Custom:int,StringId:int,ColorRGB:Vector3,Repeatable=1:int"); -ScriptRegistrant JMG_Utility_Display_HUD_Info_Text_To_Sender_On_Custom_Registrant("JMG_Utility_Display_HUD_Info_Text_To_Sender_On_Custom","Custom:int,StringId:int,ColorRGB:Vector3,Repeatable=1:int"); +ScriptRegistrant JMG_Utility_Display_HUD_Info_Text_To_All_Players_On_Custom_Registrant("JMG_Utility_Display_HUD_Info_Text_To_All_Players_On_Custom","Custom:int,StringId:int,ColorRGB:Vector3"); +ScriptRegistrant JMG_Utility_Display_HUD_Info_Text_To_Sender_On_Custom_Registrant("JMG_Utility_Display_HUD_Info_Text_To_Sender_On_Custom","Custom:int,StringId:int,ColorRGB:Vector3"); ScriptRegistrant JMG_Utility_Soldier_Transition_On_Custom_Registrant("JMG_Utility_Soldier_Transition_On_Custom","Custom:int"); ScriptRegistrant JMG_Utility_Poke_Send_Self_Custom_Registrant("JMG_Utility_Poke_Send_Self_Custom","Custom:int,Param:int,Delay:float,LockoutTime=-1.0:float"); ScriptRegistrant JMG_Turret_Spawn_Registrant("JMG_Turret_Spawn","Turret_Preset:string,Bone_Name=Tur_Mount:string"); @@ -1651,21 +720,3 @@ ScriptRegistrant JMG_Utility_Basic_Spawner_Attach_Registrant("JMG_Utility_Basic_Spawner_Attach","ControllerId:int"); ScriptRegistrant JMG_Utility_Engineer_AI_Registrant("JMG_Utility_Engineer_AI","RepaiarGun_Preset=Weapon_RepairGun_Player:string,Weapon_Preset=Weapon_Pistol_Player:string,PatrolRange=50.0:float,BaseCenterPoint=0.0 0.0 0.0:vector3"); ScriptRegistrant JMG_Utility_Set_Object_Visibility_For_Player_On_Custom_Registrant("JMG_Utility_Set_Object_Visibility_For_Player_On_Custom","Message:int,PlayerID:int,Visible:int"); -ScriptRegistrant JMG_Utility_AI_Vehicle_Registrant("JMG_Utility_AI_Vehicle","MaxRange=25.0:float,MinAttackRange=0.0:float,FollowTarget=1:int,ReturnHome=1:int,ForceFire=0:int,VTOLHover=0.0:float,vsSoldier=1:int,vsVehicle=1:int,vsAircraft=1:int,WanderingAIGroupID=-1:int,MinRandWander=60.0:float,MaxRandWander=90.0:float,SquishInfantry=1:int,EnableTransitions=0:int,UsePathfind=1:int,DisableEngineOnArrival=1:int,WeaponError=-1.0:float"); -ScriptRegistrant JMG_Utility_Dynamic_Clock_Control_Registrant("JMG_Utility_Dynamic_Clock_Control",""); -ScriptRegistrant JMG_Utility_Dynamic_Clock_Object_Registrant("JMG_Utility_Dynamic_Clock_Object",""); -ScriptRegistrant JMG_Utility_Change_Screen_Color_While_In_Zone_Registrant("JMG_Utility_Change_Screen_Color_While_In_Zone","Color[Red|Green|Blue]:vector3,Opacity:float,EnterFadeInTime:float,ExitFadeOutTime:float"); -ScriptRegistrant JMG_Utility_Reset_Screen_Color_When_Destroyed_Registrant("JMG_Utility_Reset_Screen_Color_When_Destroyed",""); -ScriptRegistrant JMG_Utility_Play_Music_On_Join_Controller_Registrant("JMG_Utility_Play_Music_On_Join_Controller","Music=null:string"); -ScriptRegistrant JMG_Utility_Play_Music_On_Join_Change_Music_Registrant("JMG_Utility_Play_Music_On_Join_Change_Music","Music=null:string,FadeOut:int,FadeIn:int"); -ScriptRegistrant JMG_Utility_Toggle_Door_Registrant("JMG_Utility_Toggle_Door","DoorID=0:int,Animation=null:string,SwitchAnimation=null:string,LastFrame=0.0:float,SwitchLastFrame=0.0:float,Key=0:int,PlayerType=2:int,DisableSwitchWhenNoShield=0:int,SwitchDisabledModel=null:string,DoorSound=null:string,SwitchSound=null:string,SwitchBlockedSound=null:string,SwitchDamagedPokeSound=null:string,WrongKeySound=null:string,WrongPlayerTypeSound=null:string,TextColor[Red|Green|Blue]=0.0 0.0 0.0:vector3,GotoLastFrameMessage=null:string,GotoFirstFrameMessage=null:string,ActionBlockedMessage=null:string,NoDoorMessage=null:string,SwitchDamagedPokeMessage=null:string,WrongKeyMessage=null:string,WrongPlayerTypeMessage=null:string,DoorControlCustom=0:int,SendCustomId=0:int,SendCustom=0:int"); -ScriptRegistrant JMG_Utility_Set_Animation_Frame_On_Creation_Registrant("JMG_Utility_Set_Animation_Frame_On_Creation","Animation:string,Frame:float"); -ScriptRegistrant JMG_Utility_Set_Model_On_Damage_Percent_3_States_Registrant("JMG_Utility_Set_Model_On_Damage_Percent_3_States","FullShieldModel:string,HalfShieldModel:string,NoShieldModel:string"); -ScriptRegistrant JMG_Utility_Set_Model_On_Damage_Percent_4_States_Registrant("JMG_Utility_Set_Model_On_Damage_Percent_4_States","FullShieldModel:string,TwoThirdsShieldModel:string,ThirdShieldModel:string,NoShieldModel:string"); -ScriptRegistrant JMG_Utility_PCT_Registrant("JMG_Utility_PCT",""); -ScriptRegistrant JMG_Utility_PCT_Inaccessible_Zone_Registrant("JMG_Utility_PCT_Inaccessible_Zone",""); -ScriptRegistrant JMG_Utility_PCT_Inaccessible_Zone_Attach_Registrant("JMG_Utility_PCT_Inaccessible_Zone_Attach",""); -ScriptRegistrant JMG_Utility_Display_HUD_Info_Text_All_Players_Custom_2_Registrant("JMG_Utility_Display_HUD_Info_Text_All_Players_Custom_Replace_String","Custom:int,StringId:int,ReplaceString:string,ColorRGB:Vector3,Repeatable=1:int"); -ScriptRegistrant JMG_Utility_Display_Text_Message_To_All_Players_On_Custom_Registrant("JMG_Utility_Display_Text_Message_To_All_Players_On_Custom","Custom:int,Message:string,ColorRGB:Vector3,Repeatable=1:int"); -ScriptRegistrant JMG_Utility_Set_Team_On_Create_Registrant("JMG_Utility_Set_Team_On_Create","PlayerType:int,Delay=0.0:float"); - diff -uwr source/scripts/jmgUtility.h sourceold/scripts/jmgUtility.h --- source/scripts/jmgUtility.h 2015-10-11 13:18:53.181836000 +1000 +++ sourceold/scripts/jmgUtility.h 2015-05-27 09:38:06.286132800 +1000 @@ -63,7 +63,7 @@ * \author jgray * \ingroup JmgUtility */ -class JMG_Utility_Display_HUD_Info_Text_All_Players_Custom : public ScriptImpClass { +class JMG_Utility_Display_HUD_Info_Text_To_All_Players_On_Custom : public ScriptImpClass { void Custom(GameObject *obj,int message,int param,GameObject *sender); }; /*! @@ -430,24 +430,6 @@ DisplayChatMessage(Player,Red,Green,Blue,MSG); } } - static GameObject *FindNearestPlayer(const Vector3 &pos) - { - GameObject *nearestPlayer = NULL; - float nearest = -1.0f; - for (int x = 1;x < 128;x++) - { - GameObject *player = Get_GameObj(x); - if (!player || Get_Player_Type(player) == -4) - continue; - float tempDist = SimpleDistance(pos,Commands->Get_Position(player)); - if (nearest < 0 || tempDist < nearest) - { - nearest = tempDist; - nearestPlayer = player; - } - } - return nearestPlayer; - } static char *Rp2Encrypt(const char *String,int EncryptionFactor,int Start) { static char FinalString[2000]; @@ -586,24 +568,6 @@ Set_HUD_Help_Text_Player(Player,stringId,color); } } - static void SetHUDHelpText(unsigned long stringId,const char *message,Vector3 color) - { - for (int x = 0;x < 128;x++) - { - GameObject *Player = Get_GameObj(x); - if (!Player) - continue; - Set_HUD_Help_Text_Player_Text(Player,stringId,message,color); - } - } - static bool DegreeDiff(float Deg1,float Deg2,float MaxDiff) - { - if (abs(Deg1-Deg2) <= MaxDiff) - return true; - if (360-abs(Deg1-Deg2) <= MaxDiff) - return true; - return false; - } }; @@ -1069,6 +1033,7 @@ } return 0; } + }; class ClientNetworkObjectPositionSync @@ -1184,7 +1149,7 @@ for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); - if (!player && syncControl.lastSyncNode[x]) + if (!player && syncControl.lastSyncNode) syncControl.clientNoLongerSynced(x); } } @@ -1280,438 +1245,3 @@ { void Destroyed(GameObject *obj); }; - -struct JMGVehicleAction -{ - int targetId; - Vector3 position; - int useAmmo; - bool backward; - bool following; - float arriveDistance; - JMGVehicleAction() - { - targetId = 0; - useAmmo = 0; - position = Vector3(); - backward = false; - following = false; - arriveDistance = 0.0f; - } - bool operator == (JMGVehicleAction jva) - { - return (targetId == jva.targetId && position == jva.position && useAmmo == jva.useAmmo); - } - bool operator != (JMGVehicleAction jva) - { - return (!(*this == jva)); - } - JMGVehicleAction &operator = (JMGVehicleAction jva) - { - targetId = jva.targetId; - useAmmo = jva.useAmmo; - position = jva.position; - backward = jva.backward; - following = jva.following; - arriveDistance = jva.arriveDistance; - return *this; - } -}; - -struct JMGVehicleAmmo -{ - bool allowError; - float range; - float speed; - JMGVehicleAmmo() - { - allowError = false; - range = 0.0f; - speed = 400.0f; - } -}; - -/*! -* \brief Vehicle AI that can be used for both aircraft and wheeled vehicles, the AI will attempt to backup when stuck and can choose different weapons depending on what foe it faces -* \MaxRange - How close will the AI drive to a target. -* \MinAttackRange - How close can a target be before it can no longer be fired upon, if the target is too close the vehicle will attempt to back up to a previous position or return to a wander point/home position if either are available. -* \FollowTarget - Tells the AI follow its target around while it tries to kill it. -* \ReturnHome - Tells the AI return to the spot it was created at once it kills a target. -* \ForceFire - Tells the AI to fire weapons even if the turret isn't aimed at the target, useful for vehicles like the MRLS. -* \VTOLHover - Used for Aircraft, tells the AI how high to fly above its target spots, if 0 it will attempt to smoosh them. -* \vsSoldier - Tells the AI what fire mode to use against infantry, -1 means it can't attack them, 2 means auto, 0 is secondary fire, 1 is primary fire. -* \vsVehicles - Tells the AI what fire mode to use against vehicles, -1 means it can't attack them, 2 means auto, 0 is secondary fire, 1 is primary fire. -* \vsAircraft - Tells the AI what fire mode to use against aircraft, -1 means it can't attack them, 2 means auto, 0 is secondary fire, 1 is primary fire. -* \WanderingAIGroupID - Tells the vehicle that it can used JMG_Wandering_AI_Controller and JMG_Wandering_AI_Wander_Point scripts to move around the map randomly. -* \MinRandWander - The smallest amount of time the AI will wait before attempting to wander. -* \MaxRandWander - The longest amount of time the AI will wait before attempting to wander. -* \SquishInfantry - Tells the unit to drive over the enemy if it is an infantry. -* \EnableTransitions - Whether or not players can get in and out of the vehicle. -* \UsePathfind - Tells the unit whether or not to use pathfind. -* \DisableEngineOnArrival - Tells the unit whether it should shutdown its engine when it finishes moving, useful for wheeled vehicles so they don't go rolling away. -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_AI_Vehicle : public ScriptImpClass { - JMGVehicleAmmo primary; - JMGVehicleAmmo secondary; - JMGVehicleAction currentAction; - JMGVehicleAction lastAction; - int retreatTime; - int lastSeenCount; - int reverseTime; - int stuckCount; - int useAmmo; - int doNotUsePathfind; - float lastHealth; - float minDistanceSquared; - bool moving; - bool attacking; - int badDestAttempt; - Vector3 mypos; - Vector3 homepos; - Vector3 retreatPos; - int myteam; - bool inRange; - bool drivingBackward; - void Created(GameObject *obj); - void Action_Complete(GameObject *obj,int action,ActionCompleteReason reason); - void Custom(GameObject *obj,int message,int param,GameObject *sender); - void Enemy_Seen(GameObject *obj,GameObject *seen); - void Damaged(GameObject *obj,GameObject *damager,float damage); - void Timer_Expired(GameObject *obj,int number); - void RunAttack(GameObject *obj,GameObject *target); - int GetThreatRating(GameObject * obj); - GameObject *GetAttackObject(GameObject * obj); - GameObject *SelectTarget(GameObject *obj,GameObject *target); - GameObject *SetTarget(GameObject *target); - GameObject *GetClosest(GameObject *obj,GameObject *new_target,GameObject *old_target); - int SelectAmmo(GameObject *target); - void StuckCheck(GameObject *obj); - void ReturnHome(GameObject * obj); - void AttackMove(GameObject *obj,GameObject *target,bool followTarget,Vector3 targetLocation,int fireMode,float weaponError,bool forceUpdate,float arriveDistance); - JMGVehicleAmmo DefineAmmo(const AmmoDefinitionClass *ammo); - bool GetRandomPosition(Vector3 *position); - bool GetRandomPositionOutsideOfRange(Vector3 *position); -}; - -class DynamicClockSystem -{ -public: - struct DynamicClockSystemNode - { - int clockId; - GameObject *clock; - bool alarmSet; - int alarmHour; - int alarmMinute; - int alarmSounding; - struct DynamicClockSystemNode *next; - DynamicClockSystemNode(GameObject *obj) - { - clockId = Commands->Get_ID(obj); - clock = obj; - alarmSet = false; - alarmHour = 12; - alarmMinute = 0; - alarmSounding = 0; - next = NULL; - } - }; -private: - bool HasLoaded; - struct DynamicClockSystemNode *DynamicClockSystemNodeList; -public: - DynamicClockSystem() - { - HasLoaded = false; - DynamicClockSystemNodeList = NULL; - } - DynamicClockSystem &operator += (GameObject *obj) - { - DynamicClockSystemNode *Current = DynamicClockSystemNodeList; - if (!DynamicClockSystemNodeList) - DynamicClockSystemNodeList = new DynamicClockSystemNode(obj); - while (Current) - { - if (Current->clock == obj) - return *this; - if (!Current->clock) - { - Current->clockId = Commands->Get_ID(obj); - Current->clock = obj; - return *this; - } - if (!Current->next) - { - Current->next = new DynamicClockSystemNode(obj); - return *this; - } - Current = Current->next; - } - return *this; - } - DynamicClockSystem &operator -= (GameObject *obj) - { - if (!DynamicClockSystemNodeList) - return *this; - DynamicClockSystemNode *Current = DynamicClockSystemNodeList; - while (Current) - { - if (Current->clock == obj) - { - Current->clock = NULL; - break; - } - Current = Current->next; - } - return *this; - } - void emptyList() - { - HasLoaded = false; - DynamicClockSystemNode *temp,*die; - temp = DynamicClockSystemNodeList; - while (temp) - { - die = temp; - temp = temp->next; - delete die; - } - DynamicClockSystemNodeList = NULL; - } - inline void updateClocks() - { - time_t t = time(0); - struct tm *ptm = localtime(&t); - int curTime = ptm->tm_hour%24; - curTime = (curTime < 0 ? curTime+24 : curTime); - float frame = (curTime*60.0f+ptm->tm_min); - DynamicClockSystemNode *Current = DynamicClockSystemNodeList; - while (Current) - { - if (Current->clock) - Commands->Set_Animation(Current->clock,"s_ecwClock.a_ecwClock",false,0,frame,frame,true); - Current = Current->next; - } - } -}; -class JMG_Utility_Dynamic_Clock_Control : public ScriptImpClass { - int lastMinute; - void Created(GameObject *obj); - void Timer_Expired(GameObject *obj,int number); - void Destroyed(GameObject *obj); - int getMinute(); -}; - -class JMG_Utility_Dynamic_Clock_Object : public ScriptImpClass { - void Created(GameObject *obj); - void Destroyed(GameObject *obj); -}; - -/*! -* \brief Fades screen color to set color while in zone -* \Color[Red|Green|Blue] RGB value of the color you want it to fade to (0-1.0) -* \Opacity How opac should the screen get while in the zone -* \EnterFadeInTime - Amount of time it takes to fade in once zone has been entered -* \ExitFadeOutTime - Amount of time it takes to fade out once the zone has been exited -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Change_Screen_Color_While_In_Zone : public ScriptImpClass { - void Entered(GameObject *obj,GameObject *enterer); - void Exited(GameObject *obj,GameObject *exiter); -}; - -/*! -* \brief Resets screen color and opacity on object destruction -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Reset_Screen_Color_When_Destroyed : public ScriptImpClass -{ - void Destroyed(GameObject *obj); -}; - - -/*! -* \brief Plays music for a player on join, the music can be changed for all players by calling JMG_Utility_Play_Music_On_Join::Set_Music -* \Music - Name of the music file to play, you need the file extension. -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Play_Music_On_Join_Controller : public ScriptImpClass { - bool playingMusic[128]; - void Created(GameObject *obj); - void Timer_Expired(GameObject *obj,int number); - void Destroyed(GameObject *obj); - static char musicFileName[256]; -public: - static bool controllerPlaced; - SCRIPTS_API static void Set_Music(const char *musicFilName,int fadeOut,int fadeIn); -}; - -/*! -* \brief Switches what music is playing, you must have a JMG_Utility_Play_Music_On_Join_Controller on the map! -* \Music - Name of the music file to play, you need the file extension. -* \FadeOut - Amount of time the last song takes to fade out. -* \FadeIn - Amount of time the last song takes to fade in. -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Play_Music_On_Join_Change_Music : public ScriptImpClass { - void Created(GameObject *obj); -}; - -/*! -* \brief Just like JFW_Toggle_Door except you can't toggle during transition, and the switch object can also be animated -* \DoorID - ID of the simple object that is the 'door' -* \Animation - Animation for the door (Hint: Dump a comma delimited string in here to populate all the parameters besides DoorID) -* \SwitchAnimation - Animation for the switch object -* \LastFrame - Last frame for the door to goto. -* \SwitchLastFrame - Last frame to use for the switch -* \Key - Key needed to open door, 0 for no key -* \PlayerType - Playertype needed to open door, 2 for anyone -* \DisableSwitchWhenNoShield - Whether or not the switch can be disabled by being damaged to the point of having 0 shield, can be reenabled by repairing back to full health again -* \SwitchDisabledModel - Model the switch switches to when destroyed (uses first frame of model's animation) -* \DoorSound - Sound the door makes when opening/closing, null for no sound -* \SwitchSound - Sound the switch makes when poked, null for no sound -* \SwitchBlockedSound - Sound the switch makes when poked and cannot accept command, null for no sound -* \SwitchDamagedPokeSound - Sound the switch makes when poked while damaged, null for no sound -* \WrongKeySound - Sound that is played if the person pressing the switch doesn't have the key, null means no sound -* \WrongPlayerTypeSound - Sound that is played if the palyer type isn't a match for the switch -* \TextColor[Red|Green|Blue] - Color of the messages that will be displayed when toggling the switch, values are from 0-1.0. -* \GotoLastFrameMessage - Message displayed when the door goes to the last frame, null for no message -* \GotoFirstFrameMessage - Message displayed when door goes to the first frame, null for no message -* \ActionBlockedMessage - Message displayed when door can't be toggled, null for no message -* \NoDoorMessage - Text message that is displayed if the door id cannot be found (useful if the door can be destroyed) -* \SwitchDamagedPokeMessage - Message that is displayed if the switch is damaged and cannot operate -* \WrongKeyMessage - Message that is displayed if the person pressing the switch doesn't have the key, null means no message -* \WrongPlayerTypeMessage - Message that is displayed if the palyer type isn't a match for the switch -* \DoorControlCustom - Send this message to the switch to open or close the door, switch must not be damaged, param of 1 goes to last frame 0 to first -* \SendCustomId - Sends a message to this id when user pokes the switch -* \SendCustom - Sends this message to the above id, param 0 = close, 1 = open, 2 = blocked, 3 = wrong player type, 4 = wrong key, 5 = damaged, 6 = door destroyed -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Toggle_Door : public ScriptImpClass { - float preDamagedFrame; - char originalModel[16]; - bool open; - bool enabled; - void Created(GameObject *obj); - void Poked(GameObject *obj,GameObject *poker); - void Damaged(GameObject *obj,GameObject *damager,float damage); - void Custom(GameObject *obj,int message,int param,GameObject *sender); - void SendCustom(GameObject *obj,int param); -}; - -/*! -* \brief Sets the animation of an object to the frame specified on script attach -* \Animation - Animation to play -* \Frame - Animation frame to display -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Set_Animation_Frame_On_Creation : public ScriptImpClass { - void Created(GameObject *obj); -}; - -/*! -* \brief Switches the model to different models as the object is damaged (Hint: Use skeleton models to fully support animations being synced across models) -* \FullShieldModel - Model to display when shield hits 100% -* \HalfShieldModel - Model to display when shield crosses the 50% mark -* \NoShieldModel - Model to display when shield hits 0%. -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Set_Model_On_Damage_Percent_3_States : public ScriptImpClass { - int damageState; - float healthThresholds[3]; - void Created(GameObject *obj); - void Damaged(GameObject *obj,GameObject *damager,float damage); - void SetModel(GameObject *obj); -}; - -/*! -* \brief Switches the model to different models as the object is damaged (Hint: Use skeleton models to fully support animations being synced across models) -* \FullShieldModel - Model to display when shield hits 100% -* \TwoThirdsShieldModel - Model to display when shield crosses the 66% mark -* \ThirdShieldModel - Model to display when shield crosses the 33% mark -* \NoShieldModel - Model to display when shield hits 0%. -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Set_Model_On_Damage_Percent_4_States : public ScriptImpClass { - int damageState; - float healthThresholds[3]; - void Created(GameObject *obj); - void Damaged(GameObject *obj,GameObject *damager,float damage); - void SetModel(GameObject *obj); -}; - -/*! -* \brief Works just like a normal PCT except you can definie zones with JMG_Utility_PCT_Inaccessible_Zone in which the PCT cannot be accessed by players -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_PCT : public ScriptImpClass { - void Created(GameObject *obj); - void Poked(GameObject *obj, GameObject *poker); -public: - static int pctInaccessible[128]; -}; - -/*! -* \brief If the player is in this zone they won't be able to access any PCT defined by JMG_Utility_PCT -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_PCT_Inaccessible_Zone : public ScriptImpClass { - void Entered(GameObject *obj,GameObject *enterer); - void Exited(GameObject *obj,GameObject *exiter); -}; - -/*! -* \brief Script is attached by JMG_Utility_PCT_Inaccessible_Zone, no need to do anything with this one -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_PCT_Inaccessible_Zone_Attach : public ScriptImpClass { - void Destroyed(GameObject *obj); -}; -/*! -* \brief Displays a hud message to all players on custom, allows user to override string with custom string -* \Custom - Custom message to trigger the script on -* \StringId - ID of the string to display (Don't use strings used by the game as this will be replaced) -* \ReplaceString - Message to replace the string ID with -* \ColorRGB - Color of the hud message to display 0-1 -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Display_HUD_Info_Text_All_Players_Custom_Replace_String : public ScriptImpClass { - void Custom(GameObject *obj,int message,int param,GameObject *sender); -}; -/*! -* \brief Displays a hud message to all players on custom, allows user to override string with custom string -* \Custom - Custom message to trigger the script on -* \Message - Message to display to all players -* \ColorRGB - Color of the hud message to display 0-255 -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Display_Text_Message_To_All_Players_On_Custom : public ScriptImpClass { - void Custom(GameObject *obj,int message,int param,GameObject *sender); -}; - -/*! -* \brief Sets an object team on attach -* \PlayerType - Player type to set the object to. -* \Delay - Amount of time to wait before setting team, default 0 -* \author jgray -* \ingroup JmgUtility -*/ -class JMG_Utility_Set_Team_On_Create : public ScriptImpClass { - void Created(GameObject *obj); - void Timer_Expired(GameObject *obj,int number); -}; \ No newline at end of file diff -uwr source/scripts/reborn.cpp sourceold/scripts/reborn.cpp --- source/scripts/reborn.cpp 2015-10-11 13:18:53.275586000 +1000 +++ sourceold/scripts/reborn.cpp 2015-04-09 09:38:16.733398400 +1000 @@ -461,13 +461,13 @@ sprintf(text,"%s_dd",model); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Set_Model(obj,text); + Commands->Clear_Weapons(obj); + Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); + Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj,false); Commands->Enable_Hibernation(obj,true); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); - Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); return; } //mech redeployed -> set standard model @@ -816,16 +816,16 @@ if (!_stricmp(animation_name,deployanim) && (mode == 1)) { mode = 2; + Commands->Clear_Weapons(obj); Commands->Set_Model(obj,deployedmodel); obj->As_PhysicalGameObj()->Clear_Animation(); + Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); + Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj,false); Commands->Enable_Vehicle_Transitions(obj,true); Commands->Enable_Innate_Conversations(obj,true); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); - Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); return; } //tank redeploy @@ -1266,15 +1266,15 @@ obj->As_VehicleGameObj()->Set_Immovable(true); mode = 1; Commands->Set_Model(obj,dmodel); + Commands->Clear_Weapons(obj); + Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); + Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); Commands->Set_Shield_Type(obj,Get_Parameter("Armor")); Commands->Set_Animation(obj,deployanim,false,0,0,-1,0); Commands->Control_Enable(sender,false); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("DeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj,false); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name"),false); - Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name")); } } //mode: 0=walk;1=deploy;2=deployed;3=redeploy @@ -1321,6 +1321,9 @@ mode = 0; Commands->Set_Model(obj,model); obj->As_PhysicalGameObj()->Clear_Animation(); + Commands->Clear_Weapons(obj); + Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name2"),false); + Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name2")); Commands->Set_Shield_Type(obj,Get_Parameter("Armor2")); Commands->Control_Enable(Commands->Find_Object(PilotID),true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); @@ -1328,9 +1331,6 @@ Commands->Enable_Innate_Conversations(obj,true); Commands->Enable_Vehicle_Transitions(obj,true); Commands->Enable_Engine(obj,true); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj,Get_Parameter("Weapon_Powerup_Name2"),false); - Commands->Select_Weapon(obj,Get_Parameter("Weapon_Name2")); return; } } @@ -1439,14 +1439,14 @@ mode = 1; Commands->Set_Model(obj, dmodel); Commands->Set_Animation(obj, deployanim, false, 0, 0, -1, 0); + Commands->Clear_Weapons(obj); + Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name"), false); + Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name")); Commands->Set_Shield_Type(obj, Get_Parameter("Armor")); Commands->Control_Enable(Commands->Find_Object(number), false); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(false); Commands->Create_Sound(Get_Parameter("DeploySound"),Commands->Get_Position(obj),obj); Commands->Enable_Vehicle_Transitions(obj, false); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name"), false); - Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name")); } void Reborn_IsDeployableTank_4::Animation_Complete(GameObject *obj, const char *animation_name) @@ -1462,16 +1462,16 @@ if (!_stricmp(animation_name, deployanim) && (mode == 1)) { mode = 2; + Commands->Clear_Weapons(obj); Commands->Set_Model(obj, deployedmodel); obj->As_PhysicalGameObj()->Clear_Animation(); + Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name"), false); + Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name")); Commands->Control_Enable(Commands->Find_Object(PilotID), true); obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); Commands->Enable_Engine(obj, false); Commands->Enable_Vehicle_Transitions(obj, true); Commands->Enable_Innate_Conversations(obj, true); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name"), false); - Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name")); return; } //tank redeploy @@ -1481,6 +1481,9 @@ obj->As_VehicleGameObj()->Set_Immovable(false); mode = 0; Commands->Set_Model(obj, model); + Commands->Clear_Weapons(obj); + Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name2"), false); + Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name2")); Commands->Set_Shield_Type(obj, Get_Parameter("Armor2")); obj->As_PhysicalGameObj()->Clear_Animation(); Commands->Control_Enable(Commands->Find_Object(PilotID), true); @@ -1489,9 +1492,6 @@ Commands->Enable_Innate_Conversations(obj, true); Commands->Enable_Vehicle_Transitions(obj, true); Commands->Enable_Engine(obj, true); - Commands->Clear_Weapons(obj); - Commands->Give_PowerUp(obj, Get_Parameter("Weapon_Powerup_Name2"), false); - Commands->Select_Weapon(obj, Get_Parameter("Weapon_Name2")); return; } } diff -uwr source/scripts/scripts.vcxproj sourceold/scripts/scripts.vcxproj --- source/scripts/scripts.vcxproj 2015-10-11 13:18:53.306836000 +1000 +++ sourceold/scripts/scripts.vcxproj 2015-05-04 21:26:30.893554600 +1000 @@ -469,7 +469,6 @@ - @@ -566,7 +565,6 @@ - @@ -667,7 +665,6 @@ - diff -uwr source/scripts/scripts.vcxproj.filters sourceold/scripts/scripts.vcxproj.filters --- source/scripts/scripts.vcxproj.filters 2015-10-11 13:18:53.322461000 +1000 +++ sourceold/scripts/scripts.vcxproj.filters 2015-05-04 21:26:30.909179600 +1000 @@ -359,9 +359,6 @@ 01. Sources - - 01. Sources - @@ -1240,12 +1237,6 @@ 02. Headers - - 02. Headers - - - 02. Headers - diff -uwr source/scripts/sh_underground.cpp sourceold/scripts/sh_underground.cpp --- source/scripts/sh_underground.cpp 2015-10-11 13:18:53.338086000 +1000 +++ sourceold/scripts/sh_underground.cpp 2015-02-25 22:57:19.823242100 +1000 @@ -73,7 +73,6 @@ Collision_Group_Type original_group; // needed to undo underground state ArmorType original_skin; // ^ ArmorType original_armor; // ^ - const char * original_weapon; // ^ bool underground; // "am I currently underground?" bool could_fire; // "could I fire before I went underground?" bool dig_pending; // "is there a dig animation pending completion?" @@ -201,9 +200,6 @@ }; }; - original_weapon = Get_Current_Weapon(owner); - Commands->Select_Weapon(owner,0); - // nobody gets in or out... Commands->Enable_Vehicle_Transitions(owner, false); Commands->Create_Explosion(Get_Parameter("DigExplosion"), Commands->Get_Position(owner), owner); @@ -315,8 +311,6 @@ movable_phys->Set_Immovable(false); movable_phys->Set_Collision_Group(original_group); - Commands->Select_Weapon(obj,original_weapon); - // weapon firing is now allowed { VehicleGameObj* vehicle = obj->As_VehicleGameObj(); diff -uwr source/scripts/shawk.cpp sourceold/scripts/shawk.cpp --- source/scripts/shawk.cpp 2015-10-11 13:18:53.338086000 +1000 +++ sourceold/scripts/shawk.cpp 2015-04-08 06:43:49.748046800 +1000 @@ -229,12 +229,6 @@ if (type == 0xAAAAAAAA && param == 0xEEEEEEEE) enabled = false; } - void Destroyed(GameObject *obj) - { - enabled = false; - Set_Screen_Fade_Opacity_Player(obj,0.0f,0.0f); - } - void Register_Auto_Save_Variables() { Auto_Save_Variable(&enabled, sizeof(enabled), 1);