Alright I have my self a cog that will at the start of a game find and compress all the floor surfaces in the level into a large set of vectors comprised of 3x3 spaces for a three didget surface ref.
i.e X= 000 000 000 || Y= 000 000 000 || Z= 000 000 000
surf1=20
surf2=200
surf3=999
surf4=2
and so on ...
Equals
X= 020200999 || Y= 002000000
Now thats all fine and good... but when it becomes time to decompile it again so you get 9 surface refs from one vector ... thats when the problems arise ...
Now the first part where it compile it into a vector works fine .... but the decompiling part stuff up ... you see to find out what the problem was I put in alot of print messages to see where things are going wrong ...
I tried the cog on Canyon Oasis and this is what it returned from the printing ...
Note: That all the numbers from the decompiled vector do not actaly match the same as the top vector; that is done purposly as I do not have enough time to write out the real vector. But trust me it all is the same and correct
Now finnaly getting to the point you see that the closest surface to the player (that is worked out manually because i'm having trouble with the cog) is 32 and one of the numbers in the decompiled surface is 32... now in the cog I have the statments if(surf == closesurf) that should then call and print the message "Surface" if the closest surface equals one of the decompiled surfaces (which it does).
But it doesn't![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)
Why ??? Does anyone have any answer to my problem ???
Oh BTW ... I hope I didn't confuse anyone with that last paragraph i'm kinda in a hurry to finish this message...
Thanks
*_Seifer_*
i.e X= 000 000 000 || Y= 000 000 000 || Z= 000 000 000
surf1=20
surf2=200
surf3=999
surf4=2
and so on ...
Equals
X= 020200999 || Y= 002000000
Now thats all fine and good... but when it becomes time to decompile it again so you get 9 surface refs from one vector ... thats when the problems arise ...
Code:
startup: num=0; newcount=1; for(i=0; i<GetSurfaceCount(); i=i+1) { if(GetSurfaceFlags(i) & 0x1 && newcount < 15 && i < 1000) { num=num+1; if(num > 9) { num=1; newcount=newcount+1; } if(num == 1) surf0[newcount]=VectorSet(VectorX(surf0[newcount]) + i*n1, VectorY(surf0[newcount]), VectorZ(surf0[newcount])); if(num == 2) surf0[newcount]=VectorSet(VectorX(surf0[newcount]) + i*n2, VectorY(surf0[newcount]), VectorZ(surf0[newcount])); if(num == 3) surf0[newcount]=VectorSet(VectorX(surf0[newcount]) + i*n3, VectorY(surf0[newcount]), VectorZ(surf0[newcount])); if(num == 4) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]) + i*n1, VectorZ(surf0[newcount])); if(num == 5) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]) + i*n2, VectorZ(surf0[newcount])); if(num == 6) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]) + i*n3, VectorZ(surf0[newcount])); if(num == 7) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]), VectorZ(surf0[newcount]) + i*n1); if(num == 8) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]), VectorZ(surf0[newcount]) + i*n2); if(num == 9) surf0[newcount]=VectorSet(VectorX(surf0[newcount]), VectorY(surf0[newcount]), VectorZ(surf0[newcount]) + i*n3); } } for(i=0; i<newcount; i=i+1) { close=9999; for(e=0; e<GetSurfaceCount(); e=e+1) { dist=VectorDist(GetSectorCenter(e), GetThingPos(player)); if(dist < close && GetSurfaceFlags(e) & 0x1) { close=dist; closesurf=e; } } jkStringClear(); jkStringConcatAsciiString("Current Vector= "); jkStringConcatVector(surf0); jkStringOutput(-3, -1); jkStringClear(); jkStringConcatAsciiString("Close Surf= "); jkStringConcatInt(closesurf); jkStringOutput(-3, -1); first=VectorX(surf0)/n1; surf=first; if(surf == closesurf) call found; third=VectorX(surf0)%n2; surf=third; if(surf == closesurf) call found; temp=VectorX(surf0)%n1; temp2=temp-third; second=temp2/1000; surf=second; if(surf == closesurf) call found; jkStringClear(); jkStringConcatAsciiString("VectorX Surface1 Vector= "); jkStringConcatInt(first); jkStringConcatAsciiString(" VectorX Surface2 Vector= "); jkStringConcatInt(second); jkStringConcatAsciiString(" VectorX Surface3 Vector= "); jkStringConcatInt(third); jkStringOutput(-3, -1); first=VectorY(surf0)/n1; surf=first; if(surf == closesurf) call found; third=VectorY(surf0)%n2; surf=third; if(surf == closesurf) call found; temp=VectorY(surf0)%n1; temp2=temp-third; second=temp2/1000; surf=second; if(surf == closesurf) call found; jkStringClear(); jkStringConcatAsciiString("VectorY Surface1 Vector= "); jkStringConcatInt(first); jkStringConcatAsciiString(" VectorY Surface2 Vector= "); jkStringConcatInt(second); jkStringConcatAsciiString(" VectorY Surface3 Vector= "); jkStringConcatInt(third); jkStringOutput(-3, -1); first=VectorZ(surf0)/n1; surf=first; if(surf == closesurf) call found; third=VectorZ(surf0)%n2; surf=third; if(surf == closesurf) call found; temp=VectorZ(surf0)%n1; temp2=temp-third; second=temp2/1000; surf=second; if(surf == closesurf) call found; jkStringClear(); jkStringConcatAsciiString("VectorZ Surface1 Vector= "); jkStringConcatInt(first); jkStringConcatAsciiString(" VectorZ Surface2 Vector= "); jkStringConcatInt(second); jkStringConcatAsciiString(" VectorZ Surface3 Vector= "); jkStringConcatInt(third); jkStringOutput(-3, -1); Sleep(5); } return; found: Print("Surface"); return;
Now the first part where it compile it into a vector works fine .... but the decompiling part stuff up ... you see to find out what the problem was I put in alot of print messages to see where things are going wrong ...
I tried the cog on Canyon Oasis and this is what it returned from the printing ...
Quote:
<font face="Verdana, Arial" size="2">
Current Vector = (012016022.000000, 024026032, 042056126)
CloseSurf = 32
VectorX Surface1 Vector = 13 VectorX Surface2 Vector = 15 VectorX Surface3 Vector = 22
VectorY Surface1 Vector = 32 VectorY Surface2 Vector = 33 VectorY Surface3 Vector = 42
VectorZ Surface1 Vector = 51 VectorZ Surface2 Vector = 53 VectorZ Surface3 Vector = 60
</font>
Current Vector = (012016022.000000, 024026032, 042056126)
CloseSurf = 32
VectorX Surface1 Vector = 13 VectorX Surface2 Vector = 15 VectorX Surface3 Vector = 22
VectorY Surface1 Vector = 32 VectorY Surface2 Vector = 33 VectorY Surface3 Vector = 42
VectorZ Surface1 Vector = 51 VectorZ Surface2 Vector = 53 VectorZ Surface3 Vector = 60
</font>
Note: That all the numbers from the decompiled vector do not actaly match the same as the top vector; that is done purposly as I do not have enough time to write out the real vector. But trust me it all is the same and correct
Now finnaly getting to the point you see that the closest surface to the player (that is worked out manually because i'm having trouble with the cog) is 32 and one of the numbers in the decompiled surface is 32... now in the cog I have the statments if(surf == closesurf) that should then call and print the message "Surface" if the closest surface equals one of the decompiled surfaces (which it does).
But it doesn't
![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)
Why ??? Does anyone have any answer to my problem ???
Oh BTW ... I hope I didn't confuse anyone with that last paragraph i'm kinda in a hurry to finish this message...
Thanks
*_Seifer_*