Advertisement
Mr-A

A-Engine <object.cpp> v0.07

Aug 5th, 2014
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 332.67 KB | None | 0 0
  1. //==========Object.cpp===========
  2.  
  3. #define GL_GLEXT_PROTOTYPES
  4. #define GLEW_STATIC
  5. #include <iostream>
  6. #include <algorithm>
  7. #include <math.h>
  8. #include <stdlib.h>
  9. #include <time.h>
  10. #include <string>
  11. #include <vector>
  12. #include <fstream>
  13. #include <sstream>
  14. //#include <glew.h>
  15. #include "SDL.h"
  16. #include "SDL_image.h"
  17. //#include <GL/glext.h>
  18. #include "SDL_opengl.h"
  19. #include "globals.h"
  20. #include "Eval.h"
  21. #include "Object.h"
  22.  
  23. int CAM[]= {0, 0, 0};
  24. int CAMV[]= {0, 0, 0};
  25.  
  26.  
  27. int GetPowerOf2(int num)
  28. {
  29.     if( num != 0 )
  30.     {
  31.         num--;
  32.         num |= (num >> 1);
  33.         num |= (num >> 2);
  34.         num |= (num >> 4);
  35.         num |= (num >> 8);
  36.         num |= (num >> 16);
  37.         num++;
  38.     }
  39.     return num;
  40. }
  41.  
  42.  
  43. SDL_Color translate_color(Uint32 int_color)
  44. {
  45. #if SDL_BYTEORDER == SDL_BIG_ENDIAN
  46.     SDL_Color color= {(int_color & 0x00ff0000)/0x10000,(int_color &
  47.                       0x0000ff00)/0x100,(int_color & 0x000000ff),(int_color & 0xff000000)/0x1000000
  48.                      };
  49. #else
  50.     SDL_Color color= {(int_color & 0x000000ff),(int_color &
  51.                       0x0000ff00)/0x100,(int_color & 0x00ff0000)/0x10000,(int_color & 0xff000000)/0x1000000
  52.                      };
  53. #endif
  54.     return color;
  55. }
  56.  
  57. void DrawCircle(float cx, float cy, float r, int num_segments, float color[], int flag)
  58. {
  59.     float theta = 2 * 3.1415926 / float(num_segments);
  60.     float tangetial_factor = tanf(theta);//calculate the tangential factor
  61.  
  62.     float radial_factor = cosf(theta);//calculate the radial factor
  63.  
  64.     float x = r;//we start at angle = 0
  65.  
  66.     float y = 0;
  67.  
  68.     glColor4f(color[0]/255.f, color[1]/255.f, color[2]/255.f, color[3]/255.f);
  69.     switch (flag)
  70.     {
  71.     case 2:
  72.         glBegin(GL_LINE_STRIP);
  73.         glLineWidth(1.f);
  74.         break;
  75.     default:
  76.         glBegin(GL_POLYGON);
  77.         glLineWidth(10.f);
  78.         break;
  79.     }
  80.     //glLineWidth(30.f);
  81.     for(int ii = 0; ii < num_segments; ii++)
  82.     {
  83.         glVertex2f(x + cx, y + cy);//output vertex
  84.  
  85.         //calculate the tangential std::vector
  86.         //remember, the radial std::vector is (x, y)
  87.         //to get the tangential std::vector we flip those coordinates and negate one of them
  88.  
  89.         float tx = -y;
  90.         float ty = x;
  91.  
  92.         //add the tangential std::vector
  93.  
  94.         x += tx * tangetial_factor;
  95.         y += ty * tangetial_factor;
  96.  
  97.         //correct using the radial factor
  98.  
  99.         x *= radial_factor;
  100.         y *= radial_factor;
  101.     }
  102.     glEnd();
  103.     glColor4f(1.f, 1.f, 1.f, 1.f);
  104. }
  105.  
  106. bool Collision_Occurs_Rect(int b[], int r[])   //[0]=x,[1]=y,[2]=z,[3]=width,[4]=height,[5]=depth
  107. {
  108.     if (r[0] <= b[0]+b[3] && b[0] <= r[0]+r[3] &&
  109.             r[1] <= b[1]+b[4] && b[1] <= r[1]+r[4] &&
  110.             r[2] <= b[2]+b[5] && b[2] <= r[2]+r[5])
  111.         return true;
  112.     else
  113.         return false;
  114. }
  115.  
  116.  
  117.  
  118.  
  119. objcopy copy_object(objcopy old_)
  120. {
  121.     objcopy new_;
  122.     new_.id=old_.id;
  123.     new_.team=old_.team;
  124.     new_.facing=old_.facing;
  125.     new_.iscom=true;
  126.     new_.posx=old_.posx;
  127.     new_.posy=old_.posy;
  128.     new_.posz=old_.posz;
  129.     new_.total_fx=old_.total_fx;
  130.     new_.total_fy=old_.total_fy;
  131.     new_.total_fz=old_.total_fz;
  132.     new_.GRAVITY=old_.GRAVITY;
  133.     new_.FRICTION=old_.FRICTION;
  134.     for (int a=0; a<52; a++) new_.regs[a]=old_.regs[a];
  135.     return new_;
  136. }
  137.  
  138.  
  139. bdy::bdy()
  140. {
  141.     exists=false;
  142. }
  143.  
  144. void bdy::init(std::string framelinee)
  145. {
  146.     exists=true;
  147.     int positions[14];
  148.     std::string tempao;
  149.     std::string maintag="set_bdy[";
  150.     std::string tags[] = {"x=", "y=", "z=", "w=", "h=", "d=", "block=", "respond=", "flag=", "resistivity=", "inertia=", "budge_dp=", "set_reg=", "set_effector_reg="};
  151.     startpos=framelinee.find(maintag);
  152.     endpos  =framelinee.find("]", startpos);
  153.     std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
  154.  
  155.     bool done=false;
  156.     if (frameline.find(tags[0])!=std::string::npos)
  157.     {
  158.         positions[0] = frameline.find(tags[0])+tags[0].length();
  159.     }
  160.     else
  161.     {
  162.         positions[0]=0;
  163.     }
  164.     if (frameline.find(tags[1])!=std::string::npos)
  165.     {
  166.         positions[1] = frameline.find(tags[1])+tags[1].length();
  167.     }
  168.     else
  169.     {
  170.         positions[1]=0;
  171.     }
  172.     if (frameline.find(tags[2])!=std::string::npos)
  173.     {
  174.         positions[2] = frameline.find(tags[2])+tags[2].length();
  175.     }
  176.     else
  177.     {
  178.         positions[2]=0;
  179.     }
  180.     if (frameline.find(tags[3])!=std::string::npos)
  181.     {
  182.         positions[3] = frameline.find(tags[3])+tags[3].length();
  183.     }
  184.     else
  185.     {
  186.         positions[3]=0;
  187.     }
  188.     if (frameline.find(tags[4])!=std::string::npos)
  189.     {
  190.         positions[4] = frameline.find(tags[4])+tags[4].length();
  191.     }
  192.     else
  193.     {
  194.         positions[4]=0;
  195.     }
  196.     if (frameline.find(tags[5])!=std::string::npos)
  197.     {
  198.         positions[5] = frameline.find(tags[5])+tags[5].length();
  199.     }
  200.     else
  201.     {
  202.         positions[5]=0;
  203.     }
  204.     if (frameline.find(tags[6])!=std::string::npos)
  205.     {
  206.         positions[6] = frameline.find(tags[6])+tags[6].length();
  207.     }
  208.     else
  209.     {
  210.         positions[6]=0;
  211.     }
  212.     if (frameline.find(tags[7])!=std::string::npos)
  213.     {
  214.         positions[7] = frameline.find(tags[7])+tags[7].length();
  215.     }
  216.     else
  217.     {
  218.         positions[7]=0;
  219.     }
  220.     if (frameline.find(tags[8])!=std::string::npos)
  221.     {
  222.         positions[8] = frameline.find(tags[8])+tags[8].length();
  223.     }
  224.     else
  225.     {
  226.         positions[8]=0;
  227.     }
  228.     if (frameline.find(tags[9])!=std::string::npos)
  229.     {
  230.         positions[9] = frameline.find(tags[9])+tags[9].length();
  231.     }
  232.     else
  233.     {
  234.         positions[9]=0;
  235.     }
  236.     if (frameline.find(tags[10])!=std::string::npos)
  237.     {
  238.         positions[10] = frameline.find(tags[10])+tags[10].length();
  239.     }
  240.     else
  241.     {
  242.         positions[10]=0;
  243.     }
  244.     if (frameline.find(tags[11])!=std::string::npos)
  245.     {
  246.         positions[11] = frameline.find(tags[11])+tags[11].length();
  247.     }
  248.     else
  249.     {
  250.         positions[11]=0;
  251.     }
  252.     if (frameline.find(tags[12])!=std::string::npos)
  253.     {
  254.         positions[12] = frameline.find(tags[12])+tags[12].length();
  255.     }
  256.     else
  257.     {
  258.         positions[12]=0;
  259.     }
  260.     if (frameline.find(tags[13])!=std::string::npos)
  261.     {
  262.         positions[13] = frameline.find(tags[13])+tags[13].length();
  263.     }
  264.     else
  265.     {
  266.         positions[13]=0;
  267.     }
  268.  
  269.     bool isvar=false, isfunc=false, isreg=false;
  270.     for (int ice=0; ice < 14; ice ++)  //iter on tags positions
  271.     {
  272.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  273.         {
  274.             done=false;
  275.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  276.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  277.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  278.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  279.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  280.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  281.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  282.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  283.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  284.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  285.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  286.             {
  287.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  288.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  289.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  290.                 tempao+=frameline.substr(food+positions[ice],1);
  291.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  292.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  293.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  294.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  295.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  296.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  297.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  298.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  299.                 {
  300.                     switch (ice)
  301.                     {
  302.                     case 0:
  303.                         if (frameline.find(tags[0])!=std::string::npos)
  304.                         {
  305.                             x=tempao;
  306.                         }
  307.                         else
  308.                         {
  309.                             x="0";
  310.                         }
  311.                         food=99999;
  312.                         done=true;
  313.                         tempao="";
  314.                         break;
  315.                     case 1:
  316.                         if (frameline.find(tags[1])!=std::string::npos)
  317.                         {
  318.                             y=tempao;
  319.                         }
  320.                         else
  321.                         {
  322.                             y="0";
  323.                         }
  324.                         food=99999;
  325.                         done=true;
  326.                         tempao="";
  327.                         break;
  328.                     case 2:
  329.                         if (frameline.find(tags[2])!=std::string::npos)
  330.                         {
  331.                             z=tempao;
  332.                         }
  333.                         else
  334.                         {
  335.                             z="-6";
  336.                         }
  337.                         food=99999;
  338.                         done=true;
  339.                         tempao="";
  340.                         break;
  341.                     case 3:
  342.                         if (frameline.find(tags[3])!=std::string::npos)
  343.                         {
  344.                             w=tempao;
  345.                         }
  346.                         else
  347.                         {
  348.                             w="1";
  349.                         }
  350.                         food=99999;
  351.                         done=true;
  352.                         tempao="";
  353.                         break;
  354.                     case 4:
  355.                         if (frameline.find(tags[4])!=std::string::npos)
  356.                         {
  357.                             h=tempao;
  358.                         }
  359.                         else
  360.                         {
  361.                             h="1";
  362.                         }
  363.                         food=99999;
  364.                         done=true;
  365.                         tempao="";
  366.                         break;
  367.                     case 5:
  368.                         if (frameline.find(tags[5])!=std::string::npos)
  369.                         {
  370.                             z_w=tempao;
  371.                         }
  372.                         else
  373.                         {
  374.                             z_w="12";
  375.                         }
  376.                         food=99999;
  377.                         done=true;
  378.                         tempao="";
  379.                         break;
  380.                     case 6:
  381.                         if (frameline.find(tags[6])!=std::string::npos)
  382.                         {
  383.                             block=tempao;
  384.                         }
  385.                         else
  386.                         {
  387.                             block="0";
  388.                         }
  389.                         food=99999;
  390.                         done=true;
  391.                         tempao="";
  392.                         break;
  393.                     case 7:
  394.                         if (frameline.find(tags[7])!=std::string::npos)
  395.                         {
  396.                             respond=tempao;
  397.                         }
  398.                         else
  399.                         {
  400.                             respond="4321";
  401.                         }
  402.                         food=99999;
  403.                         done=true;
  404.                         tempao="";
  405.                         break;
  406.                     case 8:
  407.                         if (frameline.find(tags[8])!=std::string::npos)
  408.                         {
  409.                             flg=tempao;
  410.                         }
  411.                         else
  412.                         {
  413.                             flg="4321";
  414.                         }
  415.                         food=99999;
  416.                         done=true;
  417.                         tempao="";
  418.                         break;
  419.                     case 9:
  420.                         if (frameline.find(tags[9])!=std::string::npos)
  421.                         {
  422.                             rsstvty=tempao;
  423.                         }
  424.                         else
  425.                         {
  426.                             rsstvty="0";
  427.                         }
  428.                         food=99999;
  429.                         done=true;
  430.                         tempao="";
  431.                         break;
  432.                     case 10:
  433.                         if (frameline.find(tags[10])!=std::string::npos)
  434.                         {
  435.                             inrt=tempao;
  436.                         }
  437.                         else
  438.                         {
  439.                             inrt="0";
  440.                         }
  441.                         food=99999;
  442.                         done=true;
  443.                         tempao="";
  444.                         break;
  445.                     case 11:
  446.                         if (frameline.find(tags[11])!=std::string::npos)
  447.                         {
  448.                             bdgdp=tempao;
  449.                         }
  450.                         else
  451.                         {
  452.                             bdgdp="4321";
  453.                         }
  454.                         food=99999;
  455.                         done=true;
  456.                         tempao="";
  457.                         break;
  458.                     case 12:
  459.                         if (frameline.find(tags[12])!=std::string::npos)
  460.                         {
  461.                             reggy=tempao.substr(0, tempao.find(","));
  462.                             reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  463.                         }
  464.                         else
  465.                         {
  466.                             reggy="4321";
  467.                             reggyval="0";
  468.                         }
  469.                         food=99999;
  470.                         done=true;
  471.                         tempao="";
  472.                         break;
  473.                     case 13:
  474.                         if (frameline.find(tags[13])!=std::string::npos)
  475.                         {
  476.                             effreggy=tempao.substr(0, tempao.find(","));
  477.                             effreggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  478.                         }
  479.                         else
  480.                         {
  481.                             effreggy="4321";
  482.                             effreggyval="0";
  483.                         }
  484.                         food=99999;
  485.                         done=true;
  486.                         tempao="";
  487.                         break;
  488.                     default:
  489.                         ;
  490.                     }
  491.                 }
  492.                 else
  493.                 {
  494.                     food++;
  495.                 }
  496.             }
  497.         }
  498.     }
  499.  
  500.  
  501. }
  502.  
  503.  
  504. rect::rect()
  505. {
  506.     exists=false;
  507. }
  508.  
  509. void rect::init(std::string framelinee)
  510. {
  511.     exists=true;
  512.     int positions[29];
  513.     std::string tempao;
  514.     std::string maintag="set_rect[";
  515.     std::string tags[] = {"x=", "y=", "z=", "w=", "h=", "d=", "success=", "damage=", "x_impact=", "y_impact=", "z_impact=", "hit_frequency=", "effect=",
  516.                           "strength=", "knock=", "front_target_goto=", "back_target_goto=", "x_target=", "y_target=", "z_target=", "set_curse_id=", "rect_density=", "curse_period=",
  517.                           "flag=", "set_reg=", "set_target_reg=", "remote_id=", "copy_target_reg=", "x_y_z_effect_translate="
  518.                          };
  519.     std::string flagslist[]= {"|HITFALLING|", "|HITFALLINGX|", "|CATCHING|", "|NOEFFECT|", "|NOSOUND|", "|SOLIDRECT|", "|PLATFORMRECT|", "|GHOSTRECT|", "|STICKYRECT|", "|STICKYRECTX|", "|STICKYRECTY|", "|STICKYRECTZ|", "|REMOTERECT|", "|SOLIDRECT|"};
  520.  
  521.     startpos=framelinee.find(maintag);
  522.     endpos  =framelinee.find("]", startpos);
  523.     std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
  524.     for (int a=0; a<14; a++)
  525.     {
  526.         if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
  527.     }
  528.     bool done=false;
  529.     if (frameline.find(tags[0])!=std::string::npos)
  530.     {
  531.         positions[0] = frameline.find(tags[0])+tags[0].length();
  532.     }
  533.     else
  534.     {
  535.         positions[0]=0;
  536.     }
  537.     if (frameline.find(tags[1])!=std::string::npos)
  538.     {
  539.         positions[1] = frameline.find(tags[1])+tags[1].length();
  540.     }
  541.     else
  542.     {
  543.         positions[1]=0;
  544.     }
  545.     if (frameline.find(tags[2])!=std::string::npos)
  546.     {
  547.         positions[2] = frameline.find(tags[2])+tags[2].length();
  548.     }
  549.     else
  550.     {
  551.         positions[2]=0;
  552.     }
  553.     if (frameline.find(tags[3])!=std::string::npos)
  554.     {
  555.         positions[3] = frameline.find(tags[3])+tags[3].length();
  556.     }
  557.     else
  558.     {
  559.         positions[3]=0;
  560.     }
  561.     if (frameline.find(tags[4])!=std::string::npos)
  562.     {
  563.         positions[4] = frameline.find(tags[4])+tags[4].length();
  564.     }
  565.     else
  566.     {
  567.         positions[4]=0;
  568.     }
  569.     if (frameline.find(tags[5])!=std::string::npos)
  570.     {
  571.         positions[5] = frameline.find(tags[5])+tags[5].length();
  572.     }
  573.     else
  574.     {
  575.         positions[5]=0;
  576.     }
  577.     if (frameline.find(tags[6])!=std::string::npos)
  578.     {
  579.         positions[6] = frameline.find(tags[6])+tags[6].length();
  580.     }
  581.     else
  582.     {
  583.         positions[6]=0;
  584.     }
  585.     if (frameline.find(tags[7])!=std::string::npos)
  586.     {
  587.         positions[7] = frameline.find(tags[7])+tags[7].length();
  588.     }
  589.     else
  590.     {
  591.         positions[7]=0;
  592.     }
  593.     if (frameline.find(tags[8])!=std::string::npos)
  594.     {
  595.         positions[8] = frameline.find(tags[8])+tags[8].length();
  596.     }
  597.     else
  598.     {
  599.         positions[8]=0;
  600.     }
  601.     if (frameline.find(tags[9])!=std::string::npos)
  602.     {
  603.         positions[9] = frameline.find(tags[9])+tags[9].length();
  604.     }
  605.     else
  606.     {
  607.         positions[9]=0;
  608.     }
  609.     if (frameline.find(tags[10])!=std::string::npos)
  610.     {
  611.         positions[10] = frameline.find(tags[10])+tags[10].length();
  612.     }
  613.     else
  614.     {
  615.         positions[10]=0;
  616.     }
  617.     if (frameline.find(tags[11])!=std::string::npos)
  618.     {
  619.         positions[11] = frameline.find(tags[11])+tags[11].length();
  620.     }
  621.     else
  622.     {
  623.         positions[11]=0;
  624.     }
  625.     if (frameline.find(tags[12])!=std::string::npos)
  626.     {
  627.         positions[12] = frameline.find(tags[12])+tags[12].length();
  628.     }
  629.     else
  630.     {
  631.         positions[12]=0;
  632.     }
  633.     if (frameline.find(tags[13])!=std::string::npos)
  634.     {
  635.         positions[13] = frameline.find(tags[13])+tags[13].length();
  636.     }
  637.     else
  638.     {
  639.         positions[13]=0;
  640.     }
  641.     if (frameline.find(tags[14])!=std::string::npos)
  642.     {
  643.         positions[14] = frameline.find(tags[14])+tags[14].length();
  644.     }
  645.     else
  646.     {
  647.         positions[14]=0;
  648.     }
  649.     if (frameline.find(tags[15])!=std::string::npos)
  650.     {
  651.         positions[15] = frameline.find(tags[15])+tags[15].length();
  652.     }
  653.     else
  654.     {
  655.         positions[15]=0;
  656.     }
  657.     if (frameline.find(tags[16])!=std::string::npos)
  658.     {
  659.         positions[16] = frameline.find(tags[16])+tags[16].length();
  660.     }
  661.     else
  662.     {
  663.         positions[16]=0;
  664.     }
  665.     if (frameline.find(tags[17])!=std::string::npos)
  666.     {
  667.         positions[17] = frameline.find(tags[17])+tags[17].length();
  668.     }
  669.     else
  670.     {
  671.         positions[17]=0;
  672.     }
  673.     if (frameline.find(tags[18])!=std::string::npos)
  674.     {
  675.         positions[18] = frameline.find(tags[18])+tags[18].length();
  676.     }
  677.     else
  678.     {
  679.         positions[18]=0;
  680.     }
  681.     if (frameline.find(tags[19])!=std::string::npos)
  682.     {
  683.         positions[19] = frameline.find(tags[19])+tags[19].length();
  684.     }
  685.     else
  686.     {
  687.         positions[19]=0;
  688.     }
  689.     if (frameline.find(tags[20])!=std::string::npos)
  690.     {
  691.         positions[20] = frameline.find(tags[20])+tags[20].length();
  692.     }
  693.     else
  694.     {
  695.         positions[20]=0;
  696.     }
  697.     if (frameline.find(tags[21])!=std::string::npos)
  698.     {
  699.         positions[21] = frameline.find(tags[21])+tags[21].length();
  700.     }
  701.     else
  702.     {
  703.         positions[21]=0;
  704.     }
  705.     if (frameline.find(tags[22])!=std::string::npos)
  706.     {
  707.         positions[22] = frameline.find(tags[22])+tags[22].length();
  708.     }
  709.     else
  710.     {
  711.         positions[22]=0;
  712.     }
  713.     if (frameline.find(tags[23])!=std::string::npos)
  714.     {
  715.         positions[23] = frameline.find(tags[23])+tags[23].length();
  716.     }
  717.     else
  718.     {
  719.         positions[23]=0;
  720.     }
  721.     if (frameline.find(tags[24])!=std::string::npos)
  722.     {
  723.         positions[24] = frameline.find(tags[24])+tags[24].length();
  724.     }
  725.     else
  726.     {
  727.         positions[24]=0;
  728.     }
  729.     if (frameline.find(tags[25])!=std::string::npos)
  730.     {
  731.         positions[25] = frameline.find(tags[25])+tags[25].length();
  732.     }
  733.     else
  734.     {
  735.         positions[25]=0;
  736.     }
  737.     if (frameline.find(tags[26])!=std::string::npos)
  738.     {
  739.         positions[26] = frameline.find(tags[26])+tags[26].length();
  740.     }
  741.     else
  742.     {
  743.         positions[26]=0;
  744.     }
  745.     if (frameline.find(tags[27])!=std::string::npos)
  746.     {
  747.         positions[27] = frameline.find(tags[27])+tags[27].length();
  748.     }
  749.     else
  750.     {
  751.         positions[27]=0;
  752.     }
  753.     if (frameline.find(tags[28])!=std::string::npos)
  754.     {
  755.         positions[28] = frameline.find(tags[28])+tags[28].length();
  756.     }
  757.     else
  758.     {
  759.         positions[28]=0;
  760.     }
  761.  
  762.     bool isvar=false;
  763.     bool isfunc=false;
  764.     bool isreg=false;
  765.     for (int ice=0; ice < 29; ice ++)  //iter on tags positions
  766.     {
  767.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  768.         {
  769.             done=false;
  770.  
  771.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  772.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  773.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  774.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  775.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  776.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  777.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  778.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  779.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  780.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  781.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  782.             {
  783.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  784.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  785.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  786.                 tempao+=frameline.substr(food+positions[ice],1);
  787.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  788.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  789.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  790.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  791.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  792.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  793.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  794.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  795.                 {
  796.  
  797.                     switch (ice)
  798.                     {
  799.                     case 0:
  800.                         if (frameline.find(tags[0])!=std::string::npos)
  801.                         {
  802.                             x=tempao;
  803.                         }
  804.                         else
  805.                         {
  806.                             x="0";
  807.                         }
  808.                         food=99999;
  809.                         done=true;
  810.                         tempao="";
  811.                         break;
  812.                     case 1:
  813.                         if (frameline.find(tags[1])!=std::string::npos)
  814.                         {
  815.                             y=tempao;
  816.                         }
  817.                         else
  818.                         {
  819.                             y="0";
  820.                         }
  821.                         food=99999;
  822.                         done=true;
  823.                         tempao="";
  824.                         break;
  825.                     case 2:
  826.                         if (frameline.find(tags[2])!=std::string::npos)
  827.                         {
  828.                             z=tempao;
  829.                         }
  830.                         else
  831.                         {
  832.                             z="-6";
  833.                         }
  834.                         food=99999;
  835.                         done=true;
  836.                         tempao="";
  837.                         break;
  838.                     case 3:
  839.                         if (frameline.find(tags[3])!=std::string::npos)
  840.                         {
  841.                             w=tempao;
  842.                         }
  843.                         else
  844.                         {
  845.                             w="1";
  846.                         }
  847.                         food=99999;
  848.                         done=true;
  849.                         tempao="";
  850.                         break;
  851.                     case 4:
  852.                         if (frameline.find(tags[4])!=std::string::npos)
  853.                         {
  854.                             h=tempao;
  855.                         }
  856.                         else
  857.                         {
  858.                             h="1";
  859.                         }
  860.                         food=99999;
  861.                         done=true;
  862.                         tempao="";
  863.                         break;
  864.                     case 5:
  865.                         if (frameline.find(tags[5])!=std::string::npos)
  866.                         {
  867.                             z_w=tempao;
  868.                         }
  869.                         else
  870.                         {
  871.                             z_w="12";
  872.                         }
  873.                         food=99999;
  874.                         done=true;
  875.                         tempao="";
  876.                         break;
  877.                     case 6:
  878.                         if (frameline.find(tags[6])!=std::string::npos)
  879.                         {
  880.                             sccss=tempao;
  881.                         }
  882.                         else
  883.                         {
  884.                             sccss="4321";
  885.                         }
  886.                         food=99999;
  887.                         done=true;
  888.                         tempao="";
  889.                         break;
  890.                     case 7:
  891.                         if (frameline.find(tags[7])!=std::string::npos)
  892.                         {
  893.                             damage=tempao;
  894.                         }
  895.                         else
  896.                         {
  897.                             damage="0";
  898.                         }
  899.                         food=99999;
  900.                         done=true;
  901.                         tempao="";
  902.                         break;
  903.                     case 8:
  904.                         if (frameline.find(tags[8])!=std::string::npos)
  905.                         {
  906.                             x_impct=tempao;
  907.                         }
  908.                         else
  909.                         {
  910.                             x_impct="0";
  911.                         }
  912.                         food=99999;
  913.                         done=true;
  914.                         tempao="";
  915.                         break;
  916.                     case 9:
  917.                         if (frameline.find(tags[9])!=std::string::npos)
  918.                         {
  919.                             y_impct=tempao;
  920.                         }
  921.                         else
  922.                         {
  923.                             y_impct="0";
  924.                         }
  925.                         food=99999;
  926.                         done=true;
  927.                         tempao="";
  928.                         break;
  929.                     case 10:
  930.                         if (frameline.find(tags[10])!=std::string::npos)
  931.                         {
  932.                             z_impct=tempao;
  933.                         }
  934.                         else
  935.                         {
  936.                             z_impct="0";
  937.                         }
  938.                         food=99999;
  939.                         done=true;
  940.                         tempao="";
  941.                         break;
  942.                     case 11:
  943.                         if (frameline.find(tags[11])!=std::string::npos)
  944.                         {
  945.                             hitfreq=tempao;
  946.                         }
  947.                         else
  948.                         {
  949.                             hitfreq="6";
  950.                         }
  951.                         food=99999;
  952.                         done=true;
  953.                         tempao="";
  954.                         break;
  955.                     case 12:
  956.                         if (frameline.find(tags[12])!=std::string::npos)
  957.                         {
  958.  
  959.                             if (tempao.find(",")!=std::string::npos)
  960.                             {
  961.                                 effect=tempao.substr(0, tempao.find(","));
  962.                                 effectf=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  963.                             }
  964.                             else
  965.                             {
  966.                                 effect=tempao;
  967.                                 effectf="0";
  968.                             }
  969.  
  970.  
  971.  
  972.  
  973.                         }
  974.                         else
  975.                         {
  976.                             effect="0";
  977.                             effectf="0";
  978.                         }
  979.                         food=99999;
  980.                         done=true;
  981.                         tempao="";
  982.                         break;
  983.                     case 13:
  984.                         if (frameline.find(tags[13])!=std::string::npos)
  985.                         {
  986.                             strength=tempao;
  987.                         }
  988.                         else
  989.                         {
  990.                             strength="0";
  991.                         }
  992.                         food=99999;
  993.                         done=true;
  994.                         tempao="";
  995.                         break;
  996.                     case 14:
  997.                         if (frameline.find(tags[14])!=std::string::npos)
  998.                         {
  999.                             knock=tempao;
  1000.                         }
  1001.                         else
  1002.                         {
  1003.                             knock="0";
  1004.                         }
  1005.                         food=99999;
  1006.                         done=true;
  1007.                         tempao="";
  1008.                         break;
  1009.                     case 15:
  1010.                         if (frameline.find(tags[15])!=std::string::npos)
  1011.                         {
  1012.                             tfgoto=tempao;
  1013.                         }
  1014.                         else
  1015.                         {
  1016.                             tfgoto="4321";
  1017.                         }
  1018.                         food=99999;
  1019.                         done=true;
  1020.                         tempao="";
  1021.                         break;
  1022.                     case 16:
  1023.                         if (frameline.find(tags[16])!=std::string::npos)
  1024.                         {
  1025.                             tbgoto=tempao;
  1026.                         }
  1027.                         else
  1028.                         {
  1029.                             tbgoto="4321";
  1030.                         }
  1031.                         food=99999;
  1032.                         done=true;
  1033.                         tempao="";
  1034.                         break;
  1035.                     case 17:
  1036.                         if (frameline.find(tags[17])!=std::string::npos)
  1037.                         {
  1038.                             t_x=tempao;
  1039.                         }
  1040.                         else
  1041.                         {
  1042.                             t_x="4321";
  1043.                         }
  1044.                         food=99999;
  1045.                         done=true;
  1046.                         tempao="";
  1047.                         break;
  1048.                     case 18:
  1049.                         if (frameline.find(tags[18])!=std::string::npos)
  1050.                         {
  1051.                             t_y=tempao;
  1052.                         }
  1053.                         else
  1054.                         {
  1055.                             t_y="4321";
  1056.                         }
  1057.                         food=99999;
  1058.                         done=true;
  1059.                         tempao="";
  1060.                         break;
  1061.                     case 19:
  1062.                         if (frameline.find(tags[19])!=std::string::npos)
  1063.                         {
  1064.                             t_z=tempao;
  1065.                         }
  1066.                         else
  1067.                         {
  1068.                             t_z="4321";
  1069.                         }
  1070.                         food=99999;
  1071.                         done=true;
  1072.                         tempao="";
  1073.                         break;
  1074.                     case 20:
  1075.                         if (frameline.find(tags[20])!=std::string::npos)
  1076.                         {
  1077.                             crsid=tempao;
  1078.                         }
  1079.                         else
  1080.                         {
  1081.                             crsid="4321";
  1082.                         }
  1083.                         food=99999;
  1084.                         done=true;
  1085.                         tempao="";
  1086.                         break;
  1087.                     case 21:
  1088.                         if (frameline.find(tags[21])!=std::string::npos)
  1089.                         {
  1090.                             rctdnsty=tempao;
  1091.                         }
  1092.                         else
  1093.                         {
  1094.                             rctdnsty="4321";
  1095.                         }
  1096.                         food=99999;
  1097.                         done=true;
  1098.                         tempao="";
  1099.                         break;
  1100.                     case 22:
  1101.                         if (frameline.find(tags[22])!=std::string::npos)
  1102.                         {
  1103.                             c_timer=tempao;
  1104.                         }
  1105.                         else
  1106.                         {
  1107.                             c_timer="4321";
  1108.                         }
  1109.                         food=99999;
  1110.                         done=true;
  1111.                         tempao="";
  1112.                         break;
  1113.                     case 23:
  1114.                         if (frameline.find(tags[23])!=std::string::npos)
  1115.                         {
  1116.                             flg=tempao;
  1117.                         }
  1118.                         else
  1119.                         {
  1120.                             flg="4321";
  1121.                         }
  1122.                         food=99999;
  1123.                         done=true;
  1124.                         tempao="";
  1125.                         break;
  1126.                     case 24:
  1127.                         if (frameline.find(tags[24])!=std::string::npos)
  1128.                         {
  1129.                             reggy=tempao.substr(0, tempao.find(","));
  1130.                             reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  1131.                         }
  1132.                         else
  1133.                         {
  1134.                             reggy="4321";
  1135.                             reggyval="0";
  1136.                         }
  1137.                         food=99999;
  1138.                         done=true;
  1139.                         tempao="";
  1140.                         break;
  1141.                     case 25:
  1142.                         if (frameline.find(tags[25])!=std::string::npos)
  1143.                         {
  1144.                             tarreggy=tempao.substr(0, tempao.find(","));
  1145.                             tarreggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  1146.                         }
  1147.                         else
  1148.                         {
  1149.                             tarreggy="4321";
  1150.                             tarreggyval="0";
  1151.                         }
  1152.                         food=99999;
  1153.                         done=true;
  1154.                         tempao="";
  1155.                         break;
  1156.                     case 26:
  1157.                         if (frameline.find(tags[26])!=std::string::npos)
  1158.                         {
  1159.                             rmtid=tempao;
  1160.                         }
  1161.                         else
  1162.                         {
  1163.                             rmtid="4321";
  1164.                         }
  1165.                         food=99999;
  1166.                         done=true;
  1167.                         tempao="";
  1168.                         break;
  1169.                     case 27:
  1170.                         if (frameline.find(tags[27])!=std::string::npos)
  1171.                         {
  1172.                             copydst=tempao.substr(0, tempao.find(","));
  1173.                             copysrc=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  1174.                         }
  1175.                         else
  1176.                         {
  1177.                             copydst="4321";
  1178.                             copysrc="0";
  1179.                         }
  1180.                         food=99999;
  1181.                         done=true;
  1182.                         tempao="";
  1183.                         break;
  1184.                     case 28:
  1185.                         if (frameline.find(tags[28])!=std::string::npos)
  1186.                         {
  1187.                             trans[0]=tempao.substr(0, tempao.find(","));
  1188.                             trans[1]=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(",")-1);
  1189.                             trans[2]=tempao.substr(tempao.rfind(",")+1);
  1190.                         }
  1191.                         else
  1192.                         {
  1193.                             trans[0]="4321";
  1194.                             trans[1]="4321";
  1195.                             trans[2]="4321";
  1196.                         }
  1197.                         food=99999;
  1198.                         done=true;
  1199.                         tempao="";
  1200.                         break;
  1201.                     default:
  1202.                         ;
  1203.                     }
  1204.                 }
  1205.                 else
  1206.                 {
  1207.                     food++;
  1208.                 }
  1209.             }
  1210.         }
  1211.     }
  1212. }
  1213.  
  1214.  
  1215. combination::combination()
  1216. {
  1217.     exists=false;
  1218. }
  1219. void combination::init(std::string framelinee)
  1220. {
  1221.  
  1222.     exists=true;
  1223.     int positions[5];
  1224.     std::string tempao;
  1225.     std::string maintag="set_combination[";
  1226.     std::string tags[] = {"sequence=", "time_interval=", "delay=", "goto=", "set_reg="};
  1227.     startpos=framelinee.find(maintag);
  1228.     endpos  =framelinee.find("]", startpos);
  1229.     std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
  1230.     std::string inputparas[]= {"c<a>", "c<d>", "c<j>", "c<s>", "c<f>", "c<b>", "c<u_a>", "c<d_a>", "c<l_a>", "c<r_a>",
  1231.                                "h<a>", "h<d>", "h<j>", "h<s>", "h<f>", "h<b>", "h<u_a>", "h<d_a>", "h<l_a>", "h<r_a>"
  1232.                               };
  1233.     bool done=false;
  1234.     if (frameline.find(tags[0])!=std::string::npos)
  1235.     {
  1236.         positions[0] = frameline.find(tags[0])+tags[0].length();
  1237.     }
  1238.     else
  1239.     {
  1240.         positions[0]=0;
  1241.     }
  1242.     if (frameline.find(tags[1])!=std::string::npos)
  1243.     {
  1244.         positions[1] = frameline.find(tags[1])+tags[1].length();
  1245.     }
  1246.     else
  1247.     {
  1248.         positions[1]=0;
  1249.     }
  1250.     if (frameline.find(tags[2])!=std::string::npos)
  1251.     {
  1252.         positions[2] = frameline.find(tags[2])+tags[2].length();
  1253.     }
  1254.     else
  1255.     {
  1256.         positions[2]=0;
  1257.     }
  1258.     if (frameline.find(tags[3])!=std::string::npos)
  1259.     {
  1260.         positions[3] = frameline.find(tags[3])+tags[3].length();
  1261.     }
  1262.     else
  1263.     {
  1264.         positions[3]=0;
  1265.     }
  1266.     if (frameline.find(tags[4])!=std::string::npos)
  1267.     {
  1268.         positions[4] = frameline.find(tags[4])+tags[4].length();
  1269.     }
  1270.     else
  1271.     {
  1272.         positions[4]=0;
  1273.     }
  1274.     bool isvar=false, isfunc=false, isreg=false;
  1275.     for (int ice=1; ice < 5; ice ++)  //iter on tags positions
  1276.     {
  1277.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  1278.         {
  1279.             done=false;
  1280.  
  1281.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  1282.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  1283.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  1284.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  1285.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  1286.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  1287.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  1288.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  1289.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  1290.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  1291.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  1292.             {
  1293.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  1294.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  1295.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  1296.                 tempao+=frameline.substr(food+positions[ice],1);
  1297.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  1298.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  1299.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  1300.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  1301.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  1302.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  1303.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  1304.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  1305.                 {
  1306.                     switch (ice)
  1307.                     {
  1308.                     case 1:
  1309.                         if (frameline.find(tags[1])!=std::string::npos)
  1310.                         {
  1311.                             time_interval=tempao;
  1312.                         }
  1313.                         else
  1314.                         {
  1315.                             time_interval="4321";
  1316.                         }
  1317.                         food=99999;
  1318.                         done=true;
  1319.                         tempao="";
  1320.                         break;
  1321.                     case 2:
  1322.                         if (frameline.find(tags[2])!=std::string::npos)
  1323.                         {
  1324.                             delay=tempao;
  1325.                         }
  1326.                         else
  1327.                         {
  1328.                             delay="4321";
  1329.                         }
  1330.                         food=99999;
  1331.                         done=true;
  1332.                         tempao="";
  1333.                         break;
  1334.                     case 3:
  1335.                         if (frameline.find(tags[3])!=std::string::npos)
  1336.                         {
  1337.                             nxt=tempao;
  1338.                         }
  1339.                         else
  1340.                         {
  1341.                             nxt="0";
  1342.                         }
  1343.                         food=99999;
  1344.                         done=true;
  1345.                         tempao="";
  1346.                         break;
  1347.                     case 4:
  1348.                         if (frameline.find(tags[4])!=std::string::npos)
  1349.                         {
  1350.                             reggy=tempao.substr(0, tempao.find(","));
  1351.                             reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  1352.                         }
  1353.                         else
  1354.                         {
  1355.                             reggy="4321";
  1356.                             reggyval="0";
  1357.                         }
  1358.                         food=99999;
  1359.                         done=true;
  1360.                         tempao="";
  1361.                         break;
  1362.  
  1363.                     default:
  1364.                         ;
  1365.                     }
  1366.                 }
  1367.  
  1368.                 else
  1369.                 {
  1370.                     food++;
  1371.                 }
  1372.             }
  1373.         }
  1374.     }
  1375.  
  1376.     input=frameline.substr(frameline.find("(", positions[0]), frameline.find(")", positions[0])+1-frameline.find("(", positions[0]));
  1377.     int temp0=input.find(" ");
  1378.     while(temp0!=std::string::npos)
  1379.     {
  1380.         input.erase (temp0, 1); //clear spaces
  1381.         temp0=input.find(" ", temp0);
  1382.     }
  1383.     for (int b=0; b<20; b++)
  1384.     {
  1385.         while(input.find(inputparas[b])!=std::string::npos)input.replace(input.find(inputparas[b]), inputparas[b].length(), stringify(b));
  1386.     }
  1387.     int tempinputseq[6];
  1388.     for (int b=0; b<6 && input.length()>2; b++)
  1389.     {
  1390.         if (input.find(",")!=std::string::npos)
  1391.         {
  1392.             inputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(",")-input.find("(")));
  1393.             tempinputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(",")-input.find("(")));
  1394.             input.erase(input.find("(")+1, input.find(",")-input.find("("));
  1395.             depth++;
  1396.         }
  1397.         else
  1398.         {
  1399.             inputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(")")-input.find("(")));
  1400.             tempinputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(")")-input.find("(")));
  1401.             input.erase(input.find("(")+1, input.find(")")-input.find("("));
  1402.             depth++;
  1403.         }
  1404.     }
  1405.  
  1406.     for (int c=0; c<depth; c++)
  1407.     {
  1408.         inputseq[c]=tempinputseq[(depth-1)-c];
  1409.     }
  1410.  
  1411.  
  1412. }
  1413.  
  1414.  
  1415. drawshape::drawshape()
  1416. {
  1417.     exists=false;
  1418. }
  1419.  
  1420.  
  1421. void drawshape::init(std::string framelinee)
  1422. {
  1423.     exists=true;
  1424.     int positions[15];
  1425.     std::string tempao;
  1426.     std::string maintag="draw_shape[";
  1427.     std::string tags[] = {"x=", "y=", "z=", "x_radius=", "y_radius=", "w=", "h=", "d=", "colorRGBA=", "border_width=", "fill_color=", "start_angle=", "arc_angle=", "vertices=", "condition="};
  1428.     std::string flagslist[]= {"|ELLIPSE|", "|RECTANGLE|", "|ARC|", "|POLYGON|"};
  1429.  
  1430.     startpos=framelinee.find(maintag);
  1431.     endpos  =framelinee.find("]", startpos);
  1432.     std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
  1433.     for (int a=0; a<4; a++)
  1434.     {
  1435.         if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
  1436.     }
  1437.  
  1438.     bool done=false;
  1439.     if (frameline.find(tags[0])!=std::string::npos)
  1440.     {
  1441.         positions[0] = frameline.find(tags[0])+tags[0].length();
  1442.     }
  1443.     else
  1444.     {
  1445.         positions[0]=0;
  1446.     }
  1447.     if (frameline.find(tags[1])!=std::string::npos)
  1448.     {
  1449.         positions[1] = frameline.find(tags[1])+tags[1].length();
  1450.     }
  1451.     else
  1452.     {
  1453.         positions[1]=0;
  1454.     }
  1455.     if (frameline.find(tags[2])!=std::string::npos)
  1456.     {
  1457.         positions[2] = frameline.find(tags[2])+tags[2].length();
  1458.     }
  1459.     else
  1460.     {
  1461.         positions[2]=0;
  1462.     }
  1463.     if (frameline.find(tags[3])!=std::string::npos)
  1464.     {
  1465.         positions[3] = frameline.find(tags[3])+tags[3].length();
  1466.     }
  1467.     else
  1468.     {
  1469.         positions[3]=0;
  1470.     }
  1471.     if (frameline.find(tags[4])!=std::string::npos)
  1472.     {
  1473.         positions[4] = frameline.find(tags[4])+tags[4].length();
  1474.     }
  1475.     else
  1476.     {
  1477.         positions[4]=0;
  1478.     }
  1479.     if (frameline.find(tags[5])!=std::string::npos)
  1480.     {
  1481.         positions[5] = frameline.find(tags[5])+tags[5].length();
  1482.     }
  1483.     else
  1484.     {
  1485.         positions[5]=0;
  1486.     }
  1487.     if (frameline.find(tags[6])!=std::string::npos)
  1488.     {
  1489.         positions[6] = frameline.find(tags[6])+tags[6].length();
  1490.     }
  1491.     else
  1492.     {
  1493.         positions[6]=0;
  1494.     }
  1495.     if (frameline.find(tags[7])!=std::string::npos)
  1496.     {
  1497.         positions[7] = frameline.find(tags[7])+tags[7].length();
  1498.     }
  1499.     else
  1500.     {
  1501.         positions[7]=0;
  1502.     }
  1503.     if (frameline.find(tags[8])!=std::string::npos)
  1504.     {
  1505.         positions[8] = frameline.find(tags[8])+tags[8].length();
  1506.     }
  1507.     else
  1508.     {
  1509.         positions[8]=0;
  1510.     }
  1511.     if (frameline.find(tags[9])!=std::string::npos)
  1512.     {
  1513.         positions[9] = frameline.find(tags[9])+tags[9].length();
  1514.     }
  1515.     else
  1516.     {
  1517.         positions[9]=0;
  1518.     }
  1519.     if (frameline.find(tags[10])!=std::string::npos)
  1520.     {
  1521.         positions[10] = frameline.find(tags[10])+tags[10].length();
  1522.     }
  1523.     else
  1524.     {
  1525.         positions[10]=0;
  1526.     }
  1527.     if (frameline.find(tags[11])!=std::string::npos)
  1528.     {
  1529.         positions[11] = frameline.find(tags[11])+tags[11].length();
  1530.     }
  1531.     else
  1532.     {
  1533.         positions[11]=0;
  1534.     }
  1535.     if (frameline.find(tags[12])!=std::string::npos)
  1536.     {
  1537.         positions[12] = frameline.find(tags[12])+tags[12].length();
  1538.     }
  1539.     else
  1540.     {
  1541.         positions[12]=0;
  1542.     }
  1543.     if (frameline.find(tags[13])!=std::string::npos)
  1544.     {
  1545.         positions[13] = frameline.find(tags[13])+tags[13].length();
  1546.     }
  1547.     else
  1548.     {
  1549.         positions[13]=0;
  1550.     }
  1551.     if (frameline.find(tags[14])!=std::string::npos)
  1552.     {
  1553.         positions[14] = frameline.find(tags[14])+tags[14].length();
  1554.     }
  1555.     else
  1556.     {
  1557.         positions[14]=0;
  1558.     }
  1559.  
  1560.     bool isvar=false, isfunc=false, isreg=false;
  1561.     for (int ice=0; ice < 15; ice ++)  //iter on tags positions
  1562.     {
  1563.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  1564.         {
  1565.             done=false;
  1566.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  1567.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  1568.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  1569.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  1570.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  1571.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  1572.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  1573.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  1574.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  1575.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  1576.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  1577.             {
  1578.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  1579.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  1580.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  1581.                 tempao+=frameline.substr(food+positions[ice],1);
  1582.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  1583.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  1584.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  1585.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  1586.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  1587.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  1588.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  1589.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  1590.                 {
  1591.                     switch (ice)
  1592.                     {
  1593.                     case 0:
  1594.                         if (frameline.find(tags[0])!=std::string::npos)
  1595.                         {
  1596.                             x=tempao;
  1597.                         }
  1598.                         else
  1599.                         {
  1600.                             x="0";
  1601.                         }
  1602.                         food=99999;
  1603.                         done=true;
  1604.                         tempao="";
  1605.                         break;
  1606.                     case 1:
  1607.                         if (frameline.find(tags[1])!=std::string::npos)
  1608.                         {
  1609.                             y=tempao;
  1610.                         }
  1611.                         else
  1612.                         {
  1613.                             y="0";
  1614.                         }
  1615.                         food=99999;
  1616.                         done=true;
  1617.                         tempao="";
  1618.                         break;
  1619.                     case 2:
  1620.                         if (frameline.find(tags[2])!=std::string::npos)
  1621.                         {
  1622.                             z=tempao;
  1623.                         }
  1624.                         else
  1625.                         {
  1626.                             z="0";
  1627.                         }
  1628.                         food=99999;
  1629.                         done=true;
  1630.                         tempao="";
  1631.                         break;
  1632.                     case 3:
  1633.                         if (frameline.find(tags[3])!=std::string::npos)
  1634.                         {
  1635.                             x_r=tempao;
  1636.                         }
  1637.                         else
  1638.                         {
  1639.                             x_r="4321";
  1640.                         }
  1641.                         food=99999;
  1642.                         done=true;
  1643.                         tempao="";
  1644.                         break;
  1645.                     case 4:
  1646.                         if (frameline.find(tags[4])!=std::string::npos)
  1647.                         {
  1648.                             y_r=tempao;
  1649.                         }
  1650.                         else
  1651.                         {
  1652.                             y_r="4321";
  1653.                         }
  1654.                         food=99999;
  1655.                         done=true;
  1656.                         tempao="";
  1657.                         break;
  1658.                     case 5:
  1659.                         if (frameline.find(tags[5])!=std::string::npos)
  1660.                         {
  1661.                             w=tempao;
  1662.                         }
  1663.                         else
  1664.                         {
  1665.                             w="4321";
  1666.                         }
  1667.                         food=99999;
  1668.                         done=true;
  1669.                         tempao="";
  1670.                         break;
  1671.                     case 6:
  1672.                         if (frameline.find(tags[6])!=std::string::npos)
  1673.                         {
  1674.                             h=tempao;
  1675.                         }
  1676.                         else
  1677.                         {
  1678.                             h="4321";
  1679.                         }
  1680.                         food=99999;
  1681.                         done=true;
  1682.                         tempao="";
  1683.                         break;
  1684.                     case 7:
  1685.                         if (frameline.find(tags[7])!=std::string::npos)
  1686.                         {
  1687.                             d=tempao;
  1688.                         }
  1689.                         else
  1690.                         {
  1691.                             d="1";
  1692.                         }
  1693.                         food=99999;
  1694.                         done=true;
  1695.                         tempao="";
  1696.                         break;
  1697.                     case 8:
  1698.                         if (frameline.find(tags[8])!=std::string::npos)
  1699.                         {
  1700.                             color[0]=tempao.substr(0, tempao.find(","));
  1701.                             color[1]=tempao.substr(tempao.find(",")+1, tempao.find(",", tempao.find(",")+1)-tempao.find(",")-1);
  1702.                             color[2]=tempao.substr(tempao.rfind(",", tempao.rfind(",")-1)+1, tempao.rfind(",")-tempao.rfind(",", tempao.rfind(",")-1)-1);
  1703.                             color[3]=tempao.substr(tempao.rfind(",")+1);
  1704.                         }
  1705.                         else
  1706.                         {
  1707.                             color[0]="0";
  1708.                             color[1]="0";
  1709.                             color[2]="0";
  1710.                             color[3]="0";
  1711.                         }
  1712.                         food=99999;
  1713.                         done=true;
  1714.                         tempao="";
  1715.                         break;
  1716.                     case 9:
  1717.                         if (frameline.find(tags[9])!=std::string::npos)
  1718.                         {
  1719.                             border_width=tempao;
  1720.                         }
  1721.                         else
  1722.                         {
  1723.                             border_width="1";
  1724.                         }
  1725.                         food=99999;
  1726.                         done=true;
  1727.                         tempao="";
  1728.                         break;
  1729.                     case 10:
  1730.                         if (frameline.find(tags[10])!=std::string::npos)
  1731.                         {
  1732.                             fill_color=tempao;
  1733.                         }
  1734.                         else
  1735.                         {
  1736.                             fill_color="0xFFFFFFFF";
  1737.                         }
  1738.                         food=99999;
  1739.                         done=true;
  1740.                         tempao="";
  1741.                         break;
  1742.                     case 11:
  1743.                         if (frameline.find(tags[11])!=std::string::npos)
  1744.                         {
  1745.                             strt_angle=tempao;
  1746.                         }
  1747.                         else
  1748.                         {
  1749.                             strt_angle="0";
  1750.                         }
  1751.                         food=99999;
  1752.                         done=true;
  1753.                         tempao="";
  1754.                         break;
  1755.                     case 12:
  1756.                         if (frameline.find(tags[12])!=std::string::npos)
  1757.                         {
  1758.                             arc_angle=tempao;
  1759.                         }
  1760.                         else
  1761.                         {
  1762.                             arc_angle="360";
  1763.                         }
  1764.                         food=99999;
  1765.                         done=true;
  1766.                         tempao="";
  1767.                         break;
  1768.                     case 13:
  1769.                         if (frameline.find(tags[13])!=std::string::npos)
  1770.                         {
  1771.                             vertices=tempao;
  1772.                         }
  1773.                         else
  1774.                         {
  1775.                             vertices="4321";
  1776.                         }
  1777.                         food=99999;
  1778.                         done=true;
  1779.                         tempao="";
  1780.                         break;
  1781.                     case 14:
  1782.                         if (frameline.find(tags[14])!=std::string::npos)
  1783.                         {
  1784.                             cndtn=tempao;
  1785.                         }
  1786.                         else
  1787.                         {
  1788.                             cndtn="1";
  1789.                         }
  1790.                         food=99999;
  1791.                         done=true;
  1792.                         tempao="";
  1793.                         break;
  1794.                     default:
  1795.                         ;
  1796.                     }
  1797.                 }
  1798.                 else
  1799.                 {
  1800.                     food++;
  1801.                 }
  1802.             }
  1803.         }
  1804.     }
  1805. }
  1806.  
  1807.  
  1808. callobject::callobject()
  1809. {
  1810.     exists=false;
  1811. }
  1812.  
  1813.  
  1814. void callobject::init(std::string framelinee)
  1815. {
  1816.     exists=true;
  1817.     int positions[14];
  1818.     std::string tempao;
  1819.     std::string maintag="call_object[";
  1820.     std::string tags[] = {"x=", "y=", "z=", "id=", "quantity=", "x_vel=", "y_vel=", "z_vel=", "x_hold_distance=", "z_hold_distance=", "frame=", "delay=", "set_reg=", "condition="};
  1821.     std::string flagslist[]= {"|FACINGBACK|", "|ATTACHEDBODY|", "|CLONE|", "|NOEFFECT|", "|NOSOUND|", "|SHAREREGS|", "|KEYSCONTROL|"};
  1822.  
  1823.     startpos=framelinee.find(maintag);
  1824.     endpos  =framelinee.find("]", startpos);
  1825.     std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
  1826.     for (int a=0; a<7; a++)
  1827.     {
  1828.         if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
  1829.     }
  1830.  
  1831.     bool done=false;
  1832.     if (frameline.find(tags[0])!=std::string::npos)
  1833.     {
  1834.         positions[0] = frameline.find(tags[0])+tags[0].length();
  1835.     }
  1836.     else
  1837.     {
  1838.         positions[0]=0;
  1839.     }
  1840.     if (frameline.find(tags[1])!=std::string::npos)
  1841.     {
  1842.         positions[1] = frameline.find(tags[1])+tags[1].length();
  1843.     }
  1844.     else
  1845.     {
  1846.         positions[1]=0;
  1847.     }
  1848.     if (frameline.find(tags[2])!=std::string::npos)
  1849.     {
  1850.         positions[2] = frameline.find(tags[2])+tags[2].length();
  1851.     }
  1852.     else
  1853.     {
  1854.         positions[2]=0;
  1855.     }
  1856.     if (frameline.find(tags[3])!=std::string::npos)
  1857.     {
  1858.         positions[3] = frameline.find(tags[3])+tags[3].length();
  1859.     }
  1860.     else
  1861.     {
  1862.         positions[3]=0;
  1863.     }
  1864.     if (frameline.find(tags[4])!=std::string::npos)
  1865.     {
  1866.         positions[4] = frameline.find(tags[4])+tags[4].length();
  1867.     }
  1868.     else
  1869.     {
  1870.         positions[4]=0;
  1871.     }
  1872.     if (frameline.find(tags[5])!=std::string::npos)
  1873.     {
  1874.         positions[5] = frameline.find(tags[5])+tags[5].length();
  1875.     }
  1876.     else
  1877.     {
  1878.         positions[5]=0;
  1879.     }
  1880.     if (frameline.find(tags[6])!=std::string::npos)
  1881.     {
  1882.         positions[6] = frameline.find(tags[6])+tags[6].length();
  1883.     }
  1884.     else
  1885.     {
  1886.         positions[6]=0;
  1887.     }
  1888.     if (frameline.find(tags[7])!=std::string::npos)
  1889.     {
  1890.         positions[7] = frameline.find(tags[7])+tags[7].length();
  1891.     }
  1892.     else
  1893.     {
  1894.         positions[7]=0;
  1895.     }
  1896.     if (frameline.find(tags[8])!=std::string::npos)
  1897.     {
  1898.         positions[8] = frameline.find(tags[8])+tags[8].length();
  1899.     }
  1900.     else
  1901.     {
  1902.         positions[8]=0;
  1903.     }
  1904.     if (frameline.find(tags[9])!=std::string::npos)
  1905.     {
  1906.         positions[9] = frameline.find(tags[9])+tags[9].length();
  1907.     }
  1908.     else
  1909.     {
  1910.         positions[9]=0;
  1911.     }
  1912.     if (frameline.find(tags[10])!=std::string::npos)
  1913.     {
  1914.         positions[10] = frameline.find(tags[10])+tags[10].length();
  1915.     }
  1916.     else
  1917.     {
  1918.         positions[10]=0;
  1919.     }
  1920.     if (frameline.find(tags[11])!=std::string::npos)
  1921.     {
  1922.         positions[11] = frameline.find(tags[11])+tags[11].length();
  1923.     }
  1924.     else
  1925.     {
  1926.         positions[11]=0;
  1927.     }
  1928.     if (frameline.find(tags[12])!=std::string::npos)
  1929.     {
  1930.         positions[12] = frameline.find(tags[12])+tags[12].length();
  1931.     }
  1932.     else
  1933.     {
  1934.         positions[12]=0;
  1935.     }
  1936.     if (frameline.find(tags[13])!=std::string::npos)
  1937.     {
  1938.         positions[13] = frameline.find(tags[13])+tags[13].length();
  1939.     }
  1940.     else
  1941.     {
  1942.         positions[13]=0;
  1943.     }
  1944.  
  1945.     bool isvar=false, isfunc=false, isreg=false;
  1946.     for (int ice=0; ice < 14; ice ++)  //iter on tags positions
  1947.     {
  1948.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  1949.         {
  1950.             done=false;
  1951.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  1952.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  1953.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  1954.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  1955.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  1956.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  1957.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  1958.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  1959.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  1960.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  1961.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  1962.             {
  1963.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  1964.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  1965.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  1966.                 tempao+=frameline.substr(food+positions[ice],1);
  1967.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  1968.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  1969.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  1970.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  1971.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  1972.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  1973.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  1974.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  1975.                 {
  1976.                     switch (ice)
  1977.                     {
  1978.                     case 0:
  1979.                         if (frameline.find(tags[0])!=std::string::npos)
  1980.                         {
  1981.                             x=tempao;
  1982.                         }
  1983.                         else
  1984.                         {
  1985.                             x="0";
  1986.                         }
  1987.                         food=99999;
  1988.                         done=true;
  1989.                         tempao="";
  1990.                         break;
  1991.                     case 1:
  1992.                         if (frameline.find(tags[1])!=std::string::npos)
  1993.                         {
  1994.                             y=tempao;
  1995.                         }
  1996.                         else
  1997.                         {
  1998.                             y="0";
  1999.                         }
  2000.                         food=99999;
  2001.                         done=true;
  2002.                         tempao="";
  2003.                         break;
  2004.                     case 2:
  2005.                         if (frameline.find(tags[2])!=std::string::npos)
  2006.                         {
  2007.                             z=tempao;
  2008.                         }
  2009.                         else
  2010.                         {
  2011.                             z="0";
  2012.                         }
  2013.                         food=99999;
  2014.                         done=true;
  2015.                         tempao="";
  2016.                         break;
  2017.                     case 3:
  2018.                         if (frameline.find(tags[3])!=std::string::npos)
  2019.                         {
  2020.                             id=tempao;
  2021.                         }
  2022.                         else
  2023.                         {
  2024.                             id="4321";
  2025.                         }
  2026.                         food=99999;
  2027.                         done=true;
  2028.                         tempao="";
  2029.                         break;
  2030.                     case 4:
  2031.                         if (frameline.find(tags[4])!=std::string::npos)
  2032.                         {
  2033.                             qntty=tempao;
  2034.                         }
  2035.                         else
  2036.                         {
  2037.                             qntty="1";
  2038.                         }
  2039.                         food=99999;
  2040.                         done=true;
  2041.                         tempao="";
  2042.                         break;
  2043.                     case 5:
  2044.                         if (frameline.find(tags[5])!=std::string::npos)
  2045.                         {
  2046.                             f_x=tempao;
  2047.                         }
  2048.                         else
  2049.                         {
  2050.                             f_x="0";
  2051.                         }
  2052.                         food=99999;
  2053.                         done=true;
  2054.                         tempao="";
  2055.                         break;
  2056.                     case 6:
  2057.                         if (frameline.find(tags[6])!=std::string::npos)
  2058.                         {
  2059.                             f_y=tempao;
  2060.                         }
  2061.                         else
  2062.                         {
  2063.                             f_y="0";
  2064.                         }
  2065.                         food=99999;
  2066.                         done=true;
  2067.                         tempao="";
  2068.                         break;
  2069.                     case 7:
  2070.                         if (frameline.find(tags[7])!=std::string::npos)
  2071.                         {
  2072.                             f_z=tempao;
  2073.                         }
  2074.                         else
  2075.                         {
  2076.                             f_z="0";
  2077.                         }
  2078.                         food=99999;
  2079.                         done=true;
  2080.                         tempao="";
  2081.                         break;
  2082.                     case 8:
  2083.                         if (frameline.find(tags[8])!=std::string::npos)
  2084.                         {
  2085.                             xhlddstnc=tempao;
  2086.                         }
  2087.                         else
  2088.                         {
  2089.                             xhlddstnc="4321";
  2090.                         }
  2091.                         food=99999;
  2092.                         done=true;
  2093.                         tempao="";
  2094.                         break;
  2095.                     case 9:
  2096.                         if (frameline.find(tags[9])!=std::string::npos)
  2097.                         {
  2098.                             zhlddstnc=tempao;
  2099.                         }
  2100.                         else
  2101.                         {
  2102.                             zhlddstnc="4321";
  2103.                         }
  2104.                         food=99999;
  2105.                         done=true;
  2106.                         tempao="";
  2107.                         break;
  2108.                     case 10:
  2109.                         if (frameline.find(tags[10])!=std::string::npos)
  2110.                         {
  2111.                             frm=tempao;
  2112.                         }
  2113.                         else
  2114.                         {
  2115.                             frm="4321";
  2116.                         }
  2117.                         food=99999;
  2118.                         done=true;
  2119.                         tempao="";
  2120.                         break;
  2121.                     case 11:
  2122.                         if (frameline.find(tags[11])!=std::string::npos)
  2123.                         {
  2124.                             delay=tempao;
  2125.                         }
  2126.                         else
  2127.                         {
  2128.                             delay="0";
  2129.                         }
  2130.                         food=99999;
  2131.                         done=true;
  2132.                         tempao="";
  2133.                         break;
  2134.                     case 12:
  2135.                         if (frameline.find(tags[12])!=std::string::npos)
  2136.                         {
  2137.                             reggy=tempao.substr(0, tempao.find(","));
  2138.                             reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  2139.                         }
  2140.                         else
  2141.                         {
  2142.                             reggy="4321";
  2143.                             reggyval="0";
  2144.                         }
  2145.                         food=99999;
  2146.                         done=true;
  2147.                         tempao="";
  2148.                         break;
  2149.                     case 13:
  2150.                         if (frameline.find(tags[13])!=std::string::npos)
  2151.                         {
  2152.                             cndtn=tempao;
  2153.                         }
  2154.                         else
  2155.                         {
  2156.                             cndtn="1";
  2157.                         }
  2158.                         food=99999;
  2159.                         done=true;
  2160.                         tempao="";
  2161.                         break;
  2162.                     default:
  2163.                         ;
  2164.                     }
  2165.                 }
  2166.                 else
  2167.                 {
  2168.                     food++;
  2169.                 }
  2170.             }
  2171.         }
  2172.     }
  2173.  
  2174.  
  2175. }
  2176.  
  2177.  
  2178. void frame::init(std::string frameline, int no_)
  2179. {
  2180.     exists=true;
  2181.     no=no_;
  2182.     bool validchar;
  2183.     int positions[51];
  2184.     std::string tempao;
  2185.     BDYS.resize(21);
  2186.     RECTS.resize(20);
  2187.     COMBINATIONS.resize(20);
  2188.     CALLOBJECTS.resize(20);
  2189.     DRAWSHAPES.resize(20);
  2190.  
  2191.     while (frameline.find("set_bdy[")!=std::string::npos)
  2192.     {
  2193.         BDYS[bdyindx].init(frameline);
  2194.         frameline.erase(BDYS[bdyindx].startpos, BDYS[bdyindx].endpos - BDYS[bdyindx].startpos);
  2195.         bdyindx++;
  2196.     }
  2197.     while (frameline.find("set_rect[")!=std::string::npos)
  2198.     {
  2199.         RECTS[rectindx].init(frameline);
  2200.         frameline.erase(RECTS[rectindx].startpos, RECTS[rectindx].endpos - RECTS[rectindx].startpos);
  2201.         rectindx++;
  2202.     }
  2203.     while (frameline.find("set_combination[")!=std::string::npos)
  2204.     {
  2205.         COMBINATIONS[combinationindx].init(frameline);
  2206.         frameline.erase(COMBINATIONS[combinationindx].startpos, COMBINATIONS[combinationindx].endpos - COMBINATIONS[combinationindx].startpos);
  2207.         combinationindx++;
  2208.     }
  2209.     while (frameline.find("call_object[")!=std::string::npos)
  2210.     {
  2211.         CALLOBJECTS[callobjectindx].init(frameline);
  2212.         frameline.erase(CALLOBJECTS[callobjectindx].startpos, CALLOBJECTS[callobjectindx].endpos - CALLOBJECTS[callobjectindx].startpos);
  2213.         callobjectindx++;
  2214.     }
  2215.     while (frameline.find("draw_shape[")!=std::string::npos)
  2216.     {
  2217.         DRAWSHAPES[drawshapeindx].init(frameline);
  2218.         frameline.erase(DRAWSHAPES[drawshapeindx].startpos, DRAWSHAPES[drawshapeindx].endpos - DRAWSHAPES[drawshapeindx].startpos);
  2219.         drawshapeindx++;
  2220.     }
  2221.     std::string tags[] = {"img=", "delay=", "goto=", "alpha=", "center=", "x_vel=", "y_vel=", "z_vel=", "loop=", "x_acc=",
  2222.                           "z_hold_distance=","x_hold_distance=", "acc_x_hold=", "acc_z_hold=", "max_vx_limit=",
  2223.                           "max_vy_limit=", "max_vz_limit=", "counter=", "add_hp=", "add_sp=", "add_rp=",
  2224.                           "c<a>=", "c<j>=", "c<d>=", "c<s>=", "h<a>=", "h<j>=", "h<d>=", "h<s>=", "c<b>=", "h<b>=", /*31*/
  2225.                           "hit_ground=", "c<f>=", "c<u_a>=", "c<d_a>=", "h<f>=", "h<u_a>=", "h<d_a>=", "c<r_a>=", "c<l_a>=",
  2226.                           "h<r_a>=", "h<l_a>=", "translate_x_y_z=", "set_reg=", "x_adopt=", "y_adopt=", "z_adopt=", "state=",
  2227.                           "air_resistance=", "rendering_priority=", "y_acc="
  2228.                          };
  2229.     std::string menuflagslist[]= {"|NEXTCHOOSE|", "|NEXTPLAYERMENU|", "|NEXTSTANCE|", "|BACKDISJOIN|", "|BACKHIGHLIGHT|", "|BACKCHOOSE|",
  2230.                                   "|BACKPLAYERMENU|", "|BACKSTANCE|", "|DISJOIN|", "|SHOWSTANCE|", "|HIGHLIGHT|"
  2231.                                  };
  2232.     std::string flagslist[]= {"|STANDING|","|WALKING|", "|DEFENDING|", "|ALLOWTURN|", "|REGENDPMAX|", "|REGENKPMAX|", "|REGENSP|",
  2233.                               "|REGENRP|", "|NOSHADOW|", "|NOBARS|", "|NOHPBAR|",  "|NOSPBAR|", "|NORPBAR|", "|IGNORERECT|", "|IGNOREPLATFORM|", "|PLATFORMONLY|",
  2234.                               "|DEAD|", "|FLUSHCOMBINATION|", "|CHANGEFACING|", "|HIDESHADOW|", "|UNIVERSAL|", "|IGNOREGRAVITY|", "|RENDERBACK|"
  2235.                              };
  2236.     for (int a=0; a<23; a++)
  2237.     {
  2238.         if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
  2239.     }
  2240.     for (int a=0; a<11; a++)
  2241.     {
  2242.         if (frameline.find(menuflagslist[a])!=std::string::npos) menuflags[a]=true;
  2243.     }
  2244.  
  2245.     bool done=false;
  2246.     if (frameline.find(tags[0])!=std::string::npos)
  2247.     {
  2248.         positions[0] = frameline.find(tags[0])+tags[0].length();
  2249.     }
  2250.     else
  2251.     {
  2252.         positions[0]=0;
  2253.     }
  2254.     if (frameline.find(tags[1])!=std::string::npos)
  2255.     {
  2256.         positions[1] = frameline.find(tags[1])+tags[1].length();
  2257.     }
  2258.     else
  2259.     {
  2260.         positions[1]=0;
  2261.     }
  2262.     if (frameline.find(tags[2])!=std::string::npos)
  2263.     {
  2264.         positions[2] = frameline.find(tags[2])+tags[2].length();
  2265.     }
  2266.     else
  2267.     {
  2268.         positions[2]=0;
  2269.     }
  2270.     if (frameline.find(tags[3])!=std::string::npos)
  2271.     {
  2272.         positions[3] = frameline.find(tags[3])+tags[3].length();
  2273.     }
  2274.     else
  2275.     {
  2276.         positions[3]=0;
  2277.     }
  2278.     if (frameline.find(tags[4])!=std::string::npos)
  2279.     {
  2280.         positions[4] = frameline.find(tags[4])+tags[4].length();
  2281.     }
  2282.     else
  2283.     {
  2284.         positions[4]=0;
  2285.     }
  2286.     if (frameline.find(tags[5])!=std::string::npos)
  2287.     {
  2288.         positions[5] = frameline.find(tags[5])+tags[5].length();
  2289.     }
  2290.     else
  2291.     {
  2292.         positions[5]=0;
  2293.     }
  2294.     if (frameline.find(tags[6])!=std::string::npos)
  2295.     {
  2296.         positions[6] = frameline.find(tags[6])+tags[6].length();
  2297.     }
  2298.     else
  2299.     {
  2300.         positions[6]=0;
  2301.     }
  2302.     if (frameline.find(tags[7])!=std::string::npos)
  2303.     {
  2304.         positions[7] = frameline.find(tags[7])+tags[7].length();
  2305.     }
  2306.     else
  2307.     {
  2308.         positions[7]=0;
  2309.     }
  2310.     if (frameline.find(tags[8])!=std::string::npos)
  2311.     {
  2312.         positions[8] = frameline.find(tags[8])+tags[8].length();
  2313.     }
  2314.     else
  2315.     {
  2316.         positions[8]=0;
  2317.     }
  2318.     if (frameline.find(tags[9])!=std::string::npos)
  2319.     {
  2320.         positions[9] = frameline.find(tags[9])+tags[9].length();
  2321.     }
  2322.     else
  2323.     {
  2324.         positions[9]=0;
  2325.     }
  2326.     if (frameline.find(tags[10])!=std::string::npos)
  2327.     {
  2328.         positions[10] = frameline.find(tags[10])+tags[10].length();
  2329.     }
  2330.     else
  2331.     {
  2332.         positions[10]=0;
  2333.     }
  2334.     if (frameline.find(tags[11])!=std::string::npos)
  2335.     {
  2336.         positions[11] = frameline.find(tags[11])+tags[11].length();
  2337.     }
  2338.     else
  2339.     {
  2340.         positions[11]=0;
  2341.     }
  2342.     if (frameline.find(tags[12])!=std::string::npos)
  2343.     {
  2344.         positions[12] = frameline.find(tags[12])+tags[12].length();
  2345.     }
  2346.     else
  2347.     {
  2348.         positions[12]=0;
  2349.     }
  2350.     if (frameline.find(tags[13])!=std::string::npos)
  2351.     {
  2352.         positions[13] = frameline.find(tags[13])+tags[13].length();
  2353.     }
  2354.     else
  2355.     {
  2356.         positions[13]=0;
  2357.     }
  2358.     if (frameline.find(tags[14])!=std::string::npos)
  2359.     {
  2360.         positions[14] = frameline.find(tags[14])+tags[14].length();
  2361.     }
  2362.     else
  2363.     {
  2364.         positions[14]=0;
  2365.     }
  2366.     if (frameline.find(tags[15])!=std::string::npos)
  2367.     {
  2368.         positions[15] = frameline.find(tags[15])+tags[15].length();
  2369.     }
  2370.     else
  2371.     {
  2372.         positions[15]=0;
  2373.     }
  2374.     if (frameline.find(tags[16])!=std::string::npos)
  2375.     {
  2376.         positions[16] = frameline.find(tags[16])+tags[16].length();
  2377.     }
  2378.     else
  2379.     {
  2380.         positions[16]=0;
  2381.     }
  2382.     if (frameline.find(tags[17])!=std::string::npos)
  2383.     {
  2384.         positions[17] = frameline.find(tags[17])+tags[17].length();
  2385.     }
  2386.     else
  2387.     {
  2388.         positions[17]=0;
  2389.     }
  2390.     if (frameline.find(tags[18])!=std::string::npos)
  2391.     {
  2392.         positions[18] = frameline.find(tags[18])+tags[18].length();
  2393.     }
  2394.     else
  2395.     {
  2396.         positions[18]=0;
  2397.     }
  2398.     if (frameline.find(tags[19])!=std::string::npos)
  2399.     {
  2400.         positions[19] = frameline.find(tags[19])+tags[19].length();
  2401.     }
  2402.     else
  2403.     {
  2404.         positions[19]=0;
  2405.     }
  2406.     if (frameline.find(tags[20])!=std::string::npos)
  2407.     {
  2408.         positions[20] = frameline.find(tags[20])+tags[20].length();
  2409.     }
  2410.     else
  2411.     {
  2412.         positions[20]=0;
  2413.     }
  2414.     if (frameline.find(tags[21])!=std::string::npos)
  2415.     {
  2416.         positions[21] = frameline.find(tags[21])+tags[21].length();
  2417.     }
  2418.     else
  2419.     {
  2420.         positions[21]=0;
  2421.     }
  2422.     if (frameline.find(tags[22])!=std::string::npos)
  2423.     {
  2424.         positions[22] = frameline.find(tags[22])+tags[22].length();
  2425.     }
  2426.     else
  2427.     {
  2428.         positions[22]=0;
  2429.     }
  2430.     if (frameline.find(tags[23])!=std::string::npos)
  2431.     {
  2432.         positions[23] = frameline.find(tags[23])+tags[23].length();
  2433.     }
  2434.     else
  2435.     {
  2436.         positions[23]=0;
  2437.     }
  2438.     if (frameline.find(tags[24])!=std::string::npos)
  2439.     {
  2440.         positions[24] = frameline.find(tags[24])+tags[24].length();
  2441.     }
  2442.     else
  2443.     {
  2444.         positions[24]=0;
  2445.     }
  2446.     if (frameline.find(tags[25])!=std::string::npos)
  2447.     {
  2448.         positions[25] = frameline.find(tags[25])+tags[25].length();
  2449.     }
  2450.     else
  2451.     {
  2452.         positions[25]=0;
  2453.     }
  2454.     if (frameline.find(tags[26])!=std::string::npos)
  2455.     {
  2456.         positions[26] = frameline.find(tags[26])+tags[26].length();
  2457.     }
  2458.     else
  2459.     {
  2460.         positions[26]=0;
  2461.     }
  2462.     if (frameline.find(tags[27])!=std::string::npos)
  2463.     {
  2464.         positions[27] = frameline.find(tags[27])+tags[27].length();
  2465.     }
  2466.     else
  2467.     {
  2468.         positions[27]=0;
  2469.     }
  2470.     if (frameline.find(tags[28])!=std::string::npos)
  2471.     {
  2472.         positions[28] = frameline.find(tags[28])+tags[28].length();
  2473.     }
  2474.     else
  2475.     {
  2476.         positions[28]=0;
  2477.     }
  2478.     if (frameline.find(tags[29])!=std::string::npos)
  2479.     {
  2480.         positions[29] = frameline.find(tags[29])+tags[29].length();
  2481.     }
  2482.     else
  2483.     {
  2484.         positions[29]=0;
  2485.     }
  2486.     if (frameline.find(tags[30])!=std::string::npos)
  2487.     {
  2488.         positions[30] = frameline.find(tags[30])+tags[30].length();
  2489.     }
  2490.     else
  2491.     {
  2492.         positions[30]=0;
  2493.     }
  2494.     if (frameline.find(tags[31])!=std::string::npos)
  2495.     {
  2496.         positions[31] = frameline.find(tags[31])+tags[31].length();
  2497.     }
  2498.     else
  2499.     {
  2500.         positions[31]=0;
  2501.     }
  2502.     if (frameline.find(tags[32])!=std::string::npos)
  2503.     {
  2504.         positions[32] = frameline.find(tags[32])+tags[32].length();
  2505.     }
  2506.     else
  2507.     {
  2508.         positions[32]=0;
  2509.     }
  2510.     if (frameline.find(tags[33])!=std::string::npos)
  2511.     {
  2512.         positions[33] = frameline.find(tags[33])+tags[33].length();
  2513.     }
  2514.     else
  2515.     {
  2516.         positions[33]=0;
  2517.     }
  2518.     if (frameline.find(tags[34])!=std::string::npos)
  2519.     {
  2520.         positions[34] = frameline.find(tags[34])+tags[34].length();
  2521.     }
  2522.     else
  2523.     {
  2524.         positions[34]=0;
  2525.     }
  2526.     if (frameline.find(tags[35])!=std::string::npos)
  2527.     {
  2528.         positions[35] = frameline.find(tags[35])+tags[35].length();
  2529.     }
  2530.     else
  2531.     {
  2532.         positions[35]=0;
  2533.     }
  2534.     if (frameline.find(tags[36])!=std::string::npos)
  2535.     {
  2536.         positions[36] = frameline.find(tags[36])+tags[36].length();
  2537.     }
  2538.     else
  2539.     {
  2540.         positions[36]=0;
  2541.     }
  2542.     if (frameline.find(tags[37])!=std::string::npos)
  2543.     {
  2544.         positions[37] = frameline.find(tags[37])+tags[37].length();
  2545.     }
  2546.     else
  2547.     {
  2548.         positions[37]=0;
  2549.     }
  2550.     if (frameline.find(tags[38])!=std::string::npos)
  2551.     {
  2552.         positions[38] = frameline.find(tags[38])+tags[38].length();
  2553.     }
  2554.     else
  2555.     {
  2556.         positions[38]=0;
  2557.     }
  2558.     if (frameline.find(tags[39])!=std::string::npos)
  2559.     {
  2560.         positions[39] = frameline.find(tags[39])+tags[39].length();
  2561.     }
  2562.     else
  2563.     {
  2564.         positions[39]=0;
  2565.     }
  2566.     if (frameline.find(tags[40])!=std::string::npos)
  2567.     {
  2568.         positions[40] = frameline.find(tags[40])+tags[40].length();
  2569.     }
  2570.     else
  2571.     {
  2572.         positions[40]=0;
  2573.     }
  2574.     if (frameline.find(tags[41])!=std::string::npos)
  2575.     {
  2576.         positions[41] = frameline.find(tags[41])+tags[41].length();
  2577.     }
  2578.     else
  2579.     {
  2580.         positions[41]=0;
  2581.     }
  2582.     if (frameline.find(tags[42])!=std::string::npos)
  2583.     {
  2584.         positions[42] = frameline.find(tags[42])+tags[42].length();
  2585.     }
  2586.     else
  2587.     {
  2588.         positions[42]=0;
  2589.     }
  2590.     if (frameline.find(tags[43])!=std::string::npos)
  2591.     {
  2592.         positions[43] = frameline.find(tags[43])+tags[43].length();
  2593.     }
  2594.     else
  2595.     {
  2596.         positions[43]=0;
  2597.     }
  2598.     if (frameline.find(tags[44])!=std::string::npos)
  2599.     {
  2600.         positions[44] = frameline.find(tags[44])+tags[44].length();
  2601.     }
  2602.     else
  2603.     {
  2604.         positions[44]=0;
  2605.     }
  2606.     if (frameline.find(tags[45])!=std::string::npos)
  2607.     {
  2608.         positions[45] = frameline.find(tags[45])+tags[45].length();
  2609.     }
  2610.     else
  2611.     {
  2612.         positions[45]=0;
  2613.     }
  2614.     if (frameline.find(tags[46])!=std::string::npos)
  2615.     {
  2616.         positions[46] = frameline.find(tags[46])+tags[46].length();
  2617.     }
  2618.     else
  2619.     {
  2620.         positions[46]=0;
  2621.     }
  2622.     if (frameline.find(tags[47])!=std::string::npos)
  2623.     {
  2624.         positions[47] = frameline.find(tags[47])+tags[47].length();
  2625.     }
  2626.     else
  2627.     {
  2628.         positions[47]=0;
  2629.     }
  2630.     if (frameline.find(tags[48])!=std::string::npos)
  2631.     {
  2632.         positions[48] = frameline.find(tags[48])+tags[48].length();
  2633.     }
  2634.     else
  2635.     {
  2636.         positions[48]=0;
  2637.     }
  2638.     if (frameline.find(tags[49])!=std::string::npos)
  2639.     {
  2640.         positions[49] = frameline.find(tags[49])+tags[49].length();
  2641.     }
  2642.     else
  2643.     {
  2644.         positions[49]=0;
  2645.     }
  2646.     if (frameline.find(tags[50])!=std::string::npos)
  2647.     {
  2648.         positions[50] = frameline.find(tags[50])+tags[50].length();
  2649.     }
  2650.     else
  2651.     {
  2652.         positions[50]=0;
  2653.     }
  2654.  
  2655.     bool isvar=false, isfunc=false, isreg=false;
  2656.  
  2657.     for (int ice=0; ice < 51; ice ++)  //iter on tags positions
  2658.     {
  2659.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  2660.         {
  2661.             done=false;
  2662.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  2663.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  2664.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  2665.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  2666.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  2667.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  2668.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  2669.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  2670.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  2671.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  2672.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  2673.             {
  2674.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  2675.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  2676.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  2677.                 tempao+=frameline.substr(food+positions[ice],1);
  2678.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  2679.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  2680.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  2681.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  2682.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  2683.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  2684.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  2685.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  2686.                 {
  2687.                     switch (ice)
  2688.                     {
  2689.                     case 0:
  2690.                         if (frameline.find(tags[0])!=std::string::npos)
  2691.                         {
  2692.                             if (tempao.find(",")!=std::string::npos)
  2693.                             {
  2694.                                 img=tempao.substr(0, tempao.find(","));
  2695.                                 grid=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  2696.                             }
  2697.                             else
  2698.                             {
  2699.                                 img=tempao;
  2700.                                 grid="4321";
  2701.                             }
  2702.                         }
  2703.                         else
  2704.                         {
  2705.                             img="0";
  2706.                             grid="4321";
  2707.                         }
  2708.                         food=99999;
  2709.                         done=true;
  2710.                         tempao="";
  2711.                         break;
  2712.                     case 1:
  2713.                         if (frameline.find(tags[1])!=std::string::npos)
  2714.                         {
  2715.                             delay=tempao;
  2716.                         }
  2717.                         else
  2718.                         {
  2719.                             delay="0";
  2720.                         }
  2721.                         food=99999;
  2722.                         done=true;
  2723.                         tempao="";
  2724.                         break;
  2725.                     case 2:
  2726.                         if (frameline.find(tags[2])!=std::string::npos)
  2727.                         {
  2728.                             if (tempao.find(",")!=std::string::npos)
  2729.                             {
  2730.                                 nxt=tempao.substr(0, tempao.find(","));
  2731.                                 nxtid=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  2732.                             }
  2733.                             else
  2734.                             {
  2735.                                 nxt=tempao;
  2736.                                 nxtid="4321";
  2737.                             }
  2738.                         }
  2739.                         else
  2740.                         {
  2741.                             nxt=stringify(no+1);
  2742.                             nxtid="4321";
  2743.                         }
  2744.                         food=99999;
  2745.                         done=true;
  2746.                         tempao="";
  2747.                         break;
  2748.                         if (frameline.find(tags[2])!=std::string::npos)
  2749.                         {
  2750.                             nxt=tempao;
  2751.                         }
  2752.                         else
  2753.                         {
  2754.                             nxt=stringify(no+1);
  2755.                         }
  2756.                         food=99999;
  2757.                         done=true;
  2758.                         tempao="";
  2759.                         break;
  2760.                     case 3:
  2761.                         if (frameline.find(tags[3])!=std::string::npos)
  2762.                         {
  2763.                             alpha=tempao;
  2764.                         }
  2765.                         else
  2766.                         {
  2767.                             alpha="4321";
  2768.                         }
  2769.                         food=99999;
  2770.                         done=true;
  2771.                         tempao="";
  2772.                         break;
  2773.                     case 4:
  2774.                         if (frameline.find(tags[4])!=std::string::npos)
  2775.                         {
  2776.                             center_X=tempao.substr(0, tempao.find(","));
  2777.                             center_Y=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  2778.                         }
  2779.                         else
  2780.                         {
  2781.                             center_X="0";
  2782.                             center_Y="0";
  2783.                         }
  2784.                         food=99999;
  2785.                         done=true;
  2786.                         tempao="";
  2787.                         break;
  2788.                     case 5:
  2789.                         if (frameline.find(tags[5])!=std::string::npos)
  2790.                         {
  2791.                             f_x=tempao;
  2792.                         }
  2793.                         else
  2794.                         {
  2795.                             f_x="0";
  2796.                         }
  2797.                         food=99999;
  2798.                         done=true;
  2799.                         tempao="";
  2800.                         break;
  2801.                     case 6:
  2802.                         if (frameline.find(tags[6])!=std::string::npos)
  2803.                         {
  2804.                             f_y=tempao;
  2805.                         }
  2806.                         else
  2807.                         {
  2808.                             f_y="0";
  2809.                         }
  2810.                         food=99999;
  2811.                         done=true;
  2812.                         tempao="";
  2813.                         break;
  2814.                     case 7:
  2815.                         if (frameline.find(tags[7])!=std::string::npos)
  2816.                         {
  2817.                             f_z=tempao;
  2818.                         }
  2819.                         else
  2820.                         {
  2821.                             f_z="0";
  2822.                         }
  2823.                         food=99999;
  2824.                         done=true;
  2825.                         tempao="";
  2826.                         break;
  2827.                     case 8:
  2828.                         if (frameline.find(tags[8])!=std::string::npos)
  2829.                         {
  2830.                             loop_length=tempao.substr(0, tempao.find(","));
  2831.                             loop_condition=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(","));
  2832.                             loop_goto=tempao.substr(tempao.rfind(",")+1);
  2833.                         }
  2834.                         else
  2835.                         {
  2836.                             loop_condition="4321";
  2837.                             loop_length="4321";
  2838.                             loop_goto="4321";
  2839.                         }
  2840.                         food=99999;
  2841.                         done=true;
  2842.                         tempao="";
  2843.                         break;
  2844.                     case 9:
  2845.                         if (frameline.find(tags[9])!=std::string::npos)
  2846.                         {
  2847.                             acc=tempao;
  2848.                         }
  2849.                         else
  2850.                         {
  2851.                             acc="0";
  2852.                         }
  2853.                         food=99999;
  2854.                         done=true;
  2855.                         tempao="";
  2856.                         break;
  2857.                     case 10:
  2858.                         if (frameline.find(tags[10])!=std::string::npos)
  2859.                         {
  2860.                             zhlddstnc=tempao;
  2861.                         }
  2862.                         else
  2863.                         {
  2864.                             zhlddstnc="0";
  2865.                         }
  2866.                         food=99999;
  2867.                         done=true;
  2868.                         tempao="";
  2869.                         break;
  2870.                     case 11:
  2871.                         if (frameline.find(tags[11])!=std::string::npos)
  2872.                         {
  2873.                             xhlddstnc=tempao;
  2874.                         }
  2875.                         else
  2876.                         {
  2877.                             xhlddstnc="0";
  2878.                         }
  2879.                         food=99999;
  2880.                         done=true;
  2881.                         tempao="";
  2882.                         break;
  2883.                     case 12:
  2884.                         if (frameline.find(tags[12])!=std::string::npos)
  2885.                         {
  2886.                             xhldacc=tempao;
  2887.                         }
  2888.                         else
  2889.                         {
  2890.                             xhldacc="0";
  2891.                         }
  2892.                         food=99999;
  2893.                         done=true;
  2894.                         tempao="";
  2895.                         break;
  2896.                     case 13:
  2897.                         if (frameline.find(tags[13])!=std::string::npos)
  2898.                         {
  2899.                             zhldacc=tempao;
  2900.                         }
  2901.                         else
  2902.                         {
  2903.                             zhldacc="0";
  2904.                         }
  2905.                         food=99999;
  2906.                         done=true;
  2907.                         tempao="";
  2908.                         break;
  2909.                     case 14:
  2910.                         if (frameline.find(tags[14])!=std::string::npos)
  2911.                         {
  2912.                             mxlmtvx=tempao;
  2913.                         }
  2914.                         else
  2915.                         {
  2916.                             mxlmtvx="4321";
  2917.                         }
  2918.                         food=99999;
  2919.                         done=true;
  2920.                         tempao="";
  2921.                         break;
  2922.                     case 15:
  2923.                         if (frameline.find(tags[15])!=std::string::npos)
  2924.                         {
  2925.                             mxlmtvy=tempao;
  2926.                         }
  2927.                         else
  2928.                         {
  2929.                             mxlmtvy="4321";
  2930.                         }
  2931.                         food=99999;
  2932.                         done=true;
  2933.                         tempao="";
  2934.                         break;
  2935.                     case 16:
  2936.                         if (frameline.find(tags[16])!=std::string::npos)
  2937.                         {
  2938.                             mxlmtvz=tempao;
  2939.                         }
  2940.                         else
  2941.                         {
  2942.                             mxlmtvz="4321";
  2943.                         }
  2944.                         food=99999;
  2945.                         done=true;
  2946.                         tempao="";
  2947.                         break;
  2948.                     case 17:
  2949.                         if (frameline.find(tags[17])!=std::string::npos)
  2950.                         {
  2951.                             counter=tempao;
  2952.                         }
  2953.                         else
  2954.                         {
  2955.                             counter="4321";
  2956.                         }
  2957.                         food=99999;
  2958.                         done=true;
  2959.                         tempao="";
  2960.                         break;
  2961.                     case 18:
  2962.                         if (frameline.find(tags[18])!=std::string::npos)
  2963.                         {
  2964.                             addhp=tempao;
  2965.                         }
  2966.                         else
  2967.                         {
  2968.                             addhp="4321";
  2969.                         }
  2970.                         food=99999;
  2971.                         done=true;
  2972.                         tempao="";
  2973.                         break;
  2974.                     case 19:
  2975.                         if (frameline.find(tags[19])!=std::string::npos)
  2976.                         {
  2977.                             addsp=tempao;
  2978.                         }
  2979.                         else
  2980.                         {
  2981.                             addsp="4321";
  2982.                         }
  2983.                         food=99999;
  2984.                         done=true;
  2985.                         tempao="";
  2986.                         break;
  2987.                     case 20:
  2988.                         if (frameline.find(tags[20])!=std::string::npos)
  2989.                         {
  2990.                             addrp=tempao;
  2991.                         }
  2992.                         else
  2993.                         {
  2994.                             addrp="4321";
  2995.                         }
  2996.                         food=99999;
  2997.                         done=true;
  2998.                         tempao="";
  2999.                         break;
  3000.                     case 21:
  3001.                         if (frameline.find(tags[21])!=std::string::npos)
  3002.                         {
  3003.                             c_a=tempao;
  3004.                         }
  3005.                         else
  3006.                         {
  3007.                             c_a="4321";
  3008.                         }
  3009.                         food=99999;
  3010.                         done=true;
  3011.                         tempao="";
  3012.                         break;
  3013.                     case 22:
  3014.                         if (frameline.find(tags[22])!=std::string::npos)
  3015.                         {
  3016.                             c_j=tempao;
  3017.                         }
  3018.                         else
  3019.                         {
  3020.                             c_j="4321";
  3021.                         }
  3022.                         food=99999;
  3023.                         done=true;
  3024.                         tempao="";
  3025.                         break;
  3026.                     case 23:
  3027.                         if (frameline.find(tags[23])!=std::string::npos)
  3028.                         {
  3029.                             c_d=tempao;
  3030.                         }
  3031.                         else
  3032.                         {
  3033.                             c_d="4321";
  3034.                         }
  3035.                         food=99999;
  3036.                         done=true;
  3037.                         tempao="";
  3038.                         break;
  3039.                     case 24:
  3040.                         if (frameline.find(tags[24])!=std::string::npos)
  3041.                         {
  3042.                             c_s=tempao;
  3043.                         }
  3044.                         else
  3045.                         {
  3046.                             c_s="4321";
  3047.                         }
  3048.                         food=99999;
  3049.                         done=true;
  3050.                         tempao="";
  3051.                         break;
  3052.                     case 25:
  3053.                         if (frameline.find(tags[25])!=std::string::npos)
  3054.                         {
  3055.                             h_a=tempao;
  3056.                         }
  3057.                         else
  3058.                         {
  3059.                             h_a="4321";
  3060.                         }
  3061.                         food=99999;
  3062.                         done=true;
  3063.                         tempao="";
  3064.                         break;
  3065.                     case 26:
  3066.                         if (frameline.find(tags[26])!=std::string::npos)
  3067.                         {
  3068.                             h_j=tempao;
  3069.                         }
  3070.                         else
  3071.                         {
  3072.                             h_j="4321";
  3073.                         }
  3074.                         food=99999;
  3075.                         done=true;
  3076.                         tempao="";
  3077.                         break;
  3078.                     case 27:
  3079.                         if (frameline.find(tags[27])!=std::string::npos)
  3080.                         {
  3081.                             h_d=tempao;
  3082.                         }
  3083.                         else
  3084.                         {
  3085.                             h_d="4321";
  3086.                         }
  3087.                         food=99999;
  3088.                         done=true;
  3089.                         tempao="";
  3090.                         break;
  3091.                     case 28:
  3092.                         if (frameline.find(tags[28])!=std::string::npos)
  3093.                         {
  3094.                             h_s=tempao;
  3095.                         }
  3096.                         else
  3097.                         {
  3098.                             h_s="4321";
  3099.                         }
  3100.                         food=99999;
  3101.                         done=true;
  3102.                         tempao="";
  3103.                         break;
  3104.                     case 29:
  3105.                         if (frameline.find(tags[29])!=std::string::npos)
  3106.                         {
  3107.                             c_b=tempao;
  3108.                         }
  3109.                         else
  3110.                         {
  3111.                             c_b="4321";
  3112.                         }
  3113.                         food=99999;
  3114.                         done=true;
  3115.                         tempao="";
  3116.                         break;
  3117.                     case 30:
  3118.                         if (frameline.find(tags[30])!=std::string::npos)
  3119.                         {
  3120.                             h_b=tempao;
  3121.                         }
  3122.                         else
  3123.                         {
  3124.                             h_b="4321";
  3125.                         }
  3126.                         food=99999;
  3127.                         done=true;
  3128.                         tempao="";
  3129.                         break;
  3130.                     case 31:
  3131.                         if (frameline.find(tags[31])!=std::string::npos)
  3132.                         {
  3133.                             hitground=tempao;
  3134.                         }
  3135.                         else
  3136.                         {
  3137.                             hitground="4321";
  3138.                         }
  3139.                         food=99999;
  3140.                         done=true;
  3141.                         tempao="";
  3142.                         break;
  3143.                     case 32:
  3144.                         if (frameline.find(tags[32])!=std::string::npos)
  3145.                         {
  3146.                             c_f=tempao;
  3147.                         }
  3148.                         else
  3149.                         {
  3150.                             c_f="4321";
  3151.                         }
  3152.                         food=99999;
  3153.                         done=true;
  3154.                         tempao="";
  3155.                         break;
  3156.                     case 33:
  3157.                         if (frameline.find(tags[33])!=std::string::npos)
  3158.                         {
  3159.                             c_ua=tempao;
  3160.                         }
  3161.                         else
  3162.                         {
  3163.                             c_ua="4321";
  3164.                         }
  3165.                         food=99999;
  3166.                         done=true;
  3167.                         tempao="";
  3168.                         break;
  3169.                     case 34:
  3170.                         if (frameline.find(tags[34])!=std::string::npos)
  3171.                         {
  3172.                             c_da=tempao;
  3173.                         }
  3174.                         else
  3175.                         {
  3176.                             c_da="4321";
  3177.                         }
  3178.                         food=99999;
  3179.                         done=true;
  3180.                         tempao="";
  3181.                         break;
  3182.                     case 35:
  3183.                         if (frameline.find(tags[35])!=std::string::npos)
  3184.                         {
  3185.                             h_f=tempao;
  3186.                         }
  3187.                         else
  3188.                         {
  3189.                             h_f="4321";
  3190.                         }
  3191.                         food=99999;
  3192.                         done=true;
  3193.                         tempao="";
  3194.                         break;
  3195.                     case 36:
  3196.                         if (frameline.find(tags[36])!=std::string::npos)
  3197.                         {
  3198.                             h_ua=tempao;
  3199.                         }
  3200.                         else
  3201.                         {
  3202.                             h_ua="4321";
  3203.                         }
  3204.                         food=99999;
  3205.                         done=true;
  3206.                         tempao="";
  3207.                         break;
  3208.                     case 37:
  3209.                         if (frameline.find(tags[37])!=std::string::npos)
  3210.                         {
  3211.                             h_da=tempao;
  3212.                         }
  3213.                         else
  3214.                         {
  3215.                             h_da="4321";
  3216.                         }
  3217.                         food=99999;
  3218.                         done=true;
  3219.                         tempao="";
  3220.                         break;
  3221.                     case 38:
  3222.                         if (frameline.find(tags[38])!=std::string::npos)
  3223.                         {
  3224.                             c_ra=tempao;
  3225.                         }
  3226.                         else
  3227.                         {
  3228.                             c_ra="4321";
  3229.                         }
  3230.                         food=99999;
  3231.                         done=true;
  3232.                         tempao="";
  3233.                         break;
  3234.                     case 39:
  3235.                         if (frameline.find(tags[39])!=std::string::npos)
  3236.                         {
  3237.                             c_la=tempao;
  3238.                         }
  3239.                         else
  3240.                         {
  3241.                             c_la="4321";
  3242.                         }
  3243.                         food=99999;
  3244.                         done=true;
  3245.                         tempao="";
  3246.                         break;
  3247.                     case 40:
  3248.                         if (frameline.find(tags[40])!=std::string::npos)
  3249.                         {
  3250.                             h_ra=tempao;
  3251.                         }
  3252.                         else
  3253.                         {
  3254.                             h_ra="4321";
  3255.                         }
  3256.                         food=99999;
  3257.                         done=true;
  3258.                         tempao="";
  3259.                         break;
  3260.                     case 41:
  3261.                         if (frameline.find(tags[41])!=std::string::npos)
  3262.                         {
  3263.                             h_la=tempao;
  3264.                         }
  3265.                         else
  3266.                         {
  3267.                             h_la="4321";
  3268.                         }
  3269.                         food=99999;
  3270.                         done=true;
  3271.                         tempao="";
  3272.                         break;
  3273.                     case 42:
  3274.                         if (frameline.find(tags[42])!=std::string::npos)
  3275.                         {
  3276.                             trans[0]=tempao.substr(0, tempao.find(","));
  3277.                             trans[1]=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(",")-1);
  3278.                             trans[2]=tempao.substr(tempao.rfind(",")+1);
  3279.                         }
  3280.                         else
  3281.                         {
  3282.                             trans[0]="4321";
  3283.                             trans[1]="4321";
  3284.                             trans[2]="4321";
  3285.                         }
  3286.                         food=99999;
  3287.                         done=true;
  3288.                         tempao="";
  3289.                         break;
  3290.                     case 43:
  3291.                         if (frameline.find(tags[43])!=std::string::npos)
  3292.                         {
  3293.                             reggy=tempao.substr(0, tempao.find(","));
  3294.                             reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
  3295.                         }
  3296.                         else
  3297.                         {
  3298.                             reggy="4321";
  3299.                             reggyval="0";
  3300.                         }
  3301.                         food=99999;
  3302.                         done=true;
  3303.                         tempao="";
  3304.                         break;
  3305.                     case 44:
  3306.                         if (frameline.find(tags[44])!=std::string::npos)
  3307.                         {
  3308.                             adptx=tempao;
  3309.                         }
  3310.                         else
  3311.                         {
  3312.                             adptx="4321";
  3313.                         }
  3314.                         food=99999;
  3315.                         done=true;
  3316.                         tempao="";
  3317.                         break;
  3318.                     case 45:
  3319.                         if (frameline.find(tags[45])!=std::string::npos)
  3320.                         {
  3321.                             adpty=tempao;
  3322.                         }
  3323.                         else
  3324.                         {
  3325.                             adpty="4321";
  3326.                         }
  3327.                         food=99999;
  3328.                         done=true;
  3329.                         tempao="";
  3330.                         break;
  3331.                     case 46:
  3332.                         if (frameline.find(tags[46])!=std::string::npos)
  3333.                         {
  3334.                             adptz=tempao;
  3335.                         }
  3336.                         else
  3337.                         {
  3338.                             adptz="4321";
  3339.                         }
  3340.                         food=99999;
  3341.                         done=true;
  3342.                         tempao="";
  3343.                         break;
  3344.                     case 47:
  3345.                         if (frameline.find(tags[47])!=std::string::npos)
  3346.                         {
  3347.                             state=tempao;
  3348.                         }
  3349.                         else
  3350.                         {
  3351.                             state="4321";
  3352.                         }
  3353.                         food=99999;
  3354.                         done=true;
  3355.                         tempao="";
  3356.                         break;
  3357.                     case 48:
  3358.                         if (frameline.find(tags[48])!=std::string::npos)
  3359.                         {
  3360.                             arrsstnc=tempao;
  3361.                         }
  3362.                         else
  3363.                         {
  3364.                             arrsstnc="0";
  3365.                         }
  3366.                         food=99999;
  3367.                         done=true;
  3368.                         tempao="";
  3369.                         break;
  3370.                     case 49:
  3371.                         if (frameline.find(tags[49])!=std::string::npos)
  3372.                         {
  3373.                             rndrngpriority=tempao;
  3374.                         }
  3375.                         else
  3376.                         {
  3377.                             rndrngpriority="4321";
  3378.                         }
  3379.                         food=99999;
  3380.                         done=true;
  3381.                         tempao="";
  3382.                         break;
  3383.                     case 50:
  3384.                         if (frameline.find(tags[50])!=std::string::npos)
  3385.                         {
  3386.                             yacc=tempao;
  3387.                         }
  3388.                         else
  3389.                         {
  3390.                             yacc="0";
  3391.                         }
  3392.                         food=99999;
  3393.                         done=true;
  3394.                         tempao="";
  3395.                         break;
  3396.  
  3397.                     default:
  3398.                         ;
  3399.                     }
  3400.                 }
  3401.                 else
  3402.                 {
  3403.                     food++;
  3404.                 }
  3405.             }
  3406.         }
  3407.     }
  3408.  
  3409.  
  3410.  
  3411. }
  3412.  
  3413.  
  3414. void spritegrid::ini(std::string dir_, int w_, int h_, int col_, int row_, std::string colk_, int * number, int filtering)
  3415. {
  3416.     SDL_Surface *_grid, *_grid_, *_non_power_of2_grid;
  3417.     GLenum tex_format;
  3418.     colk = colk_;
  3419.     unsigned int col1, col2, col3;
  3420.     if (colk_!=",-")
  3421.     {
  3422.         col1=  strtol(("0x"+colk_.substr (3,2)).c_str(), NULL, 16);
  3423.         col2=  strtol(("0x"+ colk_.substr (5,2)).c_str(),NULL, 16);
  3424.         col3=  strtol(("0x"+ colk_.substr (7,2)).c_str(),NULL, 16);
  3425.     }
  3426.     *number+=row_*col_;
  3427.     col=col_;
  3428.     row=row_;
  3429.     frameno = row*col;
  3430.  
  3431.     clip.resize(frameno);
  3432.     clip_.resize(frameno);
  3433.  
  3434.     _non_power_of2_grid = IMG_Load((dir_).c_str());
  3435.     _grid_ = IMG_Load((dir_).c_str());
  3436.     w=w_==4321?_non_power_of2_grid->w:w_;
  3437.     h=h_==4321?_non_power_of2_grid->h:h_;
  3438.     // _grid_= SDL_LoadBMP((dir_.substr(0, dir_.rfind("\\")+1 ) +"mirror_" + dir_.substr( dir_.rfind("\\")+1 , dir_.rfind(".BMP")-dir_.rfind("\\")+1 )).c_str());
  3439.     gw=_non_power_of2_grid->w;
  3440.     gh=_non_power_of2_grid->h;
  3441.     int grid_h = (_non_power_of2_grid->h)/row;
  3442.     int grid_w = (_non_power_of2_grid->w)/col;
  3443.     _grid=_non_power_of2_grid;
  3444.     /*_grid      = SDL_CreateRGBSurface( SDL_SWSURFACE, GetPowerOf2(gw), GetPowerOf2(gh),
  3445.                                        _non_power_of2_grid->format->BitsPerPixel, _non_power_of2_grid->format->Rmask,
  3446.                                        _non_power_of2_grid->format->Gmask, _non_power_of2_grid->format->Bmask, _non_power_of2_grid->format->Amask );
  3447.     ((unsigned int*)_grid->pixels)= ((unsigned int*)_non_power_of2_grid->pixels);*/
  3448.     for (int j=0; j<row; j++)
  3449.     {
  3450.         for (int i=0; i<col; i++)
  3451.         {
  3452.             SDL_Rect recto =  {i*grid_w, j*grid_h, w, h};
  3453.             clip[(i+(col*j))] = recto;
  3454.             SDL_Rect recto2 =  {((col-i)*grid_w)-grid_w+(grid_w-w), j*grid_h, w, h};
  3455.             clip_[i+(col*j)] = recto2;
  3456.         }
  3457.     }
  3458.     SDL_Color color;
  3459.     if (colk_!=",-")
  3460.     {
  3461.         for (int x = 0; x < _grid->w; x++)
  3462.         {
  3463.             for (int y = 0; y < _grid->h; y++)
  3464.             {
  3465.                 unsigned int pix = ((unsigned int*)_grid->pixels)[y*(_grid->pitch/sizeof(unsigned int)) + x];
  3466.                 color =  translate_color(pix);
  3467.                 if (color.r == col1 && color.g == col2 && color.b == col3)
  3468.                 {
  3469.                     ((unsigned int*)_grid->pixels)[y*(_grid->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid->format, 0, 0, 0, 0);
  3470.                 }
  3471.             }
  3472.         }
  3473.     }
  3474.     for (int x = 0; x < _grid_->w; x++)
  3475.     {
  3476.         for (int y = 0; y < _grid_->h; y++)
  3477.         {
  3478.             unsigned int pix = ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x];
  3479.             color =  translate_color(pix);
  3480.             int alph=color.a;
  3481.             int newalph=alph-100>0?alph-100:0;
  3482.             if (!(color.r == col1 && color.g == col2 && color.b == col3))
  3483.             {
  3484.                 ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid_->format, 0, 0, 0, newalph);
  3485.             }
  3486.             else
  3487.             {
  3488.                 ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid_->format, 0, 0, 0, 0);
  3489.             }
  3490.         }
  3491.     }
  3492.  
  3493.     if (_grid->format->BytesPerPixel==4)
  3494.     {
  3495.         if (_grid->format->Rmask == 0x000000ff)
  3496.             tex_format=GL_RGBA;
  3497.         else
  3498.             tex_format=GL_BGRA;
  3499.     }
  3500.     else if (_grid->format->BytesPerPixel==3)
  3501.     {
  3502.         if (_grid->format->Rmask == 0x000000ff)
  3503.             tex_format=GL_RGB;
  3504.         else
  3505.             tex_format=GL_BGR;
  3506.     }
  3507.     glGenTextures(1, &grid);
  3508.     glBindTexture(GL_TEXTURE_2D, grid);
  3509.     if (filtering==0)
  3510.     {
  3511.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  3512.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  3513.     }
  3514.     else
  3515.     {
  3516.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  3517.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  3518.     }
  3519.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  3520.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  3521.     glTexImage2D(GL_TEXTURE_2D, 0, _grid->format->BytesPerPixel, _grid->w, _grid->h,
  3522.                  0, tex_format, GL_UNSIGNED_BYTE, _grid->pixels);
  3523.  
  3524.     glGenTextures(1, &shad);
  3525.     glBindTexture(GL_TEXTURE_2D, shad);
  3526.     if (filtering==0)
  3527.     {
  3528.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  3529.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  3530.     }
  3531.     else
  3532.     {
  3533.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  3534.         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  3535.     }
  3536.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  3537.     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  3538.  
  3539.     glTexImage2D(GL_TEXTURE_2D, 0, _grid_->format->BytesPerPixel, _grid_->w, _grid_->h,
  3540.                  0, tex_format, GL_UNSIGNED_BYTE, _grid_->pixels);
  3541.  
  3542.  
  3543.     //grid=SDL_CreateTextureFromSurface(MainRend, _grid);
  3544.     //grid_=SDL_CreateTextureFromSurface(MainRend, _grid_);
  3545.     SDL_FreeSurface(_grid);
  3546.     SDL_FreeSurface(_grid_);
  3547.     SDL_FreeSurface(_non_power_of2_grid);
  3548. }
  3549. /*-------------------------------------------------------------------------------------------------------------*/
  3550.  
  3551. void layer::init(std::string frameline, int no_)
  3552. {
  3553.     exists=true;
  3554.     CALLOBJECTS.resize(20);
  3555.     no=no_;
  3556.     std::string tempao;
  3557.     int positions[9];
  3558.     IMG.resize(1);
  3559.     std::string tags[] = {"img=", "x_position=", "y_position=", "repeat_x=", "repeat_y=", "x_vel=", "y_vel=", "restart=", "delay="};
  3560.     std::string flagslist[]= {"|REPEATWITHREVERSE|"};
  3561.     for (int a=0; a<1; a++)
  3562.     {
  3563.         if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
  3564.     }
  3565.     while (frameline.find("call_object[")!=std::string::npos)
  3566.     {
  3567.         CALLOBJECTS[callobjectindx].init(frameline);
  3568.         frameline.erase(CALLOBJECTS[callobjectindx].startpos, CALLOBJECTS[callobjectindx].endpos - CALLOBJECTS[callobjectindx].startpos);
  3569.         callobjectindx++;
  3570.     }
  3571.     bool done=false;
  3572.     if (frameline.find(tags[0])!=std::string::npos)
  3573.     {
  3574.         positions[0] = frameline.find(tags[0])+tags[0].length();
  3575.     }
  3576.     else
  3577.     {
  3578.         positions[0]=0;
  3579.     }
  3580.     if (frameline.find(tags[1])!=std::string::npos)
  3581.     {
  3582.         positions[1] = frameline.find(tags[1])+tags[1].length();
  3583.     }
  3584.     else
  3585.     {
  3586.         positions[1]=0;
  3587.     }
  3588.     if (frameline.find(tags[2])!=std::string::npos)
  3589.     {
  3590.         positions[2] = frameline.find(tags[2])+tags[2].length();
  3591.     }
  3592.     else
  3593.     {
  3594.         positions[2]=0;
  3595.     }
  3596.     if (frameline.find(tags[3])!=std::string::npos)
  3597.     {
  3598.         positions[3] = frameline.find(tags[3])+tags[3].length();
  3599.     }
  3600.     else
  3601.     {
  3602.         positions[3]=0;
  3603.     }
  3604.     if (frameline.find(tags[4])!=std::string::npos)
  3605.     {
  3606.         positions[4] = frameline.find(tags[4])+tags[4].length();
  3607.     }
  3608.     else
  3609.     {
  3610.         positions[4]=0;
  3611.     }
  3612.     if (frameline.find(tags[5])!=std::string::npos)
  3613.     {
  3614.         positions[5] = frameline.find(tags[5])+tags[5].length();
  3615.     }
  3616.     else
  3617.     {
  3618.         positions[5]=0;
  3619.     }
  3620.     if (frameline.find(tags[6])!=std::string::npos)
  3621.     {
  3622.         positions[6] = frameline.find(tags[6])+tags[6].length();
  3623.     }
  3624.     else
  3625.     {
  3626.         positions[6]=0;
  3627.     }
  3628.     if (frameline.find(tags[7])!=std::string::npos)
  3629.     {
  3630.         positions[7] = frameline.find(tags[7])+tags[7].length();
  3631.     }
  3632.     else
  3633.     {
  3634.         positions[7]=0;
  3635.     }
  3636.     if (frameline.find(tags[8])!=std::string::npos)
  3637.     {
  3638.         positions[8] = frameline.find(tags[8])+tags[8].length();
  3639.     }
  3640.     else
  3641.     {
  3642.         positions[8]=0;
  3643.     }
  3644.  
  3645.     img=frameline.substr(positions[0]+1, frameline.find("\"", positions[0]+1)-positions[0]-1);
  3646.     int temparirora;
  3647.     spritegrid somegrid;
  3648.     somegrid.ini(img, 4321, 4321, 1, 1, ",-", &temparirora, 0);
  3649.     IMG[0]=somegrid;
  3650.     bool isvar=false, isreg=false, isfunc=false;
  3651.     for (int ice=1; ice < 9; ice ++)  //iter on tags positions
  3652.     {
  3653.         for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  3654.         {
  3655.             done=false;
  3656.             while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
  3657.                                                   ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
  3658.                                                   ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
  3659.                                                   ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
  3660.                                                   ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
  3661.                                                   ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
  3662.                                                   ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
  3663.                                                   ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
  3664.                                                   ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
  3665.                                                   ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
  3666.                                                   ||frameline.substr(food+positions[ice], 1)=="<")))
  3667.             {
  3668.                 if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
  3669.                 if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
  3670.                 if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
  3671.                 tempao+=frameline.substr(food+positions[ice],1);
  3672.                 if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
  3673.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
  3674.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
  3675.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
  3676.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
  3677.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
  3678.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
  3679.                                               &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
  3680.                 {
  3681.                     switch (ice)
  3682.                     {
  3683.                     case 1:
  3684.                         if (frameline.find(tags[1])!=std::string::npos)
  3685.                         {
  3686.                             x=tempao;
  3687.                         }
  3688.                         else
  3689.                         {
  3690.                             x="0";
  3691.                         }
  3692.                         food=99999;
  3693.                         done=true;
  3694.                         tempao="";
  3695.                         break;
  3696.                     case 2:
  3697.                         if (frameline.find(tags[2])!=std::string::npos)
  3698.                         {
  3699.                             y=tempao;
  3700.                         }
  3701.                         else
  3702.                         {
  3703.                             y="0";
  3704.                         }
  3705.                         food=99999;
  3706.                         done=true;
  3707.                         tempao="";
  3708.                         break;
  3709.                     case 3:
  3710.                         if (frameline.find(tags[3])!=std::string::npos)
  3711.                         {
  3712.                             rptx=tempao;
  3713.                         }
  3714.                         else
  3715.                         {
  3716.                             rptx="1";
  3717.                         }
  3718.                         food=99999;
  3719.                         done=true;
  3720.                         tempao="";
  3721.                         break;
  3722.                     case 4:
  3723.                         if (frameline.find(tags[4])!=std::string::npos)
  3724.                         {
  3725.                             rpty=tempao;
  3726.                         }
  3727.                         else
  3728.                         {
  3729.                             rpty="1";
  3730.                         }
  3731.                         food=99999;
  3732.                         done=true;
  3733.                         tempao="";
  3734.                         break;
  3735.                     case 5:
  3736.                         if (frameline.find(tags[5])!=std::string::npos)
  3737.                         {
  3738.                             f_x=tempao;
  3739.                         }
  3740.                         else
  3741.                         {
  3742.                             f_x="0";
  3743.                         }
  3744.                         food=99999;
  3745.                         done=true;
  3746.                         tempao="";
  3747.                         break;
  3748.                     case 6:
  3749.                         if (frameline.find(tags[6])!=std::string::npos)
  3750.                         {
  3751.                             f_y=tempao;
  3752.                         }
  3753.                         else
  3754.                         {
  3755.                             f_y="0";
  3756.                         }
  3757.                         food=99999;
  3758.                         done=true;
  3759.                         tempao="";
  3760.                         break;
  3761.                     case 7:
  3762.                         if (frameline.find(tags[7])!=std::string::npos)
  3763.                         {
  3764.                             restart=tempao;
  3765.                         }
  3766.                         else
  3767.                         {
  3768.                             restart="0";
  3769.                         }
  3770.                         food=99999;
  3771.                         done=true;
  3772.                         tempao="";
  3773.                         break;
  3774.                     case 8:
  3775.                         if (frameline.find(tags[8])!=std::string::npos)
  3776.                         {
  3777.                             delay=tempao;
  3778.                         }
  3779.                         else
  3780.                         {
  3781.                             delay="0";
  3782.                         }
  3783.                         food=99999;
  3784.                         done=true;
  3785.                         tempao="";
  3786.                         break;
  3787.  
  3788.  
  3789.                     default:
  3790.                         ;
  3791.                     }
  3792.                 }
  3793.                 else
  3794.                 {
  3795.                     food++;
  3796.                 }
  3797.             }
  3798.         }
  3799.     }
  3800.     posx=Evaluate(x);
  3801.     posy=Evaluate(y);
  3802. }
  3803.  
  3804.  
  3805.  
  3806. void background::init(int paraid, std::string dpndncs, std::string afildir)
  3807. {
  3808.     LAYERS.resize(50);
  3809.     shadangx=0*(M_PI/180.0);
  3810.     shadangy=35*(M_PI/180.0);
  3811. //               SDL_Surface *backgroundSurf;
  3812. //                 SDL_Surface *shadow_;
  3813. //               GLenum tex_format;
  3814.  
  3815.     /*                           bitmapfiledir = e;
  3816.                                backgroundSurf =  SDL_LoadBMP(("sys\\"+bitmapfiledir).c_str());
  3817.                                //shadow_ =  SDL_LoadBMP(("sys\\"+f).c_str());
  3818.                                //shadowpos={(shadow_->w)/2, (shadow_->h)/2, shadow_->w, shadow_->h};
  3819.                                //Uint32 colorkey = SDL_MapRGB( shadow_->format, 0x0, 0x0, 0x0 );
  3820.                                //SDL_SetColorKey( shadow_, SDL_TRUE, colorkey );
  3821.                                position={0, 0, backgroundSurf->w, backgroundSurf->h};
  3822.                                //backgroundTex=SDL_CreateTextureFromSurface(MainRend, backgroundSurf);
  3823.                                //shadow=SDL_CreateTextureFromSurface(MainRend, shadow_);
  3824.                                if (backgroundSurf->format->BytesPerPixel==4){
  3825.                                 if (backgroundSurf->format->Rmask == 0x000000ff)tex_format=GL_RGBA;
  3826.                                 else tex_format=GL_BGRA;
  3827.                                }else if (backgroundSurf->format->BytesPerPixel==3){
  3828.                                 if (backgroundSurf->format->Rmask == 0x000000ff)tex_format=GL_RGB;
  3829.                                 else tex_format=GL_BGR;
  3830.                                }
  3831.                                glGenTextures(1, &backgroundTex);
  3832.                                glBindTexture(GL_TEXTURE_2D, backgroundTex);
  3833.                                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  3834.                                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  3835.  
  3836.                                glTexImage2D(GL_TEXTURE_2D, 0, backgroundSurf->format->BytesPerPixel, backgroundSurf->w, backgroundSurf->h,
  3837.                                0, tex_format, GL_UNSIGNED_BYTE, backgroundSurf->pixels);
  3838.  
  3839.  
  3840.  
  3841.     /*                         V_DATA [0].texCoord.x= 0;V_DATA [0].texCoord.y= 0;
  3842.                                V_DATA [1].texCoord.x= 1;V_DATA [1].texCoord.y= 0;
  3843.                                V_DATA [2].texCoord.x= 1;V_DATA [2].texCoord.y= 1;
  3844.                                V_DATA [3].texCoord.x= 0;V_DATA [3].texCoord.y= 1;
  3845.  
  3846.                                V_DATA [0].position.x= 0;V_DATA [0].position.y= 0;
  3847.                                V_DATA [1].position.x= position.w;V_DATA [1].position.y= 0;
  3848.                                V_DATA [2].position.x= position.w;V_DATA [2].position.y= position.h;
  3849.                                V_DATA [3].position.x= 0;V_DATA [3].position.y= position.h;
  3850.  
  3851.  
  3852.                                glGenBuffers(1, &VBO_ID);
  3853.                                glBindBuffer(GL_ARRAY_BUFFER, VBO_ID);
  3854.                                glBufferData(GL_ARRAY_BUFFER, 4*sizeof(GLuint), V_DATA, GL_DYNAMIC_DRAW );
  3855.  
  3856.                                glGenBuffers(1, &IBO_ID);
  3857.                                glBindBuffer(GL_ARRAY_BUFFER, IBO_ID);
  3858.                                glBufferData(GL_ARRAY_BUFFER, 4*sizeof(GLuint), I_DATA, GL_DYNAMIC_DRAW );
  3859.  
  3860.                                glBindBuffer( GL_ARRAY_BUFFER, NULL );
  3861.                                glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, NULL );
  3862.  
  3863.  
  3864.  
  3865.                                SDL_FreeSurface(backgroundSurf); */
  3866.  
  3867.     id=paraid;
  3868.     name="AAAA4321";
  3869.     std::string tags[] = {"NAME=","X_BOUND_START=","X_BOUND_WIDTH=" , "Z_BOUND_START=", "Z_BOUND_WIDTH=", "LIGHT_ANGLE_X=", "LIGHT_ANGLE_Y=", "BG_COLOR=", "AIR_RESISTANCE="};
  3870.     std::fstream A_FILE(afildir.c_str());
  3871.     std::string tempariro, frameline, tempariro2;
  3872.     int trigger, triggahcomma=0;
  3873.     int positions[9];
  3874.     size_t starto, endo, temp0;
  3875.  
  3876.     bool extraction = false;
  3877.  
  3878.     if (A_FILE.is_open())
  3879.     {
  3880.         while (A_FILE.good())
  3881.         {
  3882.  
  3883.             getline(A_FILE, frameline);
  3884.             extraction = false;
  3885.             temp0=frameline.find(" ");
  3886.             while(temp0!=std::string::npos)
  3887.             {
  3888.                 frameline.erase (temp0, 1);
  3889.                 temp0=frameline.find(" ", temp0);
  3890.             }
  3891.             if (frameline.find("{info}")!= std::string::npos) trigger = 1;
  3892.             while (trigger==1)
  3893.             {
  3894.                 getline(A_FILE, frameline);
  3895.                 if (frameline.rfind(tags[0])!=std::string::npos)positions[0] = frameline.rfind(tags[0])+tags[0].length();
  3896.                 if (frameline.rfind(tags[1])!=std::string::npos)positions[1] = frameline.rfind(tags[1])+tags[1].length();
  3897.                 if (frameline.rfind(tags[2])!=std::string::npos)positions[2] = frameline.rfind(tags[2])+tags[2].length();
  3898.                 if (frameline.rfind(tags[3])!=std::string::npos)positions[3] = frameline.rfind(tags[3])+tags[3].length();
  3899.                 if (frameline.rfind(tags[4])!=std::string::npos)positions[4] = frameline.rfind(tags[4])+tags[4].length();
  3900.                 if (frameline.rfind(tags[5])!=std::string::npos)positions[5] = frameline.rfind(tags[5])+tags[5].length();
  3901.                 if (frameline.rfind(tags[6])!=std::string::npos)positions[6] = frameline.rfind(tags[6])+tags[6].length();
  3902.                 if (frameline.rfind(tags[7])!=std::string::npos)positions[7] = frameline.rfind(tags[7])+tags[7].length();
  3903.                 if (frameline.rfind(tags[7])!=std::string::npos)
  3904.                 {
  3905.                     positions[8] = frameline.rfind(tags[8])+tags[8].length();
  3906.                     trigger=0;
  3907.                     A_FILE.seekp(std::ios::beg);
  3908.                     getline(A_FILE, frameline);
  3909.                     getline(A_FILE, frameline);
  3910.                 }
  3911.             }
  3912.  
  3913.  
  3914.             if (trigger != 1)
  3915.             {
  3916.  
  3917.                 for (int ice=0; ice < 8; ice ++)  //iter on tags positions
  3918.                 {
  3919.  
  3920.                     for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  3921.                     {
  3922.                         switch (ice)
  3923.                         {
  3924.                         case 8:
  3925.                             if (frameline.rfind(tags[ice])!=std::string::npos) arresstnc=frameline.substr(positions[ice]);
  3926.                             food=1000;
  3927.                             break;
  3928.                         case 7:
  3929.                             if (frameline.rfind(tags[ice])!=std::string::npos) bgcolor=frameline.substr(positions[ice]);
  3930.                             food=1000;
  3931.                             break;
  3932.                         case 6:
  3933.                             if (frameline.rfind(tags[ice])!=std::string::npos) shadangy=atoi(frameline.substr(positions[ice]).c_str())*(M_PI/180.0);
  3934.                             food=1000;
  3935.                             break;
  3936.                         case 5:
  3937.                             if (frameline.rfind(tags[ice])!=std::string::npos) shadangx=atoi(frameline.substr(positions[ice]).c_str())*(M_PI/180.0);
  3938.                             food=1000;
  3939.                             break;
  3940.                         case 4:
  3941.                             if (frameline.rfind(tags[ice])!=std::string::npos) zboundwidth=atoi(frameline.substr(positions[ice]).c_str());
  3942.                             food=1000;
  3943.                             break;
  3944.                         case 3:
  3945.                             if (frameline.rfind(tags[ice])!=std::string::npos) zbound=atoi(frameline.substr(positions[ice]).c_str());
  3946.                             food=1000;
  3947.                             break;
  3948.                         case 2:
  3949.                             if (frameline.rfind(tags[ice])!=std::string::npos) xboundwidth=atoi(frameline.substr(positions[ice]).c_str());
  3950.                             food=1000;
  3951.                             break;
  3952.                         case 1:
  3953.                             if (frameline.rfind(tags[ice])!=std::string::npos) xbound=atoi(frameline.substr(positions[ice]).c_str());
  3954.                             food=1000;
  3955.                             break;
  3956.                         case 0:
  3957.                             if (frameline.rfind(tags[ice])!=std::string::npos) name=frameline.substr(positions[ice]);
  3958.                             food=1000;
  3959.                             break;
  3960.                         default:
  3961.                             ;
  3962.                         }
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.                         //cout<< "name: " << name << endl <<"WALKSPD_X_Z: "<<maxsp<<endl;
  3970.                         if (frameline.find("{/info}")!= std::string::npos)
  3971.                         {
  3972.                             tempariro2="";
  3973.                             while(A_FILE.good())
  3974.                             {
  3975.                                 getline(A_FILE, frameline);
  3976.                                 if(frameline.find("#")!=std::string::npos)frameline.erase(frameline.find("#"), frameline.length()-frameline.find("#"));
  3977.                                 tempariro2 +=frameline;
  3978.                             }
  3979.                             A_FILE.seekp(0, A_FILE.end);
  3980.                             A_FILE.close();
  3981.                         }
  3982.                     }
  3983.                 }
  3984.             }
  3985.         }
  3986.     }
  3987.  
  3988.  
  3989.  
  3990.  
  3991.     //loadframes:
  3992.     //A_FILE.seekp(0, A_FILE.beg);
  3993.     //A_FILE.seekg(0, A_FILE.beg);
  3994.     //getline(A_FILE, tempariro2);
  3995.     temp0=tempariro2.find(" ");
  3996.     while(temp0!=std::string::npos)
  3997.     {
  3998.         tempariro2.erase (temp0, 1); //clear spaces
  3999.         temp0=tempariro2.find(" ", temp0);
  4000.     }
  4001.     temp0=tempariro2.find("\n");
  4002.     while(temp0!=std::string::npos)
  4003.     {
  4004.         tempariro2.erase (temp0, 1); //clear newline chars
  4005.         temp0=tempariro2.find("\n", temp0);
  4006.     }
  4007.  
  4008.     tempariro2=tempariro2.substr(tempariro2.find("[l="));
  4009.     int ideh;
  4010.     while(tempariro2.find("[l=") != std::string::npos && tempariro2.find("[/l]")!= std::string::npos)
  4011.     {
  4012.         layer framah;
  4013.         ideh = atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str());
  4014.         framah.init(tempariro2.substr(tempariro2.find("]")+1,tempariro2.find("[/l]")), atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str())  );
  4015.         LAYERS[framah.no]=framah;
  4016.         if (tempariro2.find("[l=", 4) != std::string::npos)
  4017.         {
  4018.  
  4019.             tempariro2=tempariro2.substr(tempariro2.find("[l=", 4));
  4020.         }
  4021.         else
  4022.         {
  4023.             break;
  4024.         }
  4025.     }
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032. }
  4033.  
  4034.  
  4035. /*-------------------------------------------------------------------------------------------------------------*/
  4036.  
  4037. void objcopy::init(object* obj, int tm, bool iscom_, float gravity, float friction, int posx_,int posz_)
  4038. {
  4039.     id=obj->id;
  4040.     facing=obj->facing;
  4041.     iscom=iscom_;
  4042.     isdead=false;
  4043.     team=tm;
  4044.     posx=posx_;
  4045.     posy=GROUNDPOS-100;
  4046.     posz=posz_;
  4047.     currhp=obj->inihp;
  4048.     currsp=obj->inisp;
  4049.     currrp=obj->inirp;
  4050.     currdp=obj->maxdp;
  4051.     currkp=obj->maxkp;
  4052.     currframe=obj->inair;
  4053.     GRAVITY=gravity;
  4054.     FRICTION=friction;
  4055.     P_UP=false;
  4056.     P_DOWN=false;
  4057.     P_LEFT=false;
  4058.     P_RIGHT=false;
  4059.     P_ATTACK=false;
  4060.     P_DEFEND=false;
  4061.     P_JUMP=false;
  4062.     P_SPECIAL=false;
  4063.     for (int a=0; a<52; a++)
  4064.     {
  4065.         regs[a]=0;
  4066.     }
  4067. }
  4068.  
  4069.  
  4070. void object::init(int id_, std::string dpndncs, std::string afildir)
  4071. {
  4072.     id=id_;
  4073.     name="AAAA4321";
  4074.     previousframe=4321;
  4075.     std::string tags[] = {"NAME=","MAXPTS_HP_SP_RP=","INITPTS_HP_SP_RP=","WALKSPD_X_Z=","RPRATEPER_HIT_SEC_DAMAGE=",
  4076.                           "ARMORPTS_MAX_RATE=","STANDING=","WALKING=", "FALLING_BACK=", "SPAWN=", "JUMPSPD_X_Z=","HIT_GROUND=","WHEN_HIT_FRONT=",
  4077.                           "WHEN_HIT_BACK=", "KNOCKPTS_MAX_RATEPERSEC=", "KNOCKED=", "DEFENDPTS_MAX_RATEPERSEC=", "FALLING_FRONT=", "LYING=",
  4078.                           "WIDTH_tEXT=", "WIDTH_NUMBERS=", "SPRATEPER_HIT_SEC_DAMAGE=", "FATIGUE=", "IN_AIR=", "HEIGHT=", "WIDTH=", "ALLOCATE_FRAMES=", "ALLOCATE_IMGS=", "[img]"
  4079.                          };
  4080.     std::fstream A_FILE(afildir.c_str());
  4081.     std::string tempariro, frameline, tempariro2;
  4082.     int trigger, triggahcomma=0;
  4083.     int positions[30];
  4084.     size_t starto, endo, temp0;
  4085.  
  4086.     bool extraction = false;
  4087.  
  4088.     if (A_FILE.is_open())
  4089.     {
  4090.         while (A_FILE.good())
  4091.         {
  4092.             getline(A_FILE, frameline);
  4093.             extraction = false;
  4094.             temp0=frameline.find(" ");
  4095.             while(temp0!=std::string::npos)
  4096.             {
  4097.                 frameline.erase (temp0, 1);
  4098.                 temp0=frameline.find(" ", temp0);
  4099.             }
  4100.             if (frameline.find("{info}")!= std::string::npos) trigger = 1;
  4101.             while (trigger==1)
  4102.             {
  4103.                 getline(A_FILE, frameline);
  4104.                 if (frameline.rfind(tags[0])!=std::string::npos)positions[0] = frameline.rfind(tags[0])+tags[0].length();
  4105.                 if (frameline.rfind(tags[1])!=std::string::npos)positions[1] = frameline.rfind(tags[1])+tags[1].length();
  4106.                 if (frameline.rfind(tags[2])!=std::string::npos)positions[2] = frameline.rfind(tags[2])+tags[2].length();
  4107.                 if (frameline.rfind(tags[3])!=std::string::npos)positions[3] = frameline.rfind(tags[3])+tags[3].length();
  4108.                 if (frameline.rfind(tags[4])!=std::string::npos)positions[4] = frameline.rfind(tags[4])+tags[4].length();
  4109.                 if (frameline.rfind(tags[5])!=std::string::npos)positions[5] = frameline.rfind(tags[5])+tags[5].length();
  4110.                 if (frameline.rfind(tags[6])!=std::string::npos)positions[6] = frameline.rfind(tags[6])+tags[6].length();
  4111.                 if (frameline.rfind(tags[7])!=std::string::npos)positions[7] = frameline.rfind(tags[7])+tags[7].length();
  4112.                 if (frameline.rfind(tags[8])!=std::string::npos)positions[8] = frameline.rfind(tags[8])+tags[8].length();
  4113.                 if (frameline.rfind(tags[9])!=std::string::npos)positions[9] = frameline.rfind(tags[9])+tags[9].length();
  4114.                 if (frameline.rfind(tags[10])!=std::string::npos)positions[10] = frameline.rfind(tags[10])+tags[10].length();
  4115.                 if (frameline.rfind(tags[11])!=std::string::npos)positions[11] = frameline.rfind(tags[11])+tags[11].length();
  4116.                 if (frameline.rfind(tags[12])!=std::string::npos)positions[12] = frameline.rfind(tags[12])+tags[12].length();
  4117.                 if (frameline.rfind(tags[13])!=std::string::npos)positions[13] = frameline.rfind(tags[13])+tags[13].length();
  4118.                 if (frameline.rfind(tags[14])!=std::string::npos)positions[14] = frameline.rfind(tags[14])+tags[14].length();
  4119.                 if (frameline.rfind(tags[15])!=std::string::npos)positions[15] = frameline.rfind(tags[15])+tags[15].length();
  4120.                 if (frameline.rfind(tags[16])!=std::string::npos)positions[16] = frameline.rfind(tags[16])+tags[16].length();
  4121.                 if (frameline.rfind(tags[17])!=std::string::npos)positions[17] = frameline.rfind(tags[17])+tags[17].length();
  4122.                 if (frameline.rfind(tags[18])!=std::string::npos)positions[18] = frameline.rfind(tags[18])+tags[18].length();
  4123.                 if (frameline.rfind(tags[19])!=std::string::npos)positions[19] = frameline.rfind(tags[19])+tags[19].length();
  4124.                 if (frameline.rfind(tags[20])!=std::string::npos)positions[20] = frameline.rfind(tags[20])+tags[20].length();
  4125.                 if (frameline.rfind(tags[21])!=std::string::npos)positions[21] = frameline.rfind(tags[21])+tags[21].length();
  4126.                 if (frameline.rfind(tags[22])!=std::string::npos)positions[22] = frameline.rfind(tags[22])+tags[22].length();
  4127.                 if (frameline.rfind(tags[23])!=std::string::npos)positions[23] = frameline.rfind(tags[23])+tags[23].length();
  4128.                 if (frameline.rfind(tags[24])!=std::string::npos)positions[24] = frameline.rfind(tags[24])+tags[24].length();
  4129.                 if (frameline.rfind(tags[25])!=std::string::npos)positions[25] = frameline.rfind(tags[25])+tags[25].length();
  4130.                 if (frameline.rfind(tags[26])!=std::string::npos)positions[26] = frameline.rfind(tags[26])+tags[26].length();
  4131.                 if (frameline.rfind(tags[27])!=std::string::npos)positions[27] = frameline.rfind(tags[27])+tags[27].length();
  4132.                 if (frameline.rfind(tags[28])!=std::string::npos)
  4133.                 {
  4134.                     positions[28] = frameline.rfind(tags[28])+tags[28].length();
  4135.                     trigger=0;
  4136.                     A_FILE.seekp(std::ios::beg);
  4137.                     getline(A_FILE, frameline);
  4138.                     getline(A_FILE, frameline);
  4139.                 }
  4140.             }
  4141.  
  4142.  
  4143.             if (trigger != 1)
  4144.             {
  4145.                 for (int ice=0; ice < 29; ice ++)  //iter on tags positions
  4146.                 {
  4147.                     for (int food = 0; food < frameline.length(); food++)  //iter on characters of the line
  4148.                     {
  4149.  
  4150.                         while (trigger==11)
  4151.                         {
  4152.                             if (frameline.rfind("[/img]")!=std::string::npos)
  4153.                             {
  4154.                                 trigger =0;
  4155.                                 break;
  4156.                             }
  4157.                             std::string spgdarg0 = std::string(frameline.substr(0, frameline.find(",")));
  4158.                             int    spgdarg1 = atoi(frameline.substr(frameline.find(",")+1,frameline.find(",", frameline.find(",")+1)).c_str());
  4159.                             int    spgdarg2 = atoi(frameline.substr(frameline.find(",", frameline.find(",")+1)+1,  frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)).c_str());
  4160.                             int    spgdarg3 = atoi(frameline.substr( frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1, frameline.find(",", frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1)).c_str());
  4161.                             int    spgdarg4 = atoi(frameline.substr(frameline.find(",", frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1)+1, frameline.find(",", (frameline.find(",", frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1)+1))).c_str());
  4162.                             std::string spgdarg5 = frameline.substr(frameline.rfind(','));
  4163.                             sprtfl =  spgdarg0;
  4164.                             spritegrid a;
  4165.                             a.ini(spgdarg0, spgdarg1, spgdarg2, spgdarg3, spgdarg4, spgdarg5, &spritecount, 0);
  4166.                             IMGS[imgindx]= a;
  4167.                             imgindx ++;
  4168.                             food = 10000;
  4169.                             ice=100000;
  4170.                             getline(A_FILE, frameline);
  4171.                         }
  4172.                         if (ice == 28 && (frameline.rfind(tags[ice])!=std::string::npos))
  4173.                         {
  4174.                             IMGS.resize(allctimgs);
  4175.                             Frames.resize(allctfrms);
  4176.                             trigger =11;
  4177.                             food=10000;
  4178.                             ice=1000;
  4179.                         }
  4180.  
  4181.  
  4182.                         if (ice<=28)
  4183.                         {
  4184.                             while (ice==21 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4185.                             {
  4186.  
  4187.                                 if (triggahcomma==0)   //RPRATEPEhjR_HIT
  4188.                                 {
  4189.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4190.                                     {
  4191.                                         triggahcomma =1;
  4192.                                     }
  4193.                                     else if (isdigit(frameline[food+positions[ice]]))
  4194.                                     {
  4195.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4196.                                     }
  4197.                                     if (triggahcomma==1)
  4198.                                     {
  4199.                                         sphit=atoi(tempariro.c_str());
  4200.                                         tempariro = "";
  4201.                                         food++;
  4202.                                     }
  4203.                                 }
  4204.  
  4205.                                 if (triggahcomma==1)   //RPRATEPER_SEC_DAMAGE
  4206.                                 {
  4207.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4208.                                     {
  4209.                                         triggahcomma =2;
  4210.                                     }
  4211.                                     else
  4212.                                     {
  4213.                                         tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
  4214.                                         food++;
  4215.                                     }
  4216.                                     if (triggahcomma==2)
  4217.                                     {
  4218.                                         spsec=atoi(tempariro.c_str());
  4219.                                         tempariro = "";
  4220.                                         spdam=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
  4221.                                         triggahcomma=0;
  4222.                                         extraction = true;
  4223.                                         food=1000;
  4224.                                     }
  4225.                                 }
  4226.                                 else
  4227.                                 {
  4228.                                     food++;
  4229.                                 }
  4230.                             }
  4231.                             while (ice==16 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4232.                             {
  4233.                                 if (triggahcomma==0)   //defendpts
  4234.                                 {
  4235.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4236.                                     {
  4237.                                         triggahcomma =1;
  4238.                                     }
  4239.                                     else if (isdigit(frameline[food+positions[ice]]))
  4240.                                     {
  4241.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4242.                                     }
  4243.                                     if (triggahcomma==1)
  4244.                                     {
  4245.                                         maxdp=atoi(tempariro.c_str());
  4246.                                         tempariro = "";
  4247.                                         food++;
  4248.                                     }
  4249.                                 }
  4250.  
  4251.                                 if (triggahcomma==1)  //defendrate
  4252.                                 {
  4253.                                     dpsec=atoi(frameline.substr(positions[ice]+food).c_str());
  4254.                                     tempariro = "";
  4255.                                     triggahcomma=0;
  4256.                                     extraction=true;
  4257.                                     food=1000;
  4258.                                 }
  4259.                                 else
  4260.                                 {
  4261.                                     food++;
  4262.                                 }
  4263.                             }
  4264.                             while (ice==14 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4265.                             {
  4266.  
  4267.                                 if (triggahcomma==0)   //fallpts
  4268.                                 {
  4269.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4270.                                     {
  4271.                                         triggahcomma =1;
  4272.                                     }
  4273.                                     else if (isdigit(frameline[food+positions[ice]]))
  4274.                                     {
  4275.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4276.                                     }
  4277.                                     if (triggahcomma==1)
  4278.                                     {
  4279.                                         maxkp=atoi(tempariro.c_str());
  4280.                                         tempariro = "";
  4281.                                         food++;
  4282.                                     }
  4283.                                 }
  4284.  
  4285.                                 if (triggahcomma==1)  //fallrate
  4286.                                 {
  4287.                                     knockrate=atoi(frameline.substr(positions[ice]+food).c_str());
  4288.                                     tempariro = "";
  4289.                                     triggahcomma=0;
  4290.                                     extraction=true;
  4291.                                     food=1000;
  4292.                                 }
  4293.                                 else
  4294.                                 {
  4295.                                     food++;
  4296.                                 }
  4297.                             }
  4298.                             while (ice==10 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4299.                             {
  4300.                                 if (triggahcomma==0)   //JUMPSPDX
  4301.                                 {
  4302.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4303.                                     {
  4304.                                         triggahcomma =1;
  4305.                                     }
  4306.                                     else if (isdigit(frameline[food+positions[ice]]))
  4307.                                     {
  4308.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4309.                                     }
  4310.                                     if (triggahcomma==1)
  4311.                                     {
  4312.                                         jmpspdx=atoi(tempariro.c_str());
  4313.                                         tempariro = "";
  4314.                                         food++;
  4315.                                     }
  4316.                                 }
  4317.  
  4318.                                 if (triggahcomma==1)  //JUMPSPDZ
  4319.                                 {
  4320.                                     jmpspdz=atoi(frameline.substr(positions[ice]+food).c_str());
  4321.                                     tempariro = "";
  4322.                                     triggahcomma=0;
  4323.                                     extraction=true;
  4324.                                     food=1000;
  4325.                                 }
  4326.                                 else
  4327.                                 {
  4328.                                     food++;
  4329.                                 }
  4330.                             }
  4331.                             while (ice==5 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4332.                             {
  4333.                                 if (triggahcomma==0)   //JUMPSPDX
  4334.                                 {
  4335.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4336.                                     {
  4337.                                         triggahcomma =1;
  4338.                                     }
  4339.                                     else if (isdigit(frameline[food+positions[ice]]))
  4340.                                     {
  4341.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4342.                                     }
  4343.                                     if (triggahcomma==1)
  4344.                                     {
  4345.                                         armor=atoi(tempariro.c_str());
  4346.                                         tempariro = "";
  4347.                                         food++;
  4348.                                     }
  4349.                                 }
  4350.  
  4351.                                 if (triggahcomma==1)  //JUMPSPDZ
  4352.                                 {
  4353.                                     armorrate=atoi(frameline.substr(positions[ice]+food).c_str());
  4354.                                     tempariro = "";
  4355.                                     triggahcomma=0;
  4356.                                     extraction=true;
  4357.                                     food=1000;
  4358.                                 }
  4359.                                 else
  4360.                                 {
  4361.                                     food++;
  4362.                                 }
  4363.                             }
  4364.                             while (ice==4 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4365.                             {
  4366.                                 if (triggahcomma==0)   //RPRATEPEhjR_HIT
  4367.                                 {
  4368.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4369.                                     {
  4370.                                         triggahcomma =1;
  4371.                                     }
  4372.                                     else if (isdigit(frameline[food+positions[ice]]))
  4373.                                     {
  4374.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4375.                                     }
  4376.                                     if (triggahcomma==1)
  4377.                                     {
  4378.                                         rphit=atoi(tempariro.c_str());
  4379.                                         tempariro = "";
  4380.                                         food++;
  4381.                                     }
  4382.                                 }
  4383.  
  4384.                                 if (triggahcomma==1)   //RPRATEPER_SEC_DAMAGE
  4385.                                 {
  4386.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4387.                                     {
  4388.                                         triggahcomma =2;
  4389.                                     }
  4390.                                     else
  4391.                                     {
  4392.                                         tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
  4393.                                         food++;
  4394.                                     }
  4395.                                     if (triggahcomma==2)
  4396.                                     {
  4397.                                         rpsec=atoi(tempariro.c_str());
  4398.                                         tempariro = "";
  4399.                                         rpdam=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
  4400.                                         triggahcomma=0;
  4401.                                         extraction = true;
  4402.                                         food=1000;
  4403.                                     }
  4404.                                 }
  4405.                                 else
  4406.                                 {
  4407.                                     food++;
  4408.                                 }
  4409.                             }
  4410.                             while (ice==3 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4411.                             {
  4412.                                 if (triggahcomma==0)   //WALKSPDX
  4413.                                 {
  4414.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4415.                                     {
  4416.                                         triggahcomma =1;
  4417.                                     }
  4418.                                     else if (isdigit(frameline[food+positions[ice]]))
  4419.                                     {
  4420.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4421.                                     }
  4422.                                     if (triggahcomma==1)
  4423.                                     {
  4424.                                         wkspdx=atoi(tempariro.c_str());
  4425.                                         tempariro = "";
  4426.                                         food++;
  4427.                                     }
  4428.                                 }
  4429.  
  4430.                                 if (triggahcomma==1)  //WALKSPDZ
  4431.                                 {
  4432.                                     wkspdz=atoi(frameline.substr(positions[ice]+food).c_str());
  4433.                                     tempariro = "";
  4434.                                     triggahcomma=0;
  4435.                                     extraction=true;
  4436.                                     food=1000;
  4437.                                 }
  4438.                                 else
  4439.                                 {
  4440.                                     food++;
  4441.                                 }
  4442.                             }
  4443.                             while (ice==2 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4444.                             {
  4445.                                 if (triggahcomma==0)   //INIT_HP
  4446.                                 {
  4447.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4448.                                     {
  4449.                                         triggahcomma =1;
  4450.                                     }
  4451.                                     else if (isdigit(frameline[food+positions[ice]]))
  4452.                                     {
  4453.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4454.                                     }
  4455.                                     if (triggahcomma==1)
  4456.                                     {
  4457.                                         inihp=atoi(tempariro.c_str());
  4458.                                         tempariro = "";
  4459.                                         food++;
  4460.                                     }
  4461.                                 }
  4462.  
  4463.                                 if (triggahcomma==1)   //INIT_MP &INIT_RP
  4464.                                 {
  4465.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4466.                                     {
  4467.                                         triggahcomma =2;
  4468.                                     }
  4469.                                     else
  4470.                                     {
  4471.                                         tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
  4472.                                         food++;
  4473.                                     }
  4474.                                     if (triggahcomma==2)
  4475.                                     {
  4476.                                         inisp=atoi(tempariro.c_str());
  4477.                                         tempariro = "";
  4478.                                         inirp=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
  4479.                                         triggahcomma=0;
  4480.                                         extraction=true;
  4481.                                         food=1000;
  4482.                                     }
  4483.                                 }
  4484.                                 else
  4485.                                 {
  4486.                                     food++;
  4487.                                 }
  4488.                             }
  4489.  
  4490.                             while (ice == 1 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
  4491.                             {
  4492.                                 if (triggahcomma==0)   //MAX_HP
  4493.                                 {
  4494.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4495.                                     {
  4496.                                         triggahcomma =1;
  4497.                                     }
  4498.                                     else if (isdigit(frameline[food+positions[ice]]))
  4499.                                     {
  4500.                                         tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
  4501.                                     }
  4502.                                     if (triggahcomma==1)
  4503.                                     {
  4504.                                         maxhp=atoi(tempariro.c_str());
  4505.                                         tempariro = "";
  4506.                                         food++;
  4507.                                     }
  4508.                                 }
  4509.  
  4510.                                 if (triggahcomma==1)   //MAX_MP &MAX_RP
  4511.                                 {
  4512.                                     if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
  4513.                                     {
  4514.                                         triggahcomma =2;
  4515.                                     }
  4516.                                     else
  4517.                                     {
  4518.                                         tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
  4519.                                         food++;
  4520.                                     }
  4521.                                     if (triggahcomma==2)
  4522.                                     {
  4523.                                         maxsp=atoi(tempariro.c_str());
  4524.                                         tempariro = "";
  4525.                                         maxrp=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
  4526.                                         triggahcomma=0;
  4527.                                         extraction =true;
  4528.                                         food=1000;
  4529.                                     }
  4530.                                 }
  4531.                                 else
  4532.                                 {
  4533.                                     food++;
  4534.                                 }
  4535.                             }
  4536.  
  4537.                             switch (ice)
  4538.                             {
  4539.                             case 27:
  4540.                                 if (frameline.rfind(tags[ice])!=std::string::npos)allctimgs=atoi(frameline.substr(positions[ice]).c_str());
  4541.                                 food=1000;
  4542.                                 break;
  4543.                             case 26:
  4544.                                 if (frameline.rfind(tags[ice])!=std::string::npos)allctfrms=atoi(frameline.substr(positions[ice]).c_str());
  4545.                                 food=1000;
  4546.                                 break;
  4547.                             case 25:
  4548.                                 if (frameline.rfind(tags[ice])!=std::string::npos)width=atoi(frameline.substr(positions[ice]).c_str());
  4549.                                 food=1000;
  4550.                                 break;
  4551.                             case 24:
  4552.                                 if (frameline.rfind(tags[ice])!=std::string::npos)height=atoi(frameline.substr(positions[ice]).c_str());
  4553.                                 food=1000;
  4554.                                 break;
  4555.                             case 23:
  4556.                                 if (frameline.rfind(tags[ice])!=std::string::npos)inair=atoi(frameline.substr(positions[ice]).c_str());
  4557.                                 food=1000;
  4558.                                 break;
  4559.                             case 22:
  4560.                                 if (frameline.rfind(tags[ice])!=std::string::npos)fatigue=atoi(frameline.substr(positions[ice]).c_str());
  4561.                                 food=1000;
  4562.                                 break;
  4563.                             case 20:
  4564.                                 if (frameline.rfind(tags[ice])!=std::string::npos)hitnowidth=atoi(frameline.substr(positions[ice]).c_str());
  4565.                                 food=1000;
  4566.                                 break;
  4567.                             case 19:
  4568.                                 if (frameline.rfind(tags[ice])!=std::string::npos)hittxtwidth=atoi(frameline.substr(positions[ice]).c_str());
  4569.                                 food=1000;
  4570.                                 break;
  4571.                             case 18:
  4572.                                 if (frameline.rfind(tags[ice])!=std::string::npos)lying=atoi(frameline.substr(positions[ice]).c_str());
  4573.                                 food=1000;
  4574.                                 break;
  4575.                             case 17:
  4576.                                 if (frameline.rfind(tags[ice])!=std::string::npos)falling=atoi(frameline.substr(positions[ice]).c_str());
  4577.                                 food=1000;
  4578.                                 break;
  4579.                             case 15:
  4580.                                 if (frameline.rfind(tags[ice])!=std::string::npos)knocked=atoi(frameline.substr(positions[ice]).c_str());
  4581.                                 food=1000;
  4582.                                 break;
  4583.                             case 13:
  4584.                                 if (frameline.rfind(tags[ice])!=std::string::npos)whenhitb=atoi(frameline.substr(positions[ice]).c_str());
  4585.                                 food=1000;
  4586.                                 break;
  4587.                             case 12:
  4588.                                 if (frameline.rfind(tags[ice])!=std::string::npos)whenhit=atoi(frameline.substr(positions[ice]).c_str());
  4589.                                 food=1000;
  4590.                                 break;
  4591.                             case 11:
  4592.                                 if (frameline.rfind(tags[ice])!=std::string::npos)hitground=atoi(frameline.substr(positions[ice]).c_str());
  4593.                                 food=1000;
  4594.                                 break;
  4595.                             case 9:
  4596.                                 if (frameline.rfind(tags[ice])!=std::string::npos) spawn=atoi(frameline.substr(positions[ice]).c_str());
  4597.                                 food=1000;
  4598.                                 break;
  4599.                             case 8:
  4600.                                 if (frameline.rfind(tags[ice])!=std::string::npos) fallingb=atoi(frameline.substr(positions[ice]).c_str());
  4601.                                 food=1000;
  4602.                                 break;
  4603.                             case 7:
  4604.                                 if (frameline.rfind(tags[ice])!=std::string::npos) walking=atoi(frameline.substr(positions[ice]).c_str());
  4605.                                 food=1000;
  4606.                                 break;
  4607.                             case 6:
  4608.                                 if (frameline.rfind(tags[ice])!=std::string::npos) standing=atoi(frameline.substr(positions[ice]).c_str());
  4609.                                 food=1000;
  4610.                                 break;
  4611.                             case 0:
  4612.                                 if (frameline.rfind(tags[ice])!=std::string::npos) name=frameline.substr(positions[ice]);
  4613.                                 food=1000;
  4614.                                 break;
  4615.                             default:
  4616.                                 ;
  4617.                             }
  4618.  
  4619.  
  4620.                         }
  4621.                         if (frameline.find("{/info}")!= std::string::npos)
  4622.                         {
  4623.                             tempariro2="";
  4624.                             while(A_FILE.good())
  4625.                             {
  4626.                                 getline(A_FILE, frameline);
  4627.                                 if(frameline.find("#")!=std::string::npos)frameline.erase(frameline.find("#"), frameline.length()-frameline.find("#"));
  4628.                                 tempariro2 +=frameline;
  4629.                             }
  4630.                             A_FILE.seekp(0, A_FILE.end);
  4631.                             A_FILE.close();
  4632.                         }
  4633.                     }
  4634.                 }
  4635.             }
  4636.         }
  4637.     }
  4638.     wkspdxz_x=(float)wkspdx*cos(atan((float)wkspdz/(float)wkspdx));
  4639.     wkspdxz_z=(float)wkspdz*sin(atan((float)wkspdz/(float)wkspdx));
  4640.  
  4641.     if (name == "AAAA4321")
  4642.     {
  4643.         type =1;
  4644.     }
  4645.     else
  4646.     {
  4647.         type =0;
  4648.     }
  4649.  
  4650.  
  4651.     //loadframes:
  4652.     temp0=tempariro2.find(" ");
  4653.     while(temp0!=std::string::npos)
  4654.     {
  4655.         tempariro2.erase (temp0, 1); //clear spaces
  4656.         temp0=tempariro2.find(" ", temp0);
  4657.     }
  4658.     temp0=tempariro2.find("\n");
  4659.     while(temp0!=std::string::npos)
  4660.     {
  4661.         tempariro2.erase (temp0, 1); //clear newline chars
  4662.         temp0=tempariro2.find("\n", temp0);
  4663.     }
  4664.  
  4665.     std::string tempariro3=tempariro2;
  4666.     int ideh;
  4667.     int idehe;
  4668.     if (tempariro3.find("[s=")!=std::string::npos)
  4669.     {
  4670.         tempariro3=tempariro3.substr(tempariro3.find("[s="));
  4671.     }
  4672.     while (tempariro3.find("[s=")!=std::string::npos && tempariro3.find("[/s]")!=std::string::npos)
  4673.     {
  4674.  
  4675.  
  4676.         ideh=Evaluate(tempariro3.substr(3, tempariro3.find("->")-3));
  4677.         idehe=Evaluate(tempariro3.substr(tempariro3.find("->")+2, tempariro3.find("]")-2));
  4678.         for (int stfrm=ideh; stfrm<=idehe; stfrm++)
  4679.         {
  4680.             frame framah;
  4681.             framah.init(tempariro3.substr(tempariro3.find("]")+1,tempariro3.find("[/s]")), stfrm);
  4682.             if (stfrm!=idehe)
  4683.             {
  4684.                 framah.nxt=stringify(stfrm+1);
  4685.             }
  4686.             framah.img=framah.img=="999"?"999":stringify(Evaluate(framah.img)+(stfrm-ideh));
  4687.             framah.BDYS[20].init("set_bdy[x="+stringify(-width/2)+"y="+ stringify(-height)+"w="+stringify(width)+"h="+stringify(height)+"]");
  4688.             Frames[framah.no]=framah;
  4689.         }
  4690.  
  4691.         if (tempariro3.find("[s=", 4) != std::string::npos)
  4692.         {
  4693.             tempariro3=tempariro3.substr(tempariro3.find("[s=", 4));
  4694.         }
  4695.         else
  4696.         {
  4697.             break;
  4698.         }
  4699.  
  4700.     }
  4701.  
  4702.     tempariro2=tempariro2.substr(tempariro2.find("[f="));
  4703.  
  4704.     while(tempariro2.find("[f=") != std::string::npos && tempariro2.find("[/f]")!= std::string::npos)
  4705.     {
  4706.         frame framah;
  4707.  
  4708.         ideh = atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str());
  4709.         framah.init(tempariro2.substr(tempariro2.find("]")+1,tempariro2.find("[/f]")), ideh);
  4710.         framah.BDYS[20].init("set_bdy[x="+stringify(-width/2)+"y="+ stringify(-height+1)+"w="+stringify(width)+"h="+stringify(height)+"]");
  4711.         Frames[framah.no]=framah;
  4712.  
  4713.         if (tempariro2.find("[f=", 4) != std::string::npos)
  4714.         {
  4715.             tempariro2=tempariro2.substr(tempariro2.find("[f=", 4));
  4716.         }
  4717.         else
  4718.         {
  4719.             break;
  4720.         }
  4721.     }
  4722.     accU=0;
  4723. }
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729. LoadTxt::LoadTxt(std::string loadtxtdir)
  4730. {
  4731.     DATA_LINES.resize(1000);
  4732.     std::string line;
  4733.     std::ifstream LOAD_TXT;
  4734.     LOAD_TXT.open (loadtxtdir.c_str ());
  4735.     int temp0,type=0;
  4736.     while (LOAD_TXT.good()&&LOAD_TXT.is_open())
  4737.     {
  4738.         getline(LOAD_TXT, line);
  4739.         temp0=line.find("\n");
  4740.         while(temp0!=std::string::npos)
  4741.         {
  4742.             line.erase (temp0, 1);
  4743.             temp0=line.find("\n");
  4744.         }
  4745.         temp0=line.find(" ");
  4746.         while(temp0!=std::string::npos)
  4747.         {
  4748.             line.erase (temp0, 1);
  4749.             temp0=line.find(" ", temp0);
  4750.         }
  4751.  
  4752.         if (line.find("{object}")!=std::string::npos)
  4753.         {
  4754.             type=0;
  4755.             continue;
  4756.         }
  4757.         else if (line.find("{background}")!=std::string::npos)
  4758.         {
  4759.             type=1;
  4760.             continue;
  4761.         }
  4762.         else if (line.find("{/object}")!=std::string::npos || line.find("{/background}")!=std::string::npos || line=="")
  4763.         {
  4764.             continue;
  4765.         }
  4766.         else
  4767.         {
  4768.             DATA_LINES[DATA_LINES_INDEX].id=Evaluate(line.substr(0,line.find("::")));
  4769.             DATA_LINES[DATA_LINES_INDEX].dependencies=line.substr(line.find("::")+2, line.rfind("::")-(line.find("::")+2));
  4770.             DATA_LINES[DATA_LINES_INDEX].directory=line.substr(line.rfind("::")+2,line.find(";")-(line.rfind("::")+2));
  4771.             DATA_LINES[DATA_LINES_INDEX].type=type;
  4772.             DATA_LINES_INDEX++;
  4773.         }
  4774.  
  4775.     }
  4776.  
  4777. }
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783. /*-------------------------------------------------------------------------------------------------------------*/
  4784.  
  4785.  
  4786.  
  4787. void LOAD::LoadObjsForGame(LoadTxt Txt, std::string objlines, int bgid, LOAD * LOADADDRESS)
  4788. {
  4789.     std::string loaded_ids=":";
  4790.     for (int index=0; index < Txt.DATA_LINES_INDEX; index++)
  4791.     {
  4792.         std::cout << stringify(Txt.DATA_LINES[index].id) << std::endl;
  4793.         std::cout << Txt.DATA_LINES[index].directory << std::endl;
  4794.     }
  4795.  
  4796.     while (objlines.length()>2)
  4797.         for (int index=0; index < Txt.DATA_LINES_INDEX; index++)
  4798.         {
  4799.             std::cout <<"meh" <<std::endl;
  4800.             if (objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")!=std::string::npos && Txt.DATA_LINES[index].type==0)
  4801.             {
  4802.                 int pos1=objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")+(":"+stringify(Txt.DATA_LINES[index].id)+"~").length();
  4803.                 int len1=objlines.find(":", pos1)-pos1+1;
  4804.                 controllers[OBJID_INDEX]=Evaluate(objlines.substr(pos1, len1));
  4805.                 IDS[OBJID_INDEX++]=Txt.DATA_LINES[index].id;
  4806.                 objlines.erase(objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~"), objlines.find(":",objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")+1));
  4807.                 if (loaded_ids.find(":"+stringify(Txt.DATA_LINES[index].id)+":")==std::string::npos)
  4808.                 {
  4809.                     object Stickman;
  4810.                     Stickman.init(Txt.DATA_LINES[index].id, Txt.DATA_LINES[index].dependencies, Txt.DATA_LINES[index].directory);
  4811.                     Stickman.LOADED=LOADADDRESS;
  4812.                     OBJECTS[Stickman.id]= Stickman;
  4813.                     loaded_ids+=stringify(Stickman.id)+":";
  4814.                     if (Txt.DATA_LINES[index].dependencies!="-")
  4815.                     {
  4816.                         std::string tempdep=Txt.DATA_LINES[index].dependencies;
  4817.                         int tempid;
  4818.                         while (tempdep.find("&")!=std::string::npos)
  4819.                         {
  4820.                             tempid=Evaluate(tempdep.substr(0,tempdep.find("&")));
  4821.                             for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
  4822.                             {
  4823.                                 if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
  4824.                                 {
  4825.                                     object Stickman;
  4826.                                     Stickman.init(Txt.DATA_LINES[indexi].id,Txt. DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
  4827.                                     Stickman.LOADED=LOADADDRESS;
  4828.                                     OBJECTS[Stickman.id]= Stickman;
  4829.                                     loaded_ids+=stringify(Stickman.id)+":";
  4830.                                     break;
  4831.                                 }
  4832.                             }
  4833.                             tempdep.erase(0,tempdep.find("&")+1);
  4834.                         }
  4835.                         tempid=Evaluate(tempdep);
  4836.                         for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
  4837.                         {
  4838.                             if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
  4839.                             {
  4840.                                 object Stickman;
  4841.                                 Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
  4842.                                 Stickman.LOADED=LOADADDRESS;
  4843.                                 OBJECTS[Stickman.id]= Stickman;
  4844.                                 loaded_ids+=stringify(Stickman.id)+":";
  4845.                                 break;
  4846.                             }
  4847.                         }
  4848.  
  4849.                     }
  4850.                 }
  4851.             }
  4852.             if (bgid==Txt.DATA_LINES[index].id && Txt.DATA_LINES[index].type==1)
  4853.             {
  4854.                 background StickBG;
  4855.                 StickBG.init(Txt.DATA_LINES[index].id, Txt.DATA_LINES[index].dependencies, Txt.DATA_LINES[index].directory);
  4856.                 BACKGROUNDS[StickBG.id]=StickBG;
  4857.                 BGIDS[BGID_INDEX++]=StickBG.id;
  4858.                 if (Txt.DATA_LINES[index].dependencies!="-")
  4859.                 {
  4860.                     std::string tempdep=Txt.DATA_LINES[index].dependencies;
  4861.                     int tempid;
  4862.                     while (tempdep.find("&")!=std::string::npos)
  4863.                     {
  4864.                         tempid=Evaluate(tempdep.substr(0,tempdep.find("&")));
  4865.                         for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
  4866.                         {
  4867.                             if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
  4868.                             {
  4869.                                 object Stickman;
  4870.                                 Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
  4871.                                 Stickman.LOADED=LOADADDRESS;
  4872.                                 OBJECTS[Stickman.id]= Stickman;
  4873.                                 loaded_ids+=stringify(Stickman.id)+":";
  4874.                                 break;
  4875.                             }
  4876.                         }
  4877.                         tempdep.erase(0,tempdep.find("&")+1);
  4878.                     }
  4879.                     tempid=Evaluate(tempdep);
  4880.                     for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
  4881.                     {
  4882.                         if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
  4883.                         {
  4884.                             object Stickman;
  4885.                             Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
  4886.                             Stickman.LOADED=LOADADDRESS;
  4887.                             OBJECTS[Stickman.id]= Stickman;
  4888.                             loaded_ids+=stringify(Stickman.id)+":";
  4889.                             break;
  4890.                         }
  4891.                     }
  4892.  
  4893.                 }
  4894.                 bgid=4321;
  4895.             }
  4896.         }
  4897. }
  4898.  
  4899. void LOAD::LoadBG(std::string dir, int id)
  4900. {
  4901.     background StickBG;
  4902.     StickBG.init(id , "", dir);
  4903.     BACKGROUNDS[StickBG.id]=StickBG;
  4904.     BGIDS[BGID_INDEX++]=StickBG.id;
  4905. }
  4906.  
  4907. void LOAD::LoadOBJ(std::string dir, int id)
  4908. {
  4909.     object Stickman;
  4910.     Stickman.init(id, "", dir);
  4911.     OBJECTS[Stickman.id]= Stickman;
  4912. }
  4913. void LOAD::CreateOBJECTCOPY(int id, int posx, int posy, int frame)
  4914. {
  4915.     objcopy z;
  4916.     z.init(&OBJECTS[id],0, true, GRAVITY, FRICTION, posx, posy);
  4917.     z.posy=0;
  4918.     z.onscreen_id=ON_SCREEN_OBJCOUNT;
  4919.     z.currframe=frame;
  4920.     OBJS_STRUCTS[id]=z;
  4921.     ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT]=z;
  4922.     ON_SCREEN_OBJS[ON_SCREEN_OBJCOUNT]=&ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT];
  4923.     ON_SCREEN_OBJCOUNT++;
  4924. }
  4925.  
  4926.  
  4927. void LOAD::LoadLOADTXTLite()
  4928. {
  4929.     BARSG.resize(8);
  4930.     for (int reg=0; reg<100; reg++)
  4931.     {
  4932.         GLOBALREGS[reg]=0;
  4933.     }
  4934.     //regarding effects...etc
  4935.     std::fstream SYS_FILE("obj\\system.a");
  4936.     std::string tempasdf;
  4937.     std::string systemd;
  4938.     int tempadodi;
  4939.     while (SYS_FILE.good())
  4940.     {
  4941.         getline(SYS_FILE, tempasdf);
  4942.         systemd += tempasdf;
  4943.     }
  4944.     if (systemd.find("{main}")!=std::string::npos)
  4945.     {
  4946.         tempasdf=systemd.substr(systemd.find("{main}")+6, systemd.find("{/main}")-6-systemd.find("{main}"));
  4947.     }
  4948.     if (tempasdf.find("FPS=")!=std::string::npos)
  4949.     {
  4950.         tempadodi=tempasdf.find("FPS=");
  4951.         std::string asdsdf=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("FPS="))-tempadodi-4);
  4952.         FPS=Evaluate(asdsdf);
  4953.     }
  4954.  
  4955.  
  4956.     if (systemd.find("{bar_frame}"))
  4957.     {
  4958.         tempasdf=systemd.substr(systemd.find("{bar_frame}")+11, systemd.find("{/bar_frame}")-11-systemd.find("{bar_frame}"));
  4959.         tempadodi=tempasdf.find("img=");
  4960.         BARS[12]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  4961.         tempadodi=tempasdf.find("trans_x=");
  4962.         BARS[13]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  4963.         tempadodi=tempasdf.find("trans_y=");
  4964.         BARS[14]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  4965.     }
  4966.  
  4967.     if (systemd.find("{hp_bar}"))
  4968.     {
  4969.         tempasdf=systemd.substr(systemd.find("{hp_bar}")+8, systemd.find("{/hp_bar}")-8-systemd.find("{hp_bar}"));
  4970.         tempadodi=tempasdf.find("img1=");
  4971.         BARS[0]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img1="))-tempadodi-5);
  4972.         tempadodi=tempasdf.find("img2=");
  4973.         BARS[15]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img2="))-tempadodi-5);
  4974.         tempadodi=tempasdf.find("img3=");
  4975.         BARS[16]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img3="))-tempadodi-5);
  4976.         tempadodi=tempasdf.find("img4=");
  4977.         BARS[17]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img4="))-tempadodi-5);
  4978.         tempadodi=tempasdf.find("img5=");
  4979.         BARS[18]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img5="))-tempadodi-5);
  4980.         tempadodi=tempasdf.find("deplete_direction=");
  4981.         BARS[3]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  4982.         tempadodi=tempasdf.find("trans_x=");
  4983.         BARS[6]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  4984.         tempadodi=tempasdf.find("trans_y=");
  4985.         BARS[7]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  4986.     }
  4987.     if (systemd.find("{sp_bar}"))
  4988.     {
  4989.         tempasdf=systemd.substr(systemd.find("{sp_bar}")+8, systemd.find("{/sp_bar}")-8-systemd.find("{sp_bar}"));
  4990.         tempadodi=tempasdf.find("img=");
  4991.         BARS[1]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  4992.         tempadodi=tempasdf.find("deplete_direction=");
  4993.         BARS[4]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  4994.         tempadodi=tempasdf.find("trans_x=");
  4995.         BARS[8]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  4996.         tempadodi=tempasdf.find("trans_y=");
  4997.         BARS[9]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  4998.     }
  4999.     if (systemd.find("{rp_bar}"))
  5000.     {
  5001.         tempasdf=systemd.substr(systemd.find("{rp_bar}")+8, systemd.find("{/rp_bar}")-8-systemd.find("{rp_bar}"));
  5002.         tempadodi=tempasdf.find("img=");
  5003.         BARS[2]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  5004.         tempadodi=tempasdf.find("deplete_direction=");
  5005.         BARS[5]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  5006.         tempadodi=tempasdf.find("trans_x=");
  5007.         BARS[10]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  5008.         tempadodi=tempasdf.find("trans_y=");
  5009.         BARS[11]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  5010.     }
  5011.  
  5012.     for (int abcd=0; abcd<3; abcd++)
  5013.     {
  5014.         spritegrid a;
  5015.         int watever;
  5016.         a.ini(BARS[abcd], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
  5017.         BARSG[abcd]=a;
  5018.     }
  5019.     for (int aa=15; aa<19; aa++)
  5020.     {
  5021.         spritegrid a;
  5022.         int watever;
  5023.         a.ini(BARS[aa], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
  5024.         BARSG[aa-11]=a;
  5025.     }
  5026.     for (int asdfasdfasdf=0; asdfasdfasdf==0; asdfasdfasdf++)
  5027.     {
  5028.  
  5029.         int momo;
  5030.         spritegrid a;
  5031.         a.ini(BARS[12], 4321, 4321, 1, 1, ",0xFFFFFF", &momo, 1);
  5032.         BARSG[3]=a;
  5033.     }
  5034.     if (systemd.find("{defaults}")!=std::string::npos)
  5035.     {
  5036.         tempasdf=systemd.substr(systemd.find("{defaults}")+10, systemd.find("{/defaults}")-10-systemd.find("{defaults}"));
  5037.         if (tempasdf.find("gravity=")!=std::string::npos)
  5038.         {
  5039.             settings[10]=tempasdf.substr(tempasdf.find("gravity=")+8, tempasdf.find(";")-tempasdf.find("gravity=")-8);
  5040.         }
  5041.         else
  5042.         {
  5043.             settings[10]="0.7";
  5044.         }
  5045.         if (tempasdf.find("friction=")!=std::string::npos)
  5046.         {
  5047.             settings[11]=tempasdf.substr(tempasdf.find("friction=")+9, tempasdf.find(";")-tempasdf.find("friction=")-9);
  5048.         }
  5049.         else
  5050.         {
  5051.             settings[11]="2";
  5052.         }
  5053.     }
  5054.  
  5055.     FRICTION= ::atof(settings[11].c_str());
  5056.     GRAVITY =::atof(settings[10].c_str());
  5057.  
  5058.     std::string paraid, paraind, paradir;
  5059.     size_t L_POS, temp0;
  5060.     int typy=0;
  5061.  
  5062. //ON_SCREEN_OBJCOUNT=OBJID_INDEX;
  5063.     ON_SCREEN_OBJCOUNT=0;
  5064. }
  5065.  
  5066. void LOAD::LoadSettigns_OnScreenObjs()
  5067. {
  5068.     BARSG.resize(8);
  5069.     CATCHINGIDS.resize(100);
  5070.     for (int abcd=0; abcd<100; abcd++)
  5071.     {
  5072.         CATCHINGIDS[abcd].resize(7);
  5073.     }
  5074.     for (int ID=0; ID<100; ID++)
  5075.     {
  5076.         for (int data=0; data<7; data++)
  5077.         {
  5078.             CATCHINGIDS[ID][data]=4321;
  5079.         }
  5080.     }
  5081.     for (int reg=0; reg<100; reg++)
  5082.     {
  5083.         GLOBALREGS[reg]=0;
  5084.     }
  5085.     //regarding effects...etc
  5086.     std::fstream SYS_FILE("obj\\system.a");
  5087.     std::string tempasdf;
  5088.     std::string systemd;
  5089.     int tempadodi;
  5090.     while (SYS_FILE.good())
  5091.     {
  5092.         getline(SYS_FILE, tempasdf);
  5093.         systemd += tempasdf;
  5094.     }
  5095.     if (systemd.find("{main}")!=std::string::npos)
  5096.     {
  5097.         tempasdf=systemd.substr(systemd.find("{main}")+6, systemd.find("{/main}")-6-systemd.find("{main}"));
  5098.         for (int x=0; x<10; x++)
  5099.         {
  5100.             if (tempasdf.find("effect["+stringify(x)+"]=")!=std::string::npos)
  5101.             {
  5102.                 settings[x]=tempasdf.substr(tempasdf.find("effect["+stringify(x)+"]=")+10, tempasdf.find(";", tempasdf.find("effect["+stringify(x)+"]="))-tempasdf.find("effect["+stringify(x)+"]=")-10);
  5103.                 object effect;
  5104.                 effect.init(1000+x, "None", settings[x]);
  5105.                 OBJECTS[effect.id]= effect;
  5106.  
  5107.                 objcopy z;
  5108.                 z.init(&effect,5, true, GRAVITY, FRICTION, 0, 0);
  5109.                 OBJS_STRUCTS[1000+x]=z;
  5110.             }
  5111.             else
  5112.             {
  5113.                 settings[x]="None";
  5114.             }
  5115.         }
  5116.     }
  5117.     if (tempasdf.find("FPS=")!=std::string::npos)
  5118.     {
  5119.         tempadodi=tempasdf.find("FPS=");
  5120.         std::string asdsdf=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("FPS="))-tempadodi-4);
  5121.         FPS=Evaluate(asdsdf);
  5122.     }
  5123.     if (tempasdf.find("showHitNo_Dir_Interval=")!=std::string::npos)
  5124.     {
  5125.         HITSYS=true;
  5126.         object nums;
  5127.         tempadodi=tempasdf.find("showHitNo_Dir_Interval=");
  5128.         std::string asdsdf=tempasdf.substr(tempadodi+23, tempasdf.find(";", tempasdf.find("showHitNo_Dir_Interval="))-tempadodi-23);
  5129.         nums.init(1010, "None", tempasdf.substr(tempadodi+23, tempasdf.find(";", tempasdf.find("showHitNo_Dir_Interval="))-tempadodi-23));
  5130.         OBJECTS[nums.id]=nums;
  5131.         objcopy z;
  5132.         z.init(&nums,999, true, GRAVITY, FRICTION, 0, 0);
  5133.         OBJS_STRUCTS[1010]=z;
  5134.     }
  5135.     objcopy z;
  5136.  
  5137.     if (systemd.find("{bar_frame}"))
  5138.     {
  5139.         tempasdf=systemd.substr(systemd.find("{bar_frame}")+11, systemd.find("{/bar_frame}")-11-systemd.find("{bar_frame}"));
  5140.         tempadodi=tempasdf.find("img=");
  5141.         BARS[12]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  5142.         tempadodi=tempasdf.find("trans_x=");
  5143.         BARS[13]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  5144.         tempadodi=tempasdf.find("trans_y=");
  5145.         BARS[14]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  5146.     }
  5147.  
  5148.     if (systemd.find("{hp_bar}"))
  5149.     {
  5150.         tempasdf=systemd.substr(systemd.find("{hp_bar}")+8, systemd.find("{/hp_bar}")-8-systemd.find("{hp_bar}"));
  5151.         tempadodi=tempasdf.find("img1=");
  5152.         BARS[0]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img1="))-tempadodi-5);
  5153.         tempadodi=tempasdf.find("img2=");
  5154.         BARS[15]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img2="))-tempadodi-5);
  5155.         tempadodi=tempasdf.find("img3=");
  5156.         BARS[16]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img3="))-tempadodi-5);
  5157.         tempadodi=tempasdf.find("img4=");
  5158.         BARS[17]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img4="))-tempadodi-5);
  5159.         tempadodi=tempasdf.find("img5=");
  5160.         BARS[18]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img5="))-tempadodi-5);
  5161.         tempadodi=tempasdf.find("deplete_direction=");
  5162.         BARS[3]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  5163.         tempadodi=tempasdf.find("trans_x=");
  5164.         BARS[6]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  5165.         tempadodi=tempasdf.find("trans_y=");
  5166.         BARS[7]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  5167.     }
  5168.     if (systemd.find("{sp_bar}"))
  5169.     {
  5170.         tempasdf=systemd.substr(systemd.find("{sp_bar}")+8, systemd.find("{/sp_bar}")-8-systemd.find("{sp_bar}"));
  5171.         tempadodi=tempasdf.find("img=");
  5172.         BARS[1]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  5173.         tempadodi=tempasdf.find("deplete_direction=");
  5174.         BARS[4]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  5175.         tempadodi=tempasdf.find("trans_x=");
  5176.         BARS[8]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  5177.         tempadodi=tempasdf.find("trans_y=");
  5178.         BARS[9]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  5179.     }
  5180.     if (systemd.find("{rp_bar}"))
  5181.     {
  5182.         tempasdf=systemd.substr(systemd.find("{rp_bar}")+8, systemd.find("{/rp_bar}")-8-systemd.find("{rp_bar}"));
  5183.         tempadodi=tempasdf.find("img=");
  5184.         BARS[2]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
  5185.         tempadodi=tempasdf.find("deplete_direction=");
  5186.         BARS[5]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
  5187.         tempadodi=tempasdf.find("trans_x=");
  5188.         BARS[10]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
  5189.         tempadodi=tempasdf.find("trans_y=");
  5190.         BARS[11]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
  5191.     }
  5192.  
  5193.     for (int abcd=0; abcd<3; abcd++)
  5194.     {
  5195.         spritegrid a;
  5196.         int watever;
  5197.         a.ini(BARS[abcd], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
  5198.         BARSG[abcd]=a;
  5199.     }
  5200.     for (int aa=15; aa<19; aa++)
  5201.     {
  5202.         spritegrid a;
  5203.         int watever;
  5204.         a.ini(BARS[aa], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
  5205.         BARSG[aa-11]=a;
  5206.     }
  5207.     for (int asdfasdfasdf=0; asdfasdfasdf==0; asdfasdfasdf++)
  5208.     {
  5209.  
  5210.         int momo;
  5211.         spritegrid a;
  5212.         a.ini(BARS[12], 4321, 4321, 1, 1, ",0xFFFFFF", &momo, 1);
  5213.         BARSG[3]=a;
  5214.     }
  5215.     if (systemd.find("{defaults}")!=std::string::npos)
  5216.     {
  5217.         tempasdf=systemd.substr(systemd.find("{defaults}")+10, systemd.find("{/defaults}")-10-systemd.find("{defaults}"));
  5218.         if (tempasdf.find("gravity=")!=std::string::npos)
  5219.         {
  5220.             settings[10]=tempasdf.substr(tempasdf.find("gravity=")+8, tempasdf.find(";")-tempasdf.find("gravity=")-8);
  5221.         }
  5222.         else
  5223.         {
  5224.             settings[10]="0.7";
  5225.         }
  5226.         if (tempasdf.find("friction=")!=std::string::npos)
  5227.         {
  5228.             settings[11]=tempasdf.substr(tempasdf.find("friction=")+9, tempasdf.find(";")-tempasdf.find("friction=")-9);
  5229.         }
  5230.         else
  5231.         {
  5232.             settings[11]="2";
  5233.         }
  5234.     }
  5235.  
  5236.     FRICTION= ::atof(settings[11].c_str());
  5237.     GRAVITY =::atof(settings[10].c_str());
  5238.  
  5239. //ON_SCREEN_OBJCOUNT=OBJID_INDEX;
  5240.     ON_SCREEN_OBJCOUNT=0;
  5241.     srand (time(NULL));
  5242.     for (int x=0; x<OBJID_INDEX; x++)
  5243.     {
  5244.         for (int y=0; y<OBJECTS[IDS[x]].spawn; y++)
  5245.         {
  5246.             objcopy z;
  5247.             int randxpos=rand() % 800 + 50;
  5248.             int randzpos=rand() % 180 + 570;
  5249.             if (x==3) z.init(&OBJECTS[IDS[x]],x+1, true, GRAVITY, FRICTION, randxpos, randzpos);
  5250.             else
  5251.                 z.init(&OBJECTS[IDS[x]],x+1, false, GRAVITY, FRICTION, randxpos, randzpos);
  5252.             z.playerno=controllers[x]+1;
  5253.  
  5254.             z.onscreen_id=ON_SCREEN_OBJCOUNT;
  5255.             OBJS_STRUCTS[IDS[x]]=z;
  5256.             ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT]=z;
  5257.             ON_SCREEN_OBJCOUNT++;
  5258.         }
  5259.     }
  5260.     for (int aa=0; aa<ON_SCREEN_OBJCOUNT; aa++)
  5261.     {
  5262.         if (ON_SCREEN_REAL_OBJS[aa].id <200)
  5263.             ON_SCREEN_OBJS[aa]=&ON_SCREEN_REAL_OBJS[aa];
  5264.     }
  5265.  
  5266. }
  5267. void LOAD::initHeavy (std::string dir)
  5268. {
  5269.     OBJECTS.resize(1011);
  5270.     OBJID_INDEX = 0;
  5271.     BGID_INDEX = 0;
  5272.     BACKGROUNDS.resize(100);
  5273.     ON_SCREEN_OBJS.resize(1011);
  5274.     ON_SCREEN_REAL_OBJS.resize(1011);
  5275.     OBJS_STRUCTS.resize(1011);
  5276.     CURRBG=0;
  5277.     PKEYS.resize(4);
  5278.     PKEYS[0].resize(8);
  5279.     PKEYS[1].resize(8);
  5280.     PKEYS[2].resize(8);
  5281.     PKEYS[3].resize(8);
  5282. }
  5283. void LOAD::initLite ()
  5284. {
  5285.     OBJECTS.resize(100);
  5286.     OBJID_INDEX = 0;
  5287.     BGID_INDEX = 0;
  5288.     BACKGROUNDS.resize(5);
  5289.     ON_SCREEN_OBJS.resize(100);
  5290.     ON_SCREEN_REAL_OBJS.resize(100);
  5291.     OBJS_STRUCTS.resize(100);
  5292.     CURRBG=0;
  5293. }
  5294.  
  5295. void object::Walk (objcopy *objcop)
  5296. {
  5297.     if ((objcop->movedirx < 2 && objcop->movedirz < 2))
  5298.     {
  5299.         if (objcop->facing == 0)
  5300.         {
  5301.             if (objcop->movedirx == 0) Move(wkspdxz_x, 'x', objcop);
  5302.             if (objcop->movedirx == 1) objcop->facing = 1;
  5303.         }
  5304.         if (objcop->facing == 1)
  5305.         {
  5306.             if (objcop->movedirx == 1) Move(-wkspdxz_x, 'x', objcop);
  5307.             if (objcop->movedirx == 0) objcop->facing = 0;
  5308.         }
  5309.         if (objcop->movedirz == 0) Move(-wkspdxz_z, 'z', objcop);
  5310.         if (objcop->movedirz == 1) Move(wkspdxz_z, 'z', objcop);
  5311.     }
  5312.     if (!(objcop->movedirx < 2 && objcop->movedirz < 2))
  5313.     {
  5314.         if (objcop->facing == 0)
  5315.         {
  5316.             if (objcop->movedirx == 0) Move(wkspdx, 'x', objcop);
  5317.             if (objcop->movedirx == 1) objcop->facing = 1;
  5318.         }
  5319.         if (objcop->facing == 1)
  5320.         {
  5321.             if (objcop->movedirx == 1) Move(-wkspdx, 'x', objcop);
  5322.             if (objcop->movedirx == 0) objcop->facing = 0;
  5323.         }
  5324.         if (objcop->movedirz == 0) Move(-wkspdz, 'z', objcop);
  5325.         if (objcop->movedirz == 1) Move(wkspdz, 'z', objcop);
  5326.     }
  5327. }
  5328.  
  5329. void object::Move (float value, char axis, objcopy * objcop)
  5330. {
  5331.     if (axis=='x'&&value > 0)
  5332.     {
  5333.         if (objcop->total_fx!=0 && objcop->posy < objcop->GROUNDPOS)
  5334.         {
  5335.             objcop->total_fx-=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fx/10., 2))/2.);
  5336.             objcop->total_fx=objcop->total_fx<0?0:objcop->total_fx;
  5337.         }
  5338.         if (objcop->posx+value > (LOADED->BACKGROUNDS[LOADED->CURRBG].xbound+LOADED->BACKGROUNDS[LOADED->CURRBG].xboundwidth))
  5339.         {
  5340.             objcop->posx=LOADED->BACKGROUNDS[LOADED->CURRBG].xbound+LOADED->BACKGROUNDS[LOADED->CURRBG].xboundwidth;
  5341.         }
  5342.         else
  5343.         {
  5344.             objcop->posx+=value;
  5345.         }
  5346.     }
  5347.     else if (axis=='x'&&value < 0)
  5348.     {
  5349.         if (objcop->total_fx!=0 && objcop->posy < objcop->GROUNDPOS)
  5350.         {
  5351.             objcop->total_fx+=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fx/10., 2))/2.);
  5352.             objcop->total_fx=objcop->total_fx>0?0:objcop->total_fx;
  5353.         }
  5354.         if (objcop->posx+value < LOADED->BACKGROUNDS[LOADED->CURRBG].xbound)
  5355.         {
  5356.             objcop->posx=LOADED->BACKGROUNDS[LOADED->CURRBG].xbound;
  5357.         }
  5358.         else
  5359.         {
  5360.             objcop->posx+=value;
  5361.         }
  5362.     }
  5363.  
  5364.     if (axis=='z'&&value >= 0)
  5365.     {
  5366.         if (objcop->posz+value > (LOADED->BACKGROUNDS[LOADED->CURRBG].zbound+LOADED->BACKGROUNDS[LOADED->CURRBG].zboundwidth))
  5367.         {
  5368.             objcop->posz=LOADED->BACKGROUNDS[LOADED->CURRBG].zbound+LOADED->BACKGROUNDS[LOADED->CURRBG].zboundwidth-1;
  5369.         }
  5370.         else
  5371.         {
  5372.             objcop->posz+=value;
  5373.         }
  5374.     }
  5375.     else if (axis=='z'&&value < 0)
  5376.     {
  5377.         if (objcop->posz+value < LOADED->BACKGROUNDS[LOADED->CURRBG].zbound)
  5378.         {
  5379.             objcop->posz=LOADED->BACKGROUNDS[LOADED->CURRBG].zbound;
  5380.         }
  5381.         else
  5382.         {
  5383.             objcop->posz+=(float)value;
  5384.         }
  5385.     }
  5386.  
  5387.     if (axis=='y')
  5388.     {
  5389.         /*if (objcop->total_fy!=0 && objcop->posy < objcop->GROUNDPOS){
  5390.             if (objcop->total_fy<0){
  5391.                 objcop->total_fy+=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fy/10., 2))/2.);
  5392.                 objcop->total_fy=objcop->total_fy>0?0:objcop->total_fy;
  5393.             }else{
  5394.                 objcop->total_fy-=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fy/10., 2))/2.);
  5395.                 objcop->total_fy=objcop->total_fy<0?0:objcop->total_fy;
  5396.             }
  5397.         }*/
  5398.         if (objcop->posy+value > objcop->GROUNDPOS)
  5399.         {
  5400.             objcop->posy=objcop->GROUNDPOS;
  5401.         }
  5402.         else
  5403.         {
  5404.             objcop->posy+=value;
  5405.         }
  5406.     }
  5407.  
  5408. }
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415. void object::Apply_loop(objcopy * objcop)
  5416. {
  5417.  
  5418.     if (objcop->previousframe!=4321 && Eval(objcop, Frames[objcop->currframe].loop_condition)==objcop->previousframe && !bool(objcop->doloop[0]) && Eval(objcop, Frames[objcop->currframe].loop_length)!=0&&objcop->newframe)  //loop tag
  5419.     {
  5420.         objcop->U_loop_length= Eval(objcop, Frames[objcop->currframe].loop_length);
  5421.         objcop->doloop[0]=1;
  5422.         objcop->doloop[1]=objcop->currframe;
  5423.     }
  5424.     if (Eval(objcop, Frames[objcop->currframe].loop_condition)==objcop->previousframe && (bool)objcop->doloop[0]&&objcop->newframe)
  5425.     {
  5426.         if (objcop->U_loop_length == 0)
  5427.         {
  5428.             objcop->previousframe=objcop->currframe;
  5429.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].loop_goto);
  5430.             objcop->doloop[0]=0;
  5431.             objcop->newframe=true;
  5432.         }
  5433.         else
  5434.         {
  5435.             objcop->U_loop_length--;
  5436.         }
  5437.     }
  5438. }
  5439.  
  5440. void object::Apply_f_x(objcopy * objcop)
  5441. {
  5442.     if (Frames[objcop->currframe].f_x!="0")            //f_x tag
  5443.     {
  5444.         if (Frames[objcop->currframe].f_x!="4321")
  5445.         {
  5446.             if (objcop->facing==0)
  5447.             {
  5448.                 objcop->total_fx=Eval(objcop, Frames[objcop->currframe].f_x);
  5449.             }
  5450.             else
  5451.             {
  5452.                 objcop->total_fx=(Eval(objcop, Frames[objcop->currframe].f_x)*-1);
  5453.             }
  5454.         }
  5455.         else
  5456.         {
  5457.             objcop->total_fx=0;
  5458.         }
  5459.     }
  5460.  
  5461.  
  5462.  
  5463. }
  5464.  
  5465. void object::Apply_f_y(objcopy * objcop)
  5466. {
  5467.     if (Frames[objcop->currframe].f_y!="0")            //f_y tag
  5468.     {
  5469.         if (Frames[objcop->currframe].f_y!="4321")
  5470.         {
  5471.             objcop->total_fy=Eval(objcop, Frames[objcop->currframe].f_y);
  5472.         }
  5473.         else
  5474.         {
  5475.             objcop->total_fy=0;
  5476.         }
  5477.     }
  5478.  
  5479. }
  5480.  
  5481. void object::Apply_f_z(objcopy * objcop)
  5482. {
  5483.     if (Frames[objcop->currframe].f_z!="0")            //f_z tag
  5484.     {
  5485.         if (Frames[objcop->currframe].f_z!="4321")
  5486.         {
  5487.             objcop->total_fz=Eval(objcop, Frames[objcop->currframe].f_z);
  5488.         }
  5489.         else
  5490.         {
  5491.             objcop->total_fz=0;
  5492.         }
  5493.     }
  5494.  
  5495.  
  5496.  
  5497. }
  5498.  
  5499. void object::Apply_FRICTION(objcopy * objcop)
  5500. {
  5501.     if (type==0 && !objcop->caught)
  5502.     {
  5503.         if(objcop->total_fx!=0&&objcop->posy==objcop->GROUNDPOS)  //apply friction
  5504.         {
  5505.             if (objcop->total_fx>0)
  5506.             {
  5507.                 objcop->total_fx-=objcop->FRICTION;
  5508.                 if (objcop->total_fx<0) objcop->total_fx=0;
  5509.             }
  5510.             else if (objcop->total_fx<0)
  5511.             {
  5512.                 objcop->total_fx+=objcop->FRICTION;
  5513.                 if (objcop->total_fx>0) objcop->total_fx=0;
  5514.             }
  5515.         }
  5516.  
  5517.         if(objcop->total_fz!=0&&objcop->posy==objcop->GROUNDPOS)  //apply friction
  5518.         {
  5519.             if (objcop->total_fz>0)
  5520.             {
  5521.                 objcop->total_fz-=objcop->FRICTION;
  5522.                 if (objcop->total_fz<0) objcop->total_fz=0;
  5523.             }
  5524.             else if (objcop->total_fz<0)
  5525.             {
  5526.                 objcop->total_fz+=objcop->FRICTION;
  5527.                 if (objcop->total_fz>0) objcop->total_fz=0;
  5528.             }
  5529.         }
  5530.     }
  5531. }
  5532.  
  5533. void object::Apply_GRAVITY(objcopy * objcop)
  5534. {
  5535.     if (!Frames[objcop->currframe].flags[21]&&!objcop->caught)
  5536.     {
  5537.         if((objcop->posy<objcop->GROUNDPOS||objcop->total_fy!=0)&&Frames[objcop->currframe].f_y!="4321")  //apply graviry
  5538.         {
  5539.             if (objcop->total_fy==0 && objcop->ltstpltfrmvl!=objcop->GROUNDPOS)
  5540.             {
  5541.                 objcop->previousframe=objcop->currframe;
  5542.                 objcop->currframe=inair;
  5543.                 objcop->newframe=true;
  5544.             }
  5545.             objcop->total_fy+=objcop->GRAVITY;
  5546.  
  5547.             if (objcop->posy+objcop->total_fy>=objcop->GROUNDPOS)
  5548.             {
  5549.                 objcop->total_fy=0.0;
  5550.                 objcop->posy=objcop->GROUNDPOS;
  5551.                 objcop->previousframe=objcop->currframe;
  5552.                 objcop->newframe=true;
  5553.                 if(Frames[objcop->currframe].hitground!="4321")
  5554.                 {
  5555.                     objcop->currframe=Eval(objcop, Frames[objcop->currframe].hitground);
  5556.                 }
  5557.                 else
  5558.                 {
  5559.                     objcop->currframe=hitground;
  5560.                 }
  5561.             }
  5562.         }
  5563.         objcop->ltstpltfrmvl=objcop->GROUNDPOS;
  5564.     }
  5565.     objcop->GROUNDPOS=0;
  5566. }
  5567.  
  5568.  
  5569.  
  5570. void object::Apply_acc(objcopy * objcop)
  5571. {
  5572.     if (objcop->facing ==0) objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].acc);   //acc tag
  5573.     if (objcop->facing ==1)  objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].acc);
  5574.     objcop->total_fy+=Eval(objcop, Frames[objcop->currframe].yacc);
  5575. }
  5576.  
  5577. void object::Apply_x_z_hold_distance(objcopy * objcop)
  5578. {
  5579.     if (type==0)
  5580.     {
  5581.         if (objcop->P_UP==true)
  5582.         {
  5583.             Move(-(float)Eval(objcop, Frames[objcop->currframe].zhlddstnc), 'z', objcop);   //z_hold_distance tag
  5584.         }
  5585.         if (objcop->P_DOWN==true)
  5586.         {
  5587.             Move((float)Eval(objcop, Frames[objcop->currframe].zhlddstnc), 'z', objcop);
  5588.         }
  5589.  
  5590.         if (objcop->P_RIGHT==true)
  5591.         {
  5592.             objcop->total_fx+= Eval(objcop, Frames[objcop->currframe].xhlddstnc);   //x_hold_distance tag
  5593.         }
  5594.         if (objcop->P_LEFT==true)
  5595.         {
  5596.             objcop->total_fx-= Eval(objcop, Frames[objcop->currframe].xhlddstnc);
  5597.         }
  5598.     }
  5599. }
  5600.  
  5601. void object::Apply_x_hold_distance(objcopy * objcop)
  5602. {
  5603.     if (objcop->P_RIGHT==true && objcop->facing == 0)
  5604.     {
  5605.         objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
  5606.     }
  5607.     if (objcop->P_LEFT==true && objcop->facing == 1)
  5608.     {
  5609.         objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
  5610.     }
  5611. }
  5612.  
  5613. void object::Basic_Stand_Walk_Dash(objcopy * objcop)
  5614. {
  5615.     if (type==0)
  5616.     {
  5617.  
  5618.         if ((objcop->P_UP==true||objcop->P_DOWN==true||objcop->P_LEFT==true||objcop->P_RIGHT==true)&&Frames[objcop->currframe].flags[0])
  5619.         {
  5620.             //if (objcop->DASHR==1&&objcop->P_RIGHT==true&&objcop->facing==0){
  5621.             //  objcop->previousframe=objcop->currframe;objcop->currframe=dashing;objcop->newframe=true;objcop->DASHR=0;objcop->DASHL=0;objcop->DshClksIntrvlL,objcop->DshClksIntrvlR=0;
  5622.             //}else if(objcop->DASHL==1&&objcop->P_LEFT==true&&objcop->facing==1){
  5623.             //  objcop->previousframe=objcop->currframe;objcop->currframe=dashing;objcop->newframe=true;objcop->DASHL=0;objcop->DASHR=0;objcop->DshClksIntrvlL,objcop->DshClksIntrvlR=0;
  5624.             //}else{
  5625.             objcop->previousframe=objcop->currframe;
  5626.             objcop->currframe=walking;
  5627.             objcop->newframe=true;
  5628.         }//}
  5629.         if(Frames[objcop->currframe].flags[1] && !(objcop->P_UP==true||objcop->P_DOWN==true||objcop->P_LEFT==true||objcop->P_RIGHT==true))
  5630.         {
  5631.             objcop->currframe=standing;
  5632.             objcop->newframe=true;
  5633.             objcop->previousframe=objcop->currframe;
  5634.         }
  5635.         if (Frames[objcop->currframe].flags[1]&&objcop->posy==objcop->GROUNDPOS)
  5636.         {
  5637.             if (objcop->P_UP==true)
  5638.             {
  5639.                 objcop->movedirz = 0;
  5640.             }
  5641.             else if (objcop->P_DOWN==true)
  5642.             {
  5643.                 objcop->movedirz =1;
  5644.             }
  5645.             else objcop->movedirz = 2;
  5646.             if (objcop->P_LEFT==true)
  5647.             {
  5648.                 objcop->movedirx = 1;
  5649.             }
  5650.             else if (objcop->P_RIGHT==true)
  5651.             {
  5652.                 objcop->movedirx= 0;
  5653.             }
  5654.             else objcop->movedirx = 2;
  5655.             Walk(objcop);
  5656.         }
  5657.     }
  5658. }
  5659.  
  5660. void object::Apply_max_limit_vx(objcopy * objcop)
  5661. {
  5662.     if (Frames[objcop->currframe].mxlmtvx != "4321")
  5663.     {
  5664.         if (objcop->facing ==0)
  5665.         {
  5666.             if (objcop->total_fx > Eval(objcop, Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx);
  5667.             if (objcop->total_fx < Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1;
  5668.         }
  5669.         else
  5670.         {
  5671.             if (objcop->total_fx < Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1;
  5672.             if (objcop->total_fx > Eval(objcop, Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx);
  5673.         }
  5674.     }
  5675. }
  5676. void object::Apply_max_limit_vy(objcopy * objcop)
  5677. {
  5678.     if (Frames[objcop->currframe].mxlmtvy != "4321")
  5679.     {
  5680.         if (objcop->total_fy>0)
  5681.         {
  5682.             if (objcop->total_fy > Eval(objcop, Frames[objcop->currframe].mxlmtvy)) objcop->total_fy = Eval(objcop, Frames[objcop->currframe].mxlmtvy);
  5683.         }
  5684.         else
  5685.         {
  5686.             if (objcop->total_fy < Eval(objcop, Frames[objcop->currframe].mxlmtvy)*-1) objcop->total_fy = Eval(objcop, Frames[objcop->currframe].mxlmtvy)*-1;
  5687.         }
  5688.     }
  5689. }
  5690.  
  5691. void object::Basic_Jump(objcopy * objcop)
  5692. {
  5693.     if (objcop->P_JUMP==true && objcop->posy==objcop->GROUNDPOS && (Frames[objcop->currframe].flags[0]||Frames[objcop->currframe].flags[1]))
  5694.     {
  5695.         objcop->previousframe=objcop->currframe;
  5696.         objcop->currframe=jumping;
  5697.         objcop->newframe=true;
  5698.     }
  5699. }
  5700. void object::BlitShadow(objcopy * objcop)
  5701. {
  5702.  
  5703.     if (!(Frames[objcop->currframe].flags[8]) && objcop->picn!=999)
  5704.     {
  5705.  
  5706.         float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
  5707.         float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
  5708.         float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
  5709.         float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
  5710.         if (objcop->facing==0 && objcop->picn!=999)
  5711.         {
  5712.             int pos[] = {(objcop->posx)-Eval(objcop,Frames[objcop->currframe].center_X)  ,
  5713.                          (objcop->posz)-Eval(objcop,Frames[objcop->currframe].center_Y)+(objcop->posy),
  5714.                          IMGS[objcop->gridn].clip[objcop->picn].w, IMGS[objcop->gridn].clip[objcop->picn].h
  5715.                         };
  5716.  
  5717.             glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].shad );
  5718.             glBegin(GL_QUADS);
  5719.             glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  5720.             glVertex2f(pos[0]+pos[2]*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)+CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5721.             glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  5722.             glVertex2f(pos[0]+pos[2]+pos[2]*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5723.             glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  5724.             glVertex2f(pos[0]+pos[2]-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1]+pos[3])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5725.             glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  5726.             glVertex2f(pos[0]-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1]+pos[3])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5727.             glEnd();
  5728.         }
  5729.         if (objcop->facing==1 && objcop->picn!=999)
  5730.         {
  5731.             int tempaval=(objcop->posx+Eval(objcop, Frames[objcop->currframe].center_X)+objcop->posx);
  5732.             int pos[] = {objcop->posx-((IMGS[objcop->gridn].clip_[objcop->picn].w)-Eval(objcop,Frames[objcop->currframe].center_X)) , (objcop->posz)-Eval(objcop,Frames[objcop->currframe].center_Y)+(objcop->posy), IMGS[objcop->gridn].clip[objcop->picn].w, IMGS[objcop->gridn].clip[objcop->picn].h};
  5733.             glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].shad );
  5734.  
  5735.             glBegin(GL_QUADS);
  5736.  
  5737.             glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  5738.             glVertex2f(pos[0]+pos[2]+pos[2]*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5739.             //glColor3f(0.0f, 0.0/f, 0.2f);
  5740.             glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  5741.             glVertex2f(pos[0]+pos[2]*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx)+CAM[0], 0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5742.             glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  5743.             glVertex2f(pos[0]-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0],  0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1]+pos[3])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5744.             glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  5745.             glVertex2f(pos[0]+pos[2]-objcop->posy*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangx) +CAM[0],  0+objcop->posz+(0+objcop->posz)*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)-(pos[1]+pos[3])*tan(LOADED->BACKGROUNDS[LOADED->CURRBG].shadangy)+CAM[1]);
  5746.             glEnd();
  5747.         }
  5748.     }
  5749. }
  5750.  
  5751. void object::Respond_ToInput(objcopy * objcop)
  5752. {
  5753.     if (Frames[objcop->currframe].flags[3]&&(objcop->P_LEFT==true || objcop->P_RIGHT==true))
  5754.     {
  5755.         if (objcop->P_LEFT==true) objcop->facing=1;
  5756.         if (objcop->P_RIGHT==true) objcop->facing=0;
  5757.  
  5758.     }
  5759.     if (objcop->currsp >= 0)
  5760.     {
  5761.         bool smthisclicked=false;
  5762.         if (objcop->P_ATTACK_C)
  5763.         {
  5764.             for (int abc=5; abc>=0; abc--)
  5765.             {
  5766.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5767.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5768.             }
  5769.             objcop->inputarray[0]=0;
  5770.             objcop->inputarray[0+6]=SDL_GetTicks();
  5771.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5772.         }
  5773.  
  5774.         if (objcop->P_DEFEND_C)
  5775.         {
  5776.             for (int abc=5; abc>=0; abc--)
  5777.             {
  5778.                 objcop->inputarray[abc]=abc==0?4321:int(objcop->inputarray[abc-1]);
  5779.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5780.             }
  5781.             objcop->inputarray[0]=1;
  5782.             objcop->inputarray[6]=SDL_GetTicks();
  5783.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5784.         }
  5785.         if (objcop->P_JUMP_C)
  5786.         {
  5787.             for (int abc=5; abc>=0; abc--)
  5788.             {
  5789.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5790.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5791.             }
  5792.             objcop->inputarray[0]=2;
  5793.             objcop->inputarray[6]=SDL_GetTicks();
  5794.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5795.         }
  5796.         if (objcop->P_SPECIAL_C )
  5797.         {
  5798.             for (int abc=5; abc>=0; abc--)
  5799.             {
  5800.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5801.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5802.             }
  5803.             objcop->inputarray[0]=3;
  5804.             objcop->inputarray[6]=SDL_GetTicks();
  5805.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5806.         }
  5807.         if (objcop->P_UP_C)
  5808.         {
  5809.             for (int abc=5; abc>=0; abc--)
  5810.             {
  5811.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5812.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5813.             }
  5814.             objcop->inputarray[0]=6;
  5815.             objcop->inputarray[6]=SDL_GetTicks();
  5816.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5817.         }
  5818.         if (objcop->P_DOWN_C)
  5819.         {
  5820.             for (int abc=5; abc>=0; abc--)
  5821.             {
  5822.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5823.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5824.             }
  5825.             objcop->inputarray[0]=7;
  5826.             objcop->inputarray[6]=SDL_GetTicks();
  5827.             for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf];
  5828.             std::cout<<"\n";
  5829.         }
  5830.         //if (objcop->P_LEFT_C && Eval(objcop, Frames[objcop->currframe].c_la)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_la);objcop->newframe=true; }
  5831.         //if (objcop->P_RIGHT_C && Eval(objcop, Frames[objcop->currframe].c_ra)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_ra);objcop->newframe=true; }
  5832.         if ((objcop->P_RIGHT_C && objcop->facing == 0)||(objcop->P_LEFT_C && objcop->facing == 1))
  5833.         {
  5834.             for (int abc=5; abc>=0; abc--)
  5835.             {
  5836.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5837.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5838.             }
  5839.             objcop->inputarray[0]=4;
  5840.             objcop->inputarray[6]=SDL_GetTicks();
  5841.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5842.         }
  5843.         if ((objcop->P_RIGHT_C && objcop->facing == 1)||(objcop->P_LEFT_C && objcop->facing == 0))
  5844.         {
  5845.             for (int abc=5; abc>=0; abc--)
  5846.             {
  5847.                 objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
  5848.                 objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
  5849.             }
  5850.             objcop->inputarray[0]=5;
  5851.             objcop->inputarray[6]=SDL_GetTicks();
  5852.             //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
  5853.         }
  5854.  
  5855.         if (objcop->P_UP && Frames[objcop->currframe].h_ua!="4321")
  5856.         {
  5857.             objcop->previousframe=objcop->currframe;
  5858.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_ua);
  5859.             objcop->newframe=true;
  5860.         }
  5861.         if (objcop->P_DOWN && Frames[objcop->currframe].h_da!="4321")
  5862.         {
  5863.             objcop->previousframe=objcop->currframe;
  5864.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_da);
  5865.             objcop->newframe=true;
  5866.         }
  5867.         //if (objcop->P_LEFT && Eval(objcop, Frames[objcop->currframe].h_la)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_la);objcop->newframe=true; }
  5868.         //if (objcop->P_RIGHT && Eval(objcop, Frames[objcop->currframe].h_ra)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_ra);objcop->newframe=true; }
  5869.  
  5870.         if (objcop->P_ATTACK && Frames[objcop->currframe].h_a!="4321")
  5871.         {
  5872.             objcop->previousframe=objcop->currframe;
  5873.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_a);
  5874.             objcop->newframe=true;
  5875.         }
  5876.         if (objcop->P_JUMP &&  Frames[objcop->currframe].h_j!="4321")
  5877.         {
  5878.             objcop->previousframe=objcop->currframe;
  5879.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_j);
  5880.             objcop->newframe=true;
  5881.         }
  5882.         if (objcop->P_DEFEND && Frames[objcop->currframe].h_d!="4321")
  5883.         {
  5884.             objcop->previousframe=objcop->currframe;
  5885.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_d);
  5886.             objcop->newframe=true;
  5887.         }
  5888.         if (objcop->P_SPECIAL && Frames[objcop->currframe].h_s!="4321")
  5889.         {
  5890.             objcop->previousframe=objcop->currframe;
  5891.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_s);
  5892.             objcop->newframe=true;
  5893.         }
  5894.  
  5895.         if (((objcop->P_RIGHT && objcop->facing == 0)||(objcop->P_LEFT && objcop->facing == 1)) && Frames[objcop->currframe].h_f!="4321")
  5896.         {
  5897.             objcop->previousframe=objcop->currframe;
  5898.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_f);
  5899.             objcop->newframe=true;
  5900.         }
  5901.         if (((objcop->P_RIGHT && objcop->facing == 1)||(objcop->P_LEFT && objcop->facing == 0)) && Frames[objcop->currframe].h_b!="4321")
  5902.         {
  5903.             objcop->previousframe=objcop->currframe;
  5904.             objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_b);
  5905.             objcop->newframe=true;
  5906.         }
  5907.  
  5908.         if (!objcop->caught)
  5909.         {
  5910.             int tempameh=0;
  5911.             for (int y=0; y < Frames[objcop->currframe].combinationindx; y++)
  5912.             {
  5913.                 bool correctinput=true;
  5914.                 for (int z=0; z < Frames[objcop->currframe].COMBINATIONS[y].depth; z++)
  5915.                 {
  5916.  
  5917.  
  5918.                     if (Frames[objcop->currframe].COMBINATIONS[y].inputseq[z] > 9)
  5919.                     {
  5920.                         //correctinput= correctinput && Frames[objcop->currframe].COMBINATIONS[y].inputseq[z]-10==objcop->inputarray[z];
  5921.                         switch (Frames[objcop->currframe].COMBINATIONS[y].inputseq[z])
  5922.                         {
  5923.                         case 10:
  5924.                             correctinput= correctinput&&objcop->P_ATTACK;
  5925.                             break;
  5926.                         case 11:
  5927.                             correctinput= correctinput&&objcop->P_DEFEND;
  5928.                             break;
  5929.                         case 12:
  5930.                             correctinput= correctinput&&objcop->P_JUMP;
  5931.                             break;
  5932.                         case 13:
  5933.                             correctinput= correctinput&&objcop->P_SPECIAL;
  5934.                             break;
  5935.                         case 14:
  5936.                             correctinput= correctinput&&((objcop->P_RIGHT&&objcop->facing==0)||(objcop->P_LEFT&&objcop->facing==1));
  5937.                             break;
  5938.                         case 15:
  5939.                             correctinput= correctinput&&((objcop->P_RIGHT&&objcop->facing==1)||(objcop->P_LEFT&&objcop->facing==0));
  5940.                             break;
  5941.                         case 16:
  5942.                             correctinput= correctinput&&objcop->P_UP;
  5943.                             break;
  5944.                         case 17:
  5945.                             correctinput= correctinput&&objcop->P_DOWN;
  5946.                             break;
  5947.                         case 18:
  5948.                             correctinput= correctinput&&objcop->P_LEFT;
  5949.                             break;
  5950.                         case 19:
  5951.                             correctinput= correctinput&&objcop->P_RIGHT;
  5952.                             break;
  5953.                         default:
  5954.                             correctinput=false;
  5955.                         }
  5956.  
  5957.                     }
  5958.                     else
  5959.                     {
  5960.                         correctinput= correctinput && Frames[objcop->currframe].COMBINATIONS[y].inputseq[z]==objcop->inputarray[z];
  5961.  
  5962.                     }
  5963.                     tempameh++;
  5964.  
  5965.                 }
  5966.  
  5967.                 if (Frames[objcop->currframe].COMBINATIONS[y].delay!="4321")
  5968.                     correctinput=correctinput&&Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].delay)==(Eval(objcop, Frames[objcop->currframe].delay)-objcop->delayU);
  5969.  
  5970.                 if (Frames[objcop->currframe].COMBINATIONS[y].depth>=1 &&correctinput)
  5971.                 {
  5972.                     if (Frames[objcop->currframe].COMBINATIONS[y].depth>1 &&correctinput && (Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].time_interval)>=(objcop->inputarray[6]-objcop->inputarray[6+Frames[objcop->currframe].COMBINATIONS[y].depth-1])||Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].time_interval)==4321))
  5973.                     {
  5974.                         objcop->previousframe=objcop->currframe;
  5975.                         objcop->currframe=Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].nxt);
  5976.                         objcop->newframe=true;
  5977.                         smthisclicked=true;
  5978.                         for (int xyz=0; xyz<tempameh; xyz++) objcop->inputarray[xyz]=4321;
  5979.  
  5980.                     }
  5981.                     else if (Frames[objcop->currframe].COMBINATIONS[y].depth==1 &&correctinput && (Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].time_interval)>=(SDL_GetTicks()-objcop->inputarray[6+Frames[objcop->currframe].COMBINATIONS[y].depth-1])||Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].time_interval)==4321))
  5982.                     {
  5983.                         objcop->previousframe=objcop->currframe;
  5984.                         objcop->currframe=Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].nxt);
  5985.                         objcop->newframe=true;
  5986.                         smthisclicked=true;
  5987.                         for (int xyz=0; xyz<tempameh; xyz++) objcop->inputarray[xyz]=4321;
  5988.                     }
  5989.                 }
  5990.  
  5991.                 int asdfasdf=213123;
  5992.             }
  5993.  
  5994.  
  5995.  
  5996.             if (objcop->P_ATTACK_C && !smthisclicked)
  5997.             {
  5998.                 if (Frames[objcop->currframe].c_a!="4321")
  5999.                 {
  6000.                     objcop->previousframe=objcop->currframe;
  6001.                     objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_a);
  6002.                     objcop->newframe=true;
  6003.                     smthisclicked=true;
  6004.                 }
  6005.             }
  6006.             if (Frames[objcop->currframe].c_d!="4321" && objcop->P_DEFEND_C && !smthisclicked)
  6007.             {
  6008.                 objcop->previousframe=objcop->currframe;
  6009.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_d);
  6010.                 objcop->newframe=true;
  6011.                 smthisclicked=true;
  6012.             }
  6013.             if (Frames[objcop->currframe].c_j!="4321" && objcop->P_JUMP_C && !smthisclicked)
  6014.             {
  6015.                 objcop->previousframe=objcop->currframe;
  6016.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_j);
  6017.                 objcop->newframe=true;
  6018.                 smthisclicked=true;
  6019.             }
  6020.             if (Frames[objcop->currframe].c_s!="4321" && objcop->P_SPECIAL_C && !smthisclicked)
  6021.             {
  6022.                 objcop->previousframe=objcop->currframe;
  6023.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_s);
  6024.                 objcop->newframe=true;
  6025.                 smthisclicked=true;
  6026.             }
  6027.             if (Frames[objcop->currframe].c_ua!="4321" && objcop->P_UP_C && !smthisclicked)
  6028.             {
  6029.                 objcop->previousframe=objcop->currframe;
  6030.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_ua);
  6031.                 objcop->newframe=true;
  6032.                 smthisclicked=true;
  6033.             }
  6034.             if (Frames[objcop->currframe].c_da!="4321" && objcop->P_DOWN_C  && !smthisclicked)
  6035.             {
  6036.                 objcop->previousframe=objcop->currframe;
  6037.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_da);
  6038.                 objcop->newframe=true;
  6039.                 smthisclicked=true;
  6040.             }
  6041.             if (Frames[objcop->currframe].c_f!="4321" && ((objcop->P_RIGHT_C && objcop->facing == 0)||(objcop->P_LEFT_C && objcop->facing == 1))  && !smthisclicked)
  6042.             {
  6043.                 objcop->previousframe=objcop->currframe;
  6044.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_f);
  6045.                 objcop->newframe=true;
  6046.                 smthisclicked=true;
  6047.             }
  6048.             if (Frames[objcop->currframe].c_b!="4321" && ((objcop->P_RIGHT_C && objcop->facing == 1)||(objcop->P_LEFT_C && objcop->facing == 0))  && !smthisclicked)
  6049.             {
  6050.                 objcop->previousframe=objcop->currframe;
  6051.                 objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_b);
  6052.                 objcop->newframe=true;
  6053.                 smthisclicked=true;
  6054.             }
  6055.  
  6056.             if (objcop->facing == 0)
  6057.             {
  6058.                 if(objcop->P_RIGHT)objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
  6059.                 if(objcop->P_LEFT)objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
  6060.             }
  6061.             if (objcop->facing == 1)
  6062.             {
  6063.                 if(objcop->P_LEFT)objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
  6064.                 if(objcop->P_RIGHT)objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
  6065.             }
  6066.         }
  6067.  
  6068.     }
  6069. }
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075. void object::Regenerate_Deplete_Stuff(objcopy * objcop)
  6076. {
  6077.  
  6078.     if (Frames[objcop->currframe].flags[5]) objcop->currkp = maxkp;
  6079.  
  6080.     objcop->currdp=objcop->currdp+float((float)dpsec/60.0)>=maxdp?maxdp:objcop->currdp+float((float)dpsec/60.0); //Regen DP
  6081.     objcop->currsp=objcop->currsp+float((float)spsec/60.0)>=maxsp?maxsp:objcop->currsp+float((float)spsec/60.0); //Regen SP
  6082.     objcop->currkp=objcop->currkp+float((float)knockrate/60.0)>=maxkp?maxkp:objcop->currkp+float((float)knockrate/60.0); //Regen Knock Points
  6083.     objcop->currrp=objcop->currrp+float((float)rpsec/60.0)>=maxrp?maxrp:objcop->currrp+float((float)rpsec/60.0); //Regen RP
  6084.     objcop->hitcounter-=objcop->hitcounter!=0?1:0; //Regen Hit Counter
  6085.     //objcop->tempcount= objcop->tempcount==60?0:++objcop->tempcount;
  6086. }
  6087.  
  6088. void object::Set_IMG_No_On_Current_Grid(objcopy * objcop)
  6089. {
  6090.     if (objcop->newid)
  6091.     {
  6092.         if (LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321")
  6093.             objcop->gridn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid);
  6094.         else
  6095.             objcop->gridn=0;
  6096.         objcop->picn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].img);
  6097.         if (objcop->picn!=999)
  6098.         {
  6099.             for (int gridno=0; gridno<LOADED->OBJECTS[objcop->id].imgindx; gridno++)
  6100.             {
  6101.                 if (objcop->picn > LOADED->OBJECTS[objcop->id].IMGS[gridno].frameno-1)
  6102.                 {
  6103.                     objcop->gridn+=1;
  6104.                     objcop->picn-=LOADED->OBJECTS[objcop->id].IMGS[gridno].row*IMGS[gridno].col;
  6105.                 }
  6106.                 else
  6107.                 {
  6108.                     break;
  6109.                 }
  6110.             }
  6111.         }
  6112.     }
  6113.     else
  6114.     {
  6115.         try
  6116.         {
  6117.             bool www=LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321";
  6118.         }
  6119.         catch(...)
  6120.         {
  6121.             std::cout<<"hello";
  6122.         }
  6123.         if (LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321")
  6124.             objcop->gridn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid);
  6125.         else
  6126.             objcop->gridn=0;
  6127.         objcop->picn=Evaluate(Frames[objcop->currframe].img);
  6128.         if (objcop->picn!=999)
  6129.         {
  6130.  
  6131.             for (int gridno=0; gridno<imgindx; gridno++)
  6132.             {
  6133.                 if (objcop->picn > IMGS[gridno].frameno-1)
  6134.                 {
  6135.                     objcop->gridn+=1;
  6136.                     objcop->picn-=IMGS[gridno].row*IMGS[gridno].col;
  6137.                 }
  6138.                 else
  6139.                 {
  6140.                     break;
  6141.                 }
  6142.             }
  6143.         }
  6144.     }
  6145.  
  6146. }
  6147. void object::Adopt_Data(objcopy * objcop)
  6148. {
  6149.     if (Frames[objcop->currframe].adptx!="4321")
  6150.     {
  6151.         std::string asdfasdf=Frames[objcop->currframe].adptx;
  6152.         objcop->posx=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adptx)].posx;
  6153.     }
  6154.     if (Frames[objcop->currframe].adpty!="4321")
  6155.     {
  6156.         objcop->posy=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adpty)].posy;
  6157.     }
  6158.     if (Frames[objcop->currframe].adptz!="4321")
  6159.     {
  6160.         objcop->posz=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adptz)].posz;
  6161.     }
  6162. }
  6163. void object::Update_Frame_If_Time(objcopy * objcop)
  6164. {
  6165.     //priority
  6166.     objcop->rndrngpriority=4321;
  6167.     if (Frames[objcop->currframe].rndrngpriority!="4321")
  6168.     {
  6169.         objcop->rndrngpriority=Eval(objcop, Frames[objcop->currframe].rndrngpriority);
  6170.     }
  6171.  
  6172.  
  6173.  
  6174.     if (objcop->curse_id!=4321)  //stop cursing when time;
  6175.     {
  6176.         if (LOADED->CATCHINGIDS[objcop->curse_id][6]==0)
  6177.         {
  6178.             objcop->curse_id=4321;
  6179.             objcop->caught=false;
  6180.         }
  6181.     }
  6182.  
  6183.  
  6184.     if (objcop->newframe)
  6185.     {
  6186.         if (Frames[objcop->currframe].flags[22])
  6187.         {
  6188.             if (objcop->rndrbackid==4321)
  6189.             {
  6190.                 LOADED->OBJSBEHIND_INDEX++;
  6191.                 objcop->rndrbackid=1;
  6192.             }
  6193.         }
  6194.         if (Frames[objcop->currframe].flags[18])
  6195.         {
  6196.             objcop->facing=objcop->facing==1?0:1;
  6197.         }
  6198.         if (Frames[objcop->currframe].trans[0]!="4321")
  6199.         {
  6200.             objcop->posx+=Eval(objcop, Frames[objcop->currframe].trans[0]);
  6201.         }
  6202.         if (Frames[objcop->currframe].trans[1]!="4321")
  6203.         {
  6204.             objcop->posy+=Eval(objcop, Frames[objcop->currframe].trans[1]);
  6205.         }
  6206.         if (Frames[objcop->currframe].trans[2]!="4321")
  6207.         {
  6208.             objcop->posz+=Eval(objcop, Frames[objcop->currframe].trans[2]);
  6209.         }
  6210.         for (int z=0; z<20; z++)
  6211.         {
  6212.             objcop->rectdensity[z]=0;
  6213.         }
  6214.  
  6215.         if (objcop->newframe && Frames[objcop->currframe].addsp!="4321") objcop->currsp=objcop->currsp+Eval(objcop, Frames[objcop->currframe].addsp)>=maxsp?maxsp:objcop->currsp+Eval(objcop, Frames[objcop->currframe].addsp);
  6216.         if (objcop->newframe && Frames[objcop->currframe].addhp!="4321")
  6217.             objcop->currhp=objcop->currhp+Eval(objcop, Frames[objcop->currframe].addhp)>=maxhp?maxhp:objcop->currhp+Eval(objcop, Frames[objcop->currframe].addhp);
  6218.  
  6219.         if (objcop->newframe && Frames[objcop->currframe].reggy!="4321")   //set_reg= stuff
  6220.         {
  6221.             std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  6222.             std::string regas=Frames[objcop->currframe].reggy;
  6223.             std::string regasvals=Frames[objcop->currframe].reggyval;
  6224.  
  6225.             for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
  6226.             {
  6227.                 if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
  6228.                 {
  6229.                     regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
  6230.                 }
  6231.                 else if(regas.find("$")==std::string::npos)
  6232.                 {
  6233.                     break;
  6234.                 }
  6235.             }
  6236.             size_t vertposition;
  6237.             while (regas.find("|")!=std::string::npos)
  6238.             {
  6239.                 if (regasvals.find("||")!=std::string::npos)
  6240.                 {
  6241.                     vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
  6242.                 }
  6243.                 if (regas.substr(0, regas.find("|")).find("G_")==std::string::npos)
  6244.                 {
  6245.                     if (objcop->followerID!=4321)
  6246.                     {
  6247.                         LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  6248.                         regas.erase(0, regas.find("|")+1);
  6249.                         regasvals.erase(0, vertposition+1);
  6250.                     }
  6251.                     else
  6252.                     {
  6253.                         objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  6254.                     }
  6255.                     regas.erase(0, regas.find("|")+1);
  6256.                     regasvals.erase(0, vertposition+1);
  6257.                     if (objcop->followerID!=4321)
  6258.                     {
  6259.                         LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
  6260.                     }
  6261.                     else
  6262.                     {
  6263.                         objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
  6264.                     }
  6265.                 }
  6266.                 else
  6267.                 {
  6268.                     std::string greg=regas.substr(regas.find("G_")+2, regas.find("$", regas.find("G_"))-(regas.find("G_")+2));
  6269.                     LOADED->GLOBALREGS[Evaluate(greg)]=Eval(objcop, regasvals);
  6270.                     regas.erase(0, regas.find("|")+1);
  6271.                     regasvals.erase(0, vertposition+1);
  6272.                 }
  6273.             }
  6274.             if (regas.find("$G_")!=std::string::npos)
  6275.             {
  6276.                 std::string greg=regas.substr(regas.find("G_")+2, regas.find("$", regas.find("G_"))-(regas.find("G_")+2));
  6277.                 LOADED->GLOBALREGS[Evaluate(greg)]=Eval(objcop, regasvals);
  6278.             }
  6279.             else
  6280.             {
  6281.                 if (objcop->followerID!=4321)
  6282.                 {
  6283.                     LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
  6284.                 }
  6285.                 else
  6286.                 {
  6287.                     objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
  6288.                 }
  6289.             }
  6290.  
  6291.         }
  6292.  
  6293.         objcop->delayU=Eval(objcop, Frames[objcop->currframe].delay);
  6294.         objcop->newframe=false;
  6295.         if (Frames[objcop->currframe].loop_goto!="4321" &&objcop->doloop[1]!=objcop->currframe)
  6296.         {
  6297.             objcop->doloop[0]=0;
  6298.         }
  6299.     }
  6300.     if ((Frames[objcop->currframe].flags[0]||Frames[objcop->currframe].flags[1]) && objcop->currsp < 0)
  6301.     {
  6302.         objcop->previousframe=objcop->currframe;
  6303.         objcop->currframe=fatigue;
  6304.         objcop->newframe=true;
  6305.         objcop->currsp=0;
  6306.         return;
  6307.     }
  6308.     if (objcop->delayU==0)
  6309.     {
  6310.         if (Frames[objcop->currframe].nxtid!="4321")
  6311.         {
  6312.             objcop->id=Eval(objcop, Frames[objcop->currframe].nxtid);
  6313.             objcop->newid=true;
  6314.         }
  6315.         objcop->previousframe=objcop->currframe;
  6316.         objcop->currframe=Eval(objcop, Frames[objcop->currframe].nxt);
  6317.         objcop->newframe=true;
  6318.         if (objcop->currframe==1000)
  6319.         {
  6320.             objcop->currframe=objcop->previousframe;
  6321.             objcop->deleteobj=true;
  6322.         }
  6323.     }
  6324.     else    //update frame and loop on the delay
  6325.     {
  6326.         if (!objcop->caught)
  6327.         {
  6328.             objcop->delayU--;
  6329.         }
  6330.         else
  6331.         {
  6332.             if (objcop->curse_id!=4321)
  6333.             {
  6334.  
  6335.                 if (LOADED->CATCHINGIDS[objcop->curse_id][0]!=4321)
  6336.                 {
  6337.                     objcop->currframe=LOADED->CATCHINGIDS[objcop->curse_id][0];
  6338.                     objcop->newframe=true;
  6339.                 }
  6340.                 objcop->posx=LOADED->CATCHINGIDS[objcop->curse_id][2]==4321?objcop->posx:LOADED->CATCHINGIDS[objcop->curse_id][2];
  6341.                 objcop->posy=LOADED->CATCHINGIDS[objcop->curse_id][3]==4321?objcop->posy:LOADED->CATCHINGIDS[objcop->curse_id][3];
  6342.                 objcop->posz=LOADED->CATCHINGIDS[objcop->curse_id][4]==4321?objcop->posz:LOADED->CATCHINGIDS[objcop->curse_id][4];
  6343.             }
  6344.         }
  6345.     }
  6346.     bool sadfasdf=Frames[objcop->currframe].exists;
  6347.     if (!Frames[objcop->currframe].exists)
  6348.     {
  6349.         if (objcop->posy==objcop->GROUNDPOS)
  6350.         {
  6351.             objcop->previousframe=objcop->currframe;
  6352.             objcop->currframe=standing;
  6353.             objcop->newframe=true;
  6354.             return;
  6355.         }
  6356.         else if((objcop->posy>objcop->GROUNDPOS))
  6357.         {
  6358.             objcop->previousframe=objcop->currframe;
  6359.             objcop->currframe=hitground;
  6360.             objcop->newframe=true;
  6361.             return;
  6362.         }
  6363.         else
  6364.         {
  6365.             objcop->previousframe=objcop->currframe;
  6366.             objcop->currframe=inair;
  6367.             objcop->newframe=true;
  6368.             return;
  6369.         }
  6370.     }
  6371.     if (Frames[objcop->currframe].flags[17])
  6372.     {
  6373.         for (int xyz=0; xyz<6; xyz++) objcop->inputarray[xyz]=4321;
  6374.     }
  6375. }
  6376.  
  6377.  
  6378. void object::Blit   ( objcopy * objcop)
  6379. {
  6380.     ///SDL_Rect tempah={posx-BG.shadowpos.x, posz-BG.shadowpos.y, BG.shadowpos.w, BG.shadowpos.h};
  6381.     //SDL_BlitSurface (BG.shadow, NULL, d, &tempah); //SDL 1.2
  6382.     ///SDL_RenderCopy(MainRend, BG.shadow, NULL, &tempah);
  6383.     int posrcam=CAM[0];
  6384.     int pos[4]= {objcop->posx+CAM[0],objcop->posz+objcop->posy+CAM[1],0,0};
  6385.     if (Evaluate(Frames[objcop->currframe].alpha)!=4321)
  6386.     {
  6387.         glColor4f(1.0f, 1.f, 1.f, (float)Evaluate(Frames[objcop->currframe].alpha)/255.0);
  6388.     }
  6389.     else
  6390.     {
  6391.         glColor4f(1.0f, 1.f, 1.f, 1.f);
  6392.     }
  6393.     if (objcop->facing==0 && objcop->picn!=999)
  6394.     {
  6395.         pos[0]=float((objcop->posx+CAM[0])-Eval(objcop,Frames[objcop->currframe].center_X));
  6396.         pos[1]=float((objcop->posz)-Eval(objcop,Frames[objcop->currframe].center_Y)+(objcop->posy)+CAM[1]);
  6397.         pos[2]=float(IMGS[objcop->gridn].clip[objcop->picn].w);
  6398.         pos[3]=float(IMGS[objcop->gridn].clip[objcop->picn].h);
  6399.         float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
  6400.         float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
  6401.         float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
  6402.         float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
  6403.         glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].grid );
  6404.  
  6405.         glBegin(GL_QUADS);
  6406.  
  6407.         glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  6408.         glVertex2f(pos[0], pos[1]);
  6409.         glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  6410.         glVertex2f(pos[0]+pos[2], pos[1]);
  6411.         glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  6412.         glVertex2f(pos[0]+pos[2], pos[1]+pos[3]);
  6413.         glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  6414.         glVertex2f(pos[0], pos[1]+pos[3]);
  6415.         glEnd();
  6416.  
  6417.  
  6418.  
  6419.         //SDL_RenderCopy(MainRend, IMGS[0].grid,  &IMGS[0].clip[Evaluate(Frames[currframe].img)], &pos);
  6420.         //SDL_BlitSurface (IMGS[0].grid, &IMGS[0].clip[Evaluate(Frames[currframe].img)], d, &pos); SDL 1.2
  6421.     }
  6422.     if (objcop->facing==1 && objcop->picn!=999)
  6423.     {
  6424.         int tempaval=(objcop->posx+Eval(objcop,Frames[objcop->currframe].center_X)+objcop->posx);
  6425.         float depthfactor=1.0-((float)objcop->posz/(float)SH);
  6426.         depthfactor*=0;
  6427.         pos[0]=float((objcop->posx+CAM[0])-((IMGS[objcop->gridn].clip_[objcop->picn].w)-Eval(objcop,Frames[objcop->currframe].center_X)));
  6428.         pos[1]=float(objcop->posz-Eval(objcop,Frames[objcop->currframe].center_Y)+objcop->posy+CAM[1]);
  6429.         pos[2]=float(IMGS[objcop->gridn].clip[objcop->picn].w);
  6430.         pos[3]=float(IMGS[objcop->gridn].clip[objcop->picn].h);
  6431.         float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
  6432.         float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
  6433.         float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
  6434.         float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
  6435.         glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].grid );
  6436.  
  6437.         glBegin(GL_QUADS);
  6438.  
  6439.         glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  6440.         glVertex2f((pos[0]+pos[2])-(pos[2]*0.5*depthfactor), pos[1]+(pos[3]*depthfactor));
  6441.         //glColor3f(0.0f, 0.0/f, 0.2f);
  6442.         glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
  6443.         glVertex2f(pos[0]+(pos[2]*depthfactor*0.5), pos[1]+(pos[3]*depthfactor));
  6444.         glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  6445.         glVertex2f(pos[0]+(pos[2]*depthfactor*0.5), (pos[1]+pos[3]));
  6446.         glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
  6447.         glVertex2f((pos[0]+pos[2])-(pos[2]*depthfactor*0.5), (pos[1]+pos[3]));
  6448.         glEnd();
  6449.     }
  6450.     //glClear( GL_COLOR_BUFFER_BIT );
  6451.     if (!Frames[objcop->currframe].flags[9])
  6452.     {
  6453.         float backuppos[3]= {objcop->posx, objcop->posy, objcop->posz};
  6454.         objcop->posz+=CAM[1];
  6455.         if (LOADED->BARS[12]!="None")
  6456.         {
  6457.             glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[3].grid );
  6458.             glBegin(GL_QUADS);
  6459.             glTexCoord2f(0 , 0);
  6460.             glVertex2f(posrcam+Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0), Evaluate(LOADED->BARS[14])+objcop->posz+10);
  6461.             glTexCoord2f(1 , 0);
  6462.             glVertex2f(posrcam+Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0)+LOADED->BARSG[3].gw, Evaluate(LOADED->BARS[14])+objcop->posz+10);
  6463.             glTexCoord2f(1 , 1);
  6464.             glVertex2f(posrcam+Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0)+LOADED->BARSG[3].gw, Evaluate(LOADED->BARS[14])+objcop->posz+10+LOADED->BARSG[3].gh);
  6465.             glTexCoord2f(0 , 1);
  6466.             glVertex2f(posrcam+Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0), Evaluate(LOADED->BARS[14])+objcop->posz+10+LOADED->BARSG[3].gh);
  6467.             glEnd();
  6468.         }
  6469.         if (LOADED->BARS[0]=="None")
  6470.         {
  6471.             glBindTexture( GL_TEXTURE_2D, NULL );
  6472.             switch (objcop->team)
  6473.             {
  6474.             case 0:
  6475.                 glColor4f(1.0f, 0.f, 0.f, 0.5f);
  6476.                 break;
  6477.             case 1:
  6478.                 glColor4f(0.0f, 0.f, 1.f, 0.5f);
  6479.                 break;
  6480.             case 2:
  6481.                 glColor4f(0.0f, 1.f, 0.f, 0.5f);
  6482.                 break;
  6483.             case 3:
  6484.                 glColor4f(1.0f, 1.f, 0.f, 0.5f);
  6485.                 break;
  6486.             default:
  6487.                 ;
  6488.             }
  6489.         }
  6490.         else
  6491.         {
  6492.             switch(objcop->team)
  6493.             {
  6494.             case 0:
  6495.                 glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[0].grid );
  6496.                 break;
  6497.             case 1:
  6498.                 glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[4].grid );
  6499.                 break;
  6500.             case 2:
  6501.                 glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[5].grid );
  6502.                 break;
  6503.             case 3:
  6504.                 glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[6].grid );
  6505.                 break;
  6506.             default :
  6507.                 glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[7].grid );
  6508.                 break;
  6509.             }
  6510.         }
  6511.         if (objcop->currhp >= 0)
  6512.         {
  6513.             glBegin(GL_QUADS);
  6514.  
  6515.             if (LOADED->BARS[0]=="None")
  6516.             {
  6517.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+10);
  6518.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10);
  6519.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10+5);
  6520.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+10+5);
  6521.             }
  6522.             else
  6523.             {
  6524.                 switch(Evaluate(LOADED->BARS[3]))
  6525.                 {
  6526.                 case 1:
  6527.                     glTexCoord2f(1-float(float(objcop->currhp)/float(maxhp)) , 0);
  6528.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0)-((LOADED->BARSG[0].gw)*float(float(objcop->currhp)/float(maxhp))), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6529.                     glTexCoord2f(1 , 0);
  6530.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0)+LOADED->BARSG[0].gw, Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6531.                     glTexCoord2f(1 , 1);
  6532.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0)+LOADED->BARSG[0].gw, Evaluate(LOADED->BARS[7])+objcop->posz+10+LOADED->BARSG[0].gh);
  6533.                     glTexCoord2f(1-float(float(objcop->currhp)/float(maxhp)) , 1);
  6534.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0)-((LOADED->BARSG[0].gw)*float(float(objcop->currhp)/float(maxhp))), Evaluate(LOADED->BARS[7])+objcop->posz+10+LOADED->BARSG[0].gh);
  6535.                     break;
  6536.  
  6537.                 case 2:
  6538.                     glTexCoord2f(0 , 0);
  6539.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6540.                     glTexCoord2f(1 , 0);
  6541.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6542.                     glTexCoord2f(1 , float(float(objcop->currhp)/float(maxhp)));
  6543.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10+(LOADED->BARSG[0].gh*float(float(objcop->currhp)/float(maxhp))));
  6544.                     glTexCoord2f(0 , float(float(objcop->currhp)/float(maxhp)));
  6545.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10+(LOADED->BARSG[0].gh*float(float(objcop->currhp)/float(maxhp))));
  6546.                     break;
  6547.  
  6548.                 case 3:
  6549.                     glTexCoord2f(0 , 1-float(float(objcop->currhp)/float(maxhp)));
  6550.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10+(1-LOADED->BARSG[0].gh*float(float(objcop->currhp)/float(maxhp))));
  6551.                     glTexCoord2f(1 , 1-float(float(objcop->currhp)/float(maxhp)));
  6552.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10+(1-LOADED->BARSG[0].gh*float(float(objcop->currhp)/float(maxhp))));
  6553.                     glTexCoord2f(1 , 1);
  6554.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6555.                     glTexCoord2f(0 , 1);
  6556.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6557.                     break;
  6558.  
  6559.                 default:
  6560.                     glTexCoord2f(0 , 0);
  6561.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6562.                     glTexCoord2f(1*float(float(objcop->currhp)/float(maxhp)) , 0);
  6563.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0)+LOADED->BARSG[0].gw*float(float(objcop->currhp)/float(maxhp)), Evaluate(LOADED->BARS[7])+objcop->posz+10);
  6564.                     glTexCoord2f(1*float(float(objcop->currhp)/float(maxhp)) , 1);
  6565.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0)+LOADED->BARSG[0].gw*float(float(objcop->currhp)/float(maxhp)), Evaluate(LOADED->BARS[7])+objcop->posz+10+LOADED->BARSG[0].gh);
  6566.                     glTexCoord2f(0 , 1);
  6567.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10+LOADED->BARSG[0].gh);
  6568.                 }
  6569.             }
  6570.             glEnd();
  6571.  
  6572.         }
  6573.         if (LOADED->BARS[1]=="None")
  6574.         {
  6575.             glBindTexture( GL_TEXTURE_2D, NULL);
  6576.             glColor4f(1.0f, 1.f, 1.f, 0.5f);
  6577.         }
  6578.         else
  6579.         {
  6580.             glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[1].grid);
  6581.         }
  6582.         if (objcop->currsp >= 0)
  6583.         {
  6584.             glBegin(GL_QUADS);
  6585.             if (LOADED->BARS[1]=="None")
  6586.             {
  6587.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+17);
  6588.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+17);
  6589.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+20);
  6590.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+20);
  6591.             }
  6592.             else
  6593.             {
  6594.                 switch(Evaluate(LOADED->BARS[4]))
  6595.                 {
  6596.                 case 1:
  6597.                     glTexCoord2f(1-float(float(objcop->currsp)/float(maxsp)) , 0);
  6598.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0)-((LOADED->BARSG[1].gw)*float(float(objcop->currsp)/float(maxsp))), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6599.                     glTexCoord2f(1 , 0);
  6600.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0)+LOADED->BARSG[1].gw, Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6601.                     glTexCoord2f(1 , 1);
  6602.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0)+LOADED->BARSG[1].gw, Evaluate(LOADED->BARS[9])+objcop->posz+10+LOADED->BARSG[1].gh);
  6603.                     glTexCoord2f(1-float(float(objcop->currsp)/float(maxsp)) , 1);
  6604.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0)-((LOADED->BARSG[1].gw)*float(float(objcop->currsp)/float(maxsp))), Evaluate(LOADED->BARS[9])+objcop->posz+10+LOADED->BARSG[1].gh);
  6605.                     break;
  6606.  
  6607.                 case 2:
  6608.                     glTexCoord2f(0 , 0);
  6609.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6610.                     glTexCoord2f(1 , 0);
  6611.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6612.                     glTexCoord2f(1 , float(float(objcop->currsp)/float(maxsp)));
  6613.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10+(LOADED->BARSG[1].gh*float(float(objcop->currsp)/float(maxsp))));
  6614.                     glTexCoord2f(0 , float(float(objcop->currsp)/float(maxsp)));
  6615.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10+(LOADED->BARSG[1].gh*float(float(objcop->currsp)/float(maxsp))));
  6616.                     break;
  6617.  
  6618.                 case 3:
  6619.                     glTexCoord2f(0 , 1-float(float(objcop->currsp)/float(maxsp)));
  6620.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10+(1-LOADED->BARSG[1].gh*float(float(objcop->currsp)/float(maxsp))));
  6621.                     glTexCoord2f(1 , 1-float(float(objcop->currsp)/float(maxsp)));
  6622.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10+(1-LOADED->BARSG[1].gh*float(float(objcop->currsp)/float(maxsp))));
  6623.                     glTexCoord2f(1 , 1);
  6624.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6625.                     glTexCoord2f(0 , 1);
  6626.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6627.                     break;
  6628.  
  6629.                 default:
  6630.                     glTexCoord2f(0 , 0);
  6631.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6632.                     glTexCoord2f(1*float(float(objcop->currsp)/float(maxsp)) , 0);
  6633.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0)+LOADED->BARSG[1].gw*float(float(objcop->currsp)/float(maxsp)), Evaluate(LOADED->BARS[9])+objcop->posz+10);
  6634.                     glTexCoord2f(1*float(float(objcop->currsp)/float(maxsp)) , 1);
  6635.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0)+LOADED->BARSG[1].gw*float(float(objcop->currsp)/float(maxsp)), Evaluate(LOADED->BARS[9])+objcop->posz+10+LOADED->BARSG[1].gh);
  6636.                     glTexCoord2f(0 , 1);
  6637.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10+LOADED->BARSG[1].gh);
  6638.                 }
  6639.             }
  6640.             glEnd();
  6641.  
  6642.         }
  6643.         if (LOADED->BARS[2]=="None")
  6644.         {
  6645.             glBindTexture( GL_TEXTURE_2D, NULL);
  6646.             glColor4f(0.6f, 0.1f,0.1f, 0.5f);
  6647.         }
  6648.         else
  6649.         {
  6650.             glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[2].grid);
  6651.         }
  6652.  
  6653.         if (objcop->currrp >= 0)
  6654.         {
  6655.             glBegin(GL_QUADS);
  6656.             if (LOADED->BARS[1]=="None")
  6657.             {
  6658.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+17);
  6659.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+17);
  6660.                 glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+20);
  6661.                 glVertex2f(posrcam+objcop->posx-20, objcop->posz+20);
  6662.             }
  6663.             else
  6664.             {
  6665.                 switch(Evaluate(LOADED->BARS[5]))
  6666.                 {
  6667.                 case 1:
  6668.                     glTexCoord2f(1-float(float(objcop->currrp)/float(maxrp)) , 0);
  6669.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0)-((LOADED->BARSG[2].gw)*float(float(objcop->currrp)/float(maxrp))), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6670.                     glTexCoord2f(1 , 0);
  6671.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0)+LOADED->BARSG[2].gw, Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6672.                     glTexCoord2f(1 , 1);
  6673.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0)+LOADED->BARSG[2].gw, Evaluate(LOADED->BARS[11])+objcop->posz+10+LOADED->BARSG[2].gh);
  6674.                     glTexCoord2f(1-float(float(objcop->currrp)/float(maxrp)) , 1);
  6675.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0)-((LOADED->BARSG[2].gw)*float(float(objcop->currrp)/float(maxrp))), Evaluate(LOADED->BARS[11])+objcop->posz+10+LOADED->BARSG[2].gh);
  6676.                     break;
  6677.  
  6678.                 case 2:
  6679.                     glTexCoord2f(0 , 0);
  6680.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6681.                     glTexCoord2f(1 , 0);
  6682.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6683.                     glTexCoord2f(1 , float(float(objcop->currrp)/float(maxrp)));
  6684.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10+(LOADED->BARSG[2].gh*float(float(objcop->currrp)/float(maxrp))));
  6685.                     glTexCoord2f(0 , float(float(objcop->currrp)/float(maxrp)));
  6686.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10+(LOADED->BARSG[2].gh*float(float(objcop->currrp)/float(maxrp))));
  6687.                     break;
  6688.  
  6689.                 case 3:
  6690.                     glTexCoord2f(0 , 1-float(float(objcop->currrp)/float(maxrp)));
  6691.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10+(1-LOADED->BARSG[2].gh*float(float(objcop->currrp)/float(maxrp))));
  6692.                     glTexCoord2f(1 , 1-float(float(objcop->currrp)/float(maxrp)));
  6693.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10+(1-LOADED->BARSG[2].gh*float(float(objcop->currrp)/float(maxrp))));
  6694.                     glTexCoord2f(1 , 1);
  6695.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6696.                     glTexCoord2f(0 , 1);
  6697.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6698.                     break;
  6699.  
  6700.                 default:
  6701.                     glTexCoord2f(0 , 0);
  6702.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6703.                     glTexCoord2f(1*float(float(objcop->currrp)/float(maxrp)) , 0);
  6704.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0)+LOADED->BARSG[2].gw*float(float(objcop->currrp)/float(maxrp)), Evaluate(LOADED->BARS[11])+objcop->posz+10);
  6705.                     glTexCoord2f(1*float(float(objcop->currrp)/float(maxrp)) , 1);
  6706.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0)+LOADED->BARSG[2].gw*float(float(objcop->currrp)/float(maxrp)), Evaluate(LOADED->BARS[11])+objcop->posz+10+LOADED->BARSG[2].gh);
  6707.                     glTexCoord2f(0 , 1);
  6708.                     glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10+LOADED->BARSG[2].gh);
  6709.                 }
  6710.             }
  6711.             glEnd();
  6712.         }
  6713.         glColor4f(1.0f, 1.f, 1.f, 1.0f);
  6714.  
  6715.         objcop->posz=backuppos[2];
  6716.  
  6717.  
  6718.  
  6719.         ///if (facing==1){SDL_Rect pos = {posx-((IMGS[objcop->gridn].clip_[Evaluate(Frames[currframe].img)].w)-Evaluate(Frames[currframe].center_X)), posz-Evaluate(Frames[currframe].center_Y)+posy,  IMGS[objcop->gridn].clip_[Evaluate(Frames[currframe].img)].w, IMGS[objcop->gridn].clip_[Evaluate(Frames[currframe].img)].h};
  6720.         //SDL_BlitSurface (IMGS[objcop->gridn].grid_, &IMGS[objcop->gridn].clip_[Evaluate(Frames[currframe].img)], d, &pos); //SDL 1.2
  6721.         ///SDL_RenderCopy(MainRend, IMGS[objcop->gridn].grid_,  &IMGS[0].clip_[Evaluate(Frames[currframe].img)], &pos);
  6722.         ///}
  6723.     }
  6724.  
  6725.     for (int drawshape_index=0; drawshape_index<Frames[objcop->currframe].drawshapeindx; drawshape_index++)
  6726.     {
  6727.         if(Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x_r!="4321")
  6728.         {
  6729.             glBindTexture( GL_TEXTURE_2D, NULL);
  6730.             float x=pos[0]+Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x);
  6731.             float y=pos[1]+Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].y);
  6732.             float x_radius=Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x_r);
  6733.             float y_radius=Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].y_r);
  6734.             float colors[4]=
  6735.             {
  6736.                 Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[0]),
  6737.                 Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[1]),
  6738.                 Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[2]),
  6739.                 Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[3])
  6740.             };
  6741.             DrawCircle(x, y, x_radius, 300, colors,1);
  6742.         }
  6743.     }
  6744. }
  6745.  
  6746.  
  6747. /*-------------------------------------------------------------------------------------------------------------*/
  6748.  
  6749. //void object::CallObj(int ID, int currframeA, int posxA, int posyA, int poszA, int facingA, int teamA, bool flags[]){
  6750. void object::CallObj(int paras[], bool flags[])
  6751. {
  6752.     objcopy hiteff;
  6753.     hiteff=copy_object(LOADED->OBJS_STRUCTS[paras[0]]);
  6754.     hiteff.posx=paras[2];
  6755.     hiteff.posy=paras[3];
  6756.     hiteff.posz=paras[4]+1;
  6757.     hiteff.facing=paras[5];
  6758.     hiteff.currframe=paras[1];
  6759.     hiteff.showshadow=false;
  6760.     hiteff.FRICTION= LOADED->FRICTION;
  6761.     hiteff.GRAVITY = LOADED->GRAVITY;
  6762.     hiteff.team=paras[6];
  6763.     hiteff.id=paras[0];
  6764.     hiteff.newframe=true;
  6765.     if (flags[5])
  6766.     {
  6767.         hiteff.followerID=paras[7];
  6768.     }
  6769.     if (flags[6])
  6770.     {
  6771.         hiteff.playerno=paras[11];
  6772.     }
  6773.     hiteff.total_fx=paras[8];
  6774.     hiteff.total_fy=paras[9];
  6775.     hiteff.total_fz=paras[10];
  6776.  
  6777.     if (LOADED->D_O_INDEX==0)
  6778.     {
  6779.         hiteff.onscreen_id=LOADED->ON_SCREEN_OBJCOUNT;
  6780.         LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
  6781.         LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
  6782.         return;
  6783.     }
  6784.     for (int a=LOADED->D_O_INDEX-1; a >= 0; a--)
  6785.     {
  6786.         if (LOADED->DELETED_OBJS[a] >= LOADED->ON_SCREEN_OBJCOUNT )
  6787.         {
  6788.             hiteff.onscreen_id=LOADED->ON_SCREEN_OBJCOUNT;
  6789.             LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
  6790.             LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
  6791.  
  6792.             return;
  6793.         }
  6794.         else
  6795.         {
  6796.             hiteff.onscreen_id=LOADED->DELETED_OBJS[a];
  6797.             LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]]=hiteff;
  6798.             //LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]];
  6799.             LOADED->D_O_INDEX--;
  6800.             return;
  6801.         }
  6802.     }
  6803.  
  6804. }
  6805. void object::CallObject(objcopy * objcop)
  6806. {
  6807.     for (int opoint=0; opoint < Frames[objcop->currframe].callobjectindx; opoint++)
  6808.     {
  6809.         int tehid=Frames[objcop->currframe].CALLOBJECTS[opoint].id=="4321"?objcop->id:Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].id);
  6810.         int tehfrm=Frames[objcop->currframe].CALLOBJECTS[opoint].frm=="4321"?0:Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].frm);
  6811.         int tehx;
  6812.         if (objcop->facing==0)
  6813.         {
  6814.             tehx=objcop->posx+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].x)-Eval(objcop, Frames[objcop->currframe].center_X);
  6815.         }
  6816.         else
  6817.         {
  6818.             tehx=objcop->posx-Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].x)+Eval(objcop, Frames[objcop->currframe].center_X);
  6819.         }
  6820.         int tehy=objcop->posy+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].y)-Eval(objcop, Frames[objcop->currframe].center_Y);
  6821.         int tehz=objcop->posz+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].z);
  6822.         int tehfacing=Frames[objcop->currframe].CALLOBJECTS[opoint].flags[0]?int(!bool(objcop->facing)):objcop->facing;
  6823.         int tehteam= objcop->team;
  6824.         int copyregs;
  6825.         if (Frames[objcop->currframe].CALLOBJECTS[opoint].flags[5])
  6826.         {
  6827.             copyregs=objcop->followerID!=4321?objcop->followerID:objcop->index;
  6828.         }
  6829.         else
  6830.         {
  6831.             copyregs=4321;
  6832.         }
  6833.         int tehplayerno;
  6834.         if (Frames[objcop->currframe].CALLOBJECTS[opoint].flags[6])
  6835.         {
  6836.             tehplayerno=objcop->playerno;
  6837.         }
  6838.         else
  6839.         {
  6840.             tehplayerno=4321;
  6841.         }
  6842.  
  6843.         int tehfx=objcop->facing==0?Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_x):-1*Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_x);
  6844.         int tehfy=Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_y);
  6845.         int tehfz=Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_z);
  6846.         int paras[]= {tehid, tehfrm, tehx, tehy, tehz, tehfacing, tehteam, copyregs, tehfx, tehfy, tehfz, tehplayerno};
  6847.         if (Eval(objcop, Frames[objcop->currframe].delay)-objcop->delayU-1 == Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].delay)||
  6848.                 Eval(objcop, Frames[objcop->currframe].delay)==0)
  6849.         {
  6850.             if (Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].cndtn)!=0)
  6851.             {
  6852.                 for (int times=0; times<Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].qntty); times++)
  6853.                 {
  6854.                     CallObj(paras, Frames[objcop->currframe].CALLOBJECTS[opoint].flags);
  6855.                 }
  6856.             }
  6857.         }
  6858.     }
  6859. }
  6860.  
  6861.  
  6862. void background::Blit (LOAD * LOADED)
  6863. {
  6864.  
  6865.  
  6866.  
  6867.     //SDL_UpdateTexture(d, NULL,backgroundSurf->pixels, 960*sizeof (Uint32));
  6868.     //SDL_RenderCopy(MainRend, backgroundTex, NULL, &position); //SDL 2.0
  6869.  
  6870.  
  6871.     int xpositions=0, ypositions=0;
  6872.     int meanxpositions=0, meanypositions=0;
  6873.     int humanplayers=0;
  6874.     for (int x=0; x < LOADED->ON_SCREEN_OBJCOUNT; x++)
  6875.     {
  6876.         if(!LOADED->ON_SCREEN_OBJS[x]->iscom)
  6877.         {
  6878.             meanxpositions++;
  6879.             meanypositions++;
  6880.             xpositions+=LOADED->ON_SCREEN_OBJS[x]->posx;
  6881.             ypositions+=LOADED->ON_SCREEN_OBJS[x]->posy;
  6882.             humanplayers++;
  6883.         }
  6884.     }
  6885.  
  6886.     if (humanplayers>0)
  6887.     {
  6888.         if (-(xpositions/meanxpositions)+(SW/2) !=CAM[0])
  6889.         {
  6890.             CAMV[0]=(CAM[0]-(-(xpositions/meanxpositions)+(SW/2)))/20;
  6891.         }
  6892.  
  6893.         if (-(ypositions/meanypositions) !=CAM[1])
  6894.         {
  6895.             CAMV[1]=(CAM[1]-(-(ypositions/meanypositions)+(SH/2)))/10;
  6896.         }
  6897.  
  6898.         CAM[0]-=CAMV[0];
  6899.         CAM[0]= CAM[0]>0?0:CAM[0];
  6900.         CAM[0]= CAM[0]<SW-xboundwidth?SW-xboundwidth:CAM[0];
  6901.  
  6902.         if (ypositions/meanypositions<-200)
  6903.             CAM[1]=(-(ypositions/humanplayers))-200;
  6904.         else
  6905.             CAM[1]=0;
  6906.     }
  6907.     /*
  6908.      glBindTexture( GL_TEXTURE_2D, NULL );
  6909.      glColor4f(0, 0, 0, 255);
  6910.      glBegin(GL_QUADS);
  6911.      glVertex2f(0, 0);
  6912.      glVertex2f(SW, 0);
  6913.      glVertex2f(SW, SH);
  6914.      glVertex2f(0, SH);
  6915.  
  6916.      glEnd();*/
  6917.     glColor4f(255, 255, 255, 255);
  6918.  
  6919.     for (int layah=0; layah<50; layah++)
  6920.     {
  6921.         if (LAYERS[layah].exists)
  6922.         {
  6923.  
  6924.             for (int opoint=0; opoint < LAYERS[layah].callobjectindx; opoint++)
  6925.             {
  6926.                 int tehid=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].id);
  6927.                 int tehfrm=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].frm)==4321?0:Evaluate(LAYERS[layah].CALLOBJECTS[opoint].frm);
  6928.                 int tehx=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].x);
  6929.                 int tehy=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].y);
  6930.                 int tehz=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].z);
  6931.                 int tehfacing=LAYERS[layah].CALLOBJECTS[opoint].flags[0]?1:0;
  6932.                 int tehteam= 4321;
  6933.                 if (LAYERS[layah].overalldelay==0)
  6934.                 {
  6935.                     for (int times=0; times<Evaluate(LAYERS[layah].CALLOBJECTS[opoint].qntty); times++)
  6936.                     {
  6937.                         //CallObj(tehid, tehfrm, tehx, tehy, tehz, tehfacing, tehteam, LOADED);
  6938.                         objcopy hiteff;
  6939.                         hiteff=copy_object(LOADED->OBJS_STRUCTS[tehid]);
  6940.                         hiteff.posx=tehx;
  6941.                         hiteff.posy=tehy;
  6942.                         hiteff.posz=tehz;
  6943.                         hiteff.facing=tehfacing;
  6944.                         hiteff.currframe=tehfrm;
  6945.                         hiteff.showshadow=false;
  6946.                         hiteff.FRICTION= LOADED->FRICTION;
  6947.                         hiteff.GRAVITY = LOADED->GRAVITY;
  6948.                         hiteff.team=tehteam;
  6949.                         hiteff.id=tehid;
  6950.                         hiteff.newframe=true;
  6951.                         if (LOADED->D_O_INDEX==0)
  6952.                         {
  6953.                             LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
  6954.                             LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
  6955.                             continue;
  6956.                         }
  6957.                         for (int a=LOADED->D_O_INDEX-1; a >= 0; a--)
  6958.                         {
  6959.                             if (LOADED->DELETED_OBJS[a] >= LOADED->ON_SCREEN_OBJCOUNT )
  6960.                             {
  6961.                                 LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
  6962.                                 LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
  6963.  
  6964.                                 break;
  6965.                             }
  6966.                             else
  6967.                             {
  6968.                                 LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]]=hiteff;
  6969.                                 LOADED->ON_SCREEN_OBJS[LOADED->DELETED_OBJS[a]]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]];
  6970.                                 LOADED->D_O_INDEX--;
  6971.                                 break;
  6972.                             }
  6973.                         }
  6974.                     }
  6975.                 }
  6976.             }
  6977.  
  6978.             LAYERS[layah].posx+=Evaluate(LAYERS[layah].f_x);
  6979.             LAYERS[layah].posy+=Evaluate(LAYERS[layah].f_y);
  6980.             if (LAYERS[layah].overalldelay==Evaluate(LAYERS[layah].restart))
  6981.             {
  6982.                 LAYERS[layah].posx=Evaluate(LAYERS[layah].x);
  6983.                 LAYERS[layah].posy=Evaluate(LAYERS[layah].y);
  6984.                 LAYERS[layah].overalldelay=0;
  6985.             }
  6986.             else
  6987.             {
  6988.                 LAYERS[layah].overalldelay++;
  6989.             }
  6990.  
  6991.             if (Evaluate(LAYERS[layah].restart)==4321)
  6992.             {
  6993.                 LAYERS[layah].overalldelay=4321;
  6994.             }
  6995.             //int layer_width=LAYERS[layah].IMGS[0].gw;
  6996.             //int layer_height=LAYERS[layah].IMGS[0].gh;
  6997.  
  6998.             glBindTexture( GL_TEXTURE_2D, LAYERS[layah].IMG[0].grid );
  6999.  
  7000.             glBegin(GL_QUADS);
  7001.  
  7002.             glTexCoord2i(0, 0);
  7003.             glVertex3f(float(LAYERS[layah].posx) +CAM[0], float(Evaluate(LAYERS[layah].y)) +CAM[1] +CAM[2], 0);
  7004.             glTexCoord2i(1*Evaluate(LAYERS[layah].rptx), 0);
  7005.             glVertex3f(float(LAYERS[layah].posx+LAYERS[layah].IMG[0].gw*Evaluate(LAYERS[layah].rptx)) +CAM[0], float(Evaluate(LAYERS[layah].y))  +CAM[1] +CAM[2], 0);
  7006.             glTexCoord2i(1*Evaluate(LAYERS[layah].rptx), 1*Evaluate(LAYERS[layah].rpty));
  7007.             glVertex3f(float(LAYERS[layah].posx+LAYERS[layah].IMG[0].gw*Evaluate(LAYERS[layah].rptx)) +CAM[0], float(Evaluate(LAYERS[layah].y)+LAYERS[layah].IMG[0].gh*Evaluate(LAYERS[layah].rpty)) +CAM[1] +CAM[2], 0);
  7008.             glTexCoord2i(0, 1*Evaluate(LAYERS[layah].rpty));
  7009.             glVertex3f(float(LAYERS[layah].posx) +CAM[0], float(Evaluate(LAYERS[layah].y)+LAYERS[layah].IMG[0].gh*Evaluate(LAYERS[layah].rpty))  +CAM[1]  +CAM[2], 0);
  7010.  
  7011.             glEnd();
  7012.         }
  7013.     }
  7014.  
  7015.     //SDL_BlitSurface (backgroundSurf, NULL, d, &position); //SDL 1.2
  7016. }
  7017.  
  7018. void object::Platforming_Solid(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[])
  7019. {
  7020.     SDL_Rect temprect= {0, 0, 0, 0};
  7021.     int effx, effy;
  7022.     int b[6];
  7023.     int Both_Platform_Solid=0;
  7024.  
  7025.     if (!Frames[objcop->currframe].flags[14]&&LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[6] && objcop->posy <= r[1]
  7026.        )
  7027.     {
  7028.         b[0]=Evaluate(Frames[objcop->currframe].BDYS[20].x);
  7029.         b[1]=Evaluate(Frames[objcop->currframe].BDYS[20].y);
  7030.         b[2]=Evaluate(Frames[objcop->currframe].BDYS[20].z);
  7031.         b[3]=Evaluate(Frames[objcop->currframe].BDYS[20].w);
  7032.         b[4]=Evaluate(Frames[objcop->currframe].BDYS[20].h);
  7033.         b[5]=Evaluate(Frames[objcop->currframe].BDYS[20].z_w);
  7034.  
  7035.         b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
  7036.         b[0]+=objcop->facing==0 ? objcop->posx : objcop->posx-(IMGS[objcop->gridn].clip[0].w);
  7037.         b[1]+=objcop->posy;
  7038.         b[2]+=objcop->posz;
  7039.  
  7040.         b[0]-=objcop->total_fx;
  7041.         b[3]+=objcop->total_fx;
  7042.         b[4]+=objcop->total_fy;
  7043.         b[2]-=objcop->total_fz;
  7044.         b[5]+=objcop->total_fz;
  7045.  
  7046.         if(Collision_Occurs_Rect(b,r) && objcop->posy <= r[1])
  7047.         {
  7048.             if (objcop->facing == target_objcop->facing)  //if there  is target back goto
  7049.             {
  7050.                 if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto!="4321")
  7051.                 {
  7052.                     objcop->previousframe=objcop->currframe;
  7053.                     objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto);
  7054.                     objcop->newframe=true;
  7055.                 }
  7056.             }
  7057.             else                                                      //if there  is target front goto
  7058.             {
  7059.                 if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto!="4321")
  7060.                 {
  7061.                     objcop->previousframe=objcop->currframe;
  7062.                     objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto);
  7063.                     objcop->newframe=true;
  7064.                 }
  7065.             }
  7066.             objcop->GROUNDPOS=r[1];
  7067.             objcop->posy=(float)objcop->GROUNDPOS;
  7068.         }
  7069.     }
  7070.     if (!Frames[objcop->currframe].flags[14]&&LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[5]
  7071.        )
  7072.     {
  7073.         b[0]=Evaluate(Frames[objcop->currframe].BDYS[20].x);
  7074.         b[1]=Evaluate(Frames[objcop->currframe].BDYS[20].y);
  7075.         b[2]=Evaluate(Frames[objcop->currframe].BDYS[20].z);
  7076.         b[3]=Evaluate(Frames[objcop->currframe].BDYS[20].w);
  7077.         b[4]=Evaluate(Frames[objcop->currframe].BDYS[20].h);
  7078.         b[5]=Evaluate(Frames[objcop->currframe].BDYS[20].z_w);
  7079.  
  7080.         b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
  7081.         b[0]+=objcop->facing==0 ? objcop->posx : objcop->posx-(IMGS[objcop->gridn].clip[0].w);
  7082.         b[1]+=objcop->posy;
  7083.         b[2]+=objcop->posz;
  7084.  
  7085.  
  7086.         //b[0]-=objcop->total_fx;
  7087.         b[3]+=objcop->total_fx;
  7088.         b[2]-=objcop->total_fz;
  7089.         b[5]+=objcop->total_fz;
  7090.         if(Collision_Occurs_Rect(b,r)&&objcop->GROUNDPOS!=r[1])
  7091.         {
  7092.             if (objcop->posx-objcop->total_fx<r[0])
  7093.             {
  7094.                 objcop->posx=r[0]-(width/2)-2;
  7095.             }
  7096.             else if(objcop->posx-objcop->total_fx>r[0]+r[3])
  7097.             {
  7098.                 objcop->posx=r[0]+r[3]+(width/2)+2;
  7099.             }
  7100.  
  7101.             if (objcop->posz-objcop->total_fz<r[2])
  7102.             {
  7103.                 objcop->posz=r[2]-6-2;
  7104.             }
  7105.             else if(objcop->posz-objcop->total_fz>r[2]+r[5])
  7106.             {
  7107.                 objcop->posz=r[2]+r[5]+6+2;
  7108.             }
  7109.         }
  7110.     }
  7111. }
  7112.  
  7113. void object::Collision_Related(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[])
  7114. {
  7115.     if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[6]&&!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[5] && ((LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rctdnsty=="4321" ||
  7116.             target_objcop->rectdensity[rect_index] < Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rctdnsty))))
  7117.     {
  7118.         int effx, effy;
  7119.         int b[6];
  7120.         for (int bdy_index=0; bdy_index < Frames[objcop->currframe].bdyindx; bdy_index++)
  7121.         {
  7122.             if (Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flg)==Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].flg)
  7123.  
  7124.                )
  7125.             {
  7126.                 b[0]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].x);
  7127.                 b[1]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].y);
  7128.                 b[2]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].z);
  7129.                 b[3]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].w);
  7130.                 b[4]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].h);
  7131.                 b[5]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].z_w);
  7132.  
  7133.                 b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
  7134.                 b[0]+=objcop->facing==0 ? objcop->posx-Eval(objcop, Frames[objcop->currframe].center_X) : objcop->posx-(IMGS[objcop->gridn].clip[0].w-Eval(objcop, Frames[objcop->currframe].center_X));
  7135.                 b[1]+=objcop->posy-Eval(objcop, Frames[objcop->currframe].center_Y);
  7136.                 b[2]+=objcop->posz;
  7137.  
  7138.                 effx= target_objcop->facing==0? b[0]:b[0]+b[3];
  7139.                 effy= r[1]+(r[4]/2);
  7140.  
  7141.                 if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]!="4321")
  7142.                 {
  7143.                     if (target_objcop->facing==0)
  7144.                         effx+=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]);
  7145.                     else
  7146.                         effx-=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]);
  7147.                     effy+=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[1]);
  7148.                 }
  7149.  
  7150.                 if (Collision_Occurs_Rect(b, r)||(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12]))
  7151.                 {
  7152.  
  7153.                     if(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12])
  7154.                     {
  7155.                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rmtid!="4321" &&
  7156.                                 Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rmtid)!=objcop->onscreen_id)
  7157.                         {
  7158.                             break;
  7159.                         }
  7160.                     }
  7161.  
  7162.  
  7163.  
  7164.                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[9]||LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[8])
  7165.                     {
  7166.                         target_objcop->posx=objcop->posx;
  7167.                     }
  7168.                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[10]||LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[8])
  7169.                     {
  7170.                         target_objcop->posy=objcop->posy;
  7171.                     }
  7172.                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[11]||LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[8])
  7173.                     {
  7174.                         target_objcop->posz=objcop->posz;
  7175.                     }
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.                     int defendstate=0; //0: nodefend, 1: defend, 2: shaken defend, 3:broken defend
  7183.                     objcop->caught=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[2]; //send to catching state if flag
  7184.                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")  //set the curse_id stuff
  7185.                     {
  7186.                         objcop->curse_id=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid);
  7187.                         LOADED->CATCHINGIDS[objcop->curse_id][6]=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].c_timer=="4321"?4321:Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].c_timer);
  7188.                         LOADED->CATCHINGIDS[objcop->curse_id][5]=target_objcop->facing;
  7189.                     }
  7190.                     target_objcop->rectdensity[rect_index]=target_objcop->rectdensity[rect_index]==4321?4321:target_objcop->rectdensity[rect_index]+1; //rect_density stuff
  7191.  
  7192.                     if (objcop->lasthitby!=target_objcop->onscreen_id || objcop->hitcounter==0)
  7193.                     {
  7194.                         if (Frames[objcop->currframe].flags[2])
  7195.                         {
  7196.                             objcop->currdp= objcop->currdp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].strength)>=0?objcop->currdp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].strength):0;
  7197.                             if (objcop->currdp==0)
  7198.                             {
  7199.                                 defendstate=3;
  7200.                             }
  7201.                             else if(Frames[objcop->currframe].BDYS[bdy_index].bdgdp!="4321" && Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].bdgdp)>=objcop->currdp
  7202.                                     || (objcop->currdp < (float)maxdp/3.0&&Frames[objcop->currframe].BDYS[bdy_index].bdgdp=="4321"))
  7203.                             {
  7204.                                 defendstate=2;
  7205.                             }
  7206.                             else
  7207.                             {
  7208.                                 defendstate=1;
  7209.                             }
  7210.                         }
  7211.                         if (defendstate==0 ||defendstate==3)
  7212.                         {
  7213.                             objcop->currkp= objcop->currkp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].knock   )>=0?objcop->currkp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].knock   ):0;
  7214.                             objcop->currhp= objcop->currhp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].damage  )>=0?objcop->currhp-Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].damage  ):0;
  7215.                         }
  7216.                         else
  7217.                         {
  7218.                             float hpnow= objcop->currhp - (    Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].damage)  -  ((float)Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].damage)*(float)Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].rsstvty)/100.)   );
  7219.                             objcop->currhp=hpnow>=0.?hpnow:0;
  7220.                         }
  7221.                         if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[7])
  7222.                         {
  7223.  
  7224.                             objcop->lasthitby=target_objcop->onscreen_id;
  7225.                             target_objcop->lasthit=objcop->onscreen_id;
  7226.                             objcop->hitcounter=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].hitfreq);
  7227.                         }
  7228.  
  7229.                         if (defendstate==0 || defendstate==3)
  7230.                         {
  7231.                             if (Frames[objcop->currframe].BDYS[bdy_index].reggy!="4321")  //set regs in bdys
  7232.                             {
  7233.                                 std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  7234.                                 std::string regas=Frames[objcop->currframe].BDYS[bdy_index].reggy;
  7235.                                 std::string regasvals=Frames[objcop->currframe].BDYS[bdy_index].reggyval;
  7236.  
  7237.                                 for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
  7238.                                 {
  7239.                                     if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
  7240.                                     {
  7241.                                         regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
  7242.                                     }
  7243.                                     else if(regas.find("$")==std::string::npos)
  7244.                                     {
  7245.                                         break;
  7246.                                     }
  7247.                                 }
  7248.                                 size_t vertposition;
  7249.                                 while (regas.find("|")!=std::string::npos)
  7250.                                 {
  7251.                                     if (regasvals.find("||")!=std::string::npos)
  7252.                                     {
  7253.                                         vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
  7254.                                     }
  7255.                                     if (objcop->followerID!=4321)
  7256.                                     {
  7257.                                         LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7258.                                         regas.erase(0, regas.find("|")+1);
  7259.                                         regasvals.erase(0, vertposition+1);
  7260.                                     }
  7261.                                     else
  7262.                                     {
  7263.                                         objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7264.                                     }
  7265.                                     regas.erase(0, regas.find("|")+1);
  7266.                                     regasvals.erase(0, vertposition+1);
  7267.                                 }
  7268.                                 if (objcop->followerID!=4321)
  7269.                                 {
  7270.                                     LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
  7271.                                 }
  7272.                                 else
  7273.                                 {
  7274.                                     objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
  7275.                                 }
  7276.                             }
  7277.  
  7278.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggy!="4321")  //set_target_reg in rects
  7279.                             {
  7280.                                 std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  7281.  
  7282.                                 std::string regas=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggy;
  7283.                                 std::string regasvals=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggyval;
  7284.  
  7285.                                 for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
  7286.                                 {
  7287.                                     if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
  7288.                                     {
  7289.                                         regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
  7290.                                     }
  7291.                                     else if(regas.find("$")==std::string::npos)
  7292.                                     {
  7293.                                         break;
  7294.                                     }
  7295.                                 }
  7296.                                 size_t vertposition;
  7297.                                 while (regas.find("|")!=std::string::npos)
  7298.                                 {
  7299.                                     if (regasvals.find("||")!=std::string::npos)
  7300.                                     {
  7301.                                         vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
  7302.                                     }
  7303.                                     if (objcop->followerID!=4321)
  7304.                                     {
  7305.                                         LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7306.                                         regas.erase(0, regas.find("|")+1);
  7307.                                         regasvals.erase(0, vertposition+1);
  7308.                                     }
  7309.                                     else
  7310.                                     {
  7311.                                         objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7312.                                     }
  7313.                                     regas.erase(0, regas.find("|")+1);
  7314.                                     regasvals.erase(0, vertposition+1);
  7315.                                 }
  7316.                                 if (objcop->followerID!=4321)
  7317.                                 {
  7318.                                     LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(target_objcop, regasvals);
  7319.                                 }
  7320.                                 else
  7321.                                 {
  7322.                                     objcop->regs[Evaluate(regas)]=Eval(target_objcop, regasvals);
  7323.                                 }
  7324.                             }
  7325.  
  7326.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copydst!="4321")  //copy_target in rects
  7327.                             {
  7328.                                 std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  7329.  
  7330.                                 std::string regas=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copydst;
  7331.                                 std::string regasvals=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copysrc;
  7332.  
  7333.                                 for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
  7334.                                 {
  7335.                                     if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
  7336.                                     {
  7337.                                         regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
  7338.                                     }
  7339.                                     else if(regas.find("$")==std::string::npos)
  7340.                                     {
  7341.                                         break;
  7342.                                     }
  7343.                                 }
  7344.                                 size_t vertposition;
  7345.                                 while (regas.find("|")!=std::string::npos)
  7346.                                 {
  7347.                                     if (regasvals.find("||")!=std::string::npos)
  7348.                                     {
  7349.                                         vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
  7350.                                     }
  7351.                                     if (objcop->followerID!=4321)
  7352.                                     {
  7353.                                         LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7354.                                         regas.erase(0, regas.find("|")+1);
  7355.                                         regasvals.erase(0, vertposition+1);
  7356.                                     }
  7357.                                     else
  7358.                                     {
  7359.                                         objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
  7360.                                     }
  7361.                                     regas.erase(0, regas.find("|")+1);
  7362.                                     regasvals.erase(0, vertposition+1);
  7363.                                 }
  7364.                                 if (objcop->followerID==4321)
  7365.                                 {
  7366.                                     if (target_objcop->followerID==4321)
  7367.                                     {
  7368.                                         target_objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
  7369.                                     }
  7370.                                     else
  7371.                                     {
  7372.                                         LOADED->ON_SCREEN_REAL_OBJS[target_objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
  7373.                                     }
  7374.                                 }
  7375.                                 else
  7376.                                 {
  7377.                                     if (target_objcop->followerID==4321)
  7378.                                     {
  7379.                                         target_objcop->regs[Evaluate(regas)]=Eval(&LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID], regasvals);
  7380.                                     }
  7381.                                     else
  7382.                                     {
  7383.                                         LOADED->ON_SCREEN_REAL_OBJS[target_objcop->followerID].regs[Evaluate(regas)]=Eval(&LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID], regasvals);
  7384.                                     }
  7385.                                 }
  7386.                             }
  7387.  
  7388.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct!="0")   //X IMPACT
  7389.                             {
  7390.                                 if (target_objcop->facing ==0)
  7391.                                 {
  7392.                                     objcop->total_fx=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct);
  7393.                                 }
  7394.                                 else
  7395.                                 {
  7396.                                     objcop->total_fx=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)*-1;
  7397.                                 }
  7398.                             }
  7399.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y_impct!="0")   //Y IMPACT
  7400.                             {
  7401.                                 objcop->total_fy=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y_impct);
  7402.                             }
  7403.                         }
  7404.                         else if(defendstate==2)
  7405.                         {
  7406.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct!="0")   //X IMPACT
  7407.                             {
  7408.                                 if (target_objcop->facing ==0)
  7409.                                 {
  7410.                                     objcop->total_fx=(float)Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)-                      ((float)Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)*    (float)Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].inrt)/100.);
  7411.                                 }
  7412.                                 else
  7413.                                 {
  7414.                                     objcop->total_fx=(float)Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)-                      ((float)Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)*    (float)Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].inrt)/100.);
  7415.                                     objcop->total_fx*=-1.;
  7416.                                 }
  7417.                             }
  7418.                         }
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.                         if (defendstate==0 || defendstate==3)
  7425.                         {
  7426.                             if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[7])
  7427.                             {
  7428.  
  7429.                                 if (Frames[objcop->currframe].BDYS[bdy_index].respond!="4321")   //BODY HOLDER SHOUDL GO TO IF RESPOND IS THERE:
  7430.                                 {
  7431.                                     objcop->previousframe=objcop->currframe;
  7432.                                     objcop->currframe=Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].respond);
  7433.                                     objcop->newframe=true;
  7434.                                 }
  7435.                                 else if(objcop->currkp<=0)
  7436.                                 {
  7437.                                     objcop->previousframe=objcop->currframe;
  7438.                                     objcop->currframe=knocked;
  7439.                                     objcop->currkp=maxkp;
  7440.                                     objcop->newframe=true;
  7441.                                     objcop->total_fx= objcop->total_fy==0 && objcop->total_fx==0?15:objcop->total_fx;
  7442.                                     objcop->total_fy=objcop->total_fy==0?-7:objcop->total_fy;
  7443.                                 }
  7444.                                 else if((maxkp-objcop->currkp)>70)
  7445.                                 {
  7446.                                     objcop->previousframe=objcop->currframe;
  7447.                                     objcop->currframe=objcop->facing!=target_objcop->facing?falling:fallingb;
  7448.                                     objcop->newframe=true;
  7449.                                     objcop->total_fx= objcop->total_fy==0 && objcop->total_fx==0?15:objcop->total_fx;
  7450.                                     objcop->total_fy=objcop->total_fy==0?-7:objcop->total_fy;
  7451.                                 }
  7452.                                 else
  7453.                                 {
  7454.                                     objcop->previousframe=objcop->currframe;
  7455.                                     objcop->currframe= objcop->facing+target_objcop->facing%2==1?whenhit:whenhitb;
  7456.                                     objcop->newframe=true;
  7457.  
  7458.                                 }
  7459.                                 if (objcop->facing == target_objcop->facing)  //if there  is target back goto
  7460.                                 {
  7461.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto!="4321")
  7462.                                     {
  7463.                                         objcop->previousframe=objcop->currframe;
  7464.                                         objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto);
  7465.                                         objcop->newframe=true;
  7466.                                         if(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7467.                                         {
  7468.  
  7469.                                             LOADED->CATCHINGIDS[Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][1]=
  7470.                                                 objcop->currframe;
  7471.                                         }
  7472.                                     }
  7473.                                 }
  7474.                                 else                                                      //if there  is target front goto
  7475.                                 {
  7476.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto!="4321")
  7477.                                     {
  7478.                                         objcop->previousframe=objcop->currframe;
  7479.                                         objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto);
  7480.                                         objcop->newframe=true;
  7481.                                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7482.                                         {
  7483.  
  7484.                                             LOADED->CATCHINGIDS[Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][0]=
  7485.                                                 objcop->currframe;
  7486.                                         }
  7487.                                     }
  7488.                                 }
  7489.                             }
  7490.  
  7491.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x!="4321")
  7492.                             {
  7493.                                 if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)!=4321)
  7494.                                 {
  7495.                                     if (target_objcop->facing==0)
  7496.                                     {
  7497.                                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7498.                                         {
  7499.                                             LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=
  7500.                                                 target_objcop->posx+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)-
  7501.                                                 Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
  7502.  
  7503.                                         }
  7504.                                         objcop->posx=target_objcop->posx+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)-
  7505.                                                      Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
  7506.                                     }
  7507.                                     else
  7508.                                     {
  7509.                                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7510.                                         {
  7511.                                             LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=
  7512.                                                 target_objcop->posx-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)+
  7513.                                                 Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
  7514.                                         }
  7515.                                         objcop->posx=target_objcop->posx-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)+
  7516.                                                      Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
  7517.                                     }
  7518.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7519.                                         LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=objcop->posx;
  7520.                                 }
  7521.  
  7522.                             }
  7523.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y!="4321")
  7524.                             {
  7525.                                 if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)!=4321)
  7526.                                 {
  7527.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7528.                                     {
  7529.                                         LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][3]=
  7530.                                             target_objcop->posy+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)-
  7531.                                             Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
  7532.                                     }
  7533.                                     objcop->posy=target_objcop->posy+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)-
  7534.                                                  Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
  7535.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7536.                                         LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][3]=objcop->posy;
  7537.                                 }
  7538.                             }
  7539.                             if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z!="4321")
  7540.                             {
  7541.                                 if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z)!=4321)
  7542.                                 {
  7543.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7544.                                     {
  7545.                                         LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][4]=
  7546.                                             target_objcop->posz+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z);
  7547.                                     }
  7548.                                     objcop->posz=target_objcop->posz+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z);
  7549.                                     if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
  7550.                                         LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][4]=objcop->posz;
  7551.                                 }
  7552.                             }
  7553.  
  7554.                         }
  7555.  
  7556.                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12])
  7557.                         {
  7558.                             effx=objcop->posx;
  7559.                             effy=objcop->posy-(height/2);
  7560.                         }
  7561.  
  7562.                         if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[3])  // if flag NOEFFECT is off:
  7563.                         {
  7564.                             if (defendstate==3 || defendstate==0)
  7565.                             {
  7566.                                 target_objcop->hit_xNO= stringify(Eval(objcop, target_objcop->hit_xNO)+1);
  7567.                                 if(LOADED->HITSYS)
  7568.                                 {
  7569.                                     //CallObj(1010, 10, effx-(LOADED->OBJECTS[1010].hittxtwidth), effy-50, objcop->posz, 0, objcop->team, LOADED);//"HITX text
  7570.                                     for (int digit=0; digit<target_objcop->hit_xNO.length(); digit++)
  7571.                                     {
  7572.                                         //CallObj(1010, Eval(objcop, target_objcop->hit_xNO.substr(digit, 1)), effx+(LOADED->OBJECTS[1010].hitnowidth*digit), effy-50, objcop->posz, 0, objcop->team, LOADED);
  7573.                                     }
  7574.                                 }
  7575.                                 int framenddd=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].effectf);
  7576.                                 int paras[]= {1000+Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].effect), Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].effectf), effx, effy, objcop->posz, target_objcop->facing, objcop->team, 4321, 0, 0, 0};
  7577.                                 CallObj(paras, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].flags);
  7578.                             }
  7579.                             else
  7580.                             {
  7581.                                 int paras[]= {1001, 0, effx, effy, objcop->posz, target_objcop->facing, objcop->team, 4321, 0, 0, 0};
  7582.  
  7583.                                 CallObj(paras, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].flags);
  7584.                             }
  7585.                         }
  7586.                         if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].sccss!="4321")  //SUCCESS
  7587.                         {
  7588.                             target_objcop->previousframe=target_objcop->currframe;
  7589.                             target_objcop->currframe=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].sccss);
  7590.                             target_objcop->newframe=true;
  7591.                         }
  7592.                     }
  7593.                 }
  7594.             }
  7595.         }
  7596.     }
  7597. }
  7598.  
  7599.  
  7600. int object::Eval(objcopy *objcop, std::string liny)
  7601. {
  7602.     std::string line=liny;
  7603.     std::string vars[]= {"x_pos", "y_pos", "z_pos", "bg_width", "bg_zwidth", "curr_hp", "curr_sp", "curr_rp", "max_hp", "max_sp", "max_rp", "pi", "bg_zstart", "facing", "screen_id", "follower_id",\
  7604.                          "x_vel", "y_vel", "z_vel", "height", "width", "curr_frm", "id", "p_origin_x", "p_origin_y"
  7605.                         };
  7606.     std::string regs="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  7607.     std::string funcs1arg[]= {"sin", "cos", "tan", "cosec", "sec", "cot", "factorial", "2root", "3root"};
  7608.     std::string funcs2arg[]= {"resultant", "randint"};
  7609.     int s_thevars[]= {objcop->posx, objcop->posy, objcop->posz, LOADED->BACKGROUNDS[LOADED->CURRBG].xboundwidth, LOADED->BACKGROUNDS[LOADED->CURRBG].zboundwidth, objcop->currhp, objcop->currsp, objcop->currrp, maxhp, maxsp, maxrp,
  7610.                       M_PI, LOADED->BACKGROUNDS[LOADED->CURRBG].zbound, objcop->facing, objcop->onscreen_id, objcop->followerID, objcop->total_fx, objcop->total_fy, objcop->total_fz, height, width, objcop->currframe, objcop->id,
  7611.                       LOADED->_playermenuorigins[(objcop->playerno)*2], LOADED->_playermenuorigins[1+((objcop->playerno)*2)]
  7612.                      };
  7613.     if (line.find("$j$")!=std::string::npos)
  7614.     {
  7615.         int abcd=11;
  7616.     }
  7617.     if (line.find("$")!=std::string::npos)
  7618.     {
  7619.  
  7620.         for (int reg=0; reg<52; reg++)
  7621.         {
  7622.             if (objcop->followerID==4321)
  7623.             {
  7624.                 while (line.find("$"+regs.substr(reg, 1)+"$")!= std::string::npos)
  7625.                 {
  7626.                     line = line.replace(line.find("$"), 3, stringify(objcop->regs[reg]));
  7627.                 }
  7628.             }
  7629.             else
  7630.             {
  7631.                 while (line.find("$"+regs.substr(reg, 1)+"$")!= std::string::npos)
  7632.                 {
  7633.                     line = line.replace(line.find("$"+regs.substr(reg, 1)+"$"), 3, stringify(LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[reg]));
  7634.                 }
  7635.             }
  7636.         }
  7637.         while (line.find("$G_")!=std::string::npos)
  7638.         {
  7639.             std::string greg=line.substr(line.find("G_")+2, line.find("$", line.find("G_"))-(line.find("G_")+2));
  7640.             line=line.replace(line.find("$G_"), 4+greg.length(), stringify(LOADED->GLOBALREGS[Evaluate(greg)]));
  7641.         }
  7642.         /*while (line.find("$G_"+regs.substr(reg, 1)+"$")!= std::string::npos){
  7643.             //line = line.replace(line.find("$"), 3, std::stringify(objcop->regs[reg]));
  7644.             line = line.replace(line.find("$"), 3, std::stringify(LOADED->GLOBALREGS[greg]));
  7645.         }*/
  7646.     }
  7647.     /*for (int greg=0; greg<650; greg++){
  7648.         while  (line.find("$"+stringify(greg)+"$")!= std::string::npos){
  7649.             line = line.replace(line.find("$"), 3, std::stringify(LOADED->GLOBALREGS[greg]));
  7650.         }
  7651.     }*/
  7652.     if (line.find("@")!=std::string::npos)
  7653.     {
  7654.         for (int var=0; var<25; var++)
  7655.         {
  7656.             while (line.find("@"+vars[var]+"@")!= std::string::npos)
  7657.             {
  7658.                 line = line.replace(line.find("@"+vars[var]+"@"), vars[var].length()+2, stringify(s_thevars[var]));
  7659.             }
  7660.             //while (line.find("@farthest^"))
  7661.         }
  7662.     }
  7663.     line=Evaluayh(line);
  7664.     //conditionalz
  7665.     while (line.find("~")!=std::string::npos)
  7666.     {
  7667.         int temp1=line.rfind("~");
  7668.         int temp3=line.find(";", temp1);
  7669.         std::string temp2=line.substr(temp1+1,temp3-temp1);
  7670.  
  7671.         std::string temp4=temp2.substr(0, temp2.find("?", temp1));
  7672.         if (BEvaluate(Evaluayh(temp4)))
  7673.         {
  7674.             line.replace(temp1, temp3-temp1+1, line.substr(line.find("?", temp1)+1, line.find(":", temp1)-line.find("?", temp1)-1) );
  7675.         }
  7676.         else
  7677.         {
  7678.             line.replace(temp1, temp3-temp1+1, line.substr(line.find(":", temp1)+1, line.find(";", temp1)-line.find(":", temp1)-1) );
  7679.         }
  7680.     }
  7681.  
  7682.     /*while (line.find("}")!=std::string::npos && line.find("&")!=string.npos){
  7683.         for (int func1=0; func1<9; func1++){
  7684.             if (funcs1arg[func1]==line.substr(line.rfind("{")-funcs1arg[func1].length(), funcs1arg[func1].length()+1)  ){
  7685.                 switch(func1){
  7686.                     case 0: line.replace(line.rfind("{")-funcs1arg[func1].length()-1, line.find("}")-line.rfind("{")-funcs1arg[func1].length()-1, std::stringify(sin(Evaluate( substr( line.rfind("{")+1, line.find ) ))))
  7687.                 }
  7688.             }
  7689.         }
  7690.     }*/
  7691.     return Evaluate(line);
  7692. }
  7693. /*
  7694. void object::Update(objcopy *objcop){
  7695.      Adopt_Data(objcop);
  7696.      Update_Frame_If_Time(objcop);
  7697.      CallObject(objcop);
  7698.      Apply_FRICTION(objcop);
  7699.      Apply_GRAVITY(objcop);
  7700.      Regenerate_Deplete_Stuff(objcop);
  7701.      Set_IMG_No_On_Current_Grid(objcop);
  7702.      if (objcop->newid){
  7703.         objcop->newid=false;
  7704.         return;
  7705.      }
  7706.      Collision_Related(objcop);
  7707.      Apply_loop(objcop);
  7708.      Apply_max_limit_vx(objcop);
  7709.      Apply_max_limit_vy(objcop);
  7710.      Apply_f_x(objcop);
  7711.      Apply_f_y(objcop);
  7712.      Apply_f_z(objcop);
  7713.      Apply_x_z_hold_distance(objcop);
  7714.      Apply_acc(objcop);
  7715.      Respond_ToInput(objcop);
  7716.      Basic_Stand_Walk_Dash(objcop);
  7717.      Basic_Jump(objcop);
  7718.      Apply_max_limit_vx(objcop);
  7719.      Move(objcop->total_fx, 'x',objcop);
  7720.      Move(objcop->total_fy, 'y',objcop);
  7721.      Move(objcop->total_fz, 'z',objcop);
  7722.  
  7723. }
  7724. */
  7725. void object::Update(objcopy *objcop)
  7726. {
  7727.     Respond_ToInput(objcop);
  7728.     Adopt_Data(objcop);
  7729.     Update_Frame_If_Time(objcop);
  7730.     CallObject(objcop);
  7731.     Apply_FRICTION(objcop);
  7732.     Apply_GRAVITY(objcop);
  7733.     Regenerate_Deplete_Stuff(objcop);
  7734.     Set_IMG_No_On_Current_Grid(objcop);
  7735.  
  7736.     if (objcop->newid)
  7737.     {
  7738.         objcop->newid=false;
  7739.         return;
  7740.     }
  7741.     Apply_loop(objcop);
  7742.     //Collision_Related(objcop);
  7743.     Apply_max_limit_vx(objcop);
  7744.     Apply_max_limit_vy(objcop);
  7745.     Apply_f_x(objcop);
  7746.     Apply_f_y(objcop);
  7747.     Apply_f_z(objcop);
  7748.     Apply_x_z_hold_distance(objcop);
  7749.     Apply_acc(objcop);
  7750.     Basic_Stand_Walk_Dash(objcop);
  7751.     Basic_Jump(objcop);
  7752.     Apply_max_limit_vx(objcop);
  7753.     Move(objcop->total_fx, 'x',objcop);
  7754.     Move(objcop->total_fy, 'y',objcop);
  7755.     Move(objcop->total_fz, 'z',objcop);
  7756.  
  7757. }
  7758.  
  7759. void object::UpdateStat(objcopy *objcop)
  7760. {
  7761.     Respond_ToInput(objcop);
  7762.     Adopt_Data(objcop);
  7763.     Update_Frame_If_Time(objcop);
  7764.     CallObject(objcop);
  7765.     Apply_FRICTION(objcop);
  7766.     Apply_GRAVITY(objcop);
  7767.     Regenerate_Deplete_Stuff(objcop);
  7768.     Set_IMG_No_On_Current_Grid(objcop);
  7769.     if (objcop->newid)
  7770.     {
  7771.         objcop->newid=false;
  7772.         return;
  7773.     }
  7774.     Apply_loop(objcop);
  7775. }
  7776. void object::CheckCollision(objcopy *objcop)
  7777. {
  7778.     int r[6];
  7779.     int r_centerX;
  7780.     if (!Frames[objcop->currframe].flags[13])  //If |IGNORERECT| switch is off
  7781.     {
  7782.         for (int object_index=0; object_index < LOADED->ON_SCREEN_OBJCOUNT; object_index++)
  7783.         {
  7784.             objcopy* target_objcop=&LOADED->ON_SCREEN_REAL_OBJS[object_index];
  7785.             if((Frames[objcop->currframe].flags[20] || target_objcop->team!=objcop->team||LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].flags[20]) && target_objcop->onscreen_id!=objcop->onscreen_id)
  7786.             {
  7787.                 if (!target_objcop->deleted&&target_objcop->currframe!=4321 && objcop->currframe!=4321)
  7788.                 {
  7789.                     for (int rect_index=0; rect_index < LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].rectindx; rect_index++)
  7790.                     {
  7791.                         r_centerX=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
  7792.                         r[0]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x);
  7793.                         r[1]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y);
  7794.                         r[2]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].z);
  7795.                         r[3]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].w);
  7796.                         r[4]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].h);
  7797.                         r[5]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].z_w);
  7798.  
  7799.                         r[0] = target_objcop->facing==1 ? LOADED->OBJECTS[target_objcop->id].IMGS[target_objcop->gridn].clip[0].w-r[0]-r[3] : r[0];
  7800.                         r[0] +=target_objcop->facing==0 ? target_objcop->posx-r_centerX : target_objcop->posx-(LOADED->OBJECTS[target_objcop->id].IMGS[target_objcop->gridn].clip[0].w-r_centerX);
  7801.                         r[1] +=target_objcop->posy-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
  7802.                         r[2] +=target_objcop->posz;
  7803.                         Platforming_Solid(objcop, target_objcop, rect_index, r);
  7804.                         Collision_Related(objcop, target_objcop, rect_index, r);
  7805.                     }
  7806.                 }
  7807.             }
  7808.         }
  7809.     }
  7810. }
  7811. void object::UpdateMove(objcopy *objcop)
  7812. {
  7813.     Apply_max_limit_vx(objcop);
  7814.     Apply_max_limit_vy(objcop);
  7815.     Apply_f_x(objcop);
  7816.     Apply_f_y(objcop);
  7817.     Apply_f_z(objcop);
  7818.     Apply_x_z_hold_distance(objcop);
  7819.     Apply_acc(objcop);
  7820.     Basic_Stand_Walk_Dash(objcop);
  7821.     Apply_max_limit_vx(objcop);
  7822.     Move(objcop->total_fx, 'x',objcop);
  7823.     Move(objcop->total_fy, 'y',objcop);
  7824.     Move(objcop->total_fz, 'z',objcop);
  7825.  
  7826. }
  7827.  
  7828. void object::LiteUpdate(objcopy *objcop)
  7829. {
  7830.     Respond_ToInput(objcop);
  7831.     Update_Frame_If_Time(objcop);
  7832.     CallObject(objcop);
  7833.     Apply_FRICTION(objcop);
  7834.     Apply_GRAVITY(objcop);
  7835.     Set_IMG_No_On_Current_Grid(objcop);
  7836.     Apply_loop(objcop);
  7837.     Apply_max_limit_vx(objcop);
  7838.     Apply_max_limit_vy(objcop);
  7839.     Apply_f_x(objcop);
  7840.     Apply_f_y(objcop);
  7841.     Apply_f_z(objcop);
  7842.     \
  7843.     Apply_x_z_hold_distance(objcop);
  7844.     Apply_acc(objcop);
  7845.     Apply_max_limit_vx(objcop);
  7846.     Move(objcop->total_fx, 'x',objcop);
  7847.     Move(objcop->total_fy, 'y',objcop);
  7848.     Move(objcop->total_fz, 'z',objcop);
  7849. }
  7850. /*-------------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement