imk0tter

Imk0tter

Dec 10th, 2010
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 16.96 KB | None | 0 0
  1. /* Imports */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #import <math.h>
  5. /* End Imports */
  6.  
  7. /* Defines */
  8. #define PLAYER_WEIGHT_MAX 20
  9. #define PLAYER_WEIGHT_FLUX 12
  10.  
  11. #define WORLD_GRID_SIZE 8192
  12. #define WORLD_AXIS 3
  13. #define WORLD_OFFSET 4096
  14. #define FREQUENCY_DEPTH 20
  15. #define PREDICTION_DEPTH 30
  16. #define UNITS_PER_SQUARE 16
  17. /* End Defines */
  18.  
  19. /* Structs */
  20. typedef struct Neuron {
  21.     Dendrite * root;
  22.     unsigned long long frequency;
  23.     int x, int y, int z
  24. };
  25.  
  26. typedef struct NeuronList {
  27.     NeuronList * left;
  28.     NeuronList * right;
  29.     Neuron * neuron;
  30. }
  31. typedef struct Dendrite{
  32.     Dendrite * left;
  33.     Dendrite * right;
  34.     unsigned long long frequency;
  35.     Frequency * root;
  36. };
  37.  
  38. typedef struct Frequency {
  39.     Frequency * left;
  40.     Frequency * right;
  41.     unsigned long long frequency;
  42.     PlayerWeight * proot;
  43.     Synapse * root;
  44. };
  45.  
  46. typedef struct Synapse {
  47.     Synapse * left;
  48.     Synapse * right;
  49.     PlayerWeight * root;
  50.     Neuron * neuron;
  51. };
  52.  
  53. typedef struct PlayerWeight {
  54.     PlayerWeight * left;
  55.     PlayerWeight * right;
  56.     long playerId;
  57.     int count;
  58. };
  59.  
  60. typedef struct PlayerPath {
  61.     PlayerPath * prev;
  62.     Neuron * neuron;
  63. };
  64. typedef struct SynapseTree {
  65.     SynapseOffset * left;
  66.     SynapseOffset * right;
  67.     float value;
  68.     Synapse * synapse;
  69. };
  70. typedef struct FrequencyOffset {
  71.     FrequencyOffset * left;
  72.     FrequencyOffset * right;
  73.     unsigned long long offset;
  74.     Frequency * frequency;
  75. };
  76. typedef struct TreeDictRoot {
  77.     TreeDict * root;
  78.     int count;
  79. };
  80. typedef struct TreeDict {
  81.     TreeDict * left;
  82.     TreeDict * right;
  83.     int id;
  84.     long pointer;
  85.     void * data;
  86. };
  87. /* End Structs */
  88.  
  89. /* Prototypes */
  90. PlayerPath * createPath(Player * p, NeuronList * neuronListRoot);
  91. PlayerPath * updatePath(Player * p, PlayerPath * prev, neuronList, neuronListRoot);
  92. void updateNeuron(Player * p, PlayerPath * path, unsigned long long pathFreq);
  93.  
  94. PlayerPath * generatePrediction(Player * p, PlayerPath * root) ;
  95. PlayerPath * generatePrediction(Player * p, PlayerPath * root,PlayerPath * prediction, int count);
  96.  
  97. Neuron * getNeuron(int x, int y, int z, NeuronList * neuronListRoot);
  98. Neuron * getNeuron(NeuronList * neuron, unsigned long long frequency,int x, int y, int z);
  99.  
  100. SynapseTree * createSynapseTree(Frequency * freq, Player * p);
  101. SynapseTree * buildSynapseTree(SynapseTree * tree, Synapse * root, Player * p);
  102. SynapseTree * addSynapseTree(SynapseTree * tree, Synapse * root,float weight);
  103.  
  104. Synapse * getSynapse(Frequency * freq, Player * p, bool retNew);
  105. Synapse * getSynapse(Frequency * freq, Player * p);
  106.  
  107. Synapse * updateSynapse(Frequency * freq, Player * p, Neuron * n);
  108. Synapse * updateSynapse(Synapse * root,Player * p, Neuron * n);
  109.  
  110. FrequencyOffset * addFrequencyOffset(FrequencyOffset * ret, Frequency * freq, unsigned long long offset);
  111. FrequencyOffset * fillFrequencyOffset(FrequencyOffset * ret, Frequency * freq, Player * p, unsigned long long parentFreq,bool sniff,bool retNew);
  112. FrequencyOffset * createFrequencyOffset(Frequency * freq, Player * p, unsigned long long parentFreq, bool retNew);
  113. FrequencyOffset * getFrequency(FrequencyOffset * freq,Player * p);
  114.  
  115. Frequency * getFrequency(Dendrite * dend,unsigned long long parentFreq,Player * p,bool retNew);
  116. Frequency * getFrequency(Dendrite * dend,unsigned long long p,Player * pl);
  117.  
  118. Dendrite * getDendrite(Dendrite * dend, unsigned long long parentFreq, bool retNew);
  119. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq,bool retNew);
  120. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq);
  121.  
  122. void deallocateFrequencyOffsetTree(FrequencyOffset * root);
  123. void deallocatePlayerPath(PlayerPath * path);
  124. void deallocateSynapseTree(SynapseTree * tree);
  125. void removePathNodes(PlayerPath * root,int count);
  126.  
  127. void exportNetwork(NeuronList * root, char * fileName);
  128. void importNetwork(NeuronList ** root, char * fileName);
  129.  
  130. float frequencyWeight(PlayerWeight * weight);
  131. PlayerWeight * getPlayerWeight(PlayerWeight * pw, Player * p);
  132.  
  133. unsigned long long pathFrequency(PlayerPath * path);
  134. int transformCoord(int xyz);
  135. /* End Prototypes */
  136.  
  137. /* Methods & functions */
  138.  
  139. void collapseNeuronList(NeuronList * root, TreeDictRoot * nodeDict, TreeDictRoot * dendriteDict, TreeDictRoot * frequencyDict, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  140.     if (!root) return;
  141.     collapseNeuron(root->neuron,nodeDict);
  142.     collapseDendriteList(root->neuron->root,dendriteDict,frequencyDict,synapseDict,playerWeightDict);
  143.     collapseNeuronList(root->left,nodeDict,dendriteDict,frequencyDict,synapseDict,playerWeightDict);
  144.     collapseNeuronList(root->right,nodeDict,dendriteDict,frequencyDict,synapseDict,playerWeightDict);
  145.    
  146. }
  147. void collapseNeuron(Neuron * n, TreeDictRoot * nodeDict) {
  148.     if (nodeDict->root == NULL) {
  149.         nodeDict->root = malloc(sizeof(TreeDict));
  150.        
  151.     }
  152. }
  153.  
  154. void collapseDendriteList(Dendrite * root, TreeDictRoot * dendriteDict, TreeDictRoot * frequencyDict, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  155. }
  156. void collapseFrequencyList(Frequency * root, TreeDictRoot * frequencyDict, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  157. }
  158. void collapseSynapseList(Synapse * root, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  159. }
  160. void collapsePlayerWeightList(PlayerWeight * root, TreeDictRoot * playerWeightDict) {
  161. }
  162. void exportNetwork(NeuronList * root, char * fileName) {
  163.     TreeDictRoot * nodeDict = malloc(sizeof(TreeDictRoot));
  164.     TreeDictRoot * dendriteDict = malloc(sizeof(TreeDictRoot));
  165.     TreeDictRoot * frequencyDict = malloc(sizeof(TreeDictRoot));
  166.     TreeDictRoot * synapseDict = malloc(sizeof(TreeDictRoot));
  167.     TreeDictRoot * playerWeightDict = malloc(sizeof(TreeDictRoot));
  168.     nodeDict->count = 0;
  169.     dendriteDict->count = 0;
  170.     frequencyDict->count = 0;
  171.     synapseDict->count = 0;
  172.     playerWeightDict->count = 0;
  173.     collapseNeuronList(root,nodeDict,dendriteDict,frequencyDict,synapseDict,playerWeightDict);
  174. //HELP: Need help coming up with a way to export a NeuronList
  175. }
  176. void importNetwork(NeuronList ** root, char * fileName) {
  177. //HELP: Need help coming up with a way to import a NeuronList
  178. }
  179.  
  180. PlayerPath * generatePrediction(Player * p, PlayerPath * root) {
  181.     return generatePrediction(p, root, NULL, 0);
  182. }
  183. void removePathNodes(PlayerPath * root,int count) {
  184.     if (!count) return;
  185.     PlayerPath * temp = root->prev;
  186.     free(root);
  187.     root = temp;
  188.     removePathNodes(root,--count);
  189. }
  190. PlayerPath * generatePrediction(Player * p, PlayerPath * root,PlayerPath * prediction, int count) {
  191.     if (count == PREDICTION_DEPTH) {
  192.         removePathNodes(root,count);
  193.         return prediction;
  194.     }
  195.     Frequency * freq = getFrequency(getDendrite(root->neuron,root->prev->neuron->frequency),pathFrequency(root->prev),p,false);
  196.     if (!freq) {
  197.         removePathNodes(root, count);
  198.         return prediction;
  199.     }
  200.     Synapse * syn = getSynapse(freq,p);
  201.     if (!syn) {
  202.         removePathNodes(root, count);
  203.         return prediction;
  204.     }
  205.     PlayerPath * ret = malloc(sizeof(PlayerPath));
  206.     ret->neuron = syn->neuron;
  207.     ret->prev = root;
  208.     PlayerPath * rett = prediction;
  209.     prediction = malloc(sizeof(PlayerPath));
  210.     prediction->neuron = syn->neuron;
  211.     if (rett)
  212.         prediction->prev = rett;
  213.     else
  214.         prediction->prev = prediction;
  215.     return generatePrediction(p,ret,prediction,++count);
  216.     //TODO: Fix getFrequency to only create a new frequency if retNew == true - DONE
  217.    
  218. }
  219. Neuron * getNeuron(int x, int y, int z, NeuronList * neuronListRoot) {
  220.     x = transformCoord(x);
  221.     y = transformCoord(y);
  222.     z = transformCoord(z);
  223.     unsigned long long frequency = z * WORLD_GRID_SIZE^2 + y * WORLD_GRID_SIZE^1 + x;
  224.     return getNeuron(neuronListRoot, frequency,x,y,z);
  225. }
  226. Neuron * getNeuron(NeuronList * neuron, unsigned long long frequency,int x, int y, int z) {
  227.     if (neuron->neuron->frequency == frequency) return neuron->neuron;
  228.     else if (neuron->neuron->frequency > frequency) {
  229.         if (!neuron->left) {
  230.             neuron->left = malloc(sizeof(NeuronList));
  231.             neuron->left->neuron = malloc(sizeof(Neuron));
  232.             neuron->left->neuron->frequency = frequency;
  233.             neuron->left->neuron->x = x;
  234.             neuron->left->neuron->y = y;
  235.             neuron->left->neuron->z = z;
  236.             return neuron->left->neuron
  237.         }
  238.         return getNeuron(neuron->left,frequency);
  239.     }
  240.     else {
  241.         if (!neuron->right) {
  242.             neuron->right = malloc(sizeof(NeuronList));
  243.             neuron->right->neuron = malloc(sizeof(Neuron));
  244.             neuron->right->neuron->frequency = frequency;
  245.             neuron->right->neuron->x = x;
  246.             neuron->right->neuron->y = y;
  247.             neuron->right->neuron->z = z;
  248.             return neuron->right->neuron
  249.         }
  250.         return getNeuron(neuron->left,frequency);
  251.     }
  252. }
  253. PlayerPath * createPath(Player * p, NeuronList * neuronListRoot) {
  254.     return updatePath(p,NULL);
  255. }
  256.  
  257. PlayerPath * updatePath(Player * p, PlayerPath * prev, NeuronList * neuronListRoot) {
  258.     PlayerPath * ret;
  259.     ret = malloc(sizeof(PlayerPath));
  260.     if (prev == NULL) {
  261.         ret->prev = ret;
  262.         prev = ret;
  263.     }
  264.     else
  265.         ret->prev = prev;
  266.     ret->neuron = getNeuron(p->x,p->y,p->z,neuronListRoot);
  267.     updateNeuron(p,ret,pathFrequency(prev->prev));
  268.     return ret;
  269. }
  270. void updateNeuron(Player * p, PlayerPath * path, unsigned long long pathFreq) {
  271.     //getDendrite(path->neuron,path->prev->neuron->frequency,true),pathFreq));
  272.     updateSynapse(getFrequency(getDendrite(path->prev->neuron,path->prev->prev->neuron->frequency),pathFreq,p,true)->root,p,path->neuron);
  273.     getDendrite(path->neuron,path->prev->neuron);
  274. }
  275. Synapse * updateSynapse(Frequency * freq, Player * p, Neuron * n) {
  276.     return updateSynapse(p,n,freq->root)
  277. }
  278. Synapse * updateSynapse(Synapse * root,Player * p, Neuron * n) {
  279.     if (!root) {
  280.         root = malloc(sizeof(Synapse));
  281.         root->root = getPlayerWeight(NULL,p);
  282.         root->neuron = n;
  283.     }
  284.     if (root->neuron->frequency == n->frequency) {
  285.         return root;
  286.     }
  287.     else if (root->neuron->frequency > n->frequency) {
  288.         return updateSynapse(root->left,p,n);
  289.     }
  290.     else {
  291.         return updateSynapse(root->right,p,n);
  292.     }
  293. }
  294. SynapseTree * createSynapseTree(Frequency * freq, Player * p) {
  295.     return buildSynapseTree(NULL,ret,freq->root,p);
  296. }
  297. SynapseTree * buildSynapseTree(SynapseTree * tree, Synapse * root, Player * p) {
  298.     if (!root) return tree;
  299.     float weight = frequencyWeight(getPlayerWeight(root->root,p));
  300.     addSynapseTree(tree,root,weight)
  301.     buildSynapseTree(tree,root->left,p);
  302.     buildSynapseTree(tree,root->right,p);
  303.     return tree;
  304. }
  305. SynapseTree * addSynapseTree(SynapseTree * tree, Synapse * root,float weight) {
  306.     if (!root) return tree;
  307.     if (!tree) {
  308.         tree = malloc(sizeof(SynapseTree));
  309.         tree->synapse = root;
  310.         tree->value = weight;
  311.         return tree;
  312.     }
  313.     if (tree->value > weight) {
  314.         if (tree->left == NULL) {
  315.             tree->left = malloc(sizeof(SynapseTree));
  316.             tree->left->value = weight;
  317.             tree->left->synapse = root;
  318.             return tree;
  319.         }
  320.         addSynapseTree(tree->left,root,weight);
  321.     }
  322.     if (tree->value < weight) {
  323.         if (tree->right = NULL) {
  324.             tree->right = malloc(sizeof(SynapseTree));
  325.             tree->right->value = weight;
  326.             tree->right->synapse = root;
  327.             return tree;
  328.         }
  329.         addSynapseTree(tree->right,root,weight);
  330.     }
  331.     return tree;
  332. }
  333. Synapse * getSynapse(Frequency * freq, Player * p, bool retNew) {
  334.     createSynapseTree(freq->synapse,p,retNew)
  335. }
  336. Synapse * getSynapse(Frequency * freq, Player * p) {
  337.     createSynapseTree(freq->synapse,p,false);
  338. }
  339.  
  340. PlayerWeight * getPlayerWeight(PlayerWeight * pw, Player * p) {
  341.     //TODO: Replace steamID variable with real
  342.     if (pw == NULL) {
  343.         pw = malloc(sizeof(PlayerWeight));
  344.         pw->playerId = p->steamID;
  345.         pw->count = 1;
  346.         pw->weight = 1;
  347.         return pw;
  348.     }
  349.     if (pw->playerId > p->steamID) {
  350.         if (pw->left == NULL) {
  351.             pw->left = malloc(sizeof(PlayerWeight));
  352.             pw->left->playerId = p->steamID;
  353.             pw->left->count = 1;
  354.             pw->left->weight = 1;
  355.             return pw->left;
  356.         }
  357.         return getPlayerWeight(pw->left, p);
  358.     }
  359.     if (pw->playerId < p->steamID) {
  360.         if (pw->right == NULL) {
  361.             pw->right = malloc(sizeof(PlayerWeight));
  362.             pw->right->playerId = p->steamID;
  363.             pw->right->count = 1;
  364.             pw->right->weight = 1;
  365.             return pw->right;
  366.         }
  367.         return getPlayerWeight(pw->right, p);
  368.     }
  369.     pw->count++;
  370.     return pw;
  371. }
  372.  
  373. FrequencyOffset * addFrequencyOffset(FrequencyOffset * ret, Frequency * freq, unsigned long long offset) {
  374.     if (ret->offset > offset) {
  375.         if (ret->left == NULL) {
  376.             ret->left = malloc(sizeof(FrequencyOffset));
  377.             ret->left->frequency = freq;
  378.             ret->left->offset = offset;
  379.             return ret->left;
  380.         }
  381.         else {
  382.             return addFrequencyOffset(ret->left,freq,offset);
  383.         }
  384.     }
  385.     if (ret->offset < offset) {
  386.         if (ret->right == NULL) {
  387.             ret->right = malloc(sizeof(FrequencyOffset));
  388.             ret->right->frequency = freq;
  389.             ret->right->offset = offset;
  390.             return ret->right;
  391.         }
  392.         else {
  393.             return addFrequencyOffset(ret->right,freq,offset);
  394.         }
  395.     }
  396.     return ret;
  397. }
  398.  
  399. FrequencyOffset * fillFrequencyOffset(FrequencyOffset * ret, Frequency * freq, Player * p, unsigned long long parentFreq,bool sniff,bool retNew) {
  400.     if (sniff) {
  401.         if (freq->frequency > parentFreq) {
  402.             if (freq->right != NULL)
  403.                 fillFrequencyOffset(freq->right,p,parentFreq,false,retNew);
  404.             if (freq->left == NULL) {
  405.                 if (retNew) {
  406.                     freq->left = malloc(sizeof(Frequency));
  407.                     freq->left->frequency = parentFreq;
  408.                     freq->left->proot = malloc(sizeof(PlayerWeight));
  409.                     freq->left->proot->count = 1;
  410.                     freq->left->proot->playerId = p->steamId;
  411.                     fillFrequencyOffset(ret,freq->left,p,parentFreq,false,retNew);
  412.                 }
  413.                 return ret;
  414.             }
  415.             else {
  416.                 fillFrequencyOffset(ret,freq->left,p,parentFreq,true,retNew);
  417.             }
  418.         }
  419.         if (freq->frequency < parentFreq) {
  420.             if (freq->left != NULL)
  421.                 fillFrequencyOffset(freq->left,p,parentFreq,false,retNew);
  422.             if (freq->right == NULL) {
  423.                 if (retNew) {
  424.                     freq->right = malloc(sizeof(Frequency));
  425.                     freq->right->frequency = parentFreq;
  426.                     freq->right->proot = malloc(sizeof(PlayerWeight));
  427.                     freq->right->proot->count = 1;
  428.                     freq->right->proot->playerId = p->steamId;
  429.                     fillFrequencyOffset(ret,freq->right,p,parentFreq,false,retNew);
  430.                 }
  431.                 return ret;
  432.             }
  433.             else {
  434.                 fillFrequencyOffset(ret,freq->right,p,parentFreq,true,retNew);
  435.             }
  436.         }
  437.     }
  438.     else {
  439.         if (freq->left != NULL)
  440.             fillFrequencyOffset(ret,freq->left,p,parentFreq,false,retNew);
  441.         if (freq->right != NULL)
  442.             fillFrequencyOffset(ret,freq->right,p,parentFreq,false,retNew);
  443.     }
  444.     addFrequencyOffset(ret,freq,ceil(abs(parentFreq - freq->frequency) * frequencyWeight(getPlayerWeight(freq->proot,p))))
  445.     return ret;
  446. }
  447. FrequencyOffset * createFrequencyOffset(Frequency * freq, Player * p, unsigned long long parentFreq, bool retNew) {
  448.     FrequencyOffset * ret = malloc(sizeof(FrequencyOffset));
  449.     ret->frequency = freq;
  450.     ret->offset = ceil(abs(parentFreq - freq->frequency) * frequencyWeight(getPlayerWeight(freq->proot,p)))
  451.     return fillFrequencyOffset(ret,freq,p,parentFreq,true,retNew);
  452.    
  453. }
  454.  
  455. FrequencyOffset * getFrequency(FrequencyOffset * freq,Player * p) {
  456.     if (freq->offset > 0) {
  457.         if (freq->left == NULL) {
  458.             return freq;
  459.         }
  460.         else {
  461.             return getFrequency(freq->left,p);
  462.         }
  463.     }
  464.     if (freq->offset < 0) {
  465.         if (freq->right == NULL) {
  466.             return freq;
  467.         }
  468.         else {
  469.             return getFrequency(freq->right,p);
  470.         }
  471.     }
  472.     return freq;
  473. }
  474.  
  475. Frequency * getFrequency(Dendrite * dend,unsigned long long parentFreq,Player * p,bool retNew) {
  476.     Frequency * freq = dend->root;
  477.     if (freq == NULL) {
  478.         freq = malloc(sizeof(Frequency));
  479.         freq->frequency = parentFreq;
  480.     }
  481.     FrequencyOffset * root = createFrequencyOffset(freq,p,parentFreq,retNew);
  482.     Frequency * ret = getFrequency(root,p)->frequency;
  483.     deallocateFrequencyOffsetTree(root);
  484.     return ret;
  485. }
  486.  
  487. Frequency * getFrequency(Dendrite * dend,unsigned long long p,Player * pl) {
  488.     return getFrequency(dend,p,pl,false);
  489. }
  490.  
  491. void deallocateFrequencyOffsetTree(FrequencyOffset * root) {
  492.     if (!root) return;
  493.     deallocateFrequencyOffsetTree(root->left);
  494.     deallocateFrequencyOffsetTree(root->right);
  495.     free(root);
  496. }
  497. void deallocatePlayerPath(PlayerPath * path) {
  498.     if (!path) return;
  499.     if (path != path->prev)
  500.         deallocatePlayerPath(path->prev);
  501.     free(path);
  502. }
  503. void deallocateSynapseTree(SynapseTree * tree) {
  504.     if (!tree) return;
  505.     deallocateSynapseTree(tree->left);
  506.     deallocateSynapseTree(tree->right);
  507.     free(tree);
  508. }
  509. /*************************************************/
  510. Dendrite * getDendrite(Dendrite * dend, unsigned long long parentFreq, bool retNew) {
  511.     if (dend->frequency == parentFreq)
  512.         return dend;
  513.     if (dend->frequency > parentFreq)
  514.         if (dend->left == NULL) {
  515.             dend->left = malloc(sizeof(Dendrite));
  516.             dend->left->frequency = parentFreq;
  517.             return retNew ? dend->left : dend;
  518.         }
  519.         else
  520.             return getDendrite(dend->left,parentFreq);
  521.     if (dend->frequency < parentFreq)
  522.         if (dend->right == NULL) {
  523.             dend->right = malloc(sizeof(Dendrite));
  524.             dend->right->frequency = parentFreq;
  525.             return retNew ? dend->right : dend;
  526.         }
  527.         else
  528.             return getDendrite(dend->right,parentFreq);
  529. }
  530.  
  531. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq,bool retNew) {
  532.     Dendrite * dend = neuron->root;
  533.     if (dend == NULL) {
  534.         dend = malloc(sizeof(Dendrite));
  535.         dend->frequency = parentFreq;
  536.         neuron->root = dend;
  537.     }
  538.     return getDendrite(dend,parentFreq,retNew);
  539. }
  540.  
  541. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq) {
  542.     return getDendrite(neuron,parentFreq,false);
  543. }
  544.  
  545. unsigned long long pathFrequency(PlayerPath * path) {
  546.     PlayerPath * iter = path;
  547.     unsigned long long frequency = 0;
  548.     for (int i = 0; i < FREQUENCY_DEPTH; i++) {
  549.         frequency += iter->neuron->frequency;
  550.         iter = iter->prev;
  551.     }
  552.     return frequency;
  553. }
  554.  
  555. float frequencyWeight(PlayerWeight * weight) {
  556.     if (weight == NULL)
  557.         return 1f;
  558.     return 1f - ((PlAYER_WEIGHT_MAX - (PLAYER_WEIGHT_FLUX / (pow(4f,weight->count) / pow(3.6f,weight->count)))) / 100);
  559. }
  560.  
  561. int transformCoord(int xyz) {
  562.     return (int)((xyz + WORLD_OFFSET) / UNITS_PER_SQUARE);
  563. }
Add Comment
Please, Sign In to add comment