Creating X & Y for Cave

08/18/2011 00:01 hausmeister13#1
Hello,

i'd like to know if it's possible to create x and y coords for the cave.
it seems like the standard formula isn't working.

thanks!
08/18/2011 00:10 ÑõÑ_Ŝŧóp#2
Quote:
public static float cavegamex(float x)
{
byte sector = 0;
return ((sector - 135) * 192 + (x / 10));// ############################## CAVE COORD FORMULAS ######################################
}
public static float cavegamey(float y)
{
byte sector = 0;
return ((sector - 92) * 192 + (y / 10));
}
public static float cavepacketx(float x)
{
byte sector = 0;
return ((x - ((sector) - 135) * 192) * 10);
}
public static float cavepackety(float y)
{
byte sector = 0;
return ((y - ((sector) - 92) * 192) * 10);
}
from SRX source
08/18/2011 09:32 vorosmihaly#3
lol'd at xsense..he created new functions,just to make sector == 0?that was funny.
these are the "standard" formulas,with sector = 0,so no difference at all :D

edit: I have no idea if these are working,but as far as I know,it should be working without those 0's..
08/18/2011 10:12 MyMindSail#4
Quote:
Originally Posted by vorosmihaly View Post
lol'd at xsense..he created new functions,just to make sector == 0?that was funny.
these are the "standard" formulas,with sector = 0,so no difference at all :D

edit: I have no idea if these are working,but as far as I know,it should be working without those 0's..
Yeap, it's the same.
let's assume X is set to 2000:
Quote:
((2000 - ((0) - 135) * 192) * 10) = 279200
Now without that 0:
Quote:
((2000 - -135 * 192) * 10) = 279200
You don't even need the outside brackets:
Quote:
(2000 - -135 * 192) * 10 = 279200
08/18/2011 15:33 GSILKROAD#5
Quote:
Originally Posted by vorosmihaly View Post
lol'd at xsense..he created new functions,just to make sector == 0?that was funny.
these are the "standard" formulas,with sector = 0,so no difference at all :D

edit: I have no idea if these are working,but as far as I know,it should be working without those 0's..
yes its working with 0 sector and working without 0 so whats the problem ? Xsesne write the emulator with own programming style, so he use this formula but working too so who care that he use ?
08/18/2011 16:24 vorosmihaly#6
Quote:
Originally Posted by GSILKROAD View Post
yes its working with 0 sector and working without 0 so whats the problem ? Xsesne write the emulator with own programming style, so he use this formula but working too so who care that he use ?
I don't,but you know,it's pretty useless :)
08/18/2011 17:31 npcdoom#7
Well just for clarification about position formulas.

Assuming everyone understand what coordinate system is, if not google it =P.

Silkroad uses 3 types of coordinate system a global (used to display position in players screen with origin (0,0) at jangan city), another one to reference player position according to their current zone (used for movement related task outside areas with origin (0,0) at the bottom left corner of each zone this is done for precision issues with big float numbers and performing operations with them) and another one for dungeons witch atm this moment i dont know much about it because i never messed up with it (but i think their are at the center of the model).

So to calculate distance u need to calculate distance from where u are to origin, plain and simple theres no magic involved.

To calculate a "correct" dungeon position it would involve calculating the position from jangan to the dungeon, then adding the distance from your position to entrance (assuming its a 1 lv only cave like dw) if it got more then keep doing the same as before to each lv.