mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-07-11 22:44:48 +00:00
Renamed Server to servertest.cs
made some upgrades to the scripts, and added in movement for players and vehicles inside a moving base. Also added a real setMPS function with x, y, and z.
This commit is contained in:
parent
cc00588cca
commit
4830623b7a
6 changed files with 58 additions and 19 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -6,7 +6,10 @@
|
|||
#include <DXAPI/DXAPI.h>
|
||||
#include <DXAPI/MatMath.h>
|
||||
static float counter=0;
|
||||
static float mps=0.0;
|
||||
static float mpsx=0.0;
|
||||
static float mpsy=0.0;
|
||||
static float mpsz=0.0;
|
||||
static bool moveplayerstoo=1;
|
||||
static bool clientupdate=false;
|
||||
static float timecounter=0;
|
||||
#define CMALLOC (char*)malloc
|
||||
|
|
@ -60,7 +63,7 @@ void setClientPosition(unsigned int object,DX::Point3F pos){
|
|||
sendGhostCommandAll(5,object,pos);
|
||||
|
||||
}
|
||||
void moveRecursive(unsigned int simgroup,float xoff){
|
||||
void moveRecursive(unsigned int simgroup,float xoff, float yoff, float zoff){
|
||||
|
||||
unsigned int mainsim=(unsigned int)simgroup;
|
||||
if (mainsim) {
|
||||
|
|
@ -76,14 +79,22 @@ void moveRecursive(unsigned int simgroup,float xoff){
|
|||
DX::Point3F test;
|
||||
mat1.getColumn(3,&test);
|
||||
test.x+=xoff;
|
||||
test.y+=yoff;
|
||||
test.z+=zoff;
|
||||
mat1.setColumn(3,&test);
|
||||
sobj.setTransform(mat1.m);
|
||||
if (moveplayerstoo==1) {
|
||||
char evalstr[512]="";
|
||||
|
||||
sprintf (evalstr,"onMoveRoutine(%d,\"%g %g %g\",\"%g %g %g\",%g);",sobj.identifier,xoff,yoff,zoff,sobj.worldspherecenter.x,sobj.worldspherecenter.y,sobj.worldspherecenter.z,sobj.worldsphereradius);
|
||||
Con::eval(evalstr,false,NULL);
|
||||
}
|
||||
if (clientupdate==true) {
|
||||
setClientPosition(sobj.base_pointer_value,test);
|
||||
setClientPosition(sobj.base_pointer_value,test);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
moveRecursive(sim2.getObject(x),xoff);
|
||||
moveRecursive(sim2.getObject(x),xoff,yoff,zoff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +141,8 @@ void serverProcessReplacement(unsigned int timeDelta) {
|
|||
if (Sim::findObjectc("MoveGroup")) {
|
||||
basex+=counter;
|
||||
DX::SceneObject sobj = DX::SceneObject((unsigned int)Sim::findObjectc("MoveGroup"));
|
||||
moveRecursive((unsigned int)Sim::findObjectc("MoveGroup"),(mps*((float)((timeDelta)*0.001))));
|
||||
moveRecursive((unsigned int)Sim::findObjectc("MoveGroup"),(mpsx*((float)((timeDelta)*0.001))),(mpsy*((float)((timeDelta)*0.001))),(mpsz*((float)((timeDelta)*0.001))));
|
||||
Con::eval("MoveRoutineDone();",false,NULL);
|
||||
}
|
||||
if (clientupdate==true) {
|
||||
timecounter=0;
|
||||
|
|
@ -185,7 +197,9 @@ const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]
|
|||
return test2;
|
||||
}
|
||||
bool conSetMPS(Linker::SimObject *obj, S32 argc, const char *argv[]) {
|
||||
mps=atof(argv[1]);
|
||||
mpsx=atof(argv[1]);
|
||||
mpsy=atof(argv[2]);
|
||||
mpsz=atof(argv[3]);
|
||||
return false;
|
||||
}
|
||||
const char *conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[])
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ extern "C"
|
|||
Con::addMethodS("GrenadeProjectile", "getvelocity", &conGrenadeProjectileGetVelocity,"Gets the velocity of the GrenadeProjectile", 2, 2);
|
||||
Con::addMethodB("Projectile", "makeNerf", &conProjectileMakeNerf,"Makes the Projectile deal no damage", 2, 2);
|
||||
Con::addMethodS("SceneObject", "getPositionTest", &conGetPosition,"Gets the Rotation by alternate means as a test", 2, 2);
|
||||
Con::addMethodB(NULL,"setMPS",&conSetMPS,"sets meters per second for turret", 2, 2);
|
||||
Con::addMethodB(NULL,"setMPS",&conSetMPS,"sets meters per second for turret in format x,y,z", 4, 4);
|
||||
// TCPObject
|
||||
#ifdef ENABLE_TCPOBJECT
|
||||
Con::addMethodS("TCPObject", "connect", &conTCPObjectConnect, "Connects to a remote server", 3, 3);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue