Advertisement
imk0tter

Imk0tter

Dec 10th, 2010
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 17.07 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.         nodeDict->root->id = nodeDict->count++;
  151.         nodeDict->root->pointer = (long)neuron;
  152.         nodeDict->root->data = neuron;
  153.     }
  154. }
  155.  
  156. void collapseDendriteList(Dendrite * root, TreeDictRoot * dendriteDict, TreeDictRoot * frequencyDict, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  157. }
  158. void collapseFrequencyList(Frequency * root, TreeDictRoot * frequencyDict, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  159. }
  160. void collapseSynapseList(Synapse * root, TreeDictRoot * synapseDict, TreeDictRoot * playerWeightDict) {
  161. }
  162. void collapsePlayerWeightList(PlayerWeight * root, TreeDictRoot * playerWeightDict) {
  163. }
  164. void exportNetwork(NeuronList * root, char * fileName) {
  165.     TreeDictRoot * nodeDict = malloc(sizeof(TreeDictRoot));
  166.     TreeDictRoot * dendriteDict = malloc(sizeof(TreeDictRoot));
  167.     TreeDictRoot * frequencyDict = malloc(sizeof(TreeDictRoot));
  168.     TreeDictRoot * synapseDict = malloc(sizeof(TreeDictRoot));
  169.     TreeDictRoot * playerWeightDict = malloc(sizeof(TreeDictRoot));
  170.     nodeDict->count = 0;
  171.     dendriteDict->count = 0;
  172.     frequencyDict->count = 0;
  173.     synapseDict->count = 0;
  174.     playerWeightDict->count = 0;
  175.     collapseNeuronList(root,nodeDict,dendriteDict,frequencyDict,synapseDict,playerWeightDict);
  176. //HELP: Need help coming up with a way to export a NeuronList
  177. }
  178. void importNetwork(NeuronList ** root, char * fileName) {
  179. //HELP: Need help coming up with a way to import a NeuronList
  180. }
  181.  
  182. PlayerPath * generatePrediction(Player * p, PlayerPath * root) {
  183.     return generatePrediction(p, root, NULL, 0);
  184. }
  185. void removePathNodes(PlayerPath * root,int count) {
  186.     if (!count) return;
  187.     PlayerPath * temp = root->prev;
  188.     free(root);
  189.     root = temp;
  190.     removePathNodes(root,--count);
  191. }
  192. PlayerPath * generatePrediction(Player * p, PlayerPath * root,PlayerPath * prediction, int count) {
  193.     if (count == PREDICTION_DEPTH) {
  194.         removePathNodes(root,count);
  195.         return prediction;
  196.     }
  197.     Frequency * freq = getFrequency(getDendrite(root->neuron,root->prev->neuron->frequency),pathFrequency(root->prev),p,false);
  198.     if (!freq) {
  199.         removePathNodes(root, count);
  200.         return prediction;
  201.     }
  202.     Synapse * syn = getSynapse(freq,p);
  203.     if (!syn) {
  204.         removePathNodes(root, count);
  205.         return prediction;
  206.     }
  207.     PlayerPath * ret = malloc(sizeof(PlayerPath));
  208.     ret->neuron = syn->neuron;
  209.     ret->prev = root;
  210.     PlayerPath * rett = prediction;
  211.     prediction = malloc(sizeof(PlayerPath));
  212.     prediction->neuron = syn->neuron;
  213.     if (rett)
  214.         prediction->prev = rett;
  215.     else
  216.         prediction->prev = prediction;
  217.     return generatePrediction(p,ret,prediction,++count);
  218.     //TODO: Fix getFrequency to only create a new frequency if retNew == true - DONE
  219.    
  220. }
  221. Neuron * getNeuron(int x, int y, int z, NeuronList * neuronListRoot) {
  222.     x = transformCoord(x);
  223.     y = transformCoord(y);
  224.     z = transformCoord(z);
  225.     unsigned long long frequency = z * WORLD_GRID_SIZE^2 + y * WORLD_GRID_SIZE^1 + x;
  226.     return getNeuron(neuronListRoot, frequency,x,y,z);
  227. }
  228. Neuron * getNeuron(NeuronList * neuron, unsigned long long frequency,int x, int y, int z) {
  229.     if (neuron->neuron->frequency == frequency) return neuron->neuron;
  230.     else if (neuron->neuron->frequency > frequency) {
  231.         if (!neuron->left) {
  232.             neuron->left = malloc(sizeof(NeuronList));
  233.             neuron->left->neuron = malloc(sizeof(Neuron));
  234.             neuron->left->neuron->frequency = frequency;
  235.             neuron->left->neuron->x = x;
  236.             neuron->left->neuron->y = y;
  237.             neuron->left->neuron->z = z;
  238.             return neuron->left->neuron
  239.         }
  240.         return getNeuron(neuron->left,frequency);
  241.     }
  242.     else {
  243.         if (!neuron->right) {
  244.             neuron->right = malloc(sizeof(NeuronList));
  245.             neuron->right->neuron = malloc(sizeof(Neuron));
  246.             neuron->right->neuron->frequency = frequency;
  247.             neuron->right->neuron->x = x;
  248.             neuron->right->neuron->y = y;
  249.             neuron->right->neuron->z = z;
  250.             return neuron->right->neuron
  251.         }
  252.         return getNeuron(neuron->left,frequency);
  253.     }
  254. }
  255. PlayerPath * createPath(Player * p, NeuronList * neuronListRoot) {
  256.     return updatePath(p,NULL);
  257. }
  258.  
  259. PlayerPath * updatePath(Player * p, PlayerPath * prev, NeuronList * neuronListRoot) {
  260.     PlayerPath * ret;
  261.     ret = malloc(sizeof(PlayerPath));
  262.     if (prev == NULL) {
  263.         ret->prev = ret;
  264.         prev = ret;
  265.     }
  266.     else
  267.         ret->prev = prev;
  268.     ret->neuron = getNeuron(p->x,p->y,p->z,neuronListRoot);
  269.     updateNeuron(p,ret,pathFrequency(prev->prev));
  270.     return ret;
  271. }
  272. void updateNeuron(Player * p, PlayerPath * path, unsigned long long pathFreq) {
  273.     //getDendrite(path->neuron,path->prev->neuron->frequency,true),pathFreq));
  274.     updateSynapse(getFrequency(getDendrite(path->prev->neuron,path->prev->prev->neuron->frequency),pathFreq,p,true)->root,p,path->neuron);
  275.     getDendrite(path->neuron,path->prev->neuron);
  276. }
  277. Synapse * updateSynapse(Frequency * freq, Player * p, Neuron * n) {
  278.     return updateSynapse(p,n,freq->root)
  279. }
  280. Synapse * updateSynapse(Synapse * root,Player * p, Neuron * n) {
  281.     if (!root) {
  282.         root = malloc(sizeof(Synapse));
  283.         root->root = getPlayerWeight(NULL,p);
  284.         root->neuron = n;
  285.     }
  286.     if (root->neuron->frequency == n->frequency) {
  287.         return root;
  288.     }
  289.     else if (root->neuron->frequency > n->frequency) {
  290.         return updateSynapse(root->left,p,n);
  291.     }
  292.     else {
  293.         return updateSynapse(root->right,p,n);
  294.     }
  295. }
  296. SynapseTree * createSynapseTree(Frequency * freq, Player * p) {
  297.     return buildSynapseTree(NULL,ret,freq->root,p);
  298. }
  299. SynapseTree * buildSynapseTree(SynapseTree * tree, Synapse * root, Player * p) {
  300.     if (!root) return tree;
  301.     float weight = frequencyWeight(getPlayerWeight(root->root,p));
  302.     addSynapseTree(tree,root,weight)
  303.     buildSynapseTree(tree,root->left,p);
  304.     buildSynapseTree(tree,root->right,p);
  305.     return tree;
  306. }
  307. SynapseTree * addSynapseTree(SynapseTree * tree, Synapse * root,float weight) {
  308.     if (!root) return tree;
  309.     if (!tree) {
  310.         tree = malloc(sizeof(SynapseTree));
  311.         tree->synapse = root;
  312.         tree->value = weight;
  313.         return tree;
  314.     }
  315.     if (tree->value > weight) {
  316.         if (tree->left == NULL) {
  317.             tree->left = malloc(sizeof(SynapseTree));
  318.             tree->left->value = weight;
  319.             tree->left->synapse = root;
  320.             return tree;
  321.         }
  322.         addSynapseTree(tree->left,root,weight);
  323.     }
  324.     if (tree->value < weight) {
  325.         if (tree->right = NULL) {
  326.             tree->right = malloc(sizeof(SynapseTree));
  327.             tree->right->value = weight;
  328.             tree->right->synapse = root;
  329.             return tree;
  330.         }
  331.         addSynapseTree(tree->right,root,weight);
  332.     }
  333.     return tree;
  334. }
  335. Synapse * getSynapse(Frequency * freq, Player * p, bool retNew) {
  336.     createSynapseTree(freq->synapse,p,retNew)
  337. }
  338. Synapse * getSynapse(Frequency * freq, Player * p) {
  339.     createSynapseTree(freq->synapse,p,false);
  340. }
  341.  
  342. PlayerWeight * getPlayerWeight(PlayerWeight * pw, Player * p) {
  343.     //TODO: Replace steamID variable with real
  344.     if (pw == NULL) {
  345.         pw = malloc(sizeof(PlayerWeight));
  346.         pw->playerId = p->steamID;
  347.         pw->count = 1;
  348.         pw->weight = 1;
  349.         return pw;
  350.     }
  351.     if (pw->playerId > p->steamID) {
  352.         if (pw->left == NULL) {
  353.             pw->left = malloc(sizeof(PlayerWeight));
  354.             pw->left->playerId = p->steamID;
  355.             pw->left->count = 1;
  356.             pw->left->weight = 1;
  357.             return pw->left;
  358.         }
  359.         return getPlayerWeight(pw->left, p);
  360.     }
  361.     if (pw->playerId < p->steamID) {
  362.         if (pw->right == NULL) {
  363.             pw->right = malloc(sizeof(PlayerWeight));
  364.             pw->right->playerId = p->steamID;
  365.             pw->right->count = 1;
  366.             pw->right->weight = 1;
  367.             return pw->right;
  368.         }
  369.         return getPlayerWeight(pw->right, p);
  370.     }
  371.     pw->count++;
  372.     return pw;
  373. }
  374.  
  375. FrequencyOffset * addFrequencyOffset(FrequencyOffset * ret, Frequency * freq, unsigned long long offset) {
  376.     if (ret->offset > offset) {
  377.         if (ret->left == NULL) {
  378.             ret->left = malloc(sizeof(FrequencyOffset));
  379.             ret->left->frequency = freq;
  380.             ret->left->offset = offset;
  381.             return ret->left;
  382.         }
  383.         else {
  384.             return addFrequencyOffset(ret->left,freq,offset);
  385.         }
  386.     }
  387.     if (ret->offset < offset) {
  388.         if (ret->right == NULL) {
  389.             ret->right = malloc(sizeof(FrequencyOffset));
  390.             ret->right->frequency = freq;
  391.             ret->right->offset = offset;
  392.             return ret->right;
  393.         }
  394.         else {
  395.             return addFrequencyOffset(ret->right,freq,offset);
  396.         }
  397.     }
  398.     return ret;
  399. }
  400.  
  401. FrequencyOffset * fillFrequencyOffset(FrequencyOffset * ret, Frequency * freq, Player * p, unsigned long long parentFreq,bool sniff,bool retNew) {
  402.     if (sniff) {
  403.         if (freq->frequency > parentFreq) {
  404.             if (freq->right != NULL)
  405.                 fillFrequencyOffset(freq->right,p,parentFreq,false,retNew);
  406.             if (freq->left == NULL) {
  407.                 if (retNew) {
  408.                     freq->left = malloc(sizeof(Frequency));
  409.                     freq->left->frequency = parentFreq;
  410.                     freq->left->proot = malloc(sizeof(PlayerWeight));
  411.                     freq->left->proot->count = 1;
  412.                     freq->left->proot->playerId = p->steamId;
  413.                     fillFrequencyOffset(ret,freq->left,p,parentFreq,false,retNew);
  414.                 }
  415.                 return ret;
  416.             }
  417.             else {
  418.                 fillFrequencyOffset(ret,freq->left,p,parentFreq,true,retNew);
  419.             }
  420.         }
  421.         if (freq->frequency < parentFreq) {
  422.             if (freq->left != NULL)
  423.                 fillFrequencyOffset(freq->left,p,parentFreq,false,retNew);
  424.             if (freq->right == NULL) {
  425.                 if (retNew) {
  426.                     freq->right = malloc(sizeof(Frequency));
  427.                     freq->right->frequency = parentFreq;
  428.                     freq->right->proot = malloc(sizeof(PlayerWeight));
  429.                     freq->right->proot->count = 1;
  430.                     freq->right->proot->playerId = p->steamId;
  431.                     fillFrequencyOffset(ret,freq->right,p,parentFreq,false,retNew);
  432.                 }
  433.                 return ret;
  434.             }
  435.             else {
  436.                 fillFrequencyOffset(ret,freq->right,p,parentFreq,true,retNew);
  437.             }
  438.         }
  439.     }
  440.     else {
  441.         if (freq->left != NULL)
  442.             fillFrequencyOffset(ret,freq->left,p,parentFreq,false,retNew);
  443.         if (freq->right != NULL)
  444.             fillFrequencyOffset(ret,freq->right,p,parentFreq,false,retNew);
  445.     }
  446.     addFrequencyOffset(ret,freq,ceil(abs(parentFreq - freq->frequency) * frequencyWeight(getPlayerWeight(freq->proot,p))))
  447.     return ret;
  448. }
  449. FrequencyOffset * createFrequencyOffset(Frequency * freq, Player * p, unsigned long long parentFreq, bool retNew) {
  450.     FrequencyOffset * ret = malloc(sizeof(FrequencyOffset));
  451.     ret->frequency = freq;
  452.     ret->offset = ceil(abs(parentFreq - freq->frequency) * frequencyWeight(getPlayerWeight(freq->proot,p)))
  453.     return fillFrequencyOffset(ret,freq,p,parentFreq,true,retNew);
  454.    
  455. }
  456.  
  457. FrequencyOffset * getFrequency(FrequencyOffset * freq,Player * p) {
  458.     if (freq->offset > 0) {
  459.         if (freq->left == NULL) {
  460.             return freq;
  461.         }
  462.         else {
  463.             return getFrequency(freq->left,p);
  464.         }
  465.     }
  466.     if (freq->offset < 0) {
  467.         if (freq->right == NULL) {
  468.             return freq;
  469.         }
  470.         else {
  471.             return getFrequency(freq->right,p);
  472.         }
  473.     }
  474.     return freq;
  475. }
  476.  
  477. Frequency * getFrequency(Dendrite * dend,unsigned long long parentFreq,Player * p,bool retNew) {
  478.     Frequency * freq = dend->root;
  479.     if (freq == NULL) {
  480.         freq = malloc(sizeof(Frequency));
  481.         freq->frequency = parentFreq;
  482.     }
  483.     FrequencyOffset * root = createFrequencyOffset(freq,p,parentFreq,retNew);
  484.     Frequency * ret = getFrequency(root,p)->frequency;
  485.     deallocateFrequencyOffsetTree(root);
  486.     return ret;
  487. }
  488.  
  489. Frequency * getFrequency(Dendrite * dend,unsigned long long p,Player * pl) {
  490.     return getFrequency(dend,p,pl,false);
  491. }
  492.  
  493. void deallocateFrequencyOffsetTree(FrequencyOffset * root) {
  494.     if (!root) return;
  495.     deallocateFrequencyOffsetTree(root->left);
  496.     deallocateFrequencyOffsetTree(root->right);
  497.     free(root);
  498. }
  499. void deallocatePlayerPath(PlayerPath * path) {
  500.     if (!path) return;
  501.     if (path != path->prev)
  502.         deallocatePlayerPath(path->prev);
  503.     free(path);
  504. }
  505. void deallocateSynapseTree(SynapseTree * tree) {
  506.     if (!tree) return;
  507.     deallocateSynapseTree(tree->left);
  508.     deallocateSynapseTree(tree->right);
  509.     free(tree);
  510. }
  511. /*************************************************/
  512. Dendrite * getDendrite(Dendrite * dend, unsigned long long parentFreq, bool retNew) {
  513.     if (dend->frequency == parentFreq)
  514.         return dend;
  515.     if (dend->frequency > parentFreq)
  516.         if (dend->left == NULL) {
  517.             dend->left = malloc(sizeof(Dendrite));
  518.             dend->left->frequency = parentFreq;
  519.             return retNew ? dend->left : dend;
  520.         }
  521.         else
  522.             return getDendrite(dend->left,parentFreq);
  523.     if (dend->frequency < parentFreq)
  524.         if (dend->right == NULL) {
  525.             dend->right = malloc(sizeof(Dendrite));
  526.             dend->right->frequency = parentFreq;
  527.             return retNew ? dend->right : dend;
  528.         }
  529.         else
  530.             return getDendrite(dend->right,parentFreq);
  531. }
  532.  
  533. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq,bool retNew) {
  534.     Dendrite * dend = neuron->root;
  535.     if (dend == NULL) {
  536.         dend = malloc(sizeof(Dendrite));
  537.         dend->frequency = parentFreq;
  538.         neuron->root = dend;
  539.     }
  540.     return getDendrite(dend,parentFreq,retNew);
  541. }
  542.  
  543. Dendrite * getDendrite(Neuron * neuron,unsigned long long parentFreq) {
  544.     return getDendrite(neuron,parentFreq,false);
  545. }
  546.  
  547. unsigned long long pathFrequency(PlayerPath * path) {
  548.     PlayerPath * iter = path;
  549.     unsigned long long frequency = 0;
  550.     for (int i = 0; i < FREQUENCY_DEPTH; i++) {
  551.         frequency += iter->neuron->frequency;
  552.         iter = iter->prev;
  553.     }
  554.     return frequency;
  555. }
  556.  
  557. float frequencyWeight(PlayerWeight * weight) {
  558.     if (weight == NULL)
  559.         return 1f;
  560.     return 1f - ((PlAYER_WEIGHT_MAX - (PLAYER_WEIGHT_FLUX / (pow(4f,weight->count) / pow(3.6f,weight->count)))) / 100);
  561. }
  562.  
  563. int transformCoord(int xyz) {
  564.     return (int)((xyz + WORLD_OFFSET) / UNITS_PER_SQUARE);
  565. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement