From 4830623b7af459cff903a1c07318ecc52181b541 Mon Sep 17 00:00:00 2001 From: Calvin Balke Date: Wed, 28 Jan 2015 14:36:38 -0800 Subject: [PATCH] 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. --- Mod Sources/TSExtension/TSExtension.opensdf | Bin 32 -> 0 bytes Mod Sources/TSExtension/TSExtension.suo | Bin 32768 -> 44544 bytes .../TSExtension/source/DXConCmds.cpp | 26 +++++++++--- .../TSExtension/source/dllmain.cpp | 2 +- Patches/server.cs | 12 ------ Patches/servertest.cs | 37 ++++++++++++++++++ 6 files changed, 58 insertions(+), 19 deletions(-) delete mode 100644 Mod Sources/TSExtension/TSExtension.opensdf delete mode 100644 Patches/server.cs create mode 100644 Patches/servertest.cs diff --git a/Mod Sources/TSExtension/TSExtension.opensdf b/Mod Sources/TSExtension/TSExtension.opensdf deleted file mode 100644 index 34b05c33acb9e053e85c5a1452d1568bc508dac6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 lcmeZgC}+rHNM$HuFk)a}@Mj2T@MCag2mDc3Wh3o@=>wP+A&LTd2Hp7_=Q46Vz>A z2{qCR2j=%7xiLlJYs*SJb7`7aYxZkU1s%8ZJgvLydL_x^IWF3~82!~d>$U%5XX@GOeM_8MhkY7d_#U8kv ztAwAc(pd)OzN|+zQv_F3*~t!KBweV%O4{Jhs)rK1sEa3R*pl4@UD+~Wd-e>&79!c_ z!eUMWGhI-UKa5=h#EsoNXqJyS$nrFH%~4|sH0`NnE(2q)x--2m`d#(y*#98HixNEg zssU9R$S`tvu)I7#S}G?4#O%&1J=A%w`i&oQ*NfgaEP~vWnLI=eU`J~2#R&2SyJ0%d z053~*OqmeK8)xFFm&Iqo-}4VMS_r7e8J+N%I+=m1xkd2oUKz~p$x$Sl+B?pdoE`kx z^G_`no|leFL1Ee`OcY#Tq-r_{als2G8RkrcvKRe<`>kXMeK9DGg<7ln{DkZE)Vb0@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rcN(Vq&raWPC|%+lV^7dl!5=i zdSE}i0KL!$L6D)iw8Y$-a<%$&MOt%}qk22BxID!b{kcxxk5`yjA7CQY1uIC76Y1;N z+oBowkZn_zWJ2&Ng-sr#kc`l#w6X`%|CQZRnOHL@wrO0W1 zCf$qCr<8Dd6qAw=$~19m58W(?rrI}5RDN=pE*!UFkg?DzH=Q@xS+3H(D##3ZsLhY1 zfA8sG4(hfAnNzuCi)A5e7G;&B>Kn&n@b{J|a>kcTG@zFMk%~X_FiU8~?CrzscL{6N zc{kCPN89Prkd^h}*}Ev$9j_MziQ?>MX!x;o+HmqKO04Llkxe3vyfrhHEi?M;#5QU= zVPz|DZ&_43)<~z&L=`zsN*J)wfWsq|HW;S8LG_uzf_07hUG#z27&;UoAMK7mELQq&Th zK=chv@(f14i1reEtM$J}`vd%_^{=4)34Yf4SJ7UBU$p+OXm7x8TK{*nvsyfl_D`6D zzalxq(%(E#z9{Y!jg0?&{3zqgkNl5}liO!k{3YHbNj)9Ow!G_Vv2k-zxK1l(7pS|g zhR%z2X$q-pO1RD=N^GtAb>t@LJ9K6!Q14MU#$~!yUt`2M6gf!MlVcj4X$mx;0s~z~ z4+Aw|$Fl;&MWB|=AUH;Wrp?jnwpvc#L@-C;rpVoY@H7Q{IE6A0x_Fmwss*1{!tnVb z*3^O$Xc^F%`6|_c9u~>m<~FAwvcO87QG9J3q9|zt(87*!BP&GjAuS^%qiR+OcX&mS TpMC0M{JY1^{4ErJ-(mJ201(b> diff --git a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp index d050351..32732f6 100644 --- a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp @@ -6,7 +6,10 @@ #include #include 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[]) diff --git a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp index de43af3..ceb78a7 100644 --- a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp @@ -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); diff --git a/Patches/server.cs b/Patches/server.cs deleted file mode 100644 index 138bdb4..0000000 --- a/Patches/server.cs +++ /dev/null @@ -1,12 +0,0 @@ -// this is a test for katabatic only with both client and server running their scripts. -// this should be run after joining the game, or you will fall through the map on spawn where the Team1 base used to be. - - - - - - -memPatch("5BBBDC",getServPAddr()); //Hooks the serverProcess function -$mg = new SimSet(MoveGroup); -MoveGroup.add(Team1); //Adds the Team1 base to the movement group -setMPS(0.5); // Moves the base 0.5 meters per second on the X axis. \ No newline at end of file diff --git a/Patches/servertest.cs b/Patches/servertest.cs new file mode 100644 index 0000000..ffd4e77 --- /dev/null +++ b/Patches/servertest.cs @@ -0,0 +1,37 @@ +// this is a test for katabatic only with both client and server running their scripts. +// this should be run after joining the game, or you will fall through the map on spawn where the Team1 base used to be. + + + + + +$movesim = new SimSet(MoveEffectSet); +function onMoveRoutine(%obj, %offset, %center, %radius){ + + InitContainerRadiusSearch(%obj.getWorldBoxCenter(),%radius,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType); + %obj2=ContainerSearchNext(); + + while (%obj2) { + if (!(MoveEffectSet.isMember(%obj2))) { + MoveEffectSet.add(%obj2); + } + + %obj2 = ContainerSearchNext(); + } + + $moveoffset=%offset; +} + +function moveRoutineDone() { + for (%x=0;%x<(MoveEffectSet.getCount()); %x++) { + %obj=MoveEffectSet.getObject(%x); + %obj.setPosition(VectorAdd(%obj.position,$moveoffset)); + } + MoveEffectSet.clear(); + +} + +memPatch("5BBBDC",getServPAddr()); //Hooks the serverProcess function +$mg = new SimSet(MoveGroup); +MoveGroup.add(Team1); //Adds the Team1 base to the movement group +setMPS(-10,0.0,0.0); // Moves the base 0.5 meters per second on the X axis. \ No newline at end of file