mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-07-16 08:55:52 +00:00
Added Projectile collision shockwaves
Also fixed typemask for moving objects.
This commit is contained in:
parent
ebe6649da7
commit
529104d9f2
4 changed files with 29 additions and 11 deletions
|
|
@ -60,6 +60,7 @@ const char* conResolveGhost(Linker::SimObject *obj, S32 argc, const char* argv[]
|
||||||
// Network Commands ---------------------------------
|
// Network Commands ---------------------------------
|
||||||
const char *conGetGhostIndex(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
const char *conGetGhostIndex(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||||
bool conForceUpdate(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
bool conForceUpdate(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||||
|
bool conSetProjDist(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||||
// General Commands ---------------------------------
|
// General Commands ---------------------------------
|
||||||
const char* conSprintf(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
const char* conSprintf(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||||
bool conTSExtensionUpdate(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
bool conTSExtensionUpdate(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
||||||
|
|
@ -11,6 +11,7 @@ static float counter=0;
|
||||||
static float mpsx=0.0;
|
static float mpsx=0.0;
|
||||||
static float mpsy=0.0;
|
static float mpsy=0.0;
|
||||||
static float mpsz=0.0;
|
static float mpsz=0.0;
|
||||||
|
static float projdist=0.0;
|
||||||
static bool moveplayerstoo=1;
|
static bool moveplayerstoo=1;
|
||||||
static bool clientupdate=false;
|
static bool clientupdate=false;
|
||||||
static float timecounter=0;
|
static float timecounter=0;
|
||||||
|
|
@ -100,10 +101,12 @@ void collide(unsigned int simgroup){
|
||||||
DX::MatrixF mat2=DX::MatrixF(sobj3.objtoworld);
|
DX::MatrixF mat2=DX::MatrixF(sobj3.objtoworld);
|
||||||
DX::Point3F test2;
|
DX::Point3F test2;
|
||||||
mat2.getColumn(3,&test2);
|
mat2.getColumn(3,&test2);
|
||||||
if (DX::pointdistance(test,test2)<40.0) {
|
if (DX::pointdistance(test,test2)<projdist) {
|
||||||
char evalstring[1024]="";
|
char evalstring[1024]="";
|
||||||
sprintf (evalstring,"ProjCollisionCallback(%d,%d);",sobj2.identifier,sobj3.identifier);
|
if (sobj2.identifier != sobj3.identifier) {
|
||||||
Con::eval(evalstring, false, NULL);
|
sprintf (evalstring,"ProjCollisionCallback(%d,%d);",sobj2.identifier,sobj3.identifier);
|
||||||
|
Con::eval(evalstring, false, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +130,7 @@ void moveRecursive(unsigned int simgroup,float xoff, float yoff, float zoff){
|
||||||
for (unsigned int x=0; x<sim2.getCount(); x++) {
|
for (unsigned int x=0; x<sim2.getCount(); x++) {
|
||||||
DX::SimObject obj2=DX::SimObject(sim2.getObject(x));
|
DX::SimObject obj2=DX::SimObject(sim2.getObject(x));
|
||||||
if ((strcmp((obj2.getClassName()),"SimGroup")!=0)&&(strcmp((obj2.getClassName()),"SimSet")!=0)) {
|
if ((strcmp((obj2.getClassName()),"SimGroup")!=0)&&(strcmp((obj2.getClassName()),"SimSet")!=0)) {
|
||||||
if (obj2.type&0x8){
|
if ((obj2.type&0x2028)){
|
||||||
DX::SceneObject sobj = DX::SceneObject(sim2.getObject(x));
|
DX::SceneObject sobj = DX::SceneObject(sim2.getObject(x));
|
||||||
DX::MatrixF mat1=DX::MatrixF(sobj.objtoworld);
|
DX::MatrixF mat1=DX::MatrixF(sobj.objtoworld);
|
||||||
DX::Point3F test;
|
DX::Point3F test;
|
||||||
|
|
@ -432,9 +435,14 @@ bool conclientCmdSetProcessTicks(Linker::SimObject *obj, S32 argc, const char* a
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
bool conSetProjDist(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||||
|
float distance = atof(argv[1]);
|
||||||
|
projdist=distance;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool conSetProcessTicks(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
bool conSetProcessTicks(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||||
|
|
||||||
unsigned int result_ptr = 0;
|
unsigned int result_ptr = 0;
|
||||||
unsigned int my_ptr = (unsigned int) obj;
|
unsigned int my_ptr = (unsigned int) obj;
|
||||||
if (atoi(argv[2])==1) {
|
if (atoi(argv[2])==1) {
|
||||||
__asm
|
__asm
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ extern "C"
|
||||||
Con::addMethodB(NULL,"clientCmdsetProcessTicks",&conclientCmdSetProcessTicks,"Client Command for disabling tick processing on ghost object",2,10);
|
Con::addMethodB(NULL,"clientCmdsetProcessTicks",&conclientCmdSetProcessTicks,"Client Command for disabling tick processing on ghost object",2,10);
|
||||||
Con::addMethodB(NULL,"clientCmdsetPosition",&conclientCmdSetPosition,"Client Command for setting transform on ghost object",2,10);
|
Con::addMethodB(NULL,"clientCmdsetPosition",&conclientCmdSetPosition,"Client Command for setting transform on ghost object",2,10);
|
||||||
// General
|
// General
|
||||||
|
Con::addMethodB(NULL,"setCollisionDistance",&conSetProjDist, "Sets Collision Distance for Collision Detection Algorithm",2,2);
|
||||||
Con::addMethodS(NULL, "sprintf", &conSprintf,"Formats a string. See the C sprintf.", 2, 20);
|
Con::addMethodS(NULL, "sprintf", &conSprintf,"Formats a string. See the C sprintf.", 2, 20);
|
||||||
Con::addMethodB(NULL, "tsExtensionUpdate", &conTSExtensionUpdate,"Updates the TSExtension.", 1, 1);
|
Con::addMethodB(NULL, "tsExtensionUpdate", &conTSExtensionUpdate,"Updates the TSExtension.", 1, 1);
|
||||||
Con::addMethodS(NULL, "getServPAddr",&congetServPAddr,"Gets the memPatch data for ServerProcess",1,1);
|
Con::addMethodS(NULL, "getServPAddr",&congetServPAddr,"Gets the memPatch data for ServerProcess",1,1);
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,28 @@ function onMoveRoutine(%obj, %offset, %center, %radius){
|
||||||
}
|
}
|
||||||
$collidegroup = new SimSet(CollideGroup);
|
$collidegroup = new SimSet(CollideGroup);
|
||||||
|
|
||||||
|
$ccd = new SimSet(ClientCommandGroup);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ProjCollisionCallback(%proj1, %proj2) {
|
function ProjCollisionCallback(%proj1, %proj2) {
|
||||||
echo(%proj1 SPC "collided with" SPC %proj2);
|
//echo(%proj1 SPC "collided with" SPC %proj2);
|
||||||
if (isObject(%proj1) {
|
if (isObject(%proj1)) {
|
||||||
if (isObject(%proj2) {
|
if (isObject(%proj2)) {
|
||||||
if (%proj1.sourceObject != %proj2.sourceObject) {
|
//if (%proj1.sourceObject != %proj2.sourceObject) {
|
||||||
|
if (CollideGroup.isMember(%proj2)) {
|
||||||
|
if (CollideGroup.isMember(%proj1)) {
|
||||||
CollideGroup.remove(%proj1);
|
CollideGroup.remove(%proj1);
|
||||||
CollideGroup.remove(%proj2);
|
CollideGroup.remove(%proj2);
|
||||||
|
echo("Radius Explosion");
|
||||||
|
RadiusExplosion(%proj1,%proj1.position,400,0,1000,%proj1.sourceObject,$DamageType::Default);
|
||||||
|
RadiusExplosion(%proj2,%proj2.position,400,0,1000,%proj2.sourceObject,$DamageType::Default);
|
||||||
%proj1.delete();
|
%proj1.delete();
|
||||||
%proj2.delete();
|
%proj2.delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +53,7 @@ function moveRoutineDone() {
|
||||||
%obj=MoveEffectSet.getObject(%x);
|
%obj=MoveEffectSet.getObject(%x);
|
||||||
if(%obj.getType() | $TypeMasks::PlayerObjectType) {
|
if(%obj.getType() | $TypeMasks::PlayerObjectType) {
|
||||||
if (%obj.isjetting() || %obj.isjumping() ) {
|
if (%obj.isjetting() || %obj.isjumping() ) {
|
||||||
echo ("Artificial Gravity Disengaged for" SPC %obj);
|
//echo ("Artificial Gravity Disengaged for" SPC %obj);
|
||||||
} else {
|
} else {
|
||||||
%obj.setPosition(VectorAdd(%obj.position,$moveoffset));
|
%obj.setPosition(VectorAdd(%obj.position,$moveoffset));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue