diff -uwr sourceold/CTF/CTF.cpp source/CTF/CTF.cpp --- sourceold/CTF/CTF.cpp 2012-04-14 04:09:54.000000000 +0800 +++ source/CTF/CTF.cpp 2012-07-28 09:12:13.661132800 +0800 @@ -749,6 +749,7 @@ { StringClass str; str.Format("msg Running in Capture The Flag mode. This rounds CTF class will be '%s' with a capture limit of %d.",ctf.mapConfiguration.CTFClassName.Peek_Buffer(),ctf.mapConfiguration.CTFCapLimit); + Console_Input(str); if (ctf.mapConfiguration.CTFReverse) { Console_Input("msg This is a Reverse CTF game. Your objective is to take the enemy flag from your base and run it to your pedestal in the enemy base."); diff -uwr sourceold/Spectate/Spectate.cpp source/Spectate/Spectate.cpp --- sourceold/Spectate/Spectate.cpp 2012-05-02 14:15:38.000000000 +0800 +++ source/Spectate/Spectate.cpp 2012-08-28 07:46:56.349609300 +0800 @@ -170,6 +170,7 @@ for (SLNode* PlayerIter = Get_Player_List()->Head(); (PlayerIter != NULL); PlayerIter = PlayerIter->Next()) { cPlayer *p = PlayerIter->Data(); + if (!p->Is_Active()) continue; if (p->Get_Id() == id) { Send_Object_Update(obj,p->Get_Id()); Only in sourceold/bin/Debug: debug Binary files sourceold/bin/Debug/shaders.lib and source/bin/Debug/shaders.lib differ Only in sourceold/bin: Debug SSGM Binary files sourceold/bin/Release/shaders.lib and source/bin/Release/shaders.lib differ Only in sourceold/bin: Release SSGM diff -uwr sourceold/crates/crates.cpp source/crates/crates.cpp --- sourceold/crates/crates.cpp 2012-04-24 13:41:44.000000000 +0800 +++ source/crates/crates.cpp 2012-09-09 20:32:50.430507700 +0800 @@ -32,6 +32,7 @@ bool EnableNewCrates; bool VehCrate; Vector3 CrateVehSpawnPos[2]; + Vector3 CrateVehInfSpawnPos[2]; int CrateWeapon; int CrateMoney; int CratePoints; @@ -59,6 +60,8 @@ VehCrate = false; CrateVehSpawnPos[0] = Vector3(0, 0, 0); CrateVehSpawnPos[1] = Vector3(0, 0, 0); + CrateVehInfSpawnPos[0] = Vector3(0, 0, 0); + CrateVehInfSpawnPos[1] = Vector3(0, 0, 0); } }; @@ -129,6 +132,12 @@ mapConfiguration.CrateVehSpawnPos[1].X = SSGMIni->Get_Float(key, "GDIRVCX", mapConfiguration.CrateVehSpawnPos[1].X); mapConfiguration.CrateVehSpawnPos[1].Y = SSGMIni->Get_Float(key, "GDIRVCY", mapConfiguration.CrateVehSpawnPos[1].Y); mapConfiguration.CrateVehSpawnPos[1].Z = SSGMIni->Get_Float(key, "GDIRVCZ", mapConfiguration.CrateVehSpawnPos[1].Z); + mapConfiguration.CrateVehInfSpawnPos[0].X = SSGMIni->Get_Float(key, "NodRVCP_X", mapConfiguration.CrateVehInfSpawnPos[0].X); + mapConfiguration.CrateVehInfSpawnPos[0].Y = SSGMIni->Get_Float(key, "NodRVCP_Y", mapConfiguration.CrateVehInfSpawnPos[0].Y); + mapConfiguration.CrateVehInfSpawnPos[0].Z = SSGMIni->Get_Float(key, "NodRVCP_Z", mapConfiguration.CrateVehInfSpawnPos[0].Z); + mapConfiguration.CrateVehInfSpawnPos[1].X = SSGMIni->Get_Float(key, "GDIRVCP_X", mapConfiguration.CrateVehInfSpawnPos[1].X); + mapConfiguration.CrateVehInfSpawnPos[1].Y = SSGMIni->Get_Float(key, "GDIRVCP_Y", mapConfiguration.CrateVehInfSpawnPos[1].Y); + mapConfiguration.CrateVehInfSpawnPos[1].Z = SSGMIni->Get_Float(key, "GDIRVCP_Z", mapConfiguration.CrateVehInfSpawnPos[1].Z); } virtual void OnObjectCreate(void *data,GameObject *obj) { @@ -395,8 +404,9 @@ goto CrateStart; } Vector3 Pos = crate.mapConfiguration.CrateVehSpawnPos[Get_Object_Type(sender)]; + Vector3 Pos2 = crate.mapConfiguration.CrateVehInfSpawnPos[Get_Object_Type(sender)]; Damage_All_Vehicles_Area(999999.0f,"Laser_NoBuilding",Pos,2.0f,obj,0); - Commands->Set_Position(sender,Pos); + Commands->Set_Position(sender,Pos2); GameObject *Temp = Commands->Create_Object("Invisible_Object",Pos); Reselect2: @@ -443,7 +453,7 @@ Console_Input(msg); Vector3 pos; pos = Commands->Get_Position(sender); - message3.Format("CRATE;DEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;DEATH;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateTiberium)) && (crate.mapConfiguration.CrateTiberium > 0)) { message2.Format("%ls picked up a Tiberium Death crate.",Get_Wide_Player_Name(sender)); @@ -453,7 +463,7 @@ message1.Format("ppage %d [Crate] You have been killed by the tiberium death crate and your remains mutated into a visceroid.",Get_Player_ID(sender)); Commands->Create_2D_WAV_Sound("m00evag_dsgn0027i1evag_snd.wav"); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;TIBERIUMDEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;TIBERIUMDEATH;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateAmmo)) && (crate.mapConfiguration.CrateAmmo > 0)) { Commands->Give_PowerUp(sender,"CnC_POW_Ammo_ClipMax",false); @@ -464,7 +474,7 @@ message1.Format("ppage %d [Crate] You just got the Full Ammo Crate, your ammo has been refilled.",Get_Player_ID(sender)); Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav"); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;FULLAMMO;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;FULLAMMO;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateArmor)) && (crate.mapConfiguration.CrateArmor > 0)) { int RndGood = Commands->Get_Random_Int(1,3); @@ -474,14 +484,14 @@ message2.Format("%ls picked up an Armor crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You just got the Armor Crate, your max armor has been increased!",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;ARMORINCREASE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;ARMORINCREASE;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else { Commands->Set_Shield_Strength(sender,1); message2.Format("%ls picked up a Dearmor crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You just got the Dearmor Crate, your armor has been set to 1.",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;ARMORLOST;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;ARMORLOST;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateHealth)) && (crate.mapConfiguration.CrateHealth > 0)) { @@ -492,7 +502,7 @@ message2.Format("%ls picked up a Health crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You just got the Health Crate, your max health has been increased!",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;HEALTHUPGRADE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;HEALTHUPGRADE;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else { Commands->Set_Health(sender,1); @@ -500,7 +510,7 @@ message1.Format("ppage %d [Crate] You just got the Dehealth Crate, your health has been set to 1.",Get_Player_ID(sender)); Create_2D_WAV_Sound_Player(sender,"m00evag_dsgn0026i1evag_snd.wav"); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;HEALTHREDUCE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;HEALTHREDUCE;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateCharacter)) && (crate.mapConfiguration.CrateCharacter > 0)) { @@ -554,7 +564,7 @@ message2.Format("%ls picked up the Butter Fingers crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You picked up the Butter Fingers Crate, you have dropped most of your weapons.",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;BUTTERFINGER;;%d;%s;%f;%f;%f;%f;%f;%f;%d",Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;BUTTERFINGER;%d;%s;%f;%f;%f;%f;%f;%f;%d",Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateRefill)) && (crate.mapConfiguration.CrateRefill > 0)) { Grant_Refill(sender); @@ -562,7 +572,7 @@ message1.Format("ppage %d [Crate] You just got the Refill Crate, your health, armor, and ammo have all been refilled.",Get_Player_ID(sender)); Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav"); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;REFILL;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;REFILL;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateBeacon)) && (crate.mapConfiguration.CrateBeacon > 0)) { if (DisableBeacons) { @@ -584,7 +594,7 @@ Create_2D_Sound_Player(sender,"m00evan_dsgn0074i1evan_snd.wav"); } Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;BEACON;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;BEACON;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else { Commands->Create_Object("Beacon_Nuke_Strike_Anim_Post",Commands->Get_Position(obj)); @@ -598,7 +608,7 @@ delete[] str; Console_Input(msg); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;BEACONDEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;BEACONDEATH;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateSpy)) && (crate.mapConfiguration.CrateSpy > 0)) { @@ -616,14 +626,14 @@ delete[] str2; Console_Input(msg); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;SPY;;0;0;%f;%f;%f;%f;%f;%f;%d",pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;SPY;0;0;%f;%f;%f;%f;%f;%f;%d",pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateStealth)) && (crate.mapConfiguration.CrateStealth > 0)) { Commands->Enable_Stealth(sender,true); message2.Format("%ls picked up a Stealth crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You got the stealth crate! You have been given a stealth suit.",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;STEALTH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;STEALTH;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateThief)) && (crate.mapConfiguration.CrateThief > 0)) { Commands->Give_Money(sender,(Commands->Get_Money(sender) * -1),false); @@ -631,7 +641,7 @@ message1.Format("ppage %d [Crate] You got the Thief Crate, you have lost all of your credits.",Get_Player_ID(sender)); Create_2D_Sound_Player(sender,"m00evag_dsgn0028i1evag_snd.wav"); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;THIEF;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;THIEF;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateAmmoRegen)) && (crate.mapConfiguration.CrateAmmoRegen > 0)) { Commands->Send_Custom_Event(obj,sender,100100,1,1);//enable regeneration of ammo on player @@ -639,7 +649,7 @@ message1.Format("ppage %d [Crate] You got the Ammo Reneration Crate, your ammo will be refilled every minute.",Get_Player_ID(sender)); Create_2D_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");//ammo regen sound Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;AMMOREGEN;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;AMMOREGEN;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateHumanSilo)) && (crate.mapConfiguration.CrateHumanSilo > 0)) { int team = Commands->Get_Player_Type(sender); @@ -648,14 +658,14 @@ message1.Format("ppage %d [Crate] You got the Human Silo Crate, your entire team will be granted an additional $1 credit a second until you die or change character.",Get_Player_ID(sender)); Create_2D_WAV_Sound_Team("m00pc$$_aqob0002i1evag_snd.wav",team);//credits acquired Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;HUMANSILO;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;HUMANSILO;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); } else if ((RandomIntCrate <= (percent+=crate.mapConfiguration.CrateUberWire)) && (crate.mapConfiguration.CrateUberWire > 0)) { char ubermsg[250]; sprintf(ubermsg,"[CRATE] %s got the UberWire crate! Beware!",Get_Player_Name(sender)); Send_Message(255,255,255,ubermsg); message2.Format("%ls picked up a UberWire crate.",Get_Wide_Player_Name(sender)); message1.Format("ppage %d [Crate] You got the UberWire crate.",Get_Player_ID(sender)); Vector3 pos = Commands->Get_Position(sender); - message3.Format("CRATE;UBERWIRE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); + message3.Format("CRATE;UBERWIRE;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender)); Change_Character(sender,"GDI_Engineer_2SF"); } else { diff -uwr sourceold/scripts/AABoxClass.h source/scripts/AABoxClass.h --- sourceold/scripts/AABoxClass.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/AABoxClass.h 2012-09-11 08:40:47.083007800 +0800 @@ -16,6 +16,7 @@ #include "Matrix3D.h" #include "WWMath.h" #include "LineSegClass.h" +#include "engine_math.h" class MinMaxAABoxClass; class LineSegClass; class AABoxClass @@ -149,6 +150,17 @@ return sq_dist; } + float ComputeMaxSquaredDistanceFromPoint(const Vector3& point) const + { + const Vector3 d = Center - point; + const Vector3 dmin = d - Extent; + const Vector3 dmax = d + Extent; + return + max(sqr(dmin[0]), sqr(dmax[0])) + + max(sqr(dmin[1]), sqr(dmax[1])) + + max(sqr(dmin[2]), sqr(dmax[2])); + } + }; // 0018 class MinMaxAABoxClass diff -uwr sourceold/scripts/BuildingGameObj.h source/scripts/BuildingGameObj.h --- sourceold/scripts/BuildingGameObj.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/BuildingGameObj.h 2012-09-09 17:56:17.863124900 +0800 @@ -103,10 +103,13 @@ void Find_Closest_Poly (const Vector3 &pos, float *distance2); int Building_In_Range(const Vector3 &point, float range); //return 0 for no, 1 for yes and 2 for MCT in range bool Is_In_Range_Coarse(const Vector3& point, float range_sq); + bool Cast_Ray(RayCollisionTestClass& raytest); + virtual ConstructionYardGameObj * As_ConstructionYardGameObj (void) { return NULL; } virtual AirFactoryGameObj * As_AirFactoryGameObj (void) { return NULL; } virtual NavalFactoryGameObj * As_NavalFactoryGameObj (void) { return NULL; } virtual SuperWeaponGameObj * As_SuperWeaponGameObj (void) { return NULL; } + protected: BuildingMonitorClass * BuildingMonitor; BaseControllerClass * BaseController; diff -uwr sourceold/scripts/CollisionMath.h source/scripts/CollisionMath.h --- sourceold/scripts/CollisionMath.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/CollisionMath.h 2012-07-28 09:11:05.585937500 +0800 @@ -53,6 +53,14 @@ posfarpt->Z = -extent.Z; } } + +inline void get_far_extent_branchless(const Vector3& normal, const Vector3& extent, Vector3* posfarpt) +{ + *reinterpret_cast(&posfarpt->X) = (*(reinterpret_cast(&extent.X))) ^ ((*(reinterpret_cast(&normal.X))) & 0x80000000); + *reinterpret_cast(&posfarpt->Y) = (*(reinterpret_cast(&extent.Y))) ^ ((*(reinterpret_cast(&normal.Y))) & 0x80000000); + *reinterpret_cast(&posfarpt->Z) = (*(reinterpret_cast(&extent.Z))) ^ ((*(reinterpret_cast(&normal.Z))) & 0x80000000); +} + class SHADERS_API CollisionMath { public: @@ -104,7 +112,7 @@ { Vector3 posfarpt; Vector3 negfarpt; - get_far_extent(plane.N,box.Extent,&posfarpt); + get_far_extent_branchless(plane.N,box.Extent,&posfarpt); negfarpt = -posfarpt; posfarpt += box.Center; negfarpt += box.Center; @@ -159,36 +167,7 @@ static OverlapType Overlap_Test(const FrustumClass & frustum,const SphereClass & sphere); static OverlapType Overlap_Test(const FrustumClass & frustum,const AABoxClass & box); static OverlapType Overlap_Test(const FrustumClass & frustum,const OBBoxClass & box); - static OverlapType Overlap_Test(const FrustumClass & frustum,const AABoxClass & box,int & planes_passed) - { - int mask = 0; - for (int i = 0; i < 6; i++) - { - int plane_bit = (1< , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. @@ -835,7 +832,7 @@ # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. +# fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES @@ -854,7 +851,8 @@ # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. +# link to the source code. +# Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES @@ -984,20 +982,23 @@ HTML_TIMESTAMP = YES -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). +# page has loaded. HTML_DYNAMIC_SECTIONS = NO +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). @@ -1176,11 +1177,6 @@ ENUM_VALUES_PER_LINE = 4 -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. @@ -1223,7 +1219,8 @@ # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. However, it is strongly recommended to install a local +# installing MathJax. +# However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1488,8 +1485,10 @@ PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. @@ -1575,8 +1574,10 @@ # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: +# # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: +# # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does @@ -1617,7 +1618,7 @@ # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. -CLASS_DIAGRAMS = YES +CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see @@ -1743,7 +1744,7 @@ GRAPHICAL_HIERARCHY = YES -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. diff -uwr sourceold/scripts/LineSegClass.h source/scripts/LineSegClass.h --- sourceold/scripts/LineSegClass.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/LineSegClass.h 2012-08-12 22:45:46.237789100 +0800 @@ -25,6 +25,11 @@ { recalculate(); } + LineSegClass(const Vector3& p0, const Vector3& dir, float l) : P0(p0), Dir(dir), Length(l) + { + DP = Dir * Length; + P1 = P0 + DP; + } LineSegClass(const LineSegClass & that,const Matrix3D & tm) { Set(that,tm); @@ -35,6 +40,14 @@ P1 = p1; recalculate(); } + void Set(const Vector3& p0, const Vector3& dir, float l) + { + DP = dir * l; + P0 = p0; + P1 = p0 + DP; + Dir = dir; + Length = l; + } void Set(const LineSegClass & that,const Matrix3D & tm); void Set_Random(const Vector3 & min,const Vector3 & max); const Vector3 & Get_P0() const diff -uwr sourceold/scripts/MeshClass.h source/scripts/MeshClass.h --- sourceold/scripts/MeshClass.h 2012-04-14 04:09:50.000000000 +0800 +++ source/scripts/MeshClass.h 2012-08-26 23:52:06.549203100 +0800 @@ -95,10 +95,14 @@ unsigned Get_Debug_Id() const { return MeshDebugId; } void Set_Debugger_Disable(bool b) { IsDisabledByDebugger=b; } bool Is_Disabled_By_Debugger() const { return IsDisabledByDebugger; } - void Install_User_Lighting_Array(Vector4 * lighting); + SHADERS_API void Install_User_Lighting_Array(Vector4 * lighting); unsigned int * Get_User_Lighting_Array(bool alloc = false); virtual void Save_User_Lighting (ChunkSaveClass & csave); - virtual void Load_User_Lighting (ChunkLoadClass & cload); + SHADERS_API virtual void Load_User_Lighting (ChunkLoadClass & cload); + + SHADERS_API void Enable_Alternate_Material_Description(bool onoff); + SHADERS_API bool Use_User_Lighting(); //should this mesh have user lighting setup on it + protected: void Free(void); virtual void Add_Dependencies_To_List (DynamicVectorClass &file_list, bool textures_only = false); diff -uwr sourceold/scripts/RenderObjClass.h source/scripts/RenderObjClass.h --- sourceold/scripts/RenderObjClass.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/RenderObjClass.h 2012-08-27 13:03:47.565429700 +0800 @@ -267,6 +267,7 @@ void Validate_Cached_Bounding_Volumes(void) const { Bits |= BOUNDING_VOLUMES_VALID; } void Save_Sub_Object_User_Lighting(ChunkSaveClass & csave,RenderObjClass * sub_obj,int bone_index); void Load_Sub_Object_User_Lighting(ChunkLoadClass & cload); + void Set_User_Lighting_Flag(); //Set the HAS_USER_LIGHTING flag appropriatly for this renderobj, intended to be called during vertex solve. }; // 0088 00A0 TT_INLINE const SphereClass & RenderObjClass::Get_Bounding_Sphere(void) const { diff -uwr sourceold/scripts/ScriptZoneGameObj.h source/scripts/ScriptZoneGameObj.h --- sourceold/scripts/ScriptZoneGameObj.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/ScriptZoneGameObj.h 2012-08-12 22:45:46.246578200 +0800 @@ -17,11 +17,14 @@ #include "ScriptableGameObj.h" #include "OBBoxClass.h" class SmartGameObj; +class RenderObjClass; class ScriptZoneGameObj : public ScriptableGameObj { private: OBBoxClass BoundingBox; int PlayerType; SList ZoneContents; + + RenderObjClass* Model; public: ScriptZoneGameObj(); ~ScriptZoneGameObj(); @@ -31,6 +34,7 @@ const ScriptZoneGameObjDef SCRIPTS_API & Get_Definition( void ) const ; bool Save(ChunkSaveClass &csave); bool Load(ChunkLoadClass &cload); + void On_Post_Load(); void Think(); void Entered(PhysicalGameObj *); bool In_List(PhysicalGameObj *); diff -uwr sourceold/scripts/ScriptZoneGameObjDef.h source/scripts/ScriptZoneGameObjDef.h --- sourceold/scripts/ScriptZoneGameObjDef.h 2012-05-06 16:37:06.000000000 +0800 +++ source/scripts/ScriptZoneGameObjDef.h 2012-08-12 22:45:46.241695400 +0800 @@ -51,6 +51,9 @@ bool IsEnvironmentZone; bool CheckC4; int PresetID; + + StringClass ModelName; + friend class ScriptZoneGameObj; friend class PresetDump; }; diff -uwr sourceold/scripts/SmartGameObj.h source/scripts/SmartGameObj.h --- sourceold/scripts/SmartGameObj.h 2012-05-23 11:29:04.000000000 +0800 +++ source/scripts/SmartGameObj.h 2012-08-28 07:46:56.224609300 +0800 @@ -93,7 +93,7 @@ virtual float Get_Stealth_Fade_Distance(void) const { return 25.0f; } void Grant_Stealth_Powerup(float seconds); float Remaining_Stealth_Powerup_Time(void); - StealthEffectClass * Peek_Stealth_Effect(void); + StealthEffectClass * Peek_Stealth_Effect(void) { return StealthEffect; } #ifndef TTLE_EXPORTS static float Get_Global_Sight_Range_Scale( void ) { return GlobalSightRangeScale; } static void Set_Global_Sight_Range_Scale( float scale ) { GlobalSightRangeScale = scale; } diff -uwr sourceold/scripts/TransitionGameObj.h source/scripts/TransitionGameObj.h --- sourceold/scripts/TransitionGameObj.h 2012-05-23 11:15:28.000000000 +0800 +++ source/scripts/TransitionGameObj.h 2012-08-18 01:47:18.017578100 +0800 @@ -31,12 +31,12 @@ bool Save(ChunkSaveClass &csave); bool Load(ChunkLoadClass &cload); void On_Post_Load(); - void Set_Transform(const Matrix3D &tm); - const Matrix3D &Get_Transform() const; + void Set_Transform(const Matrix3D &tm) {Transform = tm;} + const Matrix3D &Get_Transform() const {return Transform;} void Create_Transitions(); void Destroy_Transitions(); void Update_Transitions(); - void Set_Ladder_Index(); + void Set_Ladder_Index(int index); int Get_Transition_Count() {return Transitions.Count();}; TransitionInstanceClass *Get_Transition(int trans) {return Transitions[trans];} int Get_Ladder_Index() {return LadderIndex;} diff -uwr sourceold/scripts/TransitionGameObjDef.h source/scripts/TransitionGameObjDef.h --- sourceold/scripts/TransitionGameObjDef.h 2012-05-06 16:37:06.000000000 +0800 +++ source/scripts/TransitionGameObjDef.h 2012-08-18 01:56:17.041992100 +0800 @@ -37,6 +37,7 @@ } bool Save(ChunkSaveClass &csave); bool Load(ChunkLoadClass &cload); + StyleType Get_Type() {return Type;} }; // 0074 class TransitionGameObjDef : public BaseGameObjDef { @@ -54,7 +55,6 @@ #ifdef DDBEDIT virtual void Dump (FileClass &file); #endif - DECLARE_EDITABLE(TransitionGameObjDef,BaseGameObjDef); private: DynamicVectorClass Transitions; friend class PresetDump; diff -uwr sourceold/scripts/TransitionInstanceClass.h source/scripts/TransitionInstanceClass.h --- sourceold/scripts/TransitionInstanceClass.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/TransitionInstanceClass.h 2012-08-18 01:47:18.033203100 +0800 @@ -25,10 +25,10 @@ Matrix3D CharacterTransform; // 0000 OBBoxClass TriggerZone; // 0030 ReferencerClass Vehicle; // 006C - TransitionDataClass* Definition; // 007C - int LadderId; // 0080 + const TransitionDataClass* Definition; // 007C + int LadderIndex; // 0080 public: - TransitionInstanceClass(); + TransitionInstanceClass(TransitionDataClass const&); ~TransitionInstanceClass(); void Start(SoldierGameObj *soldier); bool Check(SoldierGameObj *soldier, bool b); @@ -36,6 +36,7 @@ void Set_Parent_Transform(Matrix3D const &tm); TransitionDataClass::StyleType Get_Type() {return Definition->Type;} void Set_Vehicle(VehicleGameObj *obj) {Vehicle = obj;} + void Set_Ladder_Index(int index) {LadderIndex = index;} }; // 0084 #endif \ No newline at end of file diff -uwr sourceold/scripts/VehicleGameObj.h source/scripts/VehicleGameObj.h --- sourceold/scripts/VehicleGameObj.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/VehicleGameObj.h 2012-08-18 01:54:47.235351500 +0800 @@ -224,6 +224,8 @@ ReferencerClass Owner; //Owner for SSGM vehicle locking. When this is set, only this player can enter the vehicle. bool HasUpdatedTargeting; + void Remove_Transitions( TransitionDataClass::StyleType transition_type ); + void Create_New_Transitions( TransitionDataClass::StyleType transition_type ); void Destroy_Transitions( void ); void Update_Transitions( void ); void Create_And_Destroy_Transitions( void ); diff -uwr sourceold/scripts/WWAudioClass.h source/scripts/WWAudioClass.h --- sourceold/scripts/WWAudioClass.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/WWAudioClass.h 2012-08-04 10:17:08.598632800 +0800 @@ -266,20 +266,10 @@ private: static REF_DECL3(_theInstance,WWAudioClass *); static HANDLE _TimerSyncEvent; - typedef struct _CACHE_ENTRY_STRUCT + typedef struct _CACHE_ENTRY_STRUCT : public NoEqualsClass<_CACHE_ENTRY_STRUCT> { const char * string_id; SoundBufferClass * buffer; - _CACHE_ENTRY_STRUCT (void) - : string_id (0), buffer (NULL) {} - _CACHE_ENTRY_STRUCT &operator= (const _CACHE_ENTRY_STRUCT &src) - { - string_id = _strdup (src.string_id); - REF_PTR_SET (buffer, src.buffer); - return *this; - } - bool operator== (const _CACHE_ENTRY_STRUCT &src) { return false; } - bool operator!= (const _CACHE_ENTRY_STRUCT &src) { return true; } } CACHE_ENTRY_STRUCT; typedef struct _LOGICAL_TYPE_STRUCT { diff -uwr sourceold/scripts/cNetEvent.h source/scripts/cNetEvent.h --- sourceold/scripts/cNetEvent.h 2012-05-23 11:02:16.000000000 +0800 +++ source/scripts/cNetEvent.h 2012-07-28 09:11:06.348632800 +0800 @@ -32,7 +32,7 @@ virtual void Act () = 0; void Init(); - SCRIPTS_API void Set_Object_Dirty_Bit_For_Version(float version,DIRTY_BIT dirty_bit, bool onoff); + SCRIPTS_API void Set_Object_Dirty_Bit_For_Revision(uint revision,DIRTY_BIT dirty_bit, bool onoff); }; // 06B4 diff -uwr sourceold/scripts/dllmain.cpp source/scripts/dllmain.cpp --- sourceold/scripts/dllmain.cpp 2012-05-28 21:47:08.000000000 +0800 +++ source/scripts/dllmain.cpp 2012-08-24 20:46:44.369140600 +0800 @@ -388,6 +388,8 @@ Get_Mine_Limit = (gml)Address(tt,"Get_Mine_Limit"); Set_Special_Base_Destruction = (sbd)Address(tt,"Set_Special_Base_Destruction"); Get_Client_Version = (gpv)Address(tt,"Get_Client_Version"); + Get_Client_Revision = (gpr)Address(tt,"Get_Client_Revision"); + Get_Revision = (gpr)Address(tt,"Get_Revision"); Get_Damage_Warhead = (gdw)Address(tt,"Get_Damage_Warhead"); Commands->Action_Enter_Exit = (naee)Address(tt,"New_Action_Enter_Exit"); Get_GameObj_By_Player_Name = (ggobpn)Address(tt,"Get_GameObj_By_Player_Name"); @@ -407,6 +409,10 @@ Get_Client_Serial_Hash = (gcsh)Address(tt,"Get_Client_Serial_Hash"); Get_Tech_Level = (gml)Address(tt,"Get_Tech_Level"); Set_Tech_Level = (sw)Address(tt,"Set_Tech_Level"); + Create_Explosion_Extended = (cee)Address(tt,"Create_Explosion_Extended"); + Retrieve_Waypaths = (rwpa)Address(tt,"Retrieve_Waypaths"); + Retrieve_Waypoints = (rwpo)Address(tt,"Retrieve_Waypoints"); + Get_Waypoint_Position = (gwp)Address(tt,"Get_Waypoint_Position"); ssc ttssc = (ssc)Address(tt,"Set_Script_Commands"); ttssc(commands); #ifdef SSGM diff -uwr sourceold/scripts/dp88_ar.cpp source/scripts/dp88_ar.cpp --- sourceold/scripts/dp88_ar.cpp 2012-05-23 10:32:16.000000000 +0800 +++ source/scripts/dp88_ar.cpp 2012-08-22 21:20:45.922851500 +0800 @@ -1007,6 +1007,8 @@ delay is required to prevent the normal harvester AI taking over */ if ( useAI ) Commands->Send_Custom_Event( obj, obj, CUSTOM_MINER_UNLOAD_ORE_COMPLETE, 1, (float)Get_Int_Parameter("aiStartDelay") ); + if (strlen(Get_Parameter("idleAnimation")) > 0) + Commands->Set_Animation(obj,Get_Parameter("idleAnimation"),true,0,0,-1,false); } @@ -1075,7 +1077,8 @@ // Stop the mining animation animating = false; obj->As_PhysicalGameObj()->Clear_Animation(); - + if (strlen(Get_Parameter("idleAnimation")) > 0) + Commands->Set_Animation(obj,Get_Parameter("idleAnimation"),true,0,0,-1,false); // If using the AI start driving to the refinery if ( useAI ) { @@ -1187,6 +1190,8 @@ // Stop the mining animation animating = false; obj->As_PhysicalGameObj()->Clear_Animation(); + if (strlen(Get_Parameter("idleAnimation")) > 0) + Commands->Set_Animation(obj,Get_Parameter("idleAnimation"),true,0,0,-1,false); // If this is an AI miner and our state is still collecting ore then we were probably shoved out // of the ore field by some bully in a vehicle so drive back in to finish mining @@ -1280,6 +1285,9 @@ aiState = MINER_AISTATE_DRIVE_TO_ORE; DriveToOreField(obj); } + obj->As_PhysicalGameObj()->Clear_Animation(); + if (strlen(Get_Parameter("idleAnimation")) > 0) + Commands->Set_Animation(obj,Get_Parameter("idleAnimation"),true,0,0,-1,false); } @@ -2715,21 +2723,18 @@ void dp88_AR_Prism_Tower::Created( GameObject *obj ) { - Init(obj); - loadSettings(obj, false, false); + dp88_AI_ChargedTurret::Created(obj); // Initialise member variables - isChargingTower = false; + isAssistingTower = false; adjacentTowerCount = 0; adjacentTowers = NULL; // Register the tower registerTower(Commands->Get_ID(obj),this); - - // Start think timer to manage the charge level - Commands->Start_Timer ( obj, this, 1.0, TIMER_PRISMTOWER_THINK ); } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::Damaged ( GameObject *obj, GameObject *damager, float amount ) { @@ -2742,6 +2747,7 @@ } } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::Killed ( GameObject *obj, GameObject *killer ) { @@ -2758,6 +2764,7 @@ deregisterTower(Commands->Get_ID(obj)); } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::Destroyed ( GameObject *obj ) { @@ -2765,13 +2772,14 @@ deregisterTower(Commands->Get_ID(obj)); } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::Custom ( GameObject *obj, int type, int param, GameObject *sender ) { // If we recieve a stop charging message from the tower we are currently // charging then we should stop all actions - if ( type == CUSTOM_PRISMTOWER_STOP_CHARGING && isChargingTower && Commands->Get_ID(sender) == targetID ) - StopCharging(obj); + if ( type == CUSTOM_PRISMTOWER_STOP_CHARGING && isAssistingTower && Commands->Get_ID(sender) == targetID ) + StopAssisting(obj); // If we recieve a request charging message from another tower then we @@ -2779,15 +2787,13 @@ // current target (if any) and, if so, start charging them else if ( type == CUSTOM_PRISMTOWER_REQUEST_CHARGING ) { - // Are we idle? If so then there's no reason not to simply start - // charging immediatly + // Are we idle? If so then there's no reason not to simply start charging immediatly if ( targetID == 0 ) - StartCharging(obj, sender, (float)param); + StartAssisting(obj, sender, (float)param); - // Is this request from the tower we are currently charging? If so - // then update the last seen time and priority and send out the - // assistance request to any other adjacent towers - else if ( isChargingTower && targetID == Commands->Get_ID(sender) ) + // Is this request from the tower we are currently charging? If so then update the last seen + // time and priority and forward the assistance request to any other adjacent towers + else if ( isAssistingTower && targetID == Commands->Get_ID(sender) ) { targetLastSeen = (int)time(NULL); targetPriority = (float)param; @@ -2795,22 +2801,26 @@ return; } - // Is the priority of the request greater than the priority of our - // current target (either another tower or an enemy)? If so then - // stop what we are doing and charge the requester + // Is the priority of the request greater than the priority of our current target (either + // another tower or an enemy)? If so then stop what we are doing and charge the requester else if ( param > targetPriority ) - StartCharging(obj, sender, (float)param ); + StartAssisting(obj, sender, (float)param ); } } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::Timer_Expired ( GameObject *obj, int number ) { - /* Prism tower logic timer - handles charge level etc */ - if ( number == TIMER_PRISMTOWER_THINK ) + // Piggy back our assistance polling and charge refilling on the existing think timer + if ( number == TIMER_CUSTOMAI_THINK ) { - /* Send out assistance requests, otherwise the tower will 'time out' - on the last seen check */ + /* Send out assistance requests to ensure other towers don't time out on the 'last seen' check + * + * \todo + * Can this screw up the timings between charging towers and the attacking tower? Need to think + * this through sometime and possibly do some experimentation... + */ if ( targetID ) SendAssistanceRequests(obj); @@ -2821,119 +2831,108 @@ /* If current bullets > 1 and no enemy seen recently then additional charge is lost */ if ( Get_Current_Bullets(obj) > 1 && targetID == 0 ) Set_Current_Bullets(obj,1); - - // Trigger again when required - Commands->Start_Timer ( obj, this, 1.0, TIMER_PRISMTOWER_THINK ); } - // Otherwise pass the timer on to the base class - else - dp88_AI_Turret::Timer_Expired(obj, number); + // Pass the timer onto the base class to be handled + dp88_AI_ChargedTurret::Timer_Expired(obj, number); } +// ------------------------------------------------------------------------------------------------- - - -// Override priority calculation with our own taking into account -// the fact that the target might be a tower we are charging float dp88_AR_Prism_Tower::getPriority( GameObject *obj, GameObject *target ) { // If the target is the tower we are currently charging then return // the priority of that charging sequence - if ( Commands->Get_ID(target) == targetID && isChargingTower ) + if ( Commands->Get_ID(target) == targetID && isAssistingTower ) return targetPriority; // Otherwise run the normal priority calculation - return dp88_AI_Turret::getPriority(obj, target); + return dp88_AI_ChargedTurret::getPriority(obj, target); } +// ------------------------------------------------------------------------------------------------- -// Override the team check mechanism to return true when charging another -// tower, even though the target is on the same team bool dp88_AR_Prism_Tower::checkTeam( GameObject *obj, GameObject *target ) { - // If the target is the tower we are currently charging then return - // the priority of that charging sequence - if ( Commands->Get_ID(target) == targetID && isChargingTower ) + // Return true for the tower we are charging, even though it is on the same team as us + if ( Commands->Get_ID(target) == targetID && isAssistingTower ) return true; // Otherwise run the normal check team function - return dp88_AI_Turret::checkTeam(obj, target); + return dp88_AI_ChargedTurret::checkTeam(obj, target); } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::attackTarget ( GameObject* obj, GameObject* target, bool primary ) { // Call base classes attack routine - dp88_AI_Turret::attackTarget(obj, target, primary); + dp88_AI_ChargedTurret::attackTarget(obj, target, primary); // Send notifications for assistance SendAssistanceRequests(obj); } +// ------------------------------------------------------------------------------------------------- void dp88_AR_Prism_Tower::attackLocation ( GameObject* obj, Vector3 location, bool primary ) { // Call base classes attack routine - dp88_AI_Turret::attackLocation(obj, location, primary); + dp88_AI_ChargedTurret::attackLocation(obj, location, primary); // Send notifications for assistance SendAssistanceRequests(obj); } +// ------------------------------------------------------------------------------------------------- + void dp88_AR_Prism_Tower::stopAttacking ( GameObject* obj ) { - // Was the target a tower we were charging? If so this means they - // must have timed out on the last seen and are therefore probably - // dead... - if ( isChargingTower ) - StopCharging(obj); + // Was the target a tower we were charging? If so this means they must have timed out on the last + // seen and are therefore probably dead... + if ( isAssistingTower ) + StopAssisting(obj); - // Otherwise we were attacking a normal target, send out end assistance - // notifications to all adjacent towers and call base class + // Otherwise we were attacking a normal target, send out end assistance notifications to all + // adjacent towers and call base class else { SendEndAssistanceNotifications(obj); - dp88_AI_Turret::stopAttacking(obj); + dp88_AI_ChargedTurret::stopAttacking(obj); } } +// ------------------------------------------------------------------------------------------------- /* Start charging the specified tower */ -void dp88_AR_Prism_Tower::StartCharging(GameObject* obj, GameObject* tower, float priority) +void dp88_AR_Prism_Tower::StartAssisting(GameObject* obj, GameObject* tower, float priority) { // Set our new target ID and priority targetID = Commands->Get_ID(tower); targetPriority = priority; targetLastSeen = (int)time(NULL); - isChargingTower = true; + isAssistingTower = true; // Work out attack position Vector3 chargePos = Commands->Get_Bone_Position(tower,"turret"); chargePos.Z += 1; - // Start charging the tower - ActionParamsStruct params; - params.Set_Basic( this, 100, 2 ); - params.Set_Attack( chargePos, (float)primary_maxRange, 0.0, true); - params.AttackCheckBlocked = false; - Commands->Action_Attack( obj, params ); - - // Send notifications for assistance - SendAssistanceRequests(obj); + // Start charging the tower - this will also trigger assistance notifications to be sent out + attackLocation ( obj, chargePos, true ); } +// ------------------------------------------------------------------------------------------------- /* Stop charging the specified tower */ -void dp88_AR_Prism_Tower::StopCharging(GameObject* obj) +void dp88_AR_Prism_Tower::StopAssisting(GameObject* obj) { - if ( isChargingTower ) + if ( isAssistingTower ) { targetID = NULL; targetPriority = 0; - isChargingTower = false; + isAssistingTower = false; Commands->Action_Reset(obj, 101.0f); } @@ -2941,13 +2940,11 @@ SendEndAssistanceNotifications(obj); } +// ------------------------------------------------------------------------------------------------- -// Function to send assistance requests to all adjacent towers, -// except the one we are currently charging void dp88_AR_Prism_Tower::SendAssistanceRequests(GameObject* obj) { - // Send out assistance requests to all adjacent towers except the one - // we are charging, if any + // Send out assistance requests to all adjacent towers except the one we are charging, if any for ( int i = 0; i < adjacentTowerCount; ++i ) { if ( adjacentTowers[i] != targetID && Commands->Find_Object(adjacentTowers[i]) != obj) @@ -2955,9 +2952,8 @@ } } +// ------------------------------------------------------------------------------------------------- -// Function to send assistance requests to all adjacent towers, -// except the one we are currently charging void dp88_AR_Prism_Tower::SendEndAssistanceNotifications(GameObject* obj) { // Send out end assistance notifications to all adjacent towers @@ -2970,6 +2966,8 @@ } } +// ------------------------------------------------------------------------------------------------- + @@ -3109,8 +3107,8 @@ ScriptRegistrant dp88_AR_CLEG_target_Registrant( "dp88_AR_CLEG_target", "resistance=20:int,clegEffectPreset=null:string" ); // Ore Miners -ScriptRegistrant dp88_AR_Miner_Registrant("dp88_AR_War_Miner","enableAI=1:int,loadLevels=10:int,orePerLoadLevel=100:int,timePerLoadLevel=2.0:float,unloadTime=8.0:float,aiStartDelay=10:int,dockAnimation:string,dockSound:string,miningAnimation:String,miningSound:string"); -ScriptRegistrant dp88_AR_Chrono_Miner_Registrant("dp88_AR_Chrono_Miner","enableAI=1:int,chronoshift_time=2.5:float,chronoshift_out_effect_preset:string,chronoshift_out_effect_time:float,chronoshift_in_effect_preset:string,chronoshift_in_effect_time:float,chronoshiftKeyhook=VDeploy:string,loadLevels=10:int,orePerLoadLevel=50:int,timePerLoadLevel=1.00:float,unloadTime=4.0:float,emergencyChronoshiftHealthThreshold=30.0:float,aiStartDelay=10:int,dockAnimation:string,dockSound:string,miningAnimation:String,miningSound:string"); +ScriptRegistrant dp88_AR_Miner_Registrant("dp88_AR_War_Miner","enableAI=1:int,loadLevels=10:int,orePerLoadLevel=100:int,timePerLoadLevel=2.0:float,unloadTime=8.0:float,aiStartDelay=10:int,dockAnimation:string,dockSound:string,miningAnimation:String,miningSound:string,idleAnimation:string"); +ScriptRegistrant dp88_AR_Chrono_Miner_Registrant("dp88_AR_Chrono_Miner","enableAI=1:int,chronoshift_time=2.5:float,chronoshift_out_effect_preset:string,chronoshift_out_effect_time:float,chronoshift_in_effect_preset:string,chronoshift_in_effect_time:float,chronoshiftKeyhook=VDeploy:string,loadLevels=10:int,orePerLoadLevel=50:int,timePerLoadLevel=1.00:float,unloadTime=4.0:float,emergencyChronoshiftHealthThreshold=30.0:float,aiStartDelay=10:int,dockAnimation:string,dockSound:string,miningAnimation:String,miningSound:string,idleAnimation:string"); ScriptRegistrant dp88_AR_Chrono_Miner_Chronozone_Registrant("dp88_AR_Chrono_Miner_Chronozone",""); ScriptRegistrant dp88_AR_Ore_Field_Zone_Registrant("dp88_AR_Ore_Field_Zone","oreValue=1:int"); ScriptRegistrant dp88_AR_Ore_Deposit_Zone_Registrant("dp88_AR_Ore_Deposit_Zone","teamID=0:int"); @@ -3138,7 +3136,7 @@ ScriptRegistrant dp88_AR_paradrop_Registrant("dp88_AR_paradrop","infantry_preset:string"); // Prism Tower script -ScriptRegistrant dp88_AR_Prism_Tower_Registrant("dp88_AR_Prism_Tower","Priority_Infantry=1.0:float,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Priority_Heavy_Vehicle=7.0:float,Priority_VTOL=0.0:float,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Modifier_Distance=0.25:float,Modifier_Target_Damage=0.1:float,Modifier_Target_Value=0.25:float,Requires_Power=1:int,Debug=0:int"); +ScriptRegistrant dp88_AR_Prism_Tower_Registrant("dp88_AR_Prism_Tower","Priority_Infantry=1.0:float,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Priority_Heavy_Vehicle=7.0:float,Priority_VTOL=0.0:float,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Animation_Model:string,Animation_Model_Bone:string,Animation:string,Animation_Idle_Start_Frame:int,Animation_Idle_End_Frame:int,Animation_Unpowered_Start_Frame:int,Animation_Unpowered_End_Frame:int,Animation_Charge_Start_Frame:int,Animation_Charge_End_Frame:int,Charge_Sound:string,Modifier_Distance=0.25:float,Modifier_Target_Damage=0.1:float,Modifier_Target_Value=0.25:float,Requires_Power=1:int,Debug=0:int"); // Health link script ScriptRegistrant dp88_linkHealth_Registrant("dp88_linkHealth","parentObjectId=0:int"); diff -uwr sourceold/scripts/dp88_ar.h source/scripts/dp88_ar.h --- sourceold/scripts/dp88_ar.h 2012-05-23 10:33:46.000000000 +0800 +++ source/scripts/dp88_ar.h 2012-08-14 23:00:33.552734300 +0800 @@ -232,6 +232,8 @@ * An optional animation to be played in a loop whilst mining in an ore field * \param miningSound * An optional sound effect to be played each time the ore load level increases +* \param idleAnimation +* An optional animation to be played in a loop when the miner is not mining or docked * * \note * Because this script is designed to act as a base class for both types of AR miner it is not @@ -532,11 +534,80 @@ -/*------------------------ -Prism Tower Script ---------------------------*/ +// ------------------------------------------------------------------------------------------------- -class dp88_AR_Prism_Tower : public dp88_AI_Turret +/*! +* \brief AR Prism Tower script +* \author Daniel Paul (danpaul88@yahoo.co.uk) +* +* This script implements the prism tower logic for Apocalypse Rising on top of the generic charged +* turret implementation provided by dp88_AI_ChargedTurret. +* +* \param Priority_Infantry +* Base targetting priority for infantry targets, or 0 to ignore infantry +* \param Splash_Infantry +* Determines if we should try to damage infantry with splash instead of hitting them directly. +* This is useful for slow / inaccurate weapons which do splash damage: 1 to enable, 0 to disable +* \param Priority_Light_Vehicle +* Base targetting priority for light vehicle targets, or 0 to ignore light vehicles +* \param Priority_Heavy_Vehicle +* Base targetting priority for heavy vehicle targets, or 0 to ignore heavy vehicles +* \param Priority_VTOL +* Base targetting priority for flying targets, or 0 to ignore flying targets +* \param Min_Attack_Range +* Minimum distance at which the turret can engage enemies when using primary fire +* \param Max_Attack_Range +* Maximum distance at which the turret can engage enemies when using primary fire +* \param Animation_Model +* Optional name of a W3D model file to spawn and attach to the turret upon which the charge +* animations defined in this script will be applied. This allows the turret itself to be running +* a different set of animations, such as damage states via dp88_damageAnimation +* \param Animation_Model_Bone +* If you specify an Animation_Model above then you must also specify the a bone on the parent +* to which that model should be attached. This allows the animation model to be moved by the +* animation set executing on the turret. +* \param Animation +* Name of the animation which contains the frames for the various charge states +* \param Animation_Idle_Start_Frame +* First frame number for the idle animation, which will loop continually whilst the turret is +* powered and not currently attacking a target +* \param Animation_Idle_End_Frame +* Final frame number for the idle animation +* \param Animation_Unpowered_Start_Frame +* First frame number for the unpowered animation, which will loop continually whilst the turret +* is in the unpowered state. This is not used if Requires_Power is disabled (see below). +* \param Animation_Unpowered_End_Frame +* Final frame number for the unpowered animation +* \param Animation_Charge_Start_Frame +* First frame number for the charging animation, which will be played once each time the turret +* reloads its weapon. Once this animation completes the turret will fire again, therefore the +* length of this animation must be greater than the weapon reload time. +* \param Animation_Charge_End_Frame +* Final frame number for the charging animation +* \param Charge_Sound +* Optional sound effect to be played each time the turret starts charging up +* \param Modifier_Distance +* Priority modification to apply based on distance to target. Higher values will favour targets +* which are closer to the turret, good for less accurate weapons +* \param Modifier_Target_Damage +* Priority modification to apply based on damage a target has already sustained. Higher values +* will favour targets which have already been damaged in combat, picking them off first. +* \param Modifier_Target_Value +* Priority modification to apply based on the value of the target. Higher values will favour +* targets with a higher purchase cost, good for hard hitting weapons. +* \param Requires_Power +* Specify whether this turret requires base power to operate: 1 to require power, 0 to ignore +* \param Debug +* Specify whether to produce a debug logfile about the turrets targetting decisions, this is +* useful for fine tuning your base priorities and modifiers: 1 to enable, 0 to disable. +* +* \todo +* Decide on a mechanism to ensure each firing sequence fires one bullet per assisting tower, +* regardless of chain length. Can possibly overload dp88_AI_ChargedTurret::StartDischarging() to +* introduce a 0.1 second delay for each level of assisting tower depth to ensure the charging +* shot arrives before it fires its own attacking (or chain charging) shot. +*/ +class dp88_AR_Prism_Tower : public dp88_AI_ChargedTurret { /* ----- Static variables @@ -561,7 +632,7 @@ ----- */ // Is our current target a tower we are charging? - bool isChargingTower; + bool isAssistingTower; // Towers adjacent to us in the tower map int adjacentTowerCount; @@ -587,8 +658,10 @@ // the fact that the target might be a tower we are charging virtual float getPriority( GameObject *obj, GameObject *target ); - // Override the team check mechanism to return true when charging another - // tower, even though the target is on the same team + /*! + * Overrides the team check mechanism to return true if the specified target is the tower we are + * currently charging, otherwise the base class target validation logic will cancel the 'attack' + */ virtual bool checkTeam( GameObject *obj, GameObject *target ); // Customised attack functionality @@ -597,12 +670,18 @@ virtual void stopAttacking ( GameObject* obj ); /* Functions to start and stop charging of another tower */ - void StartCharging(GameObject* obj, GameObject* tower, float priority); - void StopCharging(GameObject* obj); + void StartAssisting(GameObject* obj, GameObject* tower, float priority); + void StopAssisting(GameObject* obj); - // Function to send assistance requests to all adjacent towers, - // except the one we are currently charging + /*! + * Send assistance requests to all neighbouring prism towers, except the one we are currently + * assisting, if any + */ void SendAssistanceRequests(GameObject* obj); + + /*! + * Send end assistance notifications to all neighnouring prism towers + */ void SendEndAssistanceNotifications(GameObject* obj); }; diff -uwr sourceold/scripts/dp88_customAI.cpp source/scripts/dp88_customAI.cpp --- sourceold/scripts/dp88_customAI.cpp 2012-05-23 10:21:58.000000000 +0800 +++ source/scripts/dp88_customAI.cpp 2012-08-16 09:51:47.679687500 +0800 @@ -213,6 +213,8 @@ { if ( vobj == NULL ) return false; + if ( vobj->Get_Definition().Get_Seat_Count() == 0) + return false; return (vobj->Get_Occupant_Count() == 0); } @@ -245,7 +247,7 @@ secondary_prefRange = Get_Int_Parameter ( "Preferred_Attack_Range_Secondary" ); // Start timer which runs for the lifetime of this object - Commands->Start_Timer ( obj, this, 1.0, TIMER_CHECK_TARGET ); + Commands->Start_Timer ( obj, this, 1.0, TIMER_CUSTOMAI_THINK ); } @@ -324,7 +326,7 @@ void dp88_tankAI_Offensive::Timer_Expired( GameObject *obj, int number ) { // Check target is still alive, still an enemy (eg: stolen vehicles) and in range - if ( number == TIMER_CHECK_TARGET ) + if ( number == TIMER_CUSTOMAI_THINK ) { if ( targetID != 0 ) { @@ -400,7 +402,7 @@ } // Timer always runs - Commands->Start_Timer ( obj, this, 1.0, TIMER_CHECK_TARGET ); + Commands->Start_Timer ( obj, this, 1.0, TIMER_CUSTOMAI_THINK ); } } @@ -425,7 +427,7 @@ dp88_customAI::Init( obj ); // Start timer which runs for the lifetime of this object - Commands->Start_Timer ( obj, this, 1.0, TIMER_CHECK_TARGET ); + Commands->Start_Timer ( obj, this, 1.0, TIMER_CUSTOMAI_THINK ); } void dp88_AI_Turret::loadSettings( GameObject *obj, bool loadSecondaryFireSettings, bool loadBuildingTargetSettings ) @@ -502,7 +504,7 @@ void dp88_AI_Turret::Timer_Expired( GameObject *obj, int number ) { // Check target is still alive, still an enemy (eg: stolen vehicles) and in range - if ( number == TIMER_CHECK_TARGET ) + if ( number == TIMER_CUSTOMAI_THINK ) { if ( targetID != 0 ) { @@ -528,7 +530,7 @@ } // Timer always runs - Commands->Start_Timer ( obj, this, 1.0, TIMER_CHECK_TARGET ); + Commands->Start_Timer ( obj, this, 1.0, TIMER_CUSTOMAI_THINK ); } } @@ -680,7 +682,7 @@ void dp88_AI_PopupTurret::Timer_Expired ( GameObject* pSelf, int number ) { // Piggy-back the undeploy timer logic on the existing target check timer since its always running - if ( number == TIMER_CHECK_TARGET && m_deploymentState == STATE_DEPLOYED ) + if ( number == TIMER_CUSTOMAI_THINK && m_deploymentState == STATE_DEPLOYED ) { // If we have no target and have reached the undeploy timeout then trigger undeployment if ( targetID == 0 && time(NULL) > m_undeployTime ) @@ -859,10 +861,9 @@ void dp88_AI_ChargedTurret::Timer_Expired ( GameObject* pSelf, int number ) { - // Piggy-back the base power state checks on the existing target check timer since its always - // running anyway. If the base power state changes we need to update the idle animation (and - // abort any charge up in progress) - if ( number == TIMER_CHECK_TARGET && m_bPowerState != checkPowerState(pSelf) ) + // Use the existing custom AI think timer to check for a base power state changes and, if it has + // changed, update the idle animation (and abort any charge up in progress) + if ( number == TIMER_CUSTOMAI_THINK && m_bPowerState != checkPowerState(pSelf) ) { m_bPowerState = !m_bPowerState; @@ -885,7 +886,7 @@ // We might as well piggy back the discharged checks on the same timer too whilst we are at it... - if ( number == TIMER_CHECK_TARGET && m_bIsDischarging ) + if ( number == TIMER_CUSTOMAI_THINK && m_bIsDischarging ) { // Have we unloaded our entire clip? If so then we can start charging for the next attack if ( Get_Current_Bullets(pSelf) == 0 ) @@ -917,27 +918,7 @@ { if (!_stricmp(animation_name,Get_Parameter("Animation"))) //make sure we are running the right animation { - // Were we charging up? If so we are now fully charged and can start shooting stuff, if we still - // have a valid target... - if ( m_bIsCharging ) - { - m_bIsCharging = false; - m_bIsDischarging = true; - - // Got an enemy? Also double check power state whilst we are here, just to be sure - if ( targetID != NULL && checkPowerState(pSelf) ) - { - if ( GameObject* pTarget = Commands->Find_Object(targetID) ) - { - - // Call into the base class and let it do it's thing - if ( splashInfantry && pTarget->As_SoldierGameObj() ) - dp88_AI_Turret::attackLocation(pSelf, Commands->Get_Position(pTarget), primary_target); - else - dp88_AI_Turret::attackTarget(pSelf, pTarget, primary_target); - } - } - } + StartDischarging(pSelf); } dp88_AI_Turret::Animation_Complete(pSelf, animation_name); @@ -1004,6 +985,37 @@ } } +// ------------------------------------------------------------------------------------------------- + +void dp88_AI_ChargedTurret::StartDischarging ( GameObject* pSelf ) +{ + // Were we charging up? If so we are now fully charged and can start shooting stuff, if we still + // have a valid target... + if ( m_bIsCharging ) + { + m_bIsCharging = false; + + // Got an enemy? Also double check power state whilst we are here, just to be sure + if ( targetID != NULL && checkPowerState(pSelf) ) + { + if ( GameObject* pTarget = Commands->Find_Object(targetID) ) + { + m_bIsDischarging = true; + + // Call into the base class and let it do it's thing + if ( splashInfantry && pTarget->As_SoldierGameObj() ) + dp88_AI_Turret::attackLocation(pSelf, Commands->Get_Position(pTarget), primary_target); + else + dp88_AI_Turret::attackTarget(pSelf, pTarget, primary_target); + } + } + + // If we didn't find anything to shoot at then apply the idle animation again + if ( !m_bIsDischarging ) + ApplyIdleAnimation(pSelf); + } +} + // ------------------------------------------------------------------------------------------------- GameObject* dp88_AI_ChargedTurret::GetAnimationObject ( GameObject* pSelf ) diff -uwr sourceold/scripts/dp88_customAI.h source/scripts/dp88_customAI.h --- sourceold/scripts/dp88_customAI.h 2012-05-13 21:10:02.000000000 +0800 +++ source/scripts/dp88_customAI.h 2012-09-09 17:56:17.847499900 +0800 @@ -13,8 +13,6 @@ #include "LoopedAnimationController.h" -#define TIMER_CHECK_TARGET 100778801 - /*------------------------ Base class for custom AI's @@ -146,6 +144,7 @@ /*! * \brief Turret AI * \author Daniel Paul (danpaul88@yahoo.co.uk) +* \ingroup scripts_basedefences * * A custom designed turret AI code designed to allow maximum flexibility in implementation without * needing multiple versions of effectively the same code to target different enemies (ie: VTOL vs. @@ -256,6 +255,7 @@ /*! * \brief Popup Turret AI * \author Daniel Paul (danpaul88@yahoo.co.uk) +* \ingroup scripts_basedefences * * An overloaded version of my custom turret AI incorporating popup/deploy logic. This script requires * two LevelEdit presets to work correctly, which are as follows; @@ -393,6 +393,7 @@ /*! * \brief Charged Turret AI * \author Daniel Paul (danpaul88@yahoo.co.uk) +* \ingroup scripts_basedefences * * An overloaded version of my custom turret AI incorporating charge up logic, which causes an * animation sequence to be played prior to each clip fired by the turret. For maximum flexibility @@ -532,6 +533,9 @@ /*! This function is called to initiate the charge up process, if it is not already in progress */ virtual void StartCharging ( GameObject* pSelf ); + /*! This function is called when the turret is fully charged and is ready to fire at something */ + virtual void StartDischarging ( GameObject* pSelf ); + /*! Internal utility function to get a pointer to the object upon which the charge animation will * be applied - this will either be the turret itself or the seperate charge animation object if diff -uwr sourceold/scripts/dp88_custom_timer_defines.h source/scripts/dp88_custom_timer_defines.h --- sourceold/scripts/dp88_custom_timer_defines.h 2012-05-07 07:09:14.000000000 +0800 +++ source/scripts/dp88_custom_timer_defines.h 2012-07-28 09:11:07.176757800 +0800 @@ -134,7 +134,7 @@ #define TIMER_BUILDINGSCRIPTS_TRICKLEMONEY 2244030501 // Runs on a trickle money effect to grant money once per second // Timers for prism towers and tesla coils -#define TIMER_PRISMTOWER_THINK 2244040001 +#define TIMER_CUSTOMAI_THINK 2244040001 // Timer that fires every 1 second in my custom AI scripts to update target state etc #define TIMER_TESLACOIL_DECREMENT_CHARGE 2244040002 // Timers for dp88_chronoTank diff -uwr sourceold/scripts/dp88_misc.h source/scripts/dp88_misc.h --- sourceold/scripts/dp88_misc.h 2012-05-23 10:33:46.000000000 +0800 +++ source/scripts/dp88_misc.h 2012-09-11 08:40:47.073242100 +0800 @@ -22,6 +22,89 @@ Random weather script --------------------------*/ +/*! +* \brief Weather Randomizer +* \author Daniel Paul (danpaul88@yahoo.co.uk) +* \ingroup scripts_weather +* +* This script can be used to create randomised weather conditions on a map which change periodically +* during the game. The range of weather conditions that are applied can be controlled via the script +* parameters to ensure inappropriate types of weather are not used (such as snow in the desert). +* +* You should only have one instance of this script active at any given time, generally it should be +* attached to a map controller object such as a Daves Arrow preset. +* +* \param update_interval_min +* The minimum time, in seconds, between weather update checks. Note that unless probability_change +* is set to 100 an update check does not necessarily cause new weather conditions to occur +* \param update_interval_max +* The maximum time, in seconds, between weather update checks. Note that unless probability_change +* is set to 100 an update check does not necessarily cause new weather conditions to occur +* \param probability_change +* The percentage probability that new weather conditions will be generated when an update check +* occurs +* \param fog_start_distance_min +* The minimum starting fog distance that can be applied +* \param fog_start_distance_max +* The maximum starting fog distance that can be applied +* \param fog_end_distance_min +* The minimum end of fog distance that can be applied +* \param fog_end_distance_max +* The maximum end of fog distance that can be applied +* \param precipitation_probability_snow +* The percentage probability of snow occuring +* \param precipitation_probability_rain +* The percentage probability of rain occuring +* \param precipitation_probability_volcanic_ash +* The percentage probability of volcanic ash occuring +* \param precipitation_density_min +* The minimum precipitation density that can be applied +* \param precipitation_density_max +* The maximum precipitation density that can be applied +* \param lighting_probability_normal +* The percentage probability of normal lightning occuring +* \param lighting_probability_war_blitz +* The percentage probability of a war blitz occuring +* \param lighting_intensity_min +* The minimum intensity of lightning that can be applied +* \param lighting_intensity_max +* The maximum intensity of lightning that can be applied +* \param lighting_start_distance_min +* The minimum starting distance for lightning that can be applied +* \param lighting_start_distance_max +* The maximum starting distance for lightning that can be applied +* \param lighting_end_distance_min +* The minimum end distance for lightning that can be applied +* \param lighting_end_distance_max +* The maximum end distance for lightning that can be applied +* \param lighting_heading_min +* The minimum lightning heading that can be applied +* \param lighting_heading_max +* The maximum lightning heading that can be applied +* \param lighting_distribution_min +* The minimum lightning distribution that can be applied +* \param lighting_distribution_max +* The maximum lightning distribution that can be applied +* \param wind_heading_min +* The minimum wind heading that can be applied +* \param wind_heading_max +* The maximum wind heading that can be applied +* \param wind_speed_min +* The minimum wind speed that can be applied +* \param wind_speed_max +* The maximum wind speed that can be applied +* \param wind_variability_min +* The minimum wind speed variability that can be applied +* \param wind_variability_max +* The maximum wind speed variability that can be applied +* +* \note +* The probability of clear conditions (no rain, snow or volcanic ash) is the 100% minus the +* combined probabilities of rain, snow and volcanic ash that are configured in the script. For +* example, if precipitation_probability_snow is 5, precipitation_probability_rain is 15 and +* precipitation_probability_volcanic_ash is 1 the probability of clear conditions will be 100 - +* 5 - 15 - 1 = 79% +*/ class dp88_randomWeather : public ScriptImpClass { void Created ( GameObject* obj ); diff -uwr sourceold/scripts/engine_obj.cpp source/scripts/engine_obj.cpp --- sourceold/scripts/engine_obj.cpp 2012-05-23 11:24:06.000000000 +0800 +++ source/scripts/engine_obj.cpp 2012-09-09 17:56:17.894374900 +0800 @@ -59,6 +59,7 @@ #include "TransitionGameObj.h" #include "WarFactoryGameObjDef.h" #include "WarFactoryGameObj.h" +#include "Iterator.h" SCRIPTS_API const AirFactoryGameObjDef & AirFactoryGameObj::Get_Definition (void) const @@ -556,6 +557,23 @@ return ObjList; } +GameObject SCRIPTS_API *Find_Closest_Building(const Vector3& position) +{ + GameObject* bestBuilding = 0; + float bestDistance = FLT_MAX; + TT_FOREACH(building, GameObjManager::BuildingGameObjList) + { + Vector3 offset = Commands->Get_Position(building) - position; + float distance = offset.Length2(); + if (distance < bestDistance) + { + bestBuilding = building; + bestDistance = distance; + } + } + return bestBuilding; +} + GameObject SCRIPTS_API *Find_Nearest_Preset(Vector3 position, const char *preset) { GameObject *object = 0; diff -uwr sourceold/scripts/engine_obj.h source/scripts/engine_obj.h --- sourceold/scripts/engine_obj.h 2012-04-24 13:38:30.000000000 +0800 +++ source/scripts/engine_obj.h 2012-07-28 09:11:06.362304600 +0800 @@ -73,7 +73,7 @@ void SCRIPTS_API Set_Powerup_Always_Allow_Grant(GameObject *obj,bool Grant); //Change if this powerup is set to always allows grant int SCRIPTS_API Get_Powerup_Grant_Sound(GameObject *obj); //Returns the sound that is played when this powerup is picked up void SCRIPTS_API Grant_Powerup(GameObject *obj,const char *Preset_Name); //grants a powerup - +GameObject SCRIPTS_API *Find_Closest_Building(const Vector3& position); // Find the closest building Vector3 SCRIPTS_API Get_Velocity( GameObject* obj ); // Get the current velocity of a PhysicalGameObject void SCRIPTS_API Set_Velocity( GameObject* obj, Vector3 velocity ); // Set the velocity of a PhysicalGameObject Matrix3D SCRIPTS_API Get_Transform( GameObject* obj ); // Get the current transform of a PhysicalGameObject diff -uwr sourceold/scripts/engine_obj2.cpp source/scripts/engine_obj2.cpp --- sourceold/scripts/engine_obj2.cpp 2012-05-23 11:29:56.000000000 +0800 +++ source/scripts/engine_obj2.cpp 2012-08-12 22:45:46.250484400 +0800 @@ -98,8 +98,32 @@ { Vector3 v; obj->Get_Position(&v); + + if (Model) + { + static const float test_distance = 10000.f; + static const Vector3 test_direction(0, 0, 1); + + LineSegClass line(v, test_direction, test_distance); + CastResultStruct result; + result.ComputeContactPoint = true; + RayCollisionTestClass test(line, &result, COLLISION_TYPE_PHYSICAL); + + int count = 0; + while (Model->Cast_Ray(test)) + { + ++count; + result.ContactPoint.Y += .000001f; + line.Set(result.ContactPoint, test_direction, test_distance); + } + + return count & 1; + } + else + { return CollisionMath::Overlap_Test(BoundingBox,v) == CollisionMath::INSIDE; } + } else { return false; diff -uwr sourceold/scripts/engine_tdb.h source/scripts/engine_tdb.h --- sourceold/scripts/engine_tdb.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/engine_tdb.h 2012-09-11 08:40:47.069335900 +0800 @@ -13,18 +13,128 @@ #define SCRIPTS_INCLUDE__ENGINE_TDB_H #include "scripts.h" -SCRIPTS_API const char *Get_Translated_String(unsigned long ID); //Get a string from the translation database given its ID -SCRIPTS_API const char *Get_Translated_Preset_Name(GameObject *obj); //Get the translated name for the preset of this object, if it has one -SCRIPTS_API const char *Get_Translated_Weapon(GameObject *obj,int position); //Get the translated name of a weapon -SCRIPTS_API const char *Get_Current_Translated_Weapon(GameObject *obj); //Get the translated name of the current weapon -SCRIPTS_API const char *Get_Team_Name(int Team); //Get a teams name -SCRIPTS_API const char *Get_Vehicle_Name(GameObject *obj); //Get the name of a vehicle (as used for the HUD display) -SCRIPTS_API const char *Get_Translated_Definition_Name(const char *preset); //Get the translated name string for a preset name -SCRIPTS_API const wchar_t *Get_Wide_Translated_String(unsigned long ID); //Get a wide string from the translation database given its ID +/*! +* \ingroup api_translations +* +* Get a string from the translation database given its ID +* +* \param[in] ID Translation database ID to get the string for +*/ +SCRIPTS_API const char *Get_Translated_String(unsigned long ID); + +/*! +* \ingroup api_translations +* +* Get a wide string from the translation database given its ID +* +* \param[in] ID Translation database ID to get the string for +*/ +SCRIPTS_API const wchar_t *Get_Wide_Translated_String(unsigned long ID); + +/*! +* \ingroup api_translations +* +* Get the translated name of the preset for the specified object, if it has one +* +* \param[in] obj GameObject to get the translated name of +*/ +SCRIPTS_API const char *Get_Translated_Preset_Name(GameObject *obj); + +/*! +* \ingroup api_translations +* +* Get the translated name of the preset for a specified weapon in a GameObject weapons bag +* +* \param[in] obj GameObject which has the weapon in question +* \param[in] position Position in the weapon bag of the weapon to get the translated name of +*/ +SCRIPTS_API const char *Get_Translated_Weapon(GameObject *obj,int position); + +/*! +* \ingroup api_translations +* +* Get the translated name of the preset for the currently equipped weapon of a GameObject +* +* \param[in] obj GameObject for which to get the translated name of their current weapon +*/ +SCRIPTS_API const char *Get_Current_Translated_Weapon(GameObject *obj); + +/*! +* \ingroup api_translations +* +* Get the wide translated name of the preset for the currently equipped weapon of a GameObject +* +* \param[in] obj GameObject for which to get the translated name of their current weapon +*/ +SCRIPTS_API const wchar_t *Get_Current_Wide_Translated_Weapon(GameObject *obj); + +/*! +* \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 char *Get_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 +*/ +SCRIPTS_API const char *Get_Vehicle_Name(GameObject *obj); + +/*! +* \ingroup api_translations +* +* Get the wide translated name of a specified vehicle, as shown in the HUD display +* +* \param[in] obj VehicleGameObject to get the translated name of +*/ SCRIPTS_API const wchar_t *Get_Wide_Vehicle_Name(GameObject *obj); //Get the name of a vehicle (as used for the HUD display) as a wide character string -SCRIPTS_API const wchar_t *Get_Current_Wide_Translated_Weapon(GameObject *obj); //Get the translated name of the current weapon as a wide character string -SCRIPTS_API bool Is_Valid_String_ID(unsigned long ID); //Like Is_Valid_Preset_ID but for strings, returns true if the string ID exists +/*! +* \ingroup api_translations +* +* Get the translated name string for a specified preset +* +* \param[in] preset Name of the preset to get the translated name of +*/ +SCRIPTS_API const char *Get_Translated_Definition_Name(const char *preset); + +/*! +* \ingroup api_translations +* +* Check if the specified ID is a valid translation database ID +* +* \param[in] ID An ID to check for validity +* \return Returns true if the ID exists in the translations database, false otherwise +*/ +SCRIPTS_API bool Is_Valid_String_ID(unsigned long ID); + +/*! +* \ingroup api_translations +* +* Gets the ID of a string in the translation database given it's description +* +* \param[in] desc The description string for the translation to get the ID of +* \return +* The translation database ID for the translation matching the specified description, or 0 +* if no such translation was found +*/ SCRIPTS_API unsigned long Get_String_ID_By_Desc(const char *desc); //Get the ID of a string given it's ID_Desc -SCRIPTS_API unsigned long Get_String_Sound_ID(unsigned long ID); //Get the ID of the sound preset for this string + +/*! +* \ingroup api_translations +* +* Gets the ID of the sound preset associated with the specified translation +* +* \param[in] ID The ID of the translation to get the sound preset of +* \return +* The preset ID of the sound preset associated with the translation, or 0 if no translation was +* found with the specified translation ID or the translation has no associated sound +*/ +SCRIPTS_API unsigned long Get_String_Sound_ID(unsigned long ID); #endif diff -uwr sourceold/scripts/engine_tt.cpp source/scripts/engine_tt.cpp --- sourceold/scripts/engine_tt.cpp 2012-05-28 21:47:08.000000000 +0800 +++ source/scripts/engine_tt.cpp 2012-08-24 20:46:44.473632800 +0800 @@ -156,6 +156,8 @@ SCRIPTS_API gml Get_Mine_Limit; SCRIPTS_API sbd Set_Special_Base_Destruction; SCRIPTS_API gpv Get_Client_Version; +SCRIPTS_API gpr Get_Client_Revision; +SCRIPTS_API gpr Get_Revision; SCRIPTS_API gdw Get_Damage_Warhead; SCRIPTS_API ggobpn Get_GameObj_By_Player_Name; SCRIPTS_API scap Send_Custom_All_Players; @@ -168,6 +170,10 @@ SCRIPTS_API gcsh Get_Client_Serial_Hash; SCRIPTS_API gml Get_Tech_Level; SCRIPTS_API sw Set_Tech_Level; +SCRIPTS_API cee Create_Explosion_Extended; +SCRIPTS_API rwpa Retrieve_Waypaths; +SCRIPTS_API rwpo Retrieve_Waypoints; +SCRIPTS_API gwp Get_Waypoint_Position; SCRIPTS_API bool Can_Team_Build_Vehicle(int Team) { @@ -934,11 +940,11 @@ } } -SCRIPTS_API void cNetEvent::Set_Object_Dirty_Bit_For_Version(float version,DIRTY_BIT dirty_bit, bool onoff) +SCRIPTS_API void cNetEvent::Set_Object_Dirty_Bit_For_Revision(uint revision,DIRTY_BIT dirty_bit, bool onoff) { for (int clientId = 1; clientId < 128; ++clientId) { - if (Get_Client_Version(clientId) >= version) + if (Get_Client_Revision(clientId) >= revision) { Set_Object_Dirty_Bit(clientId,dirty_bit,onoff); } diff -uwr sourceold/scripts/engine_tt.h source/scripts/engine_tt.h --- sourceold/scripts/engine_tt.h 2012-05-28 21:47:08.000000000 +0800 +++ source/scripts/engine_tt.h 2012-08-24 20:46:44.416015600 +0800 @@ -119,6 +119,7 @@ typedef int (*gml) (); typedef void (*sbd) (); typedef float (*gpv) (int playerId); +typedef uint (*gpr) (int playerId); typedef unsigned int (*gdw) (); typedef void (*naee) (GameObject * obj, const ActionParamsStruct & params); typedef GameObject *(*ggobpn) (const char *name); @@ -137,6 +138,10 @@ typedef cScTextObj *(*sct) (const WideStringClass& message, TextMessageEnum type, bool popup, int senderId, int receiverId, bool dodirtybit, bool doact); typedef SCAnnouncement *(*sca) (int _receiptientId, int _senderId, int _translationId, AnnouncementEnum _type, int _emoticonId, bool dodirtybit, bool doact); typedef bool (*iwu) (wchar_t *WideName); +typedef void (*cee) (const char *Explosion, Vector3 &Pos, GameObject *Creator); +typedef void (*rwpa) (DynamicVectorClass &WaypathIDs); +typedef void (*rwpo) (int WaypathID, DynamicVectorClass &WaypointIDs); +typedef void (*gwp) (int WaypathID, int WaypointID, Vector3 &Pos); SCRIPTS_API extern gpl Get_Player_List; SCRIPTS_API extern gcmi Get_Current_Map_Index; SCRIPTS_API extern gm Get_Map; @@ -265,12 +270,18 @@ SCRIPTS_API extern gml Get_Mine_Limit; SCRIPTS_API extern sbd Set_Special_Base_Destruction; SCRIPTS_API extern gpv Get_Client_Version; +SCRIPTS_API extern gpr Get_Client_Revision; +SCRIPTS_API extern gpr Get_Revision; SCRIPTS_API extern gdw Get_Damage_Warhead; SCRIPTS_API extern addConnectionAcceptanceFilterType addConnectionAcceptanceFilter; SCRIPTS_API extern removeConnectionAcceptanceFilterType removeConnectionAcceptanceFilter; SCRIPTS_API extern iwu Is_WOL_User; SCRIPTS_API extern gml Get_Tech_Level; SCRIPTS_API extern sw Set_Tech_Level; +SCRIPTS_API extern cee Create_Explosion_Extended; +SCRIPTS_API extern rwpa Retrieve_Waypaths; +SCRIPTS_API extern rwpo Retrieve_Waypoints; +SCRIPTS_API extern gwp Get_Waypoint_Position; class SCRIPTS_API JFW_Key_Hook_Base : public ScriptImpClass { public: diff -uwr sourceold/scripts/gmgame.cpp source/scripts/gmgame.cpp --- sourceold/scripts/gmgame.cpp 2012-05-16 00:26:44.000000000 +0800 +++ source/scripts/gmgame.cpp 2012-09-09 17:56:17.863124900 +0800 @@ -1138,6 +1138,9 @@ const char *str5 = Get_Translated_Preset_Name_Ini(obj); const char *str6 = Get_Translated_Preset_Name_Ini(Get_C4_Attached(obj)); str.Format("%s %s has detonated (Owner: %ls - Attached to: %s)",str4,str5,Get_Wide_Player_Name(Get_C4_Planter(obj)),str6); + delete[] str4; + delete[] str5; + delete[] str6; SSGMGameLog::Log_Message(str,"_C4"); SSGMGameLog::Log_Gamelog("DETONATED;OBJECT;%d;%s;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y), int(pos.X), int(pos.Z)); } @@ -1201,6 +1204,7 @@ void SSGM_Log_Beacon::Created(GameObject *obj) { + killed = false; triggerrepairing = true; Vector3 pos = Commands->Get_Position(obj); SSGMGameLog::Log_Gamelog("CREATED;OBJECT;%d;%s;%d;%d;%d;%d;%d;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y),int(pos.X),int(pos.Z), int(Commands->Get_Facing(obj)), int(Commands->Get_Max_Health(obj)),int(Commands->Get_Max_Shield_Strength(obj)), Commands->Get_Player_Type(obj),Commands->Get_ID(Get_Beacon_Planter(obj))); @@ -1208,6 +1212,13 @@ void SSGM_Log_Beacon::Destroyed(GameObject *obj) { + if (!killed) + { + StringClass str3; + const char *str4 = Get_Translated_Preset_Name_Ini(obj); + str3.Format("%s has detonated",str4); + SSGMGameLog::Log_Message(str3,"_BEACON"); + } Vector3 pos = Commands->Get_Position(obj); SSGMGameLog::Log_Gamelog("DESTROYED;OBJECT;%d;%s;%d;%d;%d", Commands->Get_ID(obj),Commands->Get_Preset_Name(obj), int(pos.Y), int(pos.X), int(pos.Z)); } @@ -1227,13 +1238,6 @@ void SSGM_Log_Beacon::Damaged(GameObject *obj, GameObject *damager, float amount) { - if (amount == 0 && damager == Get_Beacon_Planter(obj)) - { - StringClass str3; - const char *str4 = Get_Translated_Preset_Name_Ini(obj); - str3.Format("%s has detonated",str4); - SSGMGameLog::Log_Message(str3,"_BEACON"); - } if (amount != 0) { Vector3 victimpos = Commands->Get_Position(obj); @@ -1261,6 +1265,7 @@ void SSGM_Log_Beacon::Killed(GameObject *obj, GameObject *killer) { + killed = true; Vector3 victimpos = Commands->Get_Position(obj); Vector3 damagerpos = Commands->Get_Position(killer); const char *str = Get_Translated_Preset_Name_Ex(obj); diff -uwr sourceold/scripts/gmgame.h source/scripts/gmgame.h --- sourceold/scripts/gmgame.h 2012-05-16 00:26:42.000000000 +0800 +++ source/scripts/gmgame.h 2012-07-28 09:11:06.667968700 +0800 @@ -60,6 +60,7 @@ void Timer_Expired(GameObject *obj, int number); public: void Register_Auto_Save_Variables(); bool triggerrepairing; + bool killed; }; class SSGM_Log_Mine : public ScriptImpClass { diff -uwr sourceold/scripts/gmlog.cpp source/scripts/gmlog.cpp --- sourceold/scripts/gmlog.cpp 2012-04-14 04:09:50.000000000 +0800 +++ source/scripts/gmlog.cpp 2012-08-13 00:16:37.022945400 +0800 @@ -66,44 +66,35 @@ Connection *c = new Connection; c->cbufferFilled = 0; c->socket = so; + c->cbuffer[_countof(c->cbuffer)-1] = '\0'; Connections.Add(c); } - for (int i = 0;i < Connections.Count();i++) + for (int i = 0; i < Connections.Count(); ++i) { - char* bufferPtr = Connections[i]->cbuffer + Connections[i]->cbufferFilled; - int chars_read = recv(Connections[i]->socket, bufferPtr, sizeof(Connections[i]->cbuffer)-Connections[i]->cbufferFilled,0); - if( !(chars_read > 0) && WSAGetLastError() != WSAEWOULDBLOCK ) + int chars_read = recv(Connections[i]->socket, Connections[i]->cbuffer + Connections[i]->cbufferFilled, _countof(Connections[i]->cbuffer)-1 - Connections[i]->cbufferFilled, 0); + if (chars_read == 0 || (chars_read == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK)) // Graceful close or error. Note that if the buffer is full, 0 bytes are read, and this is interpreted as a graceful close too! { - // Bot has closed the socket or something has gone wrong, you should deal with that here closesocket(Connections[i]->socket); Connections.Delete(Connections[i]); - continue; } - if (!(chars_read > 0)) + else if (chars_read > 0) // Data received { - continue; + char* lineStartPos = Connections[i]->cbuffer; + char* endPos = Connections[i]->cbuffer + Connections[i]->cbufferFilled + chars_read; + for (;;) + { + TT_ASSERT(endPos >= lineStartPos); + char* lineEndPos = (char*)memchr(lineStartPos, '\n', endPos - lineStartPos); + if (!lineEndPos) break; + *lineEndPos = '\0'; + if (lineEndPos - lineStartPos > 0 && *(lineEndPos-1) == '\r') *(lineEndPos-1) = '\0'; // Remove trailing \r if CRLF line endings are used. + Console_Input(lineStartPos); + lineStartPos = lineEndPos+1; + } + TT_ASSERT(endPos - lineStartPos >= 0); + Connections[i]->cbufferFilled = endPos - lineStartPos; + memmove(Connections[i]->cbuffer, lineStartPos, endPos - lineStartPos); } - Connections[i]->cbufferFilled += chars_read; - // Look for complete messages in buffer - char *startPos = Connections[i]->cbuffer; - char *endPos = Connections[i]->cbuffer; - endPos = strchr ( startPos, '\n' ); - while ( (endPos) && (Connections[i]->cbufferFilled > 0) ) - { - // Copy input to message - int messageLength = (endPos-startPos); - char* message = new char[messageLength+1]; - strncpy ( message, startPos, messageLength ); - message[messageLength] = '\0'; - // Call a function to do something with message - Console_Input(message); - // Clean up message - delete [] message; - Connections[i]->cbufferFilled -= (++endPos - startPos); - startPos = endPos; - endPos = strchr ( startPos, '\n' ); - } - memmove(Connections[i]->cbuffer,startPos,Connections[i]->cbufferFilled); } } diff -uwr sourceold/scripts/gmsoldier.cpp source/scripts/gmsoldier.cpp --- sourceold/scripts/gmsoldier.cpp 2012-05-23 10:18:56.000000000 +0800 +++ source/scripts/gmsoldier.cpp 2012-08-05 11:28:50.059554700 +0800 @@ -129,7 +129,7 @@ void SSGM_Soldier::Detach(GameObject *obj) { - Unbind_Vehicle(obj, true); + //Unbind_Vehicle(obj, true); } void SSGM_Soldier::Destroyed(GameObject *obj) @@ -280,7 +280,7 @@ StringClass str; const char *str2 = Get_Translated_Preset_Name_Ex(obj); const char *str3 = Get_Player_Name(obj); - str.Format("%s killed their own dumb self (%s)",str3,str2); + str.Format("%s killed their self (%s)",str3,str2); delete[] str2; delete[] str3; SSGMGameLog::Log_Message(str,"_PLAYERKILL"); @@ -330,7 +330,7 @@ else if (Commands->Get_ID(obj) == Commands->Get_ID(killer)) { StringClass str; - str.Format("%ls killed their own dumb self",Get_Wide_Player_Name(obj)); + str.Format("%ls killed their self",Get_Wide_Player_Name(obj)); Send_Message_With_Team_Color(Get_Object_Type(obj),str); } else if (!Commands->Is_A_Star(killer)) Only in source/scripts: groups.dox diff -uwr sourceold/scripts/jfwcust.h source/scripts/jfwcust.h --- sourceold/scripts/jfwcust.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/jfwcust.h 2012-09-11 08:40:47.090820300 +0800 @@ -304,31 +304,61 @@ void Custom(GameObject *obj,int type,int param,GameObject *sender); }; +/*! +* \brief Set wind conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_Wind_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Set war blitz lightning conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_War_Blitz_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Set fog conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_Fog_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Set lightning conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_Lightning_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Set precipitation conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_Precipitation_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Set cloud conditions on custom +* \author jonwil +* \ingroup scripts_weather +*/ class JFW_Clouds_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); void Timer_Expired(GameObject *obj,int number); diff -uwr sourceold/scripts/jfwdef.h source/scripts/jfwdef.h --- sourceold/scripts/jfwdef.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/jfwdef.h 2012-09-09 17:56:17.863124900 +0800 @@ -24,6 +24,22 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A simple base defence script that will attack any enemy object that enters its firing range +* +* \param MinAttackDistance +* Minimum distance at which this defence will target enemies +* \param MaxAttackDistance +* Maximum distance at which this defence will target enemies. Note that the sight range of the +* preset still determines the distance at which it will see enemies. +* \param AttackTimer +* Time, in seconds, before the attack action expires. If an enemy is still in range a new attack +* action will be triggered when the Enemy_Seen function fires. +*/ class JFW_Base_Defence : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -36,6 +52,19 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will not attack objects of up to 8 different preset types. +* Note that despite the name the list of presets to avoid attacking is not limited to aircraft only. +* +* \note +* If you simply want a base defence script that does not target VTOL objects without having to +* manually specify each preset you could use JFW_Base_Defence_No_VTOL instead. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_No_Aircraft : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -48,6 +77,19 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will only attack objects of up to 8 different preset types. +* Note that despite the name the list of presets to attack is not limited to aircraft only. +* +* \note +* If you simply want a base defence script that only targets VTOL objects without having to +* manually specify each preset you could use JFW_Base_Defence_VTOL_Only instead. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Aircraft_Only : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -60,6 +102,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will use secondary fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Secondary : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -73,6 +124,18 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_No_Aircraft that will use secondary fire when attacking enemies +* +* \note +* If you simply want a base defence script that does not target VTOL objects without having to +* manually specify each preset you could use JFW_Base_Defence_No_VTOL_Secondary instead. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_No_Aircraft_Secondary : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -86,6 +149,18 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Aircraft_Only that will use secondary fire when attacking enemies +* +* \note +* If you simply want a base defence script that does only targets VTOL objects without having to +* manually specify each preset you could use JFW_Base_Defence_VTOL_Only_Secondary instead. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Aircraft_Only_Secondary : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -99,6 +174,16 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Popup Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A popup base defence script that plays a popup animation prior to firing upon an enemy and replays +* the same animation in reverse once it no longer has any targets to attack +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated : public ScriptImpClass { bool popup; bool attack; @@ -109,6 +194,16 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will not attack objects of up to 8 different preset +* types. Note that despite the name the list of presets to avoid attacking is not limited to +* aircraft only. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_No_Aircraft : public ScriptImpClass { bool popup; bool attack; @@ -119,6 +214,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will only attack objects of up to 8 different preset +* types. Note that despite the name the list of presets to attack is not limited to aircraft only. +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_Aircraft_Only : public ScriptImpClass { bool popup; bool attack; @@ -129,6 +233,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Popup Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will use secondary fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_Secondary : public ScriptImpClass { bool popup; bool attack; @@ -140,6 +253,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated_No_Aircraft that will use secondary fire when attacking +* enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_No_Aircraft_Secondary : public ScriptImpClass { bool popup; bool attack; @@ -151,6 +273,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated_Aircraft_Only that will use secondary fire when attacking +* enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_Aircraft_Only_Secondary : public ScriptImpClass { bool popup; bool attack; @@ -162,6 +293,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Ground Only Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will not attack VTOL objects +* +* \todo Document script parameters +*/ class JFW_Base_Defence_No_VTOL : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -174,10 +314,27 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will not attack VTOL or stealth objects +* +* \todo Document script parameters +*/ class JFW_Base_Defence_No_VTOL_No_Stealth : public JFW_Base_Defence_No_VTOL { void Enemy_Seen(GameObject *obj,GameObject *enemy); }; +/*! +* \brief Anti VTOL Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence that will only attack VTOL objects +* +* \todo Document script parameters +*/ class JFW_Base_Defence_VTOL_Only : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -190,6 +347,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Ground Only Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_No_VTOL that will use secondary fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_No_VTOL_Secondary : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -203,6 +369,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Anti VTOL Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_VTOL_Only that will use secondary fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_VTOL_Only_Secondary : public ScriptImpClass { unsigned int id1; unsigned int id2; @@ -216,6 +391,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Ground Only Popup Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will not attack VTOL objects +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_No_VTOL : public ScriptImpClass { bool popup; bool attack; @@ -226,6 +410,15 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Anti VTOL Popup Base Defence +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will only attack VTOL objects +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_VTOL_Only : public ScriptImpClass { bool popup; bool attack; @@ -236,6 +429,16 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Ground Only Popup Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will not attack VTOL objects and will use secondary +* fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_No_VTOL_Secondary : public ScriptImpClass { bool popup; bool attack; @@ -247,6 +450,16 @@ public: void Register_Auto_Save_Variables(); }; +/*! +* \brief Anti VTOL Popup Base Defence (Secondary Fire) +* \author jonwil +* \ingroup scripts_basedefences +* +* A variant of JFW_Base_Defence_Animated that will only attack VTOL objects and will use secondary +* fire when attacking enemies +* +* \todo Document script parameters +*/ class JFW_Base_Defence_Animated_VTOL_Only_Secondary : public ScriptImpClass { bool popup; bool attack; diff -uwr sourceold/scripts/jfwdmg.h source/scripts/jfwdmg.h --- sourceold/scripts/jfwdmg.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/jfwdmg.h 2012-07-28 09:11:05.329101500 +0800 @@ -10,28 +10,129 @@ Only the source code to the module(s) containing the licenced code has to be released. */ #pragma once + +// ------------------------------------------------------------------------------------------------- + +/*! +*\ brief Spawns a new object when an object is killed +* \author jonwil +* +* When the object this script is attached to is killed it will spawn a new object at the location it +* was killed. This is useful for spawning a destroyed version of an object. +* +* \param Drop_Object +* Name of the preset to be created when the object is killed +* \param Drop_Height +* Height above the location where the object was killed to spawn the new object, or 0 to spawn it +* at the same height as the object was killed. Can also be negative. Helps to prevent issues with +* terrain clipping when the destroyed object has a different origin point +* +* \note +* The object the script is attached to must be killed through damage applied to it for this script +* to work. If the object is simply destroyed (such as by JFW_Destroy_Self_Timer) no object will be +* spawned. +*/ class JFW_Spawn_Object_Death : public ScriptImpClass { void Killed(GameObject *obj,GameObject *killer); }; +// ------------------------------------------------------------------------------------------------- + +/*! +* \brief Destroys a building by applying damage after a fixed period of time +* \author jonwil +* +* This script will apply 10,000 damage using the Explosive warhead to the object it is +* attached to after a specified number of seconds has elapsed, which is sufficient to destroy +* any standard building in Renegade. +* +* \note +* Although the script is intended for use with buildings it will actually work on any damagable +* game object +* +* \pre +* Requires a warhead called Explosive to be defined in armor.ini. This is already present +* in stock versions of Renegade but may not exist in total conversion modifications. +* +* \param Time +* Number of seconds to wait before triggering +* \param TimerNum +* Internal ID to use for the timer to avoid clashing with any other timers on the same object +*/ class JFW_Timer_Destroy_Building : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); }; +// ------------------------------------------------------------------------------------------------- + +/*! +* \brief Destroys an object by applying damage after a fixed period of time +* \author jonwil +* +* This script will apply a specified amount of damage with a specified warhead to the object it is +* attached to after a specified number of seconds has elapsed. +* +* \note +* Although the script name implies it is purely for destroying objects it can also be used to +* apply a fixed amount of damage with a particular warhead to an object if the specified amount of +* damage is insufficient to kill the object. +* +* \param Time +* Number of seconds to wait before triggering +* \param Amount +* Amount of damage to apply to the object the script is attached to +* \param Warhead +* Warhead to use when applying damage, typically Death is a good choice here +*/ class JFW_Timer_Destroy_Object : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); }; +// ------------------------------------------------------------------------------------------------- + +/*! +* \brief Creates an explosion when an object is killed +* \author jonwil +* +* When the object this script is attached to is killed it will create an explosion at the location +* it was killed. +* +* \param Explosion +* Preset name of the explosion to be created +* +* \note +* The object the script is attached to must be killed through damage applied to it for this script +* to work. If the object is simply destroyed (such as by JFW_Destroy_Self_Timer) no explosion will +* be created. +*/ class JFW_Blow_Up_On_Death : public ScriptImpClass { void Killed(GameObject *obj,GameObject *killer); }; +// ------------------------------------------------------------------------------------------------- + +/*! +* \brief Grants extra points when an object is killed +* \author jonwil +* +* When the object this script is attached to is killed by the specified team it will grant points to +* the killer and, optionally, every other player on the killers team. +* +* \param Player_Type +* Team the killer must be on to recieve points (0 = Nod, 1 = GDI, 2 = Either) +* \param Points +* Number of points to give when this object is killed +* \param Whole_Team +* 0 to grant points to the killer only, 1 to give points to their whole team +*/ class JFW_Give_Points_On_Death : public ScriptImpClass { void Killed(GameObject *obj,GameObject *killer); }; +// ------------------------------------------------------------------------------------------------- + class JFW_Armour_Regen : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); @@ -218,6 +319,24 @@ void Timer_Expired(GameObject *obj,int number); }; +/*! +* \brief Destroys an object after a fixed period of time +* \author jonwil +* +* This script will destroy the object it is attached to after a specified number of seconds has +* elapsed. +* +* \warning +* Because the object is destroyed (by using ScriptCommands::Destroy_Object()) rather than killed +* by damage the GameObjObserverClass::Killed() callback will not be trigger for any other scripts +* attached to the object, which may cause unexpected behaviour. If you need to ensure the callback +* is executed consider using JFW_Timer_Destroy_Object instead. +* +* \param Time +* Number of seconds to wait before triggering +* \param TimerNum +* Internal ID to use for the timer to avoid clashing with any other timers on the same object +*/ class JFW_Destroy_Self_Timer : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); diff -uwr sourceold/scripts/jfwsnd.cpp source/scripts/jfwsnd.cpp --- sourceold/scripts/jfwsnd.cpp 2012-05-28 09:47:06.000000000 +0800 +++ source/scripts/jfwsnd.cpp 2012-07-28 09:11:06.284179600 +0800 @@ -218,7 +218,7 @@ void JFW_2D_Sound_Damage_Range::Damaged(GameObject *obj,GameObject *damager,float amount) { - if ((Commands->Get_Health(obj) <= Get_Float_Parameter("MaxHealth")) && (Commands->Get_Health(obj) >= Get_Float_Parameter("MinHealth"))) + if (Commands->Get_Health(obj) <= Get_Float_Parameter("MinHealth")) { if (enabled) { @@ -226,7 +226,7 @@ Commands->Create_2D_Sound(Get_Parameter("Sound")); } } - else + else if (Commands->Get_Health(obj) >= Get_Float_Parameter("MaxHealth")) { enabled = true; } @@ -244,7 +244,7 @@ void JFW_2D_Sound_Damage_Range_Team::Damaged(GameObject *obj,GameObject *damager,float amount) { - if ((Commands->Get_Health(obj) <= Get_Float_Parameter("MaxHealth")) && (Commands->Get_Health(obj) >= Get_Float_Parameter("MinHealth"))) + if (Commands->Get_Health(obj) <= Get_Float_Parameter("MinHealth")) { if (enabled) { @@ -252,7 +252,7 @@ Create_2D_Sound_Team(Get_Parameter("Sound"),Get_Object_Type(obj)); } } - else + else if (Commands->Get_Health(obj) >= Get_Float_Parameter("MaxHealth")) { enabled = true; } @@ -272,7 +272,7 @@ extern REF_DECL2(GDIHouseColor, Vector3); void JFW_2D_Sound_Damage_Range_Team_String::Damaged(GameObject *obj,GameObject *damager,float amount) { - if ((Commands->Get_Health(obj) <= Get_Float_Parameter("MaxHealth")) && (Commands->Get_Health(obj) >= Get_Float_Parameter("MinHealth"))) + if (Commands->Get_Health(obj) <= Get_Float_Parameter("MinHealth")) { if (enabled) { @@ -296,7 +296,7 @@ Send_Message_Team(Get_Object_Type(obj),red,green,blue,Get_Parameter("String")); } } - else + else if (Commands->Get_Health(obj) >= Get_Float_Parameter("MaxHealth")) { enabled = true; } @@ -314,7 +314,7 @@ void JFW_3D_Sound_Damage_Range::Damaged(GameObject *obj,GameObject *damager,float amount) { - if ((Commands->Get_Health(obj) <= Get_Float_Parameter("MaxHealth")) && (Commands->Get_Health(obj) >= Get_Float_Parameter("MinHealth"))) + if (Commands->Get_Health(obj) <= Get_Float_Parameter("MinHealth")) { if (enabled) { @@ -327,7 +327,7 @@ Commands->Create_Sound(Get_Parameter("Sound"),pos,obj); } } - else + else if (Commands->Get_Health(obj) >= Get_Float_Parameter("MaxHealth")) { enabled = true; } diff -uwr sourceold/scripts/jfwweap.cpp source/scripts/jfwweap.cpp --- sourceold/scripts/jfwweap.cpp 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/jfwweap.cpp 2012-08-21 22:31:21.856445300 +0800 @@ -14,6 +14,7 @@ #include "scripts.h" #include "engine.h" #include "jfwweap.h" +#include "VehicleGameObj.h" void JFW_Nod_Turret::Created(GameObject *obj) { @@ -1349,6 +1350,124 @@ } } +void JFW_Vehicle_Weapon_Switcher::Created(GameObject *obj) +{ + switching = false; + newweap = false; + pilotID = 0; + new_weapon = 0; + old_weapon = 0; + Commands->Give_PowerUp(obj,Get_Parameter("Powerup"),false); + new_weapon = Get_Powerup_Weapon(Get_Parameter("PowerUp")); + hookid = 0; + k = 0; +} + +void JFW_Vehicle_Weapon_Switcher::Custom(GameObject *obj,int type,int param,GameObject *sender) +{ + if (type == CUSTOM_EVENT_VEHICLE_ENTERED) + { + if (!pilotID) + { + InstallHook(Get_Parameter("Keyhook"),sender); + pilotID = Commands->Get_ID(sender); + } + } + if (type == CUSTOM_EVENT_VEHICLE_EXITED) + { + if (pilotID == Commands->Get_ID(sender)) + { + RemoveHook(); + pilotID = 0; + } + } +} + +void JFW_Vehicle_Weapon_Switcher::Killed(GameObject *obj,GameObject *killer) +{ + RemoveHook(); +} + +void JFW_Vehicle_Weapon_Switcher::Timer_Expired(GameObject *obj,int number) +{ + switching = false; + obj->As_VehicleGameObj()->Set_Scripts_Can_Fire(true); + if (newweap) + { + old_weapon = newstr(Get_Current_Weapon(obj)); + Commands->Select_Weapon(obj,new_weapon); + } + else + { + Commands->Select_Weapon(obj,old_weapon); + old_weapon = 0; + } +} + +void JFW_Vehicle_Weapon_Switcher::KeyHook() +{ + if (switching) + { + return; + } + VehicleGameObj *obj = Owner()->As_VehicleGameObj(); + obj->Set_Scripts_Can_Fire(false); + switching = true; + if (newweap) + { + newweap = false; + Commands->Create_Sound(Get_Parameter("OldSound"),Commands->Get_Position(obj),0); + } + else + { + newweap = true; + Commands->Create_Sound(Get_Parameter("NewSound"),Commands->Get_Position(obj),0); + } + Commands->Start_Timer(obj,this,Get_Float_Parameter("SwitchTime"),1); +} + +void JFW_Char_Weapon_Switcher::Created(GameObject *obj) +{ + LastSwitch = 0; + Weapon2 = true; + InstallHook(Get_Parameter("Keyhook"),obj); +} + +void JFW_Char_Weapon_Switcher::KeyHook() +{ + if (time(NULL) - LastSwitch < Get_Float_Parameter("SwitchTime")) + { + StringClass str; + str.Format("You cannot switch weapons yet, you must wait at least %f seconds after switching to switch again.",Get_Float_Parameter("SwitchTime")); + Send_Message_Player(Owner(),153,204,25,str); + return; + } + LastSwitch = time(NULL); + if (Weapon2) + { + Remove_Weapon(Owner(),Get_Powerup_Weapon(Get_Parameter("WeaponPowerup2"))); + } + else + { + Remove_Weapon(Owner(),Get_Powerup_Weapon(Get_Parameter("WeaponPowerup1"))); + } + Commands->Start_Timer(Owner(),this,Get_Float_Parameter("SwitchTime"),1); +} + +void JFW_Char_Weapon_Switcher::Timer_Expired(GameObject *obj,int number) +{ + if (Weapon2) + { + Commands->Give_PowerUp(obj,Get_Parameter("WeaponPowerup2"),false); + Commands->Select_Weapon(obj,Get_Powerup_Weapon(Get_Parameter("WeaponPowerup2"))); + } + else + { + Commands->Give_PowerUp(obj,Get_Parameter("WeaponPowerup1"),false); + Commands->Select_Weapon(obj,Get_Powerup_Weapon(Get_Parameter("WeaponPowerup1"))); + } +} + ScriptRegistrant JFW_Nod_Turret_Registrant("JFW_Nod_Turret",""); ScriptRegistrant JFW_Nod_Obelisk_CnC_Registrant("JFW_Nod_Obelisk_CnC","Controller_ID=0:int"); ScriptRegistrant JFW_Obelisk_Weapon_CnC_Registrant("JFW_Obelisk_Weapon_CnC",""); @@ -1371,3 +1490,5 @@ ScriptRegistrant JFW_Weapon_Change_On_Custom_Multiple_Registrant("JFW_Weapon_Change_On_Custom_Multiple","Message:int,Powerup1:string,Powerup2:string,Powerup3:string,Powerup4:string,Powerup5:string,Weapon:string"); ScriptRegistrant JFW_Weapon_Change_On_Custom_Multiple_Sender_Registrant("JFW_Weapon_Change_On_Custom_Multiple_Sender","Message:int,Powerup1:string,Powerup2:string,Powerup3:string,Powerup4:string,Powerup5:string,Weapon:string"); ScriptRegistrant JFW_Fire_Weapon_Custom_Registrant("JFW_Fire_Weapon_Custom","Target:vector3,Custom:int"); +ScriptRegistrant JFW_Vehicle_Weapon_Switcher_Registrant("JFW_Vehicle_Weapon_Switcher","Powerup:string,Keyhook=VDeploy:string,SwitchTime:float,OldSound:string,NewSound:string"); +ScriptRegistrant JFW_Char_Weapon_Switcher_Registrant("JFW_Char_Weapon_Switcher","SwitchTime:float,WeaponPowerup1:string,WeaponPowerup2:string,Keyhook:string"); diff -uwr sourceold/scripts/jfwweap.h source/scripts/jfwweap.h --- sourceold/scripts/jfwweap.h 2012-04-14 04:09:48.000000000 +0800 +++ source/scripts/jfwweap.h 2012-08-21 22:29:58.359375000 +0800 @@ -163,3 +163,24 @@ class JFW_Fire_Weapon_Custom : public ScriptImpClass { void Custom(GameObject *obj,int type,int param,GameObject *sender); }; + +class JFW_Vehicle_Weapon_Switcher : public JFW_Key_Hook_Base { + bool switching; + bool newweap; + int pilotID; + const char *new_weapon; + const char *old_weapon; + 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); + void KeyHook(); +}; + +class JFW_Char_Weapon_Switcher : public JFW_Key_Hook_Base { + time_t LastSwitch; + bool Weapon2; + void Created( GameObject *obj ); + void KeyHook(); + void Timer_Expired( GameObject *obj,int number ); +}; Only in source/scripts: mpf_domination.cpp Only in source/scripts: mpf_domination.h diff -uwr sourceold/scripts/scripts.vcxproj source/scripts/scripts.vcxproj --- sourceold/scripts/scripts.vcxproj 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/scripts.vcxproj 2012-10-18 19:23:14.756835900 +0800 @@ -468,6 +468,7 @@ + @@ -500,9 +501,15 @@ + + + + + + @@ -512,6 +519,7 @@ + @@ -527,6 +535,7 @@ + @@ -715,6 +724,7 @@ + @@ -793,9 +803,15 @@ + + + + + + @@ -821,6 +837,7 @@ + @@ -836,6 +853,7 @@ + diff -uwr sourceold/scripts/scripts.vcxproj.filters source/scripts/scripts.vcxproj.filters --- sourceold/scripts/scripts.vcxproj.filters 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/scripts.vcxproj.filters 2012-10-18 19:23:14.749023400 +0800 @@ -36,6 +36,12 @@ {801d5c01-d34a-4efe-8732-24c88360c57e} + + {ba24906d-1b40-49a7-aa3d-da4d65476041} + + + {694fc3c1-10b6-4967-a04e-8983bdf5cc06} + @@ -518,6 +524,33 @@ 01. Sources\Tib. Crystal War + + 01. Sources + + + 01. Sources\Tib. Crystal War + + + 01. Sources\Tib. Crystal War + + + 01. Sources\Tib. Crystal War + + + 01. Sources\Tib. Crystal War + + + 01. Sources\Tib. Crystal War\Campaign + + + 01. Sources\Tib. Crystal War\Campaign + + + 01. Sources + + + 01. Sources + @@ -1539,6 +1572,33 @@ 02. Headers\Tib. Crystal War + + 01. Sources + + + 02. Headers\Tib. Crystal War + + + 02. Headers\Tib. Crystal War + + + 02. Headers\Tib. Crystal War + + + 02. Headers\Tib. Crystal War + + + 02. Headers\Tib. Crystal War\Campaign + + + 02. Headers\Tib. Crystal War\Campaign + + + 02. Headers + + + 02. Headers + diff -uwr sourceold/scripts/tcw_building.cpp source/scripts/tcw_building.cpp --- sourceold/scripts/tcw_building.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_building.cpp 2012-07-31 21:54:12.201171800 +0800 @@ -42,6 +42,12 @@ Create_2D_WAV_Sound_Team("gdi_airfield_destroyed_nod.wav",0); Send_Message(255,255,255,"GDI Airfield destroyed."); } + else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Watchtower") == 0) + { + Create_2D_WAV_Sound_Team("gdi_watchtower_destroyed_gdi.wav",1); + Create_2D_WAV_Sound_Team("gdi_watchtower_destroyed_nod.wav",0); + Send_Message(255,255,255,"GDI Watch Tower destroyed."); + } else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_War_Factory") == 0) { Create_2D_WAV_Sound_Team("gdi_warfactory_destroyed_gdi.wav",1); @@ -171,6 +177,13 @@ Send_Message_Team(0,255,255,255,"GDI Tiberium Refinery under attack."); Send_Message_Team(1,255,255,255,"Warning GDI Tiberium Refinery under attack."); } + else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Watchtower") == 0) + { + Create_2D_WAV_Sound_Team("gdi_watchtower_under_attack_gdi.wav",1); + Create_2D_WAV_Sound_Team("gdi_watchtower_under_attack_nod.wav",0); + Send_Message_Team(1,255,255,255,"Warning: GDI Watch Tower under attack."); + Send_Message_Team(0,255,255,255,"GDI Watch Tower under attack."); + } else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Airfield") == 0) { Create_2D_WAV_Sound_Team("gdi_airfield_under_attack_gdi.wav",1); @@ -363,7 +376,7 @@ { if (play) { - if (damage > 0.5f) + if (damage > 0.1f) { play = false; Commands->Start_Timer(obj,this,25.0f,100100); diff -uwr sourceold/scripts/tcw_center_point.cpp source/scripts/tcw_center_point.cpp --- sourceold/scripts/tcw_center_point.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_center_point.cpp 2012-08-04 10:17:08.602539000 +0800 @@ -16,355 +16,191 @@ #include "engine.h" #include "BuildingGameObj.h" #include "tcw_center_point.h" -#include "GameObjManager.h" -#include "SoldierGameObj.h" -#include "VehicleGameObj.h" -//0=nod 1=gdi 2=neu current animations for spawnpads +#define ISREPAIR(Damage) (Damage < 0.0f) +#define ISVALIDPLAYER(Team) (Team == 0 || Team == 1) +#define CUSTOM_EVENT_INITIALIZE_TURRET 873423 +#define CUSTOM_EVENT_START_TURRET 978356 +#define CUSTOM_EVENT_STOP_TURRET 957832 -void tcw_cp_cruiser_countdown_point::Created(GameObject *obj) +void TCW_CP_Cruiser_Countdown_Point::Created(GameObject *obj) { Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,2,2,false); - spawnpad1 = Get_Int_Parameter("SpawnPad1ID"); - if (Commands->Find_Object(spawnpad1)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - } - spawnpad2 = Get_Int_Parameter("SpawnPad2ID"); - if (Commands->Find_Object(spawnpad2)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - } - spawnpad3 = Get_Int_Parameter("SpawnPad3ID"); - if (Commands->Find_Object(spawnpad3)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad3),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - } - spawnpad4 = Get_Int_Parameter("SpawnPad4ID"); - if (Commands->Find_Object(spawnpad4)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad4),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - } - nod_bar_turret_id = 100065; nod_ref_turret_id = 100067; gdi_hand_turret_id = 100068; gdi_ref_turret_id = 100070; - nodveh1id = 0; nodveh2id = 0; gdiveh1id = 0; gdiveh2id = 0; + SpawnPadIDs[0] = Get_Int_Parameter("VehSpawnPadID1"); + SpawnPadIDs[1] = Get_Int_Parameter("VehSpawnPadID2"); + SpawnPadIDs[2] = Get_Int_Parameter("VehSpawnPadID3"); + SpawnPadIDs[3] = Get_Int_Parameter("VehSpawnPadID4"); + for(int Index = 0; Index < 4; Index++) + Commands->Set_Animation(Commands->Find_Object(SpawnPadIDs[Index]),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); + NodTurretIDs[0] = Get_Int_Parameter("NodTurretID1"); + NodTurretIDs[1] = Get_Int_Parameter("NodTurretID2"); + GDITurretIDs[0] = Get_Int_Parameter("GDITurretID1"); + GDITurretIDs[1] = Get_Int_Parameter("GDITurretID2"); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[0]), CUSTOM_EVENT_INITIALIZE_TURRET, 1, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[1]), CUSTOM_EVENT_INITIALIZE_TURRET, 1, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[0]), CUSTOM_EVENT_INITIALIZE_TURRET, 0, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[1]), CUSTOM_EVENT_INITIALIZE_TURRET, 0, 0); + Vehs[0] = new VehicleReinforcements(Get_Parameter("GDIVehicle1"), Get_Vector3_Parameter("GDIVehicle1Pos"), Get_Float_Parameter("GDIVehicle1Facing"), 1); + Vehs[1] = new VehicleReinforcements(Get_Parameter("GDIVehicle2"), Get_Vector3_Parameter("GDIVehicle2Pos"), Get_Float_Parameter("GDIVehicle2Facing"), 1); + Vehs[2] = new VehicleReinforcements(Get_Parameter("NodVehicle1"), Get_Vector3_Parameter("NodVehicle1Pos"), Get_Float_Parameter("NodVehicle1Facing"), 0); + Vehs[3] = new VehicleReinforcements(Get_Parameter("NodVehicle2"), Get_Vector3_Parameter("NodVehicle2Pos"), Get_Float_Parameter("NodVehicle2Facing"), 0); Commands->Set_Player_Type(obj,-2); - Commands->Set_Health(obj,2.0f); - create_cruiser_countdown_object = true; - trigger_neutral_damage = true; + Commands->Set_Health(obj, 2); + Captured = false; + CaptureType = -2; + Health = 2; } -void tcw_cp_cruiser_countdown_point::Damaged(GameObject *obj, GameObject *damager, float damage) -{ - if (Commands->Is_A_Star(damager))//is it a player? - { - if ((damage < 0.0f) && (Commands->Get_Player_Type(obj) == -2)) - { - if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj))//if fully repaired - { - if (Commands->Get_Player_Type(damager) == 0) + +void TCW_CP_Cruiser_Countdown_Point::Damaged(GameObject *obj, GameObject *damager, float damage) { - trigger_neutral_damage = true; - Commands->Set_Player_Type(obj,0); - Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,0,0,false); - if (Commands->Find_Object(spawnpad1)) + if(Commands->Is_A_Star(damager)) // Only Stars may do something with me. { - Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); - } - if (Commands->Find_Object(spawnpad2)) + if(ISREPAIR(damage)) // Check if it's repair damage (damage < 0.0). { - Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); - } - if (Commands->Find_Object(spawnpad3)) + if(!ISVALIDPLAYER(Commands->Get_Player_Type(damager))) // When not a valid player ignore the repairing. { - Commands->Set_Animation(Commands->Find_Object(spawnpad3),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); + Commands->Set_Health(obj, Health); + return; } - if (Commands->Find_Object(spawnpad4)) + Health = Commands->Get_Health(obj); + if(!Captured && Commands->Get_Health(obj) == Commands->Get_Max_Health(obj)) // When I'm not captured and I've reached maximum health. { - Commands->Set_Animation(Commands->Find_Object(spawnpad4),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); - } - - if (create_cruiser_countdown_object)//if the cruisercountdown object may be created + Health = Commands->Get_Max_Health(obj); + Captured = true; + CaptureType = Commands->Get_Player_Type(damager); + Commands->Set_Player_Type(obj, CaptureType); + Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,0,0,false); + for(int Index = 0; Index < 4; Index++) + Commands->Set_Animation(Commands->Find_Object(Index),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); + Commands->Start_Timer(obj, this, 60, 1); + Commands->Give_Money(damager, 500, true); + if(CaptureType == 0) { Send_Message(255,255,255,"Nod has captured the Countdown Control Point. One Minute for Cruiser Attacks."); - create_cruiser_countdown_object = false;//its being created here so we set it to false so it doesnt get made a 2nd time - Vector3 countdown_object_pos; - countdown_object_pos.X = 0.0f; countdown_object_pos.Y = 0.0f; countdown_object_pos.Z = 0.0f; - GameObject *countdown_object = Commands->Create_Object("Invisible_Object",countdown_object_pos); - - char prms[250]; - sprintf(prms,"%d,%d,%d,%d,%d",0,nod_bar_turret_id,nod_ref_turret_id,gdi_hand_turret_id,gdi_ref_turret_id); - Attach_Script_Once(countdown_object,"tcw_cp_cruiser_countdown",prms); - Create_2D_WAV_Sound_Team("ControlPointCaptured_Nod.wav",0); - Create_2D_WAV_Sound_Team("ControlPointLost_GDI.wav",1); - - if (Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) - { - Commands->Give_Money(damager,500.0f,true); - } - - if (!Commands->Find_Object(nodveh1id)) - { - if (strcmp(Get_Parameter("NodVeh1"), "0") != 0) - { - Vector3 nodveh1pos = Get_Vector3_Parameter("NodVeh1Pos"); - float nodveh1fac = Get_Float_Parameter("NodVeh1Facing"); - GameObject *nodveh1 = Commands->Create_Object(Get_Parameter("NodVeh1"),nodveh1pos); - Commands->Set_Facing(nodveh1,nodveh1fac); - nodveh1id = Commands->Get_ID(nodveh1); - Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); - } - } - if (!Commands->Find_Object(nodveh2id)) - { - if (strcmp(Get_Parameter("NodVeh2"), "0") != 0) - { - Vector3 nodveh2pos = Get_Vector3_Parameter("NodVeh2Pos"); - float nodveh2fac = Get_Float_Parameter("NodVeh2Facing"); - GameObject *nodveh2 = Commands->Create_Object(Get_Parameter("NodVeh2"),nodveh2pos); - Commands->Set_Facing(nodveh2,nodveh2fac); - nodveh2id = Commands->Get_ID(nodveh2); - Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); - } - } - } + Vehs[2] ? Vehs[2]->Create() : 0; + Vehs[3] ? Vehs[3]->Create() : 0; } - else if (Commands->Get_Player_Type(damager) == 1) - { - trigger_neutral_damage = true; - Commands->Set_Player_Type(obj,1); - Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,1,1,false); - if (Commands->Find_Object(spawnpad1)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); - } - if (Commands->Find_Object(spawnpad2)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); - } - if (Commands->Find_Object(spawnpad3)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad3),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); - } - if (Commands->Find_Object(spawnpad4)) - { - Commands->Set_Animation(Commands->Find_Object(spawnpad4),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); - } - - if (create_cruiser_countdown_object) + else if(CaptureType == 1) { Send_Message(255,255,255,"GDI has captured the Countdown Control Point. One Minute for Cruiser Attacks."); - create_cruiser_countdown_object = false; - Vector3 countdown_object_pos; - countdown_object_pos.X = 0.0f; countdown_object_pos.Y = 0.0f; countdown_object_pos.Z = 0.0f; - GameObject *countdown_object = Commands->Create_Object("Invisible_Object",countdown_object_pos); - - char prms[250]; - sprintf(prms,"%d,%d,%d,%d,%d",1,nod_bar_turret_id,nod_ref_turret_id,gdi_hand_turret_id,gdi_ref_turret_id); - Attach_Script_Once(countdown_object,"tcw_cp_cruiser_countdown",prms); - - Create_2D_WAV_Sound_Team("ControlPointLost_Nod.wav",0); Create_2D_WAV_Sound_Team("ControlPointCaptured_GDI.wav",1); - - if (Commands->Get_Player_Type(damager) == Commands->Get_Player_Type(obj)) - { - Commands->Give_Money(damager,500.0f,true); - } - - if (!Commands->Find_Object(nodveh1id)) - { - if (strcmp(Get_Parameter("GDIVeh1"), "0") != 0) - { - Vector3 gdiveh1pos = Get_Vector3_Parameter("GDIVeh1Pos"); - float gdiveh1fac = Get_Float_Parameter("GDIVeh1Facing"); - GameObject *gdiveh1 = Commands->Create_Object(Get_Parameter("GDIVeh1"),gdiveh1pos); - Commands->Set_Facing(gdiveh1,gdiveh1fac); - gdiveh1id = Commands->Get_ID(gdiveh1); - Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); - } - } - if (!Commands->Find_Object(nodveh2id)) - { - if (strcmp(Get_Parameter("GDIVeh2"), "0") != 0) - { - Vector3 gdiveh2pos = Get_Vector3_Parameter("GDIVeh2Pos"); - float gdiveh2fac = Get_Float_Parameter("GDIVeh2Facing"); - GameObject *gdiveh2 = Commands->Create_Object(Get_Parameter("GDIVeh2"),gdiveh2pos); - Commands->Set_Facing(gdiveh2,gdiveh2fac); - gdiveh2id = Commands->Get_ID(gdiveh2); - Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Vehs[0] ? Vehs[0]->Create() : 0; + Vehs[1] ? Vehs[1]->Create() : 0; } } } - } - } - } - else if (damage > 0.0f) + else { - if (Commands->Get_Player_Type(damager) == 1)//if its gdi attacking it + if(Captured) { - if (damage >= Commands->Get_Health(obj))//point is destroyed + if(!ISVALIDPLAYER(Commands->Get_Player_Type(damager))) // When not a valid player ignore the damage being done. { - Commands->Set_Player_Type(obj,-2);//it now belongs to gdi because they fully destroyed it - Commands->Set_Health(obj,2.0f);//we cant allow them to REALLY destroy it, otherwise the script halts and stuff.... - if (trigger_neutral_damage) + Commands->Set_Health(obj, Health); + return; + } + Health = Commands->Get_Health(obj); + if(damage >= Commands->Get_Health(obj)) // We are destroyed, point lost. { + Health = 2; + Captured = false; + Commands->Set_Health(obj, 2); + Commands->Set_Player_Type(obj, -2); Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad3),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad4),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); + for(int Index = 0; Index < 4; Index++) + Commands->Set_Animation(Commands->Find_Object(SpawnPadIDs[Index]),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[0]), CUSTOM_EVENT_STOP_TURRET, 0, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[1]), CUSTOM_EVENT_STOP_TURRET, 0, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[0]), CUSTOM_EVENT_STOP_TURRET, 0, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[1]), CUSTOM_EVENT_STOP_TURRET, 0, 0); + if(CaptureType == 0) + { Send_Message(255,255,255,"Cruiser Attacks on GDI halted. Countdown Point destroyed."); - Vector3 tur1pos = Commands->Get_Position(Commands->Find_Object(nod_bar_turret_id));//bar attacking turret for nod - Vector3 tur2pos = Commands->Get_Position(Commands->Find_Object(nod_ref_turret_id));//ref attacking turret for nod - float facingtur1 = Commands->Get_Facing(Commands->Find_Object(nod_bar_turret_id)); - float facingtur2 = Commands->Get_Facing(Commands->Find_Object(nod_ref_turret_id)); - Commands->Destroy_Object(Commands->Find_Object(nod_bar_turret_id)); - Commands->Destroy_Object(Commands->Find_Object(nod_ref_turret_id)); - GameObject *tur1 = Commands->Create_Object("TCW_Cruiser_Cannon_CDP",tur1pos); - GameObject *tur2 = Commands->Create_Object("TCW_Cruiser_Cannon_CDP",tur2pos); - Commands->Set_Facing(tur1,facingtur1); - Commands->Set_Player_Type(tur1,0); - Commands->Set_Facing(tur2,facingtur2); - Commands->Set_Player_Type(tur2,0); - nod_bar_turret_id = Commands->Get_ID(tur1);//this is the new bar attacking turret for nod - nod_ref_turret_id = Commands->Get_ID(tur2);//this is the new ref attacking turret for nod - create_cruiser_countdown_object = true; Create_2D_WAV_Sound_Team("ControlPointLost_Nod.wav",0); - //destroy the spawned vehicles - if ( (Commands->Find_Object(nodveh1id)) && (!Get_Vehicle_Driver(Commands->Find_Object(nodveh1id))) ) - { - Commands->Apply_Damage(Commands->Find_Object(nodveh1id),999999.0f,"Steel",obj); nodveh1id = 0; - } - if ( (Commands->Find_Object(nodveh2id)) && (!Get_Vehicle_Driver(Commands->Find_Object(nodveh2id))) ) - { - Commands->Apply_Damage(Commands->Find_Object(nodveh2id),999999.0f,"Steel",obj); nodveh2id = 0; - } - trigger_neutral_damage = false; - } - } + Vehs[2] ? Commands->Apply_Damage(Vehs[2]->Is_Alive_And_Kicking(), 9999, "BlamoKiller", 0) : 0; + Vehs[3] ? Commands->Apply_Damage(Vehs[3]->Is_Alive_And_Kicking(), 9999, "BlamoKiller", 0) : 0; } - else if (Commands->Get_Player_Type(damager) == 0)//if its nod attacking it + else if(CaptureType == 1) { - if (damage >= Commands->Get_Health(obj))//point is destroyed - { - Commands->Set_Player_Type(obj,-2);//it now belongs to nod because they fully destroyed it - Commands->Set_Health(obj,2.0f);//we cant allow them to REALLY destroy it, otherwise the script halts and stuff.... - if (trigger_neutral_damage) - { - Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad3),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); - Commands->Set_Animation(Commands->Find_Object(spawnpad4),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); Send_Message(255,255,255,"Cruiser Attacks on Nod halted. Countdown Point destroyed."); - Vector3 tur1pos = Commands->Get_Position(Commands->Find_Object(gdi_hand_turret_id));//hon attacking turret for gdi - Vector3 tur2pos = Commands->Get_Position(Commands->Find_Object(gdi_ref_turret_id));//ref attacking turret for gdi - float facingtur1 = Commands->Get_Facing(Commands->Find_Object(gdi_hand_turret_id)); - float facingtur2 = Commands->Get_Facing(Commands->Find_Object(gdi_ref_turret_id)); - Commands->Destroy_Object(Commands->Find_Object(gdi_hand_turret_id)); - Commands->Destroy_Object(Commands->Find_Object(gdi_ref_turret_id)); - GameObject *tur1 = Commands->Create_Object("TCW_Cruiser_Cannon_CDP",tur1pos); - GameObject *tur2 = Commands->Create_Object("TCW_Cruiser_Cannon_CDP",tur2pos); - Commands->Set_Facing(tur1,facingtur1); - Commands->Set_Player_Type(tur1,1); - Commands->Set_Facing(tur2,facingtur2); - Commands->Set_Player_Type(tur2,1); - gdi_hand_turret_id = Commands->Get_ID(tur1);//this is the new hand attacking turret for gdi - gdi_ref_turret_id = Commands->Get_ID(tur2);//this is the new ref attacking turret for gdi - create_cruiser_countdown_object = true; Create_2D_WAV_Sound_Team("ControlPointLost_GDI.wav",1); - - //destroy the spawned vehicles - if ( (Commands->Find_Object(gdiveh1id)) && (!Get_Vehicle_Driver(Commands->Find_Object(gdiveh1id))) ) - { - Commands->Apply_Damage(Commands->Find_Object(gdiveh1id),999999.0f,"Death",obj); gdiveh1id = 0; - } - if ( (Commands->Find_Object(gdiveh2id)) && (!Get_Vehicle_Driver(Commands->Find_Object(gdiveh2id))) ) - { - Commands->Apply_Damage(Commands->Find_Object(gdiveh2id),999999.0f,"Death",obj); gdiveh2id = 0; - } - trigger_neutral_damage = false; - } + Vehs[0] ? Commands->Apply_Damage(Vehs[0]->Is_Alive_And_Kicking(), 9999, "BlamoKiller", 0) : 0; + Vehs[1] ? Commands->Apply_Damage(Vehs[1]->Is_Alive_And_Kicking(), 9999, "BlamoKiller", 0) : 0; } + CaptureType = -2; } } + else + Commands->Set_Health(obj, 2); } } -void tcw_cp_cruiser_countdown_point::Register_Auto_Save_Variables() -{ - Auto_Save_Variable(&create_cruiser_countdown_object,sizeof(create_cruiser_countdown_object),1); - Auto_Save_Variable(&nodveh1id,sizeof(nodveh1id),2); - Auto_Save_Variable(&nodveh2id,sizeof(nodveh2id),3); - Auto_Save_Variable(&gdiveh1id,sizeof(gdiveh1id),4); - Auto_Save_Variable(&gdiveh2id,sizeof(gdiveh2id),5); - Auto_Save_Variable(&trigger_neutral_damage,sizeof(trigger_neutral_damage),6); } -void tcw_cp_cruiser_countdown::Created(GameObject *obj) +void TCW_CP_Cruiser_Countdown_Point::Timer_Expired(GameObject *obj, int number) +{ + if(number == 1 && Captured) { - team = Get_Int_Parameter("Team"); - turretbarnod = Get_Int_Parameter("NodTurretBar_ID"); - turretrefnod = Get_Int_Parameter("NodTurretRef_ID"); - turrethongdi = Get_Int_Parameter("GDITurretHon_ID"); - turretrefgdi = Get_Int_Parameter("GDITurretRef_ID"); - if (team == 0) + Commands->Create_2D_WAV_Sound("attackalert.mp3"); + if(CaptureType == 0) { - Commands->Start_Timer(obj,this,60.0f,100); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[0]), CUSTOM_EVENT_START_TURRET, BuildingConstants::TYPE_REFINERY, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(NodTurretIDs[1]), CUSTOM_EVENT_START_TURRET, BuildingConstants::TYPE_SOLDIER_FACTORY, 0); } - else if (team == 1) + else if(CaptureType == 1) { - Commands->Start_Timer(obj,this,60.0f,101); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[0]), CUSTOM_EVENT_START_TURRET, BuildingConstants::TYPE_REFINERY, 0); + Commands->Send_Custom_Event(obj, Commands->Find_Object(GDITurretIDs[1]), CUSTOM_EVENT_START_TURRET, BuildingConstants::TYPE_SOLDIER_FACTORY, 0); } } -void tcw_cp_cruiser_countdown::Timer_Expired(GameObject *obj, int number) -{ - if (number == 100) // nod timer hits so we need the turrets from nod which attack gdi base: - { - //100065 -> bar 100067 -> ref (turrets) - //100062 -> barattack 100071 -> refattack (attackpoints) - Attach_Script_Once(Commands->Find_Object(turretbarnod),"tcw_cp_cruiser_attack","100062");//turret 1 that attacks the barracks - Attach_Script_Once(Commands->Find_Object(turretrefnod),"tcw_cp_cruiser_attack","100071");//turret 2 that attacks the refinery } - else if (number == 101) + +void TCW_CP_Cruiser_Attack::Created(GameObject *obj) { - //100068 -> hand 100070 -> ref (turrets) - //100073 -> handattack 100072 -> refattack (attackpoints) - Attach_Script_Once(Commands->Find_Object(turrethongdi),"tcw_cp_cruiser_attack","100073");//turret 1 that attacks the hand - Attach_Script_Once(Commands->Find_Object(turretrefgdi),"tcw_cp_cruiser_attack","100072");//turret 2 that attacks the refinery - } + Set_Skin(obj, "Blamo"); + Commands->Set_Shield_Type(obj, "Blamo"); + Commands->Set_Player_Type(obj, -2); + Commands->Innate_Disable(obj); } -void tcw_cp_cruiser_countdown::Register_Auto_Save_Variables() + +void TCW_CP_Cruiser_Attack::Action_Complete(GameObject *obj, int action, ActionCompleteReason reason) { - Auto_Save_Variable(&team,sizeof(team),1); - Auto_Save_Variable(&turretbarnod,sizeof(turretbarnod),2); - Auto_Save_Variable(&turretrefnod,sizeof(turretrefnod),3); - Auto_Save_Variable(&turrethongdi,sizeof(turrethongdi),4); - Auto_Save_Variable(&turretrefgdi,sizeof(turretrefgdi),5); + if(reason == ACTION_COMPLETE_NORMAL) + Commands->Action_Reset(obj, 100); } -void tcw_cp_cruiser_attack::Created(GameObject *obj)//this script will immideately attack whatever is passed as the attack id +void TCW_CP_Cruiser_Attack::Custom(GameObject *obj,int type,int param,GameObject *sender) { - Commands->Start_Timer(obj,this,1.0f,250); - Commands->Create_2D_WAV_Sound("attackalert.wav"); + if(type == CUSTOM_EVENT_INITIALIZE_TURRET) + { + AttackTeam = param; + if(AttackTeam == 0) + Commands->Set_Player_Type(obj, 1); + else if(AttackTeam == 1) + Commands->Set_Player_Type(obj, 0); + else + Commands->Set_Player_Type(obj, -2); } -void tcw_cp_cruiser_attack::Timer_Expired(GameObject *obj, int number) + else if(type == CUSTOM_EVENT_START_TURRET) { - if (number == 250) + GameObject *Building = Find_Building_By_Type(AttackTeam, param); + if(Building) { - ActionParamsStruct params; - int priority = 100; float range = 1000.0f; float deviation = 0.0f; int primary = 1; - params.Set_Basic(this,(float)priority,40016); - params.Set_Attack(Commands->Find_Object(Get_Int_Parameter("Attack_ID")),range,deviation,primary); - params.AttackCheckBlocked = false; - Commands->Action_Attack(obj,params); - Commands->Start_Timer(obj,this,1.0f,250); + ActionParamsStruct Params; + Params.Set_Basic(this, 100, 1); + Params.Set_Attack(Commands->Get_Position(Building), 9999, 0, true); + Params.AttackCheckBlocked = false; + Params.AttackForceFire = true; + Commands->Action_Attack(obj, Params); } } -void tcw_cp_cruiser_attack::Action_Complete(GameObject *obj,int action,ActionCompleteReason reason) + else if(type == CUSTOM_EVENT_STOP_TURRET) { - Commands->Action_Reset(obj,100); + ActionParamsStruct Params; + Params.Set_Basic(this, 100, 1); + Params.Set_Attack(0, 9999, 0, true); + Commands->Action_Attack(obj, Params); + } } -ScriptRegistrant tcw_cp_cruiser_attack_Registrant("tcw_cp_cruiser_attack","Attack_ID=1111:int,TurretID=0:int"); -ScriptRegistrant tcw_cp_cruiser_countdown_Registrant("tcw_cp_cruiser_countdown","Team=0:int,NodTurretBar_ID=1:int,NodTurretRef_ID=1:int,GDITurretHon_ID=1:int,GDITurretRef_ID=1:int"); -ScriptRegistrant tcw_cp_cruiser_countdown_point_Registrant("tcw_cp_cruiser_countdown_point","NodVeh1=asdf:string,NodVeh1Pos=0:vector3,NodVeh1Facing=0:float,NodVeh2=asdf:string,NodVeh2Pos=0:vector3,NodVeh2Facing=0:float,GDIVeh1=asdf:string,GDIVeh1Pos=0:vector3,GDIVeh1Facing=0:float,GDIVeh2=asdf:string,GDIVeh2Pos=0:vector3,GDIVeh2Facing=0:float,SpawnPad1ID=0:int,SpawnPad2ID=0:int,SpawnPad3ID=0:int,SpawnPad4ID=0:int"); \ No newline at end of file +ScriptRegistrant tcw_cp_cruiser_attack_Registrant("tcw_cp_cruiser_attack",""); +ScriptRegistrant tcw_cp_cruiser_countdown_point_Registrant("tcw_cp_cruiser_countdown_point","VehSpawnPadID1=0:int,VehSpawnPadID2=0:int,VehSpawnPadID3=0:int,VehSpawnPadID4=0:int,NodTurretID1=0:int,NodTurretID2=0:int,GDITurretID1=0:int,GDITurretID2=0:int,GDIVehicle1:string,GDIVehicle1Pos:vector3,GDIVehicle1Facing=0:float,GDIVehicle2:string,GDIVehicle2Pos:vector3,GDIVehicle2Facing=0:float,NodVehicle1:string,NodVehicle1Pos:vector3,NodVehicle1Facing=0:float,NodVehicle2:string,NodVehicle2Pos:vector3,NodVehicle2Facing=0:float"); \ No newline at end of file diff -uwr sourceold/scripts/tcw_center_point.h source/scripts/tcw_center_point.h --- sourceold/scripts/tcw_center_point.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_center_point.h 2012-08-04 10:17:08.606445300 +0800 @@ -13,31 +13,80 @@ */ #pragma once -class tcw_cp_cruiser_countdown_point : public ScriptImpClass { - void Created(GameObject *obj); - void Damaged(GameObject *obj, GameObject *damager, float damage); - public: void Register_Auto_Save_Variables(); - bool create_cruiser_countdown_object; - bool trigger_neutral_damage; - int gdiveh1id; int gdiveh2id; int nodveh1id; int nodveh2id; - int nod_bar_turret_id; int nod_ref_turret_id; int gdi_hand_turret_id; int gdi_ref_turret_id; - int spawnpad1; int spawnpad2; int spawnpad3; int spawnpad4; -}; +#pragma warning(disable: 4239 4706) -class tcw_cp_cruiser_countdown : public ScriptImpClass { +class TCW_CP_Cruiser_Countdown_Point : public ScriptImpClass +{ + class VehicleReinforcements + { + public: + VehicleReinforcements() + { + CreatePreset = ""; + CreatePos = Vector3(0,0,0); + CreateFacing = 0; + CreateTeam = -2; + PresetID = 0; + } + VehicleReinforcements(const char *Preset, Vector3 &Pos, float Facing, int Team) + { + CreatePreset = Preset; + CreatePos = Pos; + CreateFacing = Facing; + CreateTeam = Team; + PresetID = 0; + } + GameObject *Is_Alive_And_Kicking() + { + GameObject *Preset = Commands->Find_Object(PresetID); + if(!Preset || Commands->Get_Health(Preset) < 0) + return 0; + return Preset; + } + void Create() + { + GameObject *Preset = 0; + if(Preset = Is_Alive_And_Kicking()) + Commands->Apply_Damage(Preset, 99999, "BlamoKiller", 0); + Preset = Commands->Create_Object(CreatePreset.Peek_Buffer(), CreatePos); + Commands->Set_Facing(Preset, CreateFacing); + Commands->Set_Player_Type(Preset, CreateTeam); + StringClass Str; + Str.Format("%d", CreateTeam); + Commands->Attach_Script(Preset, "tcw_domination_vehicle", Str.Peek_Buffer()); + PresetID = Commands->Get_ID(Preset); + } + protected: + StringClass CreatePreset; + Vector3 CreatePos; + float CreateFacing; + int CreateTeam; + int PresetID; + }; + VehicleReinforcements *Vehs[4]; + ~TCW_CP_Cruiser_Countdown_Point() + { + for(int Index = 0; Index < 4; Index++) + { + delete Vehs[Index]; + Vehs[Index] = 0; + } + } void Created(GameObject *obj); + void Damaged(GameObject *obj, GameObject *damager, float damage); void Timer_Expired(GameObject *obj, int number); - public: void Register_Auto_Save_Variables(); - int team; - int turretbarnod; - int turretrefnod; - int turrethongdi; - int turretrefgdi; + int SpawnPadIDs[4]; + int NodTurretIDs[2]; + int GDITurretIDs[2]; + bool Captured; + int CaptureType; + float Health; }; -class tcw_cp_cruiser_attack : public ScriptImpClass { +class TCW_CP_Cruiser_Attack : public ScriptImpClass +{ void Created(GameObject *obj); void Action_Complete(GameObject *obj,int action,ActionCompleteReason reason); - void Timer_Expired(GameObject *obj, int number); + void Custom(GameObject *obj,int type,int param,GameObject *sender); + int AttackTeam; }; - diff -uwr sourceold/scripts/tcw_coop.cpp source/scripts/tcw_coop.cpp --- sourceold/scripts/tcw_coop.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_coop.cpp 2012-07-31 21:54:12.073242100 +0800 @@ -112,6 +112,54 @@ } } +void tcw_goto_player_attack::Created(GameObject *obj) +{ + Commands->Start_Timer(obj, this, 3.500000, 20000); +} +void tcw_goto_player_attack::Timer_Expired(GameObject *obj, int number) +{ + if(number == 20000) + { + GameObject *player = Commands->Get_A_Star(Commands->Get_Position(obj)); + if (player) + { + ActionParamsStruct Params; + Params.Set_Basic(this,100,20000); + Params.Set_Movement(player,0.800000f,2.500000f); + Params.Set_Attack(player,50.000000f,1.000000f,true); + Commands->Action_Attack(obj,Params); + Commands->Start_Timer(obj,this,3.0f,20000); + } + else + { + player = 0; Commands->Start_Timer(obj,this,3.0f,20000); + } + } +} + +void tcw_goto_player::Created(GameObject *obj) +{ + Commands->Enable_Hibernation(obj,false); + Commands->Start_Timer(obj,this,5.0f,65); + ActionParamsStruct Params; + Params.Set_Basic(this,45,63); + Params.Set_Movement(Commands->Get_A_Star(Commands->Get_Position(obj)),1,0.8f); + Commands->Action_Goto(obj,Params); +} +void tcw_goto_player::Timer_Expired(GameObject *obj, int number) +{ + if (number == 65 && obj) + { + ActionParamsStruct Params; + Params.Set_Basic(this,45,63); + Params.Set_Movement(Commands->Get_A_Star(Commands->Get_Position(obj)),1,0.8f); + Commands->Action_Goto(obj,Params); + Commands->Start_Timer(obj,this,5.0f,65); + } +} + +ScriptRegistrant tcw_goto_player_Registrant("tcw_goto_player",""); +ScriptRegistrant tcw_goto_player_attack_Registrant("tcw_goto_player_attack",""); ScriptRegistrant tcw_midlight_eva1_Registrant("tcw_midlight_eva1",""); ScriptRegistrant tcw_enable_spawners_killed_Registrant("tcw_enable_spawners_killed","Enable=0:int,Spawner01=0:int,Spawner02=0:int,Spawner03=0:int,Spawner04=0:int,Spawner05=0:int,Spawner06=0:int,Spawner07=0:int,Spawner08=0:int,Spawner09=0:int,Spawner10=0:int,"); ScriptRegistrant tcw_attach_script_simple_timer_Registrant("tcw_attach_script_simple_timer","Time=0:float,TimerID=100:int,Scriptname=bla:string"); diff -uwr sourceold/scripts/tcw_coop.h source/scripts/tcw_coop.h --- sourceold/scripts/tcw_coop.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_coop.h 2012-07-31 21:54:12.066406200 +0800 @@ -31,3 +31,15 @@ void Created(GameObject *obj); void Timer_Expired(GameObject *obj, int number); }; + +class tcw_goto_player_attack : public ScriptImpClass +{ + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj, int number); +}; + +class tcw_goto_player : public ScriptImpClass +{ + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj, int number); +}; \ No newline at end of file diff -uwr sourceold/scripts/tcw_defence.cpp source/scripts/tcw_defence.cpp --- sourceold/scripts/tcw_defence.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_defence.cpp 2012-07-31 21:54:12.054687500 +0800 @@ -37,6 +37,11 @@ Commands->Start_Timer(obj, this, attack_timer, 11); } +void tcw_Base_Defense::Killed(GameObject *obj, GameObject *shooter) +{ + //placeholder +} + void tcw_Base_Defense::Damaged(GameObject *obj, GameObject *damager, float amount) { if (Is_Base_Powered(Get_Int_Parameter("Team"))) diff -uwr sourceold/scripts/tcw_defence.h source/scripts/tcw_defence.h --- sourceold/scripts/tcw_defence.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_defence.h 2012-07-31 21:54:12.128906200 +0800 @@ -31,5 +31,6 @@ void Damaged(GameObject *obj, GameObject *damager, float amount); void Timer_Expired(GameObject *obj, int number); void Action_Complete(GameObject *obj, int action_id, ActionCompleteReason complete_reason); + void Killed(GameObject *obj, GameObject *shooter); public: void Register_Auto_Save_Variables(); }; \ No newline at end of file diff -uwr sourceold/scripts/tcw_domination.cpp source/scripts/tcw_domination.cpp --- sourceold/scripts/tcw_domination.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_domination.cpp 2012-07-31 21:54:12.189453100 +0800 @@ -224,6 +224,7 @@ Commands->Set_Facing(nodveh1,nodveh1fac); nodveh1id = Commands->Get_ID(nodveh1); Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh1,-2); } } if (!Commands->Find_Object(nodveh2id)) @@ -236,6 +237,7 @@ Commands->Set_Facing(nodveh2,nodveh2fac); nodveh2id = Commands->Get_ID(nodveh2); Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh2,-2); } } if (!Commands->Find_Object(nodveh3id)) @@ -248,6 +250,7 @@ Commands->Set_Facing(nodveh3,nodveh3fac); nodveh3id = Commands->Get_ID(nodveh3); Attach_Script_Once(nodveh3,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh3,-2); } } if (!Commands->Find_Object(nodveh4id)) @@ -260,6 +263,7 @@ Commands->Set_Facing(nodveh4,nodveh4fac); nodveh4id = Commands->Get_ID(nodveh4); Attach_Script_Once(nodveh4,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh4,-2); } } if (!Commands->Find_Object(nodveh5id)) @@ -272,6 +276,7 @@ Commands->Set_Facing(nodveh5,nodveh5fac); nodveh5id = Commands->Get_ID(nodveh5); Attach_Script_Once(nodveh5,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh5,-2); } } @@ -317,6 +322,7 @@ Commands->Set_Facing(gdiveh1,gdiveh1fac); gdiveh1id = Commands->Get_ID(gdiveh1); Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh1,-2); } } if (!Commands->Find_Object(gdiveh2id)) @@ -329,6 +335,7 @@ Commands->Set_Facing(gdiveh2,gdiveh2fac); gdiveh2id = Commands->Get_ID(gdiveh2); Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh2,-2); } } if (!Commands->Find_Object(gdiveh3id)) @@ -341,6 +348,7 @@ Commands->Set_Facing(gdiveh3,gdiveh3fac); gdiveh3id = Commands->Get_ID(gdiveh3); Attach_Script_Once(gdiveh3,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh3,-2); } } if (!Commands->Find_Object(gdiveh4id)) @@ -353,6 +361,7 @@ Commands->Set_Facing(gdiveh4,gdiveh4fac); gdiveh4id = Commands->Get_ID(gdiveh4); Attach_Script_Once(gdiveh4,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh4,-2); } } if (!Commands->Find_Object(gdiveh5id)) @@ -365,6 +374,7 @@ Commands->Set_Facing(gdiveh5,gdiveh5fac); gdiveh5id = Commands->Get_ID(gdiveh5); Attach_Script_Once(gdiveh5,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh5,-2); } } @@ -462,6 +472,7 @@ Commands->Set_Facing(nodveh1,nodveh1fac); nodveh1id = Commands->Get_ID(nodveh1); Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh1,-2); } } if (!Commands->Find_Object(nodveh2id)) @@ -474,6 +485,7 @@ Commands->Set_Facing(nodveh2,nodveh2fac); nodveh2id = Commands->Get_ID(nodveh2); Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh2,-2); } } if (!Commands->Find_Object(nodveh3id)) @@ -486,6 +498,7 @@ Commands->Set_Facing(nodveh3,nodveh3fac); nodveh3id = Commands->Get_ID(nodveh3); Attach_Script_Once(nodveh3,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh3,-2); } } if (!Commands->Find_Object(nodveh4id)) @@ -498,6 +511,7 @@ Commands->Set_Facing(nodveh4,nodveh4fac); nodveh4id = Commands->Get_ID(nodveh4); Attach_Script_Once(nodveh4,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh4,-2); } } if (!Commands->Find_Object(nodveh5id)) @@ -510,6 +524,7 @@ Commands->Set_Facing(nodveh5,nodveh5fac); nodveh5id = Commands->Get_ID(nodveh5); Attach_Script_Once(nodveh5,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh5,-2); } } } @@ -529,6 +544,7 @@ Commands->Set_Facing(gdiveh1,gdiveh1fac); gdiveh1id = Commands->Get_ID(gdiveh1); Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh1,-2); } } if (!Commands->Find_Object(gdiveh2id)) @@ -541,6 +557,7 @@ Commands->Set_Facing(gdiveh2,gdiveh2fac); gdiveh2id = Commands->Get_ID(gdiveh2); Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh2,-2); } } if (!Commands->Find_Object(gdiveh3id)) @@ -553,6 +570,7 @@ Commands->Set_Facing(gdiveh3,gdiveh3fac); gdiveh3id = Commands->Get_ID(gdiveh3); Attach_Script_Once(gdiveh3,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh3,-2); } } if (!Commands->Find_Object(gdiveh4id)) @@ -565,6 +583,7 @@ Commands->Set_Facing(gdiveh4,gdiveh4fac); gdiveh4id = Commands->Get_ID(gdiveh4); Attach_Script_Once(gdiveh4,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh4,-2); } } if (!Commands->Find_Object(gdiveh5id)) @@ -577,6 +596,7 @@ Commands->Set_Facing(gdiveh5,gdiveh5fac); gdiveh5id = Commands->Get_ID(gdiveh5); Attach_Script_Once(gdiveh5,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh5,-2); } } } diff -uwr sourceold/scripts/tcw_frost.cpp source/scripts/tcw_frost.cpp --- sourceold/scripts/tcw_frost.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_frost.cpp 2012-07-31 21:54:12.125976500 +0800 @@ -25,6 +25,8 @@ void tcw_frost_node::Created(GameObject *obj) { + spawnpad1 = Get_Int_Parameter("SpawnPad1ID"); + spawnpad2 = Get_Int_Parameter("SpawnPad2ID"); Commands->Start_Timer(obj,this,60.0f,100100);//start spawncheck for vehicles for nod Commands->Start_Timer(obj,this,60.0f,100101);//start spawncheck for vehicles for gdi int nodeteam = Get_Int_Parameter("PreTeam"); @@ -43,10 +45,12 @@ if (Commands->Find_Object(spawnpad1)) { Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad1),0); } if (Commands->Find_Object(spawnpad2)) { Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad2),0); } if (!Commands->Find_Object(nodveh1id)) { @@ -58,6 +62,7 @@ Commands->Set_Facing(nodveh1,nodveh1fac); nodveh1id = Commands->Get_ID(nodveh1); Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh1,-2); } } if (!Commands->Find_Object(nodveh2id)) @@ -70,6 +75,7 @@ Commands->Set_Facing(nodveh2,nodveh2fac); nodveh2id = Commands->Get_ID(nodveh2); Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh2,-2); } } } @@ -88,10 +94,12 @@ if (Commands->Find_Object(spawnpad1)) { Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad1),1); } if (Commands->Find_Object(spawnpad2)) { Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad2),1); } if (!Commands->Find_Object(gdiveh1id)) @@ -104,6 +112,7 @@ Commands->Set_Facing(gdiveh1,gdiveh1fac); gdiveh1id = Commands->Get_ID(gdiveh1); Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh1,-2); } } if (!Commands->Find_Object(gdiveh2id)) @@ -116,6 +125,7 @@ Commands->Set_Facing(gdiveh2,gdiveh2fac); gdiveh2id = Commands->Get_ID(gdiveh2); Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh2,-2); } } } @@ -157,11 +167,13 @@ Commands->Set_Animation(obj,"DOM_NODE.DOM_NODE",false,0,0,0,false); if (Commands->Find_Object(spawnpad1)) { + Commands->Set_Player_Type(Commands->Find_Object(spawnpad1),0); Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); } if (Commands->Find_Object(spawnpad2)) { Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,0,0,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad2),0); } if (!Commands->Find_Object(nodveh1id)) @@ -174,6 +186,7 @@ Commands->Set_Facing(nodveh1,nodveh1fac); nodveh1id = Commands->Get_ID(nodveh1); Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh1,-2); } } if (!Commands->Find_Object(nodveh2id)) @@ -186,6 +199,7 @@ Commands->Set_Facing(nodveh2,nodveh2fac); nodveh2id = Commands->Get_ID(nodveh2); Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh2,-2); } } @@ -208,10 +222,12 @@ if (Commands->Find_Object(spawnpad1)) { Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad1),1); } if (Commands->Find_Object(spawnpad2)) { Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad2),1); } if (!Commands->Find_Object(gdiveh1id)) @@ -224,6 +240,7 @@ Commands->Set_Facing(gdiveh1,gdiveh1fac); gdiveh1id = Commands->Get_ID(gdiveh1); Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh1,-2); } } if (!Commands->Find_Object(gdiveh2id)) @@ -236,6 +253,7 @@ Commands->Set_Facing(gdiveh2,gdiveh2fac); gdiveh2id = Commands->Get_ID(gdiveh2); Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh2,-2); } } @@ -258,6 +276,8 @@ if (trigger_neutral_damage) { trigger_neutral_damage = false; + Commands->Set_Player_Type(Commands->Find_Object(spawnpad1),-2); + Commands->Set_Player_Type(Commands->Find_Object(spawnpad2),-2); Commands->Set_Animation(Commands->Find_Object(spawnpad1),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); Commands->Set_Animation(Commands->Find_Object(spawnpad2),"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,2,2,false); Remove_Script(obj,"tcw_domination_pointgen"); @@ -266,6 +286,10 @@ if (owner == 0) { Create_2D_WAV_Sound_Team("ControlPointLost_Nod.wav",0); + + char lostcp[512]; + sprintf(lostcp,"Control Point Lost: %s",nodename); + Send_Message_Team(0,255,255,255,lostcp); if ( (Commands->Find_Object(nodveh1id)) && (!Get_Vehicle_Driver(Commands->Find_Object(nodveh1id))) ) { Commands->Apply_Damage(Commands->Find_Object(nodveh1id),99999.0f,"Steel",obj); nodveh1id = 0; @@ -278,6 +302,9 @@ else if (owner == 1) { Create_2D_WAV_Sound_Team("ControlPointLost_GDI.wav",1); + char lostcp[512]; + sprintf(lostcp,"Control Point Lost: %s",nodename); + Send_Message_Team(1,255,255,255,lostcp); if ( (Commands->Find_Object(gdiveh1id)) && (!Get_Vehicle_Driver(Commands->Find_Object(gdiveh1id))) ) { Commands->Apply_Damage(Commands->Find_Object(gdiveh1id),99999.0f,"Steel",obj); gdiveh1id = 0; @@ -308,6 +335,7 @@ Commands->Set_Facing(nodveh1,nodveh1fac); nodveh1id = Commands->Get_ID(nodveh1); Attach_Script_Once(nodveh1,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh1,-2); } } if (!Commands->Find_Object(nodveh2id)) @@ -320,6 +348,7 @@ Commands->Set_Facing(nodveh2,nodveh2fac); nodveh2id = Commands->Get_ID(nodveh2); Attach_Script_Once(nodveh2,"tcw_domination_vehicle","0"); + Commands->Set_Player_Type(nodveh2,-2); } } } @@ -339,6 +368,7 @@ Commands->Set_Facing(gdiveh1,gdiveh1fac); gdiveh1id = Commands->Get_ID(gdiveh1); Attach_Script_Once(gdiveh1,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh1,-2); } } if (!Commands->Find_Object(gdiveh2id)) @@ -351,6 +381,7 @@ Commands->Set_Facing(gdiveh2,gdiveh2fac); gdiveh2id = Commands->Get_ID(gdiveh2); Attach_Script_Once(gdiveh2,"tcw_domination_vehicle","1"); + Commands->Set_Player_Type(gdiveh2,-2); } } } diff -uwr sourceold/scripts/tcw_functions.cpp source/scripts/tcw_functions.cpp --- sourceold/scripts/tcw_functions.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_functions.cpp 2012-07-31 21:54:12.174804600 +0800 @@ -30,7 +30,7 @@ bool Is_TCW_Engineer(GameObject *Obj) { - if ( strcmp(Commands->Get_Preset_Name(Obj),"TCW_Nod_Saboteur") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_Nod_Saboteur_Low") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_GDI_Engineer") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_GDI_Engineer_Low") == 0 ) + if ( strcmp(Commands->Get_Preset_Name(Obj),"TCW_Nod_Saboteur") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_Nod_Saboteur_Low") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_GDI_Engineer") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_GDI_Engineer_Low") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_GDI_Engineer_Coop") == 0 || strcmp(Commands->Get_Preset_Name(Obj),"TCW_Nod_Saboteur_Coop") == 0) return true; else return false; diff -uwr sourceold/scripts/tcw_game.cpp source/scripts/tcw_game.cpp --- sourceold/scripts/tcw_game.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_game.cpp 2012-07-31 21:54:12.225585900 +0800 @@ -70,11 +70,11 @@ void tcw_Map_Intro::Created(GameObject *obj) { - Commands->Start_Timer(obj,this,10.0f,251); - Commands->Start_Timer(obj,this,13.0f,252); - Commands->Start_Timer(obj,this,16.0f,253); - Commands->Start_Timer(obj,this,19.0f,254); - Commands->Start_Timer(obj,this,22.0f,255); + Commands->Start_Timer(obj,this,15.0f,251); + Commands->Start_Timer(obj,this,18.0f,252); + Commands->Start_Timer(obj,this,21.0f,253); + Commands->Start_Timer(obj,this,24.0f,254); + Commands->Start_Timer(obj,this,27.0f,255); } void tcw_Map_Intro::Timer_Expired(GameObject *obj, int number) { @@ -333,6 +333,13 @@ } } +void tcw_snipe_only_building::Created(GameObject *obj) +{ + Set_Damage_Points(obj,0.0f); + Set_Skin(obj,"Blamo"); +} + +ScriptRegistrant tcw_snipe_only_building_Registrant("tcw_snipe_only_building",""); ScriptRegistrant tcw_Spawner_Enable_Timer_Registrant("tcw_Spawner_Enable_Timer","Enable_After_Seconds=1000:float,SpawnerID=0:int"); ScriptRegistrant tcw_destroyed_send_custom_Registrant("tcw_destroyed_send_custom","Message=1000:int,SendID=1000:int,Param=1:int"); ScriptRegistrant tcw_dm_map_tech1_Registrant("tcw_dm_map_tech1",""); diff -uwr sourceold/scripts/tcw_game.h source/scripts/tcw_game.h --- sourceold/scripts/tcw_game.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_game.h 2012-07-31 21:54:12.061523400 +0800 @@ -77,6 +77,10 @@ void Timer_Expired(GameObject *obj, int number); }; +class tcw_snipe_only_building : public ScriptImpClass { + void Created(GameObject *obj); +}; + diff -uwr sourceold/scripts/tcw_mcv_escort.cpp source/scripts/tcw_mcv_escort.cpp --- sourceold/scripts/tcw_mcv_escort.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_mcv_escort.cpp 2012-07-31 21:54:12.134765600 +0800 @@ -36,7 +36,8 @@ Commands->Set_Animation(obj,"NEU_PLATFRM_2.NEU_PLATFRM_2",false,0,1,1,false); Console_Input("amsg The MCV was successfully escorted to the GDI Base."); Commands->Start_Timer(obj,this,5.5f,100); - Remove_Script(sender,"tcw_mcv_escort_mcv"); + Remove_Script(sender,"tcw_mcv_escort_mcv");//sender is wrong, should be the mcv not the sender + //set skin of mcv to blamo } } } Only in source/scripts: tcw_mission01.cpp Only in source/scripts: tcw_mission01.h Only in source/scripts: tcw_mission03.cpp Only in source/scripts: tcw_mission03.h Only in source/scripts: tcw_nod_incursion.cpp Only in source/scripts: tcw_nod_incursion.h Only in source/scripts: tcw_paul.cpp Only in source/scripts: tcw_paul.h diff -uwr sourceold/scripts/tcw_player.cpp source/scripts/tcw_player.cpp --- sourceold/scripts/tcw_player.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_player.cpp 2012-08-02 12:51:48.533203100 +0800 @@ -14,20 +14,24 @@ #include "General.h" #include "scripts.h" #include "engine.h" +#include "SoldierGameObj.h" #include "tcw_player.h" #ifdef SSGM #include "gmgame.h" #endif +#pragma warning(disable: 4239) + void tcw_Grant_Powerup_Created::Created(GameObject *obj)//with this script we can do to players what we want easily { - map_low_grav = false; map_dm_tech1 = false; map_dm_tech2 = false; map_dm_tech3 = false; map_coop_gdi = false; map_coop_nod = false; + map_low_grav = false; map_dm_tech1 = false; map_dm_tech2 = false; map_dm_tech3 = false; map_coop_gdi = false; map_coop_nod = false; map_sniper_only = false; if (Find_Object_By_Preset(2,"TCW_Low_Grav_Map")) { map_low_grav = true; } if (Find_Object_By_Preset(2,"TCW_DM_Tech1")) { map_dm_tech1 = true; }//no snipers, shadows and commando's if (Find_Object_By_Preset(2,"TCW_DM_Tech2")) { map_dm_tech2 = true; }//no commando's if (Find_Object_By_Preset(2,"TCW_DM_Tech3")) { map_dm_tech3 = true; }//no limitations if (Find_Object_By_Preset(2,"TCW_Coop_Map_GDI")) { map_coop_gdi = true; } if (Find_Object_By_Preset(2,"TCW_Coop_Map_Nod")) { map_coop_nod = true; } + if (Find_Object_By_Preset(2,"TCW_Sniper_Only_Map")) { map_sniper_only = true; } if (map_coop_nod) { @@ -37,7 +41,13 @@ { if (Commands->Get_Player_Type(obj) == 0) { Change_Team(obj,1); } } - + else if (map_sniper_only) + { + if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Sniper") != 0) + { + Change_Character(obj,"TCW_GDI_Sniper"); + } + } if (map_dm_tech1) { int randomchargdi = Commands->Get_Random_Int(1,5); int randomcharnod = Commands->Get_Random_Int(1,5); @@ -217,7 +227,12 @@ if (Find_Object_By_Preset(2,"TCW_Tech_Composit_Armor_Available")) { upgrade_composit_armor_available = true; } if (Find_Object_By_Preset(2,"TCW_Tech_Power_Packs_Available")) { upgrade_powerpacks_available = true; } - int sniperlimit = 2; + int sniperlimit; + if (map_sniper_only) + { + sniperlimit = 100; + } + else sniperlimit = 2; commandocurrpos.X = 0; commandocurrpos.Y = 0; commandocurrpos.Z = 0; commandonewpos.X = 0; commandonewpos.Y = 0; commandonewpos.Z = 0; @@ -233,10 +248,13 @@ } else if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Sniper") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Sniper_Low") == 0) ) { + if (!map_sniper_only) + { Commands->Enable_Stealth(obj,true); commandocurrpos = Commands->Get_Position(obj); Commands->Start_Timer(obj,this,1.0f,1006);//check move enable stealth } + } //grant weapon stuff when they spawn const char *weapon1 = Get_Parameter("Weapon1"); const char *weapon2 = Get_Parameter("Weapon2"); const char *weapon3 = Get_Parameter("Weapon3"); const char *weapon4 = Get_Parameter("Weapon4"); const char *weapon5 = Get_Parameter("Weapon5"); @@ -247,7 +265,7 @@ if (_stricmp(weapon5,"0") != 0) { Commands->Give_PowerUp(obj,weapon5,false); } //unit purchase sounds - int random = Commands->Get_Random_Int(1,3);//used by char purchase playsound + int random = Commands->Get_Random_Int(1,6);//used by char purchase playsound if ( (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Commando") == 0) || (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Commando_Low") == 0) ) { if (Commands->Get_Player_Type(obj) == 1) @@ -287,7 +305,7 @@ char player[250]; sprintf(player,"%s: Didn't miss anything, did i?.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (rnd == 5) + else { Create_2D_WAV_Sound_Team("purchase_gdi_commando_5.wav",1); char player[250]; sprintf(player,"%s: Let's load and lock and roll and rock.",Get_Player_Name(obj)); @@ -332,7 +350,7 @@ char player[250]; sprintf(player,"%s: Didn't miss anything, did i?.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (rnd == 5) + else { Create_2D_WAV_Sound_Team("purchase_gdi_commando_5.wav",0); char player[250]; sprintf(player,"%s: Let's load and lock and roll and rock.",Get_Player_Name(obj)); @@ -358,7 +376,7 @@ char player[250]; sprintf(player,"%s: Reporting in.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_rifle_squad_3.wav",1); char player[250]; sprintf(player,"%s: Rifleman awaiting orders.",Get_Player_Name(obj)); @@ -366,7 +384,8 @@ } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Rifle_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } else if (Commands->Get_Player_Type(obj) == 0) @@ -383,7 +402,7 @@ char player[250]; sprintf(player,"%s: Rifle squad ready.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_rifle_squad_3.wav",0); char player[250]; sprintf(player,"%s: Rifleman awaiting orders.",Get_Player_Name(obj)); @@ -406,7 +425,7 @@ char player[250]; sprintf(player,"%s: Rifle squad ready.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_rifle_squad_3.wav",1); char player[250]; sprintf(player,"%s: Rifleman awaiting orders.",Get_Player_Name(obj)); @@ -414,7 +433,8 @@ } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Rifle_Low_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } @@ -434,7 +454,7 @@ char player[250]; sprintf(player,"%s: Engineer clocking in.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_engineer_3.wav",1); char player[250]; sprintf(player,"%s: Engineer reporting in.",Get_Player_Name(obj)); @@ -455,7 +475,7 @@ char player[250]; sprintf(player,"%s: Engineer clocking in.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_engineer_3.wav",0); char player[250]; sprintf(player,"%s: Engineer reporting in.",Get_Player_Name(obj)); @@ -479,15 +499,16 @@ char player[250]; sprintf(player,"%s: Somebody call for some blasting?",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_grenadier_3.wav",1); - char player[250]; sprintf(player,"%s: Grenade squad all ready.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Pull your pins.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Grenadier_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } else if (Commands->Get_Player_Type(obj) == 0) @@ -504,10 +525,10 @@ char player[250]; sprintf(player,"%s: Somebody call for some blasting?",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_grenadier_3.wav",0); - char player[250]; sprintf(player,"%s: Grenade squad all ready.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Pull your pins.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } @@ -526,15 +547,16 @@ char player[250]; sprintf(player,"%s: Somebody call for some blasting?",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_grenadier_3.wav",1); - char player[250]; sprintf(player,"%s: Grenade squad all ready.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Pull your pins.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Grenadier_Low_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } @@ -554,7 +576,7 @@ char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_missile_squad_1.wav",1); char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); @@ -562,7 +584,8 @@ } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Missile_Squad_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } else if (Commands->Get_Player_Type(obj) == 0) @@ -579,7 +602,7 @@ char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_missile_squad_1.wav",0); char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); @@ -601,7 +624,7 @@ char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_missile_squad_1.wav",1); char player[250]; sprintf(player,"%s: Launcher's ready.",Get_Player_Name(obj)); @@ -609,7 +632,8 @@ } if (upgrade_composit_armor_available) { - Change_Character(obj,"TCW_GDI_Missile_Squad_Low_Upgrade"); + Set_Max_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj)+75.0f); + Commands->Set_Shield_Strength(obj,Commands->Get_Health(obj)+75.0f); } } @@ -638,10 +662,10 @@ char player[250]; sprintf(player,"%s: I got'm in my scope.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_sniper_3.wav",1); - char player[250]; sprintf(player,"%s: Sniper team, where do you need us?",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Need somebody taken out?",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } } @@ -669,10 +693,10 @@ char player[250]; sprintf(player,"%s: Sniper team ready.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_sniper_3.wav",0); - char player[250]; sprintf(player,"%s: Sniper team, where do you need us?",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Need somebody taken out?",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } @@ -705,6 +729,12 @@ char player[250]; sprintf(player,"%s: Troopers in the field.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_zonetrooper_4.wav",1); + char player[250]; sprintf(player,"%s: Sit tight.",Get_Player_Name(obj)); + Send_Message_Team(1,255,204,0,player); + } } else if (Commands->Get_Player_Type(obj) == 0) { @@ -726,6 +756,12 @@ char player[250]; sprintf(player,"%s: Troopers in the field.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_zonetrooper_4.wav",0); + char player[250]; sprintf(player,"%s: Sit tight.",Get_Player_Name(obj)); + Send_Message_Team(0,255,0,0,player); + } } } else if ( (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Commando") == 0) || (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Commando_Low") == 0) ) @@ -751,13 +787,13 @@ else if (random == 2) { Create_2D_WAV_Sound_Team("purchase_nod_commando_2.wav",0); - char player[250]; sprintf(player,"%s: Ready for assignment.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: It's play time.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { - Create_2D_WAV_Sound_Team("purchase_nod_commando_2.wav",0); - char player[250]; sprintf(player,"%s: Ready for assignment.",Get_Player_Name(obj)); + Create_2D_WAV_Sound_Team("purchase_nod_commando_3.wav",0); + char player[250]; sprintf(player,"%s: Sorry about the mess.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } @@ -783,13 +819,13 @@ else if (random == 2) { Create_2D_WAV_Sound_Team("purchase_nod_commando_2.wav",1); - char player[250]; sprintf(player,"%s: Ready for assignment.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: It's play time.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_commando_3.wav",1); - char player[250]; sprintf(player,"%s: It's play time.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Sorry about the mess.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } } @@ -817,6 +853,12 @@ char player[250]; sprintf(player,"%s: Fighters arm up.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_militant_squad_4.wav",0); + char player[250]; sprintf(player,"%s: Fight for Nod.",Get_Player_Name(obj)); + Send_Message_Team(0,255,0,0,player); + } } else if (Commands->Get_Player_Type(obj) == 1) { @@ -836,7 +878,13 @@ { Create_2D_WAV_Sound_Team("purchase_nod_militant_squad_3.wav",1); char player[250]; sprintf(player,"%s: Fighters arm up.",Get_Player_Name(obj)); - Send_Message_Team(0,255,204,0,player); + Send_Message_Team(1,255,204,0,player); + } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_militant_squad_4.wav",1); + char player[250]; sprintf(player,"%s: Fight for Nod.",Get_Player_Name(obj)); + Send_Message_Team(1,255,204,0,player); } } } @@ -854,7 +902,7 @@ char player[250]; sprintf(player,"%s: The Black Hand is in control.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_blackhand_chem_3.wav",0); char player[250]; sprintf(player,"%s: The Black Hand has arrived.",Get_Player_Name(obj)); @@ -865,7 +913,7 @@ { if (Commands->Get_Player_Type(obj) == 0) { - int rnd = Commands->Get_Random_Int(1,4); + int rnd = Commands->Get_Random_Int(1,5); if (rnd == 1) { Create_2D_WAV_Sound_Team("purchase_nod_blackhand_flame_1.wav",0); @@ -884,16 +932,16 @@ char player[250]; sprintf(player,"%s: They cannot hide from the Black Hand.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (rnd == 4) + else { Create_2D_WAV_Sound_Team("purchase_nod_blackhand_flame_4.wav",0); - char player[250]; sprintf(player,"%s: And then there was fire.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Spare no one.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } else if (Commands->Get_Player_Type(obj) == 1) { - int rnd = Commands->Get_Random_Int(1,4); + int rnd = Commands->Get_Random_Int(1,5); if (rnd == 1) { Create_2D_WAV_Sound_Team("purchase_nod_blackhand_flame_1.wav",1); @@ -912,10 +960,10 @@ char player[250]; sprintf(player,"%s: The flame shall purify.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (rnd == 4) + else { Create_2D_WAV_Sound_Team("purchase_nod_blackhand_flame_4.wav",1); - char player[250]; sprintf(player,"%s: And then there was fire.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: Spare no one.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } } @@ -936,7 +984,7 @@ char player[250]; sprintf(player,"%s: Rockets ready.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_militant_rocket_squad_3.wav",0); char player[250]; sprintf(player,"%s: We got the rockets.",Get_Player_Name(obj)); @@ -957,7 +1005,7 @@ char player[250]; sprintf(player,"%s: Rockets ready.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_militant_rocket_squad_3.wav",1); char player[250]; sprintf(player,"%s: We got the rockets.",Get_Player_Name(obj)); @@ -981,10 +1029,10 @@ char player[250]; sprintf(player,"%s: Need help with anything?",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { - Create_2D_WAV_Sound_Team("purchase_nod_saboteur_1.wav",0); - char player[250]; sprintf(player,"%s: The Brotherhood has entrusted me.",Get_Player_Name(obj)); + Create_2D_WAV_Sound_Team("purchase_nod_saboteur_3.wav",0); + char player[250]; sprintf(player,"%s: You can trust me.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } @@ -1002,10 +1050,10 @@ char player[250]; sprintf(player,"%s: Need help with anything?",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { - Create_2D_WAV_Sound_Team("purchase_nod_saboteur_1.wav",1); - char player[250]; sprintf(player,"%s: The Brotherhood has entrusted me.",Get_Player_Name(obj)); + Create_2D_WAV_Sound_Team("purchase_nod_saboteur_3.wav",1); + char player[250]; sprintf(player,"%s: You can trust me.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } } @@ -1023,13 +1071,13 @@ else if (random == 2) { Create_2D_WAV_Sound_Team("purchase_nod_shadow_2.wav",0); - char player[250]; sprintf(player,"%s: Shadow team at your command.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: The wings of Nod.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_shadow_2.wav",0); - char player[250]; sprintf(player,"%s: Shadow team at your command.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: The wings of Nod.",Get_Player_Name(obj)); Send_Message_Team(0,255,0,0,player); } } @@ -1044,13 +1092,13 @@ else if (random == 2) { Create_2D_WAV_Sound_Team("purchase_nod_shadow_2.wav",1); - char player[250]; sprintf(player,"%s: Shadow team at your command.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: The wings of Nod.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_nod_shadow_2.wav",1); - char player[250]; sprintf(player,"%s: Shadow team at your command.",Get_Player_Name(obj)); + char player[250]; sprintf(player,"%s: The wings of Nod.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,player); } } @@ -1085,9 +1133,11 @@ } else if (number == 1007)//used for zonetrooper repair powerpacks { + if (!Get_Vehicle(obj)) + { commandonewpos = Commands->Get_Position(obj); - float commandotraveldistance = Commands->Get_Distance(commandocurrpos,commandonewpos); - if (commandotraveldistance <= 0.1f) // not moved... + float zonetroopertraveldistance = Commands->Get_Distance(commandocurrpos,commandonewpos); + if (zonetroopertraveldistance <= 0.1f) // not moved... { if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Zonetrooper") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Zonetrooper_Low") == 0) && (Commands->Get_Player_Type(obj) == 1)) { @@ -1101,16 +1151,26 @@ } if (curap < maxap) { - Commands->Set_Health(obj,curap+5.0f); + Commands->Set_Shield_Strength(obj,curap+5.0f); + } + Commands->Start_Timer(obj,this,3.0f,1007); + } } + else + { + commandocurrpos = Commands->Get_Position(obj);//new current position, moved.. Commands->Start_Timer(obj,this,3.0f,1007); } } + else + { + Commands->Start_Timer(obj,this,3.0f,1007); + } } } void tcw_Grant_Powerup_Created::Killed(GameObject *obj, GameObject *shooter) { - Commands->Send_Custom_Event(obj,shooter,1003,1,0); + //placeholder } void tcw_Grant_Powerup_Created::Custom(GameObject *obj, int message, int param, GameObject *sender) { @@ -1260,16 +1320,17 @@ float newhp = curhp + 30.0f; Commands->Set_Health(obj, newhp); float newap = curap + 30.0f; Commands->Set_Shield_Strength(obj, newap); Create_2D_WAV_Sound_Player(obj,"gdi_tech_unit_upgraded.wav"); - Send_Message_Player(obj,255,204,0,"Unit Upgraded: Composite Armor."); + Send_Message_Player(obj,5,220,220,"Unit Upgraded: Composite Armor."); } } else if (message == 1006)//Tech Powerpacks Upgrade complete { if (param == 1) { + commandocurrpos = Commands->Get_Position(obj); Commands->Start_Timer(obj,this,1.0f,1007);//start regeneration if not moved Create_2D_WAV_Sound_Player(obj,"gdi_tech_unit_upgraded.wav"); - Send_Message_Player(obj,255,204,0,"Unit Upgraded: Power Packs."); + Send_Message_Player(obj,5,220,220,"Unit Upgraded: Power Packs."); } } } @@ -1288,4 +1349,34 @@ Auto_Save_Variable(&map_coop_nod,sizeof(map_coop_nod),11); } +void tcw_fanatic::Created(GameObject *obj) +{ + if (!Commands->Is_A_Star(obj)) + { + Destroy_Script(); + return; + } + DetonateTime = Get_Float_Parameter("DetonateTime"); + RunSpeed = Get_Float_Parameter("RunSpeed"); + Explosion = Get_Parameter("Explosion"); + InstallHook("FanaticExplode",obj); +} + +void tcw_fanatic::Timer_Expired(GameObject *obj, int number) +{ + if (number == 1) + { + Create_Explosion_Extended(Explosion,Commands->Get_Position(obj),obj); + } +} + +void tcw_fanatic::KeyHook() +{ + RemoveHook(); + Owner()->As_SoldierGameObj()->Set_Max_Speed(RunSpeed); + Owner()->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true); + Commands->Start_Timer(Owner(),this,DetonateTime,1); +} + +ScriptRegistrant tcw_fanatic_Registrant("tcw_fanatic","DetonateTime=30:float,RunSpeed=5:float,Explosion:string"); ScriptRegistrant tcw_Grant_Powerup_Created_Registrant("tcw_Grant_Powerup_Created","Weapon1=TCW_POW_Knife:string,Weapon2=0:string,Weapon3=0:string,Weapon4=0:string,Weapon5=0:string"); \ No newline at end of file diff -uwr sourceold/scripts/tcw_player.h source/scripts/tcw_player.h --- sourceold/scripts/tcw_player.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_player.h 2012-08-02 12:51:48.537109300 +0800 @@ -31,6 +31,17 @@ bool map_dm_tech3; bool map_coop_gdi; bool map_coop_nod; + bool map_sniper_only; Vector3 commandocurrpos; Vector3 commandonewpos; }; \ No newline at end of file + +class tcw_fanatic : public JFW_Key_Hook_Base +{ + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj, int number); + void KeyHook(); + float DetonateTime; + float RunSpeed; + const char *Explosion; +}; \ No newline at end of file Only in source/scripts: tcw_sp_m01.cpp Only in source/scripts: tcw_sp_m01.h Only in source/scripts: tcw_sp_scripts.cpp Only in source/scripts: tcw_sp_scripts.h diff -uwr sourceold/scripts/tcw_superweapons.cpp source/scripts/tcw_superweapons.cpp --- sourceold/scripts/tcw_superweapons.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_superweapons.cpp 2012-07-31 21:54:12.184570300 +0800 @@ -30,26 +30,20 @@ void tcw_pt_ion::Created(GameObject *obj) { Commands->Enable_HUD_Pokable_Indicator(obj, true); - someone_has_ion = false; allowpoke = true; ionready = false; Create_2D_WAV_Sound_Team("gdi_ion_cannon_charging.wav",1); Send_Message_Team(1,255,255,255,"Ion Cannon charging"); - Commands->Start_Timer(obj,this,420.0f,100100);//420=7min + Commands->Start_Timer(obj,this,240.0f,100100);//420=7min } void tcw_pt_ion::Custom(GameObject *obj, int message, int param, GameObject *sender) { if (message == 1000) { - if (param == 1)//person holding the ion died or left game or whatever nub he did + if (param == 2)//successful beacon placed, start recharging { - someone_has_ion = false; - } - else if (param == 2)//successful beacon placed, start recharging - { - someone_has_ion = false; ionready = false; - Commands->Start_Timer(obj,this,420.0f,100100);//recharge the ion + Commands->Start_Timer(obj,this,240.0f,100100);//recharge the ion } } } @@ -89,7 +83,7 @@ allowpoke = false; Commands->Enable_HUD_Pokable_Indicator(obj, false); Commands->Start_Timer(obj,this,5.0f,100101);//alowpoke true - if (someone_has_ion) + if (Find_Object_With_Script("tcw_i_have_ion_beacon"))//someone has ion already { char currholdermsg[250]; sprintf(currholdermsg,"Sorry, %s currently has the Ion Cannon Beacon.",Get_Player_Name(Find_Object_With_Script("tcw_i_have_ion_beacon"))); @@ -99,7 +93,6 @@ { if (ionready) { - someone_has_ion = true; Attach_Script_Once(poker,"tcw_i_have_ion_beacon",""); Commands->Give_PowerUp(poker,"TCW_POW_Beacon_IonCannon_60Sec",false); char pickupmsg[250]; @@ -122,9 +115,8 @@ } void tcw_pt_ion::Register_Auto_Save_Variables() { - Auto_Save_Variable(&someone_has_ion,sizeof(someone_has_ion),1); - Auto_Save_Variable(&allowpoke,sizeof(allowpoke),2); - Auto_Save_Variable(&ionready,sizeof(ionready),3); + Auto_Save_Variable(&allowpoke,sizeof(allowpoke),1); + Auto_Save_Variable(&ionready,sizeof(ionready),2); } void tcw_gdi_ion_cannon_building::Custom(GameObject *obj, int message, int param, GameObject *sender) @@ -157,32 +149,26 @@ //NUKE SCRIPTS HERE void tcw_i_have_nuke_beacon::Destroyed(GameObject *obj) { - Commands->Send_Custom_Event(obj,Find_Object_With_Script("tcw_pt_nuke"),1000,1,0);//someone has ion is false + Commands->Send_Custom_Event(obj,Find_Object_With_Script("tcw_pt_nuke"),1000,1,0);//someone has nuke is false } void tcw_pt_nuke::Created(GameObject *obj) { Commands->Enable_HUD_Pokable_Indicator(obj, true); - someone_has_ion = false; allowpoke = true; ionready = false; Create_2D_WAV_Sound_Team("nod_nuke_charging.wav",0); Send_Message_Team(0,255,255,255,"Nuclear Missile charging"); - Commands->Start_Timer(obj,this,420.0f,100100); + Commands->Start_Timer(obj,this,240.0f,100100); } void tcw_pt_nuke::Custom(GameObject *obj, int message, int param, GameObject *sender) { if (message == 1000) { - if (param == 1)//person holding the ion died or left game or whatever nub he did - { - someone_has_ion = false; - } - else if (param == 2)//successful beacon placed, start recharging + if (param == 2)//successful beacon placed, start recharging { - someone_has_ion = false; ionready = false; - Commands->Start_Timer(obj,this,420.0f,100100);//recharge the ion + Commands->Start_Timer(obj,this,240.0f,100100);//recharge the nuke } } } @@ -213,7 +199,7 @@ } else { - if (Is_Building_Dead(Find_Building_By_Preset(1,"TCW_Temple_of_Nod"))) + if (Is_Building_Dead(Find_Building_By_Preset(0,"TCW_Temple_of_Nod"))) { Send_Message_Player(poker,255,255,255,"Your Temple of Nod is destroyed. The Nuclear Missile is unavailable."); } @@ -222,7 +208,7 @@ allowpoke = false; Commands->Enable_HUD_Pokable_Indicator(obj, false); Commands->Start_Timer(obj,this,5.0f,100101);//alowpoke true - if (someone_has_ion) + if (Find_Object_With_Script("tcw_i_have_nuke_beacon")) { char currholdermsg[250]; sprintf(currholdermsg,"Sorry, %s currently has the Nuclear Missile Beacon.",Get_Player_Name(Find_Object_With_Script("tcw_i_have_nuke_beacon"))); @@ -232,7 +218,6 @@ { if (ionready) { - someone_has_ion = true; Attach_Script_Once(poker,"tcw_i_have_nuke_beacon",""); Commands->Give_PowerUp(poker,"TCW_POW_Beacon_Nuke_60Sec",false); char pickupmsg[250]; @@ -255,9 +240,8 @@ } void tcw_pt_nuke::Register_Auto_Save_Variables() { - Auto_Save_Variable(&someone_has_ion,sizeof(someone_has_ion),1); - Auto_Save_Variable(&allowpoke,sizeof(allowpoke),2); - Auto_Save_Variable(&ionready,sizeof(ionready),3); + Auto_Save_Variable(&allowpoke,sizeof(allowpoke),1); + Auto_Save_Variable(&ionready,sizeof(ionready),2); } void tcw_nod_nuke_building::Created(GameObject *obj) diff -uwr sourceold/scripts/tcw_superweapons.h source/scripts/tcw_superweapons.h --- sourceold/scripts/tcw_superweapons.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_superweapons.h 2012-07-31 21:54:12.031250000 +0800 @@ -26,7 +26,6 @@ public: void Register_Auto_Save_Variables(); bool ionready; bool allowpoke; -bool someone_has_ion; }; class tcw_gdi_ion_cannon_building : public ScriptImpClass { @@ -47,7 +46,6 @@ public: void Register_Auto_Save_Variables(); bool ionready; bool allowpoke; -bool someone_has_ion; }; class tcw_nod_nuke_building : public ScriptImpClass { diff -uwr sourceold/scripts/tcw_technology.cpp source/scripts/tcw_technology.cpp --- sourceold/scripts/tcw_technology.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_technology.cpp 2012-07-31 21:54:12.194335900 +0800 @@ -52,7 +52,7 @@ researching_composit_armor_upgrade = true; Commands->Start_Timer(obj,this,20.0f,10001); Create_2D_WAV_Sound_Team("gdi_tech_upgrade_in_progress.wav",1); - Send_Message_Team(1,255,204,0,"Upgrade in progress: Composite Armor."); + Send_Message_Team(1,5,220,220,"Upgrade in progress: Composite Armor."); allowpokegdi = false; } } @@ -92,7 +92,7 @@ Vector3 pos; pos.Z = 999.0f; pos.Y = 999.0f; pos.X = 999.0f; GameObject *compositarmor = Commands->Create_Object("TCW_Tech_Composit_Armor_Available",pos); Commands->Set_Facing(compositarmor,0.0f); - Send_Message_Team(1,255,204,0,"Upgrade Complete: Composite Armor."); + Send_Message_Team(1,5,220,220,"Upgrade Complete: Composite Armor."); Create_2D_WAV_Sound_Team("gdi_tech_upgrade_complete.wav",1); researched_composit_armor_upgrade = true; researching_composit_armor_upgrade = false; @@ -295,7 +295,7 @@ { Commands->Start_Timer(obj,this,15.0f,779902);//start stealing from the gdi wf char stealermsg[250]; - sprintf(stealermsg,"%s is stealing technology from the Nod Weapons Factory.",Get_Player_Name(obj)); + sprintf(stealermsg,"%s is stealing technology from the Nod War Factory.",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,stealermsg); Create_2D_WAV_Sound_Team("building_capture.wav",1); } @@ -363,7 +363,7 @@ Hide_Preset_By_Name(1,"TCW_GDI_Stealth_Tank",false); char stealmsg[250]; - sprintf(stealmsg,"%s has stolen technology from the Nod Weapons Factory",Get_Player_Name(obj)); + sprintf(stealmsg,"%s has stolen technology from the Nod War Factory",Get_Player_Name(obj)); Send_Message_Team(1,255,204,0,stealmsg); Send_Message_Team(1,255,204,0,"New technology acquired."); Create_2D_WAV_Sound_Team("gdi_new_tech_acquired.wav",1); @@ -472,7 +472,7 @@ researching_powerpacks_upgrade = true; Commands->Start_Timer(obj,this,60.0f,10001); Create_2D_WAV_Sound_Team("gdi_tech_upgrade_in_progress.wav",1); - Send_Message_Team(1,255,204,0,"Upgrade in progress: Power Packs."); + Send_Message_Team(1,5,220,220,"Upgrade in progress: Power Packs."); allowpokegdi = false; } } @@ -512,7 +512,7 @@ Vector3 pos; pos.Z = 999.0f; pos.Y = 999.0f; pos.X = 999.0f; GameObject *powerpacks = Commands->Create_Object("TCW_Tech_Power_Packs_Available",pos); Commands->Set_Facing(powerpacks,0.0f); - Send_Message_Team(1,255,204,0,"Upgrade Complete: Power Packs."); + Send_Message_Team(1,5,220,220,"Upgrade Complete: Power Packs."); Create_2D_WAV_Sound_Team("gdi_tech_upgrade_complete.wav",1); researched_powerpacks_upgrade = true; researching_powerpacks_upgrade = false; diff -uwr sourceold/scripts/tcw_tiberium.cpp source/scripts/tcw_tiberium.cpp --- sourceold/scripts/tcw_tiberium.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_tiberium.cpp 2012-08-05 10:29:24.407210900 +0800 @@ -22,10 +22,10 @@ #include "tcw_TCWSoldierObj.h" ///////////////////////////////////////////////////////// -// TCW_TIBERIUM_HARVESTER +// TCW_TIBERIUM_HARVESTER (PLAYER) //////////////////////////////////////////////////////// -float TCW_Tiberium_Harvester::Get_Cash() +float tcw_tiberium_harvester::Get_Cash() { float Return = 0; for(int x = 0; x < 8; x++) @@ -33,14 +33,14 @@ return Return; } -void TCW_Tiberium_Harvester::Clear_Cash() +void tcw_tiberium_harvester::Clear_Cash() { for(int x = 0; x < 8; x++) CashCollected[x] = 0; CashIndex = 0; } -void TCW_Tiberium_Harvester::Created(GameObject *obj) +void tcw_tiberium_harvester::Created(GameObject *obj) { if (Is_TCW_Harvester(obj)) // When we are a harvester.. @@ -62,7 +62,7 @@ Destroy_Script(); // No need to leave the mess... } -void TCW_Tiberium_Harvester::Custom(GameObject *obj, int message, int param, GameObject *sender) +void tcw_tiberium_harvester::Custom(GameObject *obj, int message, int param, GameObject *sender) { if (message == CUSTOM_EVENT_VEHICLE_ENTERED) { @@ -178,7 +178,7 @@ } } -void TCW_Tiberium_Harvester::Timer_Expired(GameObject *obj, int number) +void tcw_tiberium_harvester::Timer_Expired(GameObject *obj, int number) { if(number == CUSTOM_EVENT_TIB_ENTERED && Harvesting && CashIndex < 8) // When in a tib field timer started, harvesting and we're not full do... { // Check what we need to distribute @@ -208,12 +208,12 @@ // TCW_TIBERIUM_FIELD //////////////////////////////////////////////////////// -void TCW_Tiberium_Field::Created(GameObject *obj) +void tcw_tiberium_field::Created(GameObject *obj) { Zonetype = Get_Int_Parameter("Zonetype"); //0=green 1=blue } -void TCW_Tiberium_Field::Entered(GameObject *obj, GameObject *enterer) +void tcw_tiberium_field::Entered(GameObject *obj, GameObject *enterer) { if (Is_TCW_Harvester(enterer)) { @@ -224,7 +224,7 @@ } } -void TCW_Tiberium_Field::Exited(GameObject *obj, GameObject *exiter) +void tcw_tiberium_field::Exited(GameObject *obj, GameObject *exiter) { if ( Is_TCW_Harvester(exiter)) Commands->Send_Custom_Event(obj, exiter, CUSTOM_EVENT_HARVY_LEFT_TIBFIELD, 0, 0);//tell harv left zone @@ -234,17 +234,23 @@ // TCW_TIBERIUM_DEPOSIT //////////////////////////////////////////////////////// -void TCW_Tiberium_Deposit::Entered(GameObject *obj, GameObject *enterer) +void tcw_tiberium_deposit::Entered(GameObject *obj, GameObject *enterer) { if(Is_TCW_Harvester(enterer)) Commands->Send_Custom_Event(obj,enterer, CUSTOM_EVENT_HARVY_DEPOSITING, 0, 0); + + if (strcmp(Commands->Get_Preset_Name(enterer),"TCW_GDI_Harvester") == 0) + { + Commands->Send_Custom_Event(obj, enterer, 12500, 0, 0);//tell harv set idle on + Commands->Send_Custom_Event(obj, enterer, 12505, 0, 0);//tell harv set full off + } } ///////////////////////////////////////////////////////// // TCW_TIBERIUM_SPIKE //////////////////////////////////////////////////////// -void TCW_Tiberium_Spike::Created(GameObject *obj) +void tcw_tiberium_spike::Created(GameObject *obj) { FirstCapture = true; int SpikeTeam = Commands->Get_Player_Type(obj); @@ -253,6 +259,7 @@ Commands->Set_Animation(obj, "V_NEU_SPIKE.V_NEU_SPIKE", true, 0, 0, 0, 0); Set_Skin(obj, "Blamo"); Commands->Set_Health(obj, 1); + alive = false; } else if(SpikeTeam == 0 || SpikeTeam == 1) { @@ -260,10 +267,11 @@ Commands->Set_Health(obj, Commands->Get_Max_Health(obj)); Set_Skin(obj, "CNCMCTSkin"); Commands->Start_Timer(obj, this, 1, 1); + alive = true; } } -void TCW_Tiberium_Spike::Custom(GameObject *obj, int message, int param, GameObject *sender) +void tcw_tiberium_spike::Custom(GameObject *obj, int message, int param, GameObject *sender) { if (message == CUSTOM_EVENT_CAPTURE_SPIKE) { @@ -278,6 +286,7 @@ Commands->Give_Money(sender, 250, true); } Commands->Start_Timer(obj, this, 1, 1); + alive = true; } else if(message == CUSTOM_EVENT_CAPTURE_SPIKE_START_NOD) { @@ -287,6 +296,7 @@ Commands->Set_Animation(obj, "V_NEU_SPIKE.V_NEU_SPIKE", true, 0, 1, -1, 0); Commands->Set_Health(obj, Commands->Get_Max_Health(obj)); Set_Skin(obj, "CNCMCTSkin"); + alive = true; } else if(message == CUSTOM_EVENT_CAPTURE_SPIKE_START_GDI) { @@ -296,10 +306,11 @@ Commands->Set_Animation(obj, "V_NEU_SPIKE.V_NEU_SPIKE", true, 0, 1, -1, 0); Commands->Set_Health(obj, Commands->Get_Max_Health(obj)); Set_Skin(obj, "CNCMCTSkin"); + alive = true; } } -void TCW_Tiberium_Spike::Timer_Expired(GameObject *obj, int number) +void tcw_tiberium_spike::Timer_Expired(GameObject *obj, int number) { if(number == 1 && (Commands->Get_Player_Type(obj) == 0 || Commands->Get_Player_Type(obj) == 1)) { @@ -308,14 +319,32 @@ } } -void TCW_Tiberium_Spike::Damaged(GameObject *obj, GameObject *damager, float damage) +void tcw_tiberium_spike::Damaged(GameObject *obj, GameObject *damager, float damage) { if(damage > Commands->Get_Health(obj) && (Commands->Get_Player_Type(obj) == 0 || Commands->Get_Player_Type(obj) == 1)) { Set_Skin(obj, "Blamo"); Commands->Set_Health(obj, 1); - Commands->Set_Player_Type(obj, -2); Commands->Set_Animation(obj, "V_NEU_SPIKE.V_NEU_SPIKE", true, 0, 0, 0, 0); + if (alive) + { + if (Commands->Get_Player_Type(obj) == 0) + { + Create_2D_WAV_Sound_Team("nod_spike_destroyed.wav",1); + Create_2D_WAV_Sound_Team("nod_spike_lost.wav",0); + Send_Message_Team(0,255,255,255,"Nod Tiberium Spike lost."); + Send_Message_Team(1,255,255,255,"Nod Tiberium Spike destroyed."); + } + else if (Commands->Get_Player_Type(obj) == 1) + { + Create_2D_WAV_Sound_Team("gdi_spike_lost.wav",1); + Create_2D_WAV_Sound_Team("gdi_spike_destroyed.wav",0); + Send_Message_Team(0,255,255,255,"GDI Tiberium Spike destroyed."); + Send_Message_Team(1,255,255,255,"GDI Tiberium Spike lost."); + } + alive = false; + } + Commands->Set_Player_Type(obj, -2); } if(damage < 0 && Commands->Get_Player_Type(obj) == -2) Commands->Set_Health(obj, 1); @@ -325,7 +354,7 @@ // TCW_TIBERIUM_SPIKE_CAPTURE_ZONE //////////////////////////////////////////////////////// -void TCW_Tiberium_Spike_Capture_Zone::Created(GameObject *obj) +void tcw_tiberium_spike_capture::Created(GameObject *obj) { Capturer = 0; SpikeID = Get_Int_Parameter("SpikeID"); @@ -333,7 +362,7 @@ Destroy_Script(); } -void TCW_Tiberium_Spike_Capture_Zone::Entered(GameObject *obj, GameObject *enterer) +void tcw_tiberium_spike_capture::Entered(GameObject *obj, GameObject *enterer) { if(Commands->Is_A_Star(enterer) && !Get_Vehicle(enterer) && !Capturer) { @@ -354,7 +383,7 @@ else { Capturer = enterer->Get_ID(); - Commands->Start_Timer(obj, this, 20, 1); + Commands->Start_Timer(obj, this, 15, 1); if(Commands->Get_Player_Type(enterer) == 0) { Send_Message_Team(0, 255, 0, 0, PackArg("%s is capturing a Tiberium Spike.", Get_Player_Name(enterer))); @@ -369,15 +398,14 @@ } } } - } -void TCW_Tiberium_Spike_Capture_Zone::Exited(GameObject *obj, GameObject *exiter) +void tcw_tiberium_spike_capture::Exited(GameObject *obj, GameObject *exiter) { if (Commands->Is_A_Star(exiter) && exiter->Get_ID() == Capturer) Capturer = 0; } -void TCW_Tiberium_Spike_Capture_Zone::Timer_Expired(GameObject *obj, int number) +void tcw_tiberium_spike_capture::Timer_Expired(GameObject *obj, int number) { if(number == 1) { @@ -427,7 +455,7 @@ } } -void tcw_Set_Spike_Team_Created::Created(GameObject *obj) +void tcw_set_spike_team_created::Created(GameObject *obj) { int team = Get_Int_Parameter("Team"); if (team == 0) @@ -445,13 +473,11 @@ } -ScriptRegistrant tcw_Set_Spike_Team_Created_Registrant("tcw_Set_Spike_Team_Created","Team=0:int"); - -ScriptRegistrant tcw_tiberium_spike_Registrant("tcw_tiberium_spike",""); -ScriptRegistrant tcw_tiberium_spike_capture_Registrant("tcw_tiberium_spike_capture","SpikeID=0:int"); - +ScriptRegistrant tcw_set_spike_team_created_Registrant("tcw_set_spike_team_created","Team=0:int"); +ScriptRegistrant tcw_tiberium_spike_Registrant("tcw_tiberium_spike",""); +ScriptRegistrant tcw_tiberium_spike_capture_Registrant("tcw_tiberium_spike_capture","SpikeID=0:int"); -ScriptRegistrant tcw_Tiberium_Harvester_New_Registrant("tcw_Tiberium_Harvester_New",""); -ScriptRegistrant tcw_Tiberium_Field_New_Registrant("tcw_Tiberium_Field_New","Zonetype=0:int"); -ScriptRegistrant tcw_Tiberium_Deposit_New_Registrant("tcw_Tiberium_Deposit_New",""); +ScriptRegistrant tcw_tiberium_harvester_Registrant("tcw_tiberium_harvester",""); +ScriptRegistrant tcw_tiberium_field_Registrant("tcw_tiberium_field","Zonetype=0:int"); +ScriptRegistrant tcw_tiberium_deposit_Registrant("tcw_tiberium_deposit",""); \ No newline at end of file diff -uwr sourceold/scripts/tcw_tiberium.h source/scripts/tcw_tiberium.h --- sourceold/scripts/tcw_tiberium.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_tiberium.h 2012-08-05 10:29:24.402328100 +0800 @@ -14,7 +14,7 @@ #pragma once -class TCW_Tiberium_Harvester : public ScriptImpClass +class tcw_tiberium_harvester : public ScriptImpClass { void Created(GameObject *obj); void Custom(GameObject *obj, int message, int param, GameObject *sender); @@ -31,7 +31,7 @@ int CashIndex; }; -class TCW_Tiberium_Field : public ScriptImpClass +class tcw_tiberium_field : public ScriptImpClass { void Created(GameObject *obj); void Entered(GameObject *obj, GameObject *enterer); @@ -39,21 +39,22 @@ int Zonetype; }; -class TCW_Tiberium_Deposit : public ScriptImpClass +class tcw_tiberium_deposit : public ScriptImpClass { void Entered(GameObject *obj, GameObject *enterer); }; -class TCW_Tiberium_Spike : public ScriptImpClass +class tcw_tiberium_spike : public ScriptImpClass { void Created(GameObject *obj); void Custom(GameObject *obj, int message, int param, GameObject *sender); void Damaged(GameObject *obj, GameObject *damager, float damage); void Timer_Expired(GameObject *obj, int number); bool FirstCapture; + bool alive; }; -class TCW_Tiberium_Spike_Capture_Zone : public ScriptImpClass +class tcw_tiberium_spike_capture : public ScriptImpClass { void Created(GameObject *obj); void Entered(GameObject *obj, GameObject *enterer); @@ -63,7 +64,7 @@ int SpikeID; }; -class tcw_Set_Spike_Team_Created : public ScriptImpClass { +class tcw_set_spike_team_created : public ScriptImpClass { void Created(GameObject *obj); }; diff -uwr sourceold/scripts/tcw_vehicle.cpp source/scripts/tcw_vehicle.cpp --- sourceold/scripts/tcw_vehicle.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_vehicle.cpp 2012-07-31 21:54:12.141601500 +0800 @@ -16,6 +16,11 @@ #include "engine.h" #include "tcw_vehicle.h" #include "VehicleGameObj.h" +#include "WeaponBagClass.h" +#include "WeaponClass.h" +#include "GameObjManager.h" +#include "gmgame.h" +#include "gmvehicle.h" void tcw_vehicle::Created(GameObject *obj) { @@ -23,7 +28,11 @@ playdetected = true; playdamage = true; triggerstealthdetection = true; - int random = Commands->Get_Random_Int(1,3); + venomfxid = 0; + gharv_idle_fxid = 0; + gharv_harving_fxid = 0; + gharv_full_fxid = 0; + int random = Commands->Get_Random_Int(1,5); if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_APC") == 0) { @@ -42,8 +51,13 @@ Create_2D_WAV_Sound_Team("purchase_gdi_apc_1.wav",1); Send_Message_Team(1,255,204,0,"APC ready for combat."); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_apc_3.wav",1); + Send_Message_Team(1,255,204,0,"APC standing by."); } - if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_APC") == 0) + } + else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_APC") == 0) { if (random == 1) { @@ -60,8 +74,77 @@ Create_2D_WAV_Sound_Team("purchase_gdi_apc_1.wav",0); Send_Message_Team(0,255,0,0,"APC ready for combat."); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_apc_3.wav",0); + Send_Message_Team(0,255,0,0,"APC standing by."); + } + } + else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Venom") == 0) + { + GameObject *venomfx = Commands->Create_Object("TCW_Nod_Venom_FX",Commands->Get_Position(obj)); + venomfxid = Commands->Get_ID(venomfx); + Commands->Attach_To_Object_Bone(venomfx,obj,"FX"); + Commands->Set_Animation(venomfx,"V_NOD_VENOM_AG.V_NOD_VENOM_AG",false,0,2,2,false);//engine off + if (random == 1) + { + Create_2D_WAV_Sound_Team("purchase_nod_venom_1.wav",0); + Send_Message_Team(0,255,0,0,"Venom craft ready for lift-off."); + } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_venom_1.wav",0); + Send_Message_Team(0,255,0,0,"Venom craft ready for lift-off."); + } + } + else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Orca") == 0) + { + if (random == 1) + { + Create_2D_WAV_Sound_Team("purchase_gdi_orca_1.wav",1); + Send_Message_Team(1,255,204,0,"Orca ready, sir."); + } + else if (random == 2) + { + Create_2D_WAV_Sound_Team("purchase_gdi_orca_2.wav",1); + Send_Message_Team(1,255,204,0,"Orca ready for lift-off."); + } + else if (random == 3) + { + Create_2D_WAV_Sound_Team("purchase_gdi_orca_3.wav",1); + Send_Message_Team(1,255,204,0,"Orca cleared for take off."); + } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_orca_4.wav",1); + Send_Message_Team(1,255,204,0,"Orca here."); + } + } + else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Harvester") == 0) + { + if (random == 1) + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_1.wav",1); + Send_Message_Team(1,255,204,0,"Let's get to that tib-zone."); } - else if ( (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Harvester") == 0) || (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Harvester_Player") == 0) ) + else if (random == 2) + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_1.wav",1); + Send_Message_Team(1,255,204,0,"Let's get to that tib-zone."); + } + else if (random == 3) + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_2.wav",1); + Send_Message_Team(1,255,204,0,"Which way to tiberium?"); + } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_3.wav",1); + Send_Message_Team(1,255,204,0,"Harvesting operations."); + } + Commands->Send_Custom_Event(obj,obj,400400120,1,0);//set idle animation on create + } + else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Harvester_Player") == 0) { if (random == 1) { @@ -76,7 +159,12 @@ else if (random == 3) { Create_2D_WAV_Sound_Team("purchase_gdi_harvester_2.wav",1); - Send_Message_Team(1,255,204,0,"I'm ready to go, which way is the tiberium?"); + Send_Message_Team(1,255,204,0,"Which way to tiberium?"); + } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_3.wav",1); + Send_Message_Team(1,255,204,0,"Harvesting operations."); } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_GDI_Harvester_Player") == 0) @@ -94,7 +182,12 @@ else if (random == 3) { Create_2D_WAV_Sound_Team("purchase_gdi_harvester_2.wav",0); - Send_Message_Team(0,255,0,0,"I'm ready to go, which way is the tiberium?"); + Send_Message_Team(0,255,0,0,"Which way to tiberium?"); + } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_harvester_3.wav",0); + Send_Message_Team(0,255,0,0,"Harvesting operations."); } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Juggernaut") == 0) @@ -109,7 +202,7 @@ Create_2D_WAV_Sound_Team("purchase_gdi_juggernaut_2.wav",1); Send_Message_Team(1,255,204,0,"Juggernaut standing by."); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_juggernaut_2.wav",1); Send_Message_Team(1,255,204,0,"Juggernaut standing by."); @@ -127,12 +220,11 @@ Create_2D_WAV_Sound_Team("purchase_gdi_mammoth_2.wav",1); Send_Message_Team(1,255,204,0,"Mammoth Tank ready."); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_mammoth_3.wav",1); Send_Message_Team(1,255,204,0,"Mammoth Tank assembled."); } - Commands->Start_Timer(obj,this,1.0f,1008);//railgun tech check } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Mammoth_Tank") == 0) { @@ -146,7 +238,7 @@ Create_2D_WAV_Sound_Team("purchase_gdi_mammoth_2.wav",0); Send_Message_Team(0,255,0,0,"Mammoth Tank ready."); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_mammoth_3.wav",0); Send_Message_Team(0,255,0,0,"Mammoth Tank assembled."); @@ -169,6 +261,11 @@ Create_2D_WAV_Sound_Team("purchase_gdi_pitbull_2.wav",1); Send_Message_Team(1,255,204,0,"Pitbull looking for some action."); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_pitbull_3.wav",1); + Send_Message_Team(1,255,204,0,"Ready to tear it up!"); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Pitbull") == 0) { @@ -187,6 +284,11 @@ Create_2D_WAV_Sound_Team("purchase_gdi_pitbull_2.wav",0); Send_Message_Team(0,255,0,0,"Pitbull looking for some action."); } + else + { + Create_2D_WAV_Sound_Team("purchase_gdi_pitbull_3.wav",0); + Send_Message_Team(0,255,0,0,"Ready to tear it up!"); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Predator_Tank") == 0) { @@ -200,7 +302,7 @@ Create_2D_WAV_Sound_Team("purchase_gdi_predator_1.wav",1); Send_Message_Team(1,255,204,0,"Predator rolling out."); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_predator_2.wav",1); Send_Message_Team(1,255,204,0,"Predator crew ready to roll."); @@ -218,7 +320,7 @@ Create_2D_WAV_Sound_Team("purchase_gdi_predator_1.wav",0); Send_Message_Team(0,255,0,0,"Predator rolling out."); } - else if (random == 3) + else { Create_2D_WAV_Sound_Team("purchase_gdi_predator_2.wav",0); Send_Message_Team(0,255,0,0,"Predator crew ready to roll."); @@ -241,6 +343,16 @@ Create_2D_WAV_Sound_Team("purchase_nod_attackbike_2.wav",0); Send_Message_Team(0,255,0,0,"Let's go for a hunt."); } + else if (random == 4) + { + Create_2D_WAV_Sound_Team("purchase_nod_attackbike_3.wav",0); + Send_Message_Team(0,255,0,0,"Ya i'm ready."); + } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_attackbike_4.wav",0); + Send_Message_Team(0,255,0,0,"No one's gonna save you now."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Attack_Bike") == 0) { @@ -257,7 +369,17 @@ else if (random == 3) { Create_2D_WAV_Sound_Team("purchase_nod_attackbike_2.wav",1); - Send_Message_Team(1,255,204,0,"Let's go for a hunt."); + Send_Message_Team(1,204,0,0,"Let's go for a hunt."); + } + else if (random == 4) + { + Create_2D_WAV_Sound_Team("purchase_nod_attackbike_3.wav",1); + Send_Message_Team(1,204,0,0,"Ya i'm ready."); + } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_attackbike_4.wav",1); + Send_Message_Team(1,255,204,0,"No one's gonna save you now."); } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Raider_Buggy") == 0) @@ -277,6 +399,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_raider_buggy_2.wav",0); Send_Message_Team(0,255,0,0,"Let's go on a raid."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_raider_buggy_3.wav",0); + Send_Message_Team(0,255,0,0,"When's the next raid."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Raider_Buggy") == 0) { @@ -295,6 +422,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_raider_buggy_2.wav",1); Send_Message_Team(1,255,204,0,"Let's go on a raid."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_raider_buggy_3.wav",1); + Send_Message_Team(1,255,204,0,"When's the next raid."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Scorpion_Tank") == 0) { @@ -313,6 +445,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_scorpion_2.wav",0); Send_Message_Team(0,255,0,0,"Scorpion ready for battle."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_scorpion_3.wav",0); + Send_Message_Team(0,255,0,0,"Scorpion Tank."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Scorpion_Tank") == 0) { @@ -331,6 +468,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_scorpion_2.wav",1); Send_Message_Team(1,255,204,0,"Scorpion ready for battle."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_scorpion_3.wav",1); + Send_Message_Team(1,255,204,0,"Scorpion Tank."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Stealth_Tank") == 0) { @@ -344,10 +486,10 @@ Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_1.wav",0); Send_Message_Team(0,255,0,0,"Stealth tank clear for combat."); } - else if (random == 3) + else { - Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_1.wav",0); - Send_Message_Team(0,255,0,0,"Stealth tank clear for combat."); + Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_2.wav",0); + Send_Message_Team(0,255,0,0,"Stay unseen."); } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Stealth_Tank") == 0) @@ -362,10 +504,10 @@ Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_1.wav",1); Send_Message_Team(1,255,204,0,"Stealth tank clear for combat."); } - else if (random == 3) + else { - Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_1.wav",1); - Send_Message_Team(1,255,204,0,"Stealth tank clear for combat."); + Create_2D_WAV_Sound_Team("purchase_nod_stealth_tank_2.wav",1); + Send_Message_Team(1,255,204,0,"Stay unseen."); } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Flame_Tank") == 0) @@ -385,6 +527,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_flame_tank_2.wav",0); Send_Message_Team(0,255,0,0,"Do not toy with the power of the flame."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_flame_tank_3.wav",0); + Send_Message_Team(0,255,0,0,"Flame Tank."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Flame_Tank") == 0) { @@ -403,6 +550,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_flame_tank_2.wav",1); Send_Message_Team(1,255,204,0,"Do not toy with the power of the flame."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_flame_tank_3.wav",1); + Send_Message_Team(1,255,204,0,"Flame Tank."); + } } else if ( (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester") == 0) || (_stricmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester_Player") == 0) ) @@ -422,6 +574,11 @@ Create_2D_WAV_Sound_Team("purchase_nod_harvester_2.wav",0); Send_Message_Team(0,255,0,0,"Tiberium is power."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_harvester_3.wav",0); + Send_Message_Team(0,255,0,0,"The crystals are calling."); + } } else if (_stricmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Nod_Harvester_Player") == 0) { @@ -440,6 +597,18 @@ Create_2D_WAV_Sound_Team("purchase_nod_harvester_2.wav",1); Send_Message_Team(1,255,204,0,"Tiberium is power."); } + else + { + Create_2D_WAV_Sound_Team("purchase_nod_harvester_3.wav",1); + Send_Message_Team(1,255,204,0,"The crystals are calling."); + } + } +} +void tcw_vehicle::Destroyed(GameObject *obj) +{ + if (venomfxid) + { + Commands->Destroy_Object(Commands->Find_Object(venomfxid)); } } void tcw_vehicle::Custom(GameObject *obj, int message, int param, GameObject *sender) @@ -447,11 +616,13 @@ if (message == CUSTOM_EVENT_VEHICLE_ENTERED) { if ( (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_GDI_Commando") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_GDI_Commando_Low") == 0) || - (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_Nod_Commando") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_Nod_Commando_Low") == 0) ) + (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_Nod_Commando") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_Nod_Commando_Low") == 0) || + (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_GDI_Zonetrooper") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Driver(obj)),"TCW_GDI_Zonetrooper_Low") == 0) ) { Commands->Start_Timer(obj,this,0.5f,100100); } - else if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Pitbull") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Pitbull") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Attack_Bike") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Attack_Bike") == 0) ) + else if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Pitbull") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Pitbull") == 0) || + (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Attack_Bike") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Attack_Bike") == 0) ) { Commands->Start_Timer(obj,this,5.0f,1004); triggerstealthdetection = true; @@ -463,7 +634,7 @@ Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"apc_full.wav"); Create_2D_WAV_Sound_Player(Get_Vehicle_Occupant(obj,1),"apc_full.wav"); } - if (Get_Vehicle_Occupant(obj,1))//if there is a passenger + /*if (Get_Vehicle_Occupant(obj,1))//if there is a passenger { if ( (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Occupant(obj,1)),"TCW_GDI_Missile_Squad") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Occupant(obj,1)),"TCW_Nod_RocketGuy") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Occupant(obj,1)),"TCW_Nod_RocketGuy_Low") == 0) || (strcmp(Commands->Get_Preset_Name(Get_Vehicle_Occupant(obj,1)),"TCW_GDI_Missile_Squad_Low") == 0) ) { @@ -480,7 +651,7 @@ Commands->Give_PowerUp(obj,"TCW_POW_APC_Zonetrooper_Weapon",false); Commands->Select_Weapon(obj,"TCW_Weapon_APC_Zonetrooper"); } - } + }*/ } else if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Chinook") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Chinook") == 0) ) { @@ -493,9 +664,24 @@ Create_2D_WAV_Sound_Player(Get_Vehicle_Occupant(obj,4),"apc_full.wav"); } } + else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Venom") == 0) + { + Commands->Set_Animation(Commands->Find_Object(venomfxid),"V_NOD_VENOM_AG.V_NOD_VENOM_AG",false,0,1,1,false);//engine on + } } else if (message == CUSTOM_EVENT_VEHICLE_EXITED) { + if (Commands->Get_Player_Type(sender) == 0) + { + Commands->Set_Player_Type(obj,0);//set it to exiter team to allow killing by enemy and still gaining vet points + Commands->Start_Timer(obj,this,5.0f,1008);//set to neutral if there is no driver found + } + else if (Commands->Get_Player_Type(sender) == 1) + { + Commands->Set_Player_Type(obj,1);//set it to exiter team to allow killing by enemy and still gaining vet points + Commands->Start_Timer(obj,this,5.0f,1008);//set to neutral if there is no driver found + } + if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Pitbull") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Pitbull") == 0) ) { triggerstealthdetection = false; @@ -515,6 +701,10 @@ Commands->Select_Weapon(obj,"TCW_Weapon_APC");//let's always select the normal weapon when someone exits the vehicle } } + else if (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Venom") == 0) + { + Commands->Set_Animation(Commands->Find_Object(venomfxid),"V_NOD_VENOM_AG.V_NOD_VENOM_AG",false,0,2,2,false);//engine off + } } else if (message == 1004)//destealth unit { @@ -624,19 +814,11 @@ { playdamage = true; } - else if (number == 151515)//unused now, old code... - { - if (Find_Object_By_Preset(2,"TCW_Tech_Railgun_Available")) + else if (number == 1008) { - if (strcmp(Commands->Get_Preset_Name(obj),"TCW_GDI_Mammoth_Tank") == 0) + if (Get_Vehicle_Occupant_Count(obj) == 0) { - Commands->Give_PowerUp(obj,"TCW_Mammoth_Railgun_Upgrade",false); - Commands->Select_Weapon(obj,"TCW_Weapon_Mammoth_Railgun"); - } - } - else - { - Commands->Start_Timer(obj,this,5.0f,1008); + Commands->Set_Player_Type(obj,-2);//unteam the tank after 5 seconds } } } @@ -644,17 +826,19 @@ { if (Commands->Get_Player_Type(obj) == 0) { - if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester") == 0) || - (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester_Player") == 0) || - (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_GDI_Harvester_Player") == 0) ) + if ( (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_Harvester_Player") == 0) || (strcmp(Commands->Get_Preset_Name(obj),"TCW_Nod_GDI_Harvester_Player") == 0) ) { Create_2D_WAV_Sound_Team("nod_harvester_lost.wav",0); Send_Message_Team(0,255,0,0,"Harvester lost."); } else { +#ifdef SSGM + char killmsg[250]; + sprintf(killmsg,"Unit lost. (%s)",Get_Translated_Preset_Name_Ex(obj)); + Send_Message_Team(0,255,0,0,killmsg); +#endif Create_2D_WAV_Sound_Team("nod_unit_lost.wav",0); - Send_Message_Team(0,255,0,0,"Unit lost."); } } else if (Commands->Get_Player_Type(obj) == 1) @@ -666,10 +850,19 @@ Create_2D_WAV_Sound_Team("gdi_harvester_lost.wav",1); Send_Message_Team(1,255,204,0,"Harvester lost."); } + else { +#ifdef SSGM + char killmsg[250]; + sprintf(killmsg,"Unit lost. (%s)",Get_Translated_Preset_Name_Ex(obj)); + Send_Message_Team(1,255,204,0,killmsg); +#endif Create_2D_WAV_Sound_Team("gdi_unit_lost.wav",1); - Send_Message_Team(1,255,204,0,"Unit lost."); + if (venomfxid) + { + Commands->Destroy_Object(Commands->Find_Object(venomfxid)); + } } } } @@ -751,6 +944,294 @@ Auto_Save_Variable(&driverid,sizeof(driverid),2); } +void tcw_hijacked_nod::Custom(GameObject *obj, int message, int param, GameObject *sender) +{ + if (message == CUSTOM_EVENT_VEHICLE_ENTERED) + { + if (Commands->Get_Player_Type(sender) == 1) + { + Create_2D_WAV_Sound_Player(sender,"hijacked.wav"); + Send_Message_Player(sender,255,255,255,"You have hijacked an enemy vehicle, good job!"); + Destroy_Script(); + } + } +} +void tcw_hijacked_gdi::Custom(GameObject *obj, int message, int param, GameObject *sender) +{ + if (message == CUSTOM_EVENT_VEHICLE_ENTERED) + { + if (Commands->Get_Player_Type(sender) == 0) + { + Create_2D_WAV_Sound_Player(sender,"hijacked.wav"); + Send_Message_Player(sender,255,255,255,"You have hijacked an enemy vehicle, good job!"); + Destroy_Script(); + } + } +} + +void tcw_bunker_zone::Created(GameObject *obj) +{ + ExpLoc1 = Get_Int_Parameter("ExpLoc1"); ExpLoc2 = Get_Int_Parameter("ExpLoc2"); ExpLoc3 = Get_Int_Parameter("ExpLoc3;"); +} +void tcw_bunker_zone::Custom(GameObject *obj,int type,int param,GameObject *sender) +{ + /* + if(type == 5089123)//probeer dit nog eens + { + GameObject *Damager = Commands->Find_Object(param); + SLNode *Star_Node = GameObjManager::StarGameObjList.Head(); + for(; Star_Node; Star_Node = Star_Node->Next()) + { + SoldierGameObj *Star = Star_Node->Data(); + if(Star && IsInsideZone(obj, Star)) + Commands->Apply_Damage(Star, 99999, "BlamoKiller", Damager); + } + const char *Explosion = "TCW_Explosion_Shell_Mammoth"; + if(ExpLoc1) + Commands->Create_Explosion(Explosion, Commands->Get_Position(Commands->Find_Object(ExpLoc1)), Damager); + if(ExpLoc2) + Commands->Create_Explosion(Explosion, Commands->Get_Position(Commands->Find_Object(ExpLoc2)), Damager); + if(ExpLoc3) + Commands->Create_Explosion(Explosion, Commands->Get_Position(Commands->Find_Object(ExpLoc3)), Damager); + } + */ +} + +void tcw_bunker::Created(GameObject *obj) +{ + ZoneID = Get_Int_Parameter("ZoneID"); +} +#pragma warning (disable: 4189) +void tcw_bunker::Damaged(GameObject *obj,GameObject *damager,float amount) +{ + const WeaponDefinitionClass *WepDef = Get_Current_Weapon_Definition(damager); + /*if(WepDef) + { + const char *Name = WepDef->Get_Name(); + if(strcmp(Name, "TCW_Weapon_Grenades") == 0) + Commands->Send_Custom_Event(obj, Commands->Find_Object(ZoneID), 5089123, Commands->Get_ID(damager), 0); + }*/ +} + +void tcw_apc_minefield_lay::Created(GameObject *obj) +{ + Minefield_Available = false; Commands->Start_Timer(obj,this,100.0f,155155); +} +void tcw_apc_minefield_lay::Timer_Expired(GameObject *obj, int number) +{ + if (number == 155155) + { + Minefield_Available = true; + if (Get_Vehicle_Driver(obj)) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Minefield Available"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"incmsg.wav"); + } + } + else if (number == 155161) + { + if (Commands->Get_Player_Type(obj) == 1) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 1!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_GDI_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155162); + } + else if (Commands->Get_Player_Type(obj) == 0) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 1!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_Nod_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155162); + } + } + else if (number == 155162) + { + if (Commands->Get_Player_Type(obj) == 1) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 2!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_GDI_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155163); + } + else if (Commands->Get_Player_Type(obj) == 0) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 2!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_Nod_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155163); + } + } + else if (number == 155163) + { + if (Commands->Get_Player_Type(obj) == 1) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 3!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_GDI_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155164); + } + else if (Commands->Get_Player_Type(obj) == 0) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 3!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_Nod_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155164); + } + } + else if (number == 155164) + { + if (Commands->Get_Player_Type(obj) == 1) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 4!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_GDI_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155165); + } + else if (Commands->Get_Player_Type(obj) == 0) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 4!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_Nod_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,0.2f,155165); + } + } + else if (number == 155165) + { + if (Commands->Get_Player_Type(obj) == 1) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 5!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_GDI_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,100.0f,155155); + } + else if (Commands->Get_Player_Type(obj) == 0) + { + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,"Laying Invisible Mine Section 5!"); + Create_2D_WAV_Sound_Player(Get_Vehicle_Driver(obj),"gdi_minefield_deploy.wav"); + Vector3 Size = Vector3(10.0f,10.0f,4.0f); + Matrix3 Rotation(true); + Rotation.Rotate_Z(Commands->Get_Facing(obj)); + OBBoxClass Box(Commands->Get_Position(obj),Size,Rotation); + GameObject *Zone = Create_Zone("Zone_Nod_APC_Mine",Box); + Commands->Set_Facing(Zone,Commands->Get_Facing(obj)); + Commands->Start_Timer(obj,this,100.0f,155155); + } + } +} +void tcw_apc_minefield_lay::Custom(GameObject *obj, int message, int param, GameObject *sender) +{ + if (message == 101055) + { + if (param == 1) + { + if (Minefield_Available) + { + /*int team = Get_Object_Type(obj); + int mines = Get_APC_Mine_Count(team); + if (mines < 30) + { + char minemsg[512]; sprintf(minemsg,"%d/30 mines placed.",mines); + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,minemsg); + Minefield_Available = false; Commands->Start_Timer(obj,this,0.1f,155161); + } + else + { + char minemsg[512]; sprintf(minemsg,"%d/30 mines placed. Maximum Reached. Try again later.",mines); + Send_Message_Player(Get_Vehicle_Driver(obj),255,255,255,minemsg); + }*/ + } + } + } +} + +void tcw_apc_minefield::Entered(GameObject *obj, GameObject *enter) +{ + int team = Get_Int_Parameter("Team"); + if (team == 0) + { + if (Commands->Get_Player_Type(enter) == 1) + { + const char *Explosion = "TCW_Explosion_Shell_Mammoth"; + Vector3 ExpLoc1 = Commands->Get_Position(enter); ExpLoc1.X += 0.3f; ExpLoc1.Y += 0.3f; ExpLoc1.Z += 0.3f; + Vector3 ExpLoc2 = Commands->Get_Position(enter); ExpLoc2.X += 0.4f; ExpLoc2.Y += 0.4f; ExpLoc2.Z += 0.4f; + Vector3 ExpLoc3 = Commands->Get_Position(enter); ExpLoc3.X += 0.5f; ExpLoc3.Y += 0.5f; ExpLoc3.Z += 0.5f; + Commands->Create_Explosion(Explosion,ExpLoc1,0); + Commands->Create_Explosion(Explosion,ExpLoc2,0); + Commands->Create_Explosion(Explosion,ExpLoc3,0); + Commands->Apply_Damage(Get_Vehicle(enter),135.0f,"Ammo_Mammoth_Shell",0); + Commands->Create_2D_WAV_Sound("gdi_minefield_trigger.wav"); + Commands->Destroy_Object(obj); + } + } + else if (team == 1) + { + if (Commands->Get_Player_Type(enter) == 0) + { + const char *Explosion = "TCW_Explosion_Shell_Mammoth"; + Vector3 ExpLoc1 = Commands->Get_Position(enter); ExpLoc1.X += 0.3f; ExpLoc1.Y += 0.3f; ExpLoc1.Z += 0.3f; + Vector3 ExpLoc2 = Commands->Get_Position(enter); ExpLoc2.X += 0.4f; ExpLoc2.Y += 0.4f; ExpLoc2.Z += 0.4f; + Vector3 ExpLoc3 = Commands->Get_Position(enter); ExpLoc3.X += 0.5f; ExpLoc3.Y += 0.5f; ExpLoc3.Z += 0.5f; + Commands->Create_Explosion(Explosion,ExpLoc1,0); + Commands->Create_Explosion(Explosion,ExpLoc2,0); + Commands->Create_Explosion(Explosion,ExpLoc3,0); + Commands->Apply_Damage(Get_Vehicle(enter),135.0f,"Ammo_Mammoth_Shell",0); + Commands->Create_2D_WAV_Sound("gdi_minefield_trigger.wav"); + Commands->Destroy_Object(obj); + } + } +} +ScriptRegistrant tcw_apc_minefield_Registrant("tcw_apc_minefield", "Team=0:int"); +ScriptRegistrant tcw_apc_minefield_lay_Registrant("tcw_apc_minefield_lay", ""); +ScriptRegistrant tcw_bunker_Registrant("tcw_bunker", "ZoneID=0:int"); +ScriptRegistrant tcw_bunker_zone_Registrant("tcw_bunker_zone", "ExpLoc1=0:int,ExpLoc2=0:int,ExpLoc3=0:int"); +ScriptRegistrant tcw_hijacked_gdi_Registrant("tcw_hijacked_gdi",""); +ScriptRegistrant tcw_hijacked_nod_Registrant("tcw_hijacked_nod",""); ScriptRegistrant tcw_vehexit_killtimer_Registrant("tcw_vehexit_killtimer",""); ScriptRegistrant tcw_vehicle_Registrant("tcw_vehicle",""); \ No newline at end of file diff -uwr sourceold/scripts/tcw_vehicle.h source/scripts/tcw_vehicle.h --- sourceold/scripts/tcw_vehicle.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_vehicle.h 2012-07-31 21:54:12.119140600 +0800 @@ -20,11 +20,16 @@ public: void Register_Auto_Save_Variables(); void Killed(GameObject *obj, GameObject *shooter); void Damaged(GameObject *obj, GameObject *damager, float damage); + void Destroyed(GameObject *obj); bool triggerstealthdetection; bool revealed; bool playdetected; bool playdamage; bool is_railgun_available; + int venomfxid; + int gharv_idle_fxid; + int gharv_harving_fxid; + int gharv_full_fxid; }; class tcw_vehexit_killtimer : public ScriptImpClass { @@ -35,3 +40,39 @@ int timerid; int driverid; }; + +class tcw_hijacked_nod : public ScriptImpClass { + void Custom(GameObject *obj, int message, int param, GameObject *sender); +}; +class tcw_hijacked_gdi: public ScriptImpClass { + void Custom(GameObject *obj, int message, int param, GameObject *sender); +}; + +class tcw_bunker : public ScriptImpClass +{ + void Created(GameObject *obj); + void Damaged(GameObject *obj,GameObject *damager,float amount); + int ZoneID; +}; + +class tcw_bunker_zone : public ScriptImpClass +{ + void Created(GameObject *obj); + void Custom(GameObject *obj,int type,int param,GameObject *sender); + int ExpLoc1; + int ExpLoc2; + int ExpLoc3; +}; + +class tcw_apc_minefield_lay : public ScriptImpClass +{ + void Created(GameObject *obj); + void Custom(GameObject *obj,int type,int param,GameObject *sender); + void Timer_Expired(GameObject *obj, int number); + bool Minefield_Available; +}; + +class tcw_apc_minefield : public ScriptImpClass +{ + void Entered(GameObject *obj, GameObject *enter); +}; \ No newline at end of file diff -uwr sourceold/scripts/tcw_zone.cpp source/scripts/tcw_zone.cpp --- sourceold/scripts/tcw_zone.cpp 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_zone.cpp 2012-07-31 21:54:12.208984300 +0800 @@ -69,7 +69,7 @@ } //check if they are orca or firehawk and give powerups - if (strcmp(Commands->Get_Preset_Name(Commands->Find_Object(number)),"TCW_GDI_Orca") == 0) + if ( (strcmp(Commands->Get_Preset_Name(Commands->Find_Object(number)),"TCW_GDI_Orca") == 0) || (strcmp(Commands->Get_Preset_Name(Commands->Find_Object(number)),"TCW_Paul_Orca") == 0) ) { Commands->Give_PowerUp(Commands->Find_Object(number),"TCW_POW_Orca_Rocket",true); } @@ -82,5 +82,13 @@ } } +void tcw_zone_kill_soldier_stars::Entered(GameObject *obj, GameObject *enter) +{ + if (enter->As_SoldierGameObj() && Commands->Is_A_Star(enter)) + { + Commands->Apply_Damage(enter,99999.0f,"Death",enter); + } +} +ScriptRegistrant tcw_zone_kill_soldier_stars_Registrant("tcw_zone_kill_soldier_stars",""); ScriptRegistrant tcw_GDI_Zone_Aircraft_Only_Registrant("tcw_GDI_Zone_Aircraft_Only",""); \ No newline at end of file diff -uwr sourceold/scripts/tcw_zone.h source/scripts/tcw_zone.h --- sourceold/scripts/tcw_zone.h 2012-06-09 08:11:14.000000000 +0800 +++ source/scripts/tcw_zone.h 2012-07-31 21:54:12.048828100 +0800 @@ -18,3 +18,6 @@ void Timer_Expired(GameObject *obj,int number); }; +class tcw_zone_kill_soldier_stars : public ScriptImpClass { + void Entered(GameObject *obj,GameObject *enter); +}; Only in source/scripts: xpert.cpp Only in source/scripts: xpert.h Only in source/scripts: z_Hon_DM.cpp Only in source/scripts: z_Hon_DM.h diff -uwr sourceold/scripts/z_misc.h source/scripts/z_misc.h --- sourceold/scripts/z_misc.h 2012-04-15 20:30:14.000000000 +0800 +++ source/scripts/z_misc.h 2012-07-28 09:11:06.381835900 +0800 @@ -129,3 +129,4 @@ void Created(GameObject *obj); void Timer_Expired(GameObject *obj, int number); }; \ No newline at end of file +