diff -uwr sourceold/AntiSpawnKill/AntiSpawnKill.vcxproj source/AntiSpawnKill/AntiSpawnKill.vcxproj
--- sourceold/AntiSpawnKill/AntiSpawnKill.vcxproj 2011-11-26 13:17:17.329101500 +0800
+++ source/AntiSpawnKill/AntiSpawnKill.vcxproj 2012-05-28 13:38:14.127546900 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/CTF/CTF.cpp source/CTF/CTF.cpp
--- sourceold/CTF/CTF.cpp 2012-01-11 22:13:42.196289000 +0800
+++ source/CTF/CTF.cpp 2012-04-14 04:09:52.823242100 +0800
@@ -281,7 +281,7 @@
GameObject *Flag = Commands->Create_Object(mapConfiguration.CTFFlagPreset,FlagLoc);
Commands->Set_Player_Type(Flag,Team);
Commands->Set_Model(Flag,mapConfiguration.CTFFlagModel[Team]);
- Commands->Attach_Script(Flag,"MDB_SSGM_CTF_Flag","");
+ Commands->Attach_Script(Flag,"SSGM_CTF_Flag","");
Commands->Attach_Script(Flag,"KAK_Prevent_Kill","");
Set_Flag_Location(Team,1);
return Flag;
@@ -452,6 +452,7 @@
tmp.Format("ppage %d %s Flag Captures: %d/%d - %s Flag Captures: %d/%d",PlayerID,str,CTFCaps[0],mapConfiguration.CTFCapLimit,str2,CTFCaps[1],mapConfiguration.CTFCapLimit);
delete[] str;
delete[] str2;
+ Console_Input(tmp);
return false;
}
if (wcsistr(Message,L"!flag") == Message)
diff -uwr sourceold/CTF/ctf.vcxproj source/CTF/ctf.vcxproj
--- sourceold/CTF/ctf.vcxproj 2011-11-26 13:17:40.789062500 +0800
+++ source/CTF/ctf.vcxproj 2012-05-28 13:38:15.341414100 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/CharacterRefund/CharacterRefund.vcxproj source/CharacterRefund/CharacterRefund.vcxproj
--- sourceold/CharacterRefund/CharacterRefund.vcxproj 2011-11-26 13:17:53.663085900 +0800
+++ source/CharacterRefund/CharacterRefund.vcxproj 2012-05-28 13:38:15.684187600 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/ExtraConsoleCommands/ExtraConsoleCommands.vcxproj source/ExtraConsoleCommands/ExtraConsoleCommands.vcxproj
--- sourceold/ExtraConsoleCommands/ExtraConsoleCommands.vcxproj 2011-11-26 13:17:47.099609300 +0800
+++ source/ExtraConsoleCommands/ExtraConsoleCommands.vcxproj 2012-05-28 13:38:15.609968800 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/FirstBlood/FirstBlood.vcxproj source/FirstBlood/FirstBlood.vcxproj
--- sourceold/FirstBlood/FirstBlood.vcxproj 2011-11-26 13:17:33.343750000 +0800
+++ source/FirstBlood/FirstBlood.vcxproj 2012-05-28 13:38:14.959578200 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/MemoryManager/MemTracker.cpp source/MemoryManager/MemTracker.cpp
--- sourceold/MemoryManager/MemTracker.cpp 2011-10-11 21:35:07.162109300 +0800
+++ source/MemoryManager/MemTracker.cpp 2012-04-17 17:41:01.289062500 +0800
@@ -17,6 +17,7 @@
#include
#pragma warning (disable:6387)
#include
+#include
#pragma warning (default:6387)
#pragma comment(lib, "winmm.lib")
#include "FastAllocator.h"
@@ -59,10 +60,13 @@
char path_to_exe[256];
GetModuleFileNameA(NULL, path_to_exe, sizeof(path_to_exe));
strrchr(path_to_exe,'\\')[0] = 0;
+ SetCurrentDirectoryA(path_to_exe);
strcat(path_to_exe,"\\");
strcat(path_to_exe,LEAK_LOG_DIR);
+ if (!PathFileExistsA(path_to_exe))
+ {
SHCreateDirectoryExA(NULL,path_to_exe,NULL);
-
+ }
FILE* leakLogFile = fopen(LEAK_LOG_DIR "\\leaks.txt", "wb");
if (!leakLogFile)
OutputDebugStringA("Failed to write to " LEAK_LOG_DIR "\\leaks.txt");
diff -uwr sourceold/MemoryManager/MemoryManager.vcxproj source/MemoryManager/MemoryManager.vcxproj
--- sourceold/MemoryManager/MemoryManager.vcxproj 2011-11-26 13:17:56.498046800 +0800
+++ source/MemoryManager/MemoryManager.vcxproj 2012-05-28 13:38:16.140242300 +0800
@@ -61,7 +61,7 @@
true
- MultiThreadedDLL
+ MultiThreadedDebugDLL
AssemblyAndSourceCode
@@ -78,6 +78,7 @@
Windows
MachineX86
$(OutDir)$(TargetName)$(TargetExt)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)
if defined RenPath (
@@ -130,6 +131,7 @@
true
MachineX86
$(OutDir)$(TargetName)$(TargetExt)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)
if defined RenPath (
diff -uwr sourceold/Mute/Mute.cpp source/Mute/Mute.cpp
--- sourceold/Mute/Mute.cpp 2012-01-11 22:15:17.976562500 +0800
+++ source/Mute/Mute.cpp 2012-04-09 23:34:39.794921800 +0800
@@ -148,7 +148,7 @@
}
}
- virtual bool OnRadioCommand(int PlayerType, int PlayerID, int AnnouncementID, int IconID, uint8 AnnouncementType)
+ virtual bool OnRadioCommand(int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType)
{
if(MutedPlayers[PlayerID] == false)
{
diff -uwr sourceold/Mute/Mute.vcxproj source/Mute/Mute.vcxproj
--- sourceold/Mute/Mute.vcxproj 2011-11-26 13:18:02.164062500 +0800
+++ source/Mute/Mute.vcxproj 2012-05-28 13:38:16.400984400 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/NoPoints/NoPoints.vcxproj source/NoPoints/NoPoints.vcxproj
--- sourceold/NoPoints/NoPoints.vcxproj 2011-11-26 13:17:34.499023400 +0800
+++ source/NoPoints/NoPoints.vcxproj 2012-05-28 13:38:15.014265700 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/PointsDistribution/PointsDistribution.cpp source/PointsDistribution/PointsDistribution.cpp
--- sourceold/PointsDistribution/PointsDistribution.cpp 2012-01-11 22:20:50.635742100 +0800
+++ source/PointsDistribution/PointsDistribution.cpp 2012-04-24 13:45:18.509765600 +0800
@@ -14,6 +14,7 @@
#include "DamagePoints.h"
#include "gmgame.h"
#include "Iterator.h"
+#include "SoldierGameObj.h"
void* HookupAT3x(void* a, void* b, void* c, void* patch_start, void* patch_end, int (*version_selector)())
{
@@ -49,23 +50,23 @@
virtual void OnObjectCreate(void *data,GameObject *obj)
{
- if(Is_Soldier(obj) && EnabledForInfantry == true)
+ if (obj->As_SoldierGameObj() && EnabledForInfantry == true)
{
Attach_Script_Once(obj,"CollectDamage","");
}
- else if (Is_Vehicle(obj) && EnabledForVehicles == true)
+ else if (obj->As_VehicleGameObj() && EnabledForVehicles == true)
{
Attach_Script_Once(obj,"CollectDamage","");
}
- else if (Is_Beacon(obj) && EnabledForBeacons == true)
+ else if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_BeaconGameObj() && EnabledForBeacons == true)
{
Attach_Script_Once(obj,"CollectDamage","");
}
- else if (Is_C4(obj) && EnabledForC4 == true)
+ else if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_C4GameObj() && EnabledForC4 == true)
{
Attach_Script_Once(obj,"CollectDamage","");
}
- else if(Is_Building(obj) && EnabledForBuildings == true)
+ else if(obj->As_BuildingGameObj() && EnabledForBuildings == true)
{
Attach_Script_Once(obj,"CollectDamage","");
}
diff -uwr sourceold/PointsDistribution/PointsDistribution.vcxproj source/PointsDistribution/PointsDistribution.vcxproj
--- sourceold/PointsDistribution/PointsDistribution.vcxproj 2011-11-26 13:17:39.563476500 +0800
+++ source/PointsDistribution/PointsDistribution.vcxproj 2012-05-28 13:38:15.275007900 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/Spectate/Spectate.cpp source/Spectate/Spectate.cpp
--- sourceold/Spectate/Spectate.cpp 2012-01-11 22:21:06.802734300 +0800
+++ source/Spectate/Spectate.cpp 2012-05-02 14:15:37.150390600 +0800
@@ -16,6 +16,7 @@
#include "CommandLineParser.h"
#include "engine_tt.h"
#include "SoldierGameObj.h"
+#include "VehicleGameObj.h"
#include "WeaponBagClass.h"
#include "engine_weap.h"
#include "engine_obj2.h"
@@ -145,10 +146,15 @@
void Spectate(GameObject *obj,int id)
{
- int team = Get_Team(Get_Player_ID(obj));
+ SoldierGameObj *soldier = obj->As_SoldierGameObj();
+ int team = soldier->Get_Player_Type();
if(team != -4)
{
- SoldierGameObj *soldier = obj->As_SoldierGameObj();
+ if (soldier->Get_Vehicle())
+ {
+ Console_Output("Can't enable spectate mode when in a vehicle\n");
+ return;
+ }
if (!Get_Fly_Mode(soldier))
{
Toggle_Fly_Mode(soldier);
@@ -161,10 +167,6 @@
Commands->Set_Is_Rendered(soldier,false);
Commands->Set_Shield_Type(soldier,"Blamo");
Disarm_All_C4_Beacons(id);
- if (soldier->Get_Vehicle())
- {
- Soldier_Transition_Vehicle(soldier);
- }
for (SLNode* PlayerIter = Get_Player_List()->Head(); (PlayerIter != NULL); PlayerIter = PlayerIter->Next())
{
cPlayer *p = PlayerIter->Data();
diff -uwr sourceold/Spectate/Spectate.vcxproj source/Spectate/Spectate.vcxproj
--- sourceold/Spectate/Spectate.vcxproj 2011-11-26 13:17:57.673828100 +0800
+++ source/Spectate/Spectate.vcxproj 2012-05-28 13:38:16.221296900 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/SuddenDeath/SuddenDeath.cpp source/SuddenDeath/SuddenDeath.cpp
--- sourceold/SuddenDeath/SuddenDeath.cpp 2012-01-11 22:16:29.383789000 +0800
+++ source/SuddenDeath/SuddenDeath.cpp 2012-04-24 13:46:41.072265600 +0800
@@ -16,6 +16,7 @@
#include "CommandLineParser.h"
#include "GameObjManager.h"
#include "VehicleGameObj.h"
+#include "BuildingGameObj.h"
#include "engine_tt.h"
void* HookupAT3x(void* a, void* b, void* c, void* patch_start, void* patch_end, int (*version_selector)())
@@ -178,7 +179,7 @@
while (x)
{
GameObject *o = (GameObject *)x->Data();
- if (o && Is_Building(o))
+ if (o && o->As_BuildingGameObj())
{
Commands->Attach_Script(o, "SuddenDeathBuilding", "");
}
@@ -204,7 +205,7 @@
}
if(The_Game()->Get_Game_Duration_S() <= 300) //If it less than 5 minutes into the game.
{
- if(Is_Refinery(obj))
+ if(obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_RefineryGameObj())
{
if(suddendeath.ActivateOnRefs == true)
{
diff -uwr sourceold/SuddenDeath/SuddenDeath.vcxproj source/SuddenDeath/SuddenDeath.vcxproj
--- sourceold/SuddenDeath/SuddenDeath.vcxproj 2011-11-26 13:17:24.999023400 +0800
+++ source/SuddenDeath/SuddenDeath.vcxproj 2012-05-28 13:38:14.452742300 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/bansystem/bansystem.vcxproj source/bansystem/bansystem.vcxproj
--- sourceold/bansystem/bansystem.vcxproj 2011-11-26 13:17:30.898437500 +0800
+++ source/bansystem/bansystem.vcxproj 2012-05-28 13:38:14.879500100 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
Only in source/bin/Debug: debug
Binary files sourceold/bin/Debug/shaders.lib and source/bin/Debug/shaders.lib differ
Only in source/bin: Debug SSGM
Binary files sourceold/bin/Release/shaders.lib and source/bin/Release/shaders.lib differ
Only in source/bin: Release SSGM
diff -uwr sourceold/crates/crates.cpp source/crates/crates.cpp
--- sourceold/crates/crates.cpp 2012-01-11 22:29:04.188476500 +0800
+++ source/crates/crates.cpp 2012-04-24 13:41:43.463867100 +0800
@@ -123,16 +123,16 @@
mapConfiguration = globalConfiguration;
const StringClass key = StringClass(The_Game()->Get_Map_Name()).AsLower() + "_Crates";
LoadGenericINISettings(SSGMIni, key, mapConfiguration);
- mapConfiguration.CrateVehSpawnPos[0].X = SSGMIni->Get_Float(key, "NodRVCx", mapConfiguration.CrateVehSpawnPos[0].X);
- mapConfiguration.CrateVehSpawnPos[0].Y = SSGMIni->Get_Float(key, "NodRVCy", mapConfiguration.CrateVehSpawnPos[0].Y);
- mapConfiguration.CrateVehSpawnPos[0].Z = SSGMIni->Get_Float(key, "NodRVCz", mapConfiguration.CrateVehSpawnPos[0].Z);
- 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.CrateVehSpawnPos[0].X = SSGMIni->Get_Float(key, "NodRVCX", mapConfiguration.CrateVehSpawnPos[0].X);
+ mapConfiguration.CrateVehSpawnPos[0].Y = SSGMIni->Get_Float(key, "NodRVCY", mapConfiguration.CrateVehSpawnPos[0].Y);
+ mapConfiguration.CrateVehSpawnPos[0].Z = SSGMIni->Get_Float(key, "NodRVCZ", mapConfiguration.CrateVehSpawnPos[0].Z);
+ 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);
}
virtual void OnObjectCreate(void *data,GameObject *obj)
{
- if (Is_Powerup(obj))
+ if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_PowerUpGameObj())
{
if (stristr(Commands->Get_Preset_Name(obj),"crate"))
{
@@ -420,8 +420,8 @@
StringClass cine;
cine.Format("%scrate.txt",Commands->Get_Player_Type(sender) == 0?"Nod":"GDI");
Commands->Attach_Script(Temp,"Test_Cinematic",cine);
- GameObject *veh = Commands->Create_Object(RandomVehicle[Index][3],Vector3(0,0,0));
- Commands->Send_Custom_Event(Temp,Temp,CUSTOM_EVENT_CINEMATIC_SET_FIRST_SLOT+4,Commands->Get_Preset_ID(veh),0);
+ GameObject *veh = Commands->Create_Object(RandomVehicle[Index][2],Vector3(0,0,0));
+ Commands->Send_Custom_Event(Temp,Temp,CUSTOM_EVENT_CINEMATIC_SET_FIRST_SLOT+4,Commands->Get_ID(veh),0);
StringClass msg;
const char *str = Get_Team_Name(Team);
msg.Format("msg Crate: Looks like %s just got a random vehicle! Go them!",str);
@@ -645,7 +645,7 @@
int team = Commands->Get_Player_Type(sender);
Commands->Send_Custom_Event(obj,sender,100101,1,1);//enable generating of money on player
message2.Format("%ls picked up a Human Silo crate.",Get_Wide_Player_Name(sender));
- message1.Format("ppage %d [Crate] You got the Human Silo Crate, your entier team will be granted an additional $1 credit a second until you die or change character.",Get_Player_ID(sender));
+ 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));
diff -uwr sourceold/crates/crates.vcxproj source/crates/crates.vcxproj
--- sourceold/crates/crates.vcxproj 2011-11-26 13:17:42.841796800 +0800
+++ source/crates/crates.vcxproj 2012-05-28 13:38:15.428328200 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/example-plugin/example-plugin.vcxproj source/example-plugin/example-plugin.vcxproj
--- sourceold/example-plugin/example-plugin.vcxproj 2011-11-26 13:17:22.956054600 +0800
+++ source/example-plugin/example-plugin.vcxproj 2012-05-28 13:38:14.331648500 +0800
@@ -65,7 +65,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/makemix/general.cpp source/makemix/general.cpp
--- sourceold/makemix/general.cpp 2009-04-12 11:54:00.781250000 +0800
+++ source/makemix/general.cpp 2012-05-02 02:02:33.078125000 +0800
@@ -1 +1,12 @@
+/* Renegade Scripts.dll
+ Copyright 2011 Tiberian Technologies
+
+ This file is part of the Renegade scripts.dll
+ The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version. See the file COPYING for more details.
+ In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
+ Only the source code to the module(s) containing the licenced code has to be released.
+*/
#include "general.h"
diff -uwr sourceold/makemix/general.h source/makemix/general.h
--- sourceold/makemix/general.h 2011-03-08 09:59:47.156250000 +0800
+++ source/makemix/general.h 2012-05-02 02:02:38.716796800 +0800
@@ -1,3 +1,14 @@
+/* Renegade Scripts.dll
+ Copyright 2011 Tiberian Technologies
+
+ This file is part of the Renegade scripts.dll
+ The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version. See the file COPYING for more details.
+ In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
+ Only the source code to the module(s) containing the licenced code has to be released.
+*/
#ifndef ACHASH_INCLUDE__GENERAL_H
#define ACHASH_INCLUDE__GENERAL_H
#include "Defines.h"
diff -uwr sourceold/makemix/makemix.cpp source/makemix/makemix.cpp
--- sourceold/makemix/makemix.cpp 2011-11-26 13:48:43.054687500 +0800
+++ source/makemix/makemix.cpp 2012-05-02 02:02:43.840820300 +0800
@@ -1,3 +1,14 @@
+/* Renegade Scripts.dll
+ Copyright 2011 Tiberian Technologies
+
+ This file is part of the Renegade scripts.dll
+ The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version. See the file COPYING for more details.
+ In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
+ Only the source code to the module(s) containing the licenced code has to be released.
+*/
#include "General.h"
#include "MixFileFactoryClass.h"
#include "SimpleFileFactoryClass.h"
diff -uwr sourceold/makemix/makemix.vcxproj source/makemix/makemix.vcxproj
--- sourceold/makemix/makemix.vcxproj 2011-11-26 13:17:26.556640600 +0800
+++ source/makemix/makemix.vcxproj 2012-05-28 13:38:14.603132900 +0800
@@ -123,7 +123,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/randomstartingcredits/RandomStartingCredits.vcxproj source/randomstartingcredits/RandomStartingCredits.vcxproj
--- sourceold/randomstartingcredits/RandomStartingCredits.vcxproj 2011-11-26 13:17:37.231445300 +0800
+++ source/randomstartingcredits/RandomStartingCredits.vcxproj 2012-05-28 13:38:15.165632900 +0800
@@ -153,7 +153,7 @@
false
- MultiThreadedDLL
+ MultiThreadedDebugDLL
false
true
NotSet
diff -uwr sourceold/scripts/AirFactoryGameObj.h source/scripts/AirFactoryGameObj.h
--- sourceold/scripts/AirFactoryGameObj.h 2011-10-21 09:32:28.004882800 +0800
+++ source/scripts/AirFactoryGameObj.h 2012-05-23 15:32:38.041015600 +0800
@@ -21,7 +21,7 @@
~AirFactoryGameObj (void);
virtual void Init( void );
void Init (const AirFactoryGameObjDef & definition);
- const AirFactoryGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const AirFactoryGameObjDef & Get_Definition (void) const;
AirFactoryGameObj * As_AirFactoryGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
@@ -40,6 +40,11 @@
void Import_Rare (BitStreamClass &packet);
void Export_Rare (BitStreamClass &packet);
void Create_Vehicle(int defintion_id,SoldierGameObj * player);
+ void Set_Busy(bool busy)
+ {
+ IsBusy = busy;
+ Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);
+ }
private:
void Load_Variables (ChunkLoadClass &cload);
ReferencerClass Vehicle;
diff -uwr sourceold/scripts/AirFactoryGameObjDef.h source/scripts/AirFactoryGameObjDef.h
--- sourceold/scripts/AirFactoryGameObjDef.h 2011-10-11 21:37:09.316406200 +0800
+++ source/scripts/AirFactoryGameObjDef.h 2012-05-06 16:37:04.946203100 +0800
@@ -22,6 +22,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (AirFactoryGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/AirStripGameObj.h source/scripts/AirStripGameObj.h
--- sourceold/scripts/AirStripGameObj.h 2011-10-11 21:37:11.875976500 +0800
+++ source/scripts/AirStripGameObj.h 2012-05-23 11:12:05.150390600 +0800
@@ -46,7 +46,7 @@
virtual const PersistFactoryClass& Get_Factory() const;
virtual void Init();
void Init(const AirStripGameObjDef&);
- const AirStripGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const AirStripGameObjDef & Get_Definition( void ) const ;
virtual bool Save(ChunkSaveClass&);
virtual bool Load(ChunkLoadClass&);
void Load_Variables(ChunkLoadClass&);
diff -uwr sourceold/scripts/AirStripGameObjDef.h source/scripts/AirStripGameObjDef.h
--- sourceold/scripts/AirStripGameObjDef.h 2011-10-11 21:37:14.416992100 +0800
+++ source/scripts/AirStripGameObjDef.h 2012-05-06 16:37:04.961828100 +0800
@@ -29,6 +29,9 @@
virtual bool Load (ChunkLoadClass& chunkLoader);
virtual uint32 Get_Class_ID () const;
virtual PersistClass* Create () const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (AirStripGameObjDef, VehicleFactoryGameObjDef);
private:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/ArmedGameObj.h source/scripts/ArmedGameObj.h
--- sourceold/scripts/ArmedGameObj.h 2011-10-11 21:37:23.454101500 +0800
+++ source/scripts/ArmedGameObj.h 2012-05-23 11:12:13.034179600 +0800
@@ -23,7 +23,7 @@
void Init( const ArmedGameObjDef & definition );
void Copy_Settings( const ArmedGameObjDef & definition );
void Re_Init( const ArmedGameObjDef & definition );
- const ArmedGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const ArmedGameObjDef & Get_Definition( void ) const ;
virtual bool Save( ChunkSaveClass & csave );
virtual bool Load( ChunkLoadClass & cload );
virtual void On_Post_Load( void );
@@ -32,7 +32,7 @@
virtual void Import_State_Cs( BitStreamClass & packet );
virtual void Export_State_Cs( BitStreamClass & packet );
virtual void Post_Think();
- WeaponClass * Get_Weapon( void );
+ SCRIPTS_API WeaponClass * Get_Weapon( void );
WeaponBagClass * Get_Weapon_Bag( void ) { return WeaponBag; }
bool Muzzle_Exists( int index = 0 );
virtual const Matrix3D &Get_Muzzle( int index = 0 );
diff -uwr sourceold/scripts/ArmedGameObjDef.h source/scripts/ArmedGameObjDef.h
--- sourceold/scripts/ArmedGameObjDef.h 2011-10-11 21:37:26.043945300 +0800
+++ source/scripts/ArmedGameObjDef.h 2012-05-06 16:37:04.974523400 +0800
@@ -18,6 +18,9 @@
ArmedGameObjDef( void );
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(ArmedGameObjDef,PhysicalGameObjDef);
protected:
//All of these floats are in radians (although leveledit shows degrees)
diff -uwr sourceold/scripts/ArmorWarheadManager.h source/scripts/ArmorWarheadManager.h
--- sourceold/scripts/ArmorWarheadManager.h 2011-10-11 21:57:50.799804600 +0800
+++ source/scripts/ArmorWarheadManager.h 2012-04-17 22:47:21.643554600 +0800
@@ -11,17 +11,20 @@
*/
#ifndef TT_INCLUDE__ARMORWARHEADMANAGER_H
#define TT_INCLUDE__ARMORWARHEADMANAGER_H
+#ifdef DDBEDIT
+#error cant use this in ddbedit
+#endif
#include "engine_string.h"
#include "datasafe.h"
-class ArmorWarheadManager
+class SCRIPTS_API ArmorWarheadManager
{
public:
static void Init( void );
static void Shutdown( void );
static bool Is_Armor_Soft( ArmorType armor );
static int Get_Num_Armor_Types( void );
- static ArmorType SCRIPTS_API Get_Armor_Type( const char *name );
- static const char SCRIPTS_API * Get_Armor_Name( ArmorType type );
+ static ArmorType Get_Armor_Type( const char *name );
+ static const char * Get_Armor_Name( ArmorType type );
static int Get_Num_Warhead_Types( void );
static WarheadType Get_Warhead_Type( const char *name );
static const char * Get_Warhead_Name( WarheadType type );
diff -uwr sourceold/scripts/AudibleSoundClass.h source/scripts/AudibleSoundClass.h
--- sourceold/scripts/AudibleSoundClass.h 2012-02-21 10:03:50.199218700 +0800
+++ source/scripts/AudibleSoundClass.h 2012-04-14 04:09:47.960937500 +0800
@@ -154,7 +154,7 @@
virtual void Free_Miles_Handle ();
virtual void Initialize_Miles_Handle ();
virtual void Allocate_Miles_Handle ();
- virtual SoundBufferClass* Get_Buffer () const;
+ virtual SHADERS_API SoundBufferClass* Get_Buffer () const;
virtual SoundBufferClass* Peek_Buffer () const;
SHADERS_API virtual void Set_Buffer (SoundBufferClass* buffer);
virtual void Restart_Loop ();
diff -uwr sourceold/scripts/AudibleSoundDefinitionClass.cpp source/scripts/AudibleSoundDefinitionClass.cpp
--- sourceold/scripts/AudibleSoundDefinitionClass.cpp 2011-10-11 23:04:16.190429600 +0800
+++ source/scripts/AudibleSoundDefinitionClass.cpp 2012-04-17 17:06:17.560546800 +0800
@@ -28,30 +28,30 @@
AudibleSoundDefinitionClass::AudibleSoundDefinitionClass() : m_Priority(0.5), m_Volume(1), m_VolumeRandomizer(0), m_Pan(0.5), m_LoopCount(1), m_VirtualChannel(0), m_DropoffRadius(40), m_MaxVolRadius(20), m_Is3DSound(true), m_Type(1), m_StartOffset(0), m_PitchFactor(1), m_PitchFactorRandomizer(0), m_LogicalType(0), m_LogicalNotifDelay(2.0), m_LogicalDropoffRadius(-1.0), m_CreateLogicalSound(false), m_SphereColor(0,0.75,0.75)
{
#ifdef PARAM_EDITING_ON
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_FILENAME,m_Filename,"Filename");
- INT_EDITABLE_PARAM(CNCModeSettingsDef,m_Filename,0,100);
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_FLOAT,m_DropoffRadius,"Drop-off Radius");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_FLOAT,m_MaxVolRadius,"Max-Vol Radius");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_BOOL,m_Is3DSound,"Is 3D Sound");
- INT_EDITABLE_PARAM(CNCModeSettingsDef,m_LoopCount,0,1000000);
- FLOAT_EDITABLE_PARAM(CNCModeSettingsDef,m_Volume,0,1.0);
- FLOAT_UNITS_PARAM(CNCModeSettingsDef,m_VolumeRandomizer,0,1.0,"Volume Random (+/-)");
- FLOAT_EDITABLE_PARAM(CNCModeSettingsDef,m_Pan,0,1.0);
- FLOAT_EDITABLE_PARAM(CNCModeSettingsDef,m_Priority,0,1.0);
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_FILENAME,m_Filename,"Filename");
+ INT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_VirtualChannel,0,100);
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_FLOAT,m_DropoffRadius,"Drop-off Radius");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_FLOAT,m_MaxVolRadius,"Max-Vol Radius");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_BOOL,m_Is3DSound,"Is 3D Sound");
+ INT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_LoopCount,0,1000000);
+ FLOAT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_Volume,0,1.0);
+ FLOAT_UNITS_PARAM(AudibleSoundDefinitionClass,m_VolumeRandomizer,0,1.0,"Volume Random (+/-)");
+ FLOAT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_Pan,0,1.0);
+ FLOAT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_Priority,0,1.0);
EnumParameterClass * type = new EnumParameterClass(&m_Type);
type->Set_Name ("m_Type");
type->Add_Value("Sound Effect",1);
type->Add_Value("Music",0);
type->Add_Value("Dialog",2);
type->Add_Value("Cinematic",3);
- GENERIC_EDITABLE_PARAM( CNCModeSettingsDef, type);
- FLOAT_EDITABLE_PARAM(CNCModeSettingsDef,m_StartOffset,0,1.0);
- FLOAT_EDITABLE_PARAM(CNCModeSettingsDef,m_PitchFactor,0,1.0);
- FLOAT_UNITS_PARAM(CNCModeSettingsDef,m_PitchFactorRandomizer,0,1.0,"Pitch Factor Random (+/-)");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_STRING,m_DisplayText,"Display Text");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_BOOL,m_CreateLogicalSound,"Create Logical Sound");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_FLOAT,m_LogicalDropoffRadius,"Logical Drop-off Radius");
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_FLOAT,m_LogicalNotifDelay,"Logical Notif Delay");
+ GENERIC_EDITABLE_PARAM( AudibleSoundDefinitionClass, type);
+ FLOAT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_StartOffset,0,1.0);
+ FLOAT_EDITABLE_PARAM(AudibleSoundDefinitionClass,m_PitchFactor,0,1.0);
+ FLOAT_UNITS_PARAM(AudibleSoundDefinitionClass,m_PitchFactorRandomizer,0,1.0,"Pitch Factor Random (+/-)");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_STRING,m_DisplayText,"Display Text");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_BOOL,m_CreateLogicalSound,"Create Logical Sound");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_FLOAT,m_LogicalDropoffRadius,"Logical Drop-off Radius");
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_FLOAT,m_LogicalNotifDelay,"Logical Notif Delay");
EnumParameterClass * logical = new EnumParameterClass(&m_LogicalType);
logical->Set_Name ("Logical Type");
logical->Add_Value("None",0);
@@ -69,8 +69,8 @@
logical->Add_Value("Designer07",12);
logical->Add_Value("Designer08",13);
logical->Add_Value("Designer09",14);
- GENERIC_EDITABLE_PARAM( CNCModeSettingsDef, logical);
- NAMED_EDITABLE_PARAM(CNCModeSettingsDef,ParameterClass::TYPE_COLOR,m_SphereColor,"Sphere Color");
+ GENERIC_EDITABLE_PARAM( AudibleSoundDefinitionClass, logical);
+ NAMED_EDITABLE_PARAM(AudibleSoundDefinitionClass,ParameterClass::TYPE_COLOR,m_SphereColor,"Sphere Color");
#endif
}
@@ -264,3 +264,15 @@
m_SphereColor = that.m_SphereColor;
return *this;
}
+
+#ifdef DDBEDIT
+void AudibleSoundDefinitionClass::Dump(FileClass &file)
+{
+ for (int i = 0;i < this->Get_Parameter_Count();i++)
+ {
+ ParameterClass *param = this->Lock_Parameter(i);
+ param->Dump(file);
+ this->Unlock_Parameter(i);
+ }
+}
+#endif
diff -uwr sourceold/scripts/AudibleSoundDefinitionClass.h source/scripts/AudibleSoundDefinitionClass.h
--- sourceold/scripts/AudibleSoundDefinitionClass.h 2011-10-11 21:57:45.827148400 +0800
+++ source/scripts/AudibleSoundDefinitionClass.h 2012-05-06 16:37:04.987218700 +0800
@@ -26,27 +26,6 @@
class AudibleSoundDefinitionClass :
public DefinitionClass
{
- DECLARE_EDITABLE(AudibleSoundDefinitionClass,DefinitionClass);
- float m_Priority; // 001C
- float m_Volume; // 0020
- float m_VolumeRandomizer; // 0024
- float m_Pan; // 0028
- int m_LoopCount; // 002C
- int m_VirtualChannel; // 0030
- float m_DropoffRadius; // 0034
- float m_MaxVolRadius; // 0038
- bool m_Is3DSound; // 003C
- StringClass m_Filename; // 0040
- int m_Type; // 0044
- StringClass m_DisplayText; // 0048
- float m_StartOffset; // 004C
- float m_PitchFactor; // 0050
- float m_PitchFactorRandomizer; // 0054
- int m_LogicalType; // 0058
- float m_LogicalNotifDelay; // 005C
- float m_LogicalDropoffRadius; // 0060
- bool m_CreateLogicalSound; // 0064
- Vector3 m_SphereColor; // 0068
public:
virtual ~AudibleSoundDefinitionClass();
virtual const PersistFactoryClass& Get_Factory() const;
@@ -80,6 +59,31 @@
bool Save_Variables(ChunkSaveClass&);
bool Load_Variables(ChunkLoadClass&);
const AudibleSoundDefinitionClass &operator=(AudibleSoundDefinitionClass const &that);
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
+ DECLARE_EDITABLE(AudibleSoundDefinitionClass,DefinitionClass);
+private:
+ float m_Priority; // 001C
+ float m_Volume; // 0020
+ float m_VolumeRandomizer; // 0024
+ float m_Pan; // 0028
+ int m_LoopCount; // 002C
+ int m_VirtualChannel; // 0030
+ float m_DropoffRadius; // 0034
+ float m_MaxVolRadius; // 0038
+ bool m_Is3DSound; // 003C
+ StringClass m_Filename; // 0040
+ int m_Type; // 0044
+ StringClass m_DisplayText; // 0048
+ float m_StartOffset; // 004C
+ float m_PitchFactor; // 0050
+ float m_PitchFactorRandomizer; // 0054
+ int m_LogicalType; // 0058
+ float m_LogicalNotifDelay; // 005C
+ float m_LogicalDropoffRadius; // 0060
+ bool m_CreateLogicalSound; // 0064
+ Vector3 m_SphereColor; // 0068
friend class PresetDump;
};
diff -uwr sourceold/scripts/BaseControllerClass.h source/scripts/BaseControllerClass.h
--- sourceold/scripts/BaseControllerClass.h 2011-10-11 21:57:41.484375000 +0800
+++ source/scripts/BaseControllerClass.h 2012-05-23 08:29:05.815429600 +0800
@@ -82,6 +82,7 @@
bool Can_Build_Air();
bool Can_Build_Ground();
bool Can_Build_Naval();
+ void Check_Prerequisites();
bool Is_Base_Powered() const
{
@@ -119,6 +120,10 @@
{
return RadarEnabled;
}
+ DynamicVectorClass &Get_Building_List()
+ {
+ return BuildingList;
+ }
}; // 072C
#endif
\ No newline at end of file
diff -uwr sourceold/scripts/BaseGameObjDef.h source/scripts/BaseGameObjDef.h
--- sourceold/scripts/BaseGameObjDef.h 2011-10-11 21:57:37.723632800 +0800
+++ source/scripts/BaseGameObjDef.h 2012-05-06 16:37:05.002843700 +0800
@@ -18,6 +18,9 @@
public:
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
friend class PresetDump;
}; // 001C
diff -uwr sourceold/scripts/BeaconGameObj.h source/scripts/BeaconGameObj.h
--- sourceold/scripts/BeaconGameObj.h 2011-10-11 21:57:36.038085900 +0800
+++ source/scripts/BeaconGameObj.h 2012-05-23 11:12:36.067382800 +0800
@@ -47,7 +47,7 @@
virtual const PersistFactoryClass& Get_Factory() const;
virtual void Init();
void Init(const BeaconGameObjDef &);
- const BeaconGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const BeaconGameObjDef & Get_Definition( void ) const ;
void Init_Beacon(const WeaponDefinitionClass* definition, SoldierGameObj* owner, const Vector3& position);
virtual bool Save(ChunkSaveClass& chunks);
virtual bool Load(ChunkLoadClass& chunks);
diff -uwr sourceold/scripts/BeaconGameObjDef.h source/scripts/BeaconGameObjDef.h
--- sourceold/scripts/BeaconGameObjDef.h 2012-01-13 08:30:18.359375000 +0800
+++ source/scripts/BeaconGameObjDef.h 2012-05-06 16:37:05.014562500 +0800
@@ -24,6 +24,9 @@
uint32 Get_Class_ID() const;
PersistClass* Create() const;
bool Is_Nuke() const {return IsNuke;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( BeaconGameObjDef, SimpleGameObjDef );
private:
float BroadcastToAllTime; // 00AC
diff -uwr sourceold/scripts/BuildingGameObj.h source/scripts/BuildingGameObj.h
--- sourceold/scripts/BuildingGameObj.h 2011-10-11 21:57:29.629882800 +0800
+++ source/scripts/BuildingGameObj.h 2012-04-14 04:09:47.160156200 +0800
@@ -84,6 +84,8 @@
virtual void On_Damaged (void);
bool Is_Destroyed (void) const { return IsDestroyed; }
void Set_Is_Destroyed(const bool _IsDestroyed) { IsDestroyed = _IsDestroyed; }
+ bool Is_Spy_Disabled() const { return IsSpyDisabled; }
+ void Set_Is_Spy_Disabled(const bool _IsSpyDisabled) {IsSpyDisabled = _IsSpyDisabled; }
virtual void Import_Rare (BitStreamClass &packet);
virtual void Export_Rare (BitStreamClass &packet);
virtual void Export_Creation (BitStreamClass &packet);
@@ -111,6 +113,7 @@
bool IsDestroyed;
Vector3 Position;
bool IsPowerOn;
+ bool IsSpyDisabled;
int CurrentState; // derived from the health and IsPowerOn
AudibleSoundClass * CurrentAnnouncement;
SphereClass AnnouncementSphere;
diff -uwr sourceold/scripts/BuildingGameObjDef.h source/scripts/BuildingGameObjDef.h
--- sourceold/scripts/BuildingGameObjDef.h 2011-10-11 21:57:27.790039000 +0800
+++ source/scripts/BuildingGameObjDef.h 2012-05-06 16:37:05.027257800 +0800
@@ -60,6 +60,9 @@
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
virtual const PersistFactoryClass & Get_Factory( void ) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( BuildingGameObjDef, DamageableGameObjDef );
void Set_Type (BuildingConstants::BuildingType type) { Type = type; }
BuildingConstants::BuildingType Get_Type (void) const { return Type; }
diff -uwr sourceold/scripts/C4GameObj.h source/scripts/C4GameObj.h
--- sourceold/scripts/C4GameObj.h 2011-10-11 21:57:26.085937500 +0800
+++ source/scripts/C4GameObj.h 2012-05-23 11:12:52.194335900 +0800
@@ -40,7 +40,7 @@
~C4GameObj();
void Init();
void Init(const C4GameObjDef &);
- const C4GameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const C4GameObjDef & Get_Definition( void ) const ;
void Init_C4(AmmoDefinitionClass const *ammoPreset, SoldierGameObj* owner, uint32 detonationMode, const Matrix3D& muzzle);
CollisionReactionType Collision_Occurred(const CollisionEventClass& collide);
bool Save(ChunkSaveClass &csave);
diff -uwr sourceold/scripts/C4GameObjDef.h source/scripts/C4GameObjDef.h
--- sourceold/scripts/C4GameObjDef.h 2011-10-11 21:57:24.221679600 +0800
+++ source/scripts/C4GameObjDef.h 2012-05-06 16:37:05.039953100 +0800
@@ -21,6 +21,9 @@
bool Load(ChunkLoadClass &cload);
uint32 Get_Class_ID() const;
PersistClass *Create() const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( C4GameObjDef, SimpleGameObjDef );
private:
float ThrowVelocity;
diff -uwr sourceold/scripts/CinematicGameObj.h source/scripts/CinematicGameObj.h
--- sourceold/scripts/CinematicGameObj.h 2011-10-11 21:57:10.641601500 +0800
+++ source/scripts/CinematicGameObj.h 2012-05-23 11:12:59.759765600 +0800
@@ -25,7 +25,7 @@
void Init();
void Init(const CinematicGameObjDef &);
void Cinematic_Init();
- const CinematicGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const CinematicGameObjDef & Get_Definition( void ) const ;
bool Save(ChunkSaveClass &csave);
bool Load(ChunkLoadClass &cload);
void On_Post_Load();
diff -uwr sourceold/scripts/CinematicGameObjDef.h source/scripts/CinematicGameObjDef.h
--- sourceold/scripts/CinematicGameObjDef.h 2011-10-11 21:57:08.957031200 +0800
+++ source/scripts/CinematicGameObjDef.h 2012-05-06 16:37:05.053625000 +0800
@@ -21,6 +21,10 @@
bool Load(ChunkLoadClass &cload);
uint32 Get_Class_ID() const;
PersistClass *Create() const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE( CinematicGameObjDef, ArmedGameObjDef );
private:
int SoundDefID;
diff -uwr sourceold/scripts/ComCenterGameObj.h source/scripts/ComCenterGameObj.h
--- sourceold/scripts/ComCenterGameObj.h 2011-10-11 21:56:58.881835900 +0800
+++ source/scripts/ComCenterGameObj.h 2012-05-23 11:13:09.483398400 +0800
@@ -20,7 +20,7 @@
~ComCenterGameObj (void);
virtual void Init( void );
void Init (const ComCenterGameObjDef & definition);
- const ComCenterGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const ComCenterGameObjDef & Get_Definition (void) const;
ComCenterGameObj * As_ComCenterGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/ComCenterGameObjDef.h source/scripts/ComCenterGameObjDef.h
--- sourceold/scripts/ComCenterGameObjDef.h 2011-10-11 21:56:57.004882800 +0800
+++ source/scripts/ComCenterGameObjDef.h 2012-05-06 16:37:05.070226600 +0800
@@ -22,6 +22,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (ComCenterGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/ConstructionYardGameObj.h source/scripts/ConstructionYardGameObj.h
--- sourceold/scripts/ConstructionYardGameObj.h 2011-10-11 21:56:47.152343700 +0800
+++ source/scripts/ConstructionYardGameObj.h 2012-05-23 11:13:18.676757800 +0800
@@ -22,7 +22,7 @@
~ConstructionYardGameObj (void);
virtual void Init( void );
void Init (const ConstructionYardGameObjDef & definition);
- const ConstructionYardGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const ConstructionYardGameObjDef & Get_Definition (void) const;
ConstructionYardGameObj * As_ConstructionYardGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/ConstructionYardGameObjDef.h source/scripts/ConstructionYardGameObjDef.h
--- sourceold/scripts/ConstructionYardGameObjDef.h 2011-10-11 21:56:45.261718700 +0800
+++ source/scripts/ConstructionYardGameObjDef.h 2012-05-06 16:37:05.081945300 +0800
@@ -22,6 +22,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (ConstructionYardGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/DamageZoneGameObj.h source/scripts/DamageZoneGameObj.h
--- sourceold/scripts/DamageZoneGameObj.h 2011-10-11 21:56:28.727539000 +0800
+++ source/scripts/DamageZoneGameObj.h 2012-05-23 11:14:00.280273400 +0800
@@ -26,7 +26,7 @@
bool Load(ChunkLoadClass &cload);
void Init();
void Init(const DamageZoneGameObjDef &);
- const DamageZoneGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const DamageZoneGameObjDef & Get_Definition( void ) const ;
void Think();
void Set_Bounding_Box(OBBoxClass &box) {BoundingBox = box;}
OBBoxClass &Get_Bounding_Box() {return BoundingBox;}
diff -uwr sourceold/scripts/DamageZoneGameObjDef.h source/scripts/DamageZoneGameObjDef.h
--- sourceold/scripts/DamageZoneGameObjDef.h 2011-10-11 21:56:26.795898400 +0800
+++ source/scripts/DamageZoneGameObjDef.h 2012-05-06 16:37:05.110265600 +0800
@@ -22,6 +22,9 @@
uint32 Get_Class_ID() const;
PersistClass *Create() const;
Vector3 &Get_Color() {return Color;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(DamageZoneGameObjDef, BaseGameObjDef);
private:
float DamageRate;
diff -uwr sourceold/scripts/DamageableGameObj.h source/scripts/DamageableGameObj.h
--- sourceold/scripts/DamageableGameObj.h 2011-10-11 21:56:32.453125000 +0800
+++ source/scripts/DamageableGameObj.h 2012-05-23 11:24:09.008789000 +0800
@@ -37,10 +37,10 @@
virtual DamageableGameObj *As_DamageableGameObj( void ) { return this; }
virtual int Get_Player_Type(void) const {return PlayerType;}
virtual void Set_Player_Type(int type);
- bool Is_Team_Player(void);
+ SCRIPTS_API bool Is_Team_Player(void);
Vector3 Get_Team_Color(void);
- bool Is_Teammate(DamageableGameObj * p_obj);
- bool Is_Enemy(DamageableGameObj * p_obj);
+ SCRIPTS_API bool Is_Teammate(DamageableGameObj * p_obj);
+ SCRIPTS_API bool Is_Enemy(DamageableGameObj * p_obj);
virtual void Import_Occasional( BitStreamClass &packet );
virtual void Export_Occasional( BitStreamClass &packet );
bool Is_Damaged()
diff -uwr sourceold/scripts/DamageableGameObjDef.h source/scripts/DamageableGameObjDef.h
--- sourceold/scripts/DamageableGameObjDef.h 2011-10-11 21:56:30.630859300 +0800
+++ source/scripts/DamageableGameObjDef.h 2012-05-06 16:37:05.098546900 +0800
@@ -26,6 +26,9 @@
DamageableGameObjDef( void );
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( DamageableGameObjDef, ScriptableGameObjDef );
int Get_Name_ID (void) const { return TranslatedNameID; }
int Get_Encyclopedia_Type (void) const { return EncyclopediaType; }
diff -uwr sourceold/scripts/DecorationPhysDefClass.h source/scripts/DecorationPhysDefClass.h
--- sourceold/scripts/DecorationPhysDefClass.h 2011-10-11 21:56:12.504882800 +0800
+++ source/scripts/DecorationPhysDefClass.h 2012-05-06 16:37:05.122960900 +0800
@@ -26,6 +26,9 @@
virtual const PersistFactoryClass & Get_Factory (void) const;
virtual bool Save(ChunkSaveClass &csave);
virtual bool Load(ChunkLoadClass &cload);
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(DecorationPhysDefClass,DynamicPhysDefClass);
protected:
friend class StaticPhysClass;
diff -uwr sourceold/scripts/Definition.h source/scripts/Definition.h
--- sourceold/scripts/Definition.h 2011-10-11 21:56:03.347656200 +0800
+++ source/scripts/Definition.h 2012-04-16 19:44:48.389648400 +0800
@@ -12,9 +12,9 @@
#ifndef TT_INCLUDE_DEFINITION_H
#define TT_INCLUDE_DEFINITION_H
#include "Editable.h"
+class FileClass;
class DefinitionClass : public EditableClass {
public:
- DECLARE_EDITABLE(DefinitionClass, EditableClass);
DefinitionClass (void);
virtual ~DefinitionClass (void);
virtual uint32 Get_Class_ID (void) const = 0;
@@ -30,6 +30,11 @@
void Set_User_Data (uint32 data) { m_GenericUserData = data; }
bool Is_Save_Enabled (void) const { return m_SaveEnabled; }
void Enable_Save (bool onoff) { m_SaveEnabled = onoff; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
+ DECLARE_EDITABLE(DefinitionClass, EditableClass);
protected:
int m_DefinitionMgrLink; // 0008
private:
Only in source/scripts: Doxyfile
diff -uwr sourceold/scripts/DynamicPhysClass.h source/scripts/DynamicPhysClass.h
--- sourceold/scripts/DynamicPhysClass.h 2011-10-11 21:55:09.958984300 +0800
+++ source/scripts/DynamicPhysClass.h 2012-04-14 04:09:47.578125000 +0800
@@ -26,12 +26,10 @@
virtual void Set_Model(RenderObjClass * model);
void Update_Visibility_Status(void);
virtual int Get_Vis_Object_ID(void);
-#ifndef TTLE_EXPORTS
virtual bool Is_Simulation_Disabled(void) { return _DisableDynamicPhysSimulation; }
virtual bool Is_Rendering_Disabled(void) { return _DisableDynamicPhysRendering; }
static void Disable_All_Simulation(bool onoff) { _DisableDynamicPhysSimulation = onoff; }
static void Disable_All_Rendering(bool onoff) { _DisableDynamicPhysRendering = onoff; }
-#endif
virtual bool Save (ChunkSaveClass &csave);
virtual bool Load (ChunkLoadClass &cload);
virtual void On_Post_Load(void);
@@ -41,10 +39,8 @@
int VisNodeID; // 007C 007C 0098 0094
unsigned int VisStatusLastUpdated; // 0080 0080 009C 0098
private:
-#ifndef TTLE_EXPORTS
- static REF_DECL2(_DisableDynamicPhysSimulation,bool);
- static REF_DECL2(_DisableDynamicPhysRendering,bool);
-#endif
+ static bool _DisableDynamicPhysSimulation;
+ static bool _DisableDynamicPhysRendering;
DynamicPhysClass(const DynamicPhysClass &);
DynamicPhysClass & operator = (const DynamicPhysClass &);
}; // 0084 0084 00A0 009C
diff -uwr sourceold/scripts/DynamicPhysDefClass.h source/scripts/DynamicPhysDefClass.h
--- sourceold/scripts/DynamicPhysDefClass.h 2011-10-11 21:54:51.746093700 +0800
+++ source/scripts/DynamicPhysDefClass.h 2012-05-06 16:37:05.135656200 +0800
@@ -24,6 +24,9 @@
virtual const char * Get_Type_Name(void) { return "DynamicPhysDef"; }
virtual bool Is_Type(const char *);
virtual bool Is_Valid_Config (StringClass &message);
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(DynamicPhysDefClass,PhysDefClass);
protected:
friend class DynamicPhysClass;
diff -uwr sourceold/scripts/GameObjManager.h source/scripts/GameObjManager.h
--- sourceold/scripts/GameObjManager.h 2012-02-13 13:28:20.240632800 +0800
+++ source/scripts/GameObjManager.h 2012-05-23 11:29:01.416015600 +0800
@@ -28,6 +28,7 @@
class BuildingGameObj;
class C4GameObj;
class BeaconGameObj;
+class ScriptZoneGameObj;
class GameObjManager
{
@@ -42,6 +43,7 @@
static SHADERS_API SList BeaconGameObjList;
static SHADERS_API SList SoldierGameObjList;
static SHADERS_API SList VehicleGameObjList;
+ static SHADERS_API SList ScriptZoneGameObjList;
#ifndef TTLE_EXPORTS
static REF_DECL2(CinematicFreezeActive, bool);
#endif
@@ -52,7 +54,7 @@
static void Think();
static void Post_Think();
static PhysicalGameObj* Find_PhysicalGameObj(int);
- static SmartGameObj* Find_SmartGameObj(int);
+ SCRIPTS_API static SmartGameObj* Find_SmartGameObj(int);
static void Init();
static void Shutdown();
static bool Save(ChunkSaveClass&);
diff -uwr sourceold/scripts/HarvesterClass.h source/scripts/HarvesterClass.h
--- sourceold/scripts/HarvesterClass.h 2011-10-11 21:52:33.959960900 +0800
+++ source/scripts/HarvesterClass.h 2012-04-27 22:33:07.907226500 +0800
@@ -98,6 +98,7 @@
{
return harvester;
}
+ State Get_State() {return state;}
void Harvest_Tiberium ();
void Play_Harvest_Animation (bool play);
void Think ();
Only in source/scripts: LoopedAnimationController.cpp
Only in source/scripts: LoopedAnimationController.h
diff -uwr sourceold/scripts/Matrix3D.cpp source/scripts/Matrix3D.cpp
--- sourceold/scripts/Matrix3D.cpp 2011-10-11 23:05:52.368164000 +0800
+++ source/scripts/Matrix3D.cpp 2012-04-23 13:05:44.549046900 +0800
@@ -48,6 +48,19 @@
}
+int Matrix3D::Is_Orthogonal(void) const
+{
+ Vector3 x(Row[0].X,Row[0].Y,Row[0].Z);
+ Vector3 y(Row[1].X,Row[1].Y,Row[1].Z);
+ Vector3 z(Row[2].X,Row[2].Y,Row[2].Z);
+ if (Vector3::Dot_Product(x,y) > WWMATH_EPSILON) return 0;
+ if (Vector3::Dot_Product(y,z) > WWMATH_EPSILON) return 0;
+ if (Vector3::Dot_Product(z,x) > WWMATH_EPSILON) return 0;
+ if (WWMath::Fabs(x.Length2() - 1.0f) > WWMATH_EPSILON) return 0;
+ if (WWMath::Fabs(y.Length2() - 1.0f) > WWMATH_EPSILON) return 0;
+ if (WWMath::Fabs(z.Length2() - 1.0f) > WWMATH_EPSILON) return 0;
+ return 1;
+}
void Matrix3D::Get_Orthogonal_Inverse (Matrix3D& inv) const
{
diff -uwr sourceold/scripts/Matrix3D.h source/scripts/Matrix3D.h
--- sourceold/scripts/Matrix3D.h 2011-10-11 21:50:23.392578100 +0800
+++ source/scripts/Matrix3D.h 2012-04-23 13:05:44.507054700 +0800
@@ -502,6 +502,7 @@
Row[1][2] = (float)(s*tmp1 + c*tmp2);
}
+ int Is_Orthogonal(void) const;
Vector3 applyTo (const Vector3& vector) const;
Vector3 getPosition () const;
Matrix3 getRotation () const;
diff -uwr sourceold/scripts/MoveablePhysDefClass.h source/scripts/MoveablePhysDefClass.h
--- sourceold/scripts/MoveablePhysDefClass.h 2011-10-11 21:49:58.500976500 +0800
+++ source/scripts/MoveablePhysDefClass.h 2012-05-06 16:37:05.148351600 +0800
@@ -27,6 +27,9 @@
float Get_Grav_Scale(void) { return GravScale; }
void Set_Mass(float new_mass) { Mass = new_mass; }
void Set_Grav_Scale(float new_g){ GravScale = new_g; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(MoveablePhysDefClass,DynamicPhysDefClass);
protected:
float Mass;
Only in source/scripts: NavalFactoryGameObj.h
Only in source/scripts: NavalFactoryGameObjDef.h
diff -uwr sourceold/scripts/Parameter.h source/scripts/Parameter.h
--- sourceold/scripts/Parameter.h 2011-10-11 21:49:22.120117100 +0800
+++ source/scripts/Parameter.h 2012-04-16 23:58:26.740234300 +0800
@@ -14,6 +14,7 @@
#include "Engine_String.h"
#include "Engine_Vector.h"
class DefParameterClass;
+class FileClass;
class ParameterClass
{
public:
@@ -64,6 +65,9 @@
virtual const char * Get_Units_Name (void) const;
virtual void Set_Units_Name (const char *units_name);
virtual void Copy_Value (const ParameterClass &src) { };
+#ifdef DDBEDIT
+ virtual void Dump(FileClass &file) = 0;
+#endif
static ParameterClass * Construct (ParameterClass::Type type, void *data, const char *param_name);
private:
bool IsModified;
diff -uwr sourceold/scripts/PhysDefClass.h source/scripts/PhysDefClass.h
--- sourceold/scripts/PhysDefClass.h 2011-10-11 21:49:10.120117100 +0800
+++ source/scripts/PhysDefClass.h 2012-05-06 16:37:05.173742200 +0800
@@ -100,6 +100,9 @@
virtual bool Is_Valid_Config (StringClass &message);
const StringClass & Get_Model_Name() { return ModelName; }
bool Get_Is_Pre_Lit() { return IsPreLit; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(PhysDefClass,DefinitionClass);
protected:
StringClass ModelName;
diff -uwr sourceold/scripts/PhysicalGameObj.h source/scripts/PhysicalGameObj.h
--- sourceold/scripts/PhysicalGameObj.h 2012-02-17 16:57:48.055664000 +0800
+++ source/scripts/PhysicalGameObj.h 2012-05-23 11:24:07.594726500 +0800
@@ -47,7 +47,7 @@
void Set_Position(const Vector3 & pos);
float Get_Facing(void) const;
inline RenderObjClass * Peek_Model( void ) { return Peek_Physical_Object()->Peek_Model(); }
- AnimControlClass* Get_Anim_Control( void );
+ SCRIPTS_API AnimControlClass* Get_Anim_Control( void );
void Set_Anim_Control( AnimControlClass * anim_control );
virtual void Set_Animation( const char *animation_name, bool looping = true, float frame_offset = 0.0f );
virtual void Set_Animation_Frame ( const char *animation_name, int frame );
@@ -62,7 +62,7 @@
virtual bool Takes_Explosion_Damage( void ) { return true; }
int Get_Type() const { return Get_Definition().Type; }
virtual void Post_Think();
- void Set_Collision_Group( int group );
+ void SCRIPTS_API Set_Collision_Group( int group );
Collision_Group_Type Get_Collision_Group() const { return PhysObj->Get_Collision_Group(); }
virtual ExpirationReactionType Object_Expired( PhysClass * observed_obj ) { Set_Delete_Pending(); return 1; }
virtual PhysicalGameObj *As_PhysicalGameObj( void ) { return this; }
@@ -109,7 +109,7 @@
bool Is_HUD_Pokable_Indicator_Enabled( void ) { return HUDPokableIndicatorEnabled; }
virtual void Set_Player_Type(int type);
virtual void Object_Shattered_Something(PhysClass * observed_obj, PhysClass * shattered_obj, int surface_type);
- void Clear_Animation() {if (AnimControl) {AnimControl->Set_Mode(ANIM_MODE_STOP,0);ClearAnimation = true;Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);}}
+ void Clear_Animation() {if (AnimControl) {AnimControl->Set_Animation((const char*)NULL, 0, 0);AnimControl->Set_Mode(ANIM_MODE_STOP,0);ClearAnimation = true;Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);}}
protected:
ActiveConversationClass *ActiveConversation;
private:
diff -uwr sourceold/scripts/PhysicalGameObjDef.h source/scripts/PhysicalGameObjDef.h
--- sourceold/scripts/PhysicalGameObjDef.h 2011-10-11 21:49:01.494140600 +0800
+++ source/scripts/PhysicalGameObjDef.h 2012-05-06 16:37:05.186437500 +0800
@@ -21,6 +21,9 @@
virtual bool Is_Valid_Config (StringClass &message);
int Get_Phys_Def_ID( void ) const { return PhysDefID; }
int Get_Orator_Type( void ) const { return OratorType; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( PhysicalGameObjDef, DamageableGameObjDef );
protected:
int Type;
diff -uwr sourceold/scripts/PhysicsSceneClass.h source/scripts/PhysicsSceneClass.h
--- sourceold/scripts/PhysicsSceneClass.h 2011-10-11 21:48:58.233398400 +0800
+++ source/scripts/PhysicsSceneClass.h 2012-04-14 04:09:46.643554600 +0800
@@ -112,6 +112,14 @@
SHADERS_API bool Intersection_Test(PhysMeshIntersectionTestClass & meshtest,bool use_collision_region = false);
SHADERS_API bool Intersection_Test(const AABoxClass & box,int collision_group,int collision_type,bool use_collision_region = false);
SHADERS_API bool Intersection_Test(const OBBoxClass & box,int collision_group,int collision_type,bool use_collision_region = false);
+ bool Real_Cast_Ray(PhysRayCollisionTestClass & raytest,bool use_collision_region = false);
+ bool Real_Cast_AABox(PhysAABoxCollisionTestClass & boxtest,bool use_collision_region = false);
+ bool Real_Cast_OBBox(PhysOBBoxCollisionTestClass & boxtest,bool use_collision_region = false);
+ bool Real_Intersection_Test1(PhysAABoxIntersectionTestClass & boxtest,bool use_collision_region = false);
+ bool Real_Intersection_Test2(PhysOBBoxIntersectionTestClass & boxtest,bool use_collision_region = false);
+ bool Real_Intersection_Test3(PhysMeshIntersectionTestClass & meshtest,bool use_collision_region = false);
+ bool Real_Intersection_Test4(const AABoxClass & box,int collision_group,int collision_type,bool use_collision_region = false);
+ bool Real_Intersection_Test5(const OBBoxClass & box,int collision_group,int collision_type,bool use_collision_region = false);
void Force_Dynamic_Objects_Awake(const AABoxClass & box);
void Collect_Objects(const Vector3 & point,bool static_objs, bool dynamic_objs,MultiListClass * list);
void Collect_Objects(const AABoxClass & box,bool static_objs, bool dynamic_objs,MultiListClass * list);
@@ -258,7 +266,7 @@
virtual void Destroy_Iterator(SceneIterator *) {}
virtual void Register(RenderObjClass * obj,RegType for_what);
virtual void Unregister(RenderObjClass * obj,RegType for_what);
- void Get_Level_Extents (Vector3 &min, Vector3 &max);
+ SHADERS_API void Get_Level_Extents (Vector3 &min, Vector3 &max);
void Enable_Debug_Display(bool onoff) { DebugDisplayEnabled = onoff; }
bool Is_Debug_Display_Enabled(void) { return DebugDisplayEnabled; }
void Enable_Projector_Debug_Display(bool onoff) { ProjectorDebugDisplayEnabled = onoff; }
diff -uwr sourceold/scripts/PowerPlantGameObj.h source/scripts/PowerPlantGameObj.h
--- sourceold/scripts/PowerPlantGameObj.h 2011-10-11 21:48:42.026367100 +0800
+++ source/scripts/PowerPlantGameObj.h 2012-05-23 11:14:11.018554600 +0800
@@ -20,7 +20,7 @@
~PowerPlantGameObj (void);
virtual void Init( void );
void Init (const PowerPlantGameObjDef & definition);
- const PowerPlantGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const PowerPlantGameObjDef & Get_Definition (void) const;
PowerPlantGameObj * As_PowerPlantGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/PowerPlantGameObjDef.h source/scripts/PowerPlantGameObjDef.h
--- sourceold/scripts/PowerPlantGameObjDef.h 2011-10-11 21:48:40.079101500 +0800
+++ source/scripts/PowerPlantGameObjDef.h 2012-05-06 16:37:05.200109400 +0800
@@ -22,6 +22,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (PowerPlantGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/PowerupGameObjDef.h source/scripts/PowerupGameObjDef.h
--- sourceold/scripts/PowerupGameObjDef.h 2011-10-11 21:48:36.038085900 +0800
+++ source/scripts/PowerupGameObjDef.h 2012-05-06 16:37:05.212804700 +0800
@@ -28,6 +28,9 @@
bool Is_Persistant() const {return Persistent;}
bool Is_Always_Allow_Grant() const {return AlwaysAllowGrant;}
int Get_Grant_Sound() const {return GrantSoundID;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (PowerUpGameObjDef, SimpleGameObjDef);
public:
int GrantShieldType;
Only in source/scripts: PresetMgr.cpp
Only in source/scripts: PresetMgr.h
diff -uwr sourceold/scripts/PurchaseSettingsDefClass.h source/scripts/PurchaseSettingsDefClass.h
--- sourceold/scripts/PurchaseSettingsDefClass.h 2011-10-25 15:39:17.330078100 +0800
+++ source/scripts/PurchaseSettingsDefClass.h 2012-05-06 16:37:05.226476600 +0800
@@ -18,6 +18,8 @@
#endif
#include "NetworkObjectClass.h"
#include "ExtendedNetworkObject.h"
+#include "BuildingGameObjDef.h"
+using namespace BuildingConstants;
#define PTTEAM(t) (t?0:1) //Convert a normal team into a PT team
class PurchaseSettingsDefClass abstract : public DefinitionClass, public NetworkObjectClass {
public:
@@ -46,6 +48,9 @@
uint32 Get_Class_ID() const;
PersistClass *Create() const;
static SCRIPTS_API PurchaseSettingsDefClass *Find_Definition(TYPE type,TEAM team);
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(PurchaseSettingsDefClass,DefinitionClass);
void Delete(void)
{
@@ -95,6 +100,34 @@
{
return type;
}
+ int Get_Tech_Level(int index)
+ {
+ return TechLevel[index];
+ }
+ bool Get_Factory_Not_Required(int index)
+ {
+ return FactoryNotRequired[index];
+ }
+ BuildingType Get_Factory_Building(int index)
+ {
+ return Factory[index];
+ }
+ BuildingType Get_Tech_Building(int index)
+ {
+ return TechBuilding[index];
+ }
+ void Set_Tech_Level(int index,int level)
+ {
+ TechLevel[index] = level;
+ }
+ void Set_Factory_Building(int index,BuildingType type)
+ {
+ Factory[index] = type;
+ }
+ void Set_Tech_Building(int index,BuildingType type)
+ {
+ TechBuilding[index] = type;
+ }
bool Get_Hidden(int index)
{
return Hidden[index];
@@ -160,6 +193,10 @@
bool Hidden[10];
bool Disabled[10];
bool Busy[10];
+ int TechLevel[10];
+ BuildingType Factory[10];
+ BuildingType TechBuilding[10];
+ bool FactoryNotRequired[10];
int altpresetids[10][3];
StringClass alttextures[10][3];
bool PageHidden;
Only in source/scripts: Random2Class.cpp
diff -uwr sourceold/scripts/Random2Class.h source/scripts/Random2Class.h
--- sourceold/scripts/Random2Class.h 2011-10-11 21:48:09.370117100 +0800
+++ source/scripts/Random2Class.h 2012-05-01 21:00:32.585937500 +0800
@@ -103,6 +103,8 @@
int mti;
};
#ifndef TTLE_EXPORTS
+#ifndef TDBEDIT
extern REF_DECL2(FreeRandom, CRandom);
#endif
#endif
+#endif
Only in source/scripts: Random3Class.cpp
Only in source/scripts: Random3Class.h
Only in source/scripts: RandomClass.cpp
Only in source/scripts: RandomClass.h
diff -uwr sourceold/scripts/RefineryGameObjDef.h source/scripts/RefineryGameObjDef.h
--- sourceold/scripts/RefineryGameObjDef.h 2011-10-11 21:47:47.846679600 +0800
+++ source/scripts/RefineryGameObjDef.h 2012-05-06 16:37:05.239171900 +0800
@@ -25,10 +25,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
- int Get_Harvester_ID() const
- {
- return HarvesterDefID;
- }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (RefineryGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/RepairBayGameObj.h source/scripts/RepairBayGameObj.h
--- sourceold/scripts/RepairBayGameObj.h 2011-10-11 21:44:44.096679600 +0800
+++ source/scripts/RepairBayGameObj.h 2012-05-23 11:14:19.778320300 +0800
@@ -26,7 +26,7 @@
~RepairBayGameObj (void);
virtual void Init( void );
void Init (const RepairBayGameObjDef & definition);
- const RepairBayGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const RepairBayGameObjDef & Get_Definition (void) const;
RepairBayGameObj * As_RepairBayGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/RepairBayGameObjDef.h source/scripts/RepairBayGameObjDef.h
--- sourceold/scripts/RepairBayGameObjDef.h 2011-10-11 21:44:42.151367100 +0800
+++ source/scripts/RepairBayGameObjDef.h 2012-05-06 16:37:05.252843700 +0800
@@ -26,6 +26,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (RepairBayGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
Only in source/scripts: SCAnnouncement.h
diff -uwr sourceold/scripts/SamSiteGameObj.h source/scripts/SamSiteGameObj.h
--- sourceold/scripts/SamSiteGameObj.h 2011-10-11 21:44:36.515625000 +0800
+++ source/scripts/SamSiteGameObj.h 2012-05-23 11:14:44.942382800 +0800
@@ -26,7 +26,7 @@
~SamSiteGameObj();
void Init();
void Init(const SamSiteGameObjDef &);
- const SamSiteGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const SamSiteGameObjDef & Get_Definition( void ) const ;
bool Save(ChunkSaveClass &csave);
bool Load(ChunkLoadClass &cload);
void Export_Frequent(BitStreamClass &BitStream);
diff -uwr sourceold/scripts/SamSiteGameObjDef.h source/scripts/SamSiteGameObjDef.h
--- sourceold/scripts/SamSiteGameObjDef.h 2011-10-11 21:44:34.754882800 +0800
+++ source/scripts/SamSiteGameObjDef.h 2012-05-06 16:37:05.265539100 +0800
@@ -21,6 +21,10 @@
bool Load(ChunkLoadClass &cload);
uint32 Get_Class_ID() const;
PersistClass *Create() const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE(SamSiteGameObjDef,SmartGameObjDef);
friend class PresetDump;
};
diff -uwr sourceold/scripts/ScriptManager.h source/scripts/ScriptManager.h
--- sourceold/scripts/ScriptManager.h 2011-03-28 17:16:44.035156200 +0800
+++ source/scripts/ScriptManager.h 2012-05-02 02:01:20.366210900 +0800
@@ -1,3 +1,14 @@
+/* Renegade Scripts.dll
+ Copyright 2011 Tiberian Technologies
+
+ This file is part of the Renegade scripts.dll
+ The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version. See the file COPYING for more details.
+ In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
+ Only the source code to the module(s) containing the licenced code has to be released.
+*/
#ifndef TT_INCLUDE_SCRIPTMANAGER_H
#define TT_INCLUDE_SCRIPTMANAGER_H
#include "engine_vector.h"
diff -uwr sourceold/scripts/ScriptZoneGameObjDef.h source/scripts/ScriptZoneGameObjDef.h
--- sourceold/scripts/ScriptZoneGameObjDef.h 2011-10-11 21:44:14.845703100 +0800
+++ source/scripts/ScriptZoneGameObjDef.h 2012-05-06 16:37:05.291906200 +0800
@@ -39,6 +39,9 @@
const Vector3 &Get_Color() const {return Color;}
ZoneConstants::ZoneType Get_Type() const {return ZoneType;}
int Get_Preset_ID() const {return PresetID;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (ScriptZoneGameObjDef, ScriptableGameObjDef);
protected:
ZoneConstants::ZoneType ZoneType;
diff -uwr sourceold/scripts/ScriptableGameObj.h source/scripts/ScriptableGameObj.h
--- sourceold/scripts/ScriptableGameObj.h 2011-10-11 21:44:26.625000000 +0800
+++ source/scripts/ScriptableGameObj.h 2012-05-12 19:48:12.908203100 +0800
@@ -64,7 +64,7 @@
virtual void Think();
virtual void Post_Think();
virtual void Get_Position(Vector3 * set_pos) const = 0;
- void Add_Observer( GameObjObserverClass * observer );
+ void SCRIPTS_API Add_Observer( GameObjObserverClass * observer );
void SCRIPTS_API Remove_Observer( GameObjObserverClass * observer );
void Remove_All_Observers(void);
void Start_Observers( void );
diff -uwr sourceold/scripts/ScriptableGameObjDef.h source/scripts/ScriptableGameObjDef.h
--- sourceold/scripts/ScriptableGameObjDef.h 2011-10-11 21:44:24.187500000 +0800
+++ source/scripts/ScriptableGameObjDef.h 2012-05-06 16:37:05.279210900 +0800
@@ -18,6 +18,9 @@
ScriptableGameObjDef( void );
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( ScriptableGameObjDef, BaseGameObjDef );
DynamicVectorClass ScriptNameList; // 001C
DynamicVectorClass ScriptParameterList; // 0034
diff -uwr sourceold/scripts/SimpleGameObjDef.h source/scripts/SimpleGameObjDef.h
--- sourceold/scripts/SimpleGameObjDef.h 2011-10-11 21:43:54.694335900 +0800
+++ source/scripts/SimpleGameObjDef.h 2012-05-06 16:37:05.310460900 +0800
@@ -22,6 +22,10 @@
PersistClass *Create() const;
bool Get_Is_Editor_Object() const { return IsEditorObject; }
int Get_Player_Terminal_Type() const {return PlayerTerminalType;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE( SimpleGameObjDef, PhysicalGameObjDef );
protected:
bool IsEditorObject; // 00A5
diff -uwr sourceold/scripts/SmartGameObj.h source/scripts/SmartGameObj.h
--- sourceold/scripts/SmartGameObj.h 2011-10-11 21:43:45.486328100 +0800
+++ source/scripts/SmartGameObj.h 2012-05-23 11:29:02.688476500 +0800
@@ -58,8 +58,8 @@
virtual void Set_Control_Owner(int control_owner) { ControlOwner = control_owner; }
PlayerDataClass * Get_Player_Data( void ) { return PlayerData; }
void Set_Player_Data( PlayerDataClass * player_data );
- bool Has_Player(void);
- bool Is_Human_Controlled(void);
+ SCRIPTS_API bool Has_Player(void);
+ SCRIPTS_API bool Is_Human_Controlled(void);
bool Is_Controlled_By_Me(void);
virtual void Apply_Control( void );
virtual void Think();
diff -uwr sourceold/scripts/SmartGameObjDef.h source/scripts/SmartGameObjDef.h
--- sourceold/scripts/SmartGameObjDef.h 2011-10-11 21:43:42.815429600 +0800
+++ source/scripts/SmartGameObjDef.h 2012-05-06 16:37:05.324132800 +0800
@@ -26,6 +26,9 @@
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
bool Is_Stealthed() const {return IsStealthUnit;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( SmartGameObjDef, ArmedGameObjDef );
protected:
float SightRange;
diff -uwr sourceold/scripts/SoldierFactoryGameObj.h source/scripts/SoldierFactoryGameObj.h
--- sourceold/scripts/SoldierFactoryGameObj.h 2011-10-11 21:43:39.913085900 +0800
+++ source/scripts/SoldierFactoryGameObj.h 2012-05-23 11:15:03.379882800 +0800
@@ -20,7 +20,7 @@
~SoldierFactoryGameObj (void);
virtual void Init( void );
void Init (const SoldierFactoryGameObjDef & definition);
- const SoldierFactoryGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const SoldierFactoryGameObjDef & Get_Definition (void) const;
SoldierFactoryGameObj * As_SoldierFactoryGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/SoldierFactoryGameObjDef.h source/scripts/SoldierFactoryGameObjDef.h
--- sourceold/scripts/SoldierFactoryGameObjDef.h 2011-10-11 21:43:37.670898400 +0800
+++ source/scripts/SoldierFactoryGameObjDef.h 2012-05-06 16:37:05.337804700 +0800
@@ -22,6 +22,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (SoldierFactoryGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/SoldierGameObj.h source/scripts/SoldierGameObj.h
--- sourceold/scripts/SoldierGameObj.h 2012-02-23 16:37:06.592773400 +0800
+++ source/scripts/SoldierGameObj.h 2012-05-23 11:25:50.666992100 +0800
@@ -17,13 +17,14 @@
#include "SmartGameObj.h"
#include "PhysClass.h"
#include "ArmorWarheadManager.h"
+#include "TransitionGameObjDef.h"
class TransitionInstanceClass;
class RenderObjClass;
class SimpleAnimControlClass;
class TransitionCompletionDataStruct
{
public:
- int Type;
+ TransitionDataClass::StyleType Type;
ReferencerClass Vehicle;
bool Save(ChunkSaveClass &csave);
bool Load(ChunkLoadClass &cload);
@@ -44,7 +45,7 @@
void Init( const SoldierGameObjDef & definition );
void Copy_Settings( const SoldierGameObjDef & definition );
void SCRIPTS_API Re_Init( const SoldierGameObjDef & definition );
- const SoldierGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const SoldierGameObjDef & Get_Definition( void ) const ;
virtual bool Save( ChunkSaveClass & csave );
virtual bool Load( ChunkLoadClass & cload );
virtual void On_Post_Load( void );
@@ -58,6 +59,12 @@
virtual void Apply_Damage( const OffenseObjectClass & damager, float scale = 1.0f, int alternate_skin = -1 );
virtual void Apply_Damage_Extended( const OffenseObjectClass & offense, float scale = 1.0f,
const Vector3 & direction = Vector3( 0,0,0 ), const char * collision_box_name = NULL );
+
+ /*! A clone of Apply_Damage() which ignores whether the soldier is currently in a vehicle - this
+ * is necessary for dp88_remoteControlConsole to kill the driver of a remote control vehicle when
+ * the 'dummy' version of the driver is killed. */
+ virtual void Apply_Damage_IgnoreVehicleCheck( const OffenseObjectClass & damager, float scale = 1.0f, int alternate_skin = -1 );
+
virtual void Completely_Damaged( const OffenseObjectClass & damager ) {}
virtual CollisionReactionType Collision_Occurred( const CollisionEventClass & event );
virtual Vector3 Get_Bullseye_Position( void );
@@ -81,7 +88,7 @@
void Interpret_Sc_State_Data(HumanStateClass::HumanStateType state,
int sub_state, LPCSTR trans_name, const Vector3 & velocity, const Vector3 & sc_position);
int Tally_Vis_Visible_Soldiers(void);
- bool Is_In_Elevator(void);
+ SCRIPTS_API bool Is_In_Elevator(void);
virtual void Export_Creation( BitStreamClass &packet );
virtual void Import_Creation( BitStreamClass &packet );
virtual void Export_Rare( BitStreamClass &packet );
diff -uwr sourceold/scripts/SoldierGameObjDef.h source/scripts/SoldierGameObjDef.h
--- sourceold/scripts/SoldierGameObjDef.h 2012-02-13 17:49:26.127351500 +0800
+++ source/scripts/SoldierGameObjDef.h 2012-05-06 16:37:05.348546900 +0800
@@ -30,9 +30,13 @@
virtual bool Load( ChunkLoadClass &cload );
virtual const PersistFactoryClass & Get_Factory( void ) const;
DialogueClass * Get_Dialog_List( void ) { return DialogList; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE( SoldierGameObjDef, SmartGameObjDef );
- float Get_Skeleton_Height() {return SkeletonHeight;};
- float Get_Skeleton_Width() {return SkeletonWidth;};
+ float Get_Skeleton_Height() const {return SkeletonHeight;};
+ float Get_Skeleton_Width() const {return SkeletonWidth;};
bool Is_Spy() const {return IsSpy;}
protected:
float TurnRate;
diff -uwr sourceold/scripts/SoundBufferClass.h source/scripts/SoundBufferClass.h
--- sourceold/scripts/SoundBufferClass.h 2011-10-11 21:43:30.267578100 +0800
+++ source/scripts/SoundBufferClass.h 2012-04-14 04:09:47.430664000 +0800
@@ -23,6 +23,9 @@
uint32 uBits; // 52
uint32 uChannels; // 56
uint32 uType; // 60
+ unsigned int flag;
+ int cachecount;
+ SoundBufferClass();
virtual ~SoundBufferClass();
virtual bool Load_From_File (const char* cFile);
virtual bool Load_From_File (FileClass& xFile);
@@ -38,7 +41,19 @@
virtual uint32 Get_Type () const;
virtual bool Is_Streaming () const;
virtual void Free_Buffer ();
- virtual void Determine_Stats (char*);
+ virtual void Determine_Stats (char *stats);
+};
+
+class StreamSoundBufferClass : public SoundBufferClass {
+public:
+ StreamSoundBufferClass();
+ virtual ~StreamSoundBufferClass();
+ virtual bool Load_From_File (const char* cFile);
+ virtual bool Load_From_File (FileClass& xFile);
+ virtual bool Load_From_Memory (const char* cBuffer, uint32 uLength);
+ virtual bool Is_Streaming () const;
+ virtual void Free_Buffer ();
+ virtual bool Load_From_File(void *handle, uint32 u1, uint32 u2);
};
#endif
\ No newline at end of file
diff -uwr sourceold/scripts/SpecialEffectsGameObj.h source/scripts/SpecialEffectsGameObj.h
--- sourceold/scripts/SpecialEffectsGameObj.h 2011-10-11 21:43:25.304687500 +0800
+++ source/scripts/SpecialEffectsGameObj.h 2012-05-23 11:15:20.002929600 +0800
@@ -20,7 +20,7 @@
const PersistFactoryClass &Get_Factory() const;
void Init();
void Init(const SpecialEffectsGameObjDef &);
- const SpecialEffectsGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const SpecialEffectsGameObjDef & Get_Definition( void ) const ;
bool Save(ChunkSaveClass &csave);
bool Load(ChunkLoadClass &cload);
void Do_Effect();
diff -uwr sourceold/scripts/SpecialEffectsGameObjDef.h source/scripts/SpecialEffectsGameObjDef.h
--- sourceold/scripts/SpecialEffectsGameObjDef.h 2011-10-11 21:43:23.110351500 +0800
+++ source/scripts/SpecialEffectsGameObjDef.h 2012-05-06 16:37:05.358312500 +0800
@@ -21,6 +21,10 @@
bool Load(ChunkLoadClass &cload);
uint32 Get_Class_ID() const;
PersistClass *Create() const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE(SpecialEffectsGameObjDef,PhysicalGameObjDef);
private:
void Save_Variables(ChunkSaveClass &csave);
diff -uwr sourceold/scripts/TeamPurchaseSettingsDefClass.h source/scripts/TeamPurchaseSettingsDefClass.h
--- sourceold/scripts/TeamPurchaseSettingsDefClass.h 2011-10-11 21:41:45.217773400 +0800
+++ source/scripts/TeamPurchaseSettingsDefClass.h 2012-05-06 16:37:05.368078100 +0800
@@ -35,6 +35,9 @@
uint32 Get_Class_ID() const;
virtual PersistClass *Create() const;
static SCRIPTS_API TeamPurchaseSettingsDefClass *Get_Definition(TEAM team);
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE(TeamPurchaseSettingsDefClass,DefinitionClass);
void Delete(void)
{
diff -uwr sourceold/scripts/TransitionGameObj.h source/scripts/TransitionGameObj.h
--- sourceold/scripts/TransitionGameObj.h 2011-10-11 21:41:35.694335900 +0800
+++ source/scripts/TransitionGameObj.h 2012-05-23 11:15:26.267578100 +0800
@@ -22,21 +22,24 @@
Matrix3D Transform;
int LadderIndex;
public:
+ const PersistFactoryClass &Get_Factory() const;
TransitionGameObj();
~TransitionGameObj();
- void On_Post_Load();
- const PersistFactoryClass &Get_Factory() const;
- bool Save(ChunkSaveClass &csave);
- bool Load(ChunkLoadClass &cload);
void Init();
void Init(const TransitionGameObjDef &definition);
- const TransitionGameObjDef & Get_Definition( void ) const ;
+ SCRIPTS_API const TransitionGameObjDef & Get_Definition( void ) const ;
+ bool Save(ChunkSaveClass &csave);
+ bool Load(ChunkLoadClass &cload);
+ void On_Post_Load();
void Set_Transform(const Matrix3D &tm);
const Matrix3D &Get_Transform() const;
- DynamicVectorClass &Get_Transitions() {return Transitions;}
- const DynamicVectorClass &Get_Transitions() const {return Transitions;}
void Create_Transitions();
void Destroy_Transitions();
+ void Update_Transitions();
+ void Set_Ladder_Index();
+ int Get_Transition_Count() {return Transitions.Count();};
+ TransitionInstanceClass *Get_Transition(int trans) {return Transitions[trans];}
+ int Get_Ladder_Index() {return LadderIndex;}
};
#endif
diff -uwr sourceold/scripts/TransitionGameObjDef.h source/scripts/TransitionGameObjDef.h
--- sourceold/scripts/TransitionGameObjDef.h 2011-10-11 21:41:33.498046800 +0800
+++ source/scripts/TransitionGameObjDef.h 2012-05-06 16:37:05.377843700 +0800
@@ -16,7 +16,7 @@
class TransitionDataClass
{
public:
- enum TriggerType {
+ enum StyleType {
LADDER_EXIT_TOP,
LADDER_EXIT_BOTTOM,
LADDER_ENTER_TOP,
@@ -28,11 +28,11 @@
VEHICLE_ENTER,
VEHICLE_EXIT,
};
- TriggerType triggerType; // 0000
- OBBoxClass triggerZone; // 0004
- StringClass animationName; // 0040
- Matrix3D characterTransform; // 0044
- TransitionDataClass() : triggerType(LADDER_EXIT_TOP)
+ StyleType Type; // 0000
+ OBBoxClass TriggerZone; // 0004
+ StringClass AnimationName; // 0040
+ Matrix3D CharacterTransform; // 0044
+ TransitionDataClass() : Type(LADDER_EXIT_TOP)
{
}
bool Save(ChunkSaveClass &csave);
@@ -40,9 +40,6 @@
}; // 0074
class TransitionGameObjDef : public BaseGameObjDef {
-private:
- DECLARE_EDITABLE(TransitionGameObjDef,BaseGameObjDef);
- DynamicVectorClass Transitions;
public:
TransitionGameObjDef() {};
~TransitionGameObjDef();
@@ -52,6 +49,14 @@
uint32 Get_Class_ID() const;
PersistClass *Create() const;
void Free_Transition_List();
+ DynamicVectorClass &Get_Transitions() {return Transitions;}
+ const DynamicVectorClass &Get_Transitions() const {return Transitions;}
+#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 2011-10-11 21:41:30.524414000 +0800
+++ source/scripts/TransitionInstanceClass.h 2012-04-14 04:09:46.772460900 +0800
@@ -18,16 +18,24 @@
#include "Matrix3D.h"
#include "ReferencerClass.h"
#include "TransitionGameObjDef.h"
+#include "VehicleGameObj.h"
class TransitionInstanceClass
{
- Matrix3D characterTransform; // 0000
- OBBoxClass triggerZone; // 0030
- ReferencerClass vehicle; // 006C
- TransitionDataClass* definition; // 007C
- int ladderId; // 0080
+private:
+ Matrix3D CharacterTransform; // 0000
+ OBBoxClass TriggerZone; // 0030
+ ReferencerClass Vehicle; // 006C
+ TransitionDataClass* Definition; // 007C
+ int LadderId; // 0080
public:
- int Get_Type() {return definition->triggerType;}
+ TransitionInstanceClass();
+ ~TransitionInstanceClass();
+ void Start(SoldierGameObj *soldier);
+ bool Check(SoldierGameObj *soldier, bool b);
static void End(SoldierGameObj *,TransitionCompletionDataStruct *);
+ void Set_Parent_Transform(Matrix3D const &tm);
+ TransitionDataClass::StyleType Get_Type() {return Definition->Type;}
+ void Set_Vehicle(VehicleGameObj *obj) {Vehicle = obj;}
}; // 0084
#endif
\ No newline at end of file
Only in source/scripts: TwiddlerClass.cpp
diff -uwr sourceold/scripts/TwiddlerClass.h source/scripts/TwiddlerClass.h
--- sourceold/scripts/TwiddlerClass.h 2011-10-11 21:41:14.732421800 +0800
+++ source/scripts/TwiddlerClass.h 2012-05-06 16:37:05.393468700 +0800
@@ -26,6 +26,9 @@
uint32 Get_Class_ID() const {return 57344;}
virtual uint32 Get_Indirect_Class_ID() const {return m_IndirectClassID;}
virtual void Set_Indirect_Class_ID(uint32 class_id) {m_IndirectClassID = class_id;}
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE( TwiddlerClass, DefinitionClass );
private:
uint32 m_IndirectClassID;
diff -uwr sourceold/scripts/VehicleFactoryGameObj.h source/scripts/VehicleFactoryGameObj.h
--- sourceold/scripts/VehicleFactoryGameObj.h 2011-10-21 09:32:27.700195300 +0800
+++ source/scripts/VehicleFactoryGameObj.h 2012-05-23 15:31:23.082031200 +0800
@@ -23,7 +23,7 @@
~VehicleFactoryGameObj (void);
virtual void Init( void );
void Init (const VehicleFactoryGameObjDef & definition);
- const VehicleFactoryGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const VehicleFactoryGameObjDef & Get_Definition (void) const;
VehicleFactoryGameObj * As_VehicleFactoryGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
@@ -44,6 +44,11 @@
void Export_Rare (BitStreamClass &packet);
static void Set_Max_Vehicles_Per_Team(int max) { MaxVehiclesPerTeam = max; }
static int Get_Max_Vehicles_Per_Team(void) { return MaxVehiclesPerTeam; }
+ void Set_Busy(bool busy)
+ {
+ IsBusy = busy;
+ Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);
+ }
protected:
void Load_Variables (ChunkLoadClass &cload);
virtual void Destroy_Blocking_Objects (void);
diff -uwr sourceold/scripts/VehicleFactoryGameObjDef.h source/scripts/VehicleFactoryGameObjDef.h
--- sourceold/scripts/VehicleFactoryGameObjDef.h 2011-10-11 21:40:57.450195300 +0800
+++ source/scripts/VehicleFactoryGameObjDef.h 2012-05-06 16:37:05.403234400 +0800
@@ -30,6 +30,9 @@
float Get_Total_Building_Time(void) const { return TotalBuildingTime; }
bool Get_Flying_Waypaths_Enabled() const { return EnableFlyingWaypaths; }
bool Get_Build_Ground_Only() const { return BuildGroundOnly; }
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (VehicleFactoryGameObjDef, BuildingGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/VehicleGameObjDef.h source/scripts/VehicleGameObjDef.h
--- sourceold/scripts/VehicleGameObjDef.h 2012-02-13 17:16:25.394929700 +0800
+++ source/scripts/VehicleGameObjDef.h 2012-05-06 16:37:05.414953100 +0800
@@ -43,7 +43,14 @@
virtual PersistClass * Create( void ) const ;
virtual bool Save( ChunkSaveClass &csave );
virtual bool Load( ChunkLoadClass &cload );
+#ifdef TT_EXPORTS
+ virtual void On_Post_Load( void );
+#endif
virtual const PersistFactoryClass & Get_Factory( void ) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+ virtual void DumpPhys (FileClass &file);
+#endif
DECLARE_EDITABLE( VehicleGameObjDef, SmartGameObjDef );
DynamicVectorClass * Get_Transition_List( void ) { return &Transitions; }
const DynamicVectorClass & Get_Transition_List( void ) const { return Transitions; }
@@ -54,6 +61,7 @@
VehicleType Get_Type() const {return Type;}
const StringClass &Get_Fire0_Anim() const {return Fire0Anim;}
const StringClass &Get_Fire1_Anim() const {return Fire1Anim;}
+ bool Get_Build_At_Ground() const {return BuildAtGround;}
protected:
VehicleType Type;
StringClass TypeName;
@@ -76,6 +84,8 @@
int NodDestroyReportID;
bool CanBeStolen;
bool AllowStealthWhileEmpty;
+ bool BuildAtGround;
+ bool DualAim;
friend class VehicleGameObj;
friend class PresetDump;
}; // size: 324
diff -uwr sourceold/scripts/WWAudioClass.h source/scripts/WWAudioClass.h
--- sourceold/scripts/WWAudioClass.h 2012-02-17 15:02:45.624023400 +0800
+++ source/scripts/WWAudioClass.h 2012-04-14 04:09:47.830078100 +0800
@@ -36,6 +36,7 @@
typedef void *HSAMPLE;
typedef void *H3DSAMPLE;
typedef void *H3DPOBJECT;
+typedef void *HSTREAM;
typedef signed int HTIMER;
typedef void (_stdcall *LPFNSOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param);
typedef void (_stdcall *LPFNEOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param);
@@ -254,7 +255,7 @@
SoundBufferClass * Get_Sound_Buffer (FileClass &file, const char *string_id, bool is_3d);
SoundBufferClass * Get_Sound_Buffer (const char *filename, bool is_3d);
SoundBufferClass * Find_Cached_Buffer (const char *string_id);
- SoundBufferClass * Create_Sound_Buffer (FileClass &file, const char *string_id, bool is_3d);
+ SHADERS_API SoundBufferClass * Create_Sound_Buffer (FileClass &file, const char *string_id, bool is_3d);
SoundBufferClass * Create_Sound_Buffer (unsigned char *file_image, unsigned long bytes, const char *string_id, bool is_3d);
SHADERS_API bool Cache_Buffer (SoundBufferClass *buffer, const char *string_id);
bool Free_Cache_Space (int bytes);
diff -uwr sourceold/scripts/WarFactoryGameObj.h source/scripts/WarFactoryGameObj.h
--- sourceold/scripts/WarFactoryGameObj.h 2011-10-11 21:40:43.303710900 +0800
+++ source/scripts/WarFactoryGameObj.h 2012-05-23 11:16:03.893554600 +0800
@@ -22,7 +22,7 @@
~WarFactoryGameObj (void);
virtual void Init( void );
void Init (const WarFactoryGameObjDef & definition);
- const WarFactoryGameObjDef & Get_Definition (void) const;
+ SCRIPTS_API const WarFactoryGameObjDef & Get_Definition (void) const;
WarFactoryGameObj * As_WarFactoryGameObj (void) { return this; }
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/WarFactoryGameObjDef.h source/scripts/WarFactoryGameObjDef.h
--- sourceold/scripts/WarFactoryGameObjDef.h 2011-10-11 21:40:40.850585900 +0800
+++ source/scripts/WarFactoryGameObjDef.h 2012-05-06 16:37:05.425695300 +0800
@@ -26,6 +26,9 @@
bool Save (ChunkSaveClass &csave);
bool Load (ChunkLoadClass &cload);
const PersistFactoryClass & Get_Factory (void) const;
+#ifdef DDBEDIT
+ virtual void Dump (FileClass &file);
+#endif
DECLARE_EDITABLE (WarFactoryGameObjDef, VehicleFactoryGameObjDef);
protected:
void Load_Variables (ChunkLoadClass &cload);
diff -uwr sourceold/scripts/WeaponClass.h source/scripts/WeaponClass.h
--- sourceold/scripts/WeaponClass.h 2011-11-22 14:49:49.184570300 +0800
+++ source/scripts/WeaponClass.h 2012-05-23 10:58:06.363281200 +0800
@@ -100,7 +100,7 @@
float Get_Recoil_Time( void ) { return Definition->RecoilTime; }
float Get_Recoil_Scale( void ) { return Definition->RecoilScale; }
void Set_Total_Rounds( int num );
- int Get_Total_Rounds( void );
+ SCRIPTS_API int Get_Total_Rounds( void );
void Import_Ammo_Info(int16 ammoInfo);
int16 Export_Ammo_Info();
void Add_Rounds( int num );
@@ -117,7 +117,7 @@
bool Is_Loaded( void ) { return (ClipRounds != 0); }
bool Is_Reload_OK( void );
bool Is_Reload_Needed( void ) { return !Is_Loaded() && Is_Reload_OK(); }
- float Get_Range( void );
+ SCRIPTS_API float Get_Range( void );
bool Is_Model_Update_Needed( void ) { return (UpdateModel == WEAPON_MODEL_UPDATE_IS_NEEDED); }
void Reset_Model_Update( void ) { UpdateModel = WEAPON_MODEL_UPDATE_NOT_NEEDED; CurrentAnimState = (WeaponAnimState)-1; }
bool Is_Anim_Update_Needed( void ) { return ( NextAnimState != CurrentAnimState ); }
diff -uwr sourceold/scripts/anticheat.ini source/scripts/anticheat.ini
--- sourceold/scripts/anticheat.ini 2012-02-18 13:32:47.225585900 +0800
+++ source/scripts/anticheat.ini 2012-04-21 09:47:27.628906200 +0800
@@ -113,3 +113,11 @@
909e932deec23ec75da3744306051b83=builtin_fxaa_sm3_hq.fxo
1e7fca47542d374462af2fb81ec8a87c=builtin_fxaa_sm3_mq.fxo
96d98d3a8dc579e76d9b57798a093936=builtin_fxaa_sm3_lq.fxo
+d0d6f19985a0423689531c7dee54b969=C&C_Canyon.lsd
+fad3a89c5605396475d9cd00a30ab1d4=C&C_Canyon.ldd
+f3875e9a955255b7cfb77c02f75fafd1=C&C_Canyon.lsd
+e57ab26c4790da800eb289e0518744df=C&C_Canyon.ldd
+2f760ea711b97cafa952bfbd5e990ab8=C&C_Canyon.mix
+18f1d1600b147d3ad8fdc91bc968ec95=tank_stealth_idle.wav
+9dc7f9fe39e97122f164dec1dbd1bdc4=tank_stealth_start.wav
+68cb626de41e5c24b0fc38879cc4ee1e=tank_stealth_stop.wav
Only in source/scripts: aow_intruders.cpp
Only in source/scripts: aow_intruders.h
Only in source/scripts: cNetEvent.h
diff -uwr sourceold/scripts/cPlayer.h source/scripts/cPlayer.h
--- sourceold/scripts/cPlayer.h 2011-10-11 21:56:41.257812500 +0800
+++ source/scripts/cPlayer.h 2012-05-23 11:03:51.978515600 +0800
@@ -68,8 +68,8 @@
void Get_Player_String(int id,WideStringClass &str,bool b);
void Increment_Kills();
void Increment_Deaths();
- void Set_Kills(int kills);
- void Set_Deaths(int deaths);
+ SCRIPTS_API void Set_Kills(int kills);
+ SCRIPTS_API void Set_Deaths(int deaths);
bool god; // 1876
WideStringClass PlayerName; // 1880
Only in source/scripts: cScTextObj.h
Only in source/scripts: cTeam.h
diff -uwr sourceold/scripts/definition.cpp source/scripts/definition.cpp
--- sourceold/scripts/definition.cpp 2011-10-11 23:03:55.115234300 +0800
+++ source/scripts/definition.cpp 2012-04-17 01:14:01.802734300 +0800
@@ -65,3 +65,19 @@
}
return true;
}
+
+#ifdef DDBEDIT
+void DefinitionClass::Dump(FileClass &file)
+{
+ for (int i = 0;i < this->Get_Parameter_Count();i++)
+ {
+ ParameterClass *param = this->Lock_Parameter(i);
+ param->Dump(file);
+ this->Unlock_Parameter(i);
+ }
+}
+
+void DefinitionClass::DumpPhys(FileClass &phys)
+{
+}
+#endif
diff -uwr sourceold/scripts/dllmain.cpp source/scripts/dllmain.cpp
--- sourceold/scripts/dllmain.cpp 2012-02-27 12:49:54.797328100 +0800
+++ source/scripts/dllmain.cpp 2012-05-28 21:47:07.567382800 +0800
@@ -293,6 +293,7 @@
AddHostHook = (ahh)Address(tt,"AddHostHook");
AddRefillHook = (arh)Address(tt,"AddRefillHook");
AddLoadLevelHook = (allh)Address(tt,"AddLoadLevelHook");
+ AddPreLoadLevelHook = (allh)Address(tt,"AddPreLoadLevelHook");
AddGameOverHook = (allh)Address(tt,"AddGameOverHook");
AddThinkHook = (allh)Address(tt,"AddThinkHook");
AddPlayerJoinHook = (apjh)Address(tt,"AddPlayerJoinHook");
@@ -306,6 +307,8 @@
Get_Vehicle_Limit = (gvl)Address(tt,"Get_Vehicle_Limit");
Set_Air_Vehicle_Limit = (svl)Address(tt,"Set_Air_Vehicle_Limit");
Get_Air_Vehicle_Limit = (gvl)Address(tt,"Get_Air_Vehicle_Limit");
+ Set_Naval_Vehicle_Limit = (svl)Address(tt,"Set_Naval_Vehicle_Limit");
+ Get_Naval_Vehicle_Limit = (gvl)Address(tt,"Get_Naval_Vehicle_Limit");
Send_Message = (sm)Address(tt,"Send_Message");
Send_Message_Player = (smp)Address(tt,"Send_Message_Player");
Commands->Display_Health_Bar = (void(*)( GameObject * object, bool display ))Address(tt,"New_Display_Health_Bar");
@@ -347,6 +350,8 @@
GetExplosionObj = (geo)Address(tt,"GetExplosionObj");
SetExplosionObj = (seo)Address(tt,"SetExplosionObj");
Update_Network_Object = (uno)Address(tt,"Update_Network_Object");
+ Send_Client_Text = (sct)Address(tt,"Send_Client_Text");
+ Send_Client_Announcement = (sca)Address(tt,"Send_Client_Announcement");
gttv GetTTVersion = (gttv)Address(tt,"GetTTVersion");
Commands->Control_Enable = (void(*)( GameObject * obj, bool enable ))Address(tt,"New_Control_Enable");
AddShaderNotify = (asn)Address(tt,"AddShaderNotify");
@@ -391,6 +396,7 @@
Get_Team_Credits = (gtc)Address(tt,"Get_Team_Credits");
addConnectionAcceptanceFilter = (addConnectionAcceptanceFilterType)Address(tt, "addConnectionAcceptanceFilter");
removeConnectionAcceptanceFilter = (removeConnectionAcceptanceFilterType)Address(tt, "removeConnectionAcceptanceFilter");
+ Is_WOL_User = (iwu)Address(tt, "Is_WOL_User");
Evict_Client = (ec)Address(tt,"Evict_Client");
Get_Current_Map_Index = (gcmi)Address(tt,"Get_Current_Map_Index");
Get_Player_List = (gpl)Address(tt,"Get_Player_List");
@@ -399,6 +405,8 @@
Set_Map = (smx)Address(tt,"Set_Map");
Get_Game_Definitions = (ggd)Address(tt,"Get_Game_Definitions");
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");
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-02-23 12:06:21.704101500 +0800
+++ source/scripts/dp88_ar.cpp 2012-05-23 10:32:15.882812500 +0800
@@ -21,6 +21,8 @@
#include "VehicleGameObjDef.h"
#include "MoveablePhysClass.h"
#include "SList.h"
+#include "OffenseObjectClass.h"
+#include "WeaponBagClass.h"
/*------------------------
Game Controller
@@ -186,60 +188,6 @@
mirageTank_disguisePresets[2] = new char[strlen(mtDisguise)+1];
strcpy ( mirageTank_disguisePresets[2], mtDisguise );
}
-
-
-
-
- // Disable VTOL units in non-flying maps
- if ( !Is_Map_Flying() )
- {
- PurchaseSettingsDefClass* p = NULL;
- DefinitionClass* d = NULL;
-
- // Soviet - Vehicles
- p = PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_VEHICLES,(PurchaseSettingsDefClass::TEAM)PTTEAM(0));
- for ( int i = 0; p != NULL && i < 10; i++ )
- {
- d = Find_Definition(p->Get_Definition(i));
- if ( d != NULL && d->Get_Class_ID() == (uint32)12304 && ((VehicleGameObjDef*)d)->Get_Type() == VEHICLE_TYPE_FLYING )
- {
- p->Set_Hidden(i,true);
- }
- }
-
- // Allies - Vehicles
- p = PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_VEHICLES,(PurchaseSettingsDefClass::TEAM)PTTEAM(1));
- for ( int i = 0; p != NULL && i < 10; i++ )
- {
- d = Find_Definition(p->Get_Definition(i));
- if ( d != NULL && d->Get_Class_ID() == (uint32)12304 && ((VehicleGameObjDef*)d)->Get_Type() == VEHICLE_TYPE_FLYING )
- {
- p->Set_Hidden(i,true);
- }
- }
-
- // Soviet - Secret Vehicles
- p = PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_SECRET_VEHICLES,(PurchaseSettingsDefClass::TEAM)PTTEAM(0));
- for ( int i = 0; p != NULL && i < 10; i++ )
- {
- d = Find_Definition(p->Get_Definition(i));
- if ( d != NULL && d->Get_Class_ID() == (uint32)12304 && ((VehicleGameObjDef*)d)->Get_Type() == VEHICLE_TYPE_FLYING )
- {
- p->Set_Hidden(i,true);
- }
- }
-
- // Allies - Secret Vehicles
- p = PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_SECRET_VEHICLES,(PurchaseSettingsDefClass::TEAM)PTTEAM(1));
- for ( int i = 0; p != NULL && i < 10; i++ )
- {
- d = Find_Definition(p->Get_Definition(i));
- if ( d != NULL && d->Get_Class_ID() == (uint32)12304 && ((VehicleGameObjDef*)d)->Get_Type() == VEHICLE_TYPE_FLYING )
- {
- p->Set_Hidden(i,true);
- }
- }
- }
}
@@ -595,7 +543,7 @@
// Install keyhook
- if ( Is_Soldier ( obj ) && Get_Player_ID ( obj ) >= 0 )
+ if ( obj->As_SoldierGameObj() && Get_Player_ID ( obj ) >= 0 )
InstallHook( Get_Parameter("deployKeyhook"), obj );
}
@@ -604,15 +552,17 @@
{
// Find object
GameObject* obj = Commands->Find_Object ( objectID );
- if ( !obj || Get_Vehicle(obj) || ((SoldierGameObj*)obj)->Is_On_Ladder() )
+ if ( !obj || Get_Vehicle(obj) || obj->As_SoldierGameObj()->Is_On_Ladder() || obj->As_SoldierGameObj()->Is_In_Elevator() )
return;
if ( deployed )
{
- // If deployed for less than 4 seconds dont allow undeploy
- if ( time(NULL) - lastDeploy < 4 )
+ // If deployed for less than undeployTime seconds dont allow undeploy
+ if ( time(NULL) - lastDeploy < Get_Float_Parameter("undeployTime") )
{
- Send_Message_Player(obj,153,204,25,"You cannot undeploy yet, you must wait at least 4 seconds after deploying to undeploy.");
+ StringClass str;
+ str.Format("You cannot undeploy yet, you must wait at least %f seconds after deploying to undeploy.",Get_Float_Parameter("undeployTime"));
+ Send_Message_Player(obj,153,204,25,str);
return;
}
@@ -630,10 +580,12 @@
}
else
{
- // If deployed for less than 8 seconds dont allow deploy
- if ( time(NULL) - lastDeploy < 8 )
+ // If deployed for less than deployTime seconds dont allow deploy
+ if ( time(NULL) - lastDeploy < Get_Float_Parameter("deployTime") )
{
- Send_Message_Player(obj,153,204,25,"You cannot deploy yet, you must wait at least 8 seconds after undeploying to deploy again.");
+ StringClass str;
+ str.Format("You cannot deploy yet, you must wait at least %f seconds after undeploying to deploy again.",Get_Float_Parameter("deployTime"));
+ Send_Message_Player(obj,153,204,25,str);
return;
}
@@ -1045,6 +997,7 @@
oreFieldValue = 0;
oreLoadLevel = 0;
oreValue = 0;
+ animating = false;
useAI = ( Get_Int_Parameter ( "enableAI" ) == 1 ) ? true : false;
aiState = MINER_AISTATE_IDLE;
@@ -1103,6 +1056,10 @@
// Unless we are already full increase our load level and the value of our load
if ( oreLoadLevel < Get_Int_Parameter("loadLevels") )
{
+ // Play the mining sound
+ if (strlen(Get_Parameter("miningSound")) > 0)
+ Commands->Create_Sound(Get_Parameter("miningSound"),Commands->Get_Position(obj),obj);
+
oreLoadLevel++;
oreValue += oreFieldValue*Get_Int_Parameter("orePerLoadLevel");
}
@@ -1111,8 +1068,16 @@
if ( oreLoadLevel < Get_Int_Parameter("loadLevels") )
Commands->Send_Custom_Event ( obj, obj, CUSTOM_MINER_INCREASE_ORE_LOAD, oreFieldRand, Get_Float_Parameter("timePerLoadLevel") );
- // Otherwise we are full, if using the AI start driving to the refinery
- else if ( useAI )
+
+ // Otherwise we are full of ore...
+ else
+ {
+ // Stop the mining animation
+ animating = false;
+ obj->As_PhysicalGameObj()->Clear_Animation();
+
+ // If using the AI start driving to the refinery
+ if ( useAI )
{
aiState = MINER_AISTATE_RETURN_TO_REFINERY;
ReturnToRefinery(obj);
@@ -1122,6 +1087,7 @@
else if ( Get_Vehicle_Driver(obj) != NULL )
Send_Message_Player ( Get_Vehicle_Driver(obj), 153, 204, 25, "Fully loaded with ore, dock at the Refinery to smelt the ore into credits" );
}
+ }
// Message from the ore dump zone notifying us that we have entered it. If
@@ -1206,14 +1172,24 @@
// If we are using AI then reset the action now that we have arrived
if ( useAI )
Commands->Action_Reset ( obj, 101.0f );
+
+ // Start the mining animation if it is not already running
+ if ((strlen(Get_Parameter("miningAnimation")) > 0) && !animating)
+ {
+ animating = true;
+ Commands->Set_Animation(obj,Get_Parameter("miningAnimation"),true,0,0,-1,false);
+ }
}
void dp88_AR_Miner::ExitedOreField ( GameObject *obj, GameObject* oreField )
{
- // 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
+ // Stop the mining animation
+ animating = false;
+ obj->As_PhysicalGameObj()->Clear_Animation();
+
+ // 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
if ( useAI && aiState == MINER_AISTATE_COLLECTING_ORE )
DriveToOreField(obj);
}
@@ -1270,6 +1246,12 @@
void dp88_AR_Miner::DockedAtRefinery ( GameObject *obj )
{
+ // Start dock animation and sound
+ if (strlen(Get_Parameter("dockAnimation")) > 0)
+ Commands->Set_Animation(obj,Get_Parameter("dockAnimation"),false,0,0,-1,false);
+ if (strlen(Get_Parameter("dockSound")) > 0)
+ Commands->Create_Sound(Get_Parameter("dockSound"),Commands->Get_Position(obj),obj);
+
// If we are using AI then reset the action now that we have arrived
if (useAI)
Commands->Action_Reset ( obj, 101.0f );
@@ -1459,7 +1441,7 @@
// OK, got the closest... can we chronoshift there?
// Get physical game object and moveable phys class references (used to check if we can move to the zone)
- MoveablePhysClass* mphys = ( As_PhysicalGameObj(obj) ) ? obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL;
+ MoveablePhysClass* mphys = ( obj->As_PhysicalGameObj() ) ? obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL;
// Can we move to this position without getting stuck?
if ( !mphys->Can_Teleport( Matrix3D( Commands->Get_Position(zone)) ) )
@@ -1787,9 +1769,9 @@
-/*------------------------
-Remote Control Console Script
---------------------------*/
+// -------------------------------------------------------------------------------------------------
+// Remote Control Console Script
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlConsole::Created ( GameObject *obj )
{
@@ -1801,49 +1783,32 @@
m_bEnabled = true;
m_nChargeTime = Get_Int_Parameter ( "chargeTime" );
+ m_pLoopedAnimCtrl = new LoopedAnimationController(obj);
+
// Start charge tick timer if necessary and set initial animation frames
if ( m_nChargeTime > 0 )
{
Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
- animstate = 0;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameCharging1"), Get_Int_Parameter("animFrameCharging2") );
}
else
- {
- animstate = 1;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameAvailable1"), Get_Int_Parameter("animFrameAvailable2") );
Commands->Enable_HUD_Pokable_Indicator(obj, (m_nChargeTime == 0));
}
-void dp88_RemoteControlConsole::Animation_Complete ( GameObject *obj, const char *animation_name )
+// -------------------------------------------------------------------------------------------------
+
+void dp88_RemoteControlConsole::Detach ( GameObject* obj )
{
- switch(animstate)
+ if (m_pLoopedAnimCtrl)
{
- case 0:
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
- break;
- case 1:
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
- break;
- case 2:
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameActive1"), (float)Get_Int_Parameter("animFrameActive2"), false );
- break;
- case 3:
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
- break;
- case 4:
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation(obj, Get_Parameter("animFrameIdle1"), false, NULL, (float)Get_Int_Parameter("animFrameIdle2"), (float)Get_Int_Parameter("animFrameActive2"), false );
- break;
+ delete m_pLoopedAnimCtrl;
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_RemoteControlConsole::Poked ( GameObject *obj, GameObject *poker )
{
//Console_Output ( "[%d:%s:%s] Poked\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name() );
@@ -1933,6 +1898,7 @@
}
}
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlConsole::Custom( GameObject *obj, int type, int param, GameObject *sender )
{
@@ -1963,7 +1929,6 @@
else if ( type == CUSTOM_REMOTECONTROL_DRIVEREXIT )
{
- //Console_Output ( "[%d:%s:%s] Driver exited, remote control unit now idle\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name() );
DestroyDummy();
HandleDriverExit ( obj, Commands->Find_Object(pilotID), sender );
pilotID = NULL;
@@ -1975,6 +1940,14 @@
vehicleID = NULL;
+ // Make driver invisible and uncollidable so they can't be killed before they are teleported home
+ if ( GameObject* pilot = Commands->Find_Object(pilotID) )
+ {
+ Commands->Set_Is_Rendered ( pilot, false );
+ Commands->Disable_All_Collisions ( pilot );
+ Update_Network_Object(pilot);
+ }
+
// Start timer to return the pilot (if we do it immediately the game will crash...)
if ( pilotID != NULL )
Commands->Start_Timer ( obj, this, 0.5, TIMER_REMOTECONTROL_DRIVEREXIT );
@@ -1988,14 +1961,10 @@
if ( m_nChargeTime > 0 )
{
Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
- animstate = 0;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameCharging1"), Get_Int_Parameter("animFrameCharging2") );
}
else
- {
- animstate = 1;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameAvailable1"), Get_Int_Parameter("animFrameAvailable2") );
}
Commands->Enable_HUD_Pokable_Indicator(obj, (m_bEnabled && m_nChargeTime == 0));
@@ -2012,6 +1981,7 @@
}
}
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlConsole::Timer_Expired ( GameObject *obj, int number )
{
@@ -2050,8 +2020,7 @@
Create_2D_Sound_Player(pilot, Get_Parameter("connectionEstablishedSound") );
// Set animation frame
- animstate = 2;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameActive1"), (float)Get_Int_Parameter("animFrameActive2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameActive1"), Get_Int_Parameter("animFrameActive2") );
}
else // This should never actually happen... but just in case...
{
@@ -2083,14 +2052,15 @@
Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
else
{
- animstate = 1;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameAvailable1"), Get_Int_Parameter("animFrameAvailable2") );
Commands->Enable_HUD_Pokable_Indicator(obj, true);
}
}
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_RemoteControlConsole::SetEnabled ( GameObject* obj, bool state )
{
if ( state == m_bEnabled )
@@ -2106,6 +2076,13 @@
{
Soldier_Transition_Vehicle ( pilot );
Create_2D_Sound_Player(pilot, Get_Parameter("consoleOfflineSound") );
+
+ // Make driver invisible and uncollidable so they can't be killed before they are teleported home
+ Commands->Set_Is_Rendered ( pilot, false );
+ Commands->Disable_All_Collisions ( pilot );
+ Update_Network_Object(pilot);
+
+ // Can't do this instantly or the game crashes. Yay!
Commands->Start_Timer ( obj, this, 0.5, TIMER_REMOTECONTROL_DRIVEREXIT );
}
}
@@ -2115,26 +2092,23 @@
// Update the animation frame state
if ( !m_bEnabled )
- {
- animstate = 3;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameDisabled1"), Get_Int_Parameter("animFrameDisabled2") );
+
else if ( m_nChargeTime > 0 )
{
Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
- animstate = 0;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameCharging1"), Get_Int_Parameter("animFrameCharging2") );
}
+
else
- {
- animstate = 1;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameAvailable1"), Get_Int_Parameter("animFrameAvailable2") );
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_RemoteControlConsole::CreateDummy ( GameObject* pilot, Vector3 position, float facing )
{
- GameObject* dummy = Commands->Create_Object ( "Invisible_Object", position );
+ GameObject* dummy = Commands->Create_Object ( "Invisible_Object_2", position );
if ( dummy )
{
m_pilotDummyID = Commands->Get_ID(dummy);
@@ -2159,6 +2133,8 @@
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_RemoteControlConsole::DestroyDummy()
{
if ( m_pilotDummyID != NULL )
@@ -2173,11 +2149,20 @@
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_RemoteControlConsole::HandleDriverExit ( GameObject* obj, GameObject* pilot, GameObject* vehicle )
{
if ( pilot )
+ {
Commands->Set_Position ( pilot, pilotDummyPos );
+ // Make driver visible and collidable again
+ Commands->Set_Is_Rendered ( pilot, true );
+ Commands->Enable_Collisions ( pilot );
+ Update_Network_Object(pilot);
+ }
+
// If the vehicle is still alive set it to its idle state
if ( vehicle )
{
@@ -2193,34 +2178,27 @@
// Set animation frame
if ( !m_bEnabled )
- {
- animstate = 3;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameDisabled1"), Get_Int_Parameter("animFrameDisabled2") );
+
else if ( vehicle )
- {
- animstate = 4;
- Commands->Set_Animation(obj, Get_Parameter("animFrameIdle1"), false, NULL, (float)Get_Int_Parameter("animFrameIdle2"), (float)Get_Int_Parameter("animFrameActive2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameIdle2"), Get_Int_Parameter("animFrameActive2") );
+
else if ( m_nChargeTime > 0 )
{
Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
- animstate = 0;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameCharging1"), Get_Int_Parameter("animFrameCharging2") );
}
+
else
- {
- animstate = 1;
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
- }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), Get_Int_Parameter("animFrameAvailable1"), Get_Int_Parameter("animFrameAvailable2") );
}
-/*------------------------
-Remote Control Vehicle Script
---------------------------*/
+// -------------------------------------------------------------------------------------------------
+// Remote Control Vehicle Script
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlVehicle::Created ( GameObject *obj )
{
@@ -2235,6 +2213,7 @@
Send_Custom_Event_To_Objects_With_Script(obj, "dp88_RemoteControlConsole", CUSTOM_REMOTECONTROL_CREATED, Get_Int_Parameter("remoteControlID"), 0 );
}
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlVehicle::Custom( GameObject *obj, int type, int param, GameObject *sender )
{
@@ -2268,6 +2247,7 @@
}
}
+// -------------------------------------------------------------------------------------------------
void dp88_RemoteControlVehicle::Killed ( GameObject* obj, GameObject* killer )
{
@@ -2767,7 +2747,12 @@
{
// Notify adjacent towers to stop assisting us if they were
for ( int i = 0; i < adjacentTowerCount; i++ )
+ {
+ if (Commands->Find_Object(adjacentTowers[i]) != obj)
+ {
Commands->Send_Custom_Event(obj,Commands->Find_Object(adjacentTowers[i]), CUSTOM_PRISMTOWER_STOP_CHARGING,0,0.0f);
+ }
+ }
// Deregister this tower
deregisterTower(Commands->Get_ID(obj));
@@ -2965,7 +2950,7 @@
// we are charging, if any
for ( int i = 0; i < adjacentTowerCount; ++i )
{
- if ( adjacentTowers[i] != targetID )
+ if ( adjacentTowers[i] != targetID && Commands->Find_Object(adjacentTowers[i]) != obj)
Commands->Send_Custom_Event(obj, Commands->Find_Object(adjacentTowers[i]), CUSTOM_PRISMTOWER_REQUEST_CHARGING, (int)targetPriority, 0.0f );
}
}
@@ -2977,8 +2962,13 @@
{
// Send out end assistance notifications to all adjacent towers
for ( int i = 0; i < adjacentTowerCount; ++i )
+ {
+ if (Commands->Find_Object(adjacentTowers[i]) != obj)
+ {
Commands->Send_Custom_Event(obj, Commands->Find_Object(adjacentTowers[i]), CUSTOM_PRISMTOWER_STOP_CHARGING, 0, 0.0f );
}
+ }
+}
@@ -3028,7 +3018,18 @@
// Destroy parent object if its still alive
GameObject* parent = Commands->Find_Object ( parentObjID );
if ( parent )
- Commands->Apply_Damage ( parent, 5000.00, "Death", NULL );
+ {
+ // If the parent is a soldier in a vehicle we can't simply kill them because things go horribly wrong. Instead
+ // eject them from a vehicle and attach JFW_Timer_Destroy_Object to kill them as soon as possible.
+ if ( parent->As_SoldierGameObj() && parent->As_SoldierGameObj()->Is_In_Vehicle() )
+ {
+ Soldier_Transition_Vehicle ( parent );
+ Commands->Attach_Script ( parent, "JFW_Timer_Destroy_Object", "1.0,547859,5000.0,Death" );
+ Destroy_Script(); // Prevent equaliseHealth() getting called and trying to kill the driver
+ }
+ else
+ Commands->Apply_Damage ( parent, 5000.00, "None", NULL );
+ }
}
void dp88_linkHealth::equaliseHealth ( GameObject* obj )
@@ -3043,8 +3044,15 @@
/* Work out difference in our health and armour since last check */
float difference = ((Commands->Get_Health(obj)-lastHealth)+(Commands->Get_Shield_Strength(obj)-lastArmour));
- /* Apply damage to parent using 'None' warhead (this should be 1-1
- ratio against all skin and shield types */
+ /* Apply damage to parent using 'None' warhead (this should be 1-1 ratio against all skin and
+ shield types. Special case scenario: if the target is a soldier in a vehicle we need to use a
+ special function to override the check that prevents damage to soldiers in a vehicle */
+ if ( parent->As_SoldierGameObj() && parent->As_SoldierGameObj()->Is_In_Vehicle() )
+ {
+ OffenseObjectClass offense(difference*-1.0f, ArmorWarheadManager::Get_Warhead_Type("None"), NULL);
+ parent->As_SoldierGameObj()->Apply_Damage_IgnoreVehicleCheck ( offense, 1, -1 );
+ }
+ else
Commands->Apply_Damage ( parent, difference*-1.0f, "None", NULL );
/* Update our health/armour from the parents new health/armour */
@@ -3100,9 +3108,9 @@
// CLEG resistance script
ScriptRegistrant dp88_AR_CLEG_target_Registrant( "dp88_AR_CLEG_target", "resistance=20:int,clegEffectPreset=null:string" );
-// Ore Harvesting
-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");
-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");
+// 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_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");
diff -uwr sourceold/scripts/dp88_ar.h source/scripts/dp88_ar.h
--- sourceold/scripts/dp88_ar.h 2011-12-01 12:10:36.260742100 +0800
+++ source/scripts/dp88_ar.h 2012-05-23 10:33:45.797851500 +0800
@@ -183,12 +183,63 @@
-/*------------------------
-AR Miner Script - Base Class
+// -------------------------------------------------------------------------------------------------
-This base class is used by both the dp88_AR_Chrono_Miner and dp88_AR_War_Miner scripts
-and implements common functionality used by both scripts.
---------------------------*/
+/*!
+* \brief AR Miner Script
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This class contains the basic logic for the ore miners used in Apocalypse Rising and supports both
+* AI and player controlled miners. A miner can collect ore from any ore fields defined by a script
+* zone with the dp88_AR_Ore_Field_Zone script attached to it, which determines the value of each ore
+* 'unit' in that field, thus implicitly supporting gem fields with the same scripts.
+*
+* The miner can hold up to a configurable number of ore units, each of which takes a configurable
+* amount of time to mine from the ore field. Mining is achieved by remaining inside an ore field
+* whilst ore units are 'collected'.
+*
+* Miners can deposit ore at any time as long as they have at least one unit mined, with the total
+* value of the deposit being based on the number of units collected and the value of each unit. Ore
+* deposits are achieved by entering a script zone with the dp88_AR_Ore_Deposit_Zone attached to it
+* with the team parameter matching that of the miner.
+*
+* When the AI is enabled the miner will use the pathfind grid to locate the nearest ore field and
+* drive to it to begin mining. Once it has collected a full load of ore it will locate the nearest
+* ore deposit zone and drive there to unload it's ore. This will be repeated ad-infinitum until the
+* miner is destroyed. If you have problems with the miner getting stuck on terrain or other objects
+* you should place pathfind blockers around the problematic areas and re-generate pathfind data to
+* make it route around those locations.
+*
+* \param enableAI
+* Specifies that this miner should use its AI to mine autonomously. 1 to enable AI, 0 otherwise
+* \param loadLevels
+* Specifies the total number of ore units this miner can hold at any time
+* \param orePerLoadLevel
+* Amount of ore mined in each unit, this is multiplied by the oreValue parameter in the script
+* attached to the ore field to calculate the credit value of each ore unit
+* \param timePerLoadLevel
+* The amount of time, in seconds, it takes to mine one ore unit from an ore field
+* \param unloadtime
+* The amount of time, in seconds, it takes to unload all ore units at an ore deposit zone
+* \param aiStartDelay
+* If the miner AI is enabled this specifies the initial delay before starting the first AI action,
+* which is required to avoid the original Renegade Harvester AI overriding this one.
+* \param dockAnimation
+* An optional animation to be played when depositing ore at a refinery
+* \param dockSound
+* An optional sound effect to be played when depositing ore at a refinery
+* \param miningAnimation
+* 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
+*
+* \note
+* Because this script is designed to act as a base class for both types of AR miner it is not
+* named after either teams miner and does not appear as an available script in LevelEdit. However,
+* because there is no additional logic required for the Soviet War Miner there isn't actually a
+* derived script for that at this time, thus the dp88_AR_War_Miner script in LevelEdit is really
+* an instance of this base class script.
+*/
class dp88_AR_Miner : public JFW_Key_Hook_Base // Inherit from keyhook base for chrono miner
{
@@ -199,6 +250,7 @@
int oreValue;
bool useAI; // Is AI enabled?
+ bool animating; // Used to identify if the harvest animation is running so it doesn't start it a second time
int aiState; // Current AI state
public:
@@ -332,6 +384,9 @@
/*!
+* \brief Remote Control Vehicle Console
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
* This script is attached to consoles to allow players to take remote control of a drone vehicle
* which is spawned by the console on demand. The vehicle preset which is spawned must have the
* dp88_RemoteControlVehicle script attached with a matching remoteControlID parameter to work
@@ -385,11 +440,11 @@
class dp88_RemoteControlConsole : public ScriptImpClass
{
void Created( GameObject *obj );
+ void Detach ( GameObject* obj );
void Poked ( GameObject *obj, GameObject *poker );
void Custom( GameObject *obj, int type, int param, GameObject *sender );
void Timer_Expired( GameObject *obj, int number );
void SetEnabled ( GameObject* obj, bool state );
- void Animation_Complete ( GameObject *obj, const char *animation_name );
int vehicleID;
int pilotID;
@@ -397,12 +452,15 @@
Vector3 pilotDummyPos;
bool m_bEnabled;
int m_nChargeTime;
- int animstate;
-
void CreateDummy ( GameObject* pilot, Vector3 position, float facing );
void DestroyDummy();
void HandleDriverExit ( GameObject* obj, GameObject* pilot, GameObject* vehicle );
+
+protected:
+ LoopedAnimationController* m_pLoopedAnimCtrl;
+public:
+ dp88_RemoteControlConsole() : m_pLoopedAnimCtrl(0) {}
};
@@ -548,8 +606,36 @@
void SendEndAssistanceNotifications(GameObject* obj);
};
+// -------------------------------------------------------------------------------------------------
-// Script to link health / armour values of two objects together
+/*!
+* \brief Object health linking script
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This is a simple script that links together the health and armour states of two different objects,
+* keeping them in constant sync. This is useful when an ingame entity is made up of two seperate
+* game objects, such as the AI controlled War Miner in Apocalypse Rising which spawns a seperate
+* gun turret to allow the logic for the turret and the miner to execute on seperate objects and
+* avoid conflicts between the attack and move-to actions.
+*
+* The script works on a parent/child basis, whereby the object this script is attached to is the
+* child and the parent is the object whose ID is specified in the script parameters. Upon creation
+* the script will inherit the maximum and current values of the parents health and armour states,
+* however it will maintain it's own skin and armour types, thus allowing for a child object to be
+* either more or less resistant to damage than it's parent, allowing the creation of strong or weak
+* points in the overall entities defences.
+*
+* This script is usually attached to dynamically created objects by other scripts and it's unlikely
+* to be attached to anything directly via LevelEdit.
+*
+* \param parentObjectId
+* ID of the parent game object with which this objects health and armour will be linked
+*
+* \note
+* You can link multiple child objects to a single parent object to create complex entities which
+* consist of many parts, but you should always ensure the same object is designated as the parent
+* to avoid conflicts between the scripts.
+*/
class dp88_linkHealth : public ScriptImpClass
{
void Created ( GameObject *obj );
@@ -562,6 +648,8 @@
float lastArmour;
};
+// -------------------------------------------------------------------------------------------------
+
diff -uwr sourceold/scripts/dp88_ar_unitScripts.cpp source/scripts/dp88_ar_unitScripts.cpp
--- sourceold/scripts/dp88_ar_unitScripts.cpp 2012-02-02 17:58:48.974609300 +0800
+++ source/scripts/dp88_ar_unitScripts.cpp 2012-04-24 12:35:28.803710900 +0800
@@ -30,7 +30,7 @@
isDead = false;
lastDeploy = 0;
- if ( Is_Soldier ( obj ) && Get_Player_ID ( obj ) >= 0 )
+ if ( obj->As_SoldierGameObj() && Get_Player_ID ( obj ) >= 0 )
InstallHook( Get_Parameter("Keyhook"), obj );
else
Destroy_Script();
diff -uwr sourceold/scripts/dp88_buildingScripts.cpp source/scripts/dp88_buildingScripts.cpp
--- sourceold/scripts/dp88_buildingScripts.cpp 2012-02-23 12:06:21.652343700 +0800
+++ source/scripts/dp88_buildingScripts.cpp 2012-05-23 10:20:24.692382800 +0800
@@ -19,9 +19,11 @@
#include "BaseControllerClass.h"
#include "WarFactoryGameObj.h"
#include "AirFactoryGameObj.h"
+#include "NavalFactoryGameObj.h"
#include "RefineryGameObj.h"
#include "PurchaseSettingsDefClass.h"
#include "PhysicalGameObj.h"
+#include "ArmorWarheadManager.h"
/*------------------------
Building Controller Script
@@ -100,7 +102,8 @@
{
// Get ID of child
int childId = Commands->Get_ID ( sender );
-
+ if (findChild(childId) == -1)
+ {
// Does child array exist?
if ( children != NULL )
{
@@ -128,6 +131,7 @@
children[0].type = param;
}
}
+ }
@@ -548,25 +552,11 @@
Base Class For Generic Weakpoints
--------------------------*/
-void MinorWeakpointScriptClass::Animation_Complete ( GameObject *obj, const char *animation_name )
-{
- if (animstate == 0 && Get_Int_Parameter("animLoop"))
- {
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
- }
- if (animstate == 1 && Get_Int_Parameter("destroyedAnimLoop"))
- {
- obj->As_PhysicalGameObj()->Clear_Animation();
- Commands->Set_Animation ( obj, Get_Parameter("destroyedAnimName"), false, NULL, (float)Get_Int_Parameter("destroyedAnimStartFrame"), (float)Get_Int_Parameter("destroyedAnimEndFrame"), false );
- }
-}
-
void MinorWeakpointScriptClass::Created ( GameObject *obj )
{
// Set variables
isDestroyed = false;
-
+ m_pLoopedAnimCtrl = NULL;
// Find parent
GameObject* parent = Find_Object_By_Preset ( Get_Object_Type ( obj ), Get_Parameter("buildingControllerPreset") );
if ( parent != NULL )
@@ -575,12 +565,11 @@
// Send with 1 second delay to ensure parent has been initialized
Commands->Send_Custom_Event ( obj, parent, CUSTOM_BUILDINGSCRIPTS_REGISTERCHILD, BUILDING_CHILD_TYPE_MINOR_WEAKPOINT, 1.0f );
-
+ m_pLoopedAnimCtrl = new LoopedAnimationController(obj);
// Set animation
if ( strlen(Get_Parameter("animName")) > 0 )
{
- animstate = 0;
- Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
+ m_pLoopedAnimCtrl->PlayAnimation(Get_Parameter("animName"),Get_Int_Parameter("animStartFrame"),Get_Int_Parameter("animEndFrame"),!Get_Int_Parameter("animLoop"));
}
}
else
@@ -609,8 +598,11 @@
// Set animation
if ( strlen(Get_Parameter("destroyedAnimName")) > 0 )
{
- animstate = 1;
- Commands->Set_Animation ( obj, Get_Parameter("destroyedAnimName"), false, NULL, (float)Get_Int_Parameter("destroyedAnimStartFrame"), (float)Get_Int_Parameter("destroyedAnimEndFrame"), false );
+ m_pLoopedAnimCtrl->PlayAnimation(Get_Parameter("destroyedAnimName"),Get_Int_Parameter("destroyedAnimStartFrame"),Get_Int_Parameter("destroyedAnimEndFrame"),!Get_Int_Parameter("destroyedAnimLoop"));
+ }
+ else
+ {
+ m_pLoopedAnimCtrl->StopAnimation();
}
}
@@ -631,8 +623,11 @@
// Set animation
if ( strlen(Get_Parameter("animName")) > 0 )
{
- animstate = 0;
- Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
+ m_pLoopedAnimCtrl->PlayAnimation(Get_Parameter("animName"),Get_Int_Parameter("animStartFrame"),Get_Int_Parameter("animEndFrame"),!Get_Int_Parameter("animLoop"));
+ }
+ else
+ {
+ m_pLoopedAnimCtrl->StopAnimation();
}
}
}
@@ -667,6 +662,13 @@
reverseEffect ( obj, parent );
}
+void MinorWeakpointScriptClass::Detach ( GameObject *obj )
+{
+ if (m_pLoopedAnimCtrl)
+ {
+ delete m_pLoopedAnimCtrl;
+ }
+}
@@ -734,6 +736,27 @@
}
}
+/*------------------------
+Weakpoint - Disable Naval Vehicle Purchase
+--------------------------*/
+
+void dp88_buildingScripts_weakpoint_disableNavalVehiclePurchase::applyEffect ( GameObject* obj, GameObject* parent )
+{
+ if (parent->As_BuildingGameObj() && parent->As_BuildingGameObj()->As_NavalFactoryGameObj())
+ {
+ parent->As_BuildingGameObj()->As_NavalFactoryGameObj()->Set_Disabled(true);
+ PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_NAVAL,(PurchaseSettingsDefClass::TEAM)PTTEAM(Get_Object_Type(parent)))->Set_Page_Disabled(true);
+ }
+}
+
+void dp88_buildingScripts_weakpoint_disableNavalVehiclePurchase::reverseEffect ( GameObject* obj, GameObject* parent )
+{
+ if (parent->As_BuildingGameObj() && parent->As_BuildingGameObj()->As_NavalFactoryGameObj())
+ {
+ parent->As_BuildingGameObj()->As_NavalFactoryGameObj()->Set_Disabled(false);
+ PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_NAVAL,(PurchaseSettingsDefClass::TEAM)PTTEAM(Get_Object_Type(parent)))->Set_Page_Disabled(false);
+ }
+}
/*------------------------
Weakpoint - Disable Base Power
@@ -817,12 +840,12 @@
void dp88_buildingScripts_functionMoneyTrickle::Created ( GameObject *obj )
{
+ isTimerRunning = false;
if ( Get_Object_Type(obj) == 0 || Get_Object_Type(obj) == 1 )
{
isTimerRunning = true;
Commands->Start_Timer(obj, this, 0.1f, TIMER_BUILDINGSCRIPTS_TRICKLEMONEY );
}
- isTimerRunning = false;
}
void dp88_buildingScripts_functionMoneyTrickle::OnBuildingCaptured ( GameObject *obj, int team )
@@ -856,6 +879,38 @@
}
+void dp88_buildingScripts_functionMoneyGrant::Created ( GameObject *obj )
+{
+ if ( Get_Object_Type(obj) == 0 || Get_Object_Type(obj) == 1 )
+ {
+ int team = Get_Object_Type(obj);
+ GameObject* pFirstPlayer = Find_First_Player(team);
+ if ( pFirstPlayer )
+ {
+ Commands->Give_Money(pFirstPlayer,Get_Float_Parameter("credits"),true);
+ }
+ if (Get_Int_Parameter("onceOnly") == 1)
+ {
+ Destroy_Script();
+ }
+ }
+}
+
+void dp88_buildingScripts_functionMoneyGrant::OnBuildingCaptured ( GameObject *obj, int team )
+{
+ if (team == 0 || team == 1)
+ {
+ GameObject* pFirstPlayer = Find_First_Player(team);
+ if ( pFirstPlayer )
+ {
+ Commands->Give_Money(pFirstPlayer,Get_Float_Parameter("credits"),true);
+ }
+ if (Get_Int_Parameter("onceOnly") == 1)
+ {
+ Destroy_Script();
+ }
+ }
+}
/*------------------------
@@ -1064,7 +1119,7 @@
// Check parent is not a building (since changing the team of a BuildingGameObj results
// in some very strange behaviour that we really don't want)
- if ( Is_Building(parent) )
+ if ( parent->As_BuildingGameObj() )
{
Console_Output ( "[%d:%s:%s] Critical Error: Building controller '%s' is of type BuildingGameObj, capturing is not possible. Destroying script...\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name() );
Destroy_Script();
@@ -1095,14 +1150,18 @@
}
+extern REF_DECL2(NodHouseColor, Vector3);
+extern REF_DECL2(GDIHouseColor, Vector3);
+extern REF_DECL2(PublicMessageColor, Vector3);
void dp88_buildingScripts_capturePoint::Damaged( GameObject *obj, GameObject *damager, float amount )
{
float health = Commands->Get_Health(obj);
float max = Commands->Get_Max_Health(obj);
- // If the damager was on the Soviet team then decrease the health by 1 and
+ // If the damager was the soviet engineer then decrease the health by 1 and
// check if they have now captured the building
- if ( Get_Object_Type(damager) == 0 )
+ unsigned int warhead = ArmorWarheadManager::Get_Warhead_Type(Get_Parameter("warhead"));
+ if (warhead == Get_Damage_Warhead() && Commands->Get_Player_Type(damager) == 0)
{
// Decrease health by 1.00 (unless we are already below 1.25 in which
// case we just set it to 0.25)
@@ -1113,6 +1172,33 @@
if ( health == 0.25f && currentTeam != 0 )
{
currentTeam = 0;
+ int red = (int)(NodHouseColor.X * 255);
+ int green = (int)(NodHouseColor.Y * 255);
+ int blue = (int)(NodHouseColor.Z * 255);
+ int stringall = Get_Int_Parameter("Sov_String_All");
+ if (stringall && Is_Valid_String_ID(stringall))
+ {
+ const char *str = Get_Translated_String(stringall);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringall);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringsov = Get_Int_Parameter("Sov_String_Sov");
+ if (stringsov && Is_Valid_String_ID(stringsov))
+ {
+ const char *str = Get_Translated_String(stringsov);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringsov);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
Commands->Send_Custom_Event (obj, Commands->Find_Object(parentId), CUSTOM_BUILDINGSCRIPTS_BUILDINGCAPTURED, currentTeam, 0.0f );
Set_Object_Type(obj,currentTeam);
}
@@ -1120,6 +1206,33 @@
// OK, we didn't capture it, but did we manage to make it neutral?
else if ( currentTeam == 1 && health <= max/2.0f )
{
+ int red = (int)(PublicMessageColor.X * 255);
+ int green = (int)(PublicMessageColor.Y * 255);
+ int blue = (int)(PublicMessageColor.Z * 255);
+ int stringall = Get_Int_Parameter("Neutral_String_All");
+ if (stringall && Is_Valid_String_ID(stringall))
+ {
+ const char *str = Get_Translated_String(stringall);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringall);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringsov = Get_Int_Parameter("Neutral_String_Sov");
+ if (stringsov && Is_Valid_String_ID(stringsov))
+ {
+ const char *str = Get_Translated_String(stringsov);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringsov);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
currentTeam = -2;
Commands->Send_Custom_Event (obj, Commands->Find_Object(parentId), CUSTOM_BUILDINGSCRIPTS_BUILDINGCAPTURED, currentTeam, 0.0f );
Set_Object_Type(obj,currentTeam);
@@ -1127,9 +1240,9 @@
}
- // If the damager was on the Soviet team then increase the health by 1 and
+ // If the damager was the allied engineer then increase the health by 1 and
// check if they have now captured the building
- else if ( Get_Object_Type(damager) == 1 )
+ else if (warhead == Get_Damage_Warhead() && Commands->Get_Player_Type(damager) == 1)
{
// Increase health by 1.00 (unless we are already less than 1.00 below the
// maximum in which case we just set it to the maximum)
@@ -1140,6 +1253,33 @@
if ( health == max && currentTeam != 1 )
{
currentTeam = 1;
+ int red = (int)(GDIHouseColor.X * 255);
+ int green = (int)(GDIHouseColor.Y * 255);
+ int blue = (int)(GDIHouseColor.Z * 255);
+ int stringall = Get_Int_Parameter("All_String_All");
+ if (stringall && Is_Valid_String_ID(stringall))
+ {
+ const char *str = Get_Translated_String(stringall);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringall);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringsov = Get_Int_Parameter("All_String_Sov");
+ if (stringsov && Is_Valid_String_ID(stringsov))
+ {
+ const char *str = Get_Translated_String(stringsov);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringsov);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
Commands->Send_Custom_Event (obj, Commands->Find_Object(parentId), CUSTOM_BUILDINGSCRIPTS_BUILDINGCAPTURED, currentTeam, 0.0f );
Set_Object_Type(obj,currentTeam);
}
@@ -1147,6 +1287,33 @@
// OK, we didn't capture it, but did we manage to make it neutral?
else if ( currentTeam == 0 && health >= max/2.0f )
{
+ int red = (int)(PublicMessageColor.X * 255);
+ int green = (int)(PublicMessageColor.Y * 255);
+ int blue = (int)(PublicMessageColor.Z * 255);
+ int stringall = Get_Int_Parameter("Neutral_String_All");
+ if (stringall && Is_Valid_String_ID(stringall))
+ {
+ const char *str = Get_Translated_String(stringall);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringall);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringsov = Get_Int_Parameter("Neutral_String_Sov");
+ if (stringsov && Is_Valid_String_ID(stringsov))
+ {
+ const char *str = Get_Translated_String(stringsov);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringsov);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
currentTeam = -2;
Commands->Send_Custom_Event (obj, Commands->Find_Object(parentId), CUSTOM_BUILDINGSCRIPTS_BUILDINGCAPTURED, currentTeam, 0.0f );
Set_Object_Type(obj,currentTeam);
@@ -1300,11 +1467,84 @@
partObjectId = NULL;
}
+// -------------------------------------------------------------------------------------------------
+
+void dp88_buildingScripts_PT_Script::Created( GameObject *obj )
+{
+ m_pLoopedAnimCtrl = NULL;
+
+ // Find parent
+ GameObject* parent = Find_Object_By_Preset ( Get_Object_Type ( obj ), Get_Parameter("buildingControllerPreset") );
+ if ( parent != NULL )
+ {
+ parentId = Commands->Get_ID ( parent );
+
+ // Send with 1 second delay to ensure parent has been initialized
+ Commands->Send_Custom_Event ( obj, parent, CUSTOM_BUILDINGSCRIPTS_REGISTERCHILD, BUILDING_CHILD_TYPE_GENERIC, 1.0f );
+ Commands->Start_Timer(obj, this, 1.0f, TIMER_CHECK_BASE_POWER_STATE );
+ dead = false;
+ basePowerState = Is_Base_Powered(Get_Object_Type(obj));
+ m_pLoopedAnimCtrl = new LoopedAnimationController(obj);
+ SetDamageAnimation(obj);
+ }
+ else
+ {
+ Console_Output ( "[%d:%s:%s] Critical Error: Building controller '%s' not found. Destroying script...\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name(), Get_Parameter("buildingControllerPreset") );
+ Destroy_Script();
+ }
+}
+
+void dp88_buildingScripts_PT_Script::Detach ( GameObject *obj )
+{
+ if (m_pLoopedAnimCtrl)
+ {
+ delete m_pLoopedAnimCtrl;
+ }
+}
+
+void dp88_buildingScripts_PT_Script::Custom( GameObject *obj, int type, int param, GameObject *sender )
+{
+ if ( type == CUSTOM_BUILDINGSCRIPTS_BUILDINGDESTROYED && Commands->Get_ID(sender) == parentId )
+ {
+ parentId = -1;
+ dead = true;
+ SetDamageAnimation(obj);
+ }
+}
+void dp88_buildingScripts_PT_Script::SetDamageAnimation ( GameObject* obj )
+{
+ int sFrame = 0;
+ int eFrame = 0;
+ if (basePowerState)
+ {
+ sFrame = (int)((dead) ? Get_Float_Parameter("DeadAnimationStartFrame") : Get_Float_Parameter("AliveAnimationStartFrame"));
+ eFrame = (int)((dead) ? Get_Float_Parameter("DeadAnimationEndFrame") : Get_Float_Parameter("AliveAnimationEndFrame"));
+ }
+ else
+ {
+ sFrame = (int)((dead) ? Get_Float_Parameter("LPDeadAnimationStartFrame") : Get_Float_Parameter("LPAliveAnimationStartFrame"));
+ eFrame = (int)((dead) ? Get_Float_Parameter("LPDeadAnimationEndFrame") : Get_Float_Parameter("LPAliveAnimationEndFrame"));
+ }
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("Animation"), sFrame, eFrame );
+}
+void dp88_buildingScripts_PT_Script::Timer_Expired ( GameObject* obj, int number )
+{
+ if ( number == TIMER_CHECK_BASE_POWER_STATE )
+ {
+ if ( Is_Base_Powered(Get_Object_Type(obj)) != basePowerState )
+ {
+ basePowerState = !basePowerState;
+ SetDamageAnimation(obj);
+ }
+ // Restart timer
+ Commands->Start_Timer(obj, this, 1.0f, TIMER_CHECK_BASE_POWER_STATE );
+ }
+}
ScriptRegistrant dp88_buildingScripts_buildingController_Registrant( "dp88_buildingScripts_buildingController", "team0_buildingOfflineStringId=0:int,team1_buildingOfflineStringId=0:int,team0_buildingOnlineStringId=0:int,team1_buildingOnlineStringId=0:int" );
@@ -1315,15 +1555,18 @@
ScriptRegistrant dp88_buildingScripts_weakpoint_disableSoldierPurchase_Registrant( "dp88_buildingScripts_weakpoint_disableSoldierPurchase", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_weakpoint_disableVehiclePurchase_Registrant( "dp88_buildingScripts_weakpoint_disableVehiclePurchase", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_weakpoint_disableAirVehiclePurchase_Registrant( "dp88_buildingScripts_weakpoint_disableAirVehiclePurchase", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
+ScriptRegistrant dp88_buildingScripts_weakpoint_disableNavalVehiclePurchase_Registrant( "dp88_buildingScripts_weakpoint_disableNavalVehiclePurchase", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_weakpoint_disableBasePower_Registrant( "dp88_buildingScripts_weakpoint_disableBasePower", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_weakpoint_disableRadar_Registrant( "dp88_buildingScripts_weakpoint_disableRadar", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_weakpoint_disableRefinery_Registrant( "dp88_buildingScripts_weakpoint_disableRefinery", "buildingControllerPreset:string,animName:string,animStartFrame=0:int,animEndFrame=0:int,animLoop=0:int,destroyedAnimName:string,destroyedAnimStartFrame=0:int,destroyedAnimEndFrame=0:int,destroyedAnimLoop=0:int" );
ScriptRegistrant dp88_buildingScripts_functionMoneyTrickle_Registrant( "dp88_buildingScripts_functionMoneyTrickle", "creditsPerSec=3.0:float" );
ScriptRegistrant dp88_buildingScripts_functionSpawnTeamZone_Registrant( "dp88_buildingScripts_functionSpawnTeamZone", "scriptZonePreset_team0:string,scriptZonePreset_team1:string,scriptZonePreset_team2:string,scriptZoneBone:string,scriptZoneSize:vector3,destroyZoneWhenDisabled=1:int" );
+ScriptRegistrant dp88_buildingScripts_functionMoneyGrant_Registrant( "dp88_buildingScripts_functionMoneyGrant", "credits:float,onceOnly=1:int");
ScriptRegistrant dp88_buildingScripts_scriptZone_Registrant( "dp88_buildingScripts_scriptZone", "buildingControllerPreset:string,scriptZonePreset:string,scriptZoneSize:vector3,destroyZoneWhenDisabled=1:int,destroyZoneWhenDestroyed=1:int" );
-ScriptRegistrant dp88_buildingScripts_capturePoint_Registrant( "dp88_buildingScripts_capturePoint", "buildingControllerPreset:string,dead_preset=null:string" );
+ScriptRegistrant dp88_buildingScripts_capturePoint_Registrant( "dp88_buildingScripts_capturePoint", "buildingControllerPreset:string,dead_preset=null:string,warhead:string,All_String_All:int,Sov_String_All:int,Neutral_String_All:int,All_String_Sov:int,Sov_String_Sov:int,Neutral_String_Sov:int");
ScriptRegistrant dp88_buildingScripts_spawnPart_Registrant("dp88_buildingScripts_spawnPart","Building_Part_Preset:string,Spawn_At_Bone:string,IsDecorative=0:int");
\ No newline at end of file
+ScriptRegistrant dp88_buildingScripts_PT_Script_Registrant( "dp88_buildingScripts_PT_Script", "buildingControllerPreset:string,Animation:string,AliveAnimationStartFrame:float,AliveAnimationEndFrame:float,DeadAnimationStartFrame:float,DeadAnimationEndFrame:float,LPAliveAnimationStartFrame:float,LPAliveAnimationEndFrame:float,LPDeadAnimationStartFrame:float,LPDeadAnimationEndFrame:float");
diff -uwr sourceold/scripts/dp88_buildingScripts.h source/scripts/dp88_buildingScripts.h
--- sourceold/scripts/dp88_buildingScripts.h 2011-12-01 12:29:48.027343700 +0800
+++ source/scripts/dp88_buildingScripts.h 2012-05-23 10:33:45.716796800 +0800
@@ -9,8 +9,11 @@
In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
Only the source code to the module(s) containing the licenced code has to be released.
*/
+
#pragma once
+#include "LoopedAnimationController.h"
+
// Define building child types
#define BUILDING_CHILD_TYPE_GENERIC 0
@@ -99,6 +102,24 @@
int parentId;
};
+class dp88_buildingScripts_PT_Script : public ScriptImpClass
+{
+ void Created( GameObject *obj );
+ void Detach ( GameObject *obj );
+ void Custom( GameObject *obj, int type, int param, GameObject *sender );
+ void Timer_Expired ( GameObject* obj, int number );
+ void SetDamageAnimation ( GameObject* obj );
+
+ // ID of the building controller we belong to
+ int parentId;
+ bool dead;
+ bool basePowerState;
+
+protected:
+ LoopedAnimationController* m_pLoopedAnimCtrl;
+public:
+ dp88_buildingScripts_PT_Script() : m_pLoopedAnimCtrl(0) {}
+};
@@ -114,10 +135,10 @@
class MinorWeakpointScriptClass : public ScriptImpClass
{
void Created( GameObject *obj );
+ void Detach ( GameObject *obj );
void Damaged ( GameObject *obj, GameObject *damager, float amount );
void Killed( GameObject *obj, GameObject *killer );
void Custom( GameObject *obj, int type, int param, GameObject *sender );
- void Animation_Complete ( GameObject *obj, const char *animation_name );
// ID of the building controller we belong to
int parentId;
@@ -125,11 +146,14 @@
// We use this to remember when we are in the destroyed state, so we know
// that when we next reach 100% health we need to trigger the repaired event
bool isDestroyed;
- int animstate;
// Abstract functions
virtual void applyEffect ( GameObject *obj, GameObject *parent ) = 0;
virtual void reverseEffect ( GameObject *obj, GameObject *parent ) = 0;
+protected:
+ LoopedAnimationController* m_pLoopedAnimCtrl;
+public:
+ MinorWeakpointScriptClass() : m_pLoopedAnimCtrl(0) {}
};
@@ -170,6 +194,16 @@
};
/*------------------------
+Weakpoint - Disable Naval Vehicle Purchase
+--------------------------*/
+
+class dp88_buildingScripts_weakpoint_disableNavalVehiclePurchase : public MinorWeakpointScriptClass
+{
+ void applyEffect ( GameObject *obj, GameObject *parent );
+ void reverseEffect ( GameObject *obj, GameObject *parent );
+};
+
+/*------------------------
Weakpoint - Disable Base Power
--------------------------*/
@@ -247,6 +281,12 @@
};
+class dp88_buildingScripts_functionMoneyGrant : public dp88_BuildingEffectScript
+{
+ void Created ( GameObject* obj );
+ void OnBuildingCaptured ( GameObject* obj, int team );
+};
+
// Spawn team zone - spawns a script zone depending on which team currently owns
// the building
class dp88_buildingScripts_functionSpawnTeamZone : public dp88_BuildingEffectScript
diff -uwr sourceold/scripts/dp88_customAI.cpp source/scripts/dp88_customAI.cpp
--- sourceold/scripts/dp88_customAI.cpp 2011-10-22 21:53:45.773437500 +0800
+++ source/scripts/dp88_customAI.cpp 2012-05-23 10:21:56.112304600 +0800
@@ -9,11 +9,13 @@
In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
Only the source code to the module(s) containing the licenced code has to be released.
*/
+
// Include files
#include "general.h"
#include "scripts.h"
#include "engine.h"
#include "dp88_customAI.h"
+#include "dp88_custom_timer_defines.h"
#include "VehicleGameObj.h"
/*------------------------
@@ -113,7 +115,7 @@
return 0.0;
}
- if ( Is_Vehicle(target) && !IsVehicleAIEnabled(target->As_VehicleGameObj()) && IsVehicleEmpty(target->As_VehicleGameObj()) )
+ if ( target->As_VehicleGameObj() && !IsVehicleAIEnabled(target->As_VehicleGameObj()) && IsVehicleEmpty(target->As_VehicleGameObj()) )
{
if ( debug ) fprintf ( debugFile, "Target %d is an empty, non-AI vehicle, ignoring\n", Commands->Get_ID(target));
return 0.0;
@@ -123,15 +125,15 @@
// Assign base priority
- if ( Is_Soldier ( target ) && !Get_Fly_Mode(target) )
+ if ( target->As_SoldierGameObj() && !Get_Fly_Mode(target) )
priority = (float)priority_infantry;
- else if ( Is_VTOLVehicle ( target ) || (Is_Soldier(target) && Get_Fly_Mode(target)) )
+ else if ( Get_Vehicle_Mode ( target ) == VEHICLE_TYPE_FLYING || (target->As_SoldierGameObj() && Get_Fly_Mode(target)) )
priority = (float)priority_VTOL;
- else if ( Is_Vehicle ( target ) && Is_Script_Attached ( target, "dp88_AI_heavyVehicleMarker" ) )
+ else if ( target->As_VehicleGameObj() && Is_Script_Attached ( target, "dp88_AI_heavyVehicleMarker" ) )
priority = (float)priority_heavyVehicle;
- else if ( Is_Vehicle ( target ) )
+ else if ( target->As_VehicleGameObj() )
priority = (float)priority_lightVehicle;
- else if ( Is_Building ( target ) )
+ else if ( target->As_BuildingGameObj() )
priority = (float)priority_building;
// Return if our base priority for this target type is 0
@@ -146,7 +148,7 @@
// Apply target value modifier (add X priority for every 10 credits the target
// cost to purchase - not applicable to buildings)
- if ( !Is_Building( target ) )
+ if ( !target->As_BuildingGameObj() )
{
int cost = Get_Team_Cost( Commands->Get_Preset_Name ( target ), Commands->Get_Player_Type ( target ) );
priority += ((float)cost/10.0f) * modifier_target_value;
@@ -195,13 +197,13 @@
bool dp88_customAI::getPrimary ( GameObject *target )
{
- if ( Is_Soldier ( target ) )
+ if ( target->As_SoldierGameObj() )
return primary_infantry;
- else if ( Is_VTOLVehicle ( target ) )
+ else if ( Get_Vehicle_Mode ( target ) == VEHICLE_TYPE_FLYING )
return primary_VTOL;
- else if ( Is_Vehicle ( target ) )
+ else if ( target->As_VehicleGameObj() )
return (Is_Script_Attached(target,"dp88_AI_heavyVehicleMarker")) ? primary_heavyVehicle : primary_lightVehicle;
- else if ( Is_Building ( target ) )
+ else if ( target->As_BuildingGameObj() )
return primary_building;
return true;
}
@@ -486,7 +488,7 @@
targetPriority = enemyPriority;
primary_target = attackPrimary;
- if ( splashInfantry && Is_Soldier(enemy) )
+ if ( splashInfantry && enemy->As_SoldierGameObj() )
{
if ( debug ) fprintf ( debugFile, "Using splash damage against this target\n" );
attackLocation(obj,Commands->Get_Position(enemy),primary_target);
@@ -505,13 +507,12 @@
if ( targetID != 0 )
{
GameObject *target = Commands->Find_Object ( targetID );
-
- if ( !checkPowerState(obj)
+ if (!target || !checkPowerState(obj)
|| ( Commands->Get_Health ( target ) + Commands->Get_Shield_Strength ( target ) <= 0 )
|| !checkTeam ( obj, target )
|| !checkRange ( obj, target, primary_target )
|| (int)time(NULL) - targetLastSeen > 3
- || ( Is_Vehicle(target) && !IsVehicleAIEnabled(target->As_VehicleGameObj()) && IsVehicleEmpty(target->As_VehicleGameObj()) ) )
+ || ( target->As_VehicleGameObj() && !IsVehicleAIEnabled(target->As_VehicleGameObj()) && IsVehicleEmpty(target->As_VehicleGameObj()) ))
{
if ( debug ) fprintf ( debugFile, "Target %d no longer valid, ceasing attack.\n", targetID);
targetID = 0;
@@ -522,7 +523,7 @@
// Otherwise we are OK to continue attacking... if this is an infantry unit
// and splash targetting is enabled then update targetting position
- else if ( splashInfantry && Is_Soldier(target) )
+ else if ( splashInfantry && target->As_SoldierGameObj() )
attackLocation ( obj, Commands->Get_Position(target), primary_target );
}
@@ -636,12 +637,436 @@
-/*------------------------
-Script Registrants
---------------------------*/
+// -------------------------------------------------------------------------------------------------
+// Popup Turret AI
+// -------------------------------------------------------------------------------------------------
-ScriptRegistrant dp88_tankAI_Offensive_Registrant("dp88_tankAI_Offensive","Priority_Infantry=1:int,Weapon_Infantry=1:int,priority_lightVehicle=5:int,priority_heavyVehicle=7:int,Weapon_Vehicle=1:int,Priority_VTOL=5:int,Weapon_VTOL=1:int,Priority_Building=12:int,Weapon_Building=1:int,Max_Attack_Range=150:int,Min_Attack_Range=0:int,Preferred_Attack_Range=60:int,Max_Attack_Range_Secondary=150:int,Min_Attack_Range_Secondary=0:int,Preferred_Attack_Range_Secondary=60:int");
-ScriptRegistrant dp88_AI_Turret_Registrant("dp88_AI_Turret","Priority_Infantry=1.0:float,Weapon_Infantry=1:int,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Weapon_Light_Vehicle=5:int,Priority_Heavy_Vehicle=7.0:float,Weapon_Heavy_Vehicle=1:int,Priority_VTOL=5.0:float,Weapon_VTOL=1:int,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Min_Attack_Range_Secondary=0:int,Max_Attack_Range_Secondary=150:int,Modifier_Distance=0.25:float,Modifier_Target_Damage=0.1:float,Modifier_Target_Value=0.05:float,Requires_Power=0:int,Debug=0:int");
+void dp88_AI_PopupTurret::Created ( GameObject* pSelf )
+{
+ m_deploymentState = STATE_UNDEPLOYED;
+ m_spotterId = 0;
+
+ // Create our spotter turret
+ GameObject* pSpotter = Commands->Create_Object ( Get_Parameter("Spotter_Preset"), Commands->Get_Position(pSelf) );
+ if ( pSpotter )
+ {
+ m_spotterId = Commands->Get_ID(pSpotter);
+
+ // Set the spotter turret to match our configuration, but invisible
+ Commands->Set_Model ( pSpotter, Get_Model(pSelf) );
+ Commands->Set_Is_Rendered ( pSpotter, false );
+ Commands->Enable_Enemy_Seen ( pSpotter, true );
+ Commands->Disable_All_Collisions ( pSpotter );
+ Commands->Innate_Enable ( pSpotter );
+ Set_Skin ( pSpotter, "Blamo" );
+
+ // Attach the spotter script
+ char scriptParams[20];
+ sprintf_s ( scriptParams, sizeof(scriptParams), "%d", Commands->Get_ID(pSelf) );
+ Commands->Attach_Script ( pSpotter, "dp88_AI_PopupTurret_Spotter", scriptParams );
+
+ // 'Deploy' the spotter turret so it can see what we would be able to see whilst deployed
+ Commands->Set_Animation_Frame ( pSpotter, Get_Parameter("Deploy_Animation"), Get_Int_Parameter("Deploy_Animation_Frames") );
+
+ // Make sure the turret itself starts popped down
+ Commands->Set_Animation_Frame ( pSelf, Get_Parameter("Deploy_Animation"), 0 );
+ }
+
+ dp88_AI_Turret::Created(pSelf);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+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 we have no target and have reached the undeploy timeout then trigger undeployment
+ if ( targetID == 0 && time(NULL) > m_undeployTime )
+ Undeploy(pSelf);
+
+ // Else, if we have an active target, update the undeployment timeout time
+ else if ( targetID != 0 )
+ m_undeployTime = time(NULL)+Get_Int_Parameter("Deploy_Timeout");
+ }
+
+ dp88_AI_Turret::Timer_Expired(pSelf, number);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::Custom ( GameObject* pSelf, int type, int param, GameObject* pSender )
+{
+ if ( m_spotterId == Commands->Get_ID(pSender) )
+ {
+ // Spotter only ever sends us one type of message... enemy spotted! Note that we don't simply
+ // deploy here because it might be a target we can't / shouldn't attack, let Enemy_Seen decide
+ // if we actually need to do anything
+ GameObject* pEnemy = Commands->Find_Object(param);
+ if ( pEnemy )
+ Enemy_Seen(pSelf, pEnemy);
+ }
+ else
+ dp88_AI_Turret::Custom(pSelf, type, param, pSender);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::Animation_Complete ( GameObject* pSelf, const char* animation_name )
+{
+ if ( m_deploymentState == STATE_DEPLOYING )
+ {
+ m_deploymentState = STATE_DEPLOYED;
+ m_undeployTime = time(NULL)+Get_Int_Parameter("Deploy_Timeout");
+
+ // Reset targetting parameters, otherwise the next Enemy_Seen call will think we are already attacking
+ // an enemy and not trigger the appropriate actions we are depending upon
+ targetID = 0;
+ }
+ else if ( m_deploymentState == STATE_UNDEPLOYING )
+ m_deploymentState = STATE_UNDEPLOYED;
+
+ dp88_AI_Turret::Animation_Complete(pSelf, animation_name);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::Destroyed ( GameObject* pSelf )
+{
+ if ( GameObject* pSpotter = Commands->Find_Object(m_spotterId) )
+ Commands->Destroy_Object(pSpotter);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::attackTarget ( GameObject* pSelf, GameObject* pTarget, bool primary )
+{
+ if ( m_deploymentState == STATE_DEPLOYED )
+ dp88_AI_Turret::attackTarget(pSelf, pTarget, primary);
+ else
+ Deploy(pSelf); // No need to remember what we are deploying to shoot, enemy seen will be re-triggered
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::attackLocation ( GameObject* pSelf, Vector3 location, bool primary )
+{
+ if ( m_deploymentState == STATE_DEPLOYED )
+ dp88_AI_Turret::attackLocation(pSelf, location, primary);
+ else
+ Deploy(pSelf); // No need to remember what we are deploying to shoot, enemy seen will be re-triggered
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::Deploy ( GameObject* pSelf )
+{
+ if ( m_deploymentState == STATE_UNDEPLOYED || m_deploymentState == STATE_UNDEPLOYING )
+ {
+ m_deploymentState = STATE_DEPLOYING;
+
+ Commands->Set_Animation(pSelf,Get_Parameter("Deploy_Animation"),false,0,Get_Animation_Frame(pSelf),(float)Get_Int_Parameter("Deploy_Animation_Frames"),false);
+
+ if (_stricmp(Get_Parameter("Deploy_Sound"),"0"))
+ Commands->Create_Sound(Get_Parameter("Deploy_Sound"),Commands->Get_Position(pSelf),pSelf);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret::Undeploy ( GameObject* pSelf )
+{
+ if ( m_deploymentState == STATE_DEPLOYED )
+ {
+ m_deploymentState = STATE_UNDEPLOYING;
+
+ Commands->Set_Animation(pSelf,Get_Parameter("Deploy_Animation"),false,0,(float)Get_Int_Parameter("Deploy_Animation_Frames"),0, false);
+
+ if (_stricmp(Get_Parameter("Deploy_Sound"),"0"))
+ Commands->Create_Sound(Get_Parameter("Deploy_Sound"),Commands->Get_Position(pSelf),pSelf);
+ }
+}
+
+
+
+
+
+
+
+// ------------------------------------------------------------------------------------------------
+// Popup Turret Spotter
+// ------------------------------------------------------------------------------------------------
+
+void dp88_AI_PopupTurret_Spotter::Enemy_Seen ( GameObject* pSelf, GameObject* pEnemy )
+{
+ if ( GameObject* pTurret = Commands->Find_Object(Get_Int_Parameter("tId")) )
+ Commands->Send_Custom_Event ( pSelf, pTurret, CUSTOM_TURRETAI_ENEMYSEEN, Commands->Get_ID(pEnemy), 0.0f );
+}
+
+
+
+
+
+
+
+// -------------------------------------------------------------------------------------------------
+// Charged Turret AI
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::Created ( GameObject* pSelf )
+{
+ m_bIsCharging = false;
+ m_bIsDischarging = false;
+ m_chargeAnimObjId = NULL;
+
+ // If a seperate charge animation model has been specified then go ahead and spawn it
+ if ( strlen ( Get_Parameter("Animation_Model") ) > 0 )
+ {
+ GameObject* pChargeAnimObj = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(pSelf) );
+ if ( pChargeAnimObj )
+ {
+ m_chargeAnimObjId = Commands->Get_ID(pChargeAnimObj);
+ Commands->Set_Model ( pChargeAnimObj, Get_Parameter("Animation_Model") );
+ Commands->Attach_To_Object_Bone ( pChargeAnimObj, pSelf, Get_Parameter("Animation_Model_Bone") );
+
+ // Create the looped animation controller on the charge animation object
+ m_pLoopedAnimCtrl = new LoopedAnimationController ( pChargeAnimObj );
+
+ // Attach companion script so we get notified about animation complete events - we need to know
+ // about these so we know when the charged animation is complete.
+ //
+ // \todo Could this be done by simply attaching this script as a listener on the charged
+ // animation object directly and checking the GameObject pointers we get on each
+ // event to check which object they came from? Not sure which is cleaner...
+ char scriptParams[20];
+ sprintf_s ( scriptParams, sizeof(scriptParams), "%d", Commands->Get_ID(pSelf) );
+ Commands->Attach_Script ( pChargeAnimObj, "dp88_AI_ChargedTurret_Animation", scriptParams );
+ }
+ }
+
+ // If we don't have a charge animation object create the looped animation controller on ourselves
+ if ( m_chargeAnimObjId == NULL )
+ m_pLoopedAnimCtrl = new LoopedAnimationController ( pSelf );
+
+ m_bPowerState = checkPowerState(pSelf);
+ ApplyIdleAnimation(pSelf);
+
+ dp88_AI_Turret::Created(pSelf);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+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) )
+ {
+ m_bPowerState = !m_bPowerState;
+
+ // Charging state must always become false now - either we were unpowered to begin with or
+ // we were powered and have now gone offline. Either way, we can't possibly be charging now.
+ m_bIsCharging = false;
+
+ // If we were discharging our weapon we need to stop now and trigger a reload so we don't
+ // fire a partial charge next time around
+ if ( m_bIsDischarging )
+ {
+ m_bIsDischarging = false;
+ stopAttacking(pSelf);
+ Set_Current_Bullets(pSelf, 0);
+ }
+
+ // Apply the appropriate idle animation
+ ApplyIdleAnimation(pSelf);
+ }
+
+
+ // 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 )
+ {
+ // Have we unloaded our entire clip? If so then we can start charging for the next attack
+ if ( Get_Current_Bullets(pSelf) == 0 )
+ {
+ m_bIsDischarging = false;
+ stopAttacking(pSelf); // Don't want to fire again before we are ready!
+ if ( targetID != NULL )
+ StartCharging(pSelf);
+ else
+ ApplyIdleAnimation(pSelf);
+ }
+
+ // Has our target already died or ran like a coward before we could empty our clip? If so then
+ // reset and trigger a reload (so we don't have a partial charge next time round)
+ else if ( targetID == NULL )
+ {
+ m_bIsDischarging = false;
+ Set_Current_Bullets(pSelf, 0);
+ ApplyIdleAnimation(pSelf);
+ }
+ }
+
+ dp88_AI_Turret::Timer_Expired(pSelf, number);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::Animation_Complete ( GameObject* pSelf, const char* animation_name )
+{
+ 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);
+ }
+ }
+ }
+ }
+
+ dp88_AI_Turret::Animation_Complete(pSelf, animation_name);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::Destroyed ( GameObject* pSelf )
+{
+ if (m_pLoopedAnimCtrl)
+ {
+ delete m_pLoopedAnimCtrl;
+ }
+
+ if ( m_chargeAnimObjId )
+ {
+ if ( GameObject* pChargeAnimObj = Commands->Find_Object(m_chargeAnimObjId) )
+ Commands->Destroy_Object(pChargeAnimObj);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::attackTarget ( GameObject* pSelf, GameObject* pTarget, bool primary )
+{
+ // Changing targets in the middle of discharging? Sure, why not...
+ if ( m_bIsDischarging )
+ dp88_AI_Turret::attackTarget ( pSelf, pTarget, primary );
+
+ // Otherwise call StartCharging and let it determine what to do...
+ StartCharging(pSelf);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::attackLocation ( GameObject* pSelf, Vector3 location, bool primary )
+{
+ // Changing targets in the middle of discharging? Sure, why not...
+ if ( m_bIsDischarging )
+ dp88_AI_Turret::attackLocation ( pSelf, location, primary );
+
+ // Otherwise call StartCharging and let it determine what to do...
+ StartCharging(pSelf);
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::StartCharging ( GameObject* pSelf )
+{
+ // If we are not charging, not discharging, powered and have a target then we can start a new
+ // charging cycle
+ if ( !m_bIsCharging && !m_bIsDischarging && checkPowerState(pSelf) && targetID != NULL )
+ {
+ m_bIsCharging = true;
+
+ // Only play a single iteration of the charge up animation - if we need to keep attacking after
+ // the shot is fired this will get called again
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("Animation"), Get_Int_Parameter("Animation_Charge_Start_Frame"), Get_Int_Parameter("Animation_Charge_End_Frame"), 1 );
+
+ if (_stricmp(Get_Parameter("Charge_Sound"),"0"))
+ Commands->Create_Sound(Get_Parameter("Charge_Sound"),Commands->Get_Position(pSelf),pSelf);
+
+ // Nothing to do but wait for the charging to complete... hum de dum...
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+
+GameObject* dp88_AI_ChargedTurret::GetAnimationObject ( GameObject* pSelf )
+{
+ if ( m_chargeAnimObjId != NULL )
+ return Commands->Find_Object(m_chargeAnimObjId);
+ return pSelf;
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::ApplyIdleAnimation ( GameObject* pSelf )
+{
+ // Apply the correct animation frames for the uncharged state dependant upon base power conditions,
+ // which should already have been updated before calling this function
+ if ( m_bPowerState )
+ m_pLoopedAnimCtrl->PlayAnimation(Get_Parameter("Animation"),Get_Int_Parameter("Animation_Idle_Start_Frame"),Get_Int_Parameter("Animation_Idle_End_Frame"));
+ else
+ m_pLoopedAnimCtrl->PlayAnimation(Get_Parameter("Animation"),Get_Int_Parameter("Animation_Unpowered_Start_Frame"),Get_Int_Parameter("Animation_Unpowered_End_Frame"));
+}
+
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret::Custom ( GameObject* pSelf, int type, int param, GameObject* pSender )
+{
+ if ( pSelf != pSender && GetAnimationObject(pSelf) == pSender )
+ Animation_Complete(pSelf, Get_Parameter("Animation"));
+}
+
+
+
+
+
+
+
+
+
+// -------------------------------------------------------------------------------------------------
+// Charged Turret AI - Animation Complete Notifier
+// -------------------------------------------------------------------------------------------------
+
+void dp88_AI_ChargedTurret_Animation::Animation_Complete ( GameObject* pSelf, const char* animation_name )
+{
+ if ( GameObject* pTurret = Commands->Find_Object(Get_Int_Parameter("tId")) )
+ Commands->Send_Custom_Event ( pSelf, pTurret, CUSTOM_TURRETAI_ANIMATIONCOMPLETE, 0, 0.0f );
+}
+
+
+
+
+
+
+
+// -------------------------------------------------------------------------------------------------
+// Script Registrants
+// -------------------------------------------------------------------------------------------------
// Heavy vehicle marker (dummy script)
ScriptRegistrant dp88_AI_heavyVehicleMarker_Registrant("dp88_AI_heavyVehicleMarker","");
\ No newline at end of file
+
+ScriptRegistrant dp88_tankAI_Offensive_Registrant("dp88_tankAI_Offensive","Priority_Infantry=1:int,Weapon_Infantry=1:int,priority_lightVehicle=5:int,priority_heavyVehicle=7:int,Weapon_Vehicle=1:int,Priority_VTOL=5:int,Weapon_VTOL=1:int,Priority_Building=12:int,Weapon_Building=1:int,Max_Attack_Range=150:int,Min_Attack_Range=0:int,Preferred_Attack_Range=60:int,Max_Attack_Range_Secondary=150:int,Min_Attack_Range_Secondary=0:int,Preferred_Attack_Range_Secondary=60:int");
+ScriptRegistrant dp88_AI_Turret_Registrant("dp88_AI_Turret","Priority_Infantry=1.0:float,Weapon_Infantry=1:int,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Weapon_Light_Vehicle=5:int,Priority_Heavy_Vehicle=7.0:float,Weapon_Heavy_Vehicle=1:int,Priority_VTOL=5.0:float,Weapon_VTOL=1:int,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Min_Attack_Range_Secondary=0:int,Max_Attack_Range_Secondary=150:int,Modifier_Distance=0.25:float,Modifier_Target_Damage=0.1:float,Modifier_Target_Value=0.05:float,Requires_Power=0:int,Debug=0:int");
+ScriptRegistrant dp88_AI_PopupTurret_Registrant("dp88_AI_PopupTurret","Priority_Infantry=1.0:float,Weapon_Infantry=1:int,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Weapon_Light_Vehicle=5:int,Priority_Heavy_Vehicle=7.0:float,Weapon_Heavy_Vehicle=1:int,Priority_VTOL=5.0:float,Weapon_VTOL=1:int,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Min_Attack_Range_Secondary=0:int,Max_Attack_Range_Secondary=150:int,Deploy_Animation:string,Deploy_Animation_Frames:int,Deploy_Sound:string,Deploy_Timeout:int,Spotter_Preset:string,Modifier_Distance=0.25:float,Modifier_Target_Damage=0.1:float,Modifier_Target_Value=0.05:float,Requires_Power=0:int,Debug=0:int");
+ScriptRegistrant dp88_AI_PopupTurret_Spotter_Registrant("dp88_AI_PopupTurret_Spotter","tId:int");
+ScriptRegistrant dp88_AI_ChargedTurret_Registrant("dp88_AI_ChargedTurret","Priority_Infantry=1.0:float,Weapon_Infantry=1:int,Splash_Infantry=0:int,Priority_Light_Vehicle=5.0:float,Weapon_Light_Vehicle=5:int,Priority_Heavy_Vehicle=7.0:float,Weapon_Heavy_Vehicle=1:int,Priority_VTOL=5.0:float,Weapon_VTOL=1:int,Min_Attack_Range=0:int,Max_Attack_Range=150:int,Min_Attack_Range_Secondary=0:int,Max_Attack_Range_Secondary=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.05:float,Requires_Power=0:int,Debug=0:int");
+ScriptRegistrant dp88_AI_ChargedTurret_Animation_Registrant("dp88_AI_ChargedTurret_Animation","tId:int");
diff -uwr sourceold/scripts/dp88_customAI.h source/scripts/dp88_customAI.h
--- sourceold/scripts/dp88_customAI.h 2011-10-22 19:50:31.665039000 +0800
+++ source/scripts/dp88_customAI.h 2012-05-13 21:10:00.739101500 +0800
@@ -11,6 +11,7 @@
*/
#pragma once
+#include "LoopedAnimationController.h"
#define TIMER_CHECK_TARGET 100778801
@@ -19,6 +20,14 @@
Base class for custom AI's
--------------------------*/
+
+/*!
+* \brief danpaul88's Custom AI Core
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This class contains the core logic used in custom AI scripts, such as the target prioritisation
+* mechanism. It is not an actual script in it's own right and cannot be used in LevelEdit directly.
+*/
class dp88_customAI : public ScriptImpClass
{
public:
@@ -91,11 +100,27 @@
virtual bool IsVehicleAIEnabled( VehicleGameObj* vobj );
};
+// -------------------------------------------------------------------------------------------------
-/*------------------------
-Offensive Tank AI
---------------------------*/
+/*!
+* \brief danpaul88's Custom AI Heavy Vehicle Marker
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This is a dummy script with no functionality which can be attached to an object to indicate all of
+* my custom AI scripts should treat this as a heavy vehicle. Any vehicle without this script will be
+* considered to be a light vehicle.
+*/
+class dp88_AI_heavyVehicleMarker : public ScriptImpClass{};
+
+// -------------------------------------------------------------------------------------------------
+/*!
+* \brief Offensive Tank AI
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This is a somewhat experimental AI for vehicles which can track targets over a predefined distance
+* and attack them. This script is not yet suitable for use in maps or mods and is subject to change.
+*/
class dp88_tankAI_Offensive : public dp88_customAI
{
/* ----
@@ -116,13 +141,73 @@
void Timer_Expired( GameObject *obj, int number );
};
+// -------------------------------------------------------------------------------------------------
-
-/*------------------------
-Turret AI
- Base class for turret type AI scripts
---------------------------*/
-
+/*!
+* \brief Turret AI
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* 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.
+* non-VTOL).
+*
+* The turret AI uses a priority based system to 'intelligently' pick targets based upon a range of
+* criteria such as the type of target, how far away it is, if it's already taken damage and how
+* valuable it is. All of these criteria can be fine tuned in the script parameters to give you a
+* high degree of control over which of several targets a turret will choose to shoot at. This also
+* has the effect of making multiple, closely placed, turrets with the same targetting parameters
+* concentrate their fire on a single target for maximum impact.
+*
+* \param Priority_Infantry
+* Base targetting priority for infantry targets, or 0 to ignore infantry
+* \param Weapon_Infantry
+* Weapon to use against infantry targets: 0 for primary fire, 1 for secondary fire
+* \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 Weapon_Light_Vehicle
+* Weapon to use against light vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_Heavy_Vehicle
+* Base targetting priority for heavy vehicle targets, or 0 to ignore heavy vehicles
+* \param Weapon_Heavy_Vehicle
+* Weapon to use against heavy vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_VTOL
+* Base targetting priority for flying targets, or 0 to ignore flying targets
+* \param Weapon_VTOL
+* Weapon to use against flying targets: 0 for primary fire, 1 for secondary fire
+* \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 Min_Attack_Range_Secondary
+* Minimum distance at which the turret can engage enemies when using secondary fire
+* \param Max_Attack_Range_Secondary
+* Maximum distance at which the turret can engage enemies when using secondary fire
+* \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.
+*
+* \note
+* Vehicles are always classified as light vehicles unless they have the dp88_AI_heavyVehicleMarker
+* script attached to them.
+*
+* \warning
+* Never leave the Debug parameter enabled when releasing your mod, it will clog up everyones
+* machines with useless text files everywhere... people usually don't like that :D
+*/
class dp88_AI_Turret : public dp88_customAI
{
public:
@@ -166,12 +251,307 @@
virtual void stopAttacking ( GameObject* obj );
};
+// -------------------------------------------------------------------------------------------------
+
+/*!
+* \brief Popup Turret AI
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* 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;
+*
+* Turret Preset
+* As with any turret preset, this has all the weapons, health, armour, etc etc and should have an
+* instance of this script attached to it with the relevant parameters configured (see below).
+*
+* Spotter Preset
+* This is a dummy preset used to 'see' enemies whilst the real turret is undeployed. This should be
+* setup as a turret but only the sight range parameter needs to be configured properly. It's model
+* can be set to any valid model (or possibly left blank?) and it should NOT have ANY scripts. Note
+* this preset can be shared by multiple turret presets as long as the sight range is appropriate.
+*
+* \param Priority_Infantry
+* Base targetting priority for infantry targets, or 0 to ignore infantry
+* \param Weapon_Infantry
+* Weapon to use against infantry targets: 0 for primary fire, 1 for secondary fire
+* \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 Weapon_Light_Vehicle
+* Weapon to use against light vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_Heavy_Vehicle
+* Base targetting priority for heavy vehicle targets, or 0 to ignore heavy vehicles
+* \param Weapon_Heavy_Vehicle
+* Weapon to use against heavy vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_VTOL
+* Base targetting priority for flying targets, or 0 to ignore flying targets
+* \param Weapon_VTOL
+* Weapon to use against flying targets: 0 for primary fire, 1 for secondary fire
+* \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 Min_Attack_Range_Secondary
+* Minimum distance at which the turret can engage enemies when using secondary fire
+* \param Max_Attack_Range_Secondary
+* Maximum distance at which the turret can engage enemies when using secondary fire
+* \param Deploy_Animation
+* Name of the animation to play when the turret deploys - this is played in reverse for undeploy
+* \param Deploy_Animation_Frames
+* Number of animation frames in the deployment animation, which should start at frame 0
+* \param Deploy_Sound
+* An optional sound effect to be played whilst the deployment occurs
+* \param Deploy_Timeout
+* Time the turret will wait after it last saw an enemy before it undeploys, in seconds
+* \param Spotter_Preset
+* Name of your Spotter Preset in LevelEdit
+* \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.
+*
+* \note
+* Vehicles are always classified as light vehicles unless they have the dp88_AI_heavyVehicleMarker
+* script attached to them.
+*
+* \warning
+* Never leave the Debug parameter enabled when releasing your mod, it will clog up everyones
+* machines with useless text files everywhere... people usually don't like that :D
+*/
+class dp88_AI_PopupTurret : public dp88_AI_Turret
+{
+public:
+ // Game events
+ virtual void Created ( GameObject* pSelf );
+ virtual void Timer_Expired ( GameObject* pSelf, int number );
+ virtual void Custom ( GameObject* pSelf, int type, int param, GameObject* pSender );
+ virtual void Animation_Complete ( GameObject* pSelf, const char* animation_name );
+ virtual void Destroyed( GameObject* pSelf );
+
+protected:
+ static const unsigned char STATE_UNDEPLOYED = 0x00;
+ static const unsigned char STATE_DEPLOYING = 0x01;
+ static const unsigned char STATE_DEPLOYED = 0x02;
+ static const unsigned char STATE_UNDEPLOYING = 0x03;
-/*------------------------
-Heavy Vehicle Marker
- Dummy script to mark a vehicle as being heavy
---------------------------*/
+ /*! Current deployment state */
+ unsigned char m_deploymentState;
+
+ /*! Time at which we will undeploy unless we see a target in the meantime */
+ time_t m_undeployTime;
+
+ /*! ID of the spotter turret we have created for ourselves */
+ int m_spotterId;
+
+
+ /*! Overloaded form of dp88_AI_Turret::attackTarget to check deployment state prior to initiating attack */
+ virtual void attackTarget ( GameObject* pSelf, GameObject* pTarget, bool primary );
+
+ /*! Overloaded form of dp88_AI_Turret::attackLocation to check deployment state prior to initiating attack */
+ virtual void attackLocation ( GameObject* pSelf, Vector3 location, bool primary );
+
+
+ /*! Function to initiate the deployment sequence if it is not already in process, this is called
+ when we want to start shooting things */
+ virtual void Deploy ( GameObject* pSelf );
+
+ /*! Function to initiate the undeployment sequence if it is not already in process, this is called
+ when we are bored because we haven't had anything to shoot at for a while...*/
+ virtual void Undeploy ( GameObject* pSelf );
+};
+
+// -------------------------------------------------------------------------------------------------
+
+/*!
+* \brief Popup Turret Spotter
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* A simple companion script for dp88_AI_PopupTurret which is attached to an invisible clone of the
+* turret to allow it to 'see' enemies when whilst the muzzle is underground. Simply fires off a
+* custom event to the parent turret each time it sees an enemy with the ID of that enemy.
+*/
+class dp88_AI_PopupTurret_Spotter : public ScriptImpClass
+{
+ void Enemy_Seen ( GameObject* pSelf, GameObject* pEnemy );
+};
+
+// -------------------------------------------------------------------------------------------------
+
+/*!
+* \brief Charged Turret AI
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* 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
+* the animation can be played on either the turrets own model or on a seperate preset which is
+* attached by this script to a specified bone on the turret model. This allows damage and charge
+* up animations to be used on a turret simultaneously.
+*
+* One notable feature is the ability to fire more than one shot each time the turret charges up,
+* allowing for greater flexibility in usage. When the turret is fully charged it will fire at the
+* enemy until it runs out of bullets and needs to reload, at which point it will restart the charge
+* up animation.
+*
+* \note
+* The weapon reload time must be less than the duration of the charging animation
+*
+* \warning
+* Currently there is a design limitation in the script which requires that the weapon reload time
+* must be at least 1.1 seconds in duration to ensure correct detection of the discharged state. If
+* this is problematic in future the limitation can be removed. If your reload time is less than 1
+* second the turret could empty two or more complete clips of ammo before charging again.
+*
+* \param Priority_Infantry
+* Base targetting priority for infantry targets, or 0 to ignore infantry
+* \param Weapon_Infantry
+* Weapon to use against infantry targets: 0 for primary fire, 1 for secondary fire
+* \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 Weapon_Light_Vehicle
+* Weapon to use against light vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_Heavy_Vehicle
+* Base targetting priority for heavy vehicle targets, or 0 to ignore heavy vehicles
+* \param Weapon_Heavy_Vehicle
+* Weapon to use against heavy vehicle targets: 0 for primary fire, 1 for secondary fire
+* \param Priority_VTOL
+* Base targetting priority for flying targets, or 0 to ignore flying targets
+* \param Weapon_VTOL
+* Weapon to use against flying targets: 0 for primary fire, 1 for secondary fire
+* \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 Min_Attack_Range_Secondary
+* Minimum distance at which the turret can engage enemies when using secondary fire
+* \param Max_Attack_Range_Secondary
+* Maximum distance at which the turret can engage enemies when using secondary 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.
+*
+* \note
+* Vehicles are always classified as light vehicles unless they have the dp88_AI_heavyVehicleMarker
+* script attached to them.
+*
+* \warning
+* Never leave the Debug parameter enabled when releasing your mod, it will clog up everyones
+* machines with useless text files everywhere... people usually don't like that :D
+*/
+class dp88_AI_ChargedTurret : public dp88_AI_Turret
+{
+public:
+ // Game events
+ virtual void Created ( GameObject* pSelf );
+ virtual void Timer_Expired ( GameObject* pSelf, int number );
+ virtual void Custom ( GameObject* pSelf, int type, int param, GameObject* pSender );
+ virtual void Animation_Complete ( GameObject* pSelf, const char* animation_name );
+ virtual void Destroyed( GameObject* pSelf );
+
+
+protected:
+ /*! Are we currently charging ready for an attack? */
+ bool m_bIsCharging;
+
+ /*! Are we currently discharging (ie: attacking an enemy)? */
+ bool m_bIsDischarging;
+
+ /*! ID of the charge animation object we have created for ourselves */
+ int m_chargeAnimObjId;
+
+ /*! Power state last time it was checked - if this changes we need to update our animation */
+ bool m_bPowerState;
+
+ /*! A looped animation controller for the idle and low power state animations */
+ LoopedAnimationController* m_pLoopedAnimCtrl;
+
+
+ /*! Overloaded form of dp88_AI_Turret::attackTarget which initiates turret charging (if it is not
+ * currently in progress) rather than actually attacking anything */
+ virtual void attackTarget ( GameObject* pSelf, GameObject* pTarget, bool primary );
+
+ /*! Overloaded form of dp88_AI_Turret::attackLocation which initiates turret charging (if it is
+ * not currently in progress) rather than actually attacking anything */
+ virtual void attackLocation ( GameObject* pSelf, Vector3 location, bool primary );
+
+
+ /*! This function is called to initiate the charge up process, if it is not already in progress */
+ virtual void StartCharging ( 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
+ * one was specified in the script parameters */
+ virtual GameObject* GetAnimationObject ( GameObject* pSelf );
+
+ /*! Called when the turret is idle or unpowered to apply the correct animation frames */
+ virtual void ApplyIdleAnimation ( GameObject* pSelf );
+};
+
+/*!
+* \brief Chargeup Animation Detector
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* A script to allow detection of animations if the "separate object" feature is used
+*/
+class dp88_AI_ChargedTurret_Animation : public ScriptImpClass
+{
+ // Game events
+ virtual void Animation_Complete ( GameObject* pSelf, const char* animation_name );
+};
-class dp88_AI_heavyVehicleMarker : public ScriptImpClass
-{};
\ No newline at end of file
+// -------------------------------------------------------------------------------------------------
\ No newline at end of file
diff -uwr sourceold/scripts/dp88_custom_timer_defines.h source/scripts/dp88_custom_timer_defines.h
--- sourceold/scripts/dp88_custom_timer_defines.h 2011-10-25 07:50:47.753906200 +0800
+++ source/scripts/dp88_custom_timer_defines.h 2012-05-07 07:09:13.429789000 +0800
@@ -86,6 +86,9 @@
#define CUSTOM_REMOTECONTROL_DISABLED 1144070006 // Send to a remote control console to disable it
#define CUSTOM_REMOTECONTROL_ENABLED 1144070007 // Send to a remote control console to enable it
+// Customs for custom turret AI scripts
+#define CUSTOM_TURRETAI_ENEMYSEEN 1144080001 // Sent from dp88_AI_PopupTurret_Spotter to dp88_AI_PopupTurret
+#define CUSTOM_TURRETAI_ANIMATIONCOMPLETE 1144080002 // Send from dp88_AI_ChargeTurret_Animation to dp88_AI_ChargeTurret
diff -uwr sourceold/scripts/dp88_misc.cpp source/scripts/dp88_misc.cpp
--- sourceold/scripts/dp88_misc.cpp 2012-02-23 12:06:21.224609300 +0800
+++ source/scripts/dp88_misc.cpp 2012-05-23 10:18:53.428710900 +0800
@@ -578,13 +578,14 @@
-/*------------------------
-Damage animation script
---------------------------*/
+// -------------------------------------------------------------------------------------------------
+// Damage animation script
+// -------------------------------------------------------------------------------------------------
void dp88_damageAnimation::Created ( GameObject* obj )
{
loopAnimation = (Get_Int_Parameter ( "loopAnimation" ) == 1);
+ m_pLoopedAnimCtrl = new LoopedAnimationController(obj); // Can also do single-iteration loops :)
/* Load settings */
damageLevelBoundaries[0] = 100;
@@ -643,14 +644,18 @@
}
}
-void dp88_damageAnimation::Animation_Complete ( GameObject *obj, const char *animation_name )
+// -------------------------------------------------------------------------------------------------
+
+void dp88_damageAnimation::Detach ( GameObject* obj )
{
- if (loopAnimation)
+ if (m_pLoopedAnimCtrl)
{
- SetDamageAnimation(obj);
+ delete m_pLoopedAnimCtrl;
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_damageAnimation::Damaged( GameObject *obj, GameObject *damager, float amount )
{
if ( amount >= 0 )
@@ -677,6 +682,8 @@
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_damageAnimation::Timer_Expired ( GameObject* obj, int number )
{
if ( number == TIMER_CHECK_BASE_POWER_STATE )
@@ -692,15 +699,17 @@
}
}
+// -------------------------------------------------------------------------------------------------
+
void dp88_damageAnimation::SetDamageAnimation ( GameObject* obj )
{
- obj->As_PhysicalGameObj()->Clear_Animation();
if ( basePowerState || damageLevelLowPowerStartFrames[currentDamageLevel] < 0 )
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)damageLevelStartFrames[currentDamageLevel], (float)damageLevelEndFrames[currentDamageLevel], false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), damageLevelStartFrames[currentDamageLevel], damageLevelEndFrames[currentDamageLevel], (loopAnimation)?0:1 );
else
- Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)damageLevelLowPowerStartFrames[currentDamageLevel], (float)damageLevelLowPowerEndFrames[currentDamageLevel], false );
+ m_pLoopedAnimCtrl->PlayAnimation ( Get_Parameter("animationName"), damageLevelLowPowerStartFrames[currentDamageLevel], damageLevelLowPowerEndFrames[currentDamageLevel], (loopAnimation)?0:1 );
}
+// -------------------------------------------------------------------------------------------------
ScriptRegistrant dp88_damageAnimation_Registrant(
"dp88_damageAnimation",
@@ -737,6 +746,8 @@
"damageBoundary5_endFrame_lowPower=-1:int"
);
+// -------------------------------------------------------------------------------------------------
+
@@ -865,7 +876,7 @@
shifted_vehicle_object_id = NULL;
// Can only be used on vehicles
- if ( !As_VehicleGameObj(obj) )
+ if ( !obj->As_VehicleGameObj() )
{
Console_Output ( "[%d:%s:%s] Critical Error: This script can only be used on vehicles! Destroying script...\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name() );
Destroy_Script();
diff -uwr sourceold/scripts/dp88_misc.h source/scripts/dp88_misc.h
--- sourceold/scripts/dp88_misc.h 2011-12-01 11:52:12.871093700 +0800
+++ source/scripts/dp88_misc.h 2012-05-23 10:33:45.755859300 +0800
@@ -9,10 +9,12 @@
In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
Only the source code to the module(s) containing the licenced code has to be released.
*/
+
#pragma once
#include "scripts.h"
#include "engine.h"
+#include "LoopedAnimationController.h"
@@ -104,16 +106,108 @@
-/*------------------------
-Damage animation script
---------------------------*/
+/*!
+* \brief Damage animation script
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* This is a generic damage animation script that allows you to choose the health thresholds at which
+* different damage states are applied, rather than being tied into the 25%, 50%, 75% etc permitted
+* by the damage bones mechanism.
+*
+* You can create up to six damage states using this script, with both powered and unpowered versions
+* of each state, however if you don't require all six states you can leave the extras unconfigured.
+*
+* The first state is considered to be the 'healthy' state and is used when the object is above the
+* first damage boundary. Each subsequent state is activated when the health of the object drops
+* below the specified boundary, which is a percentage of total health. So, for instance, if you set
+* boundary 1 to 70 and boundary 2 to 30 your object will animate as follows;
+*
+* Health 71% - 100%: Healthy animation
+* Health 31% - 70%: Damage animation 1
+* Health 1% - 0%: Damage animation 2
+*
+* \param animationName
+* Name of the animation containing all the damage state frames
+* \param loopAnimation
+* True if the damage animation should be played in a loop, false otherwise
+* \param healthy_startFrame
+* First frame number for the healthy state animation
+* \param healthy_endFrame
+* Last frame number for the healthy state animation
+* \param healthy_startFrame_lowPower
+* First frame number for the healthy state animation when power is offline, or -1 to use the same
+* value as healthy_startFrame
+* \param healthy_endFrame_lowPower
+* Last frame number for the healthy state animation when power is offline, or -1 to use the same
+* value as healthy_endFrame
+* \param damageBoundary1
+* Damage percent boundary for the first damage state
+* \param damageBoundary1_startFrame
+* First frame number for the first damage state animation
+* \param damageBoundary1_endFrame
+* Last frame number for the first damage state animation
+* \param damageBoundary1_startFrame_lowPower
+* First frame number for the first damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary1_startFrame
+* \param damageBoundary1_endFrame_lowPower
+* Last frame number for the first damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary1_endFrame
+* \param damageBoundary2
+* Damage percent boundary for the second damage state, or -1 to disable this state
+* \param damageBoundary2_startFrame
+* second frame number for the second damage state animation
+* \param damageBoundary2_endFrame
+* Last frame number for the second damage state animation
+* \param damageBoundary2_startFrame_lowPower
+* second frame number for the second damage state animation when power is offline, or -1 to use
+* the same value as damageBoundary2_startFrame
+* \param damageBoundary2_endFrame_lowPower
+* Last frame number for the second damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary2_endFrame
+* \param damageBoundary3
+* Damage percent boundary for the third damage state, or -1 to disable this state
+* \param damageBoundary3_startFrame
+* third frame number for the third damage state animation
+* \param damageBoundary3_endFrame
+* Last frame number for the third damage state animation
+* \param damageBoundary3_startFrame_lowPower
+* third frame number for the third damage state animation when power is offline, or -1 to use
+* the same value as damageBoundary3_startFrame
+* \param damageBoundary3_endFrame_lowPower
+* Last frame number for the third damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary3_endFrame
+* \param damageBoundary4
+* Damage percent boundary for the fourth damage state, or -1 to disable this state
+* \param damageBoundary4_startFrame
+* fourth frame number for the fourth damage state animation
+* \param damageBoundary4_endFrame
+* Last frame number for the fourth damage state animation
+* \param damageBoundary4_startFrame_lowPower
+* fourth frame number for the fourth damage state animation when power is offline, or -1 to use
+* the same value as damageBoundary4_startFrame
+* \param damageBoundary4_endFrame_lowPower
+* Last frame number for the fourth damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary4_endFrame
+* \param damageBoundary5
+* Damage percent boundary for the fifth damage state, or -1 to disable this state
+* \param damageBoundary5_startFrame
+* fifth frame number for the fifth damage state animation
+* \param damageBoundary5_endFrame
+* Last frame number for the fifth damage state animation
+* \param damageBoundary5_startFrame_lowPower
+* fifth frame number for the fifth damage state animation when power is offline, or -1 to use
+* the same value as damageBoundary5_startFrame
+* \param damageBoundary5_endFrame_lowPower
+* Last frame number for the fifth damage state animation when power is offline, or -1 to use the
+* same value as damageBoundary5_endFrame
+*/
class dp88_damageAnimation : public ScriptImpClass
{
void Created ( GameObject* obj );
+ void Detach ( GameObject* obj );
void Damaged( GameObject *obj, GameObject *damager, float amount );
void Timer_Expired ( GameObject* obj, int number );
- void Animation_Complete ( GameObject *obj, const char *animation_name );
void SetDamageAnimation ( GameObject* obj );
@@ -125,6 +219,10 @@
int damageLevelLowPowerEndFrames[6];
bool loopAnimation;
bool basePowerState;
+protected:
+ LoopedAnimationController* m_pLoopedAnimCtrl;
+public:
+ dp88_damageAnimation() : m_pLoopedAnimCtrl(0) {}
};
diff -uwr sourceold/scripts/dp88_securitySystem.cpp source/scripts/dp88_securitySystem.cpp
--- sourceold/scripts/dp88_securitySystem.cpp 2011-10-11 23:03:38.137695300 +0800
+++ source/scripts/dp88_securitySystem.cpp 2012-04-19 17:33:30.064453100 +0800
@@ -188,8 +188,8 @@
// Work out position for target box
Vector3 pos = Commands->Get_Position( obj );
- pos.X = pos.X + 2 * cos (facing);
- pos.Y = pos.Y + 2 * sin (facing);
+ pos.X = pos.X + 2 * cos (DEG_TO_RADF(facing));
+ pos.Y = pos.Y + 2 * sin (DEG_TO_RADF(facing));
// Move fake target
GameObject* fakeTarget = Commands->Find_Object ( fakeTargetId );
diff -uwr sourceold/scripts/dp88_veterancy.cpp source/scripts/dp88_veterancy.cpp
--- sourceold/scripts/dp88_veterancy.cpp 2011-10-23 09:34:51.542968900 +0800
+++ source/scripts/dp88_veterancy.cpp 2012-04-24 21:55:23.658203100 +0800
@@ -14,6 +14,7 @@
#include "dp88_veterancy.h"
#include "dp88_custom_timer_defines.h"
#include "VehicleGameObjDef.h" // For VEHICLE_TYPE_TURRET
+#include "ScriptableGameObj.h"
/******************************
Initialise static pointer lists to null
@@ -58,7 +59,7 @@
// If unit is a soldier...
- if ( Is_Soldier ( obj ) )
+ if ( obj->As_SoldierGameObj() )
{
infantryVeteranRequirement = Get_Int_Parameter ( "veteran_pointsRequired" );
infantryEliteRequirement = Get_Int_Parameter ( "elite_pointsRequired" );
@@ -112,7 +113,7 @@
// Else if unit is a vehicle
- else if ( Is_Vehicle ( obj ) )
+ else if ( obj->As_VehicleGameObj() )
{
vehicleVeteranRequirement = Get_Int_Parameter ( "veteran_pointsRequired" );
vehicleEliteRequirement = Get_Int_Parameter ( "elite_pointsRequired" );
@@ -168,7 +169,7 @@
Points given: 50% of ((pointsValue / total hit points) * damage repaired) */
else if ( amount < 0 && Get_Object_Type(damager) == Get_Object_Type(obj)
- && ( !Is_Vehicle(obj) || Get_Vehicle_Driver ( obj ) != NULL || Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET ) )
+ && ( !obj->As_VehicleGameObj() || Get_Vehicle_Driver ( obj ) != NULL || Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET ) )
{
grantVeterancyPoints ( damager, ((pointsValue/totalHitPoints)*(amount*-1)) *0.50f );
}
@@ -384,7 +385,7 @@
if ( obj == NULL || dead )
return;
- if ( Is_Soldier ( obj ) )
+ if ( obj->As_SoldierGameObj() )
{
// Generate name string for the unit promoted chevron
char promotionChevronPreset[27];
@@ -416,7 +417,7 @@
- else if ( Is_Vehicle ( obj ) )
+ else if ( obj->As_VehicleGameObj() )
{
// Generate name string for the unit promoted chevron
char promotionChevronPreset[27];
@@ -474,7 +475,11 @@
/* Find veterancy unit object */
dp88_veterancyUnit* dp88_veterancyUnit::getVeterancyData( GameObject *obj )
{
- if ( Is_Soldier ( obj ) && Get_Player_ID ( obj ) != -1 )
+ if (!obj)
+ {
+ return NULL;
+ }
+ if ( obj->As_SoldierGameObj() && Get_Player_ID ( obj ) != -1 )
return playerData[Get_Player_ID ( obj )];
else
{
@@ -508,7 +513,7 @@
return;
// If unit is a soldier and is not driving a vehicle give infantry veterancy points
- if ( Is_Soldier ( obj ) && Get_Vehicle ( obj ) == NULL )
+ if ( obj->As_SoldierGameObj() && Get_Vehicle ( obj ) == NULL )
{
infantryVeterancyPoints += points;
@@ -523,7 +528,7 @@
// If unit is a vehicle or is driving a vehicle give vehicle veterancy points
- if ( Is_Vehicle ( obj ) || ( Is_Soldier ( obj ) && Get_Vehicle ( obj ) != NULL ) )
+ if ( obj->As_VehicleGameObj() || ( obj->As_SoldierGameObj() && Get_Vehicle ( obj ) != NULL ) )
{
vehicleVeterancyPoints += points;
@@ -531,7 +536,7 @@
if ( vehicleVeterancyPoints >= vehicleEliteRequirement && vehicleEliteRequirement > 0 )
{
// If unit is a vehicle promote self to elite
- if ( currentLevel < 2 && Is_Vehicle ( obj ) )
+ if ( currentLevel < 2 && obj->As_VehicleGameObj() )
promoteToElite();
// Otherwise promote the vehicle this unit is driving to elite
@@ -547,7 +552,7 @@
else if ( vehicleVeterancyPoints >= vehicleVeteranRequirement && vehicleVeteranRequirement > 0 )
{
// If unit is a vehicle promote self to veteran
- if ( currentLevel < 1 && Is_Vehicle ( obj ) )
+ if ( currentLevel < 1 && obj->As_VehicleGameObj() )
promoteToVeteran();
// Otherwise promote the vehicle this unit is driving to veteran
@@ -576,7 +581,7 @@
createChevrons ();
// Send page and promotion sound if unit is a player
- if ( Is_Soldier ( obj ) && Get_Player_ID ( obj ) >= 0 )
+ if ( obj->As_SoldierGameObj() && Get_Player_ID ( obj ) >= 0 )
{
// Send page
char consoleInput[128];
@@ -592,7 +597,7 @@
// Send page and promotion sound if unit driver is a player
- else if ( Is_Vehicle ( obj ) && Get_Vehicle_Driver ( obj ) != NULL && Get_Player_ID ( Get_Vehicle_Driver ( obj ) ) >= 0 )
+ else if ( obj->As_VehicleGameObj() && Get_Vehicle_Driver ( obj ) != NULL && Get_Player_ID ( Get_Vehicle_Driver ( obj ) ) >= 0 )
{
// Send page
char consoleInput[128];
@@ -623,7 +628,7 @@
/* If unit is an infantry unit remove old weapon - immediatly if not
currently selected or after a 0.1 second delay otherwise */
- if ( Is_Soldier ( obj ) )
+ if ( obj->As_SoldierGameObj() )
{
if ( selectWeapon )
{
@@ -670,7 +675,7 @@
createChevrons();
// Send page and promotion sound if unit is a player
- if ( Is_Soldier ( obj ) && Get_Player_ID ( obj ) >= 0 )
+ if ( obj->As_SoldierGameObj() && Get_Player_ID ( obj ) >= 0 )
{
// Send page
char consoleInput[128];
@@ -686,7 +691,7 @@
// Send page and promotion sound if unit driver is a player
- else if ( Is_Vehicle ( obj ) && Get_Vehicle_Driver ( obj ) != NULL && Get_Player_ID ( Get_Vehicle_Driver ( obj ) ) >= 0 )
+ else if ( obj->As_VehicleGameObj() && Get_Vehicle_Driver ( obj ) != NULL && Get_Player_ID ( Get_Vehicle_Driver ( obj ) ) >= 0 )
{
// Send page
char consoleInput[128];
@@ -736,7 +741,7 @@
/* If unit is an infantry unit remove old weapon - immediatly if not
currently selected or after a 0.1 second delay otherwise */
- if ( Is_Soldier ( obj ) )
+ if ( obj->As_SoldierGameObj() )
{
if ( selectWeapon )
{
diff -uwr sourceold/scripts/engine_3dre.h source/scripts/engine_3dre.h
--- sourceold/scripts/engine_3dre.h 2012-01-01 06:32:39.324226700 +0800
+++ source/scripts/engine_3dre.h 2012-04-14 04:09:48.077148400 +0800
@@ -478,11 +478,17 @@
virtual void OnShaderDatabaseUnload() {};
};
+#ifndef TTLE_EXPORTS
class TextureMapperClass : public RefCountClass, ShaderControllerObserver {
+#else
+class TextureMapperClass : public RefCountClass {
+#endif
protected:
unsigned int Stage; // 0008 0020
+#ifndef TTLE_EXPORTS
ProgrammableShader *Shader; // 000C 0024
const char* ShaderName; // 0010 0028
+#endif
public:
enum {
MAPPER_ID_UNKNOWN = 0x0,
@@ -513,12 +519,14 @@
TextureMapperClass(TextureMapperClass& src);
TextureMapperClass(unsigned int stage=0);
TextureMapperClass(INIClass& ini,char* section,unsigned int stage);
+#ifndef TTLE_EXPORTS
SHADERS_API void Set_Shader(const char* shader_name, ProgrammableShader* shader = nullptr);
ProgrammableShader *Peek_Shader()
{
return Shader;
}
ProgrammableShader *Get_Shader();
+#endif
virtual void Reset()
{
}
@@ -537,10 +545,12 @@
return false;
}
~TextureMapperClass();
+#ifndef TTLE_EXPORTS
virtual void ApplyToMatrix(Matrix4& mat,int uv_array_index) = 0;
virtual void OnShaderDatabaseLoad();
virtual void OnShaderDatabaseUnload();
+#endif
}; // 0014 002C
typedef void (*ScriptNotify) (int ID,int notify);
diff -uwr sourceold/scripts/engine_def.cpp source/scripts/engine_def.cpp
--- sourceold/scripts/engine_def.cpp 2011-10-11 23:03:32.718750000 +0800
+++ source/scripts/engine_def.cpp 2012-04-24 11:21:11.197265600 +0800
@@ -18,6 +18,7 @@
#include "PhysClass.h"
#include "DefinitionMgrClass.h"
#include "BaseGameObjDef.h"
+#include "ScriptableGameObjDef.h"
DefinitionClass SCRIPTS_API *Find_Definition(unsigned long id)
{
@@ -57,22 +58,13 @@
return d->Get_ID();
}
-const DefinitionClass SCRIPTS_API *Get_Definition(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- return (DefinitionClass *)&(((ScriptableGameObj *)obj)->Get_Definition());
-}
-
DefinitionClass SCRIPTS_API *Get_Phys_Definition(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o = (PhysicalGameObj *)As_PhysicalGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return 0;
diff -uwr sourceold/scripts/engine_def.h source/scripts/engine_def.h
--- sourceold/scripts/engine_def.h 2011-10-11 21:54:12.960937500 +0800
+++ source/scripts/engine_def.h 2012-04-24 11:21:11.134765600 +0800
@@ -19,7 +19,6 @@
DefinitionClass SCRIPTS_API *Find_Named_Definition(const char *name); //Find a DefinitionClass given its name
DefinitionClass SCRIPTS_API *Find_Definition(unsigned long id); //Find a DefinitionClass given its ID
unsigned long SCRIPTS_API Get_Definition_Class_ID(const char *name); //get the class ID of a definition (matches the #defines above)
-const DefinitionClass SCRIPTS_API *Get_Definition(GameObject *obj); //Get a DefinitionClass given an object
DefinitionClass SCRIPTS_API *Get_Phys_Definition(GameObject *obj); //Get a DefinitionClass for the physics class given a PhysicalGameObj
bool SCRIPTS_API Is_Valid_Preset_ID(unsigned long ID); //Is this a valid preset id
bool SCRIPTS_API Is_Valid_Preset(const char *Preset); //Is this a valid preset name
diff -uwr sourceold/scripts/engine_dmg.cpp source/scripts/engine_dmg.cpp
--- sourceold/scripts/engine_dmg.cpp 2011-10-11 23:03:31.418945300 +0800
+++ source/scripts/engine_dmg.cpp 2012-04-24 21:56:27.633789000 +0800
@@ -22,6 +22,14 @@
#include "VehicleGameObjDef.h"
#ifndef TT_EXPORTS
RENEGADE_FUNCTION
+int ArmorWarheadManager::Get_Num_Armor_Types()
+AT3(0x00687730, 0x00686FD0, 0x00519180);
+
+RENEGADE_FUNCTION
+int ArmorWarheadManager::Get_Num_Warhead_Types()
+AT3(0x00687740, 0x00686FE0, 0x00519190);
+
+RENEGADE_FUNCTION
const char *ArmorWarheadManager::Get_Armor_Name(ArmorType)
AT3(0x006877D0, 0x00687070, 0x00519240);
@@ -36,6 +44,51 @@
RENEGADE_FUNCTION
const char *ArmorWarheadManager::Get_Warhead_Name(WarheadType)
AT3(0x006877E0, 0x00687080, 0x005192A0);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Damage_Multiplier(ArmorType, WarheadType)
+AT3(0x006877F0, 0x00687090, 0x00519300);
+
+RENEGADE_FUNCTION
+ArmorWarheadManager::SpecialDamageType ArmorWarheadManager::Get_Special_Damage_Type( WarheadType type )
+AT3(0x00687E60, 0x00687700, 0x005194E0);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Shield_Absorbsion( ArmorType armor, WarheadType warhead )
+AT3(0x00687AE0,0x00687380,0x005193A0);
+
+RENEGADE_FUNCTION
+bool ArmorWarheadManager::Is_Armor_Soft( ArmorType armor )
+AT3(0x00687DD0,0x00687670,0x00519440);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Special_Damage_Probability( WarheadType type )
+AT3(0x00687E70,0x00687710,0x00519540);
+
+RENEGADE_FUNCTION
+WarheadType ArmorWarheadManager::Get_Special_Damage_Warhead( SpecialDamageType type )
+AT3(0x00687E80,0x00687720,0x005195A0);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Special_Damage_Duration( SpecialDamageType type )
+AT3(0x00687E90,0x00687730,0x005195F0);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Special_Damage_Scale( SpecialDamageType type )
+AT3(0x00687EA0,0x00687740,0x00519640);
+
+RENEGADE_FUNCTION
+const char * ArmorWarheadManager::Get_Special_Damage_Explosion( SpecialDamageType type )
+AT3(0x00687EB0,0x00687750,0x00519690);
+
+RENEGADE_FUNCTION
+float ArmorWarheadManager::Get_Visceroid_Probability( WarheadType type )
+AT3(0x00687EC0,0x00687760,0x005196E0);
+
+RENEGADE_FUNCTION
+bool ArmorWarheadManager::Is_Skin_Impervious( SpecialDamageType type, ArmorType skin )
+AT3(0x00687ED0,0x00687770,0x00519740);
+
#endif
#ifndef TTLE_EXPORTS
#include "Engine_Game.h"
@@ -44,7 +97,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -61,7 +114,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) && (Commands->Get_ID(o) != ConstructionYardID))
@@ -79,13 +132,13 @@
void SCRIPTS_API Repair_All_Static_Vehicles_By_Team(int Team,int type)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
- GameObject *o = As_VehicleGameObj(x->Data());
+ VehicleGameObj *o = x->Data();
if (o)
{
- if (Get_Object_Type(o) == Team && Is_DecorationPhys(o))
+ if (Get_Object_Type(o) == Team && o->Peek_Physical_Object() && o->Peek_Physical_Object()->As_DecorationPhysClass())
{
Commands->Send_Custom_Event(o,o,type,0,0);
}
@@ -96,7 +149,11 @@
void SCRIPTS_API Set_Max_Health(GameObject *obj,float health)
{
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ if (!obj)
+ {
+ return;
+ }
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -107,7 +164,11 @@
void SCRIPTS_API Set_Max_Shield_Strength(GameObject *obj,float shieldstrength)
{
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ if (!obj)
+ {
+ return;
+ }
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -118,7 +179,11 @@
const char SCRIPTS_API *Get_Shield_Type(GameObject *obj)
{
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ if (!obj)
+ {
+ return "";
+ }
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return "";
@@ -128,7 +193,11 @@
const char SCRIPTS_API *Get_Skin(GameObject *obj)
{
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ if (!obj)
+ {
+ return "";
+ }
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return "";
@@ -138,7 +207,11 @@
void SCRIPTS_API Set_Skin(GameObject *obj,const char *Skintype)
{
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ if (!obj)
+ {
+ return;
+ }
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -150,15 +223,15 @@
void SCRIPTS_API Damage_All_Vehicles_Area(float Damage,const char *Warhead,const Vector3 &Position,float Distance,GameObject *Host,GameObject *Damager)
{
- if (!Commands->Get_ID(Host) || !Host)
+ if (!Host)
{
return;
}
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
GameObject *obj = x->Data();
- if (obj && As_VehicleGameObj(obj))
+ if (obj)
{
Vector3 ObjPosition = Commands->Get_Position(obj);
Vector3 TestPosition = Position;
@@ -175,23 +248,28 @@
void SCRIPTS_API Damage_All_Objects_Area(float Damage,const char *Warhead,const Vector3 &Position,float Distance,GameObject *Host,GameObject *Damager)
{
- if (!Commands->Get_ID(Host) || !Host)
+ if (!Host)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *obj = (GameObject *)x->Data();
- if (obj && As_ScriptableGameObj(obj))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- Vector3 ObjPosition = Commands->Get_Position(obj);
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ Vector3 ObjPosition = Commands->Get_Position(o2);
Vector3 TestPosition = Position;
ObjPosition.Z = 0;
TestPosition.Z = 0;
- if ((Commands->Get_Distance(ObjPosition,TestPosition) <= Distance) && (Commands->Get_ID(obj) != Commands->Get_ID(Host)))
+ if ((Commands->Get_Distance(ObjPosition,TestPosition) <= Distance) && (Commands->Get_ID(o2) != Commands->Get_ID(Host)))
{
- Commands->Apply_Damage(obj,Damage,Warhead,Damager);
+ Commands->Apply_Damage(o2,Damage,Warhead,Damager);
}
}
x = x->Next();
@@ -205,7 +283,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
float health = Commands->Get_Health(o);
@@ -236,7 +314,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
float health = Commands->Get_Health(o);
@@ -266,7 +344,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
float health = Commands->Get_Health(o);
@@ -297,7 +375,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -329,7 +407,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -360,7 +438,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -393,12 +471,9 @@
GameObject *obj = z->Data();
if (obj)
{
- if (As_SoldierGameObj(obj) || As_VehicleGameObj(obj))
- {
float Health = Commands->Get_Max_Health(obj) + Commands->Get_Max_Shield_Strength(obj);
Commands->Apply_Damage(obj,(Health / 2),"None",0);
}
- }
z = z->Next();
}
}
@@ -407,22 +482,18 @@
{
if (DamageRadius > 0)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
GameObject *o = x->Data();
if (o)
{
- if (As_VehicleGameObj(o))
- {
float health = Commands->Get_Health(o);
if (health > 0)
{
Vector3 pos1 = Commands->Get_Position(o);
Vector3 pos2 = Location;
-
float Distance = Commands->Get_Distance(pos1,pos2);
-
if (Distance <= DamageRadius)
{
float Max_Health = Commands->Get_Max_Health(o);
@@ -432,7 +503,6 @@
}
}
}
- }
x = x->Next();
}
}
@@ -440,11 +510,11 @@
void SCRIPTS_API Set_Damage_Points(GameObject *obj,float points)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- DamageableGameObj *o = (DamageableGameObj*)As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -454,11 +524,11 @@
void SCRIPTS_API Set_Death_Points(GameObject *obj,float points)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- DamageableGameObj *o = (DamageableGameObj*)As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -472,7 +542,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) && (Commands->Get_ID(o) != ConstructionYardID))
@@ -496,10 +566,10 @@
void SCRIPTS_API Repair_All_Turrets_By_Team(int team,float health)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
- GameObject *o = As_VehicleGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Get_Object_Type(o) == team && (Get_Vehicle_Mode(o) == VEHICLE_TYPE_TURRET))
@@ -522,19 +592,24 @@
void SCRIPTS_API Damage_All_Objects_In_Zone(GameObject *Zone,float Damage,const char *Warhead,GameObject *Damager)
{
- if (!Commands->Get_ID(Zone) || !Zone)
+ if (!Zone)
{
return;
}
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if (IsInsideZone(Zone,o))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- Commands->Apply_Damage(o,Damage,Warhead,Damager);
+ if (IsInsideZone(Zone,o2))
+ {
+ Commands->Apply_Damage(o2,Damage,Warhead,Damager);
}
}
x = x->Next();
@@ -543,11 +618,11 @@
float SCRIPTS_API Get_Damage_Points(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- DamageableGameObj *o = (DamageableGameObj*)As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return 0;
@@ -557,11 +632,11 @@
float SCRIPTS_API Get_Death_Points(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- DamageableGameObj *o = (DamageableGameObj*)As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return 0;
@@ -571,34 +646,34 @@
void SCRIPTS_API Damage_Occupants(GameObject *obj,float Damage,const char *Warhead)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
int x = o->Get_Definition().Get_Seat_Count();
for (int i = 0;i < x;i++)
{
if (o->Get_Occupant(i))
{
- Commands->Apply_Damage((GameObject *)o->Get_Occupant(i),Damage,Warhead,0);
+ Commands->Apply_Damage(o->Get_Occupant(i),Damage,Warhead,0);
}
}
}
void SCRIPTS_API Kill_Occupants(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
int x = o->Get_Definition().Get_Seat_Count();
for (int i = 0;i < x;i++)
{
if (o->Get_Occupant(i))
{
- Commands->Apply_Damage((GameObject *)o->Get_Occupant(i),100,"Death",0);
+ Commands->Apply_Damage((GameObject *)o->Get_Occupant(i),99999,"Death",0);
}
}
}
@@ -609,14 +684,12 @@
//does to all other vehicles. It can also force friendly fire
if (DamageRadius > 0)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
GameObject *o = x->Data();
if (o)
{
- if (As_VehicleGameObj(o))
- {
float health = Commands->Get_Health(o);
if (health > 0)
{
@@ -649,7 +722,6 @@
}
}
}
- }
}
x = x->Next();
}
diff -uwr sourceold/scripts/engine_game.cpp source/scripts/engine_game.cpp
--- sourceold/scripts/engine_game.cpp 2011-10-22 19:44:00.545898400 +0800
+++ source/scripts/engine_game.cpp 2012-05-23 10:47:48.822265600 +0800
@@ -24,6 +24,7 @@
#include "VehicleFactoryGameObj.h"
#include "VehicleFactoryGameObjDef.h"
#include "HarvesterClass.h"
+#include "DefinitionMgrClass.h"
REF_DEF2(CombatManager::IAmServer, bool, 0x00855EC8, 0x008550B0);
RENEGADE_FUNCTION
void *Game_Mode_Find(const char *)
@@ -48,7 +49,7 @@
VehicleGameObj *BaseControllerClass::Get_Harvester_Vehicle()
{
BuildingGameObj* refinery = Find_Building(BuildingConstants::TYPE_REFINERY);
- return refinery ? refinery->As_RefineryGameObj()->Get_Harvester_Vehicle() : nullptr;
+ return refinery && refinery->As_RefineryGameObj() ? refinery->As_RefineryGameObj()->Get_Harvester_Vehicle() : nullptr;
}
void BaseControllerClass::Set_Can_Generate_Soldiers(bool CanGenerate)
{
@@ -201,12 +202,11 @@
bool SCRIPTS_API Is_Harvester(GameObject *obj)
{
- if (!As_VehicleGameObj(obj))
+ if (!obj)
{
return false;
}
- int ID = Commands->Get_ID(obj);
- if (Commands->Get_ID(Find_Harvester(0)) == ID || Commands->Get_ID(Find_Harvester(1)) == ID)
+ if (Find_Harvester(0) == obj || Find_Harvester(1) == obj)
{
return true;
}
@@ -225,26 +225,26 @@
int SCRIPTS_API Building_Type(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- GameObject *o = As_BuildingGameObj(obj);
+ BuildingGameObj *o = obj->As_BuildingGameObj();
if (!o)
{
return 0;
}
- BuildingGameObjDef *d = (BuildingGameObjDef *)Get_Definition(obj);
- return d->Get_Type();
+ const BuildingGameObjDef &d = o->Get_Definition();
+ return d.Get_Type();
}
bool SCRIPTS_API Is_Building_Dead(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- BuildingGameObj *o = (BuildingGameObj *)As_BuildingGameObj(obj);
+ BuildingGameObj *o = obj->As_BuildingGameObj();
if (!o)
{
return 0;
@@ -252,7 +252,7 @@
return o->Is_Destroyed();
}
-GameObject SCRIPTS_API *Find_Building(int team,int type)
+GameObject SCRIPTS_API *Find_Building_By_Type(int team,int type)
{
BaseControllerClass *c = BaseControllerClass::Find_Base(team);
if (c)
@@ -285,13 +285,17 @@
return 0;
}
GameObject *obj = (GameObject *)d->Create();
- if (As_BuildingGameObj(obj))
+
+ if (obj)
+ {
+ BuildingGameObj *c = obj->As_BuildingGameObj();
+ if (c)
{
- BuildingGameObj *c = (BuildingGameObj *)obj;
c->Set_Position(Position);
c->Collect_Building_Components();
c->Start_Observers();
- return obj;
+ return c;
+ }
}
return 0;
}
@@ -322,7 +326,7 @@
GameObject *o = 0;
if (c)
{
- o = (GameObject *)c->Get_Harvester_Vehicle();
+ o = c->Get_Harvester_Vehicle();
}
return o;
}
@@ -347,22 +351,10 @@
return false;
}
-bool SCRIPTS_API Can_Generate_Soliders(int team)
-{
- BaseControllerClass *c = BaseControllerClass::Find_Base(team);
- if (c)
+bool SCRIPTS_API Can_Generate_Soldiers(int team)
{
+ if ( BaseControllerClass *c = BaseControllerClass::Find_Base(team) )
return c->Can_Generate_Soldiers();
- }
- return false;
-}
-
-bool SCRIPTS_API Is_A_Building(GameObject *obj)
-{
- if (As_BuildingGameObj(obj))
- {
- return true;
- }
return false;
}
@@ -372,7 +364,7 @@
int Count = 0;
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o && Commands->Get_Health(o) > 0 && (Get_Object_Type(o) == Team || Team == 2))
{
Count++;
@@ -387,10 +379,10 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o->Get_Definition();
if (d->Get_Class_ID() == Class_ID)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -406,47 +398,62 @@
GameObject SCRIPTS_API *Find_Power_Plant(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_POWER_PLANT);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_POWER_PLANT);
}
GameObject SCRIPTS_API *Find_Construction_Yard(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_CONYARD);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_CONYARD);
}
GameObject SCRIPTS_API *Find_Refinery(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_REFINERY);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_REFINERY);
}
GameObject SCRIPTS_API *Find_Repair_Bay(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_REPAIR_BAY);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_REPAIR_BAY);
}
GameObject SCRIPTS_API *Find_Soldier_Factory(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_SOLDIER_FACTORY);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_SOLDIER_FACTORY);
}
-GameObject SCRIPTS_API *Find_Airstrip(int Team)
+GameObject SCRIPTS_API *Find_Vehicle_Factory(int Team)
{
- return Find_Building_By_Class_ID(Team,0xD006);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_VEHICLE_FACTORY);
}
-GameObject SCRIPTS_API *Find_War_Factory(int Team)
+GameObject SCRIPTS_API *Find_Shrine(int Team)
{
- return Find_Building_By_Class_ID(Team,0xD007);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_SHRINE);
}
-GameObject SCRIPTS_API *Find_Vehicle_Factory(int Team)
+GameObject SCRIPTS_API *Find_Helipad(int Team)
+{
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_HELIPAD);
+}
+
+GameObject SCRIPTS_API *Find_Tech_Center(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_VEHICLE_FACTORY);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_TECH_CENTER);
+}
+
+GameObject SCRIPTS_API *Find_Naval_Factory(int Team)
+{
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_NAVAL_FACTORY);
+}
+
+GameObject SCRIPTS_API *Find_Special(int Team)
+{
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_SPECIAL);
}
GameObject SCRIPTS_API *Find_Com_Center(int Team)
{
- return Find_Building(Team,BuildingConstants::TYPE_COM_CENTER);
+ return Find_Building_By_Type(Team,BuildingConstants::TYPE_COM_CENTER);
}
GameObject SCRIPTS_API *Find_Building_By_Team(int Team)
@@ -454,7 +461,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Get_Object_Type(o) == Team)
@@ -467,15 +474,15 @@
return 0;
}
-GameObject SCRIPTS_API *Find_Building_By_Name(int Team,const char *Preset_Name)
+GameObject SCRIPTS_API *Find_Building_By_Preset(int Team,const char *Preset_Name)
{
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o->Get_Definition();
if (!_stricmp(d->Get_Name(),Preset_Name))
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -502,10 +509,10 @@
BaseControllerClass* base = BaseControllerClass::Find_Base(Get_Object_Type(building));
if (base)
{
- if (Is_SoldierFactory(building))
+ if (building->As_SoldierFactoryGameObj())
base->Set_Can_Generate_Soldiers(true);
- if (Is_VehicleFactory(building))
+ if (building->As_VehicleFactoryGameObj())
base->Set_Can_Generate_Vehicles(true);
base->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE, true);
@@ -581,12 +588,16 @@
int SCRIPTS_API Get_Harvester_Preset_ID(int Team)
{
- RefineryGameObj *Ref = (RefineryGameObj*)Find_Refinery(Team);
- if (!Ref)
+ if (!Find_Refinery(Team))
{
return 0;
}
- return Ref->Get_Definition().Get_Harvester_ID();
+ BuildingGameObj *Ref = Find_Refinery(Team)->As_BuildingGameObj();
+ if (!Ref || !Ref->As_RefineryGameObj())
+ {
+ return 0;
+ }
+ return Ref->As_RefineryGameObj()->Get_Harvester_Def_ID();
}
bool SCRIPTS_API Is_Harvester_Preset(GameObject *obj)
@@ -603,3 +614,57 @@
{
return (const SimpleGameObjDef &)BaseGameObj::Get_Definition();
}
+
+bool SCRIPTS_API Vehicle_Preset_Is_Air(int preset)
+{
+ DefinitionClass *def = DefinitionMgrClass::Find_Definition(preset,true);
+ if (!def)
+ {
+ return false;
+ }
+ if (def->Get_Class_ID() == 12304)
+ {
+ VehicleGameObjDef *def2 = (VehicleGameObjDef *)def;
+ if (def2->Get_Type() == VEHICLE_TYPE_FLYING && !def2->Get_Build_At_Ground())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+bool SCRIPTS_API Vehicle_Preset_Is_Naval(int preset)
+{
+ DefinitionClass *def = DefinitionMgrClass::Find_Definition(preset,true);
+ if (!def)
+ {
+ return false;
+ }
+ if (def->Get_Class_ID() == 12304)
+ {
+ VehicleGameObjDef *def2 = (VehicleGameObjDef *)def;
+ if (def2->Get_Type() == VEHICLE_TYPE_BOAT || def2->Get_Type() == VEHICLE_TYPE_SUB)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+Vector3 SCRIPTS_API Get_Base_Center(int Team)
+{
+ Vector3 ReturnPos(0.0f,0.0f,0.0f);
+ BaseControllerClass *Base = BaseControllerClass::Find_Base(Team);
+ if (Base)
+ {
+ int Num = 0;
+ for (Num = 0;Num < Base->Get_Building_List().Count();Num++)
+ {
+ ReturnPos += Commands->Get_Position(Base->Get_Building_List()[Num]);
+ }
+ if (Num)
+ {
+ ReturnPos /= (float)Num;
+ }
+ }
+ return ReturnPos;
+}
diff -uwr sourceold/scripts/engine_game.h source/scripts/engine_game.h
--- sourceold/scripts/engine_game.h 2011-10-11 21:54:02.241210900 +0800
+++ source/scripts/engine_game.h 2012-05-23 10:47:49.340820300 +0800
@@ -13,48 +13,488 @@
#define SCRIPTS_INCLUDE__ENGINE_GAME_H
#include "GameData.h"
-void SCRIPTS_API Power_Base(int team,bool powered); //Power a base up or down, correctly handles the doubled build time and costs
-void SCRIPTS_API Set_Can_Generate_Soldiers(int team,bool cangenerate); //Sets if soliders are purchasable
-void SCRIPTS_API Set_Can_Generate_Vehicles(int team,bool cangenerate); //Sets if vehicles are purchaseable
-void SCRIPTS_API Destroy_Base(int team); //Destroys a base completly
-void SCRIPTS_API Beacon_Destroyed_Base(int team, bool destroyed); //Sets if a base was destroyed by a beacon in the beacon zone
-void SCRIPTS_API Enable_Base_Radar(int team, bool enable); //Enables radar for a base, same thing as the communications center does
-bool SCRIPTS_API Is_Harvester(GameObject *obj); //Is this object one of the 2 team AI harvesters?
-bool SCRIPTS_API Is_Radar_Enabled(int team); //returns if the radar is enabled
-int SCRIPTS_API Building_Type(GameObject *obj); //returns the type of a BuildingGameObj
-bool SCRIPTS_API Is_Building_Dead(GameObject *obj); //Does the game consider the building dead
-GameObject SCRIPTS_API *Find_Building(int team,int type); //Find a building by team and type
-GameObject SCRIPTS_API *Find_Base_Defense(int team); //Find base defense for a team
-bool SCRIPTS_API Is_Map_Flying(); //Is the current map a flying map
+/*!
+* Enable or disable base power for a team, this correctly handles all the relavent stuff including base defences and purchase time/cost changes.
+*
+* \param[in] team
+* ID of the team to set power state for
+*
+* \param[in] powered
+* whether to enable or disable power
+*
+*/
+void SCRIPTS_API Power_Base(int team,bool powered);
+
+/*!
+* Enable or disable advanced infantry purchasability for a team
+*
+* \param[in] team
+* ID of the team to set advanced infantry purchasability for
+*
+* \param[in] cangenerate
+* whether to enable or disable generation
+*
+*/
+void SCRIPTS_API Set_Can_Generate_Soldiers(int team,bool cangenerate);
+
+/*!
+* Enable or disable vehicle purchasability for a team
+*
+* \param[in] team
+* ID of the team to set vehicle purchasability for
+*
+* \param[in] cangenerate
+* whether to enable or disable generation
+*
+*/
+void SCRIPTS_API Set_Can_Generate_Vehicles(int team,bool cangenerate);
+
+/*!
+* Destroy the base of a team
+*
+* \param[in] team
+* ID of the team to destroy the base of
+*
+*/
+void SCRIPTS_API Destroy_Base(int team);
+
+/*!
+* Set or clear the "beacon destroyed base" flag for a team
+*
+* \param[in] team
+* ID of the team to change the "beacon destroyed base" flag on
+*
+* \param[in] destroyed
+* whether to enable or disable the "beacon destroyed base" flag
+*
+*/
+void SCRIPTS_API Beacon_Destroyed_Base(int team, bool destroyed);
+
+/*!
+* Enable or disable radar for a team
+*
+* \param[in] team
+* ID of the team to set radar for
+*
+* \param[in] enable
+* whether to enable or disable radar
+*
+*/
+void SCRIPTS_API Enable_Base_Radar(int team, bool enable);
+
+/*!
+* Check if an object is an AI harvester
+*
+* \param[in] obj
+* object to check
+*
+* \return
+* True if the object is an AI harvester, false otherwise
+*/
+bool SCRIPTS_API Is_Harvester(GameObject *obj);
+
+/*!
+* Check if a teams base radar is enabled
+*
+* \param[in] team
+* ID of the team to check the radar of
+*
+* \return
+* True if the specified teams radar is enabled, false otherwise
+*/
+bool SCRIPTS_API Is_Radar_Enabled(int team);
+
+/*!
+* Get the building type for a building
+*
+* \param[in] obj
+* object to get type of
+*
+* \return
+* building type of the building
+*/
+int SCRIPTS_API Building_Type(GameObject *obj);
+
+/*!
+* Check if a building is dead
+*
+* \param[in] obj
+* object to check
+*
+* \return
+* True if the building is dead, false otherwise
+*/
+bool SCRIPTS_API Is_Building_Dead(GameObject *obj);
+
+/*!
+* Find the first building of a given building type for this team
+*
+* \param[in] team
+* ID of the team to find the building for
+*
+* \param[in] type
+* type to find
+*
+* \return
+* First building for this team of this type (if any)
+*/
+GameObject SCRIPTS_API *Find_Building_By_Type(int team,int type);
+
+/*!
+* Find the first base defense building for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the base defense building for
+*
+* \return
+* First base defense building for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Base_Defense(int team);
+
+/*!
+* Check if the current map is a flying map
+*
+* \return
+* True if the map is a flying time map
+*/
+bool SCRIPTS_API Is_Map_Flying();
+
GameObject SCRIPTS_API *Create_Building(const char *preset,const Vector3 & Position); //Create a building controller
-GameObject SCRIPTS_API *Find_Harvester(int team); //Find this teams current harvester, if any
-bool SCRIPTS_API Is_Base_Powered(int team); //Is this teams base powered
-bool SCRIPTS_API Can_Generate_Vehicles(int team); //Can this team buy vehicles
-bool SCRIPTS_API Can_Generate_Soliders(int team); //Can this team buy soldiers
-cGameData SCRIPTS_API *The_Game(); //get the cGameData
-cGameDataSkirmish SCRIPTS_API *The_Skirmish_Game(); //get the cGameDataSkirmish
-cGameDataCnc SCRIPTS_API *The_Cnc_Game(); //get the cGameDataCnc
-cGameDataSinglePlayer SCRIPTS_API *The_Single_Player_Game(); //get the cGameDataSinglePlayer
-bool SCRIPTS_API Is_A_Building(GameObject *obj); //is this object any building type
-int SCRIPTS_API Get_Building_Count_Team(int Team); //number of buildings a team has that are alive
-GameObject SCRIPTS_API *Find_Building_By_Team(int Team); //finds the first building of this team,0 = Nod,1 = GDI
-GameObject SCRIPTS_API *Find_Building_By_Name(int Team,const char *Preset_Name); //finds the first building of team where preset name matches name,0 = Nod,1 = GDI
-GameObject SCRIPTS_API *Find_Power_Plant(int Team); //finds the first powerplant for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Construction_Yard(int Team); //finds the first construction yard for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Refinery(int Team); //finds the first refinery for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Repair_Bay(int Team); //finds the first repair bay for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Soldier_Factory(int Team); //finds the first soldier factory for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Airstrip(int Team); //finds the first airstrip for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_War_Factory(int Team); //finds the first war factory for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Vehicle_Factory(int Team); //finds the first airstrip for Team,if none is found,finds the first war factory for Team,0 = Nod,1 = GDI,2 = either
-GameObject SCRIPTS_API *Find_Com_Center(int Team); //finds the first communications center for Team,0 = Nod,1 = GDI,2 = either
+
+/*!
+* Find the AI harvester for a team (if any)
+*
+* \param[in] team
+* ID of the team to find the harvester for
+*
+* \return
+* AI harvester object
+*/
+GameObject SCRIPTS_API *Find_Harvester(int team);
+
+/*!
+* Check if a teams base is powered
+*
+* \param[in] team
+* ID of the team to check the base power of
+*
+* \return
+* True if the specified teams base is powered, false otherwise
+*/
+bool SCRIPTS_API Is_Base_Powered(int team);
+
+/*!
+* Check if a team can currently purchase vehicles
+*
+* \param[in] team
+* ID of the team to check vehicle purchasability for
+*
+* \return
+* True if the specified team can purchase vehicles, false otherwise
+*/
+bool SCRIPTS_API Can_Generate_Vehicles(int team);
+
+/*!
+* Check if a team can currently purchase advanced infantry characters
+*
+* \param[in] team
+* ID of the team to check advanced infantry purchasability for
+*
+* \return
+* True if the specified team can purchase advanced infantry characters, false otherwise
+*/
+bool SCRIPTS_API Can_Generate_Soldiers(int team);
+
+/*!
+* Get the current cGameData
+*
+* \return
+* current cGameData
+*/
+cGameData SCRIPTS_API *The_Game();
+
+/*!
+* Get the current cGameDataSkirmish, if any
+*
+* \return
+* current cGameDataSirmish, if any
+*/
+cGameDataSkirmish SCRIPTS_API *The_Skirmish_Game();
+
+/*!
+* Get the current cGameDataCnc, if any
+*
+* \return
+* current cGameDataCnc, if any
+*/
+cGameDataCnc SCRIPTS_API *The_Cnc_Game();
+
+/*!
+* Get the current cGameDataSinglePlayer, if any
+*
+* \return
+* current cGameDataSinglePlayer, if any
+*/
+cGameDataSinglePlayer SCRIPTS_API *The_Single_Player_Game();
+
+/*!
+* Get the count of how many buildings a given team has
+*
+* \param[in] Team
+* ID of the team to count the buildings of
+*
+* \return
+* count of the buildings for that team
+*/
+int SCRIPTS_API Get_Building_Count_Team(int Team);
+
+/*!
+* Find the first building for this team
+*
+* \param[in] Team
+* ID of the team to find the building for
+*
+* \return
+* First building for this team
+*/
+GameObject SCRIPTS_API *Find_Building_By_Team(int Team);
+
+/*!
+* Find the first building of a given preset type for this team
+*
+* \param[in] Team
+* ID of the team to find the building for
+*
+* \param[in] Preset_Name
+* preset name to find
+*
+* \return
+* First building for this team of this preset (if any)
+*/
+GameObject SCRIPTS_API *Find_Building_By_Preset(int Team,const char *Preset_Name);
+
+/*!
+* Find the first power plant for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the power plant for
+*
+* \return
+* First power plant for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Power_Plant(int Team);
+
+/*!
+* Find the first construction yard for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the construction yard for
+*
+* \return
+* First construction yard for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Construction_Yard(int Team);
+
+/*!
+* Find the first refinery for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the refinery for
+*
+* \return
+* First refinery for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Refinery(int Team);
+
+/*!
+* Find the first repair bay for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the repair bay for
+*
+* \return
+* First repair bay for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Repair_Bay(int Team);
+
+/*!
+* Find the first soldier factory for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the soldier factory for
+*
+* \return
+* First soldier factory for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Soldier_Factory(int Team);
+
+/*!
+* Find the first vehicle factory for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the vehicle factory for
+*
+* \return
+* First vehicle factory for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Vehicle_Factory(int Team);
+
+/*!
+* Find the first com center for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the com center for
+*
+* \return
+* First com center for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Com_Center(int Team);
+
+/*!
+* Find the first special building for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the special building for
+*
+* \return
+* First special building for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Special(int Team);
+
+/*!
+* Find the first naval factory for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the naval factory for
+*
+* \return
+* First naval factory for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Naval_Factory(int Team);
+
+/*!
+* Find the first tech center for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the tech center for
+*
+* \return
+* First tech center for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Tech_Center(int Team);
+
+/*!
+* Find the first helipad for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the helipad for
+*
+* \return
+* First helipad for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Helipad(int Team);
+
+/*!
+* Find the first shrine for this team (if any)
+*
+* \param[in] Team
+* ID of the team to find the shrine for
+*
+* \return
+* First shrine for this team (if any)
+*/
+GameObject SCRIPTS_API *Find_Shrine(int Team);
+
void SCRIPTS_API Restore_Building(GameObject* obj); //restores a building to life
-bool SCRIPTS_API Is_Gameplay_Permitted(); //is gameplay permitted
-bool SCRIPTS_API Is_Dedicated(); //returns false if game.exe, true if WFDS/LFDS
-unsigned int SCRIPTS_API Get_Current_Game_Mode(); //Get the current game mode, 0 = function error, 1 = single player, 2 = skirmish, 3 = WOL, 4 = GameSpy, 5 = LAN. May not always differentiate correctly between WOL, Gamespy and LAN, especially when running as a non-dedicated server.
+
+/*!
+* Check if gameplay is permitted
+*
+* \return
+* True if gameplay is permitted
+*/
+bool SCRIPTS_API Is_Gameplay_Permitted();
+
+/*!
+* Check if running on the FDS
+*
+* \return
+* True if running on the FDS
+*/
+bool SCRIPTS_API Is_Dedicated();
+
+/*!
+* Get current game mode, 0 = error, 1 = single player, 2 = skirmish, 3 = WOL, 4 = GameSpy, 5 = LAN.
+* May not always differentiate correctly between WOL, Gamespy and LAN, especially when running as a non-dedicated server.
+*
+* \return
+* Current game mode
+*/
+unsigned int SCRIPTS_API Get_Current_Game_Mode();
+
void SCRIPTS_API Get_Private_Message_Color(unsigned int *red, unsigned int *green, unsigned int *blue); //get color for private messages
void SCRIPTS_API Get_Public_Message_Color(unsigned int *red, unsigned int *green, unsigned int *blue); //get color for public messages
-int SCRIPTS_API Get_Harvester_Preset_ID(int Team); //Get the harvester preset ID for this team
-bool SCRIPTS_API Is_Harvester_Preset(GameObject *obj); //Checks if the object has the same preset used for the harvesters
-bool SHADERS_API Is_Night_Map(); //is the current map a nighttime map
+
+/*!
+* Get the AI harvester preset ID of a specific team
+*
+* \param[in] team
+* ID of the team to get the harvester preset ID of
+*
+* \return
+* ID of the AI harvester preset for this team
+*/
+int SCRIPTS_API Get_Harvester_Preset_ID(int Team);
+
+/*!
+* Check if a preset matches the AI harvester preset set in the refinery
+*
+* \param[in] preset
+* ID of the preset to check
+*
+* \return
+* True if the preset matches the AI harvester preset set in the refinery
+*/
+bool SCRIPTS_API Is_Harvester_Preset(GameObject *obj);
+
+/*!
+* Check if the current map is a night time map
+*
+* \return
+* True if the map is a night time map
+*/
+bool SHADERS_API Is_Night_Map();
+
+/*!
+* Check if a preset is an air unit
+*
+* \param[in] preset
+* ID of the preset to check
+*
+* \return
+* True if the preset is an air unit (i.e. will be built at the air factory when its built)
+*/
+bool SCRIPTS_API Vehicle_Preset_Is_Air(int preset);
+
+/*!
+* Check if a preset is a naval unit
+*
+* \param[in] preset
+* ID of the preset to check
+*
+* \return
+* True if the preset is a naval unit (i.e. will be built at the naval factory when its built)
+*/
+bool SCRIPTS_API Vehicle_Preset_Is_Naval(int preset);
+
+/*!
+* Find the center point of a base
+*
+* \param[in] team
+* ID of the team to use
+*
+* \return
+* Center of that teams base
+*/
+Vector3 SCRIPTS_API Get_Base_Center(int Team);
#endif
diff -uwr sourceold/scripts/engine_obj.cpp source/scripts/engine_obj.cpp
--- sourceold/scripts/engine_obj.cpp 2012-02-17 21:03:32.721679600 +0800
+++ source/scripts/engine_obj.cpp 2012-05-23 11:24:04.913085900 +0800
@@ -29,6 +29,8 @@
#include "TransitionGameObjDef.h"
#include "AirFactoryGameObjDef.h"
#include "AirFactoryGameObj.h"
+#include "NavalFactoryGameObjDef.h"
+#include "NavalFactoryGameObj.h"
#include "AirStripGameObjDef.h"
#include "AirStripGameObj.h"
#include "BeaconGameObjDef.h"
@@ -58,844 +60,269 @@
#include "WarFactoryGameObjDef.h"
#include "WarFactoryGameObj.h"
-const AirFactoryGameObjDef &
+SCRIPTS_API const AirFactoryGameObjDef &
AirFactoryGameObj::Get_Definition (void) const
{
return (const AirFactoryGameObjDef &)BaseGameObj::Get_Definition ();
}
-const AirStripGameObjDef & AirStripGameObj::Get_Definition( void ) const
+SCRIPTS_API const NavalFactoryGameObjDef &
+NavalFactoryGameObj::Get_Definition (void) const
+{
+ return (const NavalFactoryGameObjDef &)BaseGameObj::Get_Definition ();
+}
+SCRIPTS_API const AirStripGameObjDef & AirStripGameObj::Get_Definition( void ) const
{
return (const AirStripGameObjDef &)BaseGameObj::Get_Definition();
}
-const ArmedGameObjDef & ArmedGameObj::Get_Definition( void ) const
+SCRIPTS_API const ArmedGameObjDef & ArmedGameObj::Get_Definition( void ) const
{
return (const ArmedGameObjDef &)BaseGameObj::Get_Definition();
}
-const BeaconGameObjDef & BeaconGameObj::Get_Definition( void ) const
+SCRIPTS_API const BeaconGameObjDef & BeaconGameObj::Get_Definition( void ) const
{
return (const BeaconGameObjDef &)BaseGameObj::Get_Definition();
}
-const C4GameObjDef & C4GameObj::Get_Definition( void ) const
+SCRIPTS_API const C4GameObjDef & C4GameObj::Get_Definition( void ) const
{
return (const C4GameObjDef &)BaseGameObj::Get_Definition();
}
-const CinematicGameObjDef & CinematicGameObj::Get_Definition( void ) const
+SCRIPTS_API const CinematicGameObjDef & CinematicGameObj::Get_Definition( void ) const
{
return (const CinematicGameObjDef &)BaseGameObj::Get_Definition();
}
-const ComCenterGameObjDef &
+SCRIPTS_API const ComCenterGameObjDef &
ComCenterGameObj::Get_Definition (void) const
{
return (const ComCenterGameObjDef &)BaseGameObj::Get_Definition ();
}
-const ConstructionYardGameObjDef &
+SCRIPTS_API const ConstructionYardGameObjDef &
ConstructionYardGameObj::Get_Definition (void) const
{
return (const ConstructionYardGameObjDef &)BaseGameObj::Get_Definition ();
}
-const DamageZoneGameObjDef & DamageZoneGameObj::Get_Definition( void ) const
+SCRIPTS_API const DamageZoneGameObjDef & DamageZoneGameObj::Get_Definition( void ) const
{
return (const DamageZoneGameObjDef &)BaseGameObj::Get_Definition();
}
-const PowerPlantGameObjDef &
+SCRIPTS_API const PowerPlantGameObjDef &
PowerPlantGameObj::Get_Definition (void) const
{
return (const PowerPlantGameObjDef &)BaseGameObj::Get_Definition ();
}
-const RepairBayGameObjDef &
+SCRIPTS_API const RepairBayGameObjDef &
RepairBayGameObj::Get_Definition (void) const
{
return (const RepairBayGameObjDef &)BaseGameObj::Get_Definition ();
}
-const SamSiteGameObjDef & SamSiteGameObj::Get_Definition( void ) const
+SCRIPTS_API const SamSiteGameObjDef & SamSiteGameObj::Get_Definition( void ) const
{
return (const SamSiteGameObjDef &)BaseGameObj::Get_Definition();
}
-const SoldierGameObjDef & SoldierGameObj::Get_Definition( void ) const
+SCRIPTS_API const SoldierGameObjDef & SoldierGameObj::Get_Definition( void ) const
{
return (const SoldierGameObjDef &)BaseGameObj::Get_Definition();
}
-const SoldierFactoryGameObjDef &
+SCRIPTS_API const SoldierFactoryGameObjDef &
SoldierFactoryGameObj::Get_Definition (void) const
{
return (const SoldierFactoryGameObjDef &)BaseGameObj::Get_Definition ();
}
-const SpecialEffectsGameObjDef & SpecialEffectsGameObj::Get_Definition( void ) const
-{
- return (const SpecialEffectsGameObjDef &)BaseGameObj::Get_Definition();
-}
-const TransitionGameObjDef & TransitionGameObj::Get_Definition( void ) const
-{
- return (const TransitionGameObjDef &)BaseGameObj::Get_Definition();
-}
-const WarFactoryGameObjDef &
-WarFactoryGameObj::Get_Definition (void) const
-{
- return (const WarFactoryGameObjDef &)BaseGameObj::Get_Definition ();
-}
-
-const VehicleFactoryGameObjDef &
-VehicleFactoryGameObj::Get_Definition (void) const
-{
- return (const VehicleFactoryGameObjDef &)BaseGameObj::Get_Definition ();
-}
-
-const ScriptZoneGameObjDef & ScriptZoneGameObj::Get_Definition( void ) const
-{
- return (const ScriptZoneGameObjDef &)BaseGameObj::Get_Definition();
-}
-
-unsigned char NetworkObjectClass::Get_Object_Dirty_Bits(int clientId)
-{
- return ClientStatus[clientId];
-}
-
-bool NetworkObjectClass::Get_Object_Dirty_Bit(int clientId, DIRTY_BIT level)
-{
- return (ClientStatus[clientId] & level) == level;
-}
-
-void DefenseObjectClass::Set_Health_Max(float health)
-{
- HealthMax = WWMath::Clamp(health, 0, MAX_MAX_HEALTH);
- if (HealthMax < Health)
- {
- Health = HealthMax;
- }
- Mark_Owner_Dirty();
-}
-
-void DefenseObjectClass::Set_Shield_Type( ArmorType type )
-{
- ShieldType = type;
- Mark_Owner_Dirty();
-}
-
-float DefenseObjectClass::Get_Health() const
-{
- return this->Health;
-}
-
-
-
-float DefenseObjectClass::Get_Health_Max() const
-{
- return this->HealthMax;
-}
-
-
-float DefenseObjectClass::Get_Shield_Strength() const
-{
- return this->ShieldStrength;
-}
-
-
-
-float DefenseObjectClass::Get_Shield_Strength_Max() const
-{
- return this->ShieldStrengthMax;
-}
-
-void DefenseObjectClass::Set_Shield_Strength_Max(float str)
-{
- ShieldStrengthMax = WWMath::Clamp(str, 0, MAX_MAX_SHIELD_STRENGTH);
- if (ShieldStrengthMax < ShieldStrength)
- {
- ShieldStrength = ShieldStrengthMax;
- }
- Mark_Owner_Dirty();
-}
-
-
-
-void DefenseObjectClass::Mark_Owner_Dirty()
-{
- if (Get_Owner())
- {
- Get_Owner()->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_OCCASIONAL, true);
- }
-}
-
-SCRIPTS_API REF_DEF3(GameObjManager::BuildingGameObjList, SList, 0x00856FE8, 0x008561D0, 0x0085BED0);
-SCRIPTS_API REF_DEF3(GameObjManager::GameObjList, SList, 0x00856FF8, 0x008561E0, 0x0085BEE0);
-SCRIPTS_API REF_DEF3(GameObjManager::StarGameObjList, SList, 0x00856FC8, 0x008561B0, 0x0085BEB0);
-SCRIPTS_API REF_DEF3(GameObjManager::SmartGameObjList, SList, 0x00856FD8, 0x008561C0, 0x0085BEC0);
-
-#ifdef SHADERS_EXPORTS
-SHADERS_API SList GameObjManager::C4GameObjList;
-SHADERS_API SList GameObjManager::BeaconGameObjList;
-SHADERS_API SList GameObjManager::SoldierGameObjList;
-SHADERS_API SList GameObjManager::VehicleGameObjList;
-#endif
-
-const BaseGameObjDef & BaseGameObj::Get_Definition( void ) const
-{
- return *Definition;
-};
-
-const DamageableGameObjDef & DamageableGameObj::Get_Definition( void ) const
-{
- return (const DamageableGameObjDef &)BaseGameObj::Get_Definition();
-}
-
-void ScriptableGameObj::Insert_Observer( GameObjObserverClass * observer )
-{
- observer->Attach( this );
- Observers.Add( observer );
-}
-
-void ScriptableGameObj::Remove_Observer( GameObjObserverClass * observer )
-{
- Observers.Delete( observer );
- observer->Detach( this );
-}
-
-const ScriptableGameObjDef & ScriptableGameObj::Get_Definition( void ) const
-{
- return (const ScriptableGameObjDef &)BaseGameObj::Get_Definition();
-}
-
-const BuildingGameObjDef & BuildingGameObj::Get_Definition( void ) const
-{
- return (const BuildingGameObjDef &)BaseGameObj::Get_Definition();
-}
-
-const RefineryGameObjDef & RefineryGameObj::Get_Definition( void ) const
-{
- return (const RefineryGameObjDef &)BaseGameObj::Get_Definition();
-}
-
-#ifndef TTLE_EXPORTS
-#ifndef TT_EXPORTS
-RENEGADE_FUNCTION
-bool PowerUpGameObjDef::Grant(SmartGameObj *, PowerUpGameObj *, bool) const
-AT2(0x006F09F0,0x006EFFB0);
-#endif
-
-RENEGADE_FUNCTION
-Vector3 SCRIPTS_API Get_Color_For_Team(int teamId)
-AT2(0x006D99E0,0x006D9280);
-Vector3 DamageableGameObj::Get_Team_Color(void)
-{
- return Get_Color_For_Team(PlayerType);
-}
-
-int SCRIPTS_API Get_Object_Type(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- DamageableGameObj *o2 = o->As_DamageableGameObj();
- if (!o2)
- {
- return 0;
- }
- return o2->Get_Player_Type();
-}
-
-void SCRIPTS_API Set_Object_Type(GameObject *obj,int type)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return;
- }
- DamageableGameObj *o2 = o->As_DamageableGameObj();
- if (!o2)
- {
- return;
- }
- o2->Set_Player_Type(type);
-}
-
-GameObject SCRIPTS_API *As_PowerUpGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_PowerUpGameObj();
-}
-
-GameObject SCRIPTS_API *As_C4GameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_C4GameObj();
-}
-
-GameObject SCRIPTS_API *As_BeaconGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_BeaconGameObj();
-}
-
-GameObject SCRIPTS_API *As_ArmedGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_ArmedGameObj();
-}
-
-GameObject SCRIPTS_API *As_SimpleGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_SimpleGameObj();
-}
-
-GameObject SCRIPTS_API *As_PowerPlantGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_PowerPlantGameObj();
-}
-
-GameObject SCRIPTS_API *As_ConstructionYardGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_ConstructionYardGameObj();
-}
-
-GameObject SCRIPTS_API *As_SoldierFactoryGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_SoldierFactoryGameObj();
-}
-
-GameObject SCRIPTS_API *As_VehicleFactoryGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_VehicleFactoryGameObj();
-}
-
-GameObject SCRIPTS_API *As_AirstripGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_AirStripGameObj();
-}
-
-GameObject SCRIPTS_API *As_WarFactoryGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_WarFactoryGameObj();
-}
-
-GameObject SCRIPTS_API *As_RefineryGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_RefineryGameObj();
-}
-
-GameObject SCRIPTS_API *As_ComCenterGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_ComCenterGameObj();
-}
-
-GameObject SCRIPTS_API *As_RepairBayGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj *o = ((BaseGameObj*)obj)->As_ScriptableGameObj();
- if(!o)
- {
- return 0;
- }
- BuildingGameObj *o2 = o->As_BuildingGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_RepairBayGameObj();
-}
-
-GameObject SCRIPTS_API *As_ScriptableGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- return (GameObject *)((BaseGameObj *)obj)->As_ScriptableGameObj();
-}
-
-GameObject SCRIPTS_API *As_PhysicalGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- return (GameObject *)((BaseGameObj *)obj)->As_PhysicalGameObj();
-}
-
-GameObject SCRIPTS_API *As_CinematicGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- PhysicalGameObj *o2 = ((BaseGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_CinematicGameObj();
-}
-
-GameObject SCRIPTS_API *As_VehicleGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- return (GameObject *)((BaseGameObj *)obj)->As_VehicleGameObj();
-}
-
-GameObject SCRIPTS_API *As_SmartGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- return (GameObject *)((BaseGameObj *)obj)->As_SmartGameObj();
-}
-
-GameObject SCRIPTS_API *As_DamageableGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj* o2 = ((BaseGameObj *)obj)->As_ScriptableGameObj();
- if(!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_DamageableGameObj();
-}
-
-GameObject SCRIPTS_API *As_SoldierGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj* o2 = ((BaseGameObj *)obj)->As_ScriptableGameObj();
- if(!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_SoldierGameObj();
-}
-
-GameObject SCRIPTS_API *As_ScriptZoneGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj* o2 = ((BaseGameObj *)obj)->As_ScriptableGameObj();
- if(!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_ScriptZoneGameObj();
-}
-
-GameObject SCRIPTS_API *As_BuildingGameObj(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return 0;
- }
- ScriptableGameObj* o2 = ((BaseGameObj *)obj)->As_ScriptableGameObj();
- if(!o2)
- {
- return 0;
- }
- return (GameObject *)o2->As_BuildingGameObj();
-}
-
-bool SCRIPTS_API Is_Building(GameObject *obj)
-{
- if (As_BuildingGameObj(obj))
- {
- return true;
- }
- return false;
-}
-
-bool SCRIPTS_API Is_Soldier(GameObject *obj)
-{
- if (As_SoldierGameObj(obj))
- {
- return true;
- }
- return false;
-}
-
-bool SCRIPTS_API Is_Vehicle(GameObject *obj)
-{
- if (As_VehicleGameObj(obj))
- {
- return true;
- }
- return false;
-}
-
-bool SCRIPTS_API Is_Cinematic(GameObject *obj)
-{
- if (As_CinematicGameObj(obj))
- {
- return true;
- }
- return false;
-}
-
-bool SCRIPTS_API Is_ScriptZone(GameObject *obj)
+SCRIPTS_API const SpecialEffectsGameObjDef & SpecialEffectsGameObj::Get_Definition( void ) const
{
- if (As_ScriptZoneGameObj(obj))
+ return (const SpecialEffectsGameObjDef &)BaseGameObj::Get_Definition();
+}
+SCRIPTS_API const TransitionGameObjDef & TransitionGameObj::Get_Definition( void ) const
{
- return true;
+ return (const TransitionGameObjDef &)BaseGameObj::Get_Definition();
}
- return false;
+SCRIPTS_API const WarFactoryGameObjDef &
+WarFactoryGameObj::Get_Definition (void) const
+{
+ return (const WarFactoryGameObjDef &)BaseGameObj::Get_Definition ();
}
-bool SCRIPTS_API Is_Powerup(GameObject *obj)
-{
- if (As_PowerUpGameObj(obj))
+SCRIPTS_API const VehicleFactoryGameObjDef &
+VehicleFactoryGameObj::Get_Definition (void) const
{
- return true;
- }
- return false;
+ return (const VehicleFactoryGameObjDef &)BaseGameObj::Get_Definition ();
}
-bool SCRIPTS_API Is_C4(GameObject *obj)
+SCRIPTS_API const ScriptZoneGameObjDef & ScriptZoneGameObj::Get_Definition( void ) const
{
- if (As_C4GameObj(obj))
- {
- return true;
- }
- return false;
+ return (const ScriptZoneGameObjDef &)BaseGameObj::Get_Definition();
}
-bool SCRIPTS_API Is_Scriptable(GameObject *obj)
-{
- if (As_ScriptableGameObj(obj))
+unsigned char NetworkObjectClass::Get_Object_Dirty_Bits(int clientId)
{
- return true;
- }
- return false;
+ return ClientStatus[clientId];
}
-bool SCRIPTS_API Is_Beacon(GameObject *obj)
-{
- if (As_BeaconGameObj(obj))
+bool NetworkObjectClass::Get_Object_Dirty_Bit(int clientId, DIRTY_BIT level)
{
- return true;
- }
- return false;
+ return (ClientStatus[clientId] & level) == level;
}
-bool SCRIPTS_API Is_Armed(GameObject *obj)
+void DefenseObjectClass::Set_Health_Max(float health)
{
- if (As_ArmedGameObj(obj))
+ HealthMax = WWMath::Clamp(health, 0, MAX_MAX_HEALTH);
+ if (HealthMax < Health)
{
- return true;
+ Health = HealthMax;
}
- return false;
+ Mark_Owner_Dirty();
}
-bool SCRIPTS_API Is_Simple(GameObject *obj)
-{
- if (As_SimpleGameObj(obj))
+void DefenseObjectClass::Set_Shield_Type( ArmorType type )
{
- return true;
- }
- return false;
+ ShieldType = type;
+ Mark_Owner_Dirty();
}
-bool SCRIPTS_API Is_PowerPlant(GameObject *obj)
-{
- if (As_PowerPlantGameObj(obj))
+float DefenseObjectClass::Get_Health() const
{
- return true;
- }
- return false;
+ return this->Health;
}
-bool SCRIPTS_API Is_ConstructionYard(GameObject *obj)
-{
- if (As_ConstructionYardGameObj(obj))
+
+
+float DefenseObjectClass::Get_Health_Max() const
{
- return true;
- }
- return false;
+ return this->HealthMax;
}
-bool SCRIPTS_API Is_SoldierFactory(GameObject *obj)
-{
- if (As_SoldierFactoryGameObj(obj))
+
+float DefenseObjectClass::Get_Shield_Strength() const
{
- return true;
- }
- return false;
+ return this->ShieldStrength;
}
-bool SCRIPTS_API Is_VehicleFactory(GameObject *obj)
-{
- if (As_VehicleFactoryGameObj(obj))
+
+
+float DefenseObjectClass::Get_Shield_Strength_Max() const
{
- return true;
- }
- return false;
+ return this->ShieldStrengthMax;
}
-bool SCRIPTS_API Is_Airstrip(GameObject *obj)
+void DefenseObjectClass::Set_Shield_Strength_Max(float str)
{
- if (As_AirstripGameObj(obj))
+ ShieldStrengthMax = WWMath::Clamp(str, 0, MAX_MAX_SHIELD_STRENGTH);
+ if (ShieldStrengthMax < ShieldStrength)
{
- return true;
+ ShieldStrength = ShieldStrengthMax;
}
- return false;
+ Mark_Owner_Dirty();
}
-bool SCRIPTS_API Is_WarFactory(GameObject *obj)
+
+
+void DefenseObjectClass::Mark_Owner_Dirty()
{
- if (As_WarFactoryGameObj(obj))
+ if (Get_Owner())
{
- return true;
+ Get_Owner()->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_OCCASIONAL, true);
}
- return false;
}
-bool SCRIPTS_API Is_Refinery(GameObject *obj)
+SCRIPTS_API REF_DEF3(GameObjManager::BuildingGameObjList, SList, 0x00856FE8, 0x008561D0, 0x0085BED0);
+SCRIPTS_API REF_DEF3(GameObjManager::GameObjList, SList, 0x00856FF8, 0x008561E0, 0x0085BEE0);
+SCRIPTS_API REF_DEF3(GameObjManager::StarGameObjList, SList, 0x00856FC8, 0x008561B0, 0x0085BEB0);
+SCRIPTS_API REF_DEF3(GameObjManager::SmartGameObjList, SList, 0x00856FD8, 0x008561C0, 0x0085BEC0);
+
+#ifdef SHADERS_EXPORTS
+SHADERS_API SList GameObjManager::C4GameObjList;
+SHADERS_API SList GameObjManager::BeaconGameObjList;
+SHADERS_API SList GameObjManager::SoldierGameObjList;
+SHADERS_API SList GameObjManager::VehicleGameObjList;
+SHADERS_API SList GameObjManager::ScriptZoneGameObjList;
+#endif
+
+SCRIPTS_API const BaseGameObjDef & BaseGameObj::Get_Definition( void ) const
{
- if (As_RefineryGameObj(obj))
+ return *Definition;
+};
+
+SCRIPTS_API const DamageableGameObjDef & DamageableGameObj::Get_Definition( void ) const
{
- return true;
- }
- return false;
+ return (const DamageableGameObjDef &)BaseGameObj::Get_Definition();
}
-bool SCRIPTS_API Is_ComCenter(GameObject *obj)
-{
- if (As_ComCenterGameObj(obj))
+SCRIPTS_API void ScriptableGameObj::Insert_Observer( GameObjObserverClass * observer )
{
- return true;
- }
- return false;
+ observer->Attach( this );
+ Observers.Add( observer );
}
-bool SCRIPTS_API Is_RepairBay(GameObject *obj)
-{
- if (As_RepairBayGameObj(obj))
+SCRIPTS_API void ScriptableGameObj::Remove_Observer( GameObjObserverClass * observer )
{
- return true;
- }
- return false;
+ Observers.Delete( observer );
+ observer->Detach( this );
}
-const char SCRIPTS_API *Get_Building_Type(GameObject *obj)
+SCRIPTS_API const ScriptableGameObjDef & ScriptableGameObj::Get_Definition( void ) const
{
- if (Is_PowerPlant(obj))
+ return (const ScriptableGameObjDef &)BaseGameObj::Get_Definition();
+}
+
+SCRIPTS_API const BuildingGameObjDef & BuildingGameObj::Get_Definition( void ) const
{
- return "Is_PowerPlant";
+ return (const BuildingGameObjDef &)BaseGameObj::Get_Definition();
}
- else if (Is_ConstructionYard(obj))
+
+SCRIPTS_API const RefineryGameObjDef & RefineryGameObj::Get_Definition( void ) const
{
- return "Is_ConstructionYard";
+ return (const RefineryGameObjDef &)BaseGameObj::Get_Definition();
}
- else if (Is_SoldierFactory(obj))
+
+#ifndef TTLE_EXPORTS
+#ifndef TT_EXPORTS
+RENEGADE_FUNCTION
+bool PowerUpGameObjDef::Grant(SmartGameObj *, PowerUpGameObj *, bool) const
+AT2(0x006F09F0,0x006EFFB0);
+#endif
+
+RENEGADE_FUNCTION
+Vector3 SCRIPTS_API Get_Color_For_Team(int teamId)
+AT2(0x006D99E0,0x006D9280);
+Vector3 DamageableGameObj::Get_Team_Color(void)
{
- return "Is_SoldierFactory";
+ return Get_Color_For_Team(PlayerType);
}
- else if (Is_VehicleFactory(obj))
+
+int SCRIPTS_API Get_Object_Type(GameObject *obj)
{
- if (Is_Airstrip(obj))
+ if (!obj)
{
- return "Is_Airstrip";
+ return 0;
}
- else if (Is_WarFactory(obj))
+ DamageableGameObj *o2 = obj->As_DamageableGameObj();
+ if (!o2)
{
- return "Is_WarFactory";
- }
+ return 0;
}
- else if (Is_Refinery(obj))
- {
- return "Is_Refinery";
+ return o2->Get_Player_Type();
}
- else if (Is_ComCenter(obj))
+
+void SCRIPTS_API Set_Object_Type(GameObject *obj,int type)
{
- return "Is_ComCenter";
- }
- else if (Is_RepairBay(obj))
+ if (!obj)
{
- return "Is_RepairBay";
+ return;
}
- else
+ DamageableGameObj *o2 = obj->As_DamageableGameObj();
+ if (!o2)
{
- return "(null)";
+ return;
}
- return "(null)";
+ o2->Set_Player_Type(type);
}
void SCRIPTS_API Get_Object_Color(GameObject *obj, unsigned int *red, unsigned int *green, unsigned int *blue)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- DamageableGameObj *o = (DamageableGameObj *)As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return;
@@ -911,7 +338,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Get_Object_Type(o) == Team)
@@ -929,12 +356,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (Get_Object_Type(o) == Team)
+ if (Get_Object_Type(o2) == Team)
{
- return o;
+ return o2;
}
}
x = x->Next();
@@ -947,7 +379,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) && (!Commands->Is_A_Star(o)))
@@ -965,15 +397,20 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (!_stricmp(d->Get_Name(),Preset_Name))
{
- if ((Get_Object_Type(o) == Team) || (Team == 2))
+ if ((Get_Object_Type(o2) == Team) || (Team == 2))
{
- return o;
+ return o2;
}
}
}
@@ -989,17 +426,22 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if ((Get_Object_Type(o) == Team) && !Is_Building(o))
+ if ((Get_Object_Type(o2) == Team) && !o2->As_BuildingGameObj())
{
- Vector3 pos = Commands->Get_Position(o);
+ Vector3 pos = Commands->Get_Position(o2);
float dist = Commands->Get_Distance(pos,position);
if (dist < closestdist)
{
closestdist = dist;
- closest = o;
+ closest = o2;
}
}
}
@@ -1015,16 +457,21 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if ((Get_Object_Type(o) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o),Preset))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ if ((Get_Object_Type(o2) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o2),Preset))
{
- float dist = Commands->Get_Distance(Commands->Get_Position(o),pos);
+ float dist = Commands->Get_Distance(Commands->Get_Position(o2),pos);
if (dist < closestdist)
{
closestdist = dist;
- closest = o;
+ closest = o2;
}
}
}
@@ -1039,12 +486,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if ((Get_Object_Type(o) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o),Preset))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ if ((Get_Object_Type(o2) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o2),Preset))
{
- ObjList.Add(o);
+ ObjList.Add(o2);
}
}
x = x->Next();
@@ -1086,12 +538,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if ((Get_Object_Type(o) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o),Preset))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ if ((Get_Object_Type(o2) == Team || Team == 2) && !_stricmp(Commands->Get_Preset_Name(o2),Preset))
{
- ObjList->Add(o);
+ ObjList->Add(o2);
}
}
x = x->Next();
@@ -1105,23 +562,28 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (!_stricmp(Commands->Get_Preset_Name(o),preset))
+ if (!_stricmp(Commands->Get_Preset_Name(o2),preset))
{
if (object)
{
Vector3 obj_pos = Commands->Get_Position(object);
- Vector3 o_pos = Commands->Get_Position(o);
+ Vector3 o_pos = Commands->Get_Position(o2);
if (Commands->Get_Distance(position, o_pos) < Commands->Get_Distance(position, obj_pos))
{
- object = o;
+ object = o2;
}
}
else
{
- object = o;
+ object = o2;
}
}
}
@@ -1137,12 +599,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (count > 0)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (!_stricmp(Commands->Get_Preset_Name(o),preset))
+ if (!_stricmp(Commands->Get_Preset_Name(o2),preset))
{
- object = o;
+ object = o2;
count--;
}
}
@@ -1164,14 +631,14 @@
void SCRIPTS_API Send_Custom_To_Team_Buildings(int Team,GameObject *sender,int type,int param,float delay)
{
- if (!Commands->Get_ID(sender) || !sender)
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Get_Object_Type(o) == Team)
@@ -1190,21 +657,26 @@
void SCRIPTS_API Send_Custom_To_Team_Preset(int Team,const char *PresetName,GameObject *sender,int type,int param,float delay)
{
- if (!Commands->Get_ID(sender) || !sender)
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (Get_Object_Type(o) == Team)
+ if (Get_Object_Type(o2) == Team)
{
- if (!_stricmp(Commands->Get_Preset_Name(o),PresetName))
+ if (!_stricmp(Commands->Get_Preset_Name(o2),PresetName))
{
- Commands->Send_Custom_Event(sender,o,type,param,delay);
+ Commands->Send_Custom_Event(sender,o2,type,param,delay);
}
}
}
@@ -1214,25 +686,30 @@
void SCRIPTS_API Send_Custom_All_Objects_Area(int type,const Vector3 &Position,float Distance,GameObject *sender,int team)
{
- if (!Commands->Get_ID(sender) || !sender)
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *obj = (GameObject *)x->Data();
- if (obj && As_ScriptableGameObj(obj))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- Vector3 ObjPosition = Commands->Get_Position(obj);
+ Vector3 ObjPosition = Commands->Get_Position(o2);
Vector3 TestPosition = Position;
ObjPosition.Z = 0;
TestPosition.Z = 0;
if ((Commands->Get_Distance(ObjPosition,TestPosition) <= Distance))
{
- if ((Get_Object_Type(obj) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Commands->Send_Custom_Event(sender,obj,type,0,0);
+ Commands->Send_Custom_Event(sender,o2,type,0,0);
}
}
}
@@ -1242,19 +719,24 @@
void SCRIPTS_API Send_Custom_All_Objects(int type,GameObject *sender,int team)
{
- if (!Commands->Get_ID(sender) || !sender)
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *obj = (GameObject *)x->Data();
- if (obj && As_ScriptableGameObj(obj))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if ((Get_Object_Type(obj) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Commands->Send_Custom_Event(sender,obj,type,0,0);
+ Commands->Send_Custom_Event(sender,o2,type,0,0);
}
}
x = x->Next();
@@ -1263,20 +745,25 @@
void SCRIPTS_API Send_Custom_Event_To_Object(GameObject *sender,const char *Preset,int type,int param,float delay)
{
- if (!Commands->Get_ID(sender) || !sender)
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (!_stricmp(d->Get_Name(),Preset))
{
- Commands->Send_Custom_Event(sender,o,type,param,delay);
+ Commands->Send_Custom_Event(sender,o2,type,param,delay);
}
}
x = x->Next();
@@ -1288,19 +775,24 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if (Get_Object_Type(o) == team && !_stricmp(Commands->Get_Preset_Name(o),preset))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ if (Get_Object_Type(o2) == team && !_stricmp(Commands->Get_Preset_Name(o2),preset))
{
- Vector3 pos = Commands->Get_Position(o);
+ Vector3 pos = Commands->Get_Position(o2);
pos.Z = 0;
location.Z = 0;
if (Commands->Get_Distance(pos,location) <= range)
{
- if (As_VehicleGameObj(o) && !empty)
+ if (o2->As_VehicleGameObj() && !empty)
{
- if (o->As_VehicleGameObj()->Get_Occupant_Count() == 0)
+ if (o2->As_VehicleGameObj()->Get_Occupant_Count() == 0)
{
return false;
}
@@ -1323,45 +815,57 @@
bool SCRIPTS_API Get_Is_Powerup_Persistant(GameObject *obj)
{
- PowerUpGameObj *o = (PowerUpGameObj *)As_PowerUpGameObj(obj);
+ if (obj->As_PhysicalGameObj())
+ {
+ PowerUpGameObj *o = obj->As_PhysicalGameObj()->As_PowerUpGameObj();
if (!o)
{
return 0;
}
return o->Get_Definition().Is_Persistant();
}
+ return 0;
+}
bool SCRIPTS_API Get_Powerup_Always_Allow_Grant(GameObject *obj)
{
- PowerUpGameObj *o = (PowerUpGameObj *)As_PowerUpGameObj(obj);
+ if (obj->As_PhysicalGameObj())
+ {
+ PowerUpGameObj *o = obj->As_PhysicalGameObj()->As_PowerUpGameObj();
if (!o)
{
return 0;
}
return o->Get_Definition().Is_Always_Allow_Grant();
}
+ return 0;
+}
int SCRIPTS_API Get_Powerup_Grant_Sound(GameObject *obj)
{
- PowerUpGameObj *o = (PowerUpGameObj *)As_PowerUpGameObj(obj);
+ if (obj->As_PhysicalGameObj())
+ {
+ PowerUpGameObj *o = obj->As_PhysicalGameObj()->As_PowerUpGameObj();
if (!o)
{
return 0;
}
return o->Get_Definition().Get_Grant_Sound();
}
+ return 0;
+}
void SCRIPTS_API Grant_Powerup(GameObject *obj,const char *Preset_Name)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- GameObject *o = As_SmartGameObj(obj);
+ SmartGameObj *o = obj->As_SmartGameObj();
if (o)
{
PowerUpGameObjDef *def = (PowerUpGameObjDef *)Find_Named_Definition(Preset_Name);
- def->Grant((SmartGameObj *)o,0,true);
+ def->Grant(o,0,true);
}
}
@@ -1426,17 +930,22 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o) && o != obj)
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o && o != obj)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if ((team == 2 || Get_Object_Type(o) == team) && Is_Armed(o))
+ if ((team == 2 || Get_Object_Type(o2) == team) && o2->As_PhysicalGameObj() && o2->As_PhysicalGameObj()->As_ArmedGameObj())
{
- Vector3 pos = Commands->Get_Position(o);
+ Vector3 pos = Commands->Get_Position(o2);
float dist = Commands->Get_Distance(pos,position);
if (dist < closestdist)
{
closestdist = dist;
- closest = o;
+ closest = o2;
}
}
}
@@ -1445,27 +954,6 @@
return closest;
}
-void SCRIPTS_API Set_Powerup_Always_Allow_Grant(GameObject *obj,bool Grant)
-{
- if (!Commands->Get_ID(obj) || !obj)
- {
- return;
- }
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
- if (!o2)
- {
- return;
- }
- PowerUpGameObj *o3 = o2->As_PowerUpGameObj();
- if (!o3)
- {
- return;
- }
- ((PowerUpGameObjDef&)o3->Get_Definition()).AlwaysAllowGrant = Grant;
-}
-
-
-
void PhysicalGameObj::Set_Transform(const Matrix3D& mat)
{
PhysObj->Set_Transform(mat);
@@ -1484,7 +972,7 @@
PhysObj->Set_Transform(tm);
}
-bool DamageableGameObj::Is_Teammate(DamageableGameObj * p_obj)
+SCRIPTS_API bool DamageableGameObj::Is_Teammate(DamageableGameObj * p_obj)
{
return ((p_obj == this) || (Is_Team_Player() && Get_Player_Type() == p_obj->Get_Player_Type()));
}
@@ -1516,13 +1004,13 @@
return NULL;
}
-bool DamageableGameObj::Is_Team_Player(void)
+SCRIPTS_API bool DamageableGameObj::Is_Team_Player(void)
{
int player_type = Get_Player_Type();
return player_type == PLAYERTYPE_NOD || player_type == PLAYERTYPE_GDI;
}
-bool DamageableGameObj::Is_Enemy(DamageableGameObj *obj)
+SCRIPTS_API bool DamageableGameObj::Is_Enemy(DamageableGameObj *obj)
{
bool enemy = false;
if (obj != this)
@@ -1548,7 +1036,7 @@
return enemy;
}
-AnimControlClass *PhysicalGameObj::Get_Anim_Control()
+SCRIPTS_API AnimControlClass *PhysicalGameObj::Get_Anim_Control()
{
return AnimControl;
}
@@ -1558,12 +1046,12 @@
*Position = Peek_Physical_Object()->Get_Transform().Get_Translation();
}
-const PowerUpGameObjDef & PowerUpGameObj::Get_Definition( void ) const
+SCRIPTS_API const PowerUpGameObjDef & PowerUpGameObj::Get_Definition( void ) const
{
return (const PowerUpGameObjDef &)BaseGameObj::Get_Definition();
}
-const PhysicalGameObjDef & PhysicalGameObj::Get_Definition( void ) const
+SCRIPTS_API const PhysicalGameObjDef & PhysicalGameObj::Get_Definition( void ) const
{
return (const PhysicalGameObjDef &)BaseGameObj::Get_Definition();
}
@@ -1583,4 +1071,28 @@
}
return false;
}
+
+void SCRIPTS_API Set_Powerup_Always_Allow_Grant(GameObject *obj,bool Grant)
+{
+ if (!obj)
+ {
+ return;
+ }
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
+ if (!o2)
+ {
+ return;
+ }
+ PowerUpGameObj *o3 = o2->As_PowerUpGameObj();
+ if (!o3)
+ {
+ return;
+ }
+ ((PowerUpGameObjDef&)o3->Get_Definition()).AlwaysAllowGrant = Grant;
+}
+
+void SCRIPTS_API PhysicalGameObj::Set_Collision_Group(int group)
+{
+ PhysObj->Set_Collision_Group((Collision_Group_Type)group);
+}
#endif
\ No newline at end of file
diff -uwr sourceold/scripts/engine_obj.h source/scripts/engine_obj.h
--- sourceold/scripts/engine_obj.h 2011-10-11 21:54:59.320312500 +0800
+++ source/scripts/engine_obj.h 2012-04-24 13:38:29.723632800 +0800
@@ -50,39 +50,6 @@
int SCRIPTS_API Get_Object_Type(GameObject *obj); //get the team of an object,0 = Nod,1 = GDI,2 = neutral,works on buildings
void SCRIPTS_API Set_Object_Type(GameObject *obj,int type); //set the team of an object,0 = Nod,1 = GDI,2 = neutral,works on buildings
-GameObject SCRIPTS_API *As_ArmedGameObj(GameObject *obj); //Check if object is an ArmedGameObj
-GameObject SCRIPTS_API *As_BeaconGameObj(GameObject *obj); //Check if object is a BeaconGameObj
-GameObject SCRIPTS_API *As_C4GameObj(GameObject *obj); //Check if object is a C4GameObj
-GameObject SCRIPTS_API *As_ScriptableGameObj(GameObject *obj); //Check if object is a ScritableGameObj
-GameObject SCRIPTS_API *As_VehicleGameObj(GameObject *obj); //Check if object is a VehicleGameObj
-GameObject SCRIPTS_API *As_SoldierGameObj(GameObject *obj); //Check if object is a SoldierGameObj
-GameObject SCRIPTS_API *As_BuildingGameObj(GameObject *obj); //Check if object is a BuildingGameObj
-GameObject SCRIPTS_API *As_SmartGameObj(GameObject *obj); //Check if object is a SmartGameObj
-GameObject SCRIPTS_API *As_PhysicalGameObj(GameObject *obj); //Check if object is a PhysicalGameObj
-GameObject SCRIPTS_API *As_DamageableGameObj(GameObject *obj); //Check if object is a DamageableGameObj
-GameObject SCRIPTS_API *As_ScriptZoneGameObj(GameObject *obj); //Check if object is a ScriptZoneGameObj
-GameObject SCRIPTS_API *As_VehicleFactoryGameObj(GameObject *obj); //Check of object is a VehicleFactoryGameObj
-bool SCRIPTS_API Is_Building(GameObject *obj); //is a BuildingGameObj
-bool SCRIPTS_API Is_Soldier(GameObject *obj); //is a SoldierGameObj
-bool SCRIPTS_API Is_Vehicle(GameObject *obj); //is a VechicleGameObj
-bool SCRIPTS_API Is_Cinematic(GameObject *obj); //is a CinematicGameObj
-bool SCRIPTS_API Is_ScriptZone(GameObject *obj); //is a ScriptZoneGameObj
-bool SCRIPTS_API Is_Powerup(GameObject *obj); //is a PowerUpGameObj
-bool SCRIPTS_API Is_C4(GameObject *obj); //is a C4GameObj
-bool SCRIPTS_API Is_Beacon(GameObject *obj); //is a BeaconGameObj
-bool SCRIPTS_API Is_Armed(GameObject *obj); //is an ArmedGameObj
-bool SCRIPTS_API Is_Simple(GameObject *obj); //is a SimpleGameObj
-bool SCRIPTS_API Is_PowerPlant(GameObject *obj); //is a PowerPlantGameObj
-bool SCRIPTS_API Is_ConstructionYard(GameObject *obj); //is a ConstructionYardGameObj
-bool SCRIPTS_API Is_SoldierFactory(GameObject *obj); //is a SoldierFactoryGameObj
-bool SCRIPTS_API Is_VehicleFactory(GameObject *obj); //is a VehicleFactoryGameObj
-bool SCRIPTS_API Is_Airstrip(GameObject *obj); //is an AirstripGameObj
-bool SCRIPTS_API Is_WarFactory(GameObject *obj); //is a WarFactoryGameObj
-bool SCRIPTS_API Is_Refinery(GameObject *obj); //is a RefineryGameObj
-bool SCRIPTS_API Is_ComCenter(GameObject *obj); //is a ComCenterGameObj
-bool SCRIPTS_API Is_RepairBay(GameObject *obj); //is a RepairBayGameObj
-bool SCRIPTS_API Is_Scriptable(GameObject *obj); //is a ScriptableGameObj
-const char SCRIPTS_API *Get_Building_Type(GameObject *obj); //returns a string indicating the building type of an object
void SCRIPTS_API Get_Object_Color(GameObject *obj, unsigned int *red, unsigned int *green, unsigned int *blue); //get color for a player
GameObject SCRIPTS_API *Find_Smart_Object_By_Team(int Team); //will find the first SmartGameObj (i.e. soldier or vechicle) for the team,0 = Nod,1 = GDI
GameObject SCRIPTS_API *Find_Object_By_Team(int Team); //will find the first object for the team,0 = Nod,1 = GDI
diff -uwr sourceold/scripts/engine_obj2.cpp source/scripts/engine_obj2.cpp
--- sourceold/scripts/engine_obj2.cpp 2012-02-13 18:26:42.375398400 +0800
+++ source/scripts/engine_obj2.cpp 2012-05-23 11:29:54.504882800 +0800
@@ -26,6 +26,7 @@
#include "AirFactoryGameObj.h"
#include "AirFactoryGameObjDef.h"
#include "VehicleFactoryGameObjDef.h"
+#include "NavalFactoryGameObj.h"
RENEGADE_FUNCTION
GameObject *Create_Library_Object(const char *preset)
@@ -44,6 +45,22 @@
bool AirFactoryGameObj::Is_Available_For_Purchase() const
AT2(0x0070B6F0,0x0070ACB0);
RENEGADE_FUNCTION
+SCRIPTS_API bool SoldierGameObj::Is_In_Elevator()
+AT2(0x006C9610,0x006C8EB0);
+RENEGADE_FUNCTION
+void NavalFactoryGameObj::Create_Vehicle(int defintion_id,SoldierGameObj * player)
+AT2(0x0073EE30,0x0073E6D0);
+RENEGADE_FUNCTION
+int NavalFactoryGameObj::Get_Team_Vehicle_Count() const
+AT2(0x0073FB80,0x0073F420);
+RENEGADE_FUNCTION
+bool NavalFactoryGameObj::Is_Available_For_Purchase() const
+AT2(0x007408E0,0x00740180);
+RENEGADE_FUNCTION
+bool NavalFactoryGameObj::Can_Spawn(int definition_id)
+AT2(0x007425B0,0x00741E50);
+
+RENEGADE_FUNCTION
bool VehicleFactoryGameObj::Request_Vehicle(int defintion_id, float generation_time,SoldierGameObj * player)
AT2(0x006EE1A0,0x006ED760);
RENEGADE_FUNCTION
@@ -60,14 +77,9 @@
{
float closest = 999999;
ScriptZoneGameObj *closestzone = 0;
- for (SLNode* node = GameObjManager::GameObjList.Head(); node; node = node->Next())
- {
- ScriptableGameObj* object = ((BaseGameObj *)node->Data())->As_ScriptableGameObj();
- if (object)
- {
- ScriptZoneGameObj *zone = object->As_ScriptZoneGameObj();
- if (zone)
+ for (SLNode* node = GameObjManager::ScriptZoneGameObjList.Head(); node; node = node->Next())
{
+ ScriptZoneGameObj *zone = node->Data();
if (zone->Get_Definition().Get_Type() == Type)
{
float distance = Vector3::Distance(zone->Get_Bounding_Box().Center,Location);
@@ -78,8 +90,6 @@
}
}
}
- }
- }
return closestzone;
}
bool ScriptZoneGameObj::Inside_Me(PhysicalGameObj *obj)
@@ -100,23 +110,22 @@
AT2(0x00470AC0,0x00470230);
GameObject SCRIPTS_API *Find_Closest_Zone(Vector3 &location,unsigned int type)
{
- return (GameObject *)ScriptZoneGameObj::Find_Closest_Zone(location,(ZoneConstants::ZoneType)type);
+ return ScriptZoneGameObj::Find_Closest_Zone(location,(ZoneConstants::ZoneType)type);
}
GameObject SCRIPTS_API *Get_Vehicle(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (o)
{
GameObject *vehicle = o->Get_Vehicle();
- if (vehicle)
+ if (vehicle && vehicle->As_VehicleGameObj())
{
- GameObject *v = As_VehicleGameObj(vehicle);
- return v;
+ return vehicle;
}
return 0;
}
@@ -125,11 +134,11 @@
void SCRIPTS_API Grant_Refill(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- GameObject *o = As_SoldierGameObj(obj);
+ GameObject *o = obj->As_SoldierGameObj();
if (o)
{
GrantSupplies(obj);
@@ -138,7 +147,7 @@
bool SCRIPTS_API Change_Character(GameObject *obj,const char *Preset_Name)
{
- if (!Commands->Get_ID(obj) || !obj || Get_Vehicle(obj))
+ if (!obj || Get_Vehicle(obj))
{
return false;
}
@@ -171,6 +180,10 @@
{
return factory->As_BuildingGameObj()->As_AirFactoryGameObj()->Is_Available_For_Purchase();
}
+ else if (factory->As_BuildingGameObj() && factory->As_BuildingGameObj()->As_NavalFactoryGameObj())
+ {
+ return factory->As_BuildingGameObj()->As_NavalFactoryGameObj()->Is_Available_For_Purchase();
+ }
else
{
return false;
@@ -179,11 +192,11 @@
void SCRIPTS_API Toggle_Fly_Mode(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (o)
{
o->Toggle_Fly_Mode();
@@ -193,21 +206,21 @@
int SCRIPTS_API Get_Vehicle_Occupant_Count(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Occupant_Count();
}
GameObject SCRIPTS_API *Get_Vehicle_Occupant(GameObject *obj,int seat)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
if (seat >= o->Get_Definition().Get_Seat_Count())
{
return 0;
@@ -217,42 +230,42 @@
GameObject SCRIPTS_API *Get_Vehicle_Driver(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Driver();
}
GameObject SCRIPTS_API *Get_Vehicle_Gunner_Pos(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Gunner();
}
GameObject SCRIPTS_API *Get_Vehicle_Gunner(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Actual_Gunner();
}
#ifndef SHADERS_EXPORTS
void SCRIPTS_API Force_Occupant_Exit(GameObject *obj,int seat)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
if (seat >= o->Get_Definition().Get_Seat_Count())
{
return;
@@ -267,11 +280,11 @@
void SCRIPTS_API Force_Occupants_Exit(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
int x = o->Get_Definition().Get_Seat_Count();
ActionParamsStruct params;
params.Set_Basic((long)0,100,39);
@@ -286,7 +299,7 @@
void SCRIPTS_API Soldier_Transition_Vehicle(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_SoldierGameObj(obj))
+ if (!obj || !obj->As_SoldierGameObj())
{
return;
}
@@ -297,11 +310,11 @@
void SCRIPTS_API Force_Occupants_Exit_Team(GameObject *obj,int team)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
int x = o->Get_Definition().Get_Seat_Count();
ActionParamsStruct params;
params.Set_Basic((long)0,100,39);
@@ -317,18 +330,17 @@
GameObject SCRIPTS_API *Get_Vehicle_Return(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return obj;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (o)
{
GameObject *vehicle = o->Get_Vehicle();
- if (vehicle)
+ if (vehicle && vehicle->As_VehicleGameObj())
{
- GameObject *v = As_VehicleGameObj(vehicle);
- return v;
+ return vehicle;
}
return obj;
}
@@ -337,11 +349,11 @@
bool SCRIPTS_API Get_Fly_Mode(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return false;
@@ -351,11 +363,11 @@
bool SCRIPTS_API Is_Stealth(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- SmartGameObj *o = (SmartGameObj *)As_SmartGameObj(obj);
+ SmartGameObj *o = obj->As_SmartGameObj();
if (!o)
{
return false;
@@ -365,21 +377,21 @@
int SCRIPTS_API Get_Vehicle_Seat_Count(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Definition().Get_Seat_Count();
}
unsigned int SCRIPTS_API Get_Vehicle_Mode(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- GameObject *o = As_VehicleGameObj(obj);
+ GameObject *o = obj->As_VehicleGameObj();
if (!o)
{
obj = Get_Vehicle(obj);
@@ -388,7 +400,7 @@
return 0;
}
}
- VehicleGameObjDef *d = (VehicleGameObjDef *)Get_Definition(obj);
+ const VehicleGameObjDef *d = &obj->As_VehicleGameObj()->Get_Definition();
return (int)d->Get_Type();
}
@@ -399,11 +411,11 @@
GameObject SCRIPTS_API *Get_Vehicle_Owner(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
return o->Get_Lock_Owner();
}
@@ -416,11 +428,11 @@
OBBoxClass SCRIPTS_API *Get_Zone_Box(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- ScriptZoneGameObj *o = (ScriptZoneGameObj*)As_ScriptZoneGameObj(obj);
+ ScriptZoneGameObj *o = obj->As_ScriptZoneGameObj();
if (!o)
{
return 0;
@@ -430,11 +442,11 @@
bool SCRIPTS_API PointInZone(GameObject *obj,const Vector3 &v)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- GameObject *o = As_ScriptZoneGameObj(obj);
+ GameObject *o = obj->As_ScriptZoneGameObj();
if (!o)
{
return false;
@@ -449,16 +461,16 @@
bool SCRIPTS_API IsInsideZone(GameObject *zone,GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- if (!Commands->Get_ID(zone) || !zone)
+ if (!zone)
{
return false;
}
- GameObject *o = As_SmartGameObj(obj);
- GameObject *o2 = As_ScriptZoneGameObj(zone);
+ GameObject *o = obj->As_SmartGameObj();
+ GameObject *o2 = zone->As_ScriptZoneGameObj();
if ((o) && (o2))
{
Vector3 v;
@@ -477,26 +489,26 @@
unsigned int SCRIPTS_API Get_Zone_Type(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- GameObject *o = As_ScriptZoneGameObj(obj);
+ ScriptZoneGameObj *o = obj->As_ScriptZoneGameObj();
if (!o)
{
return 0;
}
- ScriptZoneGameObjDef *d = (ScriptZoneGameObjDef *)Get_Definition(obj);
+ const ScriptZoneGameObjDef *d = &o->Get_Definition();
return d->Get_Type();
}
void SCRIPTS_API Set_Zone_Box(GameObject *obj,OBBoxClass &box)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- ScriptZoneGameObj *o = (ScriptZoneGameObj*)As_ScriptZoneGameObj(obj);
+ ScriptZoneGameObj *o = obj->As_ScriptZoneGameObj();
if (!o)
{
return;
@@ -508,27 +520,30 @@
{
GameObject *obj = Create_Library_Object(preset);
Set_Zone_Box(obj,box);
- ((ScriptableGameObj *)obj)->Start_Observers();
+ obj->Start_Observers();
return obj;
}
void SCRIPTS_API Set_Vehicle_Is_Visible(GameObject *obj,bool visible)
{
- if(!Is_Vehicle(obj))
+ if(!obj)
{
return;
}
- VehicleGameObj *b = (VehicleGameObj *)obj;
+ VehicleGameObj *b = obj->As_VehicleGameObj();
+ if (b)
+ {
b->Set_Is_Scripts_Visible(visible);
}
+}
void SCRIPTS_API Set_Vehicle_Gunner(GameObject *obj,int seat)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
if (seat <= 1 || seat > o->Get_Definition().Get_Seat_Count())
{
return;
@@ -541,7 +556,7 @@
}
}
-bool SmartGameObj::Is_Stealthed() const
+SCRIPTS_API bool SmartGameObj::Is_Stealthed() const
{
if (StealthEffect)
{
@@ -553,7 +568,7 @@
return false;
}
-bool SmartGameObj::Is_Human_Controlled()
+SCRIPTS_API bool SmartGameObj::Is_Human_Controlled()
{
return (this->ControlOwner >= 0);
}
@@ -583,34 +598,29 @@
return Get_Driver();
}
-const VehicleGameObjDef & VehicleGameObj::Get_Definition( void ) const
+SCRIPTS_API const VehicleGameObjDef & VehicleGameObj::Get_Definition( void ) const
{
return (const VehicleGameObjDef &)BaseGameObj::Get_Definition();
}
// 0x006802B0, 0x0067FB50, 0x, 0x0810D93A
-SmartGameObj* GameObjManager::Find_SmartGameObj
- (int networkId)
+SCRIPTS_API SmartGameObj* GameObjManager::Find_SmartGameObj(int networkId)
{
if (!networkId)
return 0;
-
for (SLNode* node = GameObjManager::SmartGameObjList.Head(); node; node = node->Next())
{
SmartGameObj* object = (SmartGameObj *)node->Data();
if (object->Get_Network_ID() != networkId)
continue;
-
if (object->Is_Delete_Pending())
return 0;
-
return object;
}
-
return 0;
}
-bool SmartGameObj::Has_Player()
+SCRIPTS_API bool SmartGameObj::Has_Player()
{
return ControlOwner != SERVER_CONTROL_OWNER;
}
@@ -620,7 +630,7 @@
return StealthEnabled;
}
-bool SmartGameObj::Is_Obj_Visible(PhysicalGameObj* object)
+SCRIPTS_API bool SmartGameObj::Is_Obj_Visible(PhysicalGameObj* object)
{
const Vector3 bullseyePosition = object->Get_Bullseye_Position();
const Matrix3D lookTransform = Get_Look_Transform();
@@ -650,7 +660,7 @@
collisionTest.CollidedPhysObj == object->Peek_Physical_Object();
}
-const SmartGameObjDef & SmartGameObj::Get_Definition( void ) const
+SCRIPTS_API const SmartGameObjDef & SmartGameObj::Get_Definition( void ) const
{
return (const SmartGameObjDef &)BaseGameObj::Get_Definition();
}
@@ -662,11 +672,64 @@
bool SCRIPTS_API Is_Spy(GameObject *obj)
{
- if (obj->As_SoldierGameObj())
+ if (obj && obj->As_SoldierGameObj())
{
return obj->As_SoldierGameObj()->Get_Definition().Is_Spy();
}
return false;
}
+SCRIPTS_API bool Is_Stealth_Enabled(GameObject *obj)
+{
+ if (obj && obj->As_SoldierGameObj())
+ {
+ return obj->As_SoldierGameObj()->Is_Stealth_Enabled();
+ }
+ return false;
+}
+
+SCRIPTS_API int Get_Object_Count_In_Zone(GameObject *obj,int Team)
+{
+ if (!obj)
+ {
+ return 0;
+ }
+ ScriptZoneGameObj *Zone = obj->As_ScriptZoneGameObj();
+ if (!Zone)
+ {
+ return 0;
+ }
+ int Return = 0;
+ for (SLNode *z = GameObjManager::SmartGameObjList.Head();z;z = z->Next())
+ {
+ if ((Get_Object_Type(z->Data()) == Team || Team == 2) && Zone->Inside_Me(z->Data()))
+ {
+ Return++;
+ }
+ }
+ return Return;
+}
+
+SCRIPTS_API int Get_Player_Count_In_Zone(GameObject *obj,int Team)
+{
+ if (!obj)
+ {
+ return 0;
+ }
+ ScriptZoneGameObj *Zone = obj->As_ScriptZoneGameObj();
+ if (!Zone)
+ {
+ return 0;
+ }
+ int Return = 0;
+ for (SLNode *z = GameObjManager::StarGameObjList.Head();z;z = z->Next())
+ {
+ if ((Get_Object_Type(z->Data()) == Team || Team == 2) && Zone->Inside_Me(z->Data()))
+ {
+ Return++;
+ }
+ }
+ return Return;
+}
+
REF_DEF2(SmartGameObj::GlobalSightRangeScale,float,0x00811E64,0x0081103C);
diff -uwr sourceold/scripts/engine_obj2.h source/scripts/engine_obj2.h
--- sourceold/scripts/engine_obj2.h 2012-02-13 18:26:42.432039000 +0800
+++ source/scripts/engine_obj2.h 2012-05-23 11:26:18.001953100 +0800
@@ -48,4 +48,7 @@
void SCRIPTS_API Set_Vehicle_Is_Visible(GameObject *obj,bool visible); //works like Set_Is_Visible but for vehicles, makes them be ignored by Enemy_Seen
void SCRIPTS_API Set_Vehicle_Gunner(GameObject *obj,int seat); //set gunner for this vehicle
bool SCRIPTS_API Is_Spy(GameObject *obj); //Is this soldier object a spy
+SCRIPTS_API int Get_Player_Count_In_Zone(GameObject *obj,int Team); //Get the player count in a zone
+SCRIPTS_API int Get_Object_Count_In_Zone(GameObject *obj,int Team); //Get the object count in a zone
+SCRIPTS_API bool Is_Stealth_Enabled(GameObject *obj); //Is stealth enabled
#endif
diff -uwr sourceold/scripts/engine_phys.cpp source/scripts/engine_phys.cpp
--- sourceold/scripts/engine_phys.cpp 2011-10-22 20:22:09.932617100 +0800
+++ source/scripts/engine_phys.cpp 2012-05-12 19:20:40.911132800 +0800
@@ -26,11 +26,11 @@
#include "VehicleGameObj.h"
const char SCRIPTS_API *Get_Model(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return "DUMMY";
}
- PhysicalGameObj *o = (PhysicalGameObj *)As_PhysicalGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return "DUMMY";
@@ -38,522 +38,22 @@
return o->Peek_Physical_Object()->Peek_Model()->Get_Name();
}
-bool SCRIPTS_API Is_TrackedVehicle(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900C)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_VTOLVehicle(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900D)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_WheeledVehicle(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9006)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_Motorcycle(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9002)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_Door(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9080)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_Elevator(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9081)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_DamageableStaticPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9082)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_AccessablePhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9010)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_DecorationPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9000)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_HumanPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9001)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_MotorVehicle(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9003)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_Phys3(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9004)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_RigidBody(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9005)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_ShakeableStatricPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900F)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_StaticAnimPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9008)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_StaticPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9007)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_TimedDecorationPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900A)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_VehiclePhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900B)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_DynamicAnimPhys(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x900E)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_BuildingAggregate(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9083)
- {
- return false;
- }
- return true;
-}
-
-bool SCRIPTS_API Is_Projectile(GameObject *obj)
-{
- if (!obj || !Commands->Get_ID(obj))
- {
- return false;
- }
- GameObject *o = As_PhysicalGameObj(obj);
- if (!o)
- {
- return false;
- }
- DefinitionClass* definition = Get_Phys_Definition(o);
- if (!definition)
- {
- return false;
- }
- int Class_ID = definition->Get_Class_ID();
- if (Class_ID != 0x9009)
- {
- return false;
- }
- return true;
-}
-
//doesnt work for CinematicGameObjs
float SCRIPTS_API Get_Animation_Frame(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return 0;
}
+ if (o->As_CinematicGameObj())
+ {
+ return 0;
+ }
unsigned char *x = (unsigned char *)o->Get_Anim_Control();
if (!x)
{
@@ -563,40 +63,18 @@
return a;
}
-const char SCRIPTS_API *Get_Physics(GameObject *obj)
-{
- if (Is_Door(obj)) return "Is_Door";
- else if (Is_Elevator(obj)) return "Is_Elevator";
- else if (Is_DamageableStaticPhys(obj)) return "Is_DamageableStaticPhys";
- else if (Is_AccessablePhys(obj)) return "Is_AccessablePhys";
- else if (Is_DecorationPhys(obj)) return "Is_DecorationPhys";
- else if (Is_HumanPhys(obj)) return "Is_HumanPhys";
- else if (Is_MotorVehicle(obj)) return "Is_MotorVehicle";
- else if (Is_Phys3(obj)) return "Is_Phys3";
- else if (Is_RigidBody(obj)) return "Is_RigidBody";
- else if (Is_ShakeableStatricPhys(obj)) return "Is_ShakeableStatricPhys";
- else if (Is_StaticAnimPhys(obj)) return "Is_StaticAnimPhys";
- else if (Is_StaticPhys(obj)) return "Is_StaticPhys";
- else if (Is_TimedDecorationPhys(obj)) return "Is_TimedDecorationPhys";
- else if (Is_VehiclePhys(obj)) return "Is_VehiclePhys";
- else if (Is_DynamicAnimPhys(obj)) return "Is_DynamicAnimPhys";
- else if (Is_BuildingAggregate(obj)) return "Is_BuildingAggregate";
- else if (Is_Projectile(obj)) return "Is_Projectile";
- else return "(null)";
-}
-
void SCRIPTS_API Copy_Transform(GameObject *in,GameObject *out)
{
- if (!Commands->Get_ID(in) || !in || !Commands->Get_ID(out) || !out)
+ if (!in || !out)
{
return;
}
- PhysicalGameObj *i2 = ((ScriptableGameObj *)in)->As_PhysicalGameObj();
+ PhysicalGameObj *i2 = in->As_PhysicalGameObj();
if (!i2)
{
return;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)out)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = out->As_PhysicalGameObj();
if (!o2)
{
return;
@@ -606,26 +84,30 @@
float SCRIPTS_API Get_Mass(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o = (PhysicalGameObj *)As_PhysicalGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return 0;
}
PhysClass *phys = o->Peek_Physical_Object();
+ if (phys && phys->As_MoveablePhysClass())
+ {
return phys->As_MoveablePhysClass()->Get_Mass();
}
+ return 0;
+}
const char SCRIPTS_API *Get_Htree_Name(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return "DUMMY";
}
- PhysicalGameObj *o = (PhysicalGameObj *)As_PhysicalGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return "DUMMY";
@@ -640,12 +122,10 @@
void SCRIPTS_API Create_Effect_All_Stealthed_Objects_Area(const Vector3 &Position,float Distance,const char *object,const Vector3 &offset,int team)
{
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *obj = (GameObject *)x->Data();
- if (obj && As_ScriptableGameObj(obj))
- {
+ SmartGameObj *obj = x->Data();
Vector3 ObjPosition = Commands->Get_Position(obj);
Vector3 TestPosition = Position;
ObjPosition.Z = 0;
@@ -666,7 +146,6 @@
}
}
}
- }
x = x->Next();
}
}
@@ -697,3 +176,16 @@
x = x->Next();
}
}
+
+
+SCRIPTS_API const char* Get_Animation_Name ( GameObject* pObj )
+{
+ if (!pObj || !pObj->As_PhysicalGameObj() || pObj->As_PhysicalGameObj()->As_CinematicGameObj())
+ return NULL;
+
+ AnimControlClass* pAcc = pObj->As_PhysicalGameObj()->Get_Anim_Control();
+ if ( pAcc )
+ return pAcc->Get_Animation_Name();
+ else
+ return NULL;
+}
diff -uwr sourceold/scripts/engine_phys.h source/scripts/engine_phys.h
--- sourceold/scripts/engine_phys.h 2011-10-11 21:53:38.783203100 +0800
+++ source/scripts/engine_phys.h 2012-05-12 19:20:40.888671800 +0800
@@ -15,32 +15,26 @@
const char SCRIPTS_API *Get_Model(GameObject *obj); //get the name of the 3d model used by an object,opposite of Set_Model
float SCRIPTS_API Get_Animation_Frame(GameObject *obj); //gets the current animation frame for obj,may not work for all objects
-bool SCRIPTS_API Is_TrackedVehicle(GameObject *obj); //has TrackedVechicle physics
-bool SCRIPTS_API Is_VTOLVehicle(GameObject *obj); //has VTOLVechicle physics
-bool SCRIPTS_API Is_WheeledVehicle(GameObject *obj); //has WheeledVechicle physics
-bool SCRIPTS_API Is_Motorcycle(GameObject *obj); //has Morotcycle physics
-bool SCRIPTS_API Is_Door(GameObject *obj); //has Door physics
-bool SCRIPTS_API Is_Elevator(GameObject *obj); //has Elevator physics
-bool SCRIPTS_API Is_DamageableStaticPhys(GameObject *obj); //has DamageableStaticPhys physics
-bool SCRIPTS_API Is_AccessablePhys(GameObject *obj); //has AccessablePhys physics
-bool SCRIPTS_API Is_DecorationPhys(GameObject *obj); //has DecorationPhys physics
-bool SCRIPTS_API Is_HumanPhys(GameObject *obj); //has HumanPhys physics
-bool SCRIPTS_API Is_MotorVehicle(GameObject *obj); //has MotorVehicle physics
-bool SCRIPTS_API Is_Phys3(GameObject *obj); //has Phys3 physics
-bool SCRIPTS_API Is_RigidBody(GameObject *obj); //has RigidBody physics
-bool SCRIPTS_API Is_ShakeableStatricPhys(GameObject *obj); //has ShakeableStaticPhys physics
-bool SCRIPTS_API Is_StaticAnimPhys(GameObject *obj); //has StaticAnimPhys physics
-bool SCRIPTS_API Is_StaticPhys(GameObject *obj); //has StaticPhys physics
-bool SCRIPTS_API Is_TimedDecorationPhys(GameObject *obj); //has TimedDecorationPhys physics
-bool SCRIPTS_API Is_VehiclePhys(GameObject *obj); //has VechiclePhys physics
-bool SCRIPTS_API Is_DynamicAnimPhys(GameObject *obj); //has DenamicAnimPhys physics
-bool SCRIPTS_API Is_BuildingAggregate(GameObject *obj); //has BuildingAggregate physics
-bool SCRIPTS_API Is_Projectile(GameObject *obj); //has Projectile physics
-const char SCRIPTS_API *Get_Physics(GameObject *obj); //returns a string indicating the physics type of an object
void SCRIPTS_API Copy_Transform(GameObject *in,GameObject *out); //copies the complete transform (including rotation) from one object to another
float SCRIPTS_API Get_Mass(GameObject *obj); //returns the mass of an object
const char SCRIPTS_API *Get_Htree_Name(GameObject *obj); //returns the Hierarchy Tree name for an object
char SCRIPTS_API Get_Sex(GameObject *obj); //gets the character (e.g. "A" for male or "B" for female) for use with animations
void SCRIPTS_API Create_Effect_All_Stealthed_Objects_Area(const Vector3 &Position,float Distance,const char *object,const Vector3 &offset,int team); //creates an indicator object near every stealthed object in a given area
void SCRIPTS_API Create_Effect_All_Of_Preset(const char *object,const char *preset,float ZAdjust,bool ZSet); //Create an object above all objects of a given preset, also set the facing to match the object its being created over.
+
+/*!
+* \brief Get current object animation
+* \author Daniel Paul (danpaul88@yahoo.co.uk)
+*
+* Get the name of the animation currently playing on the specified object, if any
+*
+* \param[in] pObj
+* Pointer to the GameObject for which to get the current animation name
+*
+* \return
+* The name of the current animation playing on the specified object or NULL if the object doesn't
+* support animations or is not currently playing one
+*/
+SCRIPTS_API const char* Get_Animation_Name ( GameObject* pObj );
+
#endif
diff -uwr sourceold/scripts/engine_player.cpp source/scripts/engine_player.cpp
--- sourceold/scripts/engine_player.cpp 2012-01-18 06:45:15.295898400 +0800
+++ source/scripts/engine_player.cpp 2012-05-23 15:23:26.239257800 +0800
@@ -22,6 +22,7 @@
#include "engine_game.h"
#include "engine_tdb.h"
#include "SysTimeClass.h"
+#include "cTeam.h"
RENEGADE_FUNCTION
int SCRIPTS_API Get_Player_Count()
AT2(0x00417040,0x00417040);
@@ -59,7 +60,7 @@
AT2(0x00415810,0x00415810);
RENEGADE_FUNCTION
-char *Find_Team(int team)
+cTeam *Find_Team(int team)
AT2(0x0041DA10,0x0041DA10);
RENEGADE_FUNCTION
@@ -68,11 +69,11 @@
const char SCRIPTS_API *Get_Player_Name(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return newstr("None");
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return newstr("None");
@@ -118,11 +119,11 @@
void SCRIPTS_API Change_Team(GameObject *obj,int Team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return;
@@ -137,11 +138,11 @@
void SCRIPTS_API Change_Team_2(GameObject *obj,int Team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return;
@@ -155,11 +156,11 @@
long SCRIPTS_API Get_Player_ID(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return -1;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return -1;
@@ -260,11 +261,11 @@
bool SCRIPTS_API Purchase_Item(GameObject *obj,int cost)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return false;
@@ -323,9 +324,12 @@
float SCRIPTS_API Get_Team_Score(int team)
{
- char *teamdata = Find_Team(team);
- teamdata += 0x6C0;
- return *((float *)teamdata);
+ cTeam *teamdata = Find_Team(team);
+ if (teamdata)
+ {
+ return teamdata->Get_Score();
+ }
+ return 0;
}
void SCRIPTS_API Get_Team_Color(unsigned int team, unsigned int *red, unsigned int *green, unsigned int *blue)
@@ -338,11 +342,11 @@
GameObject SCRIPTS_API *Find_First_Player(int Team)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
GameObject *o = x->Data();
- if (o && As_SoldierGameObj(o))
+ if (o && (o))
{
if (Commands->Is_A_Star(o))
{
@@ -359,7 +363,7 @@
bool SCRIPTS_API Change_Player_Team(GameObject *obj,bool Retain_Score,bool Retain_Money,bool Show_Host_Message)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
@@ -409,13 +413,13 @@
GameObject SCRIPTS_API *Get_Part_Name(const char *name1)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
int count = 0;
GameObject *current = 0;
while (x)
{
GameObject *o = x->Data();
- if (o && As_SoldierGameObj(o))
+ if (o)
{
const char *name = Get_Player_Name(o);
if (stristr(name,name1))
@@ -439,12 +443,12 @@
int SCRIPTS_API Get_Part_Names(const char *name1)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
int count = 0;
while (x)
{
GameObject *o = x->Data();
- if (o && As_SoldierGameObj(o))
+ if (o)
{
const char *name = Get_Player_Name(o);
if (stristr(name,name1))
@@ -461,11 +465,11 @@
int SCRIPTS_API Get_Team_Player_Count(int Team)
{
int Total = 0;
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
GameObject *o = x->Data();
- if (o && As_SoldierGameObj(o) && Get_Object_Type(o) == Team)
+ if (o && Get_Object_Type(o) == Team)
{
Total++;
}
@@ -476,11 +480,11 @@
int SCRIPTS_API Get_Player_Type(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return 0;
@@ -494,11 +498,11 @@
const wchar_t SCRIPTS_API *Get_Wide_Player_Name(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return L"None";
}
- SoldierGameObj *o = (SoldierGameObj *)As_SoldierGameObj(obj);
+ SoldierGameObj *o = obj->As_SoldierGameObj();
if (!o)
{
return L"None";
@@ -610,3 +614,78 @@
GameSpyAuthStateEntryTimeMs = TIMEGETTIME();
}
}
+
+SCRIPTS_API int Get_Player_Team(int PlayerID)
+{
+ cPlayer *x = Find_Player(PlayerID);
+ if (!x)
+ {
+ return 0;
+ }
+ return x->PlayerType;
+}
+
+SCRIPTS_API int Get_Player_ID_By_Name(const char *Name)
+{
+ cPlayer *Player = Find_Player(Name);
+ if (Player)
+ {
+ return Player->Get_Id();
+ }
+ return 0;
+}
+
+SCRIPTS_API bool Is_Active(int ID)
+{
+ cPlayer *Player = Find_Player(ID);
+ if (Player)
+ {
+ return Player->Get_Is_Active();
+ }
+ return false;
+}
+
+SCRIPTS_API void Set_Kills(int ID,int kills)
+{
+ cPlayer *Player = Find_Player(ID);
+ if (Player)
+ {
+ Player->Set_Kills(kills);
+ }
+}
+
+SCRIPTS_API void Set_Deaths(int ID,int deaths)
+{
+ cPlayer *Player = Find_Player(ID);
+ if (Player)
+ {
+ Player->Set_Deaths(deaths);
+ }
+}
+
+SCRIPTS_API void Set_Team_Score(int ID,float score)
+{
+ cTeam *teamdata = Find_Team(ID);
+ if (teamdata)
+ {
+ teamdata->Set_Score(score);
+ }
+}
+
+void cPlayer::Set_Kills(int kills)
+{
+ Kills = kills;
+ Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
+}
+
+void cPlayer::Set_Deaths(int deaths)
+{
+ Deaths = deaths;
+ Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
+}
+
+void cTeam::Set_Score(float _score)
+{
+ score = _score;
+ Set_Object_Dirty_Bit(NetworkObjectClass::BIT_OCCASIONAL, true);
+}
diff -uwr sourceold/scripts/engine_player.h source/scripts/engine_player.h
--- sourceold/scripts/engine_player.h 2011-10-11 21:54:40.969726500 +0800
+++ source/scripts/engine_player.h 2012-05-23 11:10:50.924804600 +0800
@@ -48,9 +48,13 @@
void SCRIPTS_API Change_Team_2(GameObject *obj,int Team); //changes the team of a player given their GameObject without killing the player,passing anything other than 0 = Nod,1 = GDI will crash
int SCRIPTS_API Get_Player_Type(GameObject *obj); //Get the player type of a player from the cPlayer
const wchar_t SCRIPTS_API *Get_Wide_Player_Name(GameObject *obj); //Converts a GameObject into a player name
-Vector3 SCRIPTS_API Get_Color_For_Team(int teamId);
-
-SCRIPTS_API cPlayer *Find_Player(int playerId);
-SCRIPTS_API cPlayer *Find_Player(const WideStringClass& playerName);
-
+Vector3 SCRIPTS_API Get_Color_For_Team(int teamId); //Get the color values for a team
+SCRIPTS_API int Get_Player_Team(int PlayerID); //Get the team type of a player
+SCRIPTS_API cPlayer *Find_Player(int playerId); //Find a player by ID
+SCRIPTS_API cPlayer *Find_Player(const WideStringClass& playerName); //find a player by name
+SCRIPTS_API int Get_Player_ID_By_Name(const char *Name); //Get the ID of a player given a name
+SCRIPTS_API bool Is_Active(int ID); //Is a player active
+SCRIPTS_API void Set_Kills(int ID,int kills); //Set kills for a player
+SCRIPTS_API void Set_Deaths(int ID,int deaths); //Set deaths for a player
+SCRIPTS_API void Set_Team_Score(int ID,float score); //Set score for a team
#endif
diff -uwr sourceold/scripts/engine_script.cpp source/scripts/engine_script.cpp
--- sourceold/scripts/engine_script.cpp 2011-10-11 23:03:17.410156200 +0800
+++ source/scripts/engine_script.cpp 2012-04-29 00:21:50.067382800 +0800
@@ -16,18 +16,20 @@
#include "slist.h"
#include "GameObjManager.h"
#include "engine_obj.h"
+#include "engine_obj2.h"
#include "engine_def.h"
#include "Definition.h"
#include "engine_phys.h"
#include "engine_game.h"
#include "BuildingGameObj.h"
+#include "VehicleGameObj.h"
SCRIPTS_API void Remove_Script(GameObject *obj,const char *script)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- const SimpleDynVecClass *observers = &((ScriptableGameObj *)obj)->Get_Observers();
+ const SimpleDynVecClass *observers = &obj->Get_Observers();
int x = observers->Count();
for (int i = 0;i < x;i++)
{
@@ -40,11 +42,11 @@
SCRIPTS_API void Remove_Duplicate_Script(GameObject *obj, const char *script)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- const SimpleDynVecClass *observers = &((ScriptableGameObj *)obj)->Get_Observers();
+ const SimpleDynVecClass *observers = &obj->Get_Observers();
bool Found = false;
for (int i = 0;i < observers->Count();i++)
{
@@ -67,15 +69,20 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (!_stricmp(d->Get_Name(),preset))
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Remove_Script(o,script);
+ Remove_Script(o2,script);
}
}
}
@@ -88,15 +95,20 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- const DefinitionClass *d = Get_Definition(o);
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ const DefinitionClass *d = &o2->Get_Definition();
if (d->Get_Class_ID() == type)
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Remove_Script(o,script);
+ Remove_Script(o2,script);
}
}
}
@@ -106,11 +118,11 @@
SCRIPTS_API void Remove_All_Scripts(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- const SimpleDynVecClass *observers = &((ScriptableGameObj *)obj)->Get_Observers();
+ const SimpleDynVecClass *observers = &obj->Get_Observers();
int x = observers->Count();
for (int i = 0;i < x;i++)
{
@@ -126,15 +138,20 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (!_stricmp(d->Get_Name(),preset))
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Commands->Attach_Script(o,script,params);
+ Commands->Attach_Script(o2,script,params);
}
}
}
@@ -147,15 +164,20 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- const DefinitionClass *d = Get_Definition(o);
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
+ {
+ const DefinitionClass *d = &o2->Get_Definition();
if (d->Get_Class_ID() == type)
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- Commands->Attach_Script(o,script,params);
+ Commands->Attach_Script(o2,script,params);
}
}
}
@@ -165,11 +187,11 @@
SCRIPTS_API bool Is_Script_Attached(GameObject *obj,const char *script)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return false;
}
- const SimpleDynVecClass *observers = &((ScriptableGameObj *)obj)->Get_Observers();
+ const SimpleDynVecClass *observers = &obj->Get_Observers();
int x = observers->Count();
for (int i = 0;i < x;i++)
{
@@ -183,7 +205,7 @@
SCRIPTS_API void Attach_Script_Once(GameObject *obj,const char *script,const char *params)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
@@ -198,17 +220,22 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (!_stricmp(d->Get_Name(),preset))
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- if (!Is_Script_Attached(o,script))
+ if (!Is_Script_Attached(o2,script))
{
- Commands->Attach_Script(o,script,params);
+ Commands->Attach_Script(o2,script,params);
}
}
}
@@ -222,17 +249,22 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- const DefinitionClass *d = Get_Definition(o);
+ const DefinitionClass *d = &o2->Get_Definition();
if (d->Get_Class_ID() == type)
{
- if ((Get_Object_Type(o) == team) || (team == 2))
+ if ((Get_Object_Type(o2) == team) || (team == 2))
{
- if (!Is_Script_Attached(o,script))
+ if (!Is_Script_Attached(o2,script))
{
- Commands->Attach_Script(o,script,params);
+ Commands->Attach_Script(o2,script,params);
}
}
}
@@ -243,15 +275,10 @@
SCRIPTS_API void Attach_Script_Player_Once(const char *script,const char *params,int team)
{
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
- {
- const DefinitionClass *d = Get_Definition(o);
- if (d->Get_Class_ID() == CID_Soldier)
- {
+ SoldierGameObj *o = x->Data();
if ((Get_Object_Type(o) == team) || (team == 2))
{
if (!Is_Script_Attached(o,script))
@@ -259,8 +286,6 @@
Commands->Attach_Script(o,script,params);
}
}
- }
- }
x = x->Next();
}
}
@@ -271,7 +296,7 @@
while (x)
{
GameObject *o = x->Data();
- if ((o) && As_BuildingGameObj(o))
+ if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
{
@@ -284,11 +309,11 @@
SCRIPTS_API void Attach_Script_Is_Preset(GameObject *obj,const char *preset,const char *script,const char *params,int team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- const DefinitionClass *d = Get_Definition(obj);
+ const DefinitionClass *d = &obj->Get_Definition();
if (!_stricmp(d->Get_Name(),preset))
{
if ((Get_Object_Type(obj) == team) || (team == 2))
@@ -300,11 +325,11 @@
SCRIPTS_API void Attach_Script_Is_Type(GameObject *obj,unsigned long type,const char *script,const char *params,int team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- const DefinitionClass *d = Get_Definition(obj);
+ const DefinitionClass *d = &obj->Get_Definition();
if (d->Get_Class_ID() == type)
{
if ((Get_Object_Type(obj) == team) || (team == 2))
@@ -319,7 +344,7 @@
SLNode *x = GameObjManager::BuildingGameObjList.Head();
while (x)
{
- GameObject *o = As_BuildingGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Get_Object_Type(o) == Team || Team == 2)
@@ -340,13 +365,11 @@
SCRIPTS_API void Attach_Script_All_Turrets_Team(int Team,const char *Script,const char *Params,bool Once)
{
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o) && As_VehicleGameObj(o))
- {
- if (Is_DecorationPhys(o) && (Get_Object_Type(o) == Team || Team == 2))
+ VehicleGameObj *o = x->Data();
+ if (Get_Vehicle_Mode(o) == VEHICLE_TYPE_TURRET && (Get_Object_Type(o) == Team || Team == 2))
{
if (Once)
{
@@ -357,7 +380,6 @@
Commands->Attach_Script(o,Script,Params);
}
}
- }
x = x->Next();
}
}
@@ -385,12 +407,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (Is_Script_Attached(o, script))
+ if (Is_Script_Attached(o2, script))
{
- return o;
+ return o2;
}
}
x = x->Next();
@@ -405,16 +432,21 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if (Is_Script_Attached(o, script))
+ if (Is_Script_Attached(o2, script))
{
- float dist = Commands->Get_Distance(Commands->Get_Position(o),pos);
+ float dist = Commands->Get_Distance(Commands->Get_Position(o2),pos);
if (closest == NULL || dist < closestdist)
{
closestdist = dist;
- closest = o;
+ closest = o2;
}
}
}
@@ -430,12 +462,17 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
{
- if (Is_Script_Attached(o, script))
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- objects.Add_Tail(o);
+ if (Is_Script_Attached(o2, script))
+ {
+ objects.Add_Tail(o2);
}
}
x = x->Next();
@@ -444,20 +481,25 @@
SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script( GameObject *sender, const char *script, int message, int param, float delay )
{
- if (!sender || !Commands->Get_ID(sender) )
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if ( Is_Script_Attached( o, script )
- && Commands->Get_ID ( sender ) != Commands->Get_ID ( o ) )
+ if ( Is_Script_Attached( o2, script )
+ && Commands->Get_ID ( sender ) != Commands->Get_ID ( o2 ) )
{
- Commands->Send_Custom_Event(sender,o,message,param,delay);
+ Commands->Send_Custom_Event(sender,o2,message,param,delay);
}
}
x = x->Next();
@@ -466,21 +508,26 @@
SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script_Ranged( GameObject *sender, const char *script, int message, int param, float delay, float range )
{
- if (!sender || !Commands->Get_ID(sender) )
+ if (!sender)
{
return;
}
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
- if (o && As_ScriptableGameObj(o))
+ BaseGameObj *o = x->Data();
+ ScriptableGameObj *o2 = 0;
+ if (o)
+ {
+ o2 = o->As_ScriptableGameObj();
+ }
+ if (o2)
{
- if ( Is_Script_Attached( o, script )
- && Commands->Get_ID ( sender ) != Commands->Get_ID ( o )
- && Commands->Get_Distance ( Commands->Get_Position ( sender ), Commands->Get_Position ( o ) ) <= range )
+ if ( Is_Script_Attached( o2, script )
+ && Commands->Get_ID ( sender ) != Commands->Get_ID ( o2 )
+ && Commands->Get_Distance ( Commands->Get_Position ( sender ), Commands->Get_Position ( o2 ) ) <= range )
{
- Commands->Send_Custom_Event(sender,o,message,param,delay);
+ Commands->Send_Custom_Event(sender,o2,message,param,delay);
}
}
x = x->Next();
@@ -489,14 +536,11 @@
SCRIPTS_API ScriptImpClass* Find_Script_On_Object(GameObject* obj, const char *script)
{
- if (!obj || !Commands->Get_ID(obj) )
+ if (!obj)
{
return NULL;
}
-
- if ( As_ScriptableGameObj(obj) )
- {
- const SimpleDynVecClass *observers = &((ScriptableGameObj *)obj)->Get_Observers();
+ const SimpleDynVecClass *observers = &obj->Get_Observers();
int x = observers->Count();
for (int i = 0;i < x;i++)
{
@@ -505,7 +549,23 @@
return ((ScriptImpClass*)(*observers)[i]);
}
}
- }
return NULL;
}
+
+void SCRIPTS_API Attach_Script_Occupants(GameObject *obj,const char *script,const char *params)
+{
+ if (!obj || !obj->As_VehicleGameObj())
+ {
+ return;
+ }
+ VehicleGameObj *o = obj->As_VehicleGameObj();
+ int x = o->Get_Definition().Get_Seat_Count();
+ for (int i = 0;i < x;i++)
+ {
+ if (o->Get_Occupant(i))
+ {
+ Commands->Attach_Script(o->Get_Occupant(i),script,params);
+ }
+ }
+}
diff -uwr sourceold/scripts/engine_script.h source/scripts/engine_script.h
--- sourceold/scripts/engine_script.h 2011-10-11 21:53:56.809570300 +0800
+++ source/scripts/engine_script.h 2012-04-24 15:57:17.879882800 +0800
@@ -38,4 +38,5 @@
SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script( GameObject *sender, const char *script, int message, int param, float delay ); // Script to send a custom to all objects with a specific script
SCRIPTS_API void Send_Custom_Event_To_Objects_With_Script_Ranged( GameObject *sender, const char *script, int message, int param, float delay, float range ); // Script to send a custom to all objects with a specific script in a specified range
SCRIPTS_API ScriptImpClass* Find_Script_On_Object(GameObject* obj, const char *script); // Returns a pointer to the first instance of the named script on the given object, or NULL if not found
+SCRIPTS_API void Attach_Script_Occupants(GameObject *obj,const char *script,const char *params); //attaches a script to all occupants of a vehicle
#endif
diff -uwr sourceold/scripts/engine_tdb.cpp source/scripts/engine_tdb.cpp
--- sourceold/scripts/engine_tdb.cpp 2011-10-11 23:03:14.446289000 +0800
+++ source/scripts/engine_tdb.cpp 2012-04-24 12:13:24.675781200 +0800
@@ -61,31 +61,36 @@
SCRIPTS_API const char *Get_Translated_Preset_Name(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return newstr("");
}
- GameObject *o = As_DamageableGameObj(obj);
+ DamageableGameObj *o = obj->As_DamageableGameObj();
if (!o)
{
return newstr("");
}
- DamageableGameObjDef *d = (DamageableGameObjDef *)Get_Definition(obj);
+ const DamageableGameObjDef *d = &o->Get_Definition();
return Get_Translated_String(d->Get_Translated_Name_ID());
}
SCRIPTS_API const wchar_t *Get_Current_Wide_Translated_Weapon(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- GameObject *o = As_ArmedGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return 0;
}
- WeaponBagClass *w = ((ArmedGameObj *)o)->Get_Weapon_Bag();
+ ArmedGameObj *o2 = o->As_ArmedGameObj();
+ if (!o2)
+ {
+ return 0;
+ }
+ WeaponBagClass *w = o2->Get_Weapon_Bag();
if ((w->Get_Index()) && (w->Get_Index() < w->Get_Count()))
{
return Get_Wide_Translated_String(w->Peek_Weapon(w->Get_Index())->Get_Definition()->IconNameID);
@@ -100,21 +105,26 @@
SCRIPTS_API const char *Get_Translated_Weapon(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return newstr("");
}
- GameObject *o = As_ArmedGameObj(obj);
+ PhysicalGameObj *o = obj->As_PhysicalGameObj();
if (!o)
{
return newstr("");
}
- WeaponBagClass *w = ((ArmedGameObj *)o)->Get_Weapon_Bag();
+ ArmedGameObj *o2 = o->As_ArmedGameObj();
+ if (!o2)
+ {
+ return newstr("");
+ }
+ WeaponBagClass *w = o2->Get_Weapon_Bag();
if ((position) && (position < w->Get_Count()))
{
return Get_Translated_String(w->Peek_Weapon(position)->Get_Definition()->IconNameID);
}
- return newstr("No String");
+ return newstr("");
}
SCRIPTS_API const char *Get_Team_Name(int Team)
@@ -132,11 +142,11 @@
SCRIPTS_API const wchar_t *Get_Wide_Vehicle_Name(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return L"Vehicle";
}
- VehicleGameObj *o = (VehicleGameObj *)As_VehicleGameObj(obj);
+ VehicleGameObj *o = obj->As_VehicleGameObj();
if (!o)
{
return L"Vehicle";
diff -uwr sourceold/scripts/engine_tt.cpp source/scripts/engine_tt.cpp
--- sourceold/scripts/engine_tt.cpp 2012-02-27 12:46:32.940882800 +0800
+++ source/scripts/engine_tt.cpp 2012-05-28 21:47:07.366210900 +0800
@@ -29,6 +29,9 @@
#include "VehicleFactoryGameObjDef.h"
#include "AirFactoryGameObj.h"
#include "Iterator.h"
+#include "NavalFactoryGameObj.h"
+#include "SCAnnouncement.h"
+#include "cScTextObj.h"
class WideStringClass;
@@ -68,6 +71,7 @@
SCRIPTS_API ahh AddHostHook;
SCRIPTS_API arh AddRefillHook;
SCRIPTS_API allh AddLoadLevelHook;
+SCRIPTS_API allh AddPreLoadLevelHook;
SCRIPTS_API allh AddGameOverHook;
SCRIPTS_API allh AddThinkHook;
SCRIPTS_API apjh AddPlayerJoinHook;
@@ -94,6 +98,8 @@
SCRIPTS_API gvl Get_Vehicle_Limit;
SCRIPTS_API svl Set_Air_Vehicle_Limit;
SCRIPTS_API gvl Get_Air_Vehicle_Limit;
+SCRIPTS_API svl Set_Naval_Vehicle_Limit;
+SCRIPTS_API gvl Get_Naval_Vehicle_Limit;
SCRIPTS_API sm Send_Message;
SCRIPTS_API smp Send_Message_Player;
SCRIPTS_API sw Set_Wireframe_Mode;
@@ -118,6 +124,8 @@
SCRIPTS_API geo GetExplosionObj;
SCRIPTS_API seo SetExplosionObj;
SCRIPTS_API uno Update_Network_Object;
+SCRIPTS_API sct Send_Client_Text;
+SCRIPTS_API sca Send_Client_Announcement;
SCRIPTS_API dod Do_Objectives_Dlg;
SCRIPTS_API sl Set_Player_Limit;
SCRIPTS_API gl Get_Player_Limit;
@@ -155,8 +163,11 @@
SCRIPTS_API gtc Get_Team_Credits;
SCRIPTS_API addConnectionAcceptanceFilterType addConnectionAcceptanceFilter;
SCRIPTS_API removeConnectionAcceptanceFilterType removeConnectionAcceptanceFilter;
+SCRIPTS_API iwu Is_WOL_User;
SCRIPTS_API ec Evict_Client;
SCRIPTS_API gcsh Get_Client_Serial_Hash;
+SCRIPTS_API gml Get_Tech_Level;
+SCRIPTS_API sw Set_Tech_Level;
SCRIPTS_API bool Can_Team_Build_Vehicle(int Team)
{
@@ -188,10 +199,10 @@
SCRIPTS_API void Send_Message_Team(int team,unsigned int red,unsigned int green,unsigned int blue,const char *msg)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -205,10 +216,10 @@
SCRIPTS_API void Set_Obj_Radar_Blip_Shape_Team(int Team,GameObject *obj,int shape)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -222,10 +233,10 @@
SCRIPTS_API void Set_Obj_Radar_Blip_Color_Team(int Team,GameObject *obj,int color)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -239,15 +250,15 @@
SCRIPTS_API void Set_Occupants_Fade(GameObject *obj,float red,float green,float blue,float opacity)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- if (!As_VehicleGameObj(obj))
+ if (!obj->As_VehicleGameObj())
{
return;
}
- VehicleGameObj *o = (VehicleGameObj *)obj;
+ VehicleGameObj *o = obj->As_VehicleGameObj();
int x = o->Get_Definition().Get_Seat_Count();
for (int i = 0;i < x;i++)
{
@@ -261,10 +272,10 @@
SCRIPTS_API void Enable_Team_Radar(int Team,bool Enable)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == Team) || (Team == 2))
@@ -278,14 +289,14 @@
SCRIPTS_API void Create_Sound_Team(const char *soundname,const Vector3 & position,GameObject *obj,int team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -299,10 +310,10 @@
SCRIPTS_API void Create_2D_Sound_Team(const char *soundname,int team)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -316,10 +327,10 @@
SCRIPTS_API void Create_2D_WAV_Sound_Team(const char *soundname,int team)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -333,14 +344,14 @@
SCRIPTS_API void Create_3D_WAV_Sound_At_Bone_Team(const char *soundname,GameObject *obj,const char *bonename,int team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -354,14 +365,14 @@
SCRIPTS_API void Create_3D_Sound_At_Bone_Team(const char *soundname,GameObject *obj,const char *bonename,int team)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::StarGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj(x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) == team) || (team == 2))
@@ -820,27 +831,9 @@
Set_Special_Base_Destruction();
}
-bool Vehicle_Preset_Is_Air(int preset)
-{
- DefinitionClass *def = Find_Definition(preset);
- if (!def)
- {
- return false;
- }
- if (def->Get_Class_ID() == 12304)
- {
- VehicleGameObjDef *def2 = (VehicleGameObjDef *)def;
- if (def2->Get_Type() == VEHICLE_TYPE_FLYING)
- {
- return true;
- }
- }
- return false;
-}
-
bool SCRIPTS_API Create_Vehicle(const char *Preset_Name,float Delay,GameObject *Owner,int Team)
{
- if (Get_Vehicle(Owner))
+ if (Owner && Get_Vehicle(Owner))
{
return false;
}
@@ -857,27 +850,27 @@
{
vf = bg2->As_VehicleFactoryGameObj();
}
- if (!vf && !Vehicle_Preset_Is_Air(preset))
+ if (!vf && !Vehicle_Preset_Is_Air(preset) && !Vehicle_Preset_Is_Naval(preset))
{
return false;
}
- if (vf && ((vf->Is_Destroyed()) || (vf->Is_Busy())))
+ if (vf && ((!vf->Is_Available())))
{
- if ((!Vehicle_Preset_Is_Air(preset)) || (!vf->Get_Definition().Get_Build_Ground_Only()))
+ if (((!Vehicle_Preset_Is_Air(preset)) || (!vf->Get_Definition().Get_Build_Ground_Only())) && !Vehicle_Preset_Is_Naval(preset))
{
return false;
}
}
- if (vf && (!Vehicle_Preset_Is_Air(preset) || !vf->Get_Definition().Get_Build_Ground_Only()))
+ if (vf && (!Vehicle_Preset_Is_Air(preset) || !vf->Get_Definition().Get_Build_Ground_Only()) && !Vehicle_Preset_Is_Naval(preset))
{
float delay = 5.0;
if (!base->Is_Base_Powered())
{
delay *= Get_Build_Time_Multiplier(Team);
}
- vf->Request_Vehicle(preset,delay,Owner->As_SoldierGameObj());
+ vf->Request_Vehicle(preset,delay,Owner ? Owner->As_SoldierGameObj() : 0);
}
- else
+ else if (Vehicle_Preset_Is_Air(preset))
{
BuildingGameObj *bg = ((BuildingGameObj *)base->Find_Building(BuildingConstants::TYPE_HELIPAD));
AirFactoryGameObj *af = 0;
@@ -885,15 +878,32 @@
{
af = bg->As_AirFactoryGameObj();
}
- if (af && !af->Is_Destroyed() && !af->Is_Busy() && Vehicle_Preset_Is_Air(preset))
+ if (af && af->Is_Available() && Vehicle_Preset_Is_Air(preset))
{
- af->Create_Vehicle(preset,Owner->As_SoldierGameObj());
+ af->Create_Vehicle(preset,Owner ? Owner->As_SoldierGameObj() : 0);
}
else
{
return false;
}
}
+ else
+ {
+ BuildingGameObj *bg = ((BuildingGameObj *)base->Find_Building(BuildingConstants::TYPE_NAVAL_FACTORY));
+ NavalFactoryGameObj *af = 0;
+ if (bg)
+ {
+ af = bg->As_NavalFactoryGameObj();
+ }
+ if (!af || !af->Is_Available() || !af->Can_Spawn(preset) || !Vehicle_Preset_Is_Naval(preset))
+ {
+ return false;
+ }
+ else
+ {
+ af->Create_Vehicle(preset,Owner ? Owner->As_SoldierGameObj() : 0);
+ }
+ }
return true;
}
@@ -909,10 +919,39 @@
{
if (strcmp(fname,name) == 0)
{
- ConsoleFunctionList.Delete(consoleFunction);
+ ConsoleFunctionList.DeleteObj(*consoleFunction);
+ }
+ }
+ }
+}
+
+SCRIPTS_API void cScTextObj::Set_Dirty_Bit_For_Team(DIRTY_BIT value, int teamId)
+{
+ TT_FOREACH(player, *Get_Player_List())
+ {
+ if (player->IsActive && player->PlayerType == teamId)
+ Set_Object_Dirty_Bit(player->PlayerId, value, true);
+ }
+}
+
+SCRIPTS_API void cNetEvent::Set_Object_Dirty_Bit_For_Version(float version,DIRTY_BIT dirty_bit, bool onoff)
+{
+ for (int clientId = 1; clientId < 128; ++clientId)
+ {
+ if (Get_Client_Version(clientId) >= version)
+ {
+ Set_Object_Dirty_Bit(clientId,dirty_bit,onoff);
}
}
}
+
+SCRIPTS_API void SCAnnouncement::Set_Dirty_Bit_For_Team(DIRTY_BIT value, int teamId)
+{
+ TT_FOREACH(player, *Get_Player_List())
+ {
+ if (player->IsActive && player->PlayerType == teamId)
+ Set_Object_Dirty_Bit(player->PlayerId, value, true);
+ }
}
RENEGADE_FUNCTION
@@ -922,3 +961,7 @@
RENEGADE_FUNCTION
SCRIPTS_API void Verbose_Help_File()
AT2(0x004284F0,0x00428670);
+
+RENEGADE_FUNCTION
+SCRIPTS_API void ScriptableGameObj::Add_Observer( GameObjObserverClass * observer )
+AT2(0x006B6C70,0x006B6510);
diff -uwr sourceold/scripts/engine_tt.h source/scripts/engine_tt.h
--- sourceold/scripts/engine_tt.h 2012-02-27 12:46:32.867640600 +0800
+++ source/scripts/engine_tt.h 2012-05-28 21:47:07.505859300 +0800
@@ -21,7 +21,8 @@
#include "cPlayer.h"
class ConnectionAcceptanceFilter;
class WideStringClass;
-
+class cScTextObj;
+class SCAnnouncement;
//start per-player script commands stuff
typedef void (*_Enable_Stealth_Player) (GameObject *obj,GameObject *obj2,bool enable);
typedef void (*_Set_Fog_Enable_Player) (GameObject *obj,bool enable);
@@ -133,6 +134,9 @@
typedef void (*ggd) (HashTemplateClass &definitions);
typedef SList *(*gpl) ();
typedef void (*uno) (NetworkObjectClass *obj);
+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);
SCRIPTS_API extern gpl Get_Player_List;
SCRIPTS_API extern gcmi Get_Current_Map_Index;
SCRIPTS_API extern gm Get_Map;
@@ -165,6 +169,7 @@
SCRIPTS_API extern rkh RemoveKeyHook;
SCRIPTS_API extern gcmt GetCurrentMusicTrack;
SCRIPTS_API extern allh AddLoadLevelHook;
+SCRIPTS_API extern allh AddPreLoadLevelHook;
SCRIPTS_API extern allh AddGameOverHook;
SCRIPTS_API extern allh AddThinkHook;
SCRIPTS_API extern apjh AddPlayerJoinHook;
@@ -210,6 +215,8 @@
SCRIPTS_API extern gvl Get_Vehicle_Limit;
SCRIPTS_API extern svl Set_Air_Vehicle_Limit;
SCRIPTS_API extern gvl Get_Air_Vehicle_Limit;
+SCRIPTS_API extern svl Set_Naval_Vehicle_Limit;
+SCRIPTS_API extern gvl Get_Naval_Vehicle_Limit;
SCRIPTS_API extern sm Send_Message;
SCRIPTS_API extern smp Send_Message_Player;
SCRIPTS_API extern sw Set_Wireframe_Mode;
@@ -234,6 +241,8 @@
SCRIPTS_API extern geo GetExplosionObj;
SCRIPTS_API extern seo SetExplosionObj;
SCRIPTS_API extern uno Update_Network_Object;
+SCRIPTS_API extern sct Send_Client_Text;
+SCRIPTS_API extern sca Send_Client_Announcement;
SCRIPTS_API extern dod Do_Objectives_Dlg;
SCRIPTS_API extern sl Set_Player_Limit;
SCRIPTS_API extern gl Get_Player_Limit;
@@ -259,6 +268,9 @@
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;
class SCRIPTS_API JFW_Key_Hook_Base : public ScriptImpClass {
public:
diff -uwr sourceold/scripts/engine_ttdef.h source/scripts/engine_ttdef.h
--- sourceold/scripts/engine_ttdef.h 2012-02-18 09:50:34.036132800 +0800
+++ source/scripts/engine_ttdef.h 2012-04-14 04:09:47.176757800 +0800
@@ -24,6 +24,12 @@
TEXT_MESSAGE_PRIVATE,
TEXT_MESSAGE_TMSG, //special extra value for the TMSG console command
};
+enum AnnouncementEnum
+{
+ ANNOUNCE_PUBLIC,
+ ANNOUNCE_TEAM,
+ ANNOUNCE_PRIVATE,
+};
typedef bool (*ChatHook) (int PlayerID,TextMessageEnum Type,const wchar_t *Message,int recieverID);
typedef bool (*HostHook) (int PlayerID,TextMessageEnum Type,const char *Message);
typedef void (*ObjectCreateHook) (void *data,GameObject *obj);
@@ -34,7 +40,7 @@
typedef int (*PurchaseHook) (BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data);
typedef void (*PurchaseMonHook) (BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,unsigned int purchaseret,const char *data);
typedef bool (*RefillHook) (GameObject *purchaser);
-typedef bool (*RadioHook) (int PlayerType, int PlayerID, int AnnouncementID, int IconID, uint8 AnnouncementType);
+typedef bool (*RadioHook) (int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType);
typedef bool (*StockDamageHook) (PhysicalGameObj* damager, PhysicalGameObj* target, float damage, uint warheadId);
typedef bool (*TtDamageHook) (PhysicalGameObj* damager, PhysicalGameObj* target, const AmmoDefinitionClass* ammo, const char* bone);
diff -uwr sourceold/scripts/engine_vector.h source/scripts/engine_vector.h
--- sourceold/scripts/engine_vector.h 2011-11-28 09:12:59.829890600 +0800
+++ source/scripts/engine_vector.h 2012-05-01 21:07:11.413085900 +0800
@@ -1122,7 +1122,7 @@
{
char buffer[256];
sprintf(buffer, "%d memory leaks found in " __FUNCTION__ "\n", TotalObjectCount - FreeObjectCount);
- OutputDebugString(buffer);
+ OutputDebugStringA(buffer);
// TODO: There are quite a few mem leaks of this kind. Fix them.
}
diff -uwr sourceold/scripts/engine_weap.cpp source/scripts/engine_weap.cpp
--- sourceold/scripts/engine_weap.cpp 2011-10-11 23:03:09.419921800 +0800
+++ source/scripts/engine_weap.cpp 2012-05-23 10:59:15.286132800 +0800
@@ -44,18 +44,19 @@
}
-
+#ifndef TT_EXPORTS
RENEGADE_FUNCTION
void C4GameObj::Defuse()
AT2(0x0070D610,0x0070CBD0);
+#endif
SCRIPTS_API int Get_Current_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -81,7 +82,7 @@
int at = AmmoDef->AmmoType;
if (!Owner && Player && AmmoDef && (1 != at))
{
- TT_FOREACH(object, (SList&)GameObjManager::SmartGameObjList)
+ TT_FOREACH(object, GameObjManager::StarGameObjList)
{
if (object->Get_Player_Data() == Player)
{
@@ -104,11 +105,11 @@
SCRIPTS_API int Get_Current_Clip_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -129,11 +130,11 @@
SCRIPTS_API int Get_Current_Total_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -160,11 +161,11 @@
SCRIPTS_API int Get_Position_Bullets(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -185,11 +186,11 @@
SCRIPTS_API int Get_Position_Clip_Bullets(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -210,11 +211,11 @@
SCRIPTS_API int Get_Position_Total_Bullets(GameObject *obj, int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -241,11 +242,11 @@
SCRIPTS_API int Get_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -273,11 +274,11 @@
SCRIPTS_API int Get_Clip_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -305,11 +306,11 @@
SCRIPTS_API int Get_Total_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -343,11 +344,11 @@
SCRIPTS_API int Get_Current_Max_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -368,11 +369,11 @@
SCRIPTS_API int Get_Current_Clip_Max_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -393,11 +394,11 @@
SCRIPTS_API int Get_Current_Total_Max_Bullets(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -424,11 +425,11 @@
SCRIPTS_API int Get_Position_Max_Bullets(GameObject *obj, int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -449,11 +450,11 @@
SCRIPTS_API int Get_Position_Clip_Max_Bullets(GameObject *obj, int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -474,11 +475,11 @@
SCRIPTS_API int Get_Position_Total_Max_Bullets(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -505,11 +506,11 @@
SCRIPTS_API int Get_Max_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -537,11 +538,11 @@
SCRIPTS_API int Get_Max_Clip_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -569,11 +570,11 @@
SCRIPTS_API int Get_Max_Total_Bullets(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -644,11 +645,11 @@
SCRIPTS_API const WeaponDefinitionClass *Get_Current_Weapon_Definition(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -673,11 +674,11 @@
SCRIPTS_API const WeaponDefinitionClass *Get_Position_Weapon_Definition(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -702,7 +703,11 @@
SCRIPTS_API const char *Get_Powerup_Weapon_By_Obj(GameObject *Powerup)
{
- const DefinitionClass *powerupdef = Get_Definition(Powerup);
+ if (!Powerup)
+ {
+ return "None";
+ }
+ const DefinitionClass *powerupdef = &Powerup->Get_Definition();
PowerUpGameObjDef *c = (PowerUpGameObjDef *)powerupdef;
if (!c)
{
@@ -718,11 +723,11 @@
SCRIPTS_API int Get_Current_Weapon_Style(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -743,11 +748,11 @@
SCRIPTS_API int Get_Position_Weapon_Style(GameObject *obj, int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -768,11 +773,11 @@
SCRIPTS_API int Get_Weapon_Style(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -800,11 +805,11 @@
SCRIPTS_API void Disarm_Beacon(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return;
@@ -820,11 +825,11 @@
SCRIPTS_API GameObject *Get_Beacon_Planter(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -855,7 +860,7 @@
}
-BeaconGameObj* Find_Nearest_Beacon(const Vector3& position, int team)
+SCRIPTS_API BeaconGameObj* Find_Nearest_Beacon(const Vector3& position, int team)
{
BeaconGameObj* beacon = nullptr;
float min_distance = std::numeric_limits::infinity();
@@ -882,11 +887,11 @@
SCRIPTS_API void Disarm_C4(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return;
@@ -981,35 +986,35 @@
SCRIPTS_API const char *Get_Current_Weapon(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
- return 0;
+ return "None";
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
- return 0;
+ return "None";
}
ArmedGameObj *o3 = o2->As_ArmedGameObj();
if (!o3)
{
- return 0;
+ return "None";
}
WeaponBagClass *w = o3->Get_Weapon_Bag();
if ((w->Get_Index()) && (w->Get_Index() < w->Get_Count()))
{
return w->Peek_Weapon(w->Get_Index())->Get_Name();
}
- return 0;
+ return "None";
}
SCRIPTS_API int Get_Weapon_Count(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -1025,35 +1030,35 @@
SCRIPTS_API const char *Get_Weapon(GameObject *obj,int position)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
- return 0;
+ return "None";
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
- return 0;
+ return "None";
}
ArmedGameObj *o3 = o2->As_ArmedGameObj();
if (!o3)
{
- return 0;
+ return "None";
}
WeaponBagClass *w = o3->Get_Weapon_Bag();
if ((position) && (position < w->Get_Count()))
{
return (w->Peek_Weapon(position)->Get_Name());
}
- return 0;
+ return "None";
}
SCRIPTS_API bool Has_Weapon(GameObject *obj,const char *weapon)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -1136,11 +1141,11 @@
SCRIPTS_API int Get_C4_Mode(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -1155,11 +1160,11 @@
SCRIPTS_API GameObject *Get_C4_Planter(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -1175,11 +1180,11 @@
SCRIPTS_API GameObject *Get_C4_Attached(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return 0;
}
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2)
{
return 0;
@@ -1193,12 +1198,12 @@
return (GameObject *)o3->Get_Stuck_Object();
}
-WeaponClass* ArmedGameObj::Get_Weapon()
+SCRIPTS_API WeaponClass* ArmedGameObj::Get_Weapon()
{
return WeaponBag->Get_Weapon();
}
-int WeaponClass::Get_Total_Rounds()
+SCRIPTS_API int WeaponClass::Get_Total_Rounds()
{
if (InventoryRounds < 0)
{
@@ -1207,7 +1212,7 @@
return ClipRounds + InventoryRounds;
}
-float WeaponClass::Get_Range( void )
+SCRIPTS_API float WeaponClass::Get_Range( void )
{
return ( PrimaryAmmoDefinition != NULL ) ? PrimaryAmmoDefinition->Range : 0;
}
diff -uwr sourceold/scripts/engine_weap.h source/scripts/engine_weap.h
--- sourceold/scripts/engine_weap.h 2011-10-11 21:53:12.073242100 +0800
+++ source/scripts/engine_weap.h 2012-05-23 11:32:21.548828100 +0800
@@ -15,7 +15,7 @@
class AmmoDefinitionClass;
class WeaponDefinitionClass;
class ExplosionDefinitionClass;
-
+class BeaconGameObj;
SCRIPTS_API int Get_Current_Bullets(GameObject *obj); //Get loaded bullets for an objects current gun
SCRIPTS_API int Get_Current_Clip_Bullets(GameObject *obj); //Get clip/backpack bullets for an objects current gun
SCRIPTS_API int Get_Current_Total_Bullets(GameObject *obj); //Get total bullets for an objects current gun
@@ -72,5 +72,5 @@
SCRIPTS_API GameObject *Get_C4_Planter(GameObject *obj); //Gets the planter of a C4GameObj
SCRIPTS_API GameObject *Get_C4_Attached(GameObject *obj); //Gets the object a C4GameObj is attached to (if any)
SCRIPTS_API GameObject *Get_Beacon_Planter(GameObject *obj); //Gets the planter of a BeaconGameObj
-
+SCRIPTS_API BeaconGameObj* Find_Nearest_Beacon(const Vector3& position, int team); //Find the nearest beacon to a position
#endif
diff -uwr sourceold/scripts/gmbuilding.cpp source/scripts/gmbuilding.cpp
--- sourceold/scripts/gmbuilding.cpp 2011-10-11 23:04:38.933593700 +0800
+++ source/scripts/gmbuilding.cpp 2012-04-24 13:34:24.211914000 +0800
@@ -85,7 +85,12 @@
Create_2D_WAV_Sound_Team("m00bnol_dsgn0008i1evan_snd.wav",team);
Commands->Start_Timer(obj,this,30.0f,22223);
}
- else if (Is_VehicleFactory(obj))
+ else
+ {
+ BuildingGameObj *b = obj->As_BuildingGameObj();
+ if (b)
+ {
+ if (b->As_WarFactoryGameObj())
{
char repairmsg[250];
const char *bld = Get_Translated_Preset_Name_Ex(obj);
@@ -102,7 +107,7 @@
}
Commands->Start_Timer(obj,this,30.0f,22223);
}
- else if (Is_SoldierFactory(obj))
+ else if (b->As_SoldierFactoryGameObj())
{
char repairmsg[250];
const char *bld = Get_Translated_Preset_Name_Ex(obj);
@@ -111,7 +116,7 @@
delete[] bld;
if (team == 0)
{
- Create_2D_WAV_Sound_Team("m00bnhn_dsgn0016i1evan_snd.wav",team);
+ Create_2D_WAV_Sound_Team("m00bnhn_dsgn0015i1evag_snd.wav",team);
}
else if (team == 1)
{
@@ -119,7 +124,7 @@
}
Commands->Start_Timer(obj,this,30.0f,22223);
}
- else if (Is_Refinery(obj))
+ else if (b->As_RefineryGameObj())
{
char repairmsg[250];
const char *bld = Get_Translated_Preset_Name_Ex(obj);
@@ -136,7 +141,7 @@
}
Commands->Start_Timer(obj,this,30.0f,22223);
}
- else if (Is_PowerPlant(obj))
+ else if (b->As_PowerPlantGameObj())
{
char repairmsg[250];
const char *bld = Get_Translated_Preset_Name_Ex(obj);
@@ -159,6 +164,8 @@
}
}
}
+ }
+}
void SSGM_Building::Timer_Expired(GameObject *obj, int number)
{
@@ -214,7 +221,7 @@
delete[] str;
delete[] str2;
- if ( (Is_ConstructionYard(obj)) || (Is_Script_Attached(obj,"TDA_ConYard_Controller")) )
+ if ( ((obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_ConstructionYardGameObj())) || (Is_Script_Attached(obj,"TDA_ConYard_Controller")) )
{
if (Get_Object_Type(obj) == 1)
{
@@ -227,7 +234,7 @@
Create_2D_WAV_Sound_Team("m00bncy_kill0002i1evag_snd.wav",1);
}
}
- else if (Is_ComCenter(obj))
+ else if (obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_ComCenterGameObj())
{
if (Get_Object_Type(obj) == 1)
{
@@ -240,7 +247,7 @@
Create_2D_WAV_Sound_Team("m00bncc_kill0002i1evag_snd.wav",1);
}
}
- else if (Is_RepairBay(obj))
+ else if (obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_RepairBayGameObj())
{
if (Get_Object_Type(obj) == 1)
{
diff -uwr sourceold/scripts/gmgame.cpp source/scripts/gmgame.cpp
--- sourceold/scripts/gmgame.cpp 2012-02-18 09:50:34.050781200 +0800
+++ source/scripts/gmgame.cpp 2012-05-16 00:26:42.453125000 +0800
@@ -97,13 +97,13 @@
const char *Get_Translated_Preset_Name_Part(GameObject *obj)
{
- if (!obj || !Commands->Get_ID(obj))
+ if (!obj)
{
return newstr("None");
}
const char *preset = Get_Translated_Preset_Name_Ini(obj);
StringClass preset2 = preset;
- if (Is_Building(obj) || Is_DecorationPhys(obj) || Is_Harvester_Preset(obj))
+ if (obj->As_BuildingGameObj() || (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_DecorationPhysClass()) || Is_Harvester_Preset(obj))
{
const char *str = Get_Team_Name(Get_Object_Type(obj));
if (!stristr(preset,str))
@@ -120,7 +120,11 @@
SCRIPTS_API const char *Get_Translated_Preset_Name_Ini(GameObject *obj)
{
- if (Is_C4(obj))
+ if (!obj)
+ {
+ return newstr("");
+ }
+ if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_C4GameObj())
{
if (Get_C4_Mode(obj) == 1)
{
@@ -153,7 +157,7 @@
SCRIPTS_API const char *Get_Translated_Preset_Name_Ex(GameObject *obj)
{
- if (!Commands->Get_ID(obj) || (!obj))
+ if (!obj)
{
return newstr("None");
}
@@ -245,6 +249,7 @@
h->hook = ObjectCreateHook;
AddObjectCreateHook(h);
AddLoadLevelHook(LoadLevelHook);
+ AddPreLoadLevelHook(PreLoadLevelHook);
AddGameOverHook(GameOverHook);
AddPlayerJoinHook(PlayerJoinHook);
AddPlayerLeaveHook(PlayerLeaveHook);
@@ -369,7 +374,7 @@
return true;
}
-bool SSGMGameManager::RadioHook(int PlayerType, int PlayerID, int AnnouncementID, int IconID, uint8 AnnouncementType)
+bool SSGMGameManager::RadioHook(int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType)
{
for (int i = 0;i < RegisteredEvents[EVENT_RADIO_HOOK].Count();i++)
{
@@ -416,18 +421,18 @@
Commands->Apply_Damage(obj,99999,"Death",0);
}
}
- else if (Is_Powerup(obj))
+ else if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_PowerUpGameObj())
{
if (PlayPowerupSounds)
{
Attach_Script_Once(obj,"SSGM_Powerup","");
}
}
- else if (Is_Beacon(obj))
+ else if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_BeaconGameObj())
{
Attach_Script_Once(obj,"SSGM_Log_Beacon","");
}
- else if (Is_C4(obj))
+ else if (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->As_C4GameObj())
{
Attach_Script_Once(obj,"SSGM_Log_Mine","");
}
@@ -683,6 +688,14 @@
Release_INI(SSGMIni);
}
+void SSGMGameManager::PreLoadLevelHook()
+{
+ for (int i = 0;i < RegisteredEvents[EVENT_PRE_LOAD_LEVEL_HOOK].Count();i++)
+ {
+ RegisteredEvents[EVENT_PRE_LOAD_LEVEL_HOOK][i]->OnPreLoadLevel();
+ }
+}
+
void SSGMGameManager::LoadLevelHook()
{
RawFileClass file("SSGM.ini");
@@ -710,23 +723,23 @@
BuildingGameObj *o = x->Data();
if (o)
{
- if (DisablePowerPlants && o->As_PowerPlantGameObj())
+ if (DisablePowerPlants && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_POWER_PLANT)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableRefineries && o->As_RefineryGameObj())
+ else if (DisableSoldierFactories && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_SOLDIER_FACTORY)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableSoldierFactories && o->As_SoldierFactoryGameObj())
+ else if (DisableVehicleFactories && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_VEHICLE_FACTORY)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableVehicleFactories && o->As_VehicleFactoryGameObj())
+ else if (DisableRefineries && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_REFINERY)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableRepairPads && o->As_RepairBayGameObj())
+ else if (DisableCommCenters && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_COM_CENTER)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
@@ -734,11 +747,15 @@
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableCommCenters && o->As_ComCenterGameObj())
+ else if (DisableShrines && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_SHRINE)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableConstructionYards && o->As_ConstructionYardGameObj())
+ else if (DisableHelipads && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_HELIPAD)
+ {
+ Commands->Apply_Damage(o,99999,"Death",0);
+ }
+ else if (DisableConstructionYards && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_CONYARD)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
@@ -746,11 +763,15 @@
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableShrines && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_SHRINE)
+ else if (DisableTechCenters && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_TECH_CENTER)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
- else if (DisableHelipads && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_HELIPAD)
+ else if (DisableNavalFactories && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_NAVAL_FACTORY)
+ {
+ Commands->Apply_Damage(o,99999,"Death",0);
+ }
+ else if (DisableSpecials && o->Get_Definition().Get_Type() == BuildingConstants::TYPE_SPECIAL)
{
Commands->Apply_Damage(o,99999,"Death",0);
}
@@ -761,15 +782,15 @@
}
x = x->Next();
}
- SLNode *x2 = GameObjManager::SmartGameObjList.Head();
+ SLNode *x2 = GameObjManager::VehicleGameObjList.Head();
while (x2)
{
- SmartGameObj *o = x2->Data();
+ VehicleGameObj *o = x2->Data();
if (o)
{
- if (o->As_VehicleGameObj())
+ if (o)
{
- if (o->As_VehicleGameObj()->Is_Turret())
+ if (o->Is_Turret())
{
if (DisableBaseDefenses)
{
@@ -1101,6 +1122,8 @@
void SSGM_Log_Mine::Created(GameObject *obj)
{
+ WasDetonated = false;
+ WasDisarmed = false;
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)), Get_Object_Type(obj),Commands->Get_ID(Get_C4_Planter(obj)));
}
@@ -1110,6 +1133,12 @@
Vector3 pos = Commands->Get_Position(obj);
if (!WasDisarmed && WasDetonated)
{
+ StringClass str;
+ const char *str4 = Get_Team_Name(Get_Object_Type(obj));
+ 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);
+ 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));
}
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));
@@ -1137,6 +1166,15 @@
const char *str = Get_Translated_Preset_Name_Ex(obj);
const char *str2 = Get_Translated_Preset_Name_Ex(killer);
SSGMGameLog::Log_Gamelog("KILLED;OBJECT;%d;%s;%d;%d;%d;%d;%d;%s;%d;%d;%d;%d;%s;%s;%s",Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(victimpos.Y), int(victimpos.X), int(victimpos.Z), int(Commands->Get_Facing(obj)), Commands->Get_ID(killer), Commands->Get_Preset_Name(killer), int(damagerpos.Y), int(damagerpos.X), int(damagerpos.Z), int(Commands->Get_Facing(killer)),Get_Current_Weapon(killer),str,str2);
+ StringClass str3;
+ const char *str4 = Get_Team_Name(Get_Object_Type(obj));
+ const char *str5 = Get_Translated_Preset_Name_Ini(obj);
+ const char *str6 = Get_Translated_Preset_Name_Ini(Get_C4_Attached(obj));
+ str3.Format("%s %s has been disarmed by %ls (Owner: %ls - Attached to: %s)",str4,str5,Get_Wide_Player_Name(killer),Get_Wide_Player_Name(Get_C4_Planter(obj)),str6);
+ delete[] str4;
+ delete[] str5;
+ delete[] str6;
+ SSGMGameLog::Log_Message(str3,"_C4");
delete[] str;
delete[] str2;
@@ -1145,13 +1183,17 @@
if (Commands->Get_Player_Type(killer) == 0)
{
char disarmer[250];
- sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),Get_Translated_Preset_Name_Ex(obj));
+ const char *s1 = Get_Translated_Preset_Name_Ex(obj);
+ sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),s1);
+ delete[] s1;
Send_Message_Team(0,104,234,40,disarmer);
}
else if (Commands->Get_Player_Type(killer) == 1)
{
char disarmer[250];
- sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),Get_Translated_Preset_Name_Ex(obj));
+ const char *s1 = Get_Translated_Preset_Name_Ex(obj);
+ sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),s1);
+ delete[] s1;
Send_Message_Team(1,104,234,40,disarmer);
}
}
@@ -1185,6 +1227,13 @@
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);
@@ -1200,7 +1249,9 @@
triggerrepairing = false;
int team = Commands->Get_Player_Type(damager);
char disarmer[250];
- sprintf(disarmer,"%ls is disarming a %s",Get_Wide_Player_Name(damager),Get_Translated_Preset_Name_Ex(obj));
+ const char *s1 = Get_Translated_Preset_Name_Ex(obj);
+ sprintf(disarmer,"%ls is disarming a %s",Get_Wide_Player_Name(damager),s1);
+ delete[] s1;
Send_Message_Team(team,104,234,40,disarmer);
Commands->Start_Timer(obj,this,15.0f,222222);
}
@@ -1217,15 +1268,35 @@
SSGMGameLog::Log_Gamelog("KILLED;OBJECT;%d;%s;%d;%d;%d;%d;%d;%s;%d;%d;%d;%d;%s;%s;%s",Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(victimpos.Y), int(victimpos.X), int(victimpos.Z), int(Commands->Get_Facing(obj)), Commands->Get_ID(killer), Commands->Get_Preset_Name(killer), int(damagerpos.Y), int(damagerpos.X), int(damagerpos.Z), int(Commands->Get_Facing(killer)),Get_Current_Weapon(killer),str,str2);
delete[] str;
delete[] str2;
+ StringClass str3;
+ const char *str4 = Get_Translated_Preset_Name_Ini(obj);
+ str3.Format("%ls disarmed a %s",Get_Wide_Player_Name(killer),str4);
+ SSGMGameLog::Log_Message(str3,"_BEACON");
+ delete[] str4;
if (ShowExtraMessages)
{
char disarmer[250];
- sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),Get_Translated_Preset_Name_Ex(obj));
+ const char *s1 = Get_Translated_Preset_Name_Ex(obj);
+ sprintf(disarmer,"%ls disarmed a %s",Get_Wide_Player_Name(killer),s1);
+ delete[] s1;
Send_Message(104,234,40,disarmer);
}
}
+void SSGM_Log_Beacon::Custom(GameObject *obj, int message, int param, GameObject *sender)
+{
+ if (message == CUSTOM_EVENT_BEACON_DEPLOYED)
+ {
+ StringClass str3;
+ const char *str4 = Get_Translated_Preset_Name_Ini(obj);
+ str3.Format("%ls deployed a %s",Get_Wide_Player_Name(sender),str4);
+ SSGMGameLog::Log_Message(str3,"_BEACON");
+ delete[] str4;
+ }
+}
+
+
void SSGM_Powerup_Expire::Created(GameObject *obj)
{
Commands->Start_Timer(obj,this,PowerupExpireTime,100);
@@ -1241,7 +1312,7 @@
void SSGM_Powerup::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
if (strstr(Commands->Get_Preset_Name(obj),"CnC_POW_MineRemote_02"))
{
@@ -1797,7 +1868,7 @@
void SSGM_Powerup_SBH::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_FlameThrower_2SF");
}
@@ -1805,7 +1876,7 @@
void SSGM_Powerup_Havoc::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,4);
if (RandomNum == 1)
@@ -1828,21 +1899,21 @@
}
void SSGM_Powerup_Deadeye::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_MiniGunner_2SF");
}
}
void SSGM_Powerup_BHSniper::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_Minigunner_2SF");
}
}
void SSGM_Powerup_Sakura::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,2);
if (RandomNum == 1)
@@ -1857,7 +1928,7 @@
}
void SSGM_Powerup_SydneyPower::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,2);
if (RandomNum == 1)
@@ -1872,7 +1943,7 @@
}
void SSGM_Powerup_Raveshaw::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,2);
if (RandomNum == 1)
@@ -1887,7 +1958,7 @@
}
void SSGM_Powerup_Mobius::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,2);
if (RandomNum == 1)
@@ -1902,7 +1973,7 @@
}
void SSGM_Powerup_Mendoza::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
int RandomNum = Commands->Get_Random_Int(1,2);
if (RandomNum == 1)
@@ -1917,42 +1988,42 @@
}
void SSGM_Powerup_Hotwire::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_Engineer_2SF");
}
}
void SSGM_Powerup_Technician::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_Technician_0");
}
}
void SSGM_Powerup_Gunner::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_RocketSoldier_2SF");
}
}
void SSGM_Powerup_LCG::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_RocketSoldier_2SF");
}
}
void SSGM_Powerup_Patch::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_Grenadier_2SF");
}
}
void SSGM_Powerup_Nod_Officer::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_Minigunner_1Off");
}
@@ -1960,7 +2031,7 @@
void SSGM_Powerup_GDI_Officer::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_MiniGunner_1Off");
}
@@ -1968,7 +2039,7 @@
void SSGM_Powerup_GDI_Sydney::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Sydney");
}
@@ -1976,7 +2047,7 @@
void SSGM_Powerup_Chemwar::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_FlameThrower_1Off");
}
@@ -1984,7 +2055,7 @@
void SSGM_Powerup_GDI_RSoldier::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_GDI_RocketSoldier_1Off");
}
@@ -1992,7 +2063,7 @@
void SSGM_Powerup_Nod_RSoldier::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000025)
+ if (message == CUSTOM_EVENT_POWERUP_GRANTED)
{
Change_Character(sender,"CnC_Nod_RocketSoldier_1Off");
}
diff -uwr sourceold/scripts/gmgame.h source/scripts/gmgame.h
--- sourceold/scripts/gmgame.h 2012-02-18 09:50:34.061523400 +0800
+++ source/scripts/gmgame.h 2012-05-16 00:26:41.498046800 +0800
@@ -12,14 +12,16 @@
#ifndef TT_INCLUDE_GMGAME_H
#define TT_INCLUDE_GMGAME_H
#include "gmplugin.h"
+#include "engine_ttdef.h"
class SSGMGameManager {
public:
static void Init();
static void Shutdown();
static bool ChatHook(int PlayerID,TextMessageEnum Type,const wchar_t *Message,int recieverID);
- static bool RadioHook(int PlayerType, int PlayerID, int AnnouncementID, int IconID, uint8 AnnouncementType);
+ static bool RadioHook(int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType);
static void ObjectCreateHook(void *data,GameObject *obj);
static void LoadLevelHook();
+ static void PreLoadLevelHook();
static void GameOverHook();
static void ConsoleOutputHook(const char *output);
static void LogFileHook(const char *output);
@@ -54,6 +56,7 @@
void Destroyed(GameObject *obj);
void Killed(GameObject *obj, GameObject *shooter);
void Damaged(GameObject *obj, GameObject *damager, float damage);
+ void Custom(GameObject *obj, int message, int param, GameObject *sender);
void Timer_Expired(GameObject *obj, int number);
public: void Register_Auto_Save_Variables();
bool triggerrepairing;
diff -uwr sourceold/scripts/gmplugin.h source/scripts/gmplugin.h
--- sourceold/scripts/gmplugin.h 2012-02-18 09:50:34.054687500 +0800
+++ source/scripts/gmplugin.h 2012-05-16 00:27:18.326171800 +0800
@@ -32,6 +32,7 @@
EVENT_RADIO_HOOK,
EVENT_STOCK_DAMAGE_HOOK,
EVENT_TT_DAMAGE_HOOK,
+ EVENT_PRE_LOAD_LEVEL_HOOK,
EVENT_COUNT
};
@@ -54,9 +55,10 @@
virtual int OnVehiclePurchase(BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data) {return -1;}; //called on vehicle purchase
virtual int OnCharacterPurchase(BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data) {return -1;}; //called on character purchase
virtual void OnThink() {}; //called once per frame
- virtual bool OnRadioCommand(int PlayerType, int PlayerID, int AnnouncementID, int IconID, uint8 AnnouncementType) {return true;} //called on radio command
+ virtual bool OnRadioCommand(int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType) {return true;} //called on radio command
virtual bool OnStockDamage(PhysicalGameObj* damager, PhysicalGameObj* target, float damage, uint warheadId) { return true; } //called on damage from clients with version <4.0
virtual bool OnTtDamage(PhysicalGameObj* damager, PhysicalGameObj* target, const AmmoDefinitionClass* ammo, const char* bone) { return true; } //called on damage from clients with version >=4.0
+ virtual void OnPreLoadLevel() {}; //called on level load but before the client is sent any network updates
};
typedef Plugin *(*Plugin_Init_Type) ();
diff -uwr sourceold/scripts/gmsoldier.cpp source/scripts/gmsoldier.cpp
--- sourceold/scripts/gmsoldier.cpp 2011-10-11 23:04:34.123046800 +0800
+++ source/scripts/gmsoldier.cpp 2012-05-23 10:18:54.079101500 +0800
@@ -127,7 +127,7 @@
delete[] str;
}
-void SSGM_Soldier::Detatch(GameObject *obj)
+void SSGM_Soldier::Detach(GameObject *obj)
{
Unbind_Vehicle(obj, true);
}
diff -uwr sourceold/scripts/gmsoldier.h source/scripts/gmsoldier.h
--- sourceold/scripts/gmsoldier.h 2011-10-11 21:52:39.229492100 +0800
+++ source/scripts/gmsoldier.h 2012-05-23 10:18:54.011718700 +0800
@@ -16,7 +16,7 @@
unsigned int RefillTime;
void Created(GameObject *obj);
void Destroyed(GameObject *obj);
- void Detatch(GameObject *obj);
+ void Detach(GameObject *obj);
void Damaged(GameObject *obj,GameObject *damager,float amount);
void Killed(GameObject *obj,GameObject *killer);
void Custom(GameObject *obj, int message, int param, GameObject *sender);
diff -uwr sourceold/scripts/gmvehicle.cpp source/scripts/gmvehicle.cpp
--- sourceold/scripts/gmvehicle.cpp 2012-02-17 17:47:52.633789000 +0800
+++ source/scripts/gmvehicle.cpp 2012-05-23 10:18:53.952148400 +0800
@@ -21,10 +21,10 @@
#include "gmgame.h"
SCRIPTS_API VehicleGameObj *Find_My_Vehicle(GameObject *obj)
{
- SLNode *x = GameObjManager::SmartGameObjList.Head();
+ SLNode *x = GameObjManager::VehicleGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
+ VehicleGameObj *o = x->Data();
if (o)
{
SSGM_Vehicle *scr = (SSGM_Vehicle *)Find_Script_On_Object(o,"SSGM_Vehicle");
@@ -37,7 +37,7 @@
}
if (Commands->Find_Object(scr->OwnerID) == obj)
{
- return o->As_VehicleGameObj();
+ return o;
}
}
}
@@ -237,9 +237,17 @@
triggerrepaired = true;
OwnerID = 0;
IconModelID = 0;
+ if (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET)
+ {
+ Vector3 pos = Commands->Get_Position(obj);
+ SSGMGameLog::Log_Gamelog("CREATED;BUILDING;%d;%s;%d;%d;%d;%d;%f;%f;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y),int(pos.X),int(pos.Z), int(Commands->Get_Facing(obj)), Commands->Get_Max_Health(obj),Commands->Get_Max_Shield_Strength(obj),Get_Object_Type(obj));
+ }
+ else
+ {
Vector3 pos = Commands->Get_Position(obj);
SSGMGameLog::Log_Gamelog("CREATED;VEHICLE;%d;%s;%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));
}
+}
void SSGM_Vehicle::Register_Auto_Save_Variables()
{
@@ -379,6 +387,18 @@
delete[] str6;
SSGMGameLog::Log_Message(str,"_VEHKILL");
}
+ if (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET)
+ {
+ Vector3 victimpos = Commands->Get_Position(obj);
+ Vector3 damagerpos = Commands->Get_Position(killer);
+ const char *str = Get_Translated_Preset_Name_Ex(obj);
+ const char *str2 = Get_Translated_Preset_Name_Ex(killer);
+ SSGMGameLog::Log_Gamelog("KILLED;BUILDING;%d;%s;%d;%d;%d;%d;%d;%s;%d;%d;%d;%d;%s;%s;%s",Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(victimpos.Y), int(victimpos.X), int(victimpos.Z), int(Commands->Get_Facing(obj)), Commands->Get_ID(killer), Commands->Get_Preset_Name(killer), int(damagerpos.Y), int(damagerpos.X), int(damagerpos.Z), int(Commands->Get_Facing(killer)),Get_Current_Weapon(killer),str,str2);
+ delete[] str;
+ delete[] str2;
+ }
+ else
+ {
Vector3 victimpos = Commands->Get_Position(obj);
Vector3 damagerpos = Commands->Get_Position(killer);
const char *str3 = Get_Translated_Preset_Name_Ex(obj);
@@ -387,6 +407,7 @@
delete[] str3;
delete[] str2;
}
+}
void SSGM_Vehicle::Destroyed(GameObject *obj)
{
@@ -394,11 +415,19 @@
{
Commands->Destroy_Object(Commands->Find_Object(IconModelID));
}
+ if (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET)
+ {
+ Vector3 pos = Commands->Get_Position(obj);
+ SSGMGameLog::Log_Gamelog("DESTROYED;BUILDING;%d;%s;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y), int(pos.X), int(pos.Z));
+ }
+ else
+ {
Vector3 pos = Commands->Get_Position(obj);
SSGMGameLog::Log_Gamelog("DESTROYED;VEHICLE;%d;%s;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y), int(pos.X), int(pos.Z));
}
+}
-void SSGM_Vehicle::Detatch(GameObject *obj)
+void SSGM_Vehicle::Detach(GameObject *obj)
{
if (Commands->Find_Object(IconModelID))
{
@@ -410,10 +439,19 @@
{
if (amount != 0)
{
+ if (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET)
+ {
+ Vector3 victimpos = Commands->Get_Position(obj);
+ Vector3 damagerpos = Commands->Get_Position(damager);
+ SSGMGameLog::Log_Gamelog("DAMAGED;BUILDING;%d;%s;%d;%d;%d;%d;%d;%s;%d;%d;%d;%d;%f;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(victimpos.Y), int(victimpos.X), int(victimpos.Z), int(Commands->Get_Facing(obj)), Commands->Get_ID(damager), Commands->Get_Preset_Name(damager), int(damagerpos.Y), int(damagerpos.X), int(damagerpos.Z), int(Commands->Get_Facing(damager)), amount, int(Commands->Get_Health(obj)), int(Commands->Get_Shield_Strength(obj)), int(Commands->Get_Points(obj)));
+ }
+ else
+ {
Vector3 victimpos = Commands->Get_Position(obj);
Vector3 damagerpos = Commands->Get_Position(damager);
SSGMGameLog::Log_Gamelog("DAMAGED;VEHICLE;%d;%s;%d;%d;%d;%d;%d;%s;%d;%d;%d;%d;%f;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(victimpos.Y), int(victimpos.X), int(victimpos.Z), int(Commands->Get_Facing(obj)), Commands->Get_ID(damager), Commands->Get_Preset_Name(damager), int(damagerpos.Y), int(damagerpos.X), int(damagerpos.Z), int(Commands->Get_Facing(damager)), amount, int(Commands->Get_Health(obj)), int(Commands->Get_Shield_Strength(obj)), int(Commands->Get_Points(damager)));
}
+ }
if (ShowExtraMessages)
{
if (triggerrepairing)
diff -uwr sourceold/scripts/gmvehicle.h source/scripts/gmvehicle.h
--- sourceold/scripts/gmvehicle.h 2011-10-11 21:52:37.589843700 +0800
+++ source/scripts/gmvehicle.h 2012-05-23 10:18:53.512695300 +0800
@@ -18,7 +18,7 @@
void Damaged(GameObject *obj,GameObject *damager,float amount);
void Killed(GameObject *obj,GameObject *killer);
void Destroyed(GameObject *obj);
- void Detatch(GameObject *obj);
+ void Detach(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
bool triggerrepairing;
bool triggerrepaired;
diff -uwr sourceold/scripts/iran_scripts.cpp source/scripts/iran_scripts.cpp
--- sourceold/scripts/iran_scripts.cpp 2012-01-05 21:21:34.000000000 +0800
+++ source/scripts/iran_scripts.cpp 2012-04-24 12:40:48.691406200 +0800
@@ -83,7 +83,7 @@
saved = Commands->Get_ID(enter);
Commands->Start_Timer(obj,this,2.5f,1);
}
- else if (Is_Vehicle(enter))
+ else if (enter->As_VehicleGameObj())
{
int type = Commands->Get_Player_Type(enter);
if ( type < 0 || type > 1 )
@@ -167,7 +167,7 @@
Commands->Start_Timer(obj,this,2.5f,1);
}
- else if (Is_Vehicle(enter))
+ else if (enter->As_VehicleGameObj())
{
if (Get_Vehicle_Mode(enter) != VEHICLE_TYPE_FLYING)
{
@@ -187,7 +187,7 @@
void Iran_Vehicle_Flying_Kill_Zone::Entered(GameObject *obj,GameObject *enter)
{
- if (Is_Vehicle(enter))
+ if (enter->As_VehicleGameObj())
{
if (Get_Vehicle_Mode(enter) == VEHICLE_TYPE_FLYING)
{
diff -uwr sourceold/scripts/jfwcine.cpp source/scripts/jfwcine.cpp
--- sourceold/scripts/jfwcine.cpp 2012-02-13 19:12:33.892000000 +0800
+++ source/scripts/jfwcine.cpp 2012-04-19 17:12:40.578125000 +0800
@@ -461,8 +461,8 @@
{
float facing = Commands->Get_Facing(Owner());
Vector3 position = Commands->Get_Position(Owner());
- position.X = (float)(cos(facing * 3.1415927 / 180) * 10 + position.X);
- position.Y = (float)(sin(facing * 3.1415927 / 180) * 10 + position.Y);
+ position.X += cos(DEG_TO_RADF(facing)) * 10.0f;
+ position.Y += sin(DEG_TO_RADF(facing)) * 10.0f;
position.Z += 2.0;
ActionParamsStruct params;
params.Set_Basic(this,99,1);
diff -uwr sourceold/scripts/jfwdef.cpp source/scripts/jfwdef.cpp
--- sourceold/scripts/jfwdef.cpp 2011-10-11 23:05:19.216796800 +0800
+++ source/scripts/jfwdef.cpp 2012-04-24 12:41:09.166015600 +0800
@@ -1497,7 +1497,7 @@
}
if (!Is_VTOL(enemy))
{
- SmartGameObj* obj1 = (SmartGameObj*)As_SmartGameObj(enemy);
+ SmartGameObj* obj1 = enemy->As_SmartGameObj();
if(!obj1
|| !obj1->Is_Stealthed()
|| Commands->Get_Distance(Commands->Get_Position(obj),Commands->Get_Position(enemy)) <= Get_Float_Parameter("MaxStealthAttackDistance"))
diff -uwr sourceold/scripts/jfwdmg.cpp source/scripts/jfwdmg.cpp
--- sourceold/scripts/jfwdmg.cpp 2012-02-13 19:32:56.397859400 +0800
+++ source/scripts/jfwdmg.cpp 2012-04-25 11:41:04.667968700 +0800
@@ -15,6 +15,7 @@
#include "engine.h"
#include "jfwdmg.h"
#include "BuildingGameObj.h"
+#include "VehicleGameObjDef.h"
void JFW_Spawn_Object_Death::Killed(GameObject *obj,GameObject *killer)
{
@@ -1049,7 +1050,7 @@
void JFW_Kill_Message_Display::Custom(GameObject *obj,int type,int param,GameObject *sender)
{
- if (!param)
+ if (!param || !Commands->Find_Object(param) ||!sender)
{
return;
}
@@ -1060,7 +1061,7 @@
KilledID = 0;
KilledPlayerID = Get_Player_ID(sender);
}
- else if (Is_Vehicle(sender) && (Get_Vehicle_Driver(sender)))
+ else if (sender->As_VehicleGameObj() && (Get_Vehicle_Driver(sender)))
{
KilledID = Commands->Get_Preset_ID(sender);
KilledPlayerID = Get_Player_ID(Get_Vehicle_Driver(sender));
@@ -1071,8 +1072,12 @@
KilledPlayerID = 0;
}
GameObject *Killer = Commands->Find_Object(param);
+ GameObject *explosion = GetExplosionObj();
+ if (!explosion || (explosion->As_VehicleGameObj() && Get_Vehicle_Mode(explosion) != VEHICLE_TYPE_TURRET))
+ {
Killer = Get_Vehicle_Return(Killer);
- if (Is_Soldier(Killer))
+ }
+ if (Killer->As_SoldierGameObj())
{
KillerTeam = Get_Object_Type(Killer);
if (Commands->Is_A_Star(Killer))
@@ -1084,7 +1089,6 @@
{
KillerPlayerID = 0;
}
- GameObject *explosion = GetExplosionObj();
if (explosion)
{
KillerID = Commands->Get_Preset_ID(explosion);
@@ -1094,10 +1098,9 @@
KillerID = Get_Definition_ID(Get_Current_Weapon(Killer));
}
}
- else if (Is_Vehicle(Killer))
+ else if (Killer->As_VehicleGameObj())
{
KillerID = Commands->Get_Preset_ID(Killer);
- GameObject *explosion = GetExplosionObj();
if (explosion)
{
KillerID = Commands->Get_Preset_ID(explosion);
@@ -1258,6 +1261,18 @@
return -1;
}
+void JFW_Spawn_Object_Repair::Damaged(GameObject *obj,GameObject *damager,float amount)
+{
+ if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj) && amount)
+ {
+ Vector3 pos = Commands->Get_Position(obj);
+ float facing = Commands->Get_Facing(obj);
+ Commands->Destroy_Object(obj);
+ GameObject *o = Commands->Create_Object(Get_Parameter("Object"),pos);
+ Commands->Set_Facing(o,facing);
+ }
+}
+
ScriptRegistrant JFW_Invulnerable_On_Create_Registrant("JFW_Invulnerable_On_Create","Time:float,TimerNum:int,InvulnerableArmour:string,NormalArmour:string");
ScriptRegistrant JFW_Destroy_Self_Timer_Registrant("JFW_Destroy_Self_Timer","Time:float,TimerNum:int");
ScriptRegistrant JFW_Change_Model_Health_Registrant("JFW_Change_Model_Health","Model:string,Health:float");
@@ -1312,3 +1327,4 @@
ScriptRegistrant JFW_C4_Explode_Registrant("JFW_C4_Explode","Preset:string,Explosion:string");
ScriptRegistrant JFW_Timer_Destroy_Object_Registrant("JFW_Timer_Destroy_Object","Time:float,TimerNum:int,Amount:float,Warhead:string");
ScriptRegistrant JFW_Beacon_Building_Registrant("JFW_Beacon_Building","");
+ScriptRegistrant JFW_Spawn_Object_Repair_Registrant("JFW_Spawn_Object_Repair","Object:string");
diff -uwr sourceold/scripts/jfwdmg.h source/scripts/jfwdmg.h
--- sourceold/scripts/jfwdmg.h 2011-10-14 22:27:32.069335900 +0800
+++ source/scripts/jfwdmg.h 2012-04-14 04:09:46.730468700 +0800
@@ -322,3 +322,7 @@
JFW_Beacon_Building() {pos = 0;}
~JFW_Beacon_Building();
};
+
+class JFW_Spawn_Object_Repair : public ScriptImpClass {
+ void Damaged(GameObject *obj,GameObject *damager,float amount);
+};
diff -uwr sourceold/scripts/jfwgame.cpp source/scripts/jfwgame.cpp
--- sourceold/scripts/jfwgame.cpp 2012-02-13 19:32:56.856843700 +0800
+++ source/scripts/jfwgame.cpp 2012-04-24 21:25:30.892578100 +0800
@@ -492,7 +492,7 @@
object = Commands->Find_Object(ID);
Commands->Send_Custom_Event(obj,object,Collected_Message,Cash,0);
pos = Commands->Get_Position(object);
- angle = Commands->Get_Facing(object);
+ angle = DEG_TO_RADF(Commands->Get_Facing(object));
pos.X+=Collected_Preset_Distance*(float)cos(angle);
pos.Y+=Collected_Preset_Distance*(float)sin(angle);
Commands->Create_Object(Collected_Preset,pos);
@@ -703,7 +703,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
enabled = false;
timertime = Get_Float_Parameter("Time");
@@ -883,7 +883,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
enabled = false;
if (Get_Int_Parameter("CinematicPowerOff") == 1)
@@ -1747,7 +1747,6 @@
if (HarvyID)
{
Commands->Apply_Damage(Commands->Find_Object(HarvyID),99999,"Explosive",0);
- if (!Commands->Get_ID(Commands->Find_Object(HarvyID))) Commands->Destroy_Object(Commands->Find_Object(HarvyID));
Commands->Destroy_Object(obj);
}
}
@@ -2295,6 +2294,8 @@
{
if (number == Get_Int_Parameter("TimerNum"))
{
+ if (Is_Base_Powered(Get_Object_Type(obj)))
+ {
Vector3 v = Commands->Get_Position(Find_Object_By_Preset(2,Get_Definition_Name(Get_Int_Parameter("CenterID"))));
if (Is_Unit_In_Range(Get_Parameter("Preset"),Get_Float_Parameter("Range"),v,PTTEAM(Get_Object_Type(obj)),false))
{
@@ -2316,6 +2317,7 @@
Enable_Base_Radar(Get_Object_Type(obj),true);
}
}
+ }
Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),Get_Int_Parameter("TimerNum"));
}
}
@@ -2342,11 +2344,14 @@
{
if (number == Get_Int_Parameter("TimerNum"))
{
+ if (Is_Base_Powered(Get_Object_Type(obj)))
+ {
Vector3 v = Commands->Get_Position(Find_Object_By_Preset(2,Get_Definition_Name(Get_Int_Parameter("CenterID"))));
if (Is_Unit_In_Range(Get_Parameter("Preset"),Get_Float_Parameter("Range"),v,PTTEAM(Get_Object_Type(obj)),false))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),Get_Object_Type(obj));
}
+ }
Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),Get_Int_Parameter("TimerNum"));
}
}
@@ -2700,6 +2705,31 @@
}
}
+void JFW_Low_Power_Sound::Created(GameObject *obj)
+{
+ lowpower = false;
+ Commands->Start_Timer(obj,this,1.0,1);
+}
+
+void JFW_Low_Power_Sound::Timer_Expired(GameObject *obj,int number)
+{
+ if (number == 1)
+ {
+ bool power = Is_Base_Powered(Commands->Get_Player_Type(obj));
+ if (power && lowpower)
+ {
+ lowpower = false;
+ Commands->Create_Sound(Get_Parameter("UpSound"),Commands->Get_Position(obj),obj);
+ }
+ if (!power && !lowpower)
+ {
+ lowpower = true;
+ Commands->Create_Sound(Get_Parameter("DownSound"),Commands->Get_Position(obj),obj);
+ }
+ Commands->Start_Timer(obj,this,1.0,1);
+ }
+}
+
void JFW_Message_Send_Zone::Entered(GameObject *obj,GameObject *enterer)
{
int team = Get_Int_Parameter("Player_Type");
@@ -3176,6 +3206,7 @@
ScriptRegistrant JFW_Stealth_Generator_Vehicle_Deploy_Registrant("JFW_Stealth_Generator_Vehicle_Deploy","Stealth_Range=50:int,Stealth_Controller:string");
ScriptRegistrant JFW_Stealth_Generator_Ignored_Registrant("JFW_Stealth_Generator_Ignored","");
ScriptRegistrant JFW_Low_Power_Message_Registrant("JFW_Low_Power_Message","Message:string");
+ScriptRegistrant JFW_Low_Power_Sound_Registrant("JFW_Low_Power_Sound","DownSound:string,UpSound:string");
ScriptRegistrant JFW_Message_Send_Zone_Registrant("JFW_Message_Send_Zone","Player_Type:int,Message:string,Red:int,Blue:int,Green:int,Sound:string,Delete:int");
ScriptRegistrant JFW_Message_Send_Zone_Team_Registrant("JFW_Message_Send_Zone_Team","Player_Type:int,Message:string,Red:int,Blue:int,Green:int,Sound:string,Delete:int");
ScriptRegistrant JFW_Message_Send_Zone_Player_Registrant("JFW_Message_Send_Zone_Player","Player_Type:int,Message:string,Red:int,Blue:int,Green:int,Sound:string,Delete:int");
diff -uwr sourceold/scripts/jfwgame.h source/scripts/jfwgame.h
--- sourceold/scripts/jfwgame.h 2012-02-13 18:26:32.682039000 +0800
+++ source/scripts/jfwgame.h 2012-04-14 04:09:46.572265600 +0800
@@ -342,6 +342,12 @@
void Timer_Expired(GameObject *obj,int number);
};
+class JFW_Low_Power_Sound : public ScriptImpClass {
+ bool lowpower;
+ void Created(GameObject *obj);
+ void Timer_Expired(GameObject *obj,int number);
+};
+
class JFW_Message_Send_Zone : public ScriptImpClass {
void Entered(GameObject *obj,GameObject *enterer);
};
diff -uwr sourceold/scripts/jfwmisc.cpp source/scripts/jfwmisc.cpp
--- sourceold/scripts/jfwmisc.cpp 2012-02-13 19:32:56.703523400 +0800
+++ source/scripts/jfwmisc.cpp 2012-06-09 08:50:40.669921800 +0800
@@ -25,6 +25,7 @@
#include "WeaponClass.h"
#include "VehicleFactoryGameObj.h"
#include "AirFactoryGameObj.h"
+#include "NavalFactoryGameObj.h"
#include "PurchaseSettingsDefClass.h"
void JFW_User_Settable_Parameters::Created(GameObject *obj)
@@ -914,7 +915,7 @@
void JFW_Radar_Low_Power::Killed(GameObject *obj,GameObject *killer)
{
- GameObject *o = Find_Building(Get_Object_Type(obj),BuildingConstants::TYPE_COM_CENTER);
+ GameObject *o = Find_Building_By_Type(Get_Object_Type(obj),BuildingConstants::TYPE_COM_CENTER);
if (o && !Is_Building_Dead(o))
{
Enable_Base_Radar(Get_Object_Type(obj),false);
@@ -1247,6 +1248,41 @@
Destroy_Script();
}
+void JFW_NavalFactory_Disable::Created(GameObject *obj)
+{
+ count = 0;
+}
+
+void JFW_NavalFactory_Disable::Custom(GameObject *obj,int type,int param,GameObject *sender)
+{
+ if (obj->As_BuildingGameObj() && obj->As_BuildingGameObj()->As_NavalFactoryGameObj())
+ {
+ if (type == Get_Int_Parameter("Disable_Custom"))
+ {
+ if (count == 0)
+ {
+ obj->As_BuildingGameObj()->As_NavalFactoryGameObj()->Set_Disabled(true);
+ PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_NAVAL,(PurchaseSettingsDefClass::TEAM)PTTEAM(Get_Object_Type(obj)))->Set_Page_Disabled(true);
+ }
+ count++;
+ }
+ if (type == Get_Int_Parameter("Enable_Custom"))
+ {
+ count--;
+ if (count == 0)
+ {
+ obj->As_BuildingGameObj()->As_NavalFactoryGameObj()->Set_Disabled(false);
+ PurchaseSettingsDefClass::Find_Definition(PurchaseSettingsDefClass::TYPE_NAVAL,(PurchaseSettingsDefClass::TEAM)PTTEAM(Get_Object_Type(obj)))->Set_Page_Disabled(false);
+ }
+ }
+ }
+}
+
+void JFW_NavalFactory_Disable::Killed(GameObject *obj,GameObject *killer)
+{
+ Destroy_Script();
+}
+
void JFW_Engineer_Hack::Created(GameObject *obj)
{
Warhead = ArmorWarheadManager::Get_Warhead_Type(Get_Parameter("Hack_Warhead"));
@@ -1340,11 +1376,12 @@
void JFW_EMP::Damaged(GameObject *obj,GameObject *damager,float amount)
{
- if (Warhead == Get_Damage_Warhead())
+ //if (Warhead == Get_Damage_Warhead())
{
VehicleGameObj *o = obj->As_VehicleGameObj();
if (o && o->Get_Is_Scripts_Visible() && !o->Is_Immovable())
{
+ Commands->Enable_Engine(obj,false);
o->Set_Immovable(true);
o->Set_Scripts_Can_Fire(false);
Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),1);
@@ -1360,6 +1397,7 @@
Commands->Set_Animation(obj,0,true,0,0,-1,false);
obj->Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE,true);
o->Set_Immovable(false);
+ Commands->Enable_Engine(obj,true);
o->Set_Scripts_Can_Fire(true);
}
@@ -1372,9 +1410,12 @@
void JFW_EMP_Mine::Enemy_Seen(GameObject *obj, GameObject *enemy)
{
+ if (enemy->As_VehicleGameObj())
+ {
Commands->Create_Explosion(Get_Parameter("Explosion"),Commands->Get_Position(obj),0);
Commands->Apply_Damage(obj,99999,"Death",0);
}
+}
void JFW_EMP_Mine::Destroyed(GameObject *obj)
{
@@ -1401,7 +1442,14 @@
SoldierGameObj *s = sender->As_SoldierGameObj();
if (s)
{
- GameObject *mine = Commands->Create_Object(Get_Parameter("Mine_Preset"),s->Get_Muzzle().Get_Translation());
+ Vector3 v = Commands->Get_Position(sender);
+ v.Z += Get_Float_Parameter("Mine_Z_Offset");
+ float len = Get_Float_Parameter("Mine_Distance");
+ float angle = DEG_TO_RADF(Commands->Get_Facing(sender));
+ v.X += cos(angle) * len;
+ v.Y += sin(angle) * len;
+ GameObject *mine = Commands->Create_Object(Get_Parameter("Mine_Preset"),v);
+ Commands->Set_Player_Type(mine,Commands->Get_Player_Type(sender));
PhysicalGameObj *p = mine->As_PhysicalGameObj();
p->Peek_Physical_Object()->Set_Collision_Group(TERRAIN_AND_BULLET_COLLISION_GROUP);
}
@@ -1532,6 +1580,10 @@
{
Destroy_Script();
}
+ if (min > max)
+ {
+ Destroy_Script();
+ }
float timer = Commands->Get_Random(min,max);
Commands->Start_Timer(obj,this,timer,1);
}
@@ -1550,24 +1602,28 @@
{
Destroy_Script();
}
+ if (min > max)
+ {
+ Destroy_Script();
+ }
float timer = Commands->Get_Random(min,max);
Commands->Start_Timer(obj,this,timer,2);
Commands->Set_Lightning(Get_Float_Parameter("Lightning_Intensity"),Get_Float_Parameter("Lightning_Start_Distance"),Get_Float_Parameter("Lightning_End_Distance"),Get_Float_Parameter("Lightning_Heading"),Get_Float_Parameter("Lightning_Distribution"),0);
- if (Find_Building(0,BuildingConstants::TYPE_COM_CENTER))
+ if (Find_Building_By_Type(0,BuildingConstants::TYPE_COM_CENTER))
{
- Commands->Send_Custom_Event(obj,Find_Building(0,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Disable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(0,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Disable_Custom"),0,0);
}
- if (Find_Building(1,BuildingConstants::TYPE_COM_CENTER))
+ if (Find_Building_By_Type(1,BuildingConstants::TYPE_COM_CENTER))
{
- Commands->Send_Custom_Event(obj,Find_Building(1,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Disable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(1,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Disable_Custom"),0,0);
}
- if (Find_Building(0,BuildingConstants::TYPE_POWER_PLANT))
+ if (Find_Building_By_Type(0,BuildingConstants::TYPE_POWER_PLANT))
{
- Commands->Send_Custom_Event(obj,Find_Building(0,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Disable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(0,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Disable_Custom"),0,0);
}
- if (Find_Building(1,BuildingConstants::TYPE_POWER_PLANT))
+ if (Find_Building_By_Type(1,BuildingConstants::TYPE_POWER_PLANT))
{
- Commands->Send_Custom_Event(obj,Find_Building(1,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Disable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(1,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Disable_Custom"),0,0);
}
Timer_Expired(obj,3);
Create_2D_Sound_Team(Get_Parameter("Announcement_Sound_Nod"),0);
@@ -1582,21 +1638,21 @@
{
storm = false;
Commands->Set_Lightning(Get_Float_Parameter("Lightning_Off_Intensity"),Get_Float_Parameter("Lightning_Off_Start_Distance"),Get_Float_Parameter("Lightning_Off_End_Distance"),Get_Float_Parameter("Lightning_Off_Heading"),Get_Float_Parameter("Lightning_Off_Distribution"),0);
- if (Find_Building(0,BuildingConstants::TYPE_COM_CENTER))
+ if (Find_Building_By_Type(0,BuildingConstants::TYPE_COM_CENTER))
{
- Commands->Send_Custom_Event(obj,Find_Building(0,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Enable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(0,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Enable_Custom"),0,0);
}
- if (Find_Building(1,BuildingConstants::TYPE_COM_CENTER))
+ if (Find_Building_By_Type(1,BuildingConstants::TYPE_COM_CENTER))
{
- Commands->Send_Custom_Event(obj,Find_Building(1,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Enable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(1,BuildingConstants::TYPE_COM_CENTER),Get_Int_Parameter("Enable_Custom"),0,0);
}
- if (Find_Building(0,BuildingConstants::TYPE_POWER_PLANT))
+ if (Find_Building_By_Type(0,BuildingConstants::TYPE_POWER_PLANT))
{
- Commands->Send_Custom_Event(obj,Find_Building(0,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Enable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(0,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Enable_Custom"),0,0);
}
- if (Find_Building(1,BuildingConstants::TYPE_POWER_PLANT))
+ if (Find_Building_By_Type(1,BuildingConstants::TYPE_POWER_PLANT))
{
- Commands->Send_Custom_Event(obj,Find_Building(1,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Enable_Custom"),0,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(1,BuildingConstants::TYPE_POWER_PLANT),Get_Int_Parameter("Enable_Custom"),0,0);
}
Create_2D_Sound_Team(Get_Parameter("End_Announcement_Sound_Nod"),0);
Create_2D_Sound_Team(Get_Parameter("End_Announcement_Sound_GDI"),1);
@@ -1615,6 +1671,10 @@
{
Destroy_Script();
}
+ if (min > max)
+ {
+ Destroy_Script();
+ }
float timer = Commands->Get_Random(min,max);
Commands->Start_Timer(obj,this,timer,1);
}
@@ -1628,6 +1688,181 @@
}
}
+void JFW_Tech_Level_Custom::Custom(GameObject *obj,int type,int param,GameObject *sender)
+{
+ if (type == Get_Int_Parameter("Message"))
+ {
+ Set_Tech_Level(Get_Int_Parameter("Tech_Level"));
+ Destroy_Script();
+ }
+}
+
+void JFW_Tech_Level_Startup::Created(GameObject *obj)
+{
+ Set_Tech_Level(Get_Int_Parameter("Tech_Level"));
+ Destroy_Script();
+}
+
+void JFW_Tech_Level_Timer::Created(GameObject *obj)
+{
+ Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),1);
+}
+void JFW_Tech_Level_Timer::Timer_Expired(GameObject *obj,int number)
+{
+ if (number == 1)
+ {
+ Commands->Create_2D_Sound(Get_Parameter("Sound"));
+ Send_Message(Get_Int_Parameter("Red"),Get_Int_Parameter("Green"),Get_Int_Parameter("Blue"),Get_Parameter("Display_Message"));
+ Set_Tech_Level(Get_Int_Parameter("Tech_Level"));
+ Destroy_Script();
+ }
+}
+
+void JFW_Change_Character_Created::Created(GameObject *obj)
+{
+ Change_Character(obj,Get_Parameter("Character"));
+ Destroy_Script();
+}
+
+void JFW_Spawn_Object_Created::Created(GameObject *obj)
+{
+ Commands->Create_Object(Get_Parameter("Object"),Commands->Get_Position(obj));
+ Destroy_Script();
+}
+
+void JFW_Change_Model_Created::Created(GameObject *obj)
+{
+ const char *model = 0;
+ do
+ {
+ int rand = Commands->Get_Random_Int(0,6);
+ if (rand == 1)
+ {
+ model = Get_Parameter("Model1");
+ }
+ if (rand == 2)
+ {
+ model = Get_Parameter("Model2");
+ }
+ if (rand == 3)
+ {
+ model = Get_Parameter("Model3");
+ }
+ if (rand == 4)
+ {
+ model = Get_Parameter("Model4");
+ }
+ if (rand == 5)
+ {
+ model = Get_Parameter("Model5");
+ }
+ } while (!model || !model[0]);
+ Commands->Set_Model(obj,model);
+ Destroy_Script();
+}
+
+extern REF_DECL2(NodHouseColor, Vector3);
+extern REF_DECL2(GDIHouseColor, Vector3);
+extern REF_DECL2(PublicMessageColor, Vector3);
+void JFW_Killed_String_Sound::Killed(GameObject *obj,GameObject *killer)
+{
+ if (Get_Object_Type(obj) == 0)
+ {
+ int red = (int)(NodHouseColor.X * 255);
+ int green = (int)(NodHouseColor.Y * 255);
+ int blue = (int)(NodHouseColor.Z * 255);
+ int stringgdi = Get_Int_Parameter("Nod_String_GDI");
+ if (stringgdi && Is_Valid_String_ID(stringgdi))
+ {
+ const char *str = Get_Translated_String(stringgdi);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringgdi);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringnod = Get_Int_Parameter("Nod_String_Nod");
+ if (stringnod && Is_Valid_String_ID(stringnod))
+ {
+ const char *str = Get_Translated_String(stringnod);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringnod);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
+ }
+ else if (Get_Object_Type(obj) == 1)
+ {
+ int red = (int)(GDIHouseColor.X * 255);
+ int green = (int)(GDIHouseColor.Y * 255);
+ int blue = (int)(GDIHouseColor.Z * 255);
+ int stringgdi = Get_Int_Parameter("GDI_String_GDI");
+ if (stringgdi && Is_Valid_String_ID(stringgdi))
+ {
+ const char *str = Get_Translated_String(stringgdi);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringgdi);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringnod = Get_Int_Parameter("GDI_String_Nod");
+ if (stringnod && Is_Valid_String_ID(stringnod))
+ {
+ const char *str = Get_Translated_String(stringnod);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringnod);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
+ }
+ else
+ {
+ int red = (int)(PublicMessageColor.X * 255);
+ int green = (int)(PublicMessageColor.Y * 255);
+ int blue = (int)(PublicMessageColor.Z * 255);
+ int stringgdi = Get_Int_Parameter("Neutral_String_GDI");
+ if (stringgdi && Is_Valid_String_ID(stringgdi))
+ {
+ const char *str = Get_Translated_String(stringgdi);
+ Send_Message_Team(1,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringgdi);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),1);
+ }
+ }
+ int stringnod = Get_Int_Parameter("Neutral_String_Nod");
+ if (stringnod && Is_Valid_String_ID(stringnod))
+ {
+ const char *str = Get_Translated_String(stringnod);
+ Send_Message_Team(0,red,green,blue,str);
+ delete[] str;
+ int soundId = Get_String_Sound_ID(stringnod);
+ if (soundId && Is_Valid_Preset_ID(soundId) && Find_Definition(soundId)->Get_Class_ID() == 0x5000)
+ {
+ Create_2D_Sound_Team(Get_Definition_Name(soundId),0);
+ }
+ }
+ }
+}
+
+
+ScriptRegistrant JFW_Tech_Level_Timer_Registrant("JFW_Tech_Level_Timer","Display_Message:string,Red:int,Blue:int,Green:int,Sound:string,Time:float,Tech_Level:int");
+ScriptRegistrant JFW_Tech_Level_Startup_Registrant("JFW_Tech_Level_Startup","Tech_Level:int");
+ScriptRegistrant JFW_Tech_Level_Custom_Registrant("JFW_Tech_Level_Custom","Message:int,Tech_Level:int");
+
ScriptRegistrant JFW_Stealthable_Object_Registrant("JFW_Stealthable_Object","Message:int");
ScriptRegistrant JFW_Object_Counter_Registrant("JFW_Object_Counter","Count:int,IncrementMessage:int,DecrementMessage:int");
ScriptRegistrant JFW_Fog_Create_Registrant("JFW_Fog_Create","Fog_Enable:int,Fog_Start_Distance=0.000:float,Fog_End_Distance=0.000:float,Delay=0.000:float,OnCreate=0:int,OnDestroy=0:int");
@@ -1691,9 +1926,10 @@
ScriptRegistrant JFW_Refinery_Disable_Registrant("JFW_Refinery_Disable","Disable_Custom:int,Enable_Custom:int");
ScriptRegistrant JFW_VehicleFactory_Disable_Registrant("JFW_VehicleFactory_Disable","Disable_Custom:int,Enable_Custom:int");
ScriptRegistrant JFW_AirFactory_Disable_Registrant("JFW_AirFactory_Disable","Disable_Custom:int,Enable_Custom:int");
+ScriptRegistrant JFW_NavalFactory_Disable_Registrant("JFW_NavalFactory_Disable","Disable_Custom:int,Enable_Custom:int");
ScriptRegistrant JFW_EMP_Registrant("JFW_EMP","Warhead:string,Time:fload,Animation:string");
ScriptRegistrant JFW_EMP_Mine_Registrant("JFW_EMP_Mine","Mine_Manager_ID:int,Explosion:string");
-ScriptRegistrant JFW_EMP_Mine_Manager_Registrant("JFW_EMP_Mine_Manager","Mine_Preset:string,Mine_Limit:int,Mine_Reload:string");
+ScriptRegistrant JFW_EMP_Mine_Manager_Registrant("JFW_EMP_Mine_Manager","Mine_Preset:string,Mine_Limit:int,Mine_Reload:string,Mine_Z_Offset:float,Mine_Distance:float");
ScriptRegistrant JFW_EMP_Mine_Layer_Registrant("JFW_EMP_Mine_Layer","Mine_Manager_ID:int,Warhead:string");
ScriptRegistrant JFW_Radar_Disable_Death_Registrant("JFW_Radar_Disable_Death","");
ScriptRegistrant JFW_Cyborg_Reaper_Registrant("JFW_Cyborg_Reaper","");
@@ -1702,3 +1938,7 @@
ScriptRegistrant JFW_Death_Send_Custom_Self_Registrant("JFW_Death_Send_Custom_Self","Message:int");
ScriptRegistrant JFW_Hunter_Seeker_Registrant("JFW_Hunter_Seeker","Key:string,Explosion:string");
ScriptRegistrant JFW_Ion_Storm_Registrant("JFW_Ion_Storm","Min_Delay:float,Max_Delay:float,Min_Time:float,Max_Time:float,Disable_Custom:int,Enable_Custom:int,Announcement_Sound_Nod:string,Announcement_Sound_GDI:string,Announcement_String:string,Red:int,Green:int,Blue:int,Ion_Effect_Sound:string,Ion_Effect_Time:float,Lightning_Intensity:float,Lightning_Start_Distance:float,Lightning_End_Distance:float,Lightning_Heading:float,Lightning_Distribution:float,Lightning_Off_Intensity:float,Lightning_Off_Start_Distance:float,Lightning_Off_End_Distance:float,Lightning_Off_Heading:float,Lightning_Off_Distribution:float,End_Announcement_Sound_Nod:string,End_Announcement_Sound_GDI:string,End_Announcement_String:string");
+ScriptRegistrant JFW_Change_Character_Created_Registrant("JFW_Change_Character_Created","Character:string");
+ScriptRegistrant JFW_Change_Model_Created_Registrant("JFW_Change_Model_Created","Model1:string,Model2:string,Model3:string,Model4:string,Model5:string");
+ScriptRegistrant JFW_Spawn_Object_Created_Registrant("JFW_Spawn_Object_Created","Object:string");
+ScriptRegistrant JFW_Killed_String_Sound_Registrant("JFW_Killed_String_Sound","GDI_String_GDI:int,Nod_String_GDI:int,Neutral_String_GDI:int,GDI_String_Nod:int,Nod_String_Nod:int,Neutral_String_Nod:int");
diff -uwr sourceold/scripts/jfwmisc.h source/scripts/jfwmisc.h
--- sourceold/scripts/jfwmisc.h 2011-10-22 19:58:24.060546800 +0800
+++ source/scripts/jfwmisc.h 2012-04-24 10:06:13.417968700 +0800
@@ -327,6 +327,13 @@
unsigned int count;
};
+class JFW_NavalFactory_Disable : public ScriptImpClass {
+ void Created(GameObject *obj);
+ void Custom(GameObject *obj,int type,int param,GameObject *sender);
+ void Killed(GameObject *obj,GameObject *killer);
+ unsigned int count;
+};
+
class JFW_Engineer_Hack : public ScriptImpClass {
unsigned int Warhead;
int IndcatorID;
@@ -405,3 +412,32 @@
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
+
+class JFW_Tech_Level_Custom : public ScriptImpClass {
+ void Custom(GameObject *obj,int type,int param,GameObject *sender);
+};
+
+class JFW_Tech_Level_Startup : public ScriptImpClass {
+ void Created(GameObject *obj);
+};
+
+class JFW_Tech_Level_Timer : public ScriptImpClass {
+ void Created(GameObject *obj);
+ void Timer_Expired(GameObject *obj,int number);
+};
+
+class JFW_Change_Character_Created : public ScriptImpClass {
+ void Created(GameObject *obj);
+};
+
+class JFW_Change_Model_Created : public ScriptImpClass {
+ void Created(GameObject *obj);
+};
+
+class JFW_Spawn_Object_Created : public ScriptImpClass {
+ void Created(GameObject *obj);
+};
+
+class JFW_Killed_String_Sound : public ScriptImpClass {
+ void Killed(GameObject *obj,GameObject *killer);
+};
diff -uwr sourceold/scripts/jfwsnd.cpp source/scripts/jfwsnd.cpp
--- sourceold/scripts/jfwsnd.cpp 2012-02-13 19:12:33.200593700 +0800
+++ source/scripts/jfwsnd.cpp 2012-05-28 09:47:05.897078200 +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("MaxHealth")) && (Commands->Get_Health(obj) >= Get_Float_Parameter("MinHealth")))
{
if (enabled)
{
@@ -237,6 +237,76 @@
Auto_Save_Variable(&enabled,1,1);
}
+void JFW_2D_Sound_Damage_Range_Team::Created(GameObject *obj)
+{
+ enabled = true;
+}
+
+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 (enabled)
+ {
+ enabled = false;
+ Create_2D_Sound_Team(Get_Parameter("Sound"),Get_Object_Type(obj));
+ }
+ }
+ else
+ {
+ enabled = true;
+ }
+}
+
+void JFW_2D_Sound_Damage_Range_Team_String::Register_Auto_Save_Variables()
+{
+ Auto_Save_Variable(&enabled,1,1);
+}
+
+void JFW_2D_Sound_Damage_Range_Team_String::Created(GameObject *obj)
+{
+ enabled = true;
+}
+
+extern REF_DECL2(NodHouseColor, Vector3);
+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 (enabled)
+ {
+ enabled = false;
+ Create_2D_Sound_Team(Get_Parameter("Sound"),Get_Object_Type(obj));
+ int red = 0;
+ int blue = 0;
+ int green = 0;
+ if (Get_Object_Type(obj) == 0)
+ {
+ red = (int)(NodHouseColor.X * 255);
+ green = (int)(NodHouseColor.Y * 255);
+ blue = (int)(NodHouseColor.Z * 255);
+ }
+ else
+ {
+ red = (int)(GDIHouseColor.X * 255);
+ green = (int)(GDIHouseColor.Y * 255);
+ blue = (int)(GDIHouseColor.Z * 255);
+ }
+ Send_Message_Team(Get_Object_Type(obj),red,green,blue,Get_Parameter("String"));
+ }
+ }
+ else
+ {
+ enabled = true;
+ }
+}
+
+void JFW_2D_Sound_Damage_Range_Team::Register_Auto_Save_Variables()
+{
+ Auto_Save_Variable(&enabled,1,1);
+}
+
void JFW_3D_Sound_Damage_Range::Created(GameObject *obj)
{
enabled = true;
@@ -430,7 +500,7 @@
c = Get_Parameter("Sound");
if (number == timernumber)
{
- if (Is_Vehicle(obj))
+ if (obj->As_VehicleGameObj())
{
if (Get_Vehicle_Occupant_Count(obj) >= Get_Vehicle_Seat_Count(obj))
{
@@ -514,6 +584,8 @@
ScriptRegistrant JFW_Fade_Background_Music_On_Enter_Registrant("JFW_Fade_Background_Music_On_Enter","Music:string,unk1:int,unk2:int");
ScriptRegistrant JFW_Stop_Background_Music_On_Enter_Registrant("JFW_Stop_Background_Music_On_Enter","");
ScriptRegistrant JFW_2D_Sound_Damage_Range_Registrant("JFW_2D_Sound_Damage_Range","Sound:string,MinHealth:float,MaxHealth:float");
+ScriptRegistrant JFW_2D_Sound_Damage_Range_Team_Registrant("JFW_2D_Sound_Damage_Range_Team","Sound:string,MinHealth:float,MaxHealth:float");
+ScriptRegistrant JFW_2D_Sound_Damage_Range_Team_String_Registrant("JFW_2D_Sound_Damage_Range_Team_String","Sound:string,MinHealth:float,MaxHealth:float,String:string");
ScriptRegistrant JFW_3D_Sound_Damage_Range_Registrant("JFW_3D_Sound_Damage_Range","Sound:string,MinHealth:float,MaxHealth:float,Offset:vector3");
ScriptRegistrant JFW_3D_Sound_Timer_Registrant("JFW_3D_Sound_Timer","Time:float,TimerNum:int,Repeat:int,Sound:string,Offset:vector3");
ScriptRegistrant JFW_2D_Sound_Damage_Registrant("JFW_2D_Sound_Damage","Sound:string,Health:float");
diff -uwr sourceold/scripts/jfwsnd.h source/scripts/jfwsnd.h
--- sourceold/scripts/jfwsnd.h 2011-10-14 22:27:31.957031200 +0800
+++ source/scripts/jfwsnd.h 2012-05-28 09:47:05.779890700 +0800
@@ -51,6 +51,20 @@
public: void Register_Auto_Save_Variables();
};
+class JFW_2D_Sound_Damage_Range_Team : public ScriptImpClass {
+ bool enabled;
+ void Created(GameObject *obj);
+ void Damaged(GameObject *obj,GameObject *damager,float amount);
+ public: void Register_Auto_Save_Variables();
+};
+
+class JFW_2D_Sound_Damage_Range_Team_String : public ScriptImpClass {
+ bool enabled;
+ void Created(GameObject *obj);
+ void Damaged(GameObject *obj,GameObject *damager,float amount);
+ public: void Register_Auto_Save_Variables();
+};
+
class JFW_3D_Sound_Damage_Range : public ScriptImpClass {
bool enabled;
void Created(GameObject *obj);
diff -uwr sourceold/scripts/jfwveh.cpp source/scripts/jfwveh.cpp
--- sourceold/scripts/jfwveh.cpp 2012-02-23 12:06:21.760742100 +0800
+++ source/scripts/jfwveh.cpp 2012-04-24 21:25:31.486328100 +0800
@@ -902,7 +902,7 @@
if (!active)
{
GameObject *vobj = 0;
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
vobj = enterer;
}
@@ -929,17 +929,22 @@
Vector3 pos2;
float distance;
GameObject *object = Commands->Find_Object(number);
+ if (!object)
+ {
+ return;
+ }
pos1 = Commands->Get_Position(obj);
pos2 = Commands->Get_Position(object);
distance = Commands->Get_Distance(pos1,pos2);
if (distance <= 10.0)
{
- if (Is_Vehicle(object))
+ if (object->As_VehicleGameObj())
{
if (Get_Vehicle_Mode(object) == VEHICLE_TYPE_FLYING && Get_Vehicle_Driver(object))
{
Commands->Give_PowerUp(object,Get_Parameter("Reload_Powerup"),false);
Commands->Start_Timer(obj, this, Get_Float_Parameter("Reload_Interval"), number);
+ active = true;
}
}
}
diff -uwr sourceold/scripts/jfwzone.cpp source/scripts/jfwzone.cpp
--- sourceold/scripts/jfwzone.cpp 2012-02-23 12:11:58.802734300 +0800
+++ source/scripts/jfwzone.cpp 2012-05-28 09:47:05.711531300 +0800
@@ -23,6 +23,7 @@
#include "BuildingGameObjDef.h"
#include "dp88_custom_timer_defines.h"
#include "PhysicalGameObj.h"
+#include "VehicleGameObj.h"
void JFW_3D_Sound_Zone::Entered(GameObject *obj,GameObject *enterer)
{
@@ -379,7 +380,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Commands->Start_Timer(obj,this,1.0,Commands->Get_ID(enterer));
}
@@ -399,13 +400,20 @@
float Health = Commands->Get_Health(Commands->Find_Object(number));
float Max_Shield_Strength = Commands->Get_Max_Shield_Strength(Commands->Find_Object(number));
float Shield_Strength = Commands->Get_Shield_Strength(Commands->Find_Object(number));
+ bool repair = false;
if (Health < Max_Health)
{
Commands->Set_Health(Commands->Find_Object(number),Health + Get_Float_Parameter("Repair_Health"));
+ repair = true;
}
if (Shield_Strength < Max_Shield_Strength)
{
Commands->Set_Shield_Strength(Commands->Find_Object(number),Shield_Strength + Get_Float_Parameter("Repair_Health"));
+ repair = true;
+ }
+ if (repair && Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
}
Commands->Start_Timer(obj,this,1.0,number);
}
@@ -420,7 +428,7 @@
}
if ((!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset1"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset2"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset3"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset4"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset5"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset6"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset7"))) || (!_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset8"))))
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Commands->Start_Timer(obj,this,1.0,Commands->Get_ID(enterer));
}
@@ -441,13 +449,20 @@
float Health = Commands->Get_Health(Commands->Find_Object(number));
float Max_Shield_Strength = Commands->Get_Max_Shield_Strength(Commands->Find_Object(number));
float Shield_Strength = Commands->Get_Shield_Strength(Commands->Find_Object(number));
+ bool repair = false;
if (Health < Max_Health)
{
Commands->Set_Health(Commands->Find_Object(number),Health + Get_Float_Parameter("Repair_Health"));
+ repair = true;
}
if (Shield_Strength < Max_Shield_Strength)
{
Commands->Set_Shield_Strength(Commands->Find_Object(number),Shield_Strength + Get_Float_Parameter("Repair_Health"));
+ repair = true;
+ }
+ if (repair && Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
}
Commands->Start_Timer(obj,this,1.0,number);
}
@@ -462,7 +477,7 @@
}
if ((_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset1"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset2"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset3"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset4"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset5"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset6"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset7"))) && (_stricmp(Commands->Get_Preset_Name(enterer),Get_Parameter("Preset8"))))
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Commands->Start_Timer(obj,this,1.0,Commands->Get_ID(enterer));
}
@@ -483,13 +498,20 @@
float Health = Commands->Get_Health(Commands->Find_Object(number));
float Max_Shield_Strength = Commands->Get_Max_Shield_Strength(Commands->Find_Object(number));
float Shield_Strength = Commands->Get_Shield_Strength(Commands->Find_Object(number));
+ bool repair = false;
if (Health < Max_Health)
{
Commands->Set_Health(Commands->Find_Object(number),Health + Get_Float_Parameter("Repair_Health"));
+ repair = true;
}
if (Shield_Strength < Max_Shield_Strength)
{
Commands->Set_Shield_Strength(Commands->Find_Object(number),Shield_Strength + Get_Float_Parameter("Repair_Health"));
+ repair = true;
+ }
+ if (repair && Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
}
Commands->Start_Timer(obj,this,1.0,number);
}
@@ -630,7 +652,7 @@
{
return;
}
- if (Is_Soldier(obj))
+ if (enterer->As_SoldierGameObj())
{
Commands->Start_Timer(obj,this,1.0,Commands->Get_ID(enterer));
}
@@ -703,7 +725,7 @@
void JFW_Disable_Transitions_Zone::Entered(GameObject *obj,GameObject *enterer)
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Commands->Enable_Vehicle_Transitions(enterer,false);
}
@@ -711,7 +733,7 @@
void JFW_Disable_Transitions_Zone::Exited(GameObject *obj,GameObject *exiter)
{
- if (Is_Vehicle(exiter))
+ if (exiter->As_VehicleGameObj())
{
Commands->Enable_Vehicle_Transitions(exiter,true);
}
@@ -729,7 +751,7 @@
}
pos = Commands->Get_Position(enterer);
pos.Z += Get_Float_Parameter("ZAmount");
- angle = Commands->Get_Facing(obj);
+ angle = DEG_TO_RADF(Commands->Get_Facing(obj));
pos.X += Get_Float_Parameter("Amount")*(float)cos(angle);
pos.Y += Get_Float_Parameter("Amount")*(float)sin(angle);
Commands->Set_Position(enterer,pos);
@@ -767,7 +789,7 @@
void JFW_Vechicle_Damage_Zone::Entered(GameObject *obj,GameObject *enterer)
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
int Player_Type = Get_Int_Parameter("Player_Type");
if (CheckPlayerType(enterer,Player_Type))
@@ -899,7 +921,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
if (Get_Vehicle_Mode(enterer) == VEHICLE_TYPE_FLYING)
{
@@ -922,13 +944,20 @@
float Health = Commands->Get_Health(Commands->Find_Object(number));
float Max_Shield_Strength = Commands->Get_Max_Shield_Strength(Commands->Find_Object(number));
float Shield_Strength = Commands->Get_Shield_Strength(Commands->Find_Object(number));
+ bool repair = false;
if (Health < Max_Health)
{
Commands->Set_Health(Commands->Find_Object(number),Health + Get_Float_Parameter("Repair_Health"));
+ repair = true;
}
if (Shield_Strength < Max_Shield_Strength)
{
Commands->Set_Shield_Strength(Commands->Find_Object(number),Shield_Strength + Get_Float_Parameter("Repair_Health"));
+ repair = true;
+ }
+ if (repair && Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
}
Commands->Start_Timer(obj,this,1.0,number);
}
@@ -941,7 +970,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
if (Get_Vehicle_Mode(enterer) != VEHICLE_TYPE_FLYING)
{
@@ -964,13 +993,20 @@
float Health = Commands->Get_Health(Commands->Find_Object(number));
float Max_Shield_Strength = Commands->Get_Max_Shield_Strength(Commands->Find_Object(number));
float Shield_Strength = Commands->Get_Shield_Strength(Commands->Find_Object(number));
+ bool repair = false;
if (Health < Max_Health)
{
Commands->Set_Health(Commands->Find_Object(number),Health + Get_Float_Parameter("Repair_Health"));
+ repair = true;
}
if (Shield_Strength < Max_Shield_Strength)
{
Commands->Set_Shield_Strength(Commands->Find_Object(number),Shield_Strength + Get_Float_Parameter("Repair_Health"));
+ repair = true;
+ }
+ if (repair && Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
}
Commands->Start_Timer(obj,this,1.0,number);
}
@@ -1545,7 +1581,7 @@
void JFW_Heavy_Vehicle_Damage_Zone::Entered(GameObject *obj,GameObject *enterer)
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
int Player_Type = Get_Int_Parameter("Player_Type");
if ((CheckPlayerType(enterer,Player_Type)) || (Get_Mass(enterer) < Get_Float_Parameter("Mass")))
@@ -1577,7 +1613,7 @@
void JFW_Light_Vehicle_Damage_Zone::Entered(GameObject *obj,GameObject *enterer)
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
int Player_Type = Get_Int_Parameter("Player_Type");
if ((CheckPlayerType(enterer,Player_Type)) || (Get_Mass(enterer) > Get_Float_Parameter("Mass")))
@@ -1877,7 +1913,7 @@
void JFW_Vehicle_Zone_Animation::Entered(GameObject *obj,GameObject *enterer)
{
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
if (!refcount)
{
@@ -1918,7 +1954,7 @@
void JFW_Vehicle_Zone_Animation::Exited(GameObject *obj,GameObject *exiter)
{
- if (Is_Vehicle(exiter))
+ if (exiter->As_VehicleGameObj())
{
refcount--;
if (!refcount)
@@ -2093,7 +2129,7 @@
{
return;
}
- if ((Is_Building_Dead(Find_Com_Center(Commands->Get_Player_Type(enterer))) && (Is_Radar_Enabled(PTTEAM(Commands->Get_Player_Type(enterer))))))
+ if (Find_Com_Center(Commands->Get_Player_Type(enterer)) && (Is_Building_Dead(Find_Com_Center(Commands->Get_Player_Type(enterer))) && (Is_Radar_Enabled(PTTEAM(Commands->Get_Player_Type(enterer))))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),Commands->Get_Player_Type(enterer));
Enable_Base_Radar(Get_Object_Type(enterer),true);
@@ -2116,7 +2152,7 @@
{
return;
}
- if ((Is_Building_Dead(Find_Com_Center(Commands->Get_Player_Type(enterer))) && (Is_Radar_Enabled(PTTEAM(Commands->Get_Player_Type(enterer))))))
+ if (Find_Com_Center(Commands->Get_Player_Type(enterer)) && (Is_Building_Dead(Find_Com_Center(Commands->Get_Player_Type(enterer))) && (Is_Radar_Enabled(PTTEAM(Commands->Get_Player_Type(enterer))))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),Commands->Get_Player_Type(enterer));
Enable_Base_Radar(Get_Object_Type(enterer),true);
@@ -2162,7 +2198,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Create_2D_Sound_Player(Get_Vehicle_Driver(enterer),Get_Parameter("Sound"));
InstallHook("Repair",Get_Vehicle_Driver(enterer));
@@ -2207,6 +2243,10 @@
}
if (cost_scale > 0)
{
+ if (Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
+ }
Commands->Give_Money(Get_Vehicle_Driver(Commands->Find_Object(number)),-cost * cost_scale,false);
Commands->Start_Timer(obj,this,1.0,number);
return;
@@ -2273,7 +2313,7 @@
{
return;
}
- if (Is_Vehicle(enterer) && !Is_Script_Attached(enterer,"JFW_Boat"))
+ if (enterer->As_VehicleGameObj() && Get_Vehicle_Mode(enterer) != VEHICLE_TYPE_BOAT && Get_Vehicle_Mode(enterer) != VEHICLE_TYPE_SUB)
{
Create_2D_Sound_Player(Get_Vehicle_Driver(enterer),Get_Parameter("Sound"));
InstallHook("Repair",Get_Vehicle_Driver(enterer));
@@ -2318,6 +2358,10 @@
}
if (cost_scale > 0)
{
+ if (Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
+ }
Commands->Give_Money(Get_Vehicle_Driver(Commands->Find_Object(number)),-cost * cost_scale,false);
Commands->Start_Timer(obj,this,1.0,number);
return;
@@ -2384,7 +2428,7 @@
{
return;
}
- if (Is_Vehicle(enterer) && Is_Script_Attached(enterer,"JFW_Boat"))
+ if (enterer->As_VehicleGameObj() && (Get_Vehicle_Mode(enterer) == VEHICLE_TYPE_BOAT || Get_Vehicle_Mode(enterer) == VEHICLE_TYPE_SUB))
{
Create_2D_Sound_Player(Get_Vehicle_Driver(enterer),Get_Parameter("Sound"));
InstallHook("Repair",Get_Vehicle_Driver(enterer));
@@ -2429,6 +2473,10 @@
}
if (cost_scale > 0)
{
+ if (Commands->Find_Object(number)->As_VehicleGameObj())
+ {
+ Commands->Find_Object(number)->As_VehicleGameObj()->Damage_Meshes_Update(); //repair was done, update damage meshes
+ }
Commands->Give_Money(Get_Vehicle_Driver(Commands->Find_Object(number)),-cost * cost_scale,false);
Commands->Start_Timer(obj,this,1.0,number);
return;
@@ -2495,7 +2543,7 @@
{
return;
}
- if (Is_Vehicle(enterer))
+ if (enterer->As_VehicleGameObj())
{
Create_2D_Sound_Player(Get_Vehicle_Driver(enterer),Get_Parameter("Sound"));
InstallHook("Sell",Get_Vehicle_Driver(enterer));
@@ -2525,7 +2573,7 @@
RemoveHook();
ID = 0;
}
- if (Is_Vehicle(Commands->Find_Object(ID)))
+ if (Commands->Find_Object(ID)->As_VehicleGameObj())
{
if (Get_Vehicle_Driver(Commands->Find_Object(ID)))
{
@@ -3027,21 +3075,9 @@
if (object)
{
Vector3 v = Get_Vector3_Parameter("Size");
- object->Get_Bounding_Box().Extent.X = v.X;
- object->Get_Bounding_Box().Extent.Y = v.Y;
- object->Get_Bounding_Box().Extent.Z = v.Z;
- float z = Get_Float_Parameter("ZRotate");
- float c = cos(z);
- float s = sin(z);
- object->Get_Bounding_Box().Basis[0].X = c;
- object->Get_Bounding_Box().Basis[0].Y = -s;
- object->Get_Bounding_Box().Basis[0].Z = 0;
- object->Get_Bounding_Box().Basis[1].X = s;
- object->Get_Bounding_Box().Basis[1].Y = c;
- object->Get_Bounding_Box().Basis[1].Z = 0;
- object->Get_Bounding_Box().Basis[2].X = 0;
- object->Get_Bounding_Box().Basis[2].Y = 0;
- object->Get_Bounding_Box().Basis[2].Z = 1;
+ object->Get_Bounding_Box().Extent = v;
+ float z = DEG_TO_RADF(Get_Float_Parameter("ZRotate"));
+ object->Get_Bounding_Box().Basis.Rotate_Z(z);
}
Destroy_Script();
}
@@ -3136,11 +3172,11 @@
return;
}
team = Commands->Get_Player_Type(enterer);
- if (Is_Base_Powered(PTTEAM(team)) && !reset && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
+ if (Is_Base_Powered(PTTEAM(team)) && !reset && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),team);
Power_Base(PTTEAM(team),false);
- GameObject *o = Find_Building(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
+ GameObject *o = Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
if (o && !Is_Building_Dead(o))
{
Enable_Base_Radar(PTTEAM(team),false);
@@ -3151,11 +3187,11 @@
void JFW_Power_Spy_Zone::Timer_Expired(GameObject *obj,int number)
{
- if ((number == 1) && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
+ if ((number == 1) && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
{
Create_2D_Sound_Team(Get_Parameter("Sound2"),PTTEAM(team));
Power_Base(PTTEAM(team),true);
- GameObject *o = Find_Building(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
+ GameObject *o = Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
if (o && !Is_Building_Dead(o))
{
Enable_Base_Radar(PTTEAM(team),true);
@@ -3210,11 +3246,11 @@
return;
}
team = Commands->Get_Player_Type(enterer);
- if (Is_Base_Powered(PTTEAM(team)) && !reset && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
+ if (Is_Base_Powered(PTTEAM(team)) && !reset && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),team);
Power_Base(PTTEAM(team),false);
- GameObject *o = Find_Building(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
+ GameObject *o = Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
if (o && !Is_Building_Dead(o))
{
Enable_Base_Radar(PTTEAM(team),false);
@@ -3225,11 +3261,11 @@
void JFW_Power_Spy_Zone_New::Timer_Expired(GameObject *obj,int number)
{
- if ((number == 1) && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
+ if ((number == 1) && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_POWER_PLANT))))
{
Create_2D_Sound_Team(Get_Parameter("Sound2"),PTTEAM(team));
Power_Base(PTTEAM(team),true);
- GameObject *o = Find_Building(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
+ GameObject *o = Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_COM_CENTER);
if (o && !Is_Building_Dead(o))
{
Enable_Base_Radar(PTTEAM(team),true);
@@ -3255,23 +3291,23 @@
{
return;
}
- int team = Commands->Get_Player_Type(enterer);
- if (!cydisabled && !reset && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
+ team = Commands->Get_Player_Type(enterer);
+ if (!cydisabled && !reset && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),team);
cydisabled = true;
- Commands->Send_Custom_Event(obj,Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD),3000,320023,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD),3000,320023,0);
Commands->Start_Timer(obj,this,Get_Float_Parameter("Power_Time"),1);
}
}
void JFW_Conyard_Spy_Zone::Timer_Expired(GameObject *obj,int number)
{
- if ((number == 1) && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
+ if ((number == 1) && Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD) && (!Is_Building_Dead(Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
{
Create_2D_Sound_Team(Get_Parameter("Sound2"),PTTEAM(team));
cydisabled = false;
- Commands->Send_Custom_Event(obj,Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD),3000,230032,0);
+ Commands->Send_Custom_Event(obj,Find_Building_By_Type(PTTEAM(team),BuildingConstants::TYPE_CONYARD),3000,230032,0);
reset = true;
Commands->Start_Timer(obj,this,Get_Float_Parameter("Reset_Time"),2);
}
@@ -3293,8 +3329,8 @@
{
return;
}
- int team = Commands->Get_Player_Type(enterer);
- if (!cydisabled && !reset && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
+ team = Commands->Get_Player_Type(enterer);
+ if (!cydisabled && !reset && Find_Construction_Yard(PTTEAM(team)) && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),team);
cydisabled = true;
@@ -3306,7 +3342,7 @@
void JFW_Conyard_Spy_Zone_2::Timer_Expired(GameObject *obj,int number)
{
- if ((number == 1) && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
+ if ((number == 1) && Find_Construction_Yard(PTTEAM(team)) && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
{
Create_2D_Sound_Team(Get_Parameter("Sound2"),PTTEAM(team));
cydisabled = false;
@@ -3333,8 +3369,8 @@
{
return;
}
- int team = Commands->Get_Player_Type(enterer);
- if (!cydisabled && !reset && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
+ team = Commands->Get_Player_Type(enterer);
+ if (!cydisabled && !reset && Find_Construction_Yard(PTTEAM(team)) && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
{
Create_2D_Sound_Team(Get_Parameter("Sound"),team);
cydisabled = true;
@@ -3346,7 +3382,7 @@
void JFW_Conyard_Spy_Zone_2_New::Timer_Expired(GameObject *obj,int number)
{
- if ((number == 1) && (!Is_Building_Dead(Find_Building(PTTEAM(team),BuildingConstants::TYPE_CONYARD))))
+ if ((number == 1) && Find_Construction_Yard(PTTEAM(team)) && (!Is_Building_Dead(Find_Construction_Yard(PTTEAM(team)))))
{
Create_2D_Sound_Team(Get_Parameter("Sound2"),PTTEAM(team));
cydisabled = false;
@@ -3361,6 +3397,15 @@
}
}
+void JFW_Destroy_Vehicle_Zone::Entered(GameObject *obj,GameObject *enterer)
+{
+ if (enterer->As_VehicleGameObj())
+ {
+ Attach_Script_Occupants(enterer,"RA_DriverDeath", "0");
+ }
+ Commands->Apply_Damage(enterer,99999,"Death",0);
+}
+
ScriptRegistrant JFW_Look_At_Location_Entry("JFW_Look_At_Location_Entry","Player_Type:int,Location:vector3");
ScriptRegistrant JFW_Look_At_Object_Entry("JFW_Look_At_Object_Entry","Player_Type:int,ObjectID:int");
ScriptRegistrant JFW_Zone_PCT_Registrant("JFW_Zone_PCT","Player_Type:int");
@@ -3452,3 +3497,4 @@
ScriptRegistrant JFW_Custom_Spawn_Zone_Registrant("JFW_Custom_Spawn_Zone","Position:vector3,Size:vector3,ZRotate:float,SpawnCustom:int,DestroyCustom:int,Preset:string");
ScriptRegistrant JFW_Spawn_Zone_Created_Registrant("JFW_Spawn_Zone_Created","Offset:vector3,Size:vector3,ZRotate:float,Preset:string");
ScriptRegistrant JFW_Boat_Registrant("JFW_Boat","");
+ScriptRegistrant JFW_Destroy_Vehicle_Zone_Registrant("JFW_Destroy_Vehicle_Zone","");
diff -uwr sourceold/scripts/jfwzone.h source/scripts/jfwzone.h
--- sourceold/scripts/jfwzone.h 2012-02-13 18:44:52.651765600 +0800
+++ source/scripts/jfwzone.h 2012-04-15 11:56:05.470093800 +0800
@@ -542,3 +542,7 @@
class JFW_Boat : public ScriptImpClass {
};
+
+class JFW_Destroy_Vehicle_Zone : public ScriptImpClass {
+ void Entered(GameObject *obj,GameObject *enterer);
+};
diff -uwr sourceold/scripts/jmgrp2.cpp source/scripts/jmgrp2.cpp
--- sourceold/scripts/jmgrp2.cpp 2011-10-11 23:05:24.216796800 +0800
+++ source/scripts/jmgrp2.cpp 2012-04-24 21:25:30.842773400 +0800
@@ -26,6 +26,10 @@
#include
#include
#include "VehicleGameObj.h"
+#include "BuildingGameObj.h"
+#include "ScriptZoneGameObj.h"
+#include "ScriptableGameObj.h"
+#include "BeaconGameObj.h"
#define VERSION "2.2.9:1.0 Alpha"
char MAPVERSION[100] = "Not Available";
#define PLUGINVERSIONNUMBER 3
@@ -1074,7 +1078,7 @@
int Get_Gun_Position(GameObject *obj,const char *WeaponName)
{
- PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *o2 = obj->As_PhysicalGameObj();
if (!o2){return 0;}
ArmedGameObj *o3 = o2->As_ArmedGameObj();
if (!o3){return 0;}
@@ -2848,42 +2852,42 @@
{
if (MyMissionNode->FailOnTrackedVehicle)
{
- if (Is_TrackedVehicle(sender))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_TrackedVehicleClass())
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnTrackedVehicle);
}
}
if (MyMissionNode->FailOnMotorcycle)
{
- if (Is_Motorcycle(sender))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_MotorcycleClass())
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnMotorcycle);
}
}
if (MyMissionNode->FailOnTurret)
{
- if (Is_WheeledVehicle(sender))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_WheeledVehicleClass())
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnTurret);
}
}
if (MyMissionNode->FailOnWheeledVehicle)
{
- if (Is_Phys3(sender))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_Phys3Class())
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnWheeledVehicle);
}
}
if (MyMissionNode->FailOnAircraft)
{
- if (Is_VTOLVehicle(sender) && !Is_Script_Attached(sender,"JMG_Boat_To_High"))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass() && !Is_Script_Attached(sender,"JMG_Boat_To_High"))
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnAircraft);
}
}
if (MyMissionNode->FailOnBoat)
{
- if (Is_VTOLVehicle(sender) && Is_Script_Attached(sender,"JMG_Boat_To_High"))
+ if (sender->As_PhysicalGameObj() && sender->As_PhysicalGameObj()->Peek_Physical_Object() && sender->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass() && Is_Script_Attached(sender,"JMG_Boat_To_High"))
{
Scan_For_Vehicle_Conflicts(obj,MyMissionNode->FailOnBoat);
}
@@ -4102,12 +4106,12 @@
if (41352349 == number)
{
Vector3 pos = Commands->Get_Position(obj);
- if (Commands->Get_Position(obj).Z < Create_Height && As_PhysicalGameObj(obj))
+ if (Commands->Get_Position(obj).Z < Create_Height && obj->As_PhysicalGameObj())
{
Vector3 OldPos = pos;
pos.Z = Create_Height;
Commands->Set_Position(obj,pos);
- PhysicalGameObj *objphys = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *objphys = obj->As_PhysicalGameObj();
if (!objphys->Peek_Physical_Object()->As_MoveablePhysClass()->Can_Teleport(objphys->Get_Transform(),false))
{
Commands->Set_Position(obj,OldPos);
@@ -7332,11 +7336,11 @@
void JMG_Real_Plane_Physics::Custom(GameObject *obj,int message,int param,GameObject *sender)
{
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
occupied++;
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
occupied--;
if (occupied == 0)
@@ -7500,7 +7504,7 @@
void JMG_Keyboard_Vehicle_Input_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender)
{
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int r, end = 0;
for(r = 0;r < 10 && end == 0;r++)
@@ -7516,7 +7520,7 @@
Attach_Script_Once(sender,"JMG_Keyboard_Input_Custom_ID_Veh",params);
Remove_Script(sender,"JMG_Keyboard_Input_Custom_ID_Veh");
}
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
int r, end = 0, msg;
int SenderID = Commands->Get_ID(sender);
@@ -7620,7 +7624,7 @@
void JMG_RP2_Teleport_Zone_Script::Entered(GameObject *obj,GameObject *enter)//For Doors
{
char params[128];
- if (Is_HumanPhys(enter) && !Get_Vehicle(enter) && Commands->Is_A_Star(enter))
+ if ((enter->As_PhysicalGameObj() && enter->As_PhysicalGameObj()->Peek_Physical_Object() && enter->As_PhysicalGameObj()->Peek_Physical_Object()->As_HumanPhysClass()) && !Get_Vehicle(enter) && Commands->Is_A_Star(enter))
{
sprintf(params,"%f,%f,%f,%f,%f,%s,%s,%s,%s,%s",Teleport_Pos.X,Teleport_Pos.Y,Teleport_Pos.Z,Get_Float_Parameter("Enter_Rotation"),Get_Float_Parameter("Exit_Rotation"),Get_Parameter("Enter_Animation"),Get_Parameter("Exit_Animation"),Get_Parameter("Enter_Path_Animation"),Get_Parameter("Exit_Path_Animation"),Get_Parameter("Bone_Attach_Name"));
Attach_Script_Once(enter,"JMG_RP2_Teleport_Zone_Script_Attach",params);
@@ -7669,7 +7673,7 @@
pos.Y = Get_Float_Parameter("Y");
pos.Z = Get_Float_Parameter("Z");
Vector3 ExitPos = pos;
- PhysicalGameObj *objphys = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *objphys = obj->As_PhysicalGameObj();
objphys->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass()->Find_Teleport_Location(pos,1.0f,&ExitPos);
Commands->Set_Position(obj,ExitPos);
Set_Screen_Fade_Opacity_Player(obj,1.0f,0.1f);
@@ -7757,7 +7761,7 @@
void JMG_RP2_Renhalo_Vortex::Enemy_Seen(GameObject *obj,GameObject *seen)
{
- if (Is_Soldier(seen) == 1)
+ if (seen->As_SoldierGameObj())
{
if (Commands->Is_A_Star(seen))
{
@@ -8009,7 +8013,7 @@
if (Node)
{
Vector3 Pos = Node->Telepos;
- if (Is_Vehicle(enter))
+ if (enter->As_VehicleGameObj())
{
Pos.Z += 5.0f;
Commands->Send_Custom_Event(obj,Get_Vehicle_Driver(enter),PHONEAquiredSignal,1,0);
@@ -8179,7 +8183,7 @@
void JMG_Set_Ammo_On_Enter_Reset_On_Exit::Entered(GameObject *obj,GameObject *enter)
{
int x, end,y = 0;
- if (Is_Vehicle(enter) == 0)
+ if (!enter->As_VehicleGameObj())
{
end = 0;
for (x = 0;x < 125 && end == 0;x++)
@@ -8199,7 +8203,7 @@
}
}
}
- if (Is_Vehicle(enter) == 1)
+ if (enter->As_VehicleGameObj())
{
while (y <= Get_Vehicle_Seat_Count(enter))
{
@@ -8240,7 +8244,7 @@
void JMG_Set_Ammo_On_Enter_Reset_On_Exit::Exited(GameObject *obj,GameObject *exit)
{
int x, end,y = 0;
- if (Is_Vehicle(exit) == 0)
+ if (!exit->As_VehicleGameObj())
{
end = 0;
for (x = 0;x < 125 && end == 0;x++)
@@ -8254,7 +8258,7 @@
}
}
}
- if (Is_Vehicle(exit) == 1)
+ if (exit->As_VehicleGameObj())
{
y = 0;
while (y < Get_Vehicle_Seat_Count(exit))
@@ -8303,7 +8307,7 @@
int x, end,y = 0;
if (message == Get_Int_Parameter("Set_Ammo_Message"))
{
- if (Is_Vehicle(Commands->Find_Object(param)) == 0)
+ if (!Commands->Find_Object(param)->As_VehicleGameObj())
{
end = 0;
for (x = 0;x < 125 && end == 0;x++)
@@ -8330,7 +8334,7 @@
}
}
}
- if (Is_Vehicle(Commands->Find_Object(param)) == 1)
+ if (Commands->Find_Object(param)->As_VehicleGameObj())
{
while (y <= Get_Vehicle_Seat_Count(Commands->Find_Object(param)))
{
@@ -8372,7 +8376,7 @@
}
if (message == Get_Int_Parameter("Reset_Ammo_Message"))
{
- if (Is_Vehicle(Commands->Find_Object(param)) == 0)
+ if (!Commands->Find_Object(param)->As_VehicleGameObj())
{
end = 0;
for (x = 0;x < 125 && end == 0;x++)
@@ -8386,7 +8390,7 @@
}
}
}
- if (Is_Vehicle(Commands->Find_Object(param)) == 1)
+ if (Commands->Find_Object(param)->As_VehicleGameObj())
{
y = 0;
while (y < Get_Vehicle_Seat_Count(Commands->Find_Object(param)))
@@ -9702,7 +9706,7 @@
void JMG_Advanced_Visible_Driver::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
int r, end = 0,sc = Get_Vehicle_Seat_Count(obj);
for(r = 0;r < sc && end == 0;r++)
@@ -9730,7 +9734,7 @@
}
}
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int r, end = 0,sc = Get_Vehicle_Seat_Count(obj);
for(r = 0;r < sc && end == 0;r++)
@@ -9897,7 +9901,7 @@
Vector3 Pos = Commands->Get_Position(TargetSpot);
Vector3 ExitPos = Pos;
float Facing = Commands->Get_Facing(TargetSpot);
- PhysicalGameObj *objphys = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *objphys = obj->As_PhysicalGameObj();
objphys->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass()->Find_Teleport_Location(Pos,1.0f,&ExitPos);
Commands->Set_Position(obj,ExitPos);
Vector3 pos = Commands->Get_Bone_Position(obj,"c head");
@@ -11705,7 +11709,7 @@
SLNode *ABuildingLL = GameObjManager::BuildingGameObjList.Head();
while (ABuildingLL)
{
- GameObject *TheBuilding = (GameObject *)ABuildingLL->Data();
+ GameObject *TheBuilding = ABuildingLL->Data();
if (TheBuilding)
{
if (Building_Type(TheBuilding) == 9)
@@ -11954,7 +11958,7 @@
void JMG_RP2_Submarine_Script::Custom(GameObject *obj,int message,int param,GameObject *sender)
{
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
int r, end = 0;
for(r = 0;r < 10 && end == 0;r++)
@@ -11977,7 +11981,7 @@
Commands->Send_Custom_Event(sender,Commands->Find_Object(133700),987123546,1,0);
}
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int r, end = 0;
for(r = 0;r < 10 && end == 0;r++)
@@ -12477,7 +12481,7 @@
{
float Angle;
enemydistance = Commands->Get_Distance(Commands->Get_Position(seen),Commands->Get_Position(obj));
- if (enemydistance < maxdistance && !Is_VTOLVehicle(seen))
+ if (enemydistance < maxdistance && !(seen->As_PhysicalGameObj() && seen->As_PhysicalGameObj()->Peek_Physical_Object() && seen->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass()))
{
Commands->Select_Weapon(obj,Get_Parameter("Dummy_Weapon"));
ActionParamsStruct params;
@@ -13280,7 +13284,7 @@
void JMG_Vehicle_Occupant_Visible_And_Damageable::Custom(GameObject *obj, int message, int param, GameObject *sender)
{
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
int sc = Get_Vehicle_Seat_Count(obj);
for (int r = 0,end = 0;r < sc && (end == 0 || Get_Int_Parameter("Debug"));r++)
@@ -13331,7 +13335,7 @@
}
}
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int sc = Get_Vehicle_Seat_Count(obj);
for (int r = 0, end = 0;r < sc && (end == 0 || Get_Int_Parameter("Debug"));r++)
@@ -13419,7 +13423,7 @@
ObjectID[x] = d;
}
}
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
if (Get_Int_Parameter("ObjectCount") == 0 && ObjectID[0] == 0)
{
@@ -13442,7 +13446,7 @@
}
}
}
- if (message == 1000000029 && Get_Vehicle_Occupant_Count(obj) == 0)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED && Get_Vehicle_Occupant_Count(obj) == 0)
{
for (int x = 0;x < 10;x++)
{
@@ -13477,7 +13481,7 @@
void JMG_Repair_Zone::Entered(GameObject *obj,GameObject *enter)
{
- if (!Is_Script_Attached(enter,"JMG_Repair_Zone_Attach_Script") && Is_Vehicle(enter))
+ if (!Is_Script_Attached(enter,"JMG_Repair_Zone_Attach_Script") && enter->As_VehicleGameObj())
{
char params[4000];
sprintf(params,"%f,%d,%d,%d,%d,%d,%f,%f,%s,%s",Get_Float_Parameter("Repair_Delay"),Get_Int_Parameter("Damage_Halt_Repair_Time"),Get_Int_Parameter("Add_Health"),Get_Int_Parameter("Add_Armor"),Get_Int_Parameter("Heath_Repair_Cost"),Get_Int_Parameter("Armor_Repair_Cost"),Get_Float_Parameter("Health_Repair_Sound_Time"),Get_Float_Parameter("Armor_Repair_Sound_Time"),Get_Parameter("Health_Repair_Sound"),Get_Parameter("Armor_Repair_Sound"));
@@ -13640,10 +13644,10 @@
SLNode *x = GameObjManager::GameObjList.Head();
while (x)
{
- GameObject *preset = (GameObject *)x->Data();
- if (preset && As_ScriptableGameObj(preset))
+ ScriptableGameObj *preset = x->Data()->As_ScriptableGameObj();
+ if (preset)
{
- const DefinitionClass *def = Get_Definition(preset);
+ const DefinitionClass *def = &preset->Get_Definition();
if (!_stricmp(def->Get_Name(),Get_Parameter("Preset")))
{
if (!Is_Script_Attached(preset,Get_Parameter("Script")))
@@ -13864,13 +13868,13 @@
}
Commands->Enable_Vehicle_Transitions(obj,true);
int j = 0;
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
while (Get_Vehicle_Occupant_Count(obj) > 0 && j < 5)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
@@ -13911,7 +13915,7 @@
void JMG_Vehicle_Sell_Zone::Entered(GameObject *obj,GameObject *enter)
{
- if (!Is_Script_Attached(enter,"JMG_Sell_Vehicle_On_Custom") && Is_Vehicle(enter))
+ if (!Is_Script_Attached(enter,"JMG_Sell_Vehicle_On_Custom") && enter->As_VehicleGameObj())
{
char params[4000];
sprintf(params,"%d,%d,%d,%s,%f,%f,%f,%s",Get_Int_Parameter("SellKeyMessage"),Get_Int_Parameter("CostRequestMessage"),Get_Int_Parameter("PriceReturnedMessage"),Get_Parameter("SellSound"),Get_Float_Parameter("HealthValueRatio"),Get_Float_Parameter("ArmorValueRatio"),Get_Float_Parameter("MinimumSellCondition"),Get_Parameter("Sell_Explosion"));
@@ -14051,7 +14055,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
+ GameObject *o = x->Data();
if (o)
{
if (Commands->Get_Distance(Commands->Get_Position(obj),Commands->Get_Position(o)) <= Get_Float_Parameter("DamageRange") && o != obj)
@@ -14069,7 +14073,7 @@
int kill = 0;
while (x)
{
- GameObject *o = (GameObject *)x->Data();
+ GameObject *o = x->Data();
if (o)
{
Vector3 objpos = Commands->Get_Position(obj),opos = Commands->Get_Position(o);
@@ -14111,7 +14115,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
+ GameObject *o = x->Data();
if (o)
{
if (!_stricmp(Commands->Get_Preset_Name(o),Get_Parameter("ObjectName")))
@@ -14213,7 +14217,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj((GameObject *)x->Data());
+ GameObject *o = x->Data();
if (o)
{
if ((Get_Object_Type(o) != Team && Commands->Get_ID(obj) != Commands->Get_ID(o)))
@@ -14286,7 +14290,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj((GameObject *)x->Data());
+ GameObject *o = x->Data();
if (obj)
{
if (obj != o)
@@ -14323,14 +14327,14 @@
int JMG_Motion_Mine_Script::Usable_Target(GameObject *obj)
{
- if (Is_Vehicle(obj))
+ if (obj->As_VehicleGameObj())
{
- if ((Is_VTOLVehicle(obj) || Is_TrackedVehicle(obj) || Is_WheeledVehicle(obj) || Is_Motorcycle(obj) || Is_HumanPhys(obj)))
+ if (((obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass()) || (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_TrackedVehicleClass()) || (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_WheeledVehicleClass()) || (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_MotorcycleClass()) || (obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_HumanPhysClass())))
{
return 1;
}
}
- if (Is_Soldier(obj))
+ if (obj->As_SoldierGameObj())
{
return 1;
}
@@ -18437,7 +18441,7 @@
HJROWP = 0;// Added in so you won't glitch and swim under the water as easily
Vector3 ExitPos,StartPos;//Small bit of code to try to prevent you getting stuck in the ground
StartPos = ExitPos = Commands->Get_Position(obj);
- PhysicalGameObj *objphys = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
+ PhysicalGameObj *objphys = obj->As_PhysicalGameObj();
objphys->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass()->Find_Teleport_Location(StartPos,1.0f,&ExitPos);
Commands->Set_Position(obj,StartPos);
}
@@ -19021,13 +19025,11 @@
GameObject *Zone = NULL;
Vector3 Pos = Commands->Get_Position(obj);
float HighestPoint = 0;
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::ScriptZoneGameObjList.Head();
while (x)
{
- GameObject *TempZone = (GameObject *)x->Data();
- if (TempZone && As_ScriptableGameObj(TempZone))
- {
- if (Is_ScriptZone(TempZone))
+ GameObject *TempZone = x->Data();
+ if (TempZone)
{
if (Is_Script_Attached(TempZone,"JMG_New_Swimming_Zone"))
{
@@ -19053,7 +19055,6 @@
}
}
}
- }
x = x->Next();
}
WaterZoneHeight(Zone);
@@ -19066,13 +19067,11 @@
if (obj && Head)
{
int UWZC = 0;
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::ScriptZoneGameObjList.Head();
while (x)
{
- GameObject *TempZone = (GameObject *)x->Data();
- if (TempZone && As_ScriptableGameObj(TempZone))
- {
- if (Is_ScriptZone(TempZone))
+ GameObject *TempZone = x->Data();
+ if (TempZone)
{
if (Is_Script_Attached(TempZone,"JMG_New_Swimming_Zone"))
{
@@ -19082,7 +19081,6 @@
}
}
}
- }
x = x->Next();
}
if (underwater != UWZC)
@@ -19210,13 +19208,11 @@
GameObject *Zone = NULL;
Vector3 Pos = Commands->Get_Position(obj);
float HighestPoint = 0;
- SLNode *x = GameObjManager::GameObjList.Head();
+ SLNode *x = GameObjManager::ScriptZoneGameObjList.Head();
while (x)
{
- GameObject *TempZone = (GameObject *)x->Data();
- if (TempZone && As_ScriptableGameObj(TempZone))
- {
- if (Is_ScriptZone(TempZone))
+ GameObject *TempZone = x->Data();
+ if (TempZone)
{
if (Is_Script_Attached(TempZone,"JMG_New_Swimming_Zone"))
{
@@ -19242,7 +19238,6 @@
}
}
}
- }
x = x->Next();
}
/**///Swimming_Trace("Complete - FindCurrentWaterZone",-1);
@@ -19977,7 +19972,7 @@
{
DamageEffectIDs[set] = 0;
}
- if (Is_VTOLVehicle(obj) == 1)
+ if ((obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass()))
{
if (Get_Int_Parameter("Create_Clouds") == 1 || Get_Int_Parameter("Create_Clouds") == -2)
{
@@ -20022,7 +20017,7 @@
}
}
}
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
if (enginedisabled == 1 && Is_In_Water == 0)
{
@@ -20086,7 +20081,7 @@
RP2_Set_Fog_And_Screen_Color_To_Level_Default(sender);
}
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int r, end = 0;
for(r = 0;r < 10 && end == 0;r++)
@@ -20123,7 +20118,7 @@
{
Commands->Set_Player_Type(obj,-1);
}
- if (As_PhysicalGameObj(sender))//Function below is for vehicle exit damage
+ if (sender->As_PhysicalGameObj())//Function below is for vehicle exit damage
{
Vector3 Pos = Commands->Get_Position(sender),OldPos;
OldPos = Pos;
@@ -20188,7 +20183,7 @@
}
}
// Back to original Swimming Script Stuff
- if (Is_VTOLVehicle(obj) == 1 && Get_Int_Parameter("Create_Clouds") >= 0)
+ if ((obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass()) && Get_Int_Parameter("Create_Clouds") >= 0)
{
enginedisabled = 1;
if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj))
@@ -20275,7 +20270,7 @@
else
{
Commands->Enable_Engine(obj,0);
- if (!Is_VTOLVehicle(obj))
+ if (!(obj->As_PhysicalGameObj() && obj->As_PhysicalGameObj()->Peek_Physical_Object() && obj->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass()))
{
JMG_Force_Occupants_Exit(obj);
}
@@ -20428,7 +20423,7 @@
int j = 0;
while (Get_Vehicle_Occupant_Count(obj) > 0 && j < 5)
{
- if (!Commands->Get_ID(obj) || !obj || !As_VehicleGameObj(obj))
+ if (!obj || !obj->As_VehicleGameObj())
{
return;
}
@@ -20623,7 +20618,7 @@
Send_Message_Player(sender,200,200,125,"Vehicle Special Key:");
Send_Message_Player(sender,200,200,125,"H - Toggle Sonar");
}
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
Commands->Send_Custom_Event(obj,sender,90000028,-1,0);
int sc = Get_Vehicle_Seat_Count(obj);
@@ -20658,7 +20653,7 @@
}
}
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
int r, end = 0;
for(r = 0;r < 10 && end == 0;r++)
@@ -21075,7 +21070,7 @@
void JMG_RP2_Submarine_Script_Advanced::PingSound(GameObject *Sub)
{
- if (!Commands->Get_ID(Sub) || !Sub)
+ if (!Sub)
{
return;
}
@@ -21083,7 +21078,7 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = As_SmartGameObj((GameObject *)x->Data());
+ GameObject *o = x->Data();
if (o)
{
if (Commands->Is_A_Star(o))
@@ -21211,7 +21206,7 @@
{
aco2 = 1;
}
- if (Is_Vehicle(damager))
+ if (damager->As_VehicleGameObj())
{
if (!Get_Vehicle_Occupant_Count(damager) && Get_Vehicle_Seat_Count(damager))
{
@@ -22932,8 +22927,8 @@
SLNode *Current = GameObjManager::GameObjList.Head();
while (Current)
{
- GameObject *Object = (GameObject *)Current->Data();
- if (Object && As_ScriptableGameObj(Object) && Object != obj)
+ GameObject *Object = Current->Data()->As_ScriptableGameObj();
+ if (Object && Object != obj)
{
if (Commands->Is_A_Star(Object))
{
@@ -23041,12 +23036,12 @@
void JMG_Turret_Attach::Custom(GameObject *obj,int message,int param,GameObject *sender)
{
- if (message == 1000000028)
+ if (message == CUSTOM_EVENT_VEHICLE_ENTERED)
{
GameObject *object = Commands->Find_Object(ObjectID);
Commands->Set_Player_Type(object,Commands->Get_Player_Type(sender));
}
- if (message == 1000000029)
+ if (message == CUSTOM_EVENT_VEHICLE_EXITED)
{
GameObject *object = Commands->Find_Object(ObjectID);
Commands->Set_Player_Type(object,Commands->Get_Player_Type(sender));
@@ -23086,10 +23081,10 @@
SLNode *x = GameObjManager::SmartGameObjList.Head();
while (x)
{
- GameObject *o = (GameObject *)x->Data();
+ GameObject *o = x->Data();
if (o)
{
- if (!Commands->Is_A_Star(o) && Is_Soldier(o) && o != obj && !Is_Script_Attached(obj,Get_Parameter("Script")))
+ if (!Commands->Is_A_Star(o) && o->As_SoldierGameObj() && o != obj && !Is_Script_Attached(obj,Get_Parameter("Script")))
{
Commands->Attach_Script(o,Get_Parameter("Script"),params);
}
@@ -23104,10 +23099,10 @@
SLNode