Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==========Object.cpp===========
- #define GL_GLEXT_PROTOTYPES
- #define GLEW_STATIC
- #include <iostream>
- #include <algorithm>
- #include <math.h>
- #include <stdlib.h>
- #include <time.h>
- #include <string>
- #include <vector>
- #include <fstream>
- #include <sstream>
- //#include <glew.h>
- #include "SDL.h"
- #include "SDL_image.h"
- //#include <GL/glext.h>
- #include "SDL_opengl.h"
- #include "globals.h"
- #include "Eval.h"
- #include "Object.h"
- int CAM[]= {0, 0, 0};
- int CAMV[]= {0, 0, 0};
- int GetPowerOf2(int num)
- {
- if( num != 0 )
- {
- num--;
- num |= (num >> 1);
- num |= (num >> 2);
- num |= (num >> 4);
- num |= (num >> 8);
- num |= (num >> 16);
- num++;
- }
- return num;
- }
- SDL_Color translate_color(Uint32 int_color)
- {
- #if SDL_BYTEORDER == SDL_BIG_ENDIAN
- SDL_Color color= {(int_color & 0x00ff0000)/0x10000,(int_color &
- 0x0000ff00)/0x100,(int_color & 0x000000ff),(int_color & 0xff000000)/0x1000000
- };
- #else
- SDL_Color color= {(int_color & 0x000000ff),(int_color &
- 0x0000ff00)/0x100,(int_color & 0x00ff0000)/0x10000,(int_color & 0xff000000)/0x1000000
- };
- #endif
- return color;
- }
- void DrawCircle(float cx, float cy, float r, int num_segments, float color[], int flag)
- {
- float theta = 2 * 3.1415926 / float(num_segments);
- float tangetial_factor = tanf(theta);//calculate the tangential factor
- float radial_factor = cosf(theta);//calculate the radial factor
- float x = r;//we start at angle = 0
- float y = 0;
- glColor4f(color[0]/255.f, color[1]/255.f, color[2]/255.f, color[3]/255.f);
- switch (flag)
- {
- case 2:
- glBegin(GL_LINE_STRIP);
- glLineWidth(1.f);
- break;
- default:
- glBegin(GL_POLYGON);
- glLineWidth(10.f);
- break;
- }
- //glLineWidth(30.f);
- for(int ii = 0; ii < num_segments; ii++)
- {
- glVertex2f(x + cx, y + cy);//output vertex
- //calculate the tangential std::vector
- //remember, the radial std::vector is (x, y)
- //to get the tangential std::vector we flip those coordinates and negate one of them
- float tx = -y;
- float ty = x;
- //add the tangential std::vector
- x += tx * tangetial_factor;
- y += ty * tangetial_factor;
- //correct using the radial factor
- x *= radial_factor;
- y *= radial_factor;
- }
- glEnd();
- glColor4f(1.f, 1.f, 1.f, 1.f);
- }
- bool Collision_Occurs_Rect(int b[], int r[]) //[0]=x,[1]=y,[2]=z,[3]=width,[4]=height,[5]=depth
- {
- if (r[0] <= b[0]+b[3] && b[0] <= r[0]+r[3] &&
- r[1] <= b[1]+b[4] && b[1] <= r[1]+r[4] &&
- r[2] <= b[2]+b[5] && b[2] <= r[2]+r[5])
- return true;
- else
- return false;
- }
- objcopy copy_object(objcopy old_)
- {
- objcopy new_;
- new_.id=old_.id;
- new_.team=old_.team;
- new_.facing=old_.facing;
- new_.iscom=true;
- new_.posx=old_.posx;
- new_.posy=old_.posy;
- new_.posz=old_.posz;
- new_.total_fx=old_.total_fx;
- new_.total_fy=old_.total_fy;
- new_.total_fz=old_.total_fz;
- new_.GRAVITY=old_.GRAVITY;
- new_.FRICTION=old_.FRICTION;
- for (int a=0; a<52; a++) new_.regs[a]=old_.regs[a];
- return new_;
- }
- bdy::bdy()
- {
- exists=false;
- }
- void bdy::init(std::string framelinee)
- {
- exists=true;
- int positions[14];
- std::string tempao;
- std::string maintag="set_bdy[";
- std::string tags[] = {"x=", "y=", "z=", "w=", "h=", "d=", "block=", "respond=", "flag=", "resistivity=", "inertia=", "budge_dp=", "set_reg=", "set_effector_reg="};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- if (frameline.find(tags[9])!=std::string::npos)
- {
- positions[9] = frameline.find(tags[9])+tags[9].length();
- }
- else
- {
- positions[9]=0;
- }
- if (frameline.find(tags[10])!=std::string::npos)
- {
- positions[10] = frameline.find(tags[10])+tags[10].length();
- }
- else
- {
- positions[10]=0;
- }
- if (frameline.find(tags[11])!=std::string::npos)
- {
- positions[11] = frameline.find(tags[11])+tags[11].length();
- }
- else
- {
- positions[11]=0;
- }
- if (frameline.find(tags[12])!=std::string::npos)
- {
- positions[12] = frameline.find(tags[12])+tags[12].length();
- }
- else
- {
- positions[12]=0;
- }
- if (frameline.find(tags[13])!=std::string::npos)
- {
- positions[13] = frameline.find(tags[13])+tags[13].length();
- }
- else
- {
- positions[13]=0;
- }
- bool isvar=false, isfunc=false, isreg=false;
- for (int ice=0; ice < 14; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 0:
- if (frameline.find(tags[0])!=std::string::npos)
- {
- x=tempao;
- }
- else
- {
- x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- y=tempao;
- }
- else
- {
- y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- z=tempao;
- }
- else
- {
- z="-6";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- w=tempao;
- }
- else
- {
- w="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- h=tempao;
- }
- else
- {
- h="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- z_w=tempao;
- }
- else
- {
- z_w="12";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- block=tempao;
- }
- else
- {
- block="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- respond=tempao;
- }
- else
- {
- respond="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- flg=tempao;
- }
- else
- {
- flg="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 9:
- if (frameline.find(tags[9])!=std::string::npos)
- {
- rsstvty=tempao;
- }
- else
- {
- rsstvty="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 10:
- if (frameline.find(tags[10])!=std::string::npos)
- {
- inrt=tempao;
- }
- else
- {
- inrt="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 11:
- if (frameline.find(tags[11])!=std::string::npos)
- {
- bdgdp=tempao;
- }
- else
- {
- bdgdp="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 12:
- if (frameline.find(tags[12])!=std::string::npos)
- {
- reggy=tempao.substr(0, tempao.find(","));
- reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- reggy="4321";
- reggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 13:
- if (frameline.find(tags[13])!=std::string::npos)
- {
- effreggy=tempao.substr(0, tempao.find(","));
- effreggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- effreggy="4321";
- effreggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- }
- rect::rect()
- {
- exists=false;
- }
- void rect::init(std::string framelinee)
- {
- exists=true;
- int positions[29];
- std::string tempao;
- std::string maintag="set_rect[";
- std::string tags[] = {"x=", "y=", "z=", "w=", "h=", "d=", "success=", "damage=", "x_impact=", "y_impact=", "z_impact=", "hit_frequency=", "effect=",
- "strength=", "knock=", "front_target_goto=", "back_target_goto=", "x_target=", "y_target=", "z_target=", "set_curse_id=", "rect_density=", "curse_period=",
- "flag=", "set_reg=", "set_target_reg=", "remote_id=", "copy_target_reg=", "x_y_z_effect_translate="
- };
- std::string flagslist[]= {"|HITFALLING|", "|HITFALLINGX|", "|CATCHING|", "|NOEFFECT|", "|NOSOUND|", "|SOLIDRECT|", "|PLATFORMRECT|", "|GHOSTRECT|", "|STICKYRECT|", "|STICKYRECTX|", "|STICKYRECTY|", "|STICKYRECTZ|", "|REMOTERECT|", "|SOLIDRECT|"};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- for (int a=0; a<14; a++)
- {
- if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- if (frameline.find(tags[9])!=std::string::npos)
- {
- positions[9] = frameline.find(tags[9])+tags[9].length();
- }
- else
- {
- positions[9]=0;
- }
- if (frameline.find(tags[10])!=std::string::npos)
- {
- positions[10] = frameline.find(tags[10])+tags[10].length();
- }
- else
- {
- positions[10]=0;
- }
- if (frameline.find(tags[11])!=std::string::npos)
- {
- positions[11] = frameline.find(tags[11])+tags[11].length();
- }
- else
- {
- positions[11]=0;
- }
- if (frameline.find(tags[12])!=std::string::npos)
- {
- positions[12] = frameline.find(tags[12])+tags[12].length();
- }
- else
- {
- positions[12]=0;
- }
- if (frameline.find(tags[13])!=std::string::npos)
- {
- positions[13] = frameline.find(tags[13])+tags[13].length();
- }
- else
- {
- positions[13]=0;
- }
- if (frameline.find(tags[14])!=std::string::npos)
- {
- positions[14] = frameline.find(tags[14])+tags[14].length();
- }
- else
- {
- positions[14]=0;
- }
- if (frameline.find(tags[15])!=std::string::npos)
- {
- positions[15] = frameline.find(tags[15])+tags[15].length();
- }
- else
- {
- positions[15]=0;
- }
- if (frameline.find(tags[16])!=std::string::npos)
- {
- positions[16] = frameline.find(tags[16])+tags[16].length();
- }
- else
- {
- positions[16]=0;
- }
- if (frameline.find(tags[17])!=std::string::npos)
- {
- positions[17] = frameline.find(tags[17])+tags[17].length();
- }
- else
- {
- positions[17]=0;
- }
- if (frameline.find(tags[18])!=std::string::npos)
- {
- positions[18] = frameline.find(tags[18])+tags[18].length();
- }
- else
- {
- positions[18]=0;
- }
- if (frameline.find(tags[19])!=std::string::npos)
- {
- positions[19] = frameline.find(tags[19])+tags[19].length();
- }
- else
- {
- positions[19]=0;
- }
- if (frameline.find(tags[20])!=std::string::npos)
- {
- positions[20] = frameline.find(tags[20])+tags[20].length();
- }
- else
- {
- positions[20]=0;
- }
- if (frameline.find(tags[21])!=std::string::npos)
- {
- positions[21] = frameline.find(tags[21])+tags[21].length();
- }
- else
- {
- positions[21]=0;
- }
- if (frameline.find(tags[22])!=std::string::npos)
- {
- positions[22] = frameline.find(tags[22])+tags[22].length();
- }
- else
- {
- positions[22]=0;
- }
- if (frameline.find(tags[23])!=std::string::npos)
- {
- positions[23] = frameline.find(tags[23])+tags[23].length();
- }
- else
- {
- positions[23]=0;
- }
- if (frameline.find(tags[24])!=std::string::npos)
- {
- positions[24] = frameline.find(tags[24])+tags[24].length();
- }
- else
- {
- positions[24]=0;
- }
- if (frameline.find(tags[25])!=std::string::npos)
- {
- positions[25] = frameline.find(tags[25])+tags[25].length();
- }
- else
- {
- positions[25]=0;
- }
- if (frameline.find(tags[26])!=std::string::npos)
- {
- positions[26] = frameline.find(tags[26])+tags[26].length();
- }
- else
- {
- positions[26]=0;
- }
- if (frameline.find(tags[27])!=std::string::npos)
- {
- positions[27] = frameline.find(tags[27])+tags[27].length();
- }
- else
- {
- positions[27]=0;
- }
- if (frameline.find(tags[28])!=std::string::npos)
- {
- positions[28] = frameline.find(tags[28])+tags[28].length();
- }
- else
- {
- positions[28]=0;
- }
- bool isvar=false;
- bool isfunc=false;
- bool isreg=false;
- for (int ice=0; ice < 29; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 0:
- if (frameline.find(tags[0])!=std::string::npos)
- {
- x=tempao;
- }
- else
- {
- x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- y=tempao;
- }
- else
- {
- y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- z=tempao;
- }
- else
- {
- z="-6";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- w=tempao;
- }
- else
- {
- w="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- h=tempao;
- }
- else
- {
- h="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- z_w=tempao;
- }
- else
- {
- z_w="12";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- sccss=tempao;
- }
- else
- {
- sccss="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- damage=tempao;
- }
- else
- {
- damage="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- x_impct=tempao;
- }
- else
- {
- x_impct="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 9:
- if (frameline.find(tags[9])!=std::string::npos)
- {
- y_impct=tempao;
- }
- else
- {
- y_impct="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 10:
- if (frameline.find(tags[10])!=std::string::npos)
- {
- z_impct=tempao;
- }
- else
- {
- z_impct="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 11:
- if (frameline.find(tags[11])!=std::string::npos)
- {
- hitfreq=tempao;
- }
- else
- {
- hitfreq="6";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 12:
- if (frameline.find(tags[12])!=std::string::npos)
- {
- if (tempao.find(",")!=std::string::npos)
- {
- effect=tempao.substr(0, tempao.find(","));
- effectf=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- effect=tempao;
- effectf="0";
- }
- }
- else
- {
- effect="0";
- effectf="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 13:
- if (frameline.find(tags[13])!=std::string::npos)
- {
- strength=tempao;
- }
- else
- {
- strength="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 14:
- if (frameline.find(tags[14])!=std::string::npos)
- {
- knock=tempao;
- }
- else
- {
- knock="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 15:
- if (frameline.find(tags[15])!=std::string::npos)
- {
- tfgoto=tempao;
- }
- else
- {
- tfgoto="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 16:
- if (frameline.find(tags[16])!=std::string::npos)
- {
- tbgoto=tempao;
- }
- else
- {
- tbgoto="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 17:
- if (frameline.find(tags[17])!=std::string::npos)
- {
- t_x=tempao;
- }
- else
- {
- t_x="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 18:
- if (frameline.find(tags[18])!=std::string::npos)
- {
- t_y=tempao;
- }
- else
- {
- t_y="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 19:
- if (frameline.find(tags[19])!=std::string::npos)
- {
- t_z=tempao;
- }
- else
- {
- t_z="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 20:
- if (frameline.find(tags[20])!=std::string::npos)
- {
- crsid=tempao;
- }
- else
- {
- crsid="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 21:
- if (frameline.find(tags[21])!=std::string::npos)
- {
- rctdnsty=tempao;
- }
- else
- {
- rctdnsty="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 22:
- if (frameline.find(tags[22])!=std::string::npos)
- {
- c_timer=tempao;
- }
- else
- {
- c_timer="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 23:
- if (frameline.find(tags[23])!=std::string::npos)
- {
- flg=tempao;
- }
- else
- {
- flg="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 24:
- if (frameline.find(tags[24])!=std::string::npos)
- {
- reggy=tempao.substr(0, tempao.find(","));
- reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- reggy="4321";
- reggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 25:
- if (frameline.find(tags[25])!=std::string::npos)
- {
- tarreggy=tempao.substr(0, tempao.find(","));
- tarreggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- tarreggy="4321";
- tarreggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 26:
- if (frameline.find(tags[26])!=std::string::npos)
- {
- rmtid=tempao;
- }
- else
- {
- rmtid="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 27:
- if (frameline.find(tags[27])!=std::string::npos)
- {
- copydst=tempao.substr(0, tempao.find(","));
- copysrc=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- copydst="4321";
- copysrc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 28:
- if (frameline.find(tags[28])!=std::string::npos)
- {
- trans[0]=tempao.substr(0, tempao.find(","));
- trans[1]=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(",")-1);
- trans[2]=tempao.substr(tempao.rfind(",")+1);
- }
- else
- {
- trans[0]="4321";
- trans[1]="4321";
- trans[2]="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- }
- combination::combination()
- {
- exists=false;
- }
- void combination::init(std::string framelinee)
- {
- exists=true;
- int positions[5];
- std::string tempao;
- std::string maintag="set_combination[";
- std::string tags[] = {"sequence=", "time_interval=", "delay=", "goto=", "set_reg="};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- 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>",
- "h<a>", "h<d>", "h<j>", "h<s>", "h<f>", "h<b>", "h<u_a>", "h<d_a>", "h<l_a>", "h<r_a>"
- };
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- bool isvar=false, isfunc=false, isreg=false;
- for (int ice=1; ice < 5; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- time_interval=tempao;
- }
- else
- {
- time_interval="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- delay=tempao;
- }
- else
- {
- delay="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- nxt=tempao;
- }
- else
- {
- nxt="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- reggy=tempao.substr(0, tempao.find(","));
- reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- reggy="4321";
- reggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- input=frameline.substr(frameline.find("(", positions[0]), frameline.find(")", positions[0])+1-frameline.find("(", positions[0]));
- int temp0=input.find(" ");
- while(temp0!=std::string::npos)
- {
- input.erase (temp0, 1); //clear spaces
- temp0=input.find(" ", temp0);
- }
- for (int b=0; b<20; b++)
- {
- while(input.find(inputparas[b])!=std::string::npos)input.replace(input.find(inputparas[b]), inputparas[b].length(), stringify(b));
- }
- int tempinputseq[6];
- for (int b=0; b<6 && input.length()>2; b++)
- {
- if (input.find(",")!=std::string::npos)
- {
- inputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(",")-input.find("(")));
- tempinputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(",")-input.find("(")));
- input.erase(input.find("(")+1, input.find(",")-input.find("("));
- depth++;
- }
- else
- {
- inputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(")")-input.find("(")));
- tempinputseq[b]=Evaluate(input.substr(input.find("(")+1, input.find(")")-input.find("(")));
- input.erase(input.find("(")+1, input.find(")")-input.find("("));
- depth++;
- }
- }
- for (int c=0; c<depth; c++)
- {
- inputseq[c]=tempinputseq[(depth-1)-c];
- }
- }
- drawshape::drawshape()
- {
- exists=false;
- }
- void drawshape::init(std::string framelinee)
- {
- exists=true;
- int positions[15];
- std::string tempao;
- std::string maintag="draw_shape[";
- std::string tags[] = {"x=", "y=", "z=", "x_radius=", "y_radius=", "w=", "h=", "d=", "colorRGBA=", "border_width=", "fill_color=", "start_angle=", "arc_angle=", "vertices=", "condition="};
- std::string flagslist[]= {"|ELLIPSE|", "|RECTANGLE|", "|ARC|", "|POLYGON|"};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- for (int a=0; a<4; a++)
- {
- if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- if (frameline.find(tags[9])!=std::string::npos)
- {
- positions[9] = frameline.find(tags[9])+tags[9].length();
- }
- else
- {
- positions[9]=0;
- }
- if (frameline.find(tags[10])!=std::string::npos)
- {
- positions[10] = frameline.find(tags[10])+tags[10].length();
- }
- else
- {
- positions[10]=0;
- }
- if (frameline.find(tags[11])!=std::string::npos)
- {
- positions[11] = frameline.find(tags[11])+tags[11].length();
- }
- else
- {
- positions[11]=0;
- }
- if (frameline.find(tags[12])!=std::string::npos)
- {
- positions[12] = frameline.find(tags[12])+tags[12].length();
- }
- else
- {
- positions[12]=0;
- }
- if (frameline.find(tags[13])!=std::string::npos)
- {
- positions[13] = frameline.find(tags[13])+tags[13].length();
- }
- else
- {
- positions[13]=0;
- }
- if (frameline.find(tags[14])!=std::string::npos)
- {
- positions[14] = frameline.find(tags[14])+tags[14].length();
- }
- else
- {
- positions[14]=0;
- }
- bool isvar=false, isfunc=false, isreg=false;
- for (int ice=0; ice < 15; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 0:
- if (frameline.find(tags[0])!=std::string::npos)
- {
- x=tempao;
- }
- else
- {
- x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- y=tempao;
- }
- else
- {
- y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- z=tempao;
- }
- else
- {
- z="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- x_r=tempao;
- }
- else
- {
- x_r="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- y_r=tempao;
- }
- else
- {
- y_r="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- w=tempao;
- }
- else
- {
- w="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- h=tempao;
- }
- else
- {
- h="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- d=tempao;
- }
- else
- {
- d="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- color[0]=tempao.substr(0, tempao.find(","));
- color[1]=tempao.substr(tempao.find(",")+1, tempao.find(",", tempao.find(",")+1)-tempao.find(",")-1);
- color[2]=tempao.substr(tempao.rfind(",", tempao.rfind(",")-1)+1, tempao.rfind(",")-tempao.rfind(",", tempao.rfind(",")-1)-1);
- color[3]=tempao.substr(tempao.rfind(",")+1);
- }
- else
- {
- color[0]="0";
- color[1]="0";
- color[2]="0";
- color[3]="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 9:
- if (frameline.find(tags[9])!=std::string::npos)
- {
- border_width=tempao;
- }
- else
- {
- border_width="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 10:
- if (frameline.find(tags[10])!=std::string::npos)
- {
- fill_color=tempao;
- }
- else
- {
- fill_color="0xFFFFFFFF";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 11:
- if (frameline.find(tags[11])!=std::string::npos)
- {
- strt_angle=tempao;
- }
- else
- {
- strt_angle="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 12:
- if (frameline.find(tags[12])!=std::string::npos)
- {
- arc_angle=tempao;
- }
- else
- {
- arc_angle="360";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 13:
- if (frameline.find(tags[13])!=std::string::npos)
- {
- vertices=tempao;
- }
- else
- {
- vertices="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 14:
- if (frameline.find(tags[14])!=std::string::npos)
- {
- cndtn=tempao;
- }
- else
- {
- cndtn="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- }
- callobject::callobject()
- {
- exists=false;
- }
- void callobject::init(std::string framelinee)
- {
- exists=true;
- int positions[14];
- std::string tempao;
- std::string maintag="call_object[";
- 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="};
- std::string flagslist[]= {"|FACINGBACK|", "|ATTACHEDBODY|", "|CLONE|", "|NOEFFECT|", "|NOSOUND|", "|SHAREREGS|", "|KEYSCONTROL|"};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- std::string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- for (int a=0; a<7; a++)
- {
- if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- if (frameline.find(tags[9])!=std::string::npos)
- {
- positions[9] = frameline.find(tags[9])+tags[9].length();
- }
- else
- {
- positions[9]=0;
- }
- if (frameline.find(tags[10])!=std::string::npos)
- {
- positions[10] = frameline.find(tags[10])+tags[10].length();
- }
- else
- {
- positions[10]=0;
- }
- if (frameline.find(tags[11])!=std::string::npos)
- {
- positions[11] = frameline.find(tags[11])+tags[11].length();
- }
- else
- {
- positions[11]=0;
- }
- if (frameline.find(tags[12])!=std::string::npos)
- {
- positions[12] = frameline.find(tags[12])+tags[12].length();
- }
- else
- {
- positions[12]=0;
- }
- if (frameline.find(tags[13])!=std::string::npos)
- {
- positions[13] = frameline.find(tags[13])+tags[13].length();
- }
- else
- {
- positions[13]=0;
- }
- bool isvar=false, isfunc=false, isreg=false;
- for (int ice=0; ice < 14; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 0:
- if (frameline.find(tags[0])!=std::string::npos)
- {
- x=tempao;
- }
- else
- {
- x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- y=tempao;
- }
- else
- {
- y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- z=tempao;
- }
- else
- {
- z="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- id=tempao;
- }
- else
- {
- id="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- qntty=tempao;
- }
- else
- {
- qntty="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- f_x=tempao;
- }
- else
- {
- f_x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- f_y=tempao;
- }
- else
- {
- f_y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- f_z=tempao;
- }
- else
- {
- f_z="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- xhlddstnc=tempao;
- }
- else
- {
- xhlddstnc="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 9:
- if (frameline.find(tags[9])!=std::string::npos)
- {
- zhlddstnc=tempao;
- }
- else
- {
- zhlddstnc="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 10:
- if (frameline.find(tags[10])!=std::string::npos)
- {
- frm=tempao;
- }
- else
- {
- frm="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 11:
- if (frameline.find(tags[11])!=std::string::npos)
- {
- delay=tempao;
- }
- else
- {
- delay="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 12:
- if (frameline.find(tags[12])!=std::string::npos)
- {
- reggy=tempao.substr(0, tempao.find(","));
- reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- reggy="4321";
- reggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 13:
- if (frameline.find(tags[13])!=std::string::npos)
- {
- cndtn=tempao;
- }
- else
- {
- cndtn="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- }
- void frame::init(std::string frameline, int no_)
- {
- exists=true;
- no=no_;
- bool validchar;
- int positions[51];
- std::string tempao;
- BDYS.resize(21);
- RECTS.resize(20);
- COMBINATIONS.resize(20);
- CALLOBJECTS.resize(20);
- DRAWSHAPES.resize(20);
- while (frameline.find("set_bdy[")!=std::string::npos)
- {
- BDYS[bdyindx].init(frameline);
- frameline.erase(BDYS[bdyindx].startpos, BDYS[bdyindx].endpos - BDYS[bdyindx].startpos);
- bdyindx++;
- }
- while (frameline.find("set_rect[")!=std::string::npos)
- {
- RECTS[rectindx].init(frameline);
- frameline.erase(RECTS[rectindx].startpos, RECTS[rectindx].endpos - RECTS[rectindx].startpos);
- rectindx++;
- }
- while (frameline.find("set_combination[")!=std::string::npos)
- {
- COMBINATIONS[combinationindx].init(frameline);
- frameline.erase(COMBINATIONS[combinationindx].startpos, COMBINATIONS[combinationindx].endpos - COMBINATIONS[combinationindx].startpos);
- combinationindx++;
- }
- while (frameline.find("call_object[")!=std::string::npos)
- {
- CALLOBJECTS[callobjectindx].init(frameline);
- frameline.erase(CALLOBJECTS[callobjectindx].startpos, CALLOBJECTS[callobjectindx].endpos - CALLOBJECTS[callobjectindx].startpos);
- callobjectindx++;
- }
- while (frameline.find("draw_shape[")!=std::string::npos)
- {
- DRAWSHAPES[drawshapeindx].init(frameline);
- frameline.erase(DRAWSHAPES[drawshapeindx].startpos, DRAWSHAPES[drawshapeindx].endpos - DRAWSHAPES[drawshapeindx].startpos);
- drawshapeindx++;
- }
- std::string tags[] = {"img=", "delay=", "goto=", "alpha=", "center=", "x_vel=", "y_vel=", "z_vel=", "loop=", "x_acc=",
- "z_hold_distance=","x_hold_distance=", "acc_x_hold=", "acc_z_hold=", "max_vx_limit=",
- "max_vy_limit=", "max_vz_limit=", "counter=", "add_hp=", "add_sp=", "add_rp=",
- "c<a>=", "c<j>=", "c<d>=", "c<s>=", "h<a>=", "h<j>=", "h<d>=", "h<s>=", "c<b>=", "h<b>=", /*31*/
- "hit_ground=", "c<f>=", "c<u_a>=", "c<d_a>=", "h<f>=", "h<u_a>=", "h<d_a>=", "c<r_a>=", "c<l_a>=",
- "h<r_a>=", "h<l_a>=", "translate_x_y_z=", "set_reg=", "x_adopt=", "y_adopt=", "z_adopt=", "state=",
- "air_resistance=", "rendering_priority=", "y_acc="
- };
- std::string menuflagslist[]= {"|NEXTCHOOSE|", "|NEXTPLAYERMENU|", "|NEXTSTANCE|", "|BACKDISJOIN|", "|BACKHIGHLIGHT|", "|BACKCHOOSE|",
- "|BACKPLAYERMENU|", "|BACKSTANCE|", "|DISJOIN|", "|SHOWSTANCE|", "|HIGHLIGHT|"
- };
- std::string flagslist[]= {"|STANDING|","|WALKING|", "|DEFENDING|", "|ALLOWTURN|", "|REGENDPMAX|", "|REGENKPMAX|", "|REGENSP|",
- "|REGENRP|", "|NOSHADOW|", "|NOBARS|", "|NOHPBAR|", "|NOSPBAR|", "|NORPBAR|", "|IGNORERECT|", "|IGNOREPLATFORM|", "|PLATFORMONLY|",
- "|DEAD|", "|FLUSHCOMBINATION|", "|CHANGEFACING|", "|HIDESHADOW|", "|UNIVERSAL|", "|IGNOREGRAVITY|", "|RENDERBACK|"
- };
- for (int a=0; a<23; a++)
- {
- if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
- }
- for (int a=0; a<11; a++)
- {
- if (frameline.find(menuflagslist[a])!=std::string::npos) menuflags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- if (frameline.find(tags[9])!=std::string::npos)
- {
- positions[9] = frameline.find(tags[9])+tags[9].length();
- }
- else
- {
- positions[9]=0;
- }
- if (frameline.find(tags[10])!=std::string::npos)
- {
- positions[10] = frameline.find(tags[10])+tags[10].length();
- }
- else
- {
- positions[10]=0;
- }
- if (frameline.find(tags[11])!=std::string::npos)
- {
- positions[11] = frameline.find(tags[11])+tags[11].length();
- }
- else
- {
- positions[11]=0;
- }
- if (frameline.find(tags[12])!=std::string::npos)
- {
- positions[12] = frameline.find(tags[12])+tags[12].length();
- }
- else
- {
- positions[12]=0;
- }
- if (frameline.find(tags[13])!=std::string::npos)
- {
- positions[13] = frameline.find(tags[13])+tags[13].length();
- }
- else
- {
- positions[13]=0;
- }
- if (frameline.find(tags[14])!=std::string::npos)
- {
- positions[14] = frameline.find(tags[14])+tags[14].length();
- }
- else
- {
- positions[14]=0;
- }
- if (frameline.find(tags[15])!=std::string::npos)
- {
- positions[15] = frameline.find(tags[15])+tags[15].length();
- }
- else
- {
- positions[15]=0;
- }
- if (frameline.find(tags[16])!=std::string::npos)
- {
- positions[16] = frameline.find(tags[16])+tags[16].length();
- }
- else
- {
- positions[16]=0;
- }
- if (frameline.find(tags[17])!=std::string::npos)
- {
- positions[17] = frameline.find(tags[17])+tags[17].length();
- }
- else
- {
- positions[17]=0;
- }
- if (frameline.find(tags[18])!=std::string::npos)
- {
- positions[18] = frameline.find(tags[18])+tags[18].length();
- }
- else
- {
- positions[18]=0;
- }
- if (frameline.find(tags[19])!=std::string::npos)
- {
- positions[19] = frameline.find(tags[19])+tags[19].length();
- }
- else
- {
- positions[19]=0;
- }
- if (frameline.find(tags[20])!=std::string::npos)
- {
- positions[20] = frameline.find(tags[20])+tags[20].length();
- }
- else
- {
- positions[20]=0;
- }
- if (frameline.find(tags[21])!=std::string::npos)
- {
- positions[21] = frameline.find(tags[21])+tags[21].length();
- }
- else
- {
- positions[21]=0;
- }
- if (frameline.find(tags[22])!=std::string::npos)
- {
- positions[22] = frameline.find(tags[22])+tags[22].length();
- }
- else
- {
- positions[22]=0;
- }
- if (frameline.find(tags[23])!=std::string::npos)
- {
- positions[23] = frameline.find(tags[23])+tags[23].length();
- }
- else
- {
- positions[23]=0;
- }
- if (frameline.find(tags[24])!=std::string::npos)
- {
- positions[24] = frameline.find(tags[24])+tags[24].length();
- }
- else
- {
- positions[24]=0;
- }
- if (frameline.find(tags[25])!=std::string::npos)
- {
- positions[25] = frameline.find(tags[25])+tags[25].length();
- }
- else
- {
- positions[25]=0;
- }
- if (frameline.find(tags[26])!=std::string::npos)
- {
- positions[26] = frameline.find(tags[26])+tags[26].length();
- }
- else
- {
- positions[26]=0;
- }
- if (frameline.find(tags[27])!=std::string::npos)
- {
- positions[27] = frameline.find(tags[27])+tags[27].length();
- }
- else
- {
- positions[27]=0;
- }
- if (frameline.find(tags[28])!=std::string::npos)
- {
- positions[28] = frameline.find(tags[28])+tags[28].length();
- }
- else
- {
- positions[28]=0;
- }
- if (frameline.find(tags[29])!=std::string::npos)
- {
- positions[29] = frameline.find(tags[29])+tags[29].length();
- }
- else
- {
- positions[29]=0;
- }
- if (frameline.find(tags[30])!=std::string::npos)
- {
- positions[30] = frameline.find(tags[30])+tags[30].length();
- }
- else
- {
- positions[30]=0;
- }
- if (frameline.find(tags[31])!=std::string::npos)
- {
- positions[31] = frameline.find(tags[31])+tags[31].length();
- }
- else
- {
- positions[31]=0;
- }
- if (frameline.find(tags[32])!=std::string::npos)
- {
- positions[32] = frameline.find(tags[32])+tags[32].length();
- }
- else
- {
- positions[32]=0;
- }
- if (frameline.find(tags[33])!=std::string::npos)
- {
- positions[33] = frameline.find(tags[33])+tags[33].length();
- }
- else
- {
- positions[33]=0;
- }
- if (frameline.find(tags[34])!=std::string::npos)
- {
- positions[34] = frameline.find(tags[34])+tags[34].length();
- }
- else
- {
- positions[34]=0;
- }
- if (frameline.find(tags[35])!=std::string::npos)
- {
- positions[35] = frameline.find(tags[35])+tags[35].length();
- }
- else
- {
- positions[35]=0;
- }
- if (frameline.find(tags[36])!=std::string::npos)
- {
- positions[36] = frameline.find(tags[36])+tags[36].length();
- }
- else
- {
- positions[36]=0;
- }
- if (frameline.find(tags[37])!=std::string::npos)
- {
- positions[37] = frameline.find(tags[37])+tags[37].length();
- }
- else
- {
- positions[37]=0;
- }
- if (frameline.find(tags[38])!=std::string::npos)
- {
- positions[38] = frameline.find(tags[38])+tags[38].length();
- }
- else
- {
- positions[38]=0;
- }
- if (frameline.find(tags[39])!=std::string::npos)
- {
- positions[39] = frameline.find(tags[39])+tags[39].length();
- }
- else
- {
- positions[39]=0;
- }
- if (frameline.find(tags[40])!=std::string::npos)
- {
- positions[40] = frameline.find(tags[40])+tags[40].length();
- }
- else
- {
- positions[40]=0;
- }
- if (frameline.find(tags[41])!=std::string::npos)
- {
- positions[41] = frameline.find(tags[41])+tags[41].length();
- }
- else
- {
- positions[41]=0;
- }
- if (frameline.find(tags[42])!=std::string::npos)
- {
- positions[42] = frameline.find(tags[42])+tags[42].length();
- }
- else
- {
- positions[42]=0;
- }
- if (frameline.find(tags[43])!=std::string::npos)
- {
- positions[43] = frameline.find(tags[43])+tags[43].length();
- }
- else
- {
- positions[43]=0;
- }
- if (frameline.find(tags[44])!=std::string::npos)
- {
- positions[44] = frameline.find(tags[44])+tags[44].length();
- }
- else
- {
- positions[44]=0;
- }
- if (frameline.find(tags[45])!=std::string::npos)
- {
- positions[45] = frameline.find(tags[45])+tags[45].length();
- }
- else
- {
- positions[45]=0;
- }
- if (frameline.find(tags[46])!=std::string::npos)
- {
- positions[46] = frameline.find(tags[46])+tags[46].length();
- }
- else
- {
- positions[46]=0;
- }
- if (frameline.find(tags[47])!=std::string::npos)
- {
- positions[47] = frameline.find(tags[47])+tags[47].length();
- }
- else
- {
- positions[47]=0;
- }
- if (frameline.find(tags[48])!=std::string::npos)
- {
- positions[48] = frameline.find(tags[48])+tags[48].length();
- }
- else
- {
- positions[48]=0;
- }
- if (frameline.find(tags[49])!=std::string::npos)
- {
- positions[49] = frameline.find(tags[49])+tags[49].length();
- }
- else
- {
- positions[49]=0;
- }
- if (frameline.find(tags[50])!=std::string::npos)
- {
- positions[50] = frameline.find(tags[50])+tags[50].length();
- }
- else
- {
- positions[50]=0;
- }
- bool isvar=false, isfunc=false, isreg=false;
- for (int ice=0; ice < 51; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 0:
- if (frameline.find(tags[0])!=std::string::npos)
- {
- if (tempao.find(",")!=std::string::npos)
- {
- img=tempao.substr(0, tempao.find(","));
- grid=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- img=tempao;
- grid="4321";
- }
- }
- else
- {
- img="0";
- grid="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- delay=tempao;
- }
- else
- {
- delay="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- if (tempao.find(",")!=std::string::npos)
- {
- nxt=tempao.substr(0, tempao.find(","));
- nxtid=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- nxt=tempao;
- nxtid="4321";
- }
- }
- else
- {
- nxt=stringify(no+1);
- nxtid="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- if (frameline.find(tags[2])!=std::string::npos)
- {
- nxt=tempao;
- }
- else
- {
- nxt=stringify(no+1);
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- alpha=tempao;
- }
- else
- {
- alpha="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- center_X=tempao.substr(0, tempao.find(","));
- center_Y=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- center_X="0";
- center_Y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- f_x=tempao;
- }
- else
- {
- f_x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- f_y=tempao;
- }
- else
- {
- f_y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- f_z=tempao;
- }
- else
- {
- f_z="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- loop_length=tempao.substr(0, tempao.find(","));
- loop_condition=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(","));
- loop_goto=tempao.substr(tempao.rfind(",")+1);
- }
- else
- {
- loop_condition="4321";
- loop_length="4321";
- loop_goto="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 9:
- if (frameline.find(tags[9])!=std::string::npos)
- {
- acc=tempao;
- }
- else
- {
- acc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 10:
- if (frameline.find(tags[10])!=std::string::npos)
- {
- zhlddstnc=tempao;
- }
- else
- {
- zhlddstnc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 11:
- if (frameline.find(tags[11])!=std::string::npos)
- {
- xhlddstnc=tempao;
- }
- else
- {
- xhlddstnc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 12:
- if (frameline.find(tags[12])!=std::string::npos)
- {
- xhldacc=tempao;
- }
- else
- {
- xhldacc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 13:
- if (frameline.find(tags[13])!=std::string::npos)
- {
- zhldacc=tempao;
- }
- else
- {
- zhldacc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 14:
- if (frameline.find(tags[14])!=std::string::npos)
- {
- mxlmtvx=tempao;
- }
- else
- {
- mxlmtvx="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 15:
- if (frameline.find(tags[15])!=std::string::npos)
- {
- mxlmtvy=tempao;
- }
- else
- {
- mxlmtvy="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 16:
- if (frameline.find(tags[16])!=std::string::npos)
- {
- mxlmtvz=tempao;
- }
- else
- {
- mxlmtvz="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 17:
- if (frameline.find(tags[17])!=std::string::npos)
- {
- counter=tempao;
- }
- else
- {
- counter="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 18:
- if (frameline.find(tags[18])!=std::string::npos)
- {
- addhp=tempao;
- }
- else
- {
- addhp="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 19:
- if (frameline.find(tags[19])!=std::string::npos)
- {
- addsp=tempao;
- }
- else
- {
- addsp="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 20:
- if (frameline.find(tags[20])!=std::string::npos)
- {
- addrp=tempao;
- }
- else
- {
- addrp="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 21:
- if (frameline.find(tags[21])!=std::string::npos)
- {
- c_a=tempao;
- }
- else
- {
- c_a="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 22:
- if (frameline.find(tags[22])!=std::string::npos)
- {
- c_j=tempao;
- }
- else
- {
- c_j="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 23:
- if (frameline.find(tags[23])!=std::string::npos)
- {
- c_d=tempao;
- }
- else
- {
- c_d="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 24:
- if (frameline.find(tags[24])!=std::string::npos)
- {
- c_s=tempao;
- }
- else
- {
- c_s="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 25:
- if (frameline.find(tags[25])!=std::string::npos)
- {
- h_a=tempao;
- }
- else
- {
- h_a="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 26:
- if (frameline.find(tags[26])!=std::string::npos)
- {
- h_j=tempao;
- }
- else
- {
- h_j="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 27:
- if (frameline.find(tags[27])!=std::string::npos)
- {
- h_d=tempao;
- }
- else
- {
- h_d="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 28:
- if (frameline.find(tags[28])!=std::string::npos)
- {
- h_s=tempao;
- }
- else
- {
- h_s="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 29:
- if (frameline.find(tags[29])!=std::string::npos)
- {
- c_b=tempao;
- }
- else
- {
- c_b="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 30:
- if (frameline.find(tags[30])!=std::string::npos)
- {
- h_b=tempao;
- }
- else
- {
- h_b="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 31:
- if (frameline.find(tags[31])!=std::string::npos)
- {
- hitground=tempao;
- }
- else
- {
- hitground="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 32:
- if (frameline.find(tags[32])!=std::string::npos)
- {
- c_f=tempao;
- }
- else
- {
- c_f="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 33:
- if (frameline.find(tags[33])!=std::string::npos)
- {
- c_ua=tempao;
- }
- else
- {
- c_ua="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 34:
- if (frameline.find(tags[34])!=std::string::npos)
- {
- c_da=tempao;
- }
- else
- {
- c_da="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 35:
- if (frameline.find(tags[35])!=std::string::npos)
- {
- h_f=tempao;
- }
- else
- {
- h_f="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 36:
- if (frameline.find(tags[36])!=std::string::npos)
- {
- h_ua=tempao;
- }
- else
- {
- h_ua="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 37:
- if (frameline.find(tags[37])!=std::string::npos)
- {
- h_da=tempao;
- }
- else
- {
- h_da="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 38:
- if (frameline.find(tags[38])!=std::string::npos)
- {
- c_ra=tempao;
- }
- else
- {
- c_ra="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 39:
- if (frameline.find(tags[39])!=std::string::npos)
- {
- c_la=tempao;
- }
- else
- {
- c_la="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 40:
- if (frameline.find(tags[40])!=std::string::npos)
- {
- h_ra=tempao;
- }
- else
- {
- h_ra="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 41:
- if (frameline.find(tags[41])!=std::string::npos)
- {
- h_la=tempao;
- }
- else
- {
- h_la="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 42:
- if (frameline.find(tags[42])!=std::string::npos)
- {
- trans[0]=tempao.substr(0, tempao.find(","));
- trans[1]=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(",")-1);
- trans[2]=tempao.substr(tempao.rfind(",")+1);
- }
- else
- {
- trans[0]="4321";
- trans[1]="4321";
- trans[2]="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 43:
- if (frameline.find(tags[43])!=std::string::npos)
- {
- reggy=tempao.substr(0, tempao.find(","));
- reggyval=tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(","));
- }
- else
- {
- reggy="4321";
- reggyval="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 44:
- if (frameline.find(tags[44])!=std::string::npos)
- {
- adptx=tempao;
- }
- else
- {
- adptx="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 45:
- if (frameline.find(tags[45])!=std::string::npos)
- {
- adpty=tempao;
- }
- else
- {
- adpty="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 46:
- if (frameline.find(tags[46])!=std::string::npos)
- {
- adptz=tempao;
- }
- else
- {
- adptz="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 47:
- if (frameline.find(tags[47])!=std::string::npos)
- {
- state=tempao;
- }
- else
- {
- state="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 48:
- if (frameline.find(tags[48])!=std::string::npos)
- {
- arrsstnc=tempao;
- }
- else
- {
- arrsstnc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 49:
- if (frameline.find(tags[49])!=std::string::npos)
- {
- rndrngpriority=tempao;
- }
- else
- {
- rndrngpriority="4321";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 50:
- if (frameline.find(tags[50])!=std::string::npos)
- {
- yacc=tempao;
- }
- else
- {
- yacc="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- }
- void spritegrid::ini(std::string dir_, int w_, int h_, int col_, int row_, std::string colk_, int * number, int filtering)
- {
- SDL_Surface *_grid, *_grid_, *_non_power_of2_grid;
- GLenum tex_format;
- colk = colk_;
- unsigned int col1, col2, col3;
- if (colk_!=",-")
- {
- col1= strtol(("0x"+colk_.substr (3,2)).c_str(), NULL, 16);
- col2= strtol(("0x"+ colk_.substr (5,2)).c_str(),NULL, 16);
- col3= strtol(("0x"+ colk_.substr (7,2)).c_str(),NULL, 16);
- }
- *number+=row_*col_;
- col=col_;
- row=row_;
- frameno = row*col;
- clip.resize(frameno);
- clip_.resize(frameno);
- _non_power_of2_grid = IMG_Load((dir_).c_str());
- _grid_ = IMG_Load((dir_).c_str());
- w=w_==4321?_non_power_of2_grid->w:w_;
- h=h_==4321?_non_power_of2_grid->h:h_;
- // _grid_= SDL_LoadBMP((dir_.substr(0, dir_.rfind("\\")+1 ) +"mirror_" + dir_.substr( dir_.rfind("\\")+1 , dir_.rfind(".BMP")-dir_.rfind("\\")+1 )).c_str());
- gw=_non_power_of2_grid->w;
- gh=_non_power_of2_grid->h;
- int grid_h = (_non_power_of2_grid->h)/row;
- int grid_w = (_non_power_of2_grid->w)/col;
- _grid=_non_power_of2_grid;
- /*_grid = SDL_CreateRGBSurface( SDL_SWSURFACE, GetPowerOf2(gw), GetPowerOf2(gh),
- _non_power_of2_grid->format->BitsPerPixel, _non_power_of2_grid->format->Rmask,
- _non_power_of2_grid->format->Gmask, _non_power_of2_grid->format->Bmask, _non_power_of2_grid->format->Amask );
- ((unsigned int*)_grid->pixels)= ((unsigned int*)_non_power_of2_grid->pixels);*/
- for (int j=0; j<row; j++)
- {
- for (int i=0; i<col; i++)
- {
- SDL_Rect recto = {i*grid_w, j*grid_h, w, h};
- clip[(i+(col*j))] = recto;
- SDL_Rect recto2 = {((col-i)*grid_w)-grid_w+(grid_w-w), j*grid_h, w, h};
- clip_[i+(col*j)] = recto2;
- }
- }
- SDL_Color color;
- if (colk_!=",-")
- {
- for (int x = 0; x < _grid->w; x++)
- {
- for (int y = 0; y < _grid->h; y++)
- {
- unsigned int pix = ((unsigned int*)_grid->pixels)[y*(_grid->pitch/sizeof(unsigned int)) + x];
- color = translate_color(pix);
- if (color.r == col1 && color.g == col2 && color.b == col3)
- {
- ((unsigned int*)_grid->pixels)[y*(_grid->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid->format, 0, 0, 0, 0);
- }
- }
- }
- }
- for (int x = 0; x < _grid_->w; x++)
- {
- for (int y = 0; y < _grid_->h; y++)
- {
- unsigned int pix = ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x];
- color = translate_color(pix);
- int alph=color.a;
- int newalph=alph-100>0?alph-100:0;
- if (!(color.r == col1 && color.g == col2 && color.b == col3))
- {
- ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid_->format, 0, 0, 0, newalph);
- }
- else
- {
- ((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid_->format, 0, 0, 0, 0);
- }
- }
- }
- if (_grid->format->BytesPerPixel==4)
- {
- if (_grid->format->Rmask == 0x000000ff)
- tex_format=GL_RGBA;
- else
- tex_format=GL_BGRA;
- }
- else if (_grid->format->BytesPerPixel==3)
- {
- if (_grid->format->Rmask == 0x000000ff)
- tex_format=GL_RGB;
- else
- tex_format=GL_BGR;
- }
- glGenTextures(1, &grid);
- glBindTexture(GL_TEXTURE_2D, grid);
- if (filtering==0)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, _grid->format->BytesPerPixel, _grid->w, _grid->h,
- 0, tex_format, GL_UNSIGNED_BYTE, _grid->pixels);
- glGenTextures(1, &shad);
- glBindTexture(GL_TEXTURE_2D, shad);
- if (filtering==0)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, _grid_->format->BytesPerPixel, _grid_->w, _grid_->h,
- 0, tex_format, GL_UNSIGNED_BYTE, _grid_->pixels);
- //grid=SDL_CreateTextureFromSurface(MainRend, _grid);
- //grid_=SDL_CreateTextureFromSurface(MainRend, _grid_);
- SDL_FreeSurface(_grid);
- SDL_FreeSurface(_grid_);
- SDL_FreeSurface(_non_power_of2_grid);
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- void layer::init(std::string frameline, int no_)
- {
- exists=true;
- CALLOBJECTS.resize(20);
- no=no_;
- std::string tempao;
- int positions[9];
- IMG.resize(1);
- std::string tags[] = {"img=", "x_position=", "y_position=", "repeat_x=", "repeat_y=", "x_vel=", "y_vel=", "restart=", "delay="};
- std::string flagslist[]= {"|REPEATWITHREVERSE|"};
- for (int a=0; a<1; a++)
- {
- if (frameline.find(flagslist[a])!=std::string::npos) flags[a]=true;
- }
- while (frameline.find("call_object[")!=std::string::npos)
- {
- CALLOBJECTS[callobjectindx].init(frameline);
- frameline.erase(CALLOBJECTS[callobjectindx].startpos, CALLOBJECTS[callobjectindx].endpos - CALLOBJECTS[callobjectindx].startpos);
- callobjectindx++;
- }
- bool done=false;
- if (frameline.find(tags[0])!=std::string::npos)
- {
- positions[0] = frameline.find(tags[0])+tags[0].length();
- }
- else
- {
- positions[0]=0;
- }
- if (frameline.find(tags[1])!=std::string::npos)
- {
- positions[1] = frameline.find(tags[1])+tags[1].length();
- }
- else
- {
- positions[1]=0;
- }
- if (frameline.find(tags[2])!=std::string::npos)
- {
- positions[2] = frameline.find(tags[2])+tags[2].length();
- }
- else
- {
- positions[2]=0;
- }
- if (frameline.find(tags[3])!=std::string::npos)
- {
- positions[3] = frameline.find(tags[3])+tags[3].length();
- }
- else
- {
- positions[3]=0;
- }
- if (frameline.find(tags[4])!=std::string::npos)
- {
- positions[4] = frameline.find(tags[4])+tags[4].length();
- }
- else
- {
- positions[4]=0;
- }
- if (frameline.find(tags[5])!=std::string::npos)
- {
- positions[5] = frameline.find(tags[5])+tags[5].length();
- }
- else
- {
- positions[5]=0;
- }
- if (frameline.find(tags[6])!=std::string::npos)
- {
- positions[6] = frameline.find(tags[6])+tags[6].length();
- }
- else
- {
- positions[6]=0;
- }
- if (frameline.find(tags[7])!=std::string::npos)
- {
- positions[7] = frameline.find(tags[7])+tags[7].length();
- }
- else
- {
- positions[7]=0;
- }
- if (frameline.find(tags[8])!=std::string::npos)
- {
- positions[8] = frameline.find(tags[8])+tags[8].length();
- }
- else
- {
- positions[8]=0;
- }
- img=frameline.substr(positions[0]+1, frameline.find("\"", positions[0]+1)-positions[0]-1);
- int temparirora;
- spritegrid somegrid;
- somegrid.ini(img, 4321, 4321, 1, 1, ",-", &temparirora, 0);
- IMG[0]=somegrid;
- bool isvar=false, isreg=false, isfunc=false;
- for (int ice=1; ice < 9; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- done=false;
- while (isvar||isfunc||isreg||(!done&&(isdigit(frameline[food+positions[ice]]) || frameline.substr(food+positions[ice], 1)==","||frameline.substr(food+positions[ice], 1)=="-"
- ||frameline.substr(food+positions[ice], 1)=="+"||frameline.substr(food+positions[ice], 1)=="/"
- ||frameline.substr(food+positions[ice], 1)=="*"||frameline.substr(food+positions[ice], 1)=="("
- ||frameline.substr(food+positions[ice], 1)==")"||frameline.substr(food+positions[ice], 1)=="@"
- ||frameline.substr(food+positions[ice], 1)=="{"||frameline.substr(food+positions[ice], 1)=="}"
- ||frameline.substr(food+positions[ice], 1)=="$"||frameline.substr(food+positions[ice], 1)=="&"
- ||frameline.substr(food+positions[ice], 1)=="^"||frameline.substr(food+positions[ice], 1)=="?"
- ||frameline.substr(food+positions[ice], 1)=="%"||frameline.substr(food+positions[ice], 1)==":"
- ||frameline.substr(food+positions[ice], 1)==";"||frameline.substr(food+positions[ice], 1)=="~"
- ||frameline.substr(food+positions[ice], 1)=="="||frameline.substr(food+positions[ice], 1)==">"
- ||frameline.substr(food+positions[ice], 1)=="<")))
- {
- if (frameline.substr(food+positions[ice], 1)=="@") isvar=!isvar;
- if (frameline.substr(food+positions[ice], 1)=="&") isfunc=!isfunc;
- if (frameline.substr(food+positions[ice], 1)=="$") isreg=!isreg;
- tempao+=frameline.substr(food+positions[ice],1);
- if (!isvar&&!isfunc&&!isreg&&(!isdigit(frameline[food+positions[ice]+1])&&!(frameline[food+positions[ice]+1]==',') &&(!(frameline.substr(food+positions[ice]+1, 1)=="-")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="+")&&!(frameline.substr(food+positions[ice]+1, 1)=="*")&&!(frameline.substr(food+positions[ice]+1, 1)=="/")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="(")&&!(frameline.substr(food+positions[ice]+1, 1)==")")&&!(frameline.substr(food+positions[ice]+1, 1)=="@")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="{")&&!(frameline.substr(food+positions[ice]+1, 1)=="}")&&!(frameline.substr(food+positions[ice]+1, 1)=="$")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="&")&&!(frameline.substr(food+positions[ice]+1, 1)=="^")&&!(frameline.substr(food+positions[ice]+1, 1)=="?")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="%")&&!(frameline.substr(food+positions[ice]+1, 1)==":")&&!(frameline.substr(food+positions[ice]+1, 1)==";")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="~")&&!(frameline.substr(food+positions[ice]+1, 1)=="=")&&!(frameline.substr(food+positions[ice]+1, 1)==">")
- &&!(frameline.substr(food+positions[ice]+1, 1)=="<"))))
- {
- switch (ice)
- {
- case 1:
- if (frameline.find(tags[1])!=std::string::npos)
- {
- x=tempao;
- }
- else
- {
- x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 2:
- if (frameline.find(tags[2])!=std::string::npos)
- {
- y=tempao;
- }
- else
- {
- y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 3:
- if (frameline.find(tags[3])!=std::string::npos)
- {
- rptx=tempao;
- }
- else
- {
- rptx="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 4:
- if (frameline.find(tags[4])!=std::string::npos)
- {
- rpty=tempao;
- }
- else
- {
- rpty="1";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 5:
- if (frameline.find(tags[5])!=std::string::npos)
- {
- f_x=tempao;
- }
- else
- {
- f_x="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 6:
- if (frameline.find(tags[6])!=std::string::npos)
- {
- f_y=tempao;
- }
- else
- {
- f_y="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 7:
- if (frameline.find(tags[7])!=std::string::npos)
- {
- restart=tempao;
- }
- else
- {
- restart="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- case 8:
- if (frameline.find(tags[8])!=std::string::npos)
- {
- delay=tempao;
- }
- else
- {
- delay="0";
- }
- food=99999;
- done=true;
- tempao="";
- break;
- default:
- ;
- }
- }
- else
- {
- food++;
- }
- }
- }
- }
- posx=Evaluate(x);
- posy=Evaluate(y);
- }
- void background::init(int paraid, std::string dpndncs, std::string afildir)
- {
- LAYERS.resize(50);
- shadangx=0*(M_PI/180.0);
- shadangy=35*(M_PI/180.0);
- // SDL_Surface *backgroundSurf;
- // SDL_Surface *shadow_;
- // GLenum tex_format;
- /* bitmapfiledir = e;
- backgroundSurf = SDL_LoadBMP(("sys\\"+bitmapfiledir).c_str());
- //shadow_ = SDL_LoadBMP(("sys\\"+f).c_str());
- //shadowpos={(shadow_->w)/2, (shadow_->h)/2, shadow_->w, shadow_->h};
- //Uint32 colorkey = SDL_MapRGB( shadow_->format, 0x0, 0x0, 0x0 );
- //SDL_SetColorKey( shadow_, SDL_TRUE, colorkey );
- position={0, 0, backgroundSurf->w, backgroundSurf->h};
- //backgroundTex=SDL_CreateTextureFromSurface(MainRend, backgroundSurf);
- //shadow=SDL_CreateTextureFromSurface(MainRend, shadow_);
- if (backgroundSurf->format->BytesPerPixel==4){
- if (backgroundSurf->format->Rmask == 0x000000ff)tex_format=GL_RGBA;
- else tex_format=GL_BGRA;
- }else if (backgroundSurf->format->BytesPerPixel==3){
- if (backgroundSurf->format->Rmask == 0x000000ff)tex_format=GL_RGB;
- else tex_format=GL_BGR;
- }
- glGenTextures(1, &backgroundTex);
- glBindTexture(GL_TEXTURE_2D, backgroundTex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, backgroundSurf->format->BytesPerPixel, backgroundSurf->w, backgroundSurf->h,
- 0, tex_format, GL_UNSIGNED_BYTE, backgroundSurf->pixels);
- /* V_DATA [0].texCoord.x= 0;V_DATA [0].texCoord.y= 0;
- V_DATA [1].texCoord.x= 1;V_DATA [1].texCoord.y= 0;
- V_DATA [2].texCoord.x= 1;V_DATA [2].texCoord.y= 1;
- V_DATA [3].texCoord.x= 0;V_DATA [3].texCoord.y= 1;
- V_DATA [0].position.x= 0;V_DATA [0].position.y= 0;
- V_DATA [1].position.x= position.w;V_DATA [1].position.y= 0;
- V_DATA [2].position.x= position.w;V_DATA [2].position.y= position.h;
- V_DATA [3].position.x= 0;V_DATA [3].position.y= position.h;
- glGenBuffers(1, &VBO_ID);
- glBindBuffer(GL_ARRAY_BUFFER, VBO_ID);
- glBufferData(GL_ARRAY_BUFFER, 4*sizeof(GLuint), V_DATA, GL_DYNAMIC_DRAW );
- glGenBuffers(1, &IBO_ID);
- glBindBuffer(GL_ARRAY_BUFFER, IBO_ID);
- glBufferData(GL_ARRAY_BUFFER, 4*sizeof(GLuint), I_DATA, GL_DYNAMIC_DRAW );
- glBindBuffer( GL_ARRAY_BUFFER, NULL );
- glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, NULL );
- SDL_FreeSurface(backgroundSurf); */
- id=paraid;
- name="AAAA4321";
- 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="};
- std::fstream A_FILE(afildir.c_str());
- std::string tempariro, frameline, tempariro2;
- int trigger, triggahcomma=0;
- int positions[9];
- size_t starto, endo, temp0;
- bool extraction = false;
- if (A_FILE.is_open())
- {
- while (A_FILE.good())
- {
- getline(A_FILE, frameline);
- extraction = false;
- temp0=frameline.find(" ");
- while(temp0!=std::string::npos)
- {
- frameline.erase (temp0, 1);
- temp0=frameline.find(" ", temp0);
- }
- if (frameline.find("{info}")!= std::string::npos) trigger = 1;
- while (trigger==1)
- {
- getline(A_FILE, frameline);
- if (frameline.rfind(tags[0])!=std::string::npos)positions[0] = frameline.rfind(tags[0])+tags[0].length();
- if (frameline.rfind(tags[1])!=std::string::npos)positions[1] = frameline.rfind(tags[1])+tags[1].length();
- if (frameline.rfind(tags[2])!=std::string::npos)positions[2] = frameline.rfind(tags[2])+tags[2].length();
- if (frameline.rfind(tags[3])!=std::string::npos)positions[3] = frameline.rfind(tags[3])+tags[3].length();
- if (frameline.rfind(tags[4])!=std::string::npos)positions[4] = frameline.rfind(tags[4])+tags[4].length();
- if (frameline.rfind(tags[5])!=std::string::npos)positions[5] = frameline.rfind(tags[5])+tags[5].length();
- if (frameline.rfind(tags[6])!=std::string::npos)positions[6] = frameline.rfind(tags[6])+tags[6].length();
- if (frameline.rfind(tags[7])!=std::string::npos)positions[7] = frameline.rfind(tags[7])+tags[7].length();
- if (frameline.rfind(tags[7])!=std::string::npos)
- {
- positions[8] = frameline.rfind(tags[8])+tags[8].length();
- trigger=0;
- A_FILE.seekp(std::ios::beg);
- getline(A_FILE, frameline);
- getline(A_FILE, frameline);
- }
- }
- if (trigger != 1)
- {
- for (int ice=0; ice < 8; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- switch (ice)
- {
- case 8:
- if (frameline.rfind(tags[ice])!=std::string::npos) arresstnc=frameline.substr(positions[ice]);
- food=1000;
- break;
- case 7:
- if (frameline.rfind(tags[ice])!=std::string::npos) bgcolor=frameline.substr(positions[ice]);
- food=1000;
- break;
- case 6:
- if (frameline.rfind(tags[ice])!=std::string::npos) shadangy=atoi(frameline.substr(positions[ice]).c_str())*(M_PI/180.0);
- food=1000;
- break;
- case 5:
- if (frameline.rfind(tags[ice])!=std::string::npos) shadangx=atoi(frameline.substr(positions[ice]).c_str())*(M_PI/180.0);
- food=1000;
- break;
- case 4:
- if (frameline.rfind(tags[ice])!=std::string::npos) zboundwidth=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 3:
- if (frameline.rfind(tags[ice])!=std::string::npos) zbound=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 2:
- if (frameline.rfind(tags[ice])!=std::string::npos) xboundwidth=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 1:
- if (frameline.rfind(tags[ice])!=std::string::npos) xbound=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 0:
- if (frameline.rfind(tags[ice])!=std::string::npos) name=frameline.substr(positions[ice]);
- food=1000;
- break;
- default:
- ;
- }
- //cout<< "name: " << name << endl <<"WALKSPD_X_Z: "<<maxsp<<endl;
- if (frameline.find("{/info}")!= std::string::npos)
- {
- tempariro2="";
- while(A_FILE.good())
- {
- getline(A_FILE, frameline);
- if(frameline.find("#")!=std::string::npos)frameline.erase(frameline.find("#"), frameline.length()-frameline.find("#"));
- tempariro2 +=frameline;
- }
- A_FILE.seekp(0, A_FILE.end);
- A_FILE.close();
- }
- }
- }
- }
- }
- }
- //loadframes:
- //A_FILE.seekp(0, A_FILE.beg);
- //A_FILE.seekg(0, A_FILE.beg);
- //getline(A_FILE, tempariro2);
- temp0=tempariro2.find(" ");
- while(temp0!=std::string::npos)
- {
- tempariro2.erase (temp0, 1); //clear spaces
- temp0=tempariro2.find(" ", temp0);
- }
- temp0=tempariro2.find("\n");
- while(temp0!=std::string::npos)
- {
- tempariro2.erase (temp0, 1); //clear newline chars
- temp0=tempariro2.find("\n", temp0);
- }
- tempariro2=tempariro2.substr(tempariro2.find("[l="));
- int ideh;
- while(tempariro2.find("[l=") != std::string::npos && tempariro2.find("[/l]")!= std::string::npos)
- {
- layer framah;
- ideh = atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str());
- framah.init(tempariro2.substr(tempariro2.find("]")+1,tempariro2.find("[/l]")), atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str()) );
- LAYERS[framah.no]=framah;
- if (tempariro2.find("[l=", 4) != std::string::npos)
- {
- tempariro2=tempariro2.substr(tempariro2.find("[l=", 4));
- }
- else
- {
- break;
- }
- }
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- void objcopy::init(object* obj, int tm, bool iscom_, float gravity, float friction, int posx_,int posz_)
- {
- id=obj->id;
- facing=obj->facing;
- iscom=iscom_;
- isdead=false;
- team=tm;
- posx=posx_;
- posy=GROUNDPOS-100;
- posz=posz_;
- currhp=obj->inihp;
- currsp=obj->inisp;
- currrp=obj->inirp;
- currdp=obj->maxdp;
- currkp=obj->maxkp;
- currframe=obj->inair;
- GRAVITY=gravity;
- FRICTION=friction;
- P_UP=false;
- P_DOWN=false;
- P_LEFT=false;
- P_RIGHT=false;
- P_ATTACK=false;
- P_DEFEND=false;
- P_JUMP=false;
- P_SPECIAL=false;
- for (int a=0; a<52; a++)
- {
- regs[a]=0;
- }
- }
- void object::init(int id_, std::string dpndncs, std::string afildir)
- {
- id=id_;
- name="AAAA4321";
- previousframe=4321;
- std::string tags[] = {"NAME=","MAXPTS_HP_SP_RP=","INITPTS_HP_SP_RP=","WALKSPD_X_Z=","RPRATEPER_HIT_SEC_DAMAGE=",
- "ARMORPTS_MAX_RATE=","STANDING=","WALKING=", "FALLING_BACK=", "SPAWN=", "JUMPSPD_X_Z=","HIT_GROUND=","WHEN_HIT_FRONT=",
- "WHEN_HIT_BACK=", "KNOCKPTS_MAX_RATEPERSEC=", "KNOCKED=", "DEFENDPTS_MAX_RATEPERSEC=", "FALLING_FRONT=", "LYING=",
- "WIDTH_tEXT=", "WIDTH_NUMBERS=", "SPRATEPER_HIT_SEC_DAMAGE=", "FATIGUE=", "IN_AIR=", "HEIGHT=", "WIDTH=", "ALLOCATE_FRAMES=", "ALLOCATE_IMGS=", "[img]"
- };
- std::fstream A_FILE(afildir.c_str());
- std::string tempariro, frameline, tempariro2;
- int trigger, triggahcomma=0;
- int positions[30];
- size_t starto, endo, temp0;
- bool extraction = false;
- if (A_FILE.is_open())
- {
- while (A_FILE.good())
- {
- getline(A_FILE, frameline);
- extraction = false;
- temp0=frameline.find(" ");
- while(temp0!=std::string::npos)
- {
- frameline.erase (temp0, 1);
- temp0=frameline.find(" ", temp0);
- }
- if (frameline.find("{info}")!= std::string::npos) trigger = 1;
- while (trigger==1)
- {
- getline(A_FILE, frameline);
- if (frameline.rfind(tags[0])!=std::string::npos)positions[0] = frameline.rfind(tags[0])+tags[0].length();
- if (frameline.rfind(tags[1])!=std::string::npos)positions[1] = frameline.rfind(tags[1])+tags[1].length();
- if (frameline.rfind(tags[2])!=std::string::npos)positions[2] = frameline.rfind(tags[2])+tags[2].length();
- if (frameline.rfind(tags[3])!=std::string::npos)positions[3] = frameline.rfind(tags[3])+tags[3].length();
- if (frameline.rfind(tags[4])!=std::string::npos)positions[4] = frameline.rfind(tags[4])+tags[4].length();
- if (frameline.rfind(tags[5])!=std::string::npos)positions[5] = frameline.rfind(tags[5])+tags[5].length();
- if (frameline.rfind(tags[6])!=std::string::npos)positions[6] = frameline.rfind(tags[6])+tags[6].length();
- if (frameline.rfind(tags[7])!=std::string::npos)positions[7] = frameline.rfind(tags[7])+tags[7].length();
- if (frameline.rfind(tags[8])!=std::string::npos)positions[8] = frameline.rfind(tags[8])+tags[8].length();
- if (frameline.rfind(tags[9])!=std::string::npos)positions[9] = frameline.rfind(tags[9])+tags[9].length();
- if (frameline.rfind(tags[10])!=std::string::npos)positions[10] = frameline.rfind(tags[10])+tags[10].length();
- if (frameline.rfind(tags[11])!=std::string::npos)positions[11] = frameline.rfind(tags[11])+tags[11].length();
- if (frameline.rfind(tags[12])!=std::string::npos)positions[12] = frameline.rfind(tags[12])+tags[12].length();
- if (frameline.rfind(tags[13])!=std::string::npos)positions[13] = frameline.rfind(tags[13])+tags[13].length();
- if (frameline.rfind(tags[14])!=std::string::npos)positions[14] = frameline.rfind(tags[14])+tags[14].length();
- if (frameline.rfind(tags[15])!=std::string::npos)positions[15] = frameline.rfind(tags[15])+tags[15].length();
- if (frameline.rfind(tags[16])!=std::string::npos)positions[16] = frameline.rfind(tags[16])+tags[16].length();
- if (frameline.rfind(tags[17])!=std::string::npos)positions[17] = frameline.rfind(tags[17])+tags[17].length();
- if (frameline.rfind(tags[18])!=std::string::npos)positions[18] = frameline.rfind(tags[18])+tags[18].length();
- if (frameline.rfind(tags[19])!=std::string::npos)positions[19] = frameline.rfind(tags[19])+tags[19].length();
- if (frameline.rfind(tags[20])!=std::string::npos)positions[20] = frameline.rfind(tags[20])+tags[20].length();
- if (frameline.rfind(tags[21])!=std::string::npos)positions[21] = frameline.rfind(tags[21])+tags[21].length();
- if (frameline.rfind(tags[22])!=std::string::npos)positions[22] = frameline.rfind(tags[22])+tags[22].length();
- if (frameline.rfind(tags[23])!=std::string::npos)positions[23] = frameline.rfind(tags[23])+tags[23].length();
- if (frameline.rfind(tags[24])!=std::string::npos)positions[24] = frameline.rfind(tags[24])+tags[24].length();
- if (frameline.rfind(tags[25])!=std::string::npos)positions[25] = frameline.rfind(tags[25])+tags[25].length();
- if (frameline.rfind(tags[26])!=std::string::npos)positions[26] = frameline.rfind(tags[26])+tags[26].length();
- if (frameline.rfind(tags[27])!=std::string::npos)positions[27] = frameline.rfind(tags[27])+tags[27].length();
- if (frameline.rfind(tags[28])!=std::string::npos)
- {
- positions[28] = frameline.rfind(tags[28])+tags[28].length();
- trigger=0;
- A_FILE.seekp(std::ios::beg);
- getline(A_FILE, frameline);
- getline(A_FILE, frameline);
- }
- }
- if (trigger != 1)
- {
- for (int ice=0; ice < 29; ice ++) //iter on tags positions
- {
- for (int food = 0; food < frameline.length(); food++) //iter on characters of the line
- {
- while (trigger==11)
- {
- if (frameline.rfind("[/img]")!=std::string::npos)
- {
- trigger =0;
- break;
- }
- std::string spgdarg0 = std::string(frameline.substr(0, frameline.find(",")));
- int spgdarg1 = atoi(frameline.substr(frameline.find(",")+1,frameline.find(",", frameline.find(",")+1)).c_str());
- int spgdarg2 = atoi(frameline.substr(frameline.find(",", frameline.find(",")+1)+1, frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)).c_str());
- 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());
- 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());
- std::string spgdarg5 = frameline.substr(frameline.rfind(','));
- sprtfl = spgdarg0;
- spritegrid a;
- a.ini(spgdarg0, spgdarg1, spgdarg2, spgdarg3, spgdarg4, spgdarg5, &spritecount, 0);
- IMGS[imgindx]= a;
- imgindx ++;
- food = 10000;
- ice=100000;
- getline(A_FILE, frameline);
- }
- if (ice == 28 && (frameline.rfind(tags[ice])!=std::string::npos))
- {
- IMGS.resize(allctimgs);
- Frames.resize(allctfrms);
- trigger =11;
- food=10000;
- ice=1000;
- }
- if (ice<=28)
- {
- while (ice==21 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //RPRATEPEhjR_HIT
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- sphit=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //RPRATEPER_SEC_DAMAGE
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =2;
- }
- else
- {
- tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
- food++;
- }
- if (triggahcomma==2)
- {
- spsec=atoi(tempariro.c_str());
- tempariro = "";
- spdam=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
- triggahcomma=0;
- extraction = true;
- food=1000;
- }
- }
- else
- {
- food++;
- }
- }
- while (ice==16 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //defendpts
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- maxdp=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //defendrate
- {
- dpsec=atoi(frameline.substr(positions[ice]+food).c_str());
- tempariro = "";
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- else
- {
- food++;
- }
- }
- while (ice==14 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //fallpts
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- maxkp=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //fallrate
- {
- knockrate=atoi(frameline.substr(positions[ice]+food).c_str());
- tempariro = "";
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- else
- {
- food++;
- }
- }
- while (ice==10 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //JUMPSPDX
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- jmpspdx=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //JUMPSPDZ
- {
- jmpspdz=atoi(frameline.substr(positions[ice]+food).c_str());
- tempariro = "";
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- else
- {
- food++;
- }
- }
- while (ice==5 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //JUMPSPDX
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- armor=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //JUMPSPDZ
- {
- armorrate=atoi(frameline.substr(positions[ice]+food).c_str());
- tempariro = "";
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- else
- {
- food++;
- }
- }
- while (ice==4 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //RPRATEPEhjR_HIT
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- rphit=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //RPRATEPER_SEC_DAMAGE
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =2;
- }
- else
- {
- tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
- food++;
- }
- if (triggahcomma==2)
- {
- rpsec=atoi(tempariro.c_str());
- tempariro = "";
- rpdam=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
- triggahcomma=0;
- extraction = true;
- food=1000;
- }
- }
- else
- {
- food++;
- }
- }
- while (ice==3 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //WALKSPDX
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- wkspdx=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //WALKSPDZ
- {
- wkspdz=atoi(frameline.substr(positions[ice]+food).c_str());
- tempariro = "";
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- else
- {
- food++;
- }
- }
- while (ice==2 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //INIT_HP
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- inihp=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //INIT_MP &INIT_RP
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =2;
- }
- else
- {
- tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
- food++;
- }
- if (triggahcomma==2)
- {
- inisp=atoi(tempariro.c_str());
- tempariro = "";
- inirp=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
- triggahcomma=0;
- extraction=true;
- food=1000;
- }
- }
- else
- {
- food++;
- }
- }
- while (ice == 1 && (frameline.rfind(tags[ice])!=std::string::npos) && !extraction)
- {
- if (triggahcomma==0) //MAX_HP
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =1;
- }
- else if (isdigit(frameline[food+positions[ice]]))
- {
- tempariro+=(frameline.substr(food+positions[ice], 1).c_str());
- }
- if (triggahcomma==1)
- {
- maxhp=atoi(tempariro.c_str());
- tempariro = "";
- food++;
- }
- }
- if (triggahcomma==1) //MAX_MP &MAX_RP
- {
- if(frameline.substr(food+positions[ice],1).find(",")!=std::string::npos)
- {
- triggahcomma =2;
- }
- else
- {
- tempariro+=(frameline.substr(positions[ice]+food, 1).c_str());
- food++;
- }
- if (triggahcomma==2)
- {
- maxsp=atoi(tempariro.c_str());
- tempariro = "";
- maxrp=atoi(frameline.substr(frameline.rfind(",")+1).c_str());
- triggahcomma=0;
- extraction =true;
- food=1000;
- }
- }
- else
- {
- food++;
- }
- }
- switch (ice)
- {
- case 27:
- if (frameline.rfind(tags[ice])!=std::string::npos)allctimgs=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 26:
- if (frameline.rfind(tags[ice])!=std::string::npos)allctfrms=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 25:
- if (frameline.rfind(tags[ice])!=std::string::npos)width=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 24:
- if (frameline.rfind(tags[ice])!=std::string::npos)height=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 23:
- if (frameline.rfind(tags[ice])!=std::string::npos)inair=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 22:
- if (frameline.rfind(tags[ice])!=std::string::npos)fatigue=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 20:
- if (frameline.rfind(tags[ice])!=std::string::npos)hitnowidth=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 19:
- if (frameline.rfind(tags[ice])!=std::string::npos)hittxtwidth=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 18:
- if (frameline.rfind(tags[ice])!=std::string::npos)lying=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 17:
- if (frameline.rfind(tags[ice])!=std::string::npos)falling=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 15:
- if (frameline.rfind(tags[ice])!=std::string::npos)knocked=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 13:
- if (frameline.rfind(tags[ice])!=std::string::npos)whenhitb=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 12:
- if (frameline.rfind(tags[ice])!=std::string::npos)whenhit=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 11:
- if (frameline.rfind(tags[ice])!=std::string::npos)hitground=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 9:
- if (frameline.rfind(tags[ice])!=std::string::npos) spawn=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 8:
- if (frameline.rfind(tags[ice])!=std::string::npos) fallingb=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 7:
- if (frameline.rfind(tags[ice])!=std::string::npos) walking=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 6:
- if (frameline.rfind(tags[ice])!=std::string::npos) standing=atoi(frameline.substr(positions[ice]).c_str());
- food=1000;
- break;
- case 0:
- if (frameline.rfind(tags[ice])!=std::string::npos) name=frameline.substr(positions[ice]);
- food=1000;
- break;
- default:
- ;
- }
- }
- if (frameline.find("{/info}")!= std::string::npos)
- {
- tempariro2="";
- while(A_FILE.good())
- {
- getline(A_FILE, frameline);
- if(frameline.find("#")!=std::string::npos)frameline.erase(frameline.find("#"), frameline.length()-frameline.find("#"));
- tempariro2 +=frameline;
- }
- A_FILE.seekp(0, A_FILE.end);
- A_FILE.close();
- }
- }
- }
- }
- }
- }
- wkspdxz_x=(float)wkspdx*cos(atan((float)wkspdz/(float)wkspdx));
- wkspdxz_z=(float)wkspdz*sin(atan((float)wkspdz/(float)wkspdx));
- if (name == "AAAA4321")
- {
- type =1;
- }
- else
- {
- type =0;
- }
- //loadframes:
- temp0=tempariro2.find(" ");
- while(temp0!=std::string::npos)
- {
- tempariro2.erase (temp0, 1); //clear spaces
- temp0=tempariro2.find(" ", temp0);
- }
- temp0=tempariro2.find("\n");
- while(temp0!=std::string::npos)
- {
- tempariro2.erase (temp0, 1); //clear newline chars
- temp0=tempariro2.find("\n", temp0);
- }
- std::string tempariro3=tempariro2;
- int ideh;
- int idehe;
- if (tempariro3.find("[s=")!=std::string::npos)
- {
- tempariro3=tempariro3.substr(tempariro3.find("[s="));
- }
- while (tempariro3.find("[s=")!=std::string::npos && tempariro3.find("[/s]")!=std::string::npos)
- {
- ideh=Evaluate(tempariro3.substr(3, tempariro3.find("->")-3));
- idehe=Evaluate(tempariro3.substr(tempariro3.find("->")+2, tempariro3.find("]")-2));
- for (int stfrm=ideh; stfrm<=idehe; stfrm++)
- {
- frame framah;
- framah.init(tempariro3.substr(tempariro3.find("]")+1,tempariro3.find("[/s]")), stfrm);
- if (stfrm!=idehe)
- {
- framah.nxt=stringify(stfrm+1);
- }
- framah.img=framah.img=="999"?"999":stringify(Evaluate(framah.img)+(stfrm-ideh));
- framah.BDYS[20].init("set_bdy[x="+stringify(-width/2)+"y="+ stringify(-height)+"w="+stringify(width)+"h="+stringify(height)+"]");
- Frames[framah.no]=framah;
- }
- if (tempariro3.find("[s=", 4) != std::string::npos)
- {
- tempariro3=tempariro3.substr(tempariro3.find("[s=", 4));
- }
- else
- {
- break;
- }
- }
- tempariro2=tempariro2.substr(tempariro2.find("[f="));
- while(tempariro2.find("[f=") != std::string::npos && tempariro2.find("[/f]")!= std::string::npos)
- {
- frame framah;
- ideh = atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str());
- framah.init(tempariro2.substr(tempariro2.find("]")+1,tempariro2.find("[/f]")), ideh);
- framah.BDYS[20].init("set_bdy[x="+stringify(-width/2)+"y="+ stringify(-height+1)+"w="+stringify(width)+"h="+stringify(height)+"]");
- Frames[framah.no]=framah;
- if (tempariro2.find("[f=", 4) != std::string::npos)
- {
- tempariro2=tempariro2.substr(tempariro2.find("[f=", 4));
- }
- else
- {
- break;
- }
- }
- accU=0;
- }
- LoadTxt::LoadTxt(std::string loadtxtdir)
- {
- DATA_LINES.resize(1000);
- std::string line;
- std::ifstream LOAD_TXT;
- LOAD_TXT.open (loadtxtdir.c_str ());
- int temp0,type=0;
- while (LOAD_TXT.good()&&LOAD_TXT.is_open())
- {
- getline(LOAD_TXT, line);
- temp0=line.find("\n");
- while(temp0!=std::string::npos)
- {
- line.erase (temp0, 1);
- temp0=line.find("\n");
- }
- temp0=line.find(" ");
- while(temp0!=std::string::npos)
- {
- line.erase (temp0, 1);
- temp0=line.find(" ", temp0);
- }
- if (line.find("{object}")!=std::string::npos)
- {
- type=0;
- continue;
- }
- else if (line.find("{background}")!=std::string::npos)
- {
- type=1;
- continue;
- }
- else if (line.find("{/object}")!=std::string::npos || line.find("{/background}")!=std::string::npos || line=="")
- {
- continue;
- }
- else
- {
- DATA_LINES[DATA_LINES_INDEX].id=Evaluate(line.substr(0,line.find("::")));
- DATA_LINES[DATA_LINES_INDEX].dependencies=line.substr(line.find("::")+2, line.rfind("::")-(line.find("::")+2));
- DATA_LINES[DATA_LINES_INDEX].directory=line.substr(line.rfind("::")+2,line.find(";")-(line.rfind("::")+2));
- DATA_LINES[DATA_LINES_INDEX].type=type;
- DATA_LINES_INDEX++;
- }
- }
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- void LOAD::LoadObjsForGame(LoadTxt Txt, std::string objlines, int bgid, LOAD * LOADADDRESS)
- {
- std::string loaded_ids=":";
- for (int index=0; index < Txt.DATA_LINES_INDEX; index++)
- {
- std::cout << stringify(Txt.DATA_LINES[index].id) << std::endl;
- std::cout << Txt.DATA_LINES[index].directory << std::endl;
- }
- while (objlines.length()>2)
- for (int index=0; index < Txt.DATA_LINES_INDEX; index++)
- {
- std::cout <<"meh" <<std::endl;
- if (objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")!=std::string::npos && Txt.DATA_LINES[index].type==0)
- {
- int pos1=objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")+(":"+stringify(Txt.DATA_LINES[index].id)+"~").length();
- int len1=objlines.find(":", pos1)-pos1+1;
- controllers[OBJID_INDEX]=Evaluate(objlines.substr(pos1, len1));
- IDS[OBJID_INDEX++]=Txt.DATA_LINES[index].id;
- objlines.erase(objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~"), objlines.find(":",objlines.find(":"+stringify(Txt.DATA_LINES[index].id)+"~")+1));
- if (loaded_ids.find(":"+stringify(Txt.DATA_LINES[index].id)+":")==std::string::npos)
- {
- object Stickman;
- Stickman.init(Txt.DATA_LINES[index].id, Txt.DATA_LINES[index].dependencies, Txt.DATA_LINES[index].directory);
- Stickman.LOADED=LOADADDRESS;
- OBJECTS[Stickman.id]= Stickman;
- loaded_ids+=stringify(Stickman.id)+":";
- if (Txt.DATA_LINES[index].dependencies!="-")
- {
- std::string tempdep=Txt.DATA_LINES[index].dependencies;
- int tempid;
- while (tempdep.find("&")!=std::string::npos)
- {
- tempid=Evaluate(tempdep.substr(0,tempdep.find("&")));
- for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
- {
- if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
- {
- object Stickman;
- Stickman.init(Txt.DATA_LINES[indexi].id,Txt. DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
- Stickman.LOADED=LOADADDRESS;
- OBJECTS[Stickman.id]= Stickman;
- loaded_ids+=stringify(Stickman.id)+":";
- break;
- }
- }
- tempdep.erase(0,tempdep.find("&")+1);
- }
- tempid=Evaluate(tempdep);
- for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
- {
- if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
- {
- object Stickman;
- Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
- Stickman.LOADED=LOADADDRESS;
- OBJECTS[Stickman.id]= Stickman;
- loaded_ids+=stringify(Stickman.id)+":";
- break;
- }
- }
- }
- }
- }
- if (bgid==Txt.DATA_LINES[index].id && Txt.DATA_LINES[index].type==1)
- {
- background StickBG;
- StickBG.init(Txt.DATA_LINES[index].id, Txt.DATA_LINES[index].dependencies, Txt.DATA_LINES[index].directory);
- BACKGROUNDS[StickBG.id]=StickBG;
- BGIDS[BGID_INDEX++]=StickBG.id;
- if (Txt.DATA_LINES[index].dependencies!="-")
- {
- std::string tempdep=Txt.DATA_LINES[index].dependencies;
- int tempid;
- while (tempdep.find("&")!=std::string::npos)
- {
- tempid=Evaluate(tempdep.substr(0,tempdep.find("&")));
- for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
- {
- if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
- {
- object Stickman;
- Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
- Stickman.LOADED=LOADADDRESS;
- OBJECTS[Stickman.id]= Stickman;
- loaded_ids+=stringify(Stickman.id)+":";
- break;
- }
- }
- tempdep.erase(0,tempdep.find("&")+1);
- }
- tempid=Evaluate(tempdep);
- for (int indexi=0; indexi < Txt.DATA_LINES_INDEX; indexi++)
- {
- if (tempid==Txt.DATA_LINES[indexi].id && loaded_ids.find(":"+stringify(tempid)+":")==std::string::npos)
- {
- object Stickman;
- Stickman.init(Txt.DATA_LINES[indexi].id, Txt.DATA_LINES[indexi].dependencies, Txt.DATA_LINES[indexi].directory);
- Stickman.LOADED=LOADADDRESS;
- OBJECTS[Stickman.id]= Stickman;
- loaded_ids+=stringify(Stickman.id)+":";
- break;
- }
- }
- }
- bgid=4321;
- }
- }
- }
- void LOAD::LoadBG(std::string dir, int id)
- {
- background StickBG;
- StickBG.init(id , "", dir);
- BACKGROUNDS[StickBG.id]=StickBG;
- BGIDS[BGID_INDEX++]=StickBG.id;
- }
- void LOAD::LoadOBJ(std::string dir, int id)
- {
- object Stickman;
- Stickman.init(id, "", dir);
- OBJECTS[Stickman.id]= Stickman;
- }
- void LOAD::CreateOBJECTCOPY(int id, int posx, int posy, int frame)
- {
- objcopy z;
- z.init(&OBJECTS[id],0, true, GRAVITY, FRICTION, posx, posy);
- z.posy=0;
- z.onscreen_id=ON_SCREEN_OBJCOUNT;
- z.currframe=frame;
- OBJS_STRUCTS[id]=z;
- ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT]=z;
- ON_SCREEN_OBJS[ON_SCREEN_OBJCOUNT]=&ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT];
- ON_SCREEN_OBJCOUNT++;
- }
- void LOAD::LoadLOADTXTLite()
- {
- BARSG.resize(8);
- for (int reg=0; reg<100; reg++)
- {
- GLOBALREGS[reg]=0;
- }
- //regarding effects...etc
- std::fstream SYS_FILE("obj\\system.a");
- std::string tempasdf;
- std::string systemd;
- int tempadodi;
- while (SYS_FILE.good())
- {
- getline(SYS_FILE, tempasdf);
- systemd += tempasdf;
- }
- if (systemd.find("{main}")!=std::string::npos)
- {
- tempasdf=systemd.substr(systemd.find("{main}")+6, systemd.find("{/main}")-6-systemd.find("{main}"));
- }
- if (tempasdf.find("FPS=")!=std::string::npos)
- {
- tempadodi=tempasdf.find("FPS=");
- std::string asdsdf=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("FPS="))-tempadodi-4);
- FPS=Evaluate(asdsdf);
- }
- if (systemd.find("{bar_frame}"))
- {
- tempasdf=systemd.substr(systemd.find("{bar_frame}")+11, systemd.find("{/bar_frame}")-11-systemd.find("{bar_frame}"));
- tempadodi=tempasdf.find("img=");
- BARS[12]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("trans_x=");
- BARS[13]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[14]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{hp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{hp_bar}")+8, systemd.find("{/hp_bar}")-8-systemd.find("{hp_bar}"));
- tempadodi=tempasdf.find("img1=");
- BARS[0]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img1="))-tempadodi-5);
- tempadodi=tempasdf.find("img2=");
- BARS[15]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img2="))-tempadodi-5);
- tempadodi=tempasdf.find("img3=");
- BARS[16]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img3="))-tempadodi-5);
- tempadodi=tempasdf.find("img4=");
- BARS[17]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img4="))-tempadodi-5);
- tempadodi=tempasdf.find("img5=");
- BARS[18]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img5="))-tempadodi-5);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[3]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[6]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[7]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{sp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{sp_bar}")+8, systemd.find("{/sp_bar}")-8-systemd.find("{sp_bar}"));
- tempadodi=tempasdf.find("img=");
- BARS[1]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[4]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[8]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[9]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{rp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{rp_bar}")+8, systemd.find("{/rp_bar}")-8-systemd.find("{rp_bar}"));
- tempadodi=tempasdf.find("img=");
- BARS[2]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[5]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[10]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[11]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- for (int abcd=0; abcd<3; abcd++)
- {
- spritegrid a;
- int watever;
- a.ini(BARS[abcd], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
- BARSG[abcd]=a;
- }
- for (int aa=15; aa<19; aa++)
- {
- spritegrid a;
- int watever;
- a.ini(BARS[aa], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
- BARSG[aa-11]=a;
- }
- for (int asdfasdfasdf=0; asdfasdfasdf==0; asdfasdfasdf++)
- {
- int momo;
- spritegrid a;
- a.ini(BARS[12], 4321, 4321, 1, 1, ",0xFFFFFF", &momo, 1);
- BARSG[3]=a;
- }
- if (systemd.find("{defaults}")!=std::string::npos)
- {
- tempasdf=systemd.substr(systemd.find("{defaults}")+10, systemd.find("{/defaults}")-10-systemd.find("{defaults}"));
- if (tempasdf.find("gravity=")!=std::string::npos)
- {
- settings[10]=tempasdf.substr(tempasdf.find("gravity=")+8, tempasdf.find(";")-tempasdf.find("gravity=")-8);
- }
- else
- {
- settings[10]="0.7";
- }
- if (tempasdf.find("friction=")!=std::string::npos)
- {
- settings[11]=tempasdf.substr(tempasdf.find("friction=")+9, tempasdf.find(";")-tempasdf.find("friction=")-9);
- }
- else
- {
- settings[11]="2";
- }
- }
- FRICTION= ::atof(settings[11].c_str());
- GRAVITY =::atof(settings[10].c_str());
- std::string paraid, paraind, paradir;
- size_t L_POS, temp0;
- int typy=0;
- //ON_SCREEN_OBJCOUNT=OBJID_INDEX;
- ON_SCREEN_OBJCOUNT=0;
- }
- void LOAD::LoadSettigns_OnScreenObjs()
- {
- BARSG.resize(8);
- CATCHINGIDS.resize(100);
- for (int abcd=0; abcd<100; abcd++)
- {
- CATCHINGIDS[abcd].resize(7);
- }
- for (int ID=0; ID<100; ID++)
- {
- for (int data=0; data<7; data++)
- {
- CATCHINGIDS[ID][data]=4321;
- }
- }
- for (int reg=0; reg<100; reg++)
- {
- GLOBALREGS[reg]=0;
- }
- //regarding effects...etc
- std::fstream SYS_FILE("obj\\system.a");
- std::string tempasdf;
- std::string systemd;
- int tempadodi;
- while (SYS_FILE.good())
- {
- getline(SYS_FILE, tempasdf);
- systemd += tempasdf;
- }
- if (systemd.find("{main}")!=std::string::npos)
- {
- tempasdf=systemd.substr(systemd.find("{main}")+6, systemd.find("{/main}")-6-systemd.find("{main}"));
- for (int x=0; x<10; x++)
- {
- if (tempasdf.find("effect["+stringify(x)+"]=")!=std::string::npos)
- {
- settings[x]=tempasdf.substr(tempasdf.find("effect["+stringify(x)+"]=")+10, tempasdf.find(";", tempasdf.find("effect["+stringify(x)+"]="))-tempasdf.find("effect["+stringify(x)+"]=")-10);
- object effect;
- effect.init(1000+x, "None", settings[x]);
- OBJECTS[effect.id]= effect;
- objcopy z;
- z.init(&effect,5, true, GRAVITY, FRICTION, 0, 0);
- OBJS_STRUCTS[1000+x]=z;
- }
- else
- {
- settings[x]="None";
- }
- }
- }
- if (tempasdf.find("FPS=")!=std::string::npos)
- {
- tempadodi=tempasdf.find("FPS=");
- std::string asdsdf=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("FPS="))-tempadodi-4);
- FPS=Evaluate(asdsdf);
- }
- if (tempasdf.find("showHitNo_Dir_Interval=")!=std::string::npos)
- {
- HITSYS=true;
- object nums;
- tempadodi=tempasdf.find("showHitNo_Dir_Interval=");
- std::string asdsdf=tempasdf.substr(tempadodi+23, tempasdf.find(";", tempasdf.find("showHitNo_Dir_Interval="))-tempadodi-23);
- nums.init(1010, "None", tempasdf.substr(tempadodi+23, tempasdf.find(";", tempasdf.find("showHitNo_Dir_Interval="))-tempadodi-23));
- OBJECTS[nums.id]=nums;
- objcopy z;
- z.init(&nums,999, true, GRAVITY, FRICTION, 0, 0);
- OBJS_STRUCTS[1010]=z;
- }
- objcopy z;
- if (systemd.find("{bar_frame}"))
- {
- tempasdf=systemd.substr(systemd.find("{bar_frame}")+11, systemd.find("{/bar_frame}")-11-systemd.find("{bar_frame}"));
- tempadodi=tempasdf.find("img=");
- BARS[12]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("trans_x=");
- BARS[13]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[14]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{hp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{hp_bar}")+8, systemd.find("{/hp_bar}")-8-systemd.find("{hp_bar}"));
- tempadodi=tempasdf.find("img1=");
- BARS[0]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img1="))-tempadodi-5);
- tempadodi=tempasdf.find("img2=");
- BARS[15]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img2="))-tempadodi-5);
- tempadodi=tempasdf.find("img3=");
- BARS[16]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img3="))-tempadodi-5);
- tempadodi=tempasdf.find("img4=");
- BARS[17]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img4="))-tempadodi-5);
- tempadodi=tempasdf.find("img5=");
- BARS[18]=tempasdf.substr(tempadodi+5, tempasdf.find(";", tempasdf.find("img5="))-tempadodi-5);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[3]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[6]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[7]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{sp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{sp_bar}")+8, systemd.find("{/sp_bar}")-8-systemd.find("{sp_bar}"));
- tempadodi=tempasdf.find("img=");
- BARS[1]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[4]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[8]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[9]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- if (systemd.find("{rp_bar}"))
- {
- tempasdf=systemd.substr(systemd.find("{rp_bar}")+8, systemd.find("{/rp_bar}")-8-systemd.find("{rp_bar}"));
- tempadodi=tempasdf.find("img=");
- BARS[2]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- tempadodi=tempasdf.find("deplete_direction=");
- BARS[5]=tempasdf.substr(tempadodi+18, tempasdf.find(";", tempasdf.find("deplete_direction="))-tempadodi-18);
- tempadodi=tempasdf.find("trans_x=");
- BARS[10]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_x="))-tempadodi-8);
- tempadodi=tempasdf.find("trans_y=");
- BARS[11]=tempasdf.substr(tempadodi+8, tempasdf.find(";", tempasdf.find("trans_y="))-tempadodi-8);
- }
- for (int abcd=0; abcd<3; abcd++)
- {
- spritegrid a;
- int watever;
- a.ini(BARS[abcd], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
- BARSG[abcd]=a;
- }
- for (int aa=15; aa<19; aa++)
- {
- spritegrid a;
- int watever;
- a.ini(BARS[aa], 4321, 4321, 1, 1, ",0xFFFFFF", &watever, 1);
- BARSG[aa-11]=a;
- }
- for (int asdfasdfasdf=0; asdfasdfasdf==0; asdfasdfasdf++)
- {
- int momo;
- spritegrid a;
- a.ini(BARS[12], 4321, 4321, 1, 1, ",0xFFFFFF", &momo, 1);
- BARSG[3]=a;
- }
- if (systemd.find("{defaults}")!=std::string::npos)
- {
- tempasdf=systemd.substr(systemd.find("{defaults}")+10, systemd.find("{/defaults}")-10-systemd.find("{defaults}"));
- if (tempasdf.find("gravity=")!=std::string::npos)
- {
- settings[10]=tempasdf.substr(tempasdf.find("gravity=")+8, tempasdf.find(";")-tempasdf.find("gravity=")-8);
- }
- else
- {
- settings[10]="0.7";
- }
- if (tempasdf.find("friction=")!=std::string::npos)
- {
- settings[11]=tempasdf.substr(tempasdf.find("friction=")+9, tempasdf.find(";")-tempasdf.find("friction=")-9);
- }
- else
- {
- settings[11]="2";
- }
- }
- FRICTION= ::atof(settings[11].c_str());
- GRAVITY =::atof(settings[10].c_str());
- //ON_SCREEN_OBJCOUNT=OBJID_INDEX;
- ON_SCREEN_OBJCOUNT=0;
- srand (time(NULL));
- for (int x=0; x<OBJID_INDEX; x++)
- {
- for (int y=0; y<OBJECTS[IDS[x]].spawn; y++)
- {
- objcopy z;
- int randxpos=rand() % 800 + 50;
- int randzpos=rand() % 180 + 570;
- if (x==3) z.init(&OBJECTS[IDS[x]],x+1, true, GRAVITY, FRICTION, randxpos, randzpos);
- else
- z.init(&OBJECTS[IDS[x]],x+1, false, GRAVITY, FRICTION, randxpos, randzpos);
- z.playerno=controllers[x]+1;
- z.onscreen_id=ON_SCREEN_OBJCOUNT;
- OBJS_STRUCTS[IDS[x]]=z;
- ON_SCREEN_REAL_OBJS[ON_SCREEN_OBJCOUNT]=z;
- ON_SCREEN_OBJCOUNT++;
- }
- }
- for (int aa=0; aa<ON_SCREEN_OBJCOUNT; aa++)
- {
- if (ON_SCREEN_REAL_OBJS[aa].id <200)
- ON_SCREEN_OBJS[aa]=&ON_SCREEN_REAL_OBJS[aa];
- }
- }
- void LOAD::initHeavy (std::string dir)
- {
- OBJECTS.resize(1011);
- OBJID_INDEX = 0;
- BGID_INDEX = 0;
- BACKGROUNDS.resize(100);
- ON_SCREEN_OBJS.resize(1011);
- ON_SCREEN_REAL_OBJS.resize(1011);
- OBJS_STRUCTS.resize(1011);
- CURRBG=0;
- PKEYS.resize(4);
- PKEYS[0].resize(8);
- PKEYS[1].resize(8);
- PKEYS[2].resize(8);
- PKEYS[3].resize(8);
- }
- void LOAD::initLite ()
- {
- OBJECTS.resize(100);
- OBJID_INDEX = 0;
- BGID_INDEX = 0;
- BACKGROUNDS.resize(5);
- ON_SCREEN_OBJS.resize(100);
- ON_SCREEN_REAL_OBJS.resize(100);
- OBJS_STRUCTS.resize(100);
- CURRBG=0;
- }
- void object::Walk (objcopy *objcop)
- {
- if ((objcop->movedirx < 2 && objcop->movedirz < 2))
- {
- if (objcop->facing == 0)
- {
- if (objcop->movedirx == 0) Move(wkspdxz_x, 'x', objcop);
- if (objcop->movedirx == 1) objcop->facing = 1;
- }
- if (objcop->facing == 1)
- {
- if (objcop->movedirx == 1) Move(-wkspdxz_x, 'x', objcop);
- if (objcop->movedirx == 0) objcop->facing = 0;
- }
- if (objcop->movedirz == 0) Move(-wkspdxz_z, 'z', objcop);
- if (objcop->movedirz == 1) Move(wkspdxz_z, 'z', objcop);
- }
- if (!(objcop->movedirx < 2 && objcop->movedirz < 2))
- {
- if (objcop->facing == 0)
- {
- if (objcop->movedirx == 0) Move(wkspdx, 'x', objcop);
- if (objcop->movedirx == 1) objcop->facing = 1;
- }
- if (objcop->facing == 1)
- {
- if (objcop->movedirx == 1) Move(-wkspdx, 'x', objcop);
- if (objcop->movedirx == 0) objcop->facing = 0;
- }
- if (objcop->movedirz == 0) Move(-wkspdz, 'z', objcop);
- if (objcop->movedirz == 1) Move(wkspdz, 'z', objcop);
- }
- }
- void object::Move (float value, char axis, objcopy * objcop)
- {
- if (axis=='x'&&value > 0)
- {
- if (objcop->total_fx!=0 && objcop->posy < objcop->GROUNDPOS)
- {
- objcop->total_fx-=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fx/10., 2))/2.);
- objcop->total_fx=objcop->total_fx<0?0:objcop->total_fx;
- }
- if (objcop->posx+value > (LOADED->BACKGROUNDS[LOADED->CURRBG].xbound+LOADED->BACKGROUNDS[LOADED->CURRBG].xboundwidth))
- {
- objcop->posx=LOADED->BACKGROUNDS[LOADED->CURRBG].xbound+LOADED->BACKGROUNDS[LOADED->CURRBG].xboundwidth;
- }
- else
- {
- objcop->posx+=value;
- }
- }
- else if (axis=='x'&&value < 0)
- {
- if (objcop->total_fx!=0 && objcop->posy < objcop->GROUNDPOS)
- {
- objcop->total_fx+=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fx/10., 2))/2.);
- objcop->total_fx=objcop->total_fx>0?0:objcop->total_fx;
- }
- if (objcop->posx+value < LOADED->BACKGROUNDS[LOADED->CURRBG].xbound)
- {
- objcop->posx=LOADED->BACKGROUNDS[LOADED->CURRBG].xbound;
- }
- else
- {
- objcop->posx+=value;
- }
- }
- if (axis=='z'&&value >= 0)
- {
- if (objcop->posz+value > (LOADED->BACKGROUNDS[LOADED->CURRBG].zbound+LOADED->BACKGROUNDS[LOADED->CURRBG].zboundwidth))
- {
- objcop->posz=LOADED->BACKGROUNDS[LOADED->CURRBG].zbound+LOADED->BACKGROUNDS[LOADED->CURRBG].zboundwidth-1;
- }
- else
- {
- objcop->posz+=value;
- }
- }
- else if (axis=='z'&&value < 0)
- {
- if (objcop->posz+value < LOADED->BACKGROUNDS[LOADED->CURRBG].zbound)
- {
- objcop->posz=LOADED->BACKGROUNDS[LOADED->CURRBG].zbound;
- }
- else
- {
- objcop->posz+=(float)value;
- }
- }
- if (axis=='y')
- {
- /*if (objcop->total_fy!=0 && objcop->posy < objcop->GROUNDPOS){
- if (objcop->total_fy<0){
- objcop->total_fy+=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fy/10., 2))/2.);
- objcop->total_fy=objcop->total_fy>0?0:objcop->total_fy;
- }else{
- objcop->total_fy-=(((Eval(objcop, Frames[objcop->currframe].arrsstnc)/10.)*pow(objcop->total_fy/10., 2))/2.);
- objcop->total_fy=objcop->total_fy<0?0:objcop->total_fy;
- }
- }*/
- if (objcop->posy+value > objcop->GROUNDPOS)
- {
- objcop->posy=objcop->GROUNDPOS;
- }
- else
- {
- objcop->posy+=value;
- }
- }
- }
- void object::Apply_loop(objcopy * objcop)
- {
- 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
- {
- objcop->U_loop_length= Eval(objcop, Frames[objcop->currframe].loop_length);
- objcop->doloop[0]=1;
- objcop->doloop[1]=objcop->currframe;
- }
- if (Eval(objcop, Frames[objcop->currframe].loop_condition)==objcop->previousframe && (bool)objcop->doloop[0]&&objcop->newframe)
- {
- if (objcop->U_loop_length == 0)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].loop_goto);
- objcop->doloop[0]=0;
- objcop->newframe=true;
- }
- else
- {
- objcop->U_loop_length--;
- }
- }
- }
- void object::Apply_f_x(objcopy * objcop)
- {
- if (Frames[objcop->currframe].f_x!="0") //f_x tag
- {
- if (Frames[objcop->currframe].f_x!="4321")
- {
- if (objcop->facing==0)
- {
- objcop->total_fx=Eval(objcop, Frames[objcop->currframe].f_x);
- }
- else
- {
- objcop->total_fx=(Eval(objcop, Frames[objcop->currframe].f_x)*-1);
- }
- }
- else
- {
- objcop->total_fx=0;
- }
- }
- }
- void object::Apply_f_y(objcopy * objcop)
- {
- if (Frames[objcop->currframe].f_y!="0") //f_y tag
- {
- if (Frames[objcop->currframe].f_y!="4321")
- {
- objcop->total_fy=Eval(objcop, Frames[objcop->currframe].f_y);
- }
- else
- {
- objcop->total_fy=0;
- }
- }
- }
- void object::Apply_f_z(objcopy * objcop)
- {
- if (Frames[objcop->currframe].f_z!="0") //f_z tag
- {
- if (Frames[objcop->currframe].f_z!="4321")
- {
- objcop->total_fz=Eval(objcop, Frames[objcop->currframe].f_z);
- }
- else
- {
- objcop->total_fz=0;
- }
- }
- }
- void object::Apply_FRICTION(objcopy * objcop)
- {
- if (type==0 && !objcop->caught)
- {
- if(objcop->total_fx!=0&&objcop->posy==objcop->GROUNDPOS) //apply friction
- {
- if (objcop->total_fx>0)
- {
- objcop->total_fx-=objcop->FRICTION;
- if (objcop->total_fx<0) objcop->total_fx=0;
- }
- else if (objcop->total_fx<0)
- {
- objcop->total_fx+=objcop->FRICTION;
- if (objcop->total_fx>0) objcop->total_fx=0;
- }
- }
- if(objcop->total_fz!=0&&objcop->posy==objcop->GROUNDPOS) //apply friction
- {
- if (objcop->total_fz>0)
- {
- objcop->total_fz-=objcop->FRICTION;
- if (objcop->total_fz<0) objcop->total_fz=0;
- }
- else if (objcop->total_fz<0)
- {
- objcop->total_fz+=objcop->FRICTION;
- if (objcop->total_fz>0) objcop->total_fz=0;
- }
- }
- }
- }
- void object::Apply_GRAVITY(objcopy * objcop)
- {
- if (!Frames[objcop->currframe].flags[21]&&!objcop->caught)
- {
- if((objcop->posy<objcop->GROUNDPOS||objcop->total_fy!=0)&&Frames[objcop->currframe].f_y!="4321") //apply graviry
- {
- if (objcop->total_fy==0 && objcop->ltstpltfrmvl!=objcop->GROUNDPOS)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=inair;
- objcop->newframe=true;
- }
- objcop->total_fy+=objcop->GRAVITY;
- if (objcop->posy+objcop->total_fy>=objcop->GROUNDPOS)
- {
- objcop->total_fy=0.0;
- objcop->posy=objcop->GROUNDPOS;
- objcop->previousframe=objcop->currframe;
- objcop->newframe=true;
- if(Frames[objcop->currframe].hitground!="4321")
- {
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].hitground);
- }
- else
- {
- objcop->currframe=hitground;
- }
- }
- }
- objcop->ltstpltfrmvl=objcop->GROUNDPOS;
- }
- objcop->GROUNDPOS=0;
- }
- void object::Apply_acc(objcopy * objcop)
- {
- if (objcop->facing ==0) objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].acc); //acc tag
- if (objcop->facing ==1) objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].acc);
- objcop->total_fy+=Eval(objcop, Frames[objcop->currframe].yacc);
- }
- void object::Apply_x_z_hold_distance(objcopy * objcop)
- {
- if (type==0)
- {
- if (objcop->P_UP==true)
- {
- Move(-(float)Eval(objcop, Frames[objcop->currframe].zhlddstnc), 'z', objcop); //z_hold_distance tag
- }
- if (objcop->P_DOWN==true)
- {
- Move((float)Eval(objcop, Frames[objcop->currframe].zhlddstnc), 'z', objcop);
- }
- if (objcop->P_RIGHT==true)
- {
- objcop->total_fx+= Eval(objcop, Frames[objcop->currframe].xhlddstnc); //x_hold_distance tag
- }
- if (objcop->P_LEFT==true)
- {
- objcop->total_fx-= Eval(objcop, Frames[objcop->currframe].xhlddstnc);
- }
- }
- }
- void object::Apply_x_hold_distance(objcopy * objcop)
- {
- if (objcop->P_RIGHT==true && objcop->facing == 0)
- {
- objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
- }
- if (objcop->P_LEFT==true && objcop->facing == 1)
- {
- objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
- }
- }
- void object::Basic_Stand_Walk_Dash(objcopy * objcop)
- {
- if (type==0)
- {
- if ((objcop->P_UP==true||objcop->P_DOWN==true||objcop->P_LEFT==true||objcop->P_RIGHT==true)&&Frames[objcop->currframe].flags[0])
- {
- //if (objcop->DASHR==1&&objcop->P_RIGHT==true&&objcop->facing==0){
- // objcop->previousframe=objcop->currframe;objcop->currframe=dashing;objcop->newframe=true;objcop->DASHR=0;objcop->DASHL=0;objcop->DshClksIntrvlL,objcop->DshClksIntrvlR=0;
- //}else if(objcop->DASHL==1&&objcop->P_LEFT==true&&objcop->facing==1){
- // objcop->previousframe=objcop->currframe;objcop->currframe=dashing;objcop->newframe=true;objcop->DASHL=0;objcop->DASHR=0;objcop->DshClksIntrvlL,objcop->DshClksIntrvlR=0;
- //}else{
- objcop->previousframe=objcop->currframe;
- objcop->currframe=walking;
- objcop->newframe=true;
- }//}
- if(Frames[objcop->currframe].flags[1] && !(objcop->P_UP==true||objcop->P_DOWN==true||objcop->P_LEFT==true||objcop->P_RIGHT==true))
- {
- objcop->currframe=standing;
- objcop->newframe=true;
- objcop->previousframe=objcop->currframe;
- }
- if (Frames[objcop->currframe].flags[1]&&objcop->posy==objcop->GROUNDPOS)
- {
- if (objcop->P_UP==true)
- {
- objcop->movedirz = 0;
- }
- else if (objcop->P_DOWN==true)
- {
- objcop->movedirz =1;
- }
- else objcop->movedirz = 2;
- if (objcop->P_LEFT==true)
- {
- objcop->movedirx = 1;
- }
- else if (objcop->P_RIGHT==true)
- {
- objcop->movedirx= 0;
- }
- else objcop->movedirx = 2;
- Walk(objcop);
- }
- }
- }
- void object::Apply_max_limit_vx(objcopy * objcop)
- {
- if (Frames[objcop->currframe].mxlmtvx != "4321")
- {
- if (objcop->facing ==0)
- {
- if (objcop->total_fx > Eval(objcop, Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx);
- if (objcop->total_fx < Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1;
- }
- else
- {
- if (objcop->total_fx < Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx)*-1;
- if (objcop->total_fx > Eval(objcop, Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Eval(objcop, Frames[objcop->currframe].mxlmtvx);
- }
- }
- }
- void object::Apply_max_limit_vy(objcopy * objcop)
- {
- if (Frames[objcop->currframe].mxlmtvy != "4321")
- {
- if (objcop->total_fy>0)
- {
- if (objcop->total_fy > Eval(objcop, Frames[objcop->currframe].mxlmtvy)) objcop->total_fy = Eval(objcop, Frames[objcop->currframe].mxlmtvy);
- }
- else
- {
- if (objcop->total_fy < Eval(objcop, Frames[objcop->currframe].mxlmtvy)*-1) objcop->total_fy = Eval(objcop, Frames[objcop->currframe].mxlmtvy)*-1;
- }
- }
- }
- void object::Basic_Jump(objcopy * objcop)
- {
- if (objcop->P_JUMP==true && objcop->posy==objcop->GROUNDPOS && (Frames[objcop->currframe].flags[0]||Frames[objcop->currframe].flags[1]))
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=jumping;
- objcop->newframe=true;
- }
- }
- void object::BlitShadow(objcopy * objcop)
- {
- if (!(Frames[objcop->currframe].flags[8]) && objcop->picn!=999)
- {
- float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
- float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
- float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
- float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
- if (objcop->facing==0 && objcop->picn!=999)
- {
- int pos[] = {(objcop->posx)-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
- };
- glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].shad );
- glBegin(GL_QUADS);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- 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]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- 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]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- 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]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- 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]);
- glEnd();
- }
- if (objcop->facing==1 && objcop->picn!=999)
- {
- int tempaval=(objcop->posx+Eval(objcop, Frames[objcop->currframe].center_X)+objcop->posx);
- 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};
- glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].shad );
- glBegin(GL_QUADS);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- 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]);
- //glColor3f(0.0f, 0.0/f, 0.2f);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- 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]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- 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]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- 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]);
- glEnd();
- }
- }
- }
- void object::Respond_ToInput(objcopy * objcop)
- {
- if (Frames[objcop->currframe].flags[3]&&(objcop->P_LEFT==true || objcop->P_RIGHT==true))
- {
- if (objcop->P_LEFT==true) objcop->facing=1;
- if (objcop->P_RIGHT==true) objcop->facing=0;
- }
- if (objcop->currsp >= 0)
- {
- bool smthisclicked=false;
- if (objcop->P_ATTACK_C)
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=0;
- objcop->inputarray[0+6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_DEFEND_C)
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:int(objcop->inputarray[abc-1]);
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=1;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_JUMP_C)
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=2;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_SPECIAL_C )
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=3;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_UP_C)
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=6;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_DOWN_C)
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=7;
- objcop->inputarray[6]=SDL_GetTicks();
- for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf];
- std::cout<<"\n";
- }
- //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; }
- //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; }
- if ((objcop->P_RIGHT_C && objcop->facing == 0)||(objcop->P_LEFT_C && objcop->facing == 1))
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=4;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if ((objcop->P_RIGHT_C && objcop->facing == 1)||(objcop->P_LEFT_C && objcop->facing == 0))
- {
- for (int abc=5; abc>=0; abc--)
- {
- objcop->inputarray[abc]=abc==0?4321:objcop->inputarray[abc-1];
- objcop->inputarray[abc+6]=abc==0?4321:objcop->inputarray[abc+6-1];
- }
- objcop->inputarray[0]=5;
- objcop->inputarray[6]=SDL_GetTicks();
- //for (int asdf=0; asdf<12; asdf++) std::cout<<","<<objcop->inputarray[asdf]; std::cout<<"\n";
- }
- if (objcop->P_UP && Frames[objcop->currframe].h_ua!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_ua);
- objcop->newframe=true;
- }
- if (objcop->P_DOWN && Frames[objcop->currframe].h_da!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_da);
- objcop->newframe=true;
- }
- //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; }
- //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; }
- if (objcop->P_ATTACK && Frames[objcop->currframe].h_a!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_a);
- objcop->newframe=true;
- }
- if (objcop->P_JUMP && Frames[objcop->currframe].h_j!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_j);
- objcop->newframe=true;
- }
- if (objcop->P_DEFEND && Frames[objcop->currframe].h_d!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_d);
- objcop->newframe=true;
- }
- if (objcop->P_SPECIAL && Frames[objcop->currframe].h_s!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_s);
- objcop->newframe=true;
- }
- if (((objcop->P_RIGHT && objcop->facing == 0)||(objcop->P_LEFT && objcop->facing == 1)) && Frames[objcop->currframe].h_f!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_f);
- objcop->newframe=true;
- }
- if (((objcop->P_RIGHT && objcop->facing == 1)||(objcop->P_LEFT && objcop->facing == 0)) && Frames[objcop->currframe].h_b!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].h_b);
- objcop->newframe=true;
- }
- if (!objcop->caught)
- {
- int tempameh=0;
- for (int y=0; y < Frames[objcop->currframe].combinationindx; y++)
- {
- bool correctinput=true;
- for (int z=0; z < Frames[objcop->currframe].COMBINATIONS[y].depth; z++)
- {
- if (Frames[objcop->currframe].COMBINATIONS[y].inputseq[z] > 9)
- {
- //correctinput= correctinput && Frames[objcop->currframe].COMBINATIONS[y].inputseq[z]-10==objcop->inputarray[z];
- switch (Frames[objcop->currframe].COMBINATIONS[y].inputseq[z])
- {
- case 10:
- correctinput= correctinput&&objcop->P_ATTACK;
- break;
- case 11:
- correctinput= correctinput&&objcop->P_DEFEND;
- break;
- case 12:
- correctinput= correctinput&&objcop->P_JUMP;
- break;
- case 13:
- correctinput= correctinput&&objcop->P_SPECIAL;
- break;
- case 14:
- correctinput= correctinput&&((objcop->P_RIGHT&&objcop->facing==0)||(objcop->P_LEFT&&objcop->facing==1));
- break;
- case 15:
- correctinput= correctinput&&((objcop->P_RIGHT&&objcop->facing==1)||(objcop->P_LEFT&&objcop->facing==0));
- break;
- case 16:
- correctinput= correctinput&&objcop->P_UP;
- break;
- case 17:
- correctinput= correctinput&&objcop->P_DOWN;
- break;
- case 18:
- correctinput= correctinput&&objcop->P_LEFT;
- break;
- case 19:
- correctinput= correctinput&&objcop->P_RIGHT;
- break;
- default:
- correctinput=false;
- }
- }
- else
- {
- correctinput= correctinput && Frames[objcop->currframe].COMBINATIONS[y].inputseq[z]==objcop->inputarray[z];
- }
- tempameh++;
- }
- if (Frames[objcop->currframe].COMBINATIONS[y].delay!="4321")
- correctinput=correctinput&&Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].delay)==(Eval(objcop, Frames[objcop->currframe].delay)-objcop->delayU);
- if (Frames[objcop->currframe].COMBINATIONS[y].depth>=1 &&correctinput)
- {
- 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))
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].nxt);
- objcop->newframe=true;
- smthisclicked=true;
- for (int xyz=0; xyz<tempameh; xyz++) objcop->inputarray[xyz]=4321;
- }
- 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))
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].COMBINATIONS[y].nxt);
- objcop->newframe=true;
- smthisclicked=true;
- for (int xyz=0; xyz<tempameh; xyz++) objcop->inputarray[xyz]=4321;
- }
- }
- int asdfasdf=213123;
- }
- if (objcop->P_ATTACK_C && !smthisclicked)
- {
- if (Frames[objcop->currframe].c_a!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_a);
- objcop->newframe=true;
- smthisclicked=true;
- }
- }
- if (Frames[objcop->currframe].c_d!="4321" && objcop->P_DEFEND_C && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_d);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_j!="4321" && objcop->P_JUMP_C && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_j);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_s!="4321" && objcop->P_SPECIAL_C && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_s);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_ua!="4321" && objcop->P_UP_C && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_ua);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_da!="4321" && objcop->P_DOWN_C && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_da);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_f!="4321" && ((objcop->P_RIGHT_C && objcop->facing == 0)||(objcop->P_LEFT_C && objcop->facing == 1)) && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_f);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (Frames[objcop->currframe].c_b!="4321" && ((objcop->P_RIGHT_C && objcop->facing == 1)||(objcop->P_LEFT_C && objcop->facing == 0)) && !smthisclicked)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].c_b);
- objcop->newframe=true;
- smthisclicked=true;
- }
- if (objcop->facing == 0)
- {
- if(objcop->P_RIGHT)objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
- if(objcop->P_LEFT)objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
- }
- if (objcop->facing == 1)
- {
- if(objcop->P_LEFT)objcop->total_fx-=Eval(objcop, Frames[objcop->currframe].xhldacc);
- if(objcop->P_RIGHT)objcop->total_fx+=Eval(objcop, Frames[objcop->currframe].xhldacc);
- }
- }
- }
- }
- void object::Regenerate_Deplete_Stuff(objcopy * objcop)
- {
- if (Frames[objcop->currframe].flags[5]) objcop->currkp = maxkp;
- objcop->currdp=objcop->currdp+float((float)dpsec/60.0)>=maxdp?maxdp:objcop->currdp+float((float)dpsec/60.0); //Regen DP
- objcop->currsp=objcop->currsp+float((float)spsec/60.0)>=maxsp?maxsp:objcop->currsp+float((float)spsec/60.0); //Regen SP
- objcop->currkp=objcop->currkp+float((float)knockrate/60.0)>=maxkp?maxkp:objcop->currkp+float((float)knockrate/60.0); //Regen Knock Points
- objcop->currrp=objcop->currrp+float((float)rpsec/60.0)>=maxrp?maxrp:objcop->currrp+float((float)rpsec/60.0); //Regen RP
- objcop->hitcounter-=objcop->hitcounter!=0?1:0; //Regen Hit Counter
- //objcop->tempcount= objcop->tempcount==60?0:++objcop->tempcount;
- }
- void object::Set_IMG_No_On_Current_Grid(objcopy * objcop)
- {
- if (objcop->newid)
- {
- if (LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321")
- objcop->gridn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid);
- else
- objcop->gridn=0;
- objcop->picn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].img);
- if (objcop->picn!=999)
- {
- for (int gridno=0; gridno<LOADED->OBJECTS[objcop->id].imgindx; gridno++)
- {
- if (objcop->picn > LOADED->OBJECTS[objcop->id].IMGS[gridno].frameno-1)
- {
- objcop->gridn+=1;
- objcop->picn-=LOADED->OBJECTS[objcop->id].IMGS[gridno].row*IMGS[gridno].col;
- }
- else
- {
- break;
- }
- }
- }
- }
- else
- {
- try
- {
- bool www=LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321";
- }
- catch(...)
- {
- std::cout<<"hello";
- }
- if (LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid!="4321")
- objcop->gridn=Eval(objcop, LOADED->OBJECTS[objcop->id].Frames[objcop->currframe].grid);
- else
- objcop->gridn=0;
- objcop->picn=Evaluate(Frames[objcop->currframe].img);
- if (objcop->picn!=999)
- {
- for (int gridno=0; gridno<imgindx; gridno++)
- {
- if (objcop->picn > IMGS[gridno].frameno-1)
- {
- objcop->gridn+=1;
- objcop->picn-=IMGS[gridno].row*IMGS[gridno].col;
- }
- else
- {
- break;
- }
- }
- }
- }
- }
- void object::Adopt_Data(objcopy * objcop)
- {
- if (Frames[objcop->currframe].adptx!="4321")
- {
- std::string asdfasdf=Frames[objcop->currframe].adptx;
- objcop->posx=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adptx)].posx;
- }
- if (Frames[objcop->currframe].adpty!="4321")
- {
- objcop->posy=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adpty)].posy;
- }
- if (Frames[objcop->currframe].adptz!="4321")
- {
- objcop->posz=LOADED->ON_SCREEN_REAL_OBJS[Eval(objcop, Frames[objcop->currframe].adptz)].posz;
- }
- }
- void object::Update_Frame_If_Time(objcopy * objcop)
- {
- //priority
- objcop->rndrngpriority=4321;
- if (Frames[objcop->currframe].rndrngpriority!="4321")
- {
- objcop->rndrngpriority=Eval(objcop, Frames[objcop->currframe].rndrngpriority);
- }
- if (objcop->curse_id!=4321) //stop cursing when time;
- {
- if (LOADED->CATCHINGIDS[objcop->curse_id][6]==0)
- {
- objcop->curse_id=4321;
- objcop->caught=false;
- }
- }
- if (objcop->newframe)
- {
- if (Frames[objcop->currframe].flags[22])
- {
- if (objcop->rndrbackid==4321)
- {
- LOADED->OBJSBEHIND_INDEX++;
- objcop->rndrbackid=1;
- }
- }
- if (Frames[objcop->currframe].flags[18])
- {
- objcop->facing=objcop->facing==1?0:1;
- }
- if (Frames[objcop->currframe].trans[0]!="4321")
- {
- objcop->posx+=Eval(objcop, Frames[objcop->currframe].trans[0]);
- }
- if (Frames[objcop->currframe].trans[1]!="4321")
- {
- objcop->posy+=Eval(objcop, Frames[objcop->currframe].trans[1]);
- }
- if (Frames[objcop->currframe].trans[2]!="4321")
- {
- objcop->posz+=Eval(objcop, Frames[objcop->currframe].trans[2]);
- }
- for (int z=0; z<20; z++)
- {
- objcop->rectdensity[z]=0;
- }
- 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);
- if (objcop->newframe && Frames[objcop->currframe].addhp!="4321")
- objcop->currhp=objcop->currhp+Eval(objcop, Frames[objcop->currframe].addhp)>=maxhp?maxhp:objcop->currhp+Eval(objcop, Frames[objcop->currframe].addhp);
- if (objcop->newframe && Frames[objcop->currframe].reggy!="4321") //set_reg= stuff
- {
- std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- std::string regas=Frames[objcop->currframe].reggy;
- std::string regasvals=Frames[objcop->currframe].reggyval;
- for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
- {
- if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
- {
- regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
- }
- else if(regas.find("$")==std::string::npos)
- {
- break;
- }
- }
- size_t vertposition;
- while (regas.find("|")!=std::string::npos)
- {
- if (regasvals.find("||")!=std::string::npos)
- {
- vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
- }
- if (regas.substr(0, regas.find("|")).find("G_")==std::string::npos)
- {
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- else
- {
- objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- }
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- else
- {
- objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- }
- else
- {
- std::string greg=regas.substr(regas.find("G_")+2, regas.find("$", regas.find("G_"))-(regas.find("G_")+2));
- LOADED->GLOBALREGS[Evaluate(greg)]=Eval(objcop, regasvals);
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- }
- if (regas.find("$G_")!=std::string::npos)
- {
- std::string greg=regas.substr(regas.find("G_")+2, regas.find("$", regas.find("G_"))-(regas.find("G_")+2));
- LOADED->GLOBALREGS[Evaluate(greg)]=Eval(objcop, regasvals);
- }
- else
- {
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- else
- {
- objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- }
- }
- objcop->delayU=Eval(objcop, Frames[objcop->currframe].delay);
- objcop->newframe=false;
- if (Frames[objcop->currframe].loop_goto!="4321" &&objcop->doloop[1]!=objcop->currframe)
- {
- objcop->doloop[0]=0;
- }
- }
- if ((Frames[objcop->currframe].flags[0]||Frames[objcop->currframe].flags[1]) && objcop->currsp < 0)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=fatigue;
- objcop->newframe=true;
- objcop->currsp=0;
- return;
- }
- if (objcop->delayU==0)
- {
- if (Frames[objcop->currframe].nxtid!="4321")
- {
- objcop->id=Eval(objcop, Frames[objcop->currframe].nxtid);
- objcop->newid=true;
- }
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].nxt);
- objcop->newframe=true;
- if (objcop->currframe==1000)
- {
- objcop->currframe=objcop->previousframe;
- objcop->deleteobj=true;
- }
- }
- else //update frame and loop on the delay
- {
- if (!objcop->caught)
- {
- objcop->delayU--;
- }
- else
- {
- if (objcop->curse_id!=4321)
- {
- if (LOADED->CATCHINGIDS[objcop->curse_id][0]!=4321)
- {
- objcop->currframe=LOADED->CATCHINGIDS[objcop->curse_id][0];
- objcop->newframe=true;
- }
- objcop->posx=LOADED->CATCHINGIDS[objcop->curse_id][2]==4321?objcop->posx:LOADED->CATCHINGIDS[objcop->curse_id][2];
- objcop->posy=LOADED->CATCHINGIDS[objcop->curse_id][3]==4321?objcop->posy:LOADED->CATCHINGIDS[objcop->curse_id][3];
- objcop->posz=LOADED->CATCHINGIDS[objcop->curse_id][4]==4321?objcop->posz:LOADED->CATCHINGIDS[objcop->curse_id][4];
- }
- }
- }
- bool sadfasdf=Frames[objcop->currframe].exists;
- if (!Frames[objcop->currframe].exists)
- {
- if (objcop->posy==objcop->GROUNDPOS)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=standing;
- objcop->newframe=true;
- return;
- }
- else if((objcop->posy>objcop->GROUNDPOS))
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=hitground;
- objcop->newframe=true;
- return;
- }
- else
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=inair;
- objcop->newframe=true;
- return;
- }
- }
- if (Frames[objcop->currframe].flags[17])
- {
- for (int xyz=0; xyz<6; xyz++) objcop->inputarray[xyz]=4321;
- }
- }
- void object::Blit ( objcopy * objcop)
- {
- ///SDL_Rect tempah={posx-BG.shadowpos.x, posz-BG.shadowpos.y, BG.shadowpos.w, BG.shadowpos.h};
- //SDL_BlitSurface (BG.shadow, NULL, d, &tempah); //SDL 1.2
- ///SDL_RenderCopy(MainRend, BG.shadow, NULL, &tempah);
- int posrcam=CAM[0];
- int pos[4]= {objcop->posx+CAM[0],objcop->posz+objcop->posy+CAM[1],0,0};
- if (Evaluate(Frames[objcop->currframe].alpha)!=4321)
- {
- glColor4f(1.0f, 1.f, 1.f, (float)Evaluate(Frames[objcop->currframe].alpha)/255.0);
- }
- else
- {
- glColor4f(1.0f, 1.f, 1.f, 1.f);
- }
- if (objcop->facing==0 && objcop->picn!=999)
- {
- pos[0]=float((objcop->posx+CAM[0])-Eval(objcop,Frames[objcop->currframe].center_X));
- pos[1]=float((objcop->posz)-Eval(objcop,Frames[objcop->currframe].center_Y)+(objcop->posy)+CAM[1]);
- pos[2]=float(IMGS[objcop->gridn].clip[objcop->picn].w);
- pos[3]=float(IMGS[objcop->gridn].clip[objcop->picn].h);
- float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
- float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
- float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
- float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
- glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].grid );
- glBegin(GL_QUADS);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0], pos[1]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2], pos[1]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2], pos[1]+pos[3]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0], pos[1]+pos[3]);
- glEnd();
- //SDL_RenderCopy(MainRend, IMGS[0].grid, &IMGS[0].clip[Evaluate(Frames[currframe].img)], &pos);
- //SDL_BlitSurface (IMGS[0].grid, &IMGS[0].clip[Evaluate(Frames[currframe].img)], d, &pos); SDL 1.2
- }
- if (objcop->facing==1 && objcop->picn!=999)
- {
- int tempaval=(objcop->posx+Eval(objcop,Frames[objcop->currframe].center_X)+objcop->posx);
- float depthfactor=1.0-((float)objcop->posz/(float)SH);
- depthfactor*=0;
- pos[0]=float((objcop->posx+CAM[0])-((IMGS[objcop->gridn].clip_[objcop->picn].w)-Eval(objcop,Frames[objcop->currframe].center_X)));
- pos[1]=float(objcop->posz-Eval(objcop,Frames[objcop->currframe].center_Y)+objcop->posy+CAM[1]);
- pos[2]=float(IMGS[objcop->gridn].clip[objcop->picn].w);
- pos[3]=float(IMGS[objcop->gridn].clip[objcop->picn].h);
- float cx=float(IMGS[objcop->gridn].clip[objcop->picn].x);
- float cy=float(IMGS[objcop->gridn].clip[objcop->picn].y);
- float cw=float(IMGS[objcop->gridn].clip[objcop->picn].w);
- float ch=float(IMGS[objcop->gridn].clip[objcop->picn].h);
- glBindTexture( GL_TEXTURE_2D, IMGS[objcop->gridn].grid );
- glBegin(GL_QUADS);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- glVertex2f((pos[0]+pos[2])-(pos[2]*0.5*depthfactor), pos[1]+(pos[3]*depthfactor));
- //glColor3f(0.0f, 0.0/f, 0.2f);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+(pos[2]*depthfactor*0.5), pos[1]+(pos[3]*depthfactor));
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+(pos[2]*depthfactor*0.5), (pos[1]+pos[3]));
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f((pos[0]+pos[2])-(pos[2]*depthfactor*0.5), (pos[1]+pos[3]));
- glEnd();
- }
- //glClear( GL_COLOR_BUFFER_BIT );
- if (!Frames[objcop->currframe].flags[9])
- {
- float backuppos[3]= {objcop->posx, objcop->posy, objcop->posz};
- objcop->posz+=CAM[1];
- if (LOADED->BARS[12]!="None")
- {
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[3].grid );
- glBegin(GL_QUADS);
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0), Evaluate(LOADED->BARS[14])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- 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);
- glTexCoord2f(1 , 1);
- 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);
- glTexCoord2f(0 , 1);
- 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);
- glEnd();
- }
- if (LOADED->BARS[0]=="None")
- {
- glBindTexture( GL_TEXTURE_2D, NULL );
- switch (objcop->team)
- {
- case 0:
- glColor4f(1.0f, 0.f, 0.f, 0.5f);
- break;
- case 1:
- glColor4f(0.0f, 0.f, 1.f, 0.5f);
- break;
- case 2:
- glColor4f(0.0f, 1.f, 0.f, 0.5f);
- break;
- case 3:
- glColor4f(1.0f, 1.f, 0.f, 0.5f);
- break;
- default:
- ;
- }
- }
- else
- {
- switch(objcop->team)
- {
- case 0:
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[0].grid );
- break;
- case 1:
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[4].grid );
- break;
- case 2:
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[5].grid );
- break;
- case 3:
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[6].grid );
- break;
- default :
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[7].grid );
- break;
- }
- }
- if (objcop->currhp >= 0)
- {
- glBegin(GL_QUADS);
- if (LOADED->BARS[0]=="None")
- {
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+10);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10+5);
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+10+5);
- }
- else
- {
- switch(Evaluate(LOADED->BARS[3]))
- {
- case 1:
- glTexCoord2f(1-float(float(objcop->currhp)/float(maxhp)) , 0);
- 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);
- glTexCoord2f(1 , 0);
- 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);
- glTexCoord2f(1 , 1);
- 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);
- glTexCoord2f(1-float(float(objcop->currhp)/float(maxhp)) , 1);
- 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);
- break;
- case 2:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(1 , float(float(objcop->currhp)/float(maxhp)));
- 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))));
- glTexCoord2f(0 , float(float(objcop->currhp)/float(maxhp)));
- 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))));
- break;
- case 3:
- glTexCoord2f(0 , 1-float(float(objcop->currhp)/float(maxhp)));
- 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))));
- glTexCoord2f(1 , 1-float(float(objcop->currhp)/float(maxhp)));
- 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))));
- glTexCoord2f(1 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- break;
- default:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(1*float(float(objcop->currhp)/float(maxhp)) , 0);
- 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);
- glTexCoord2f(1*float(float(objcop->currhp)/float(maxhp)) , 1);
- 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);
- glTexCoord2f(0 , 1);
- 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);
- }
- }
- glEnd();
- }
- if (LOADED->BARS[1]=="None")
- {
- glBindTexture( GL_TEXTURE_2D, NULL);
- glColor4f(1.0f, 1.f, 1.f, 0.5f);
- }
- else
- {
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[1].grid);
- }
- if (objcop->currsp >= 0)
- {
- glBegin(GL_QUADS);
- if (LOADED->BARS[1]=="None")
- {
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+17);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+17);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+20);
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+20);
- }
- else
- {
- switch(Evaluate(LOADED->BARS[4]))
- {
- case 1:
- glTexCoord2f(1-float(float(objcop->currsp)/float(maxsp)) , 0);
- 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);
- glTexCoord2f(1 , 0);
- 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);
- glTexCoord2f(1 , 1);
- 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);
- glTexCoord2f(1-float(float(objcop->currsp)/float(maxsp)) , 1);
- 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);
- break;
- case 2:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(1 , float(float(objcop->currsp)/float(maxsp)));
- 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))));
- glTexCoord2f(0 , float(float(objcop->currsp)/float(maxsp)));
- 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))));
- break;
- case 3:
- glTexCoord2f(0 , 1-float(float(objcop->currsp)/float(maxsp)));
- 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))));
- glTexCoord2f(1 , 1-float(float(objcop->currsp)/float(maxsp)));
- 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))));
- glTexCoord2f(1 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- break;
- default:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(1*float(float(objcop->currsp)/float(maxsp)) , 0);
- 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);
- glTexCoord2f(1*float(float(objcop->currsp)/float(maxsp)) , 1);
- 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);
- glTexCoord2f(0 , 1);
- 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);
- }
- }
- glEnd();
- }
- if (LOADED->BARS[2]=="None")
- {
- glBindTexture( GL_TEXTURE_2D, NULL);
- glColor4f(0.6f, 0.1f,0.1f, 0.5f);
- }
- else
- {
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[2].grid);
- }
- if (objcop->currrp >= 0)
- {
- glBegin(GL_QUADS);
- if (LOADED->BARS[1]=="None")
- {
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+17);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+17);
- glVertex2f(posrcam+objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+20);
- glVertex2f(posrcam+objcop->posx-20, objcop->posz+20);
- }
- else
- {
- switch(Evaluate(LOADED->BARS[5]))
- {
- case 1:
- glTexCoord2f(1-float(float(objcop->currrp)/float(maxrp)) , 0);
- 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);
- glTexCoord2f(1 , 0);
- 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);
- glTexCoord2f(1 , 1);
- 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);
- glTexCoord2f(1-float(float(objcop->currrp)/float(maxrp)) , 1);
- 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);
- break;
- case 2:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(1 , float(float(objcop->currrp)/float(maxrp)));
- 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))));
- glTexCoord2f(0 , float(float(objcop->currrp)/float(maxrp)));
- 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))));
- break;
- case 3:
- glTexCoord2f(0 , 1-float(float(objcop->currrp)/float(maxrp)));
- 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))));
- glTexCoord2f(1 , 1-float(float(objcop->currrp)/float(maxrp)));
- 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))));
- glTexCoord2f(1 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- break;
- default:
- glTexCoord2f(0 , 0);
- glVertex2f(posrcam+Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(1*float(float(objcop->currrp)/float(maxrp)) , 0);
- 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);
- glTexCoord2f(1*float(float(objcop->currrp)/float(maxrp)) , 1);
- 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);
- glTexCoord2f(0 , 1);
- 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);
- }
- }
- glEnd();
- }
- glColor4f(1.0f, 1.f, 1.f, 1.0f);
- objcop->posz=backuppos[2];
- ///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};
- //SDL_BlitSurface (IMGS[objcop->gridn].grid_, &IMGS[objcop->gridn].clip_[Evaluate(Frames[currframe].img)], d, &pos); //SDL 1.2
- ///SDL_RenderCopy(MainRend, IMGS[objcop->gridn].grid_, &IMGS[0].clip_[Evaluate(Frames[currframe].img)], &pos);
- ///}
- }
- for (int drawshape_index=0; drawshape_index<Frames[objcop->currframe].drawshapeindx; drawshape_index++)
- {
- if(Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x_r!="4321")
- {
- glBindTexture( GL_TEXTURE_2D, NULL);
- float x=pos[0]+Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x);
- float y=pos[1]+Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].y);
- float x_radius=Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].x_r);
- float y_radius=Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].y_r);
- float colors[4]=
- {
- Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[0]),
- Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[1]),
- Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[2]),
- Eval(objcop, Frames[objcop->currframe].DRAWSHAPES[drawshape_index].color[3])
- };
- DrawCircle(x, y, x_radius, 300, colors,1);
- }
- }
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- //void object::CallObj(int ID, int currframeA, int posxA, int posyA, int poszA, int facingA, int teamA, bool flags[]){
- void object::CallObj(int paras[], bool flags[])
- {
- objcopy hiteff;
- hiteff=copy_object(LOADED->OBJS_STRUCTS[paras[0]]);
- hiteff.posx=paras[2];
- hiteff.posy=paras[3];
- hiteff.posz=paras[4]+1;
- hiteff.facing=paras[5];
- hiteff.currframe=paras[1];
- hiteff.showshadow=false;
- hiteff.FRICTION= LOADED->FRICTION;
- hiteff.GRAVITY = LOADED->GRAVITY;
- hiteff.team=paras[6];
- hiteff.id=paras[0];
- hiteff.newframe=true;
- if (flags[5])
- {
- hiteff.followerID=paras[7];
- }
- if (flags[6])
- {
- hiteff.playerno=paras[11];
- }
- hiteff.total_fx=paras[8];
- hiteff.total_fy=paras[9];
- hiteff.total_fz=paras[10];
- if (LOADED->D_O_INDEX==0)
- {
- hiteff.onscreen_id=LOADED->ON_SCREEN_OBJCOUNT;
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
- LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
- return;
- }
- for (int a=LOADED->D_O_INDEX-1; a >= 0; a--)
- {
- if (LOADED->DELETED_OBJS[a] >= LOADED->ON_SCREEN_OBJCOUNT )
- {
- hiteff.onscreen_id=LOADED->ON_SCREEN_OBJCOUNT;
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
- LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
- return;
- }
- else
- {
- hiteff.onscreen_id=LOADED->DELETED_OBJS[a];
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]]=hiteff;
- //LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]];
- LOADED->D_O_INDEX--;
- return;
- }
- }
- }
- void object::CallObject(objcopy * objcop)
- {
- for (int opoint=0; opoint < Frames[objcop->currframe].callobjectindx; opoint++)
- {
- int tehid=Frames[objcop->currframe].CALLOBJECTS[opoint].id=="4321"?objcop->id:Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].id);
- int tehfrm=Frames[objcop->currframe].CALLOBJECTS[opoint].frm=="4321"?0:Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].frm);
- int tehx;
- if (objcop->facing==0)
- {
- tehx=objcop->posx+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].x)-Eval(objcop, Frames[objcop->currframe].center_X);
- }
- else
- {
- tehx=objcop->posx-Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].x)+Eval(objcop, Frames[objcop->currframe].center_X);
- }
- int tehy=objcop->posy+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].y)-Eval(objcop, Frames[objcop->currframe].center_Y);
- int tehz=objcop->posz+Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].z);
- int tehfacing=Frames[objcop->currframe].CALLOBJECTS[opoint].flags[0]?int(!bool(objcop->facing)):objcop->facing;
- int tehteam= objcop->team;
- int copyregs;
- if (Frames[objcop->currframe].CALLOBJECTS[opoint].flags[5])
- {
- copyregs=objcop->followerID!=4321?objcop->followerID:objcop->index;
- }
- else
- {
- copyregs=4321;
- }
- int tehplayerno;
- if (Frames[objcop->currframe].CALLOBJECTS[opoint].flags[6])
- {
- tehplayerno=objcop->playerno;
- }
- else
- {
- tehplayerno=4321;
- }
- int tehfx=objcop->facing==0?Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_x):-1*Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_x);
- int tehfy=Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_y);
- int tehfz=Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].f_z);
- int paras[]= {tehid, tehfrm, tehx, tehy, tehz, tehfacing, tehteam, copyregs, tehfx, tehfy, tehfz, tehplayerno};
- if (Eval(objcop, Frames[objcop->currframe].delay)-objcop->delayU-1 == Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].delay)||
- Eval(objcop, Frames[objcop->currframe].delay)==0)
- {
- if (Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].cndtn)!=0)
- {
- for (int times=0; times<Eval(objcop, Frames[objcop->currframe].CALLOBJECTS[opoint].qntty); times++)
- {
- CallObj(paras, Frames[objcop->currframe].CALLOBJECTS[opoint].flags);
- }
- }
- }
- }
- }
- void background::Blit (LOAD * LOADED)
- {
- //SDL_UpdateTexture(d, NULL,backgroundSurf->pixels, 960*sizeof (Uint32));
- //SDL_RenderCopy(MainRend, backgroundTex, NULL, &position); //SDL 2.0
- int xpositions=0, ypositions=0;
- int meanxpositions=0, meanypositions=0;
- int humanplayers=0;
- for (int x=0; x < LOADED->ON_SCREEN_OBJCOUNT; x++)
- {
- if(!LOADED->ON_SCREEN_OBJS[x]->iscom)
- {
- meanxpositions++;
- meanypositions++;
- xpositions+=LOADED->ON_SCREEN_OBJS[x]->posx;
- ypositions+=LOADED->ON_SCREEN_OBJS[x]->posy;
- humanplayers++;
- }
- }
- if (humanplayers>0)
- {
- if (-(xpositions/meanxpositions)+(SW/2) !=CAM[0])
- {
- CAMV[0]=(CAM[0]-(-(xpositions/meanxpositions)+(SW/2)))/20;
- }
- if (-(ypositions/meanypositions) !=CAM[1])
- {
- CAMV[1]=(CAM[1]-(-(ypositions/meanypositions)+(SH/2)))/10;
- }
- CAM[0]-=CAMV[0];
- CAM[0]= CAM[0]>0?0:CAM[0];
- CAM[0]= CAM[0]<SW-xboundwidth?SW-xboundwidth:CAM[0];
- if (ypositions/meanypositions<-200)
- CAM[1]=(-(ypositions/humanplayers))-200;
- else
- CAM[1]=0;
- }
- /*
- glBindTexture( GL_TEXTURE_2D, NULL );
- glColor4f(0, 0, 0, 255);
- glBegin(GL_QUADS);
- glVertex2f(0, 0);
- glVertex2f(SW, 0);
- glVertex2f(SW, SH);
- glVertex2f(0, SH);
- glEnd();*/
- glColor4f(255, 255, 255, 255);
- for (int layah=0; layah<50; layah++)
- {
- if (LAYERS[layah].exists)
- {
- for (int opoint=0; opoint < LAYERS[layah].callobjectindx; opoint++)
- {
- int tehid=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].id);
- int tehfrm=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].frm)==4321?0:Evaluate(LAYERS[layah].CALLOBJECTS[opoint].frm);
- int tehx=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].x);
- int tehy=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].y);
- int tehz=Evaluate(LAYERS[layah].CALLOBJECTS[opoint].z);
- int tehfacing=LAYERS[layah].CALLOBJECTS[opoint].flags[0]?1:0;
- int tehteam= 4321;
- if (LAYERS[layah].overalldelay==0)
- {
- for (int times=0; times<Evaluate(LAYERS[layah].CALLOBJECTS[opoint].qntty); times++)
- {
- //CallObj(tehid, tehfrm, tehx, tehy, tehz, tehfacing, tehteam, LOADED);
- objcopy hiteff;
- hiteff=copy_object(LOADED->OBJS_STRUCTS[tehid]);
- hiteff.posx=tehx;
- hiteff.posy=tehy;
- hiteff.posz=tehz;
- hiteff.facing=tehfacing;
- hiteff.currframe=tehfrm;
- hiteff.showshadow=false;
- hiteff.FRICTION= LOADED->FRICTION;
- hiteff.GRAVITY = LOADED->GRAVITY;
- hiteff.team=tehteam;
- hiteff.id=tehid;
- hiteff.newframe=true;
- if (LOADED->D_O_INDEX==0)
- {
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
- LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
- continue;
- }
- for (int a=LOADED->D_O_INDEX-1; a >= 0; a--)
- {
- if (LOADED->DELETED_OBJS[a] >= LOADED->ON_SCREEN_OBJCOUNT )
- {
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=hiteff;
- LOADED->ON_SCREEN_OBJS[LOADED->ON_SCREEN_OBJCOUNT]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->ON_SCREEN_OBJCOUNT++];
- break;
- }
- else
- {
- LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]]=hiteff;
- LOADED->ON_SCREEN_OBJS[LOADED->DELETED_OBJS[a]]=&LOADED->ON_SCREEN_REAL_OBJS[LOADED->DELETED_OBJS[a]];
- LOADED->D_O_INDEX--;
- break;
- }
- }
- }
- }
- }
- LAYERS[layah].posx+=Evaluate(LAYERS[layah].f_x);
- LAYERS[layah].posy+=Evaluate(LAYERS[layah].f_y);
- if (LAYERS[layah].overalldelay==Evaluate(LAYERS[layah].restart))
- {
- LAYERS[layah].posx=Evaluate(LAYERS[layah].x);
- LAYERS[layah].posy=Evaluate(LAYERS[layah].y);
- LAYERS[layah].overalldelay=0;
- }
- else
- {
- LAYERS[layah].overalldelay++;
- }
- if (Evaluate(LAYERS[layah].restart)==4321)
- {
- LAYERS[layah].overalldelay=4321;
- }
- //int layer_width=LAYERS[layah].IMGS[0].gw;
- //int layer_height=LAYERS[layah].IMGS[0].gh;
- glBindTexture( GL_TEXTURE_2D, LAYERS[layah].IMG[0].grid );
- glBegin(GL_QUADS);
- glTexCoord2i(0, 0);
- glVertex3f(float(LAYERS[layah].posx) +CAM[0], float(Evaluate(LAYERS[layah].y)) +CAM[1] +CAM[2], 0);
- glTexCoord2i(1*Evaluate(LAYERS[layah].rptx), 0);
- 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);
- glTexCoord2i(1*Evaluate(LAYERS[layah].rptx), 1*Evaluate(LAYERS[layah].rpty));
- 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);
- glTexCoord2i(0, 1*Evaluate(LAYERS[layah].rpty));
- 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);
- glEnd();
- }
- }
- //SDL_BlitSurface (backgroundSurf, NULL, d, &position); //SDL 1.2
- }
- void object::Platforming_Solid(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[])
- {
- SDL_Rect temprect= {0, 0, 0, 0};
- int effx, effy;
- int b[6];
- int Both_Platform_Solid=0;
- if (!Frames[objcop->currframe].flags[14]&&LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[6] && objcop->posy <= r[1]
- )
- {
- b[0]=Evaluate(Frames[objcop->currframe].BDYS[20].x);
- b[1]=Evaluate(Frames[objcop->currframe].BDYS[20].y);
- b[2]=Evaluate(Frames[objcop->currframe].BDYS[20].z);
- b[3]=Evaluate(Frames[objcop->currframe].BDYS[20].w);
- b[4]=Evaluate(Frames[objcop->currframe].BDYS[20].h);
- b[5]=Evaluate(Frames[objcop->currframe].BDYS[20].z_w);
- b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
- b[0]+=objcop->facing==0 ? objcop->posx : objcop->posx-(IMGS[objcop->gridn].clip[0].w);
- b[1]+=objcop->posy;
- b[2]+=objcop->posz;
- b[0]-=objcop->total_fx;
- b[3]+=objcop->total_fx;
- b[4]+=objcop->total_fy;
- b[2]-=objcop->total_fz;
- b[5]+=objcop->total_fz;
- if(Collision_Occurs_Rect(b,r) && objcop->posy <= r[1])
- {
- if (objcop->facing == target_objcop->facing) //if there is target back goto
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto);
- objcop->newframe=true;
- }
- }
- else //if there is target front goto
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto);
- objcop->newframe=true;
- }
- }
- objcop->GROUNDPOS=r[1];
- objcop->posy=(float)objcop->GROUNDPOS;
- }
- }
- if (!Frames[objcop->currframe].flags[14]&&LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[5]
- )
- {
- b[0]=Evaluate(Frames[objcop->currframe].BDYS[20].x);
- b[1]=Evaluate(Frames[objcop->currframe].BDYS[20].y);
- b[2]=Evaluate(Frames[objcop->currframe].BDYS[20].z);
- b[3]=Evaluate(Frames[objcop->currframe].BDYS[20].w);
- b[4]=Evaluate(Frames[objcop->currframe].BDYS[20].h);
- b[5]=Evaluate(Frames[objcop->currframe].BDYS[20].z_w);
- b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
- b[0]+=objcop->facing==0 ? objcop->posx : objcop->posx-(IMGS[objcop->gridn].clip[0].w);
- b[1]+=objcop->posy;
- b[2]+=objcop->posz;
- //b[0]-=objcop->total_fx;
- b[3]+=objcop->total_fx;
- b[2]-=objcop->total_fz;
- b[5]+=objcop->total_fz;
- if(Collision_Occurs_Rect(b,r)&&objcop->GROUNDPOS!=r[1])
- {
- if (objcop->posx-objcop->total_fx<r[0])
- {
- objcop->posx=r[0]-(width/2)-2;
- }
- else if(objcop->posx-objcop->total_fx>r[0]+r[3])
- {
- objcop->posx=r[0]+r[3]+(width/2)+2;
- }
- if (objcop->posz-objcop->total_fz<r[2])
- {
- objcop->posz=r[2]-6-2;
- }
- else if(objcop->posz-objcop->total_fz>r[2]+r[5])
- {
- objcop->posz=r[2]+r[5]+6+2;
- }
- }
- }
- }
- void object::Collision_Related(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[])
- {
- 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" ||
- target_objcop->rectdensity[rect_index] < Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rctdnsty))))
- {
- int effx, effy;
- int b[6];
- for (int bdy_index=0; bdy_index < Frames[objcop->currframe].bdyindx; bdy_index++)
- {
- 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)
- )
- {
- b[0]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].x);
- b[1]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].y);
- b[2]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].z);
- b[3]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].w);
- b[4]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].h);
- b[5]=Evaluate(Frames[objcop->currframe].BDYS[bdy_index].z_w);
- b[0] =objcop->facing==1 ? IMGS[objcop->gridn].clip[0].w-b[0]-b[3] : b[0];
- 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));
- b[1]+=objcop->posy-Eval(objcop, Frames[objcop->currframe].center_Y);
- b[2]+=objcop->posz;
- effx= target_objcop->facing==0? b[0]:b[0]+b[3];
- effy= r[1]+(r[4]/2);
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]!="4321")
- {
- if (target_objcop->facing==0)
- effx+=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]);
- else
- effx-=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[0]);
- effy+=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].trans[1]);
- }
- if (Collision_Occurs_Rect(b, r)||(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12]))
- {
- if(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12])
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rmtid!="4321" &&
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].rmtid)!=objcop->onscreen_id)
- {
- break;
- }
- }
- 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])
- {
- target_objcop->posx=objcop->posx;
- }
- 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])
- {
- target_objcop->posy=objcop->posy;
- }
- 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])
- {
- target_objcop->posz=objcop->posz;
- }
- int defendstate=0; //0: nodefend, 1: defend, 2: shaken defend, 3:broken defend
- objcop->caught=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[2]; //send to catching state if flag
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321") //set the curse_id stuff
- {
- objcop->curse_id=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid);
- 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);
- LOADED->CATCHINGIDS[objcop->curse_id][5]=target_objcop->facing;
- }
- target_objcop->rectdensity[rect_index]=target_objcop->rectdensity[rect_index]==4321?4321:target_objcop->rectdensity[rect_index]+1; //rect_density stuff
- if (objcop->lasthitby!=target_objcop->onscreen_id || objcop->hitcounter==0)
- {
- if (Frames[objcop->currframe].flags[2])
- {
- 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;
- if (objcop->currdp==0)
- {
- defendstate=3;
- }
- else if(Frames[objcop->currframe].BDYS[bdy_index].bdgdp!="4321" && Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].bdgdp)>=objcop->currdp
- || (objcop->currdp < (float)maxdp/3.0&&Frames[objcop->currframe].BDYS[bdy_index].bdgdp=="4321"))
- {
- defendstate=2;
- }
- else
- {
- defendstate=1;
- }
- }
- if (defendstate==0 ||defendstate==3)
- {
- 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;
- 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;
- }
- else
- {
- 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.) );
- objcop->currhp=hpnow>=0.?hpnow:0;
- }
- if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[7])
- {
- objcop->lasthitby=target_objcop->onscreen_id;
- target_objcop->lasthit=objcop->onscreen_id;
- objcop->hitcounter=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].hitfreq);
- }
- if (defendstate==0 || defendstate==3)
- {
- if (Frames[objcop->currframe].BDYS[bdy_index].reggy!="4321") //set regs in bdys
- {
- std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- std::string regas=Frames[objcop->currframe].BDYS[bdy_index].reggy;
- std::string regasvals=Frames[objcop->currframe].BDYS[bdy_index].reggyval;
- for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
- {
- if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
- {
- regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
- }
- else if(regas.find("$")==std::string::npos)
- {
- break;
- }
- }
- size_t vertposition;
- while (regas.find("|")!=std::string::npos)
- {
- if (regasvals.find("||")!=std::string::npos)
- {
- vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
- }
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- else
- {
- objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- }
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- else
- {
- objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggy!="4321") //set_target_reg in rects
- {
- std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- std::string regas=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggy;
- std::string regasvals=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tarreggyval;
- for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
- {
- if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
- {
- regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
- }
- else if(regas.find("$")==std::string::npos)
- {
- break;
- }
- }
- size_t vertposition;
- while (regas.find("|")!=std::string::npos)
- {
- if (regasvals.find("||")!=std::string::npos)
- {
- vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
- }
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- else
- {
- objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- }
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas)]=Eval(target_objcop, regasvals);
- }
- else
- {
- objcop->regs[Evaluate(regas)]=Eval(target_objcop, regasvals);
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copydst!="4321") //copy_target in rects
- {
- std::string regs= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- std::string regas=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copydst;
- std::string regasvals=LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].copysrc;
- for (int abcdefg=0; abcdefg< regs.length(); abcdefg++)
- {
- if (regas.find("$"+regs.substr(abcdefg,1)+"$")!=std::string::npos)
- {
- regas.replace(regas.find("$"+regs.substr(abcdefg,1)+"$"), 3, stringify(abcdefg));
- }
- else if(regas.find("$")==std::string::npos)
- {
- break;
- }
- }
- size_t vertposition;
- while (regas.find("|")!=std::string::npos)
- {
- if (regasvals.find("||")!=std::string::npos)
- {
- vertposition=regasvals.find("|")==regasvals.find("||")?regasvals.find("|", regasvals.find("||")+2):regasvals.find("|");
- }
- if (objcop->followerID!=4321)
- {
- LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- else
- {
- objcop->regs[Evaluate(regas.substr(0, regas.find("|")))]=Eval(objcop, regasvals.substr(0, vertposition));
- }
- regas.erase(0, regas.find("|")+1);
- regasvals.erase(0, vertposition+1);
- }
- if (objcop->followerID==4321)
- {
- if (target_objcop->followerID==4321)
- {
- target_objcop->regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- else
- {
- LOADED->ON_SCREEN_REAL_OBJS[target_objcop->followerID].regs[Evaluate(regas)]=Eval(objcop, regasvals);
- }
- }
- else
- {
- if (target_objcop->followerID==4321)
- {
- target_objcop->regs[Evaluate(regas)]=Eval(&LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID], regasvals);
- }
- else
- {
- LOADED->ON_SCREEN_REAL_OBJS[target_objcop->followerID].regs[Evaluate(regas)]=Eval(&LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID], regasvals);
- }
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct!="0") //X IMPACT
- {
- if (target_objcop->facing ==0)
- {
- objcop->total_fx=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct);
- }
- else
- {
- objcop->total_fx=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct)*-1;
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y_impct!="0") //Y IMPACT
- {
- objcop->total_fy=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y_impct);
- }
- }
- else if(defendstate==2)
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x_impct!="0") //X IMPACT
- {
- if (target_objcop->facing ==0)
- {
- 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.);
- }
- else
- {
- 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.);
- objcop->total_fx*=-1.;
- }
- }
- }
- if (defendstate==0 || defendstate==3)
- {
- if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[7])
- {
- if (Frames[objcop->currframe].BDYS[bdy_index].respond!="4321") //BODY HOLDER SHOUDL GO TO IF RESPOND IS THERE:
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, Frames[objcop->currframe].BDYS[bdy_index].respond);
- objcop->newframe=true;
- }
- else if(objcop->currkp<=0)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=knocked;
- objcop->currkp=maxkp;
- objcop->newframe=true;
- objcop->total_fx= objcop->total_fy==0 && objcop->total_fx==0?15:objcop->total_fx;
- objcop->total_fy=objcop->total_fy==0?-7:objcop->total_fy;
- }
- else if((maxkp-objcop->currkp)>70)
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=objcop->facing!=target_objcop->facing?falling:fallingb;
- objcop->newframe=true;
- objcop->total_fx= objcop->total_fy==0 && objcop->total_fx==0?15:objcop->total_fx;
- objcop->total_fy=objcop->total_fy==0?-7:objcop->total_fy;
- }
- else
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe= objcop->facing+target_objcop->facing%2==1?whenhit:whenhitb;
- objcop->newframe=true;
- }
- if (objcop->facing == target_objcop->facing) //if there is target back goto
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tbgoto);
- objcop->newframe=true;
- if(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][1]=
- objcop->currframe;
- }
- }
- }
- else //if there is target front goto
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto!="4321")
- {
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].tfgoto);
- objcop->newframe=true;
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][0]=
- objcop->currframe;
- }
- }
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x!="4321")
- {
- if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)!=4321)
- {
- if (target_objcop->facing==0)
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=
- target_objcop->posx+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)-
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
- }
- objcop->posx=target_objcop->posx+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)-
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
- }
- else
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=
- target_objcop->posx-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)+
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
- }
- objcop->posx=target_objcop->posx-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_x)+
- Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][2]=objcop->posx;
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y!="4321")
- {
- if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)!=4321)
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][3]=
- target_objcop->posy+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)-
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
- }
- objcop->posy=target_objcop->posy+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_y)-
- Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][3]=objcop->posy;
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z!="4321")
- {
- if (Eval(target_objcop,LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z)!=4321)
- {
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- {
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][4]=
- target_objcop->posz+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z);
- }
- objcop->posz=target_objcop->posz+Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].t_z);
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid!="4321")
- LOADED->CATCHINGIDS[Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].crsid)][4]=objcop->posz;
- }
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[12])
- {
- effx=objcop->posx;
- effy=objcop->posy-(height/2);
- }
- if (!LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].flags[3]) // if flag NOEFFECT is off:
- {
- if (defendstate==3 || defendstate==0)
- {
- target_objcop->hit_xNO= stringify(Eval(objcop, target_objcop->hit_xNO)+1);
- if(LOADED->HITSYS)
- {
- //CallObj(1010, 10, effx-(LOADED->OBJECTS[1010].hittxtwidth), effy-50, objcop->posz, 0, objcop->team, LOADED);//"HITX text
- for (int digit=0; digit<target_objcop->hit_xNO.length(); digit++)
- {
- //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);
- }
- }
- int framenddd=Eval(objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].effectf);
- 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};
- CallObj(paras, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].flags);
- }
- else
- {
- int paras[]= {1001, 0, effx, effy, objcop->posz, target_objcop->facing, objcop->team, 4321, 0, 0, 0};
- CallObj(paras, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].flags);
- }
- }
- if (LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].sccss!="4321") //SUCCESS
- {
- target_objcop->previousframe=target_objcop->currframe;
- target_objcop->currframe=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].sccss);
- target_objcop->newframe=true;
- }
- }
- }
- }
- }
- }
- }
- int object::Eval(objcopy *objcop, std::string liny)
- {
- std::string line=liny;
- 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",\
- "x_vel", "y_vel", "z_vel", "height", "width", "curr_frm", "id", "p_origin_x", "p_origin_y"
- };
- std::string regs="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- std::string funcs1arg[]= {"sin", "cos", "tan", "cosec", "sec", "cot", "factorial", "2root", "3root"};
- std::string funcs2arg[]= {"resultant", "randint"};
- 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,
- 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,
- LOADED->_playermenuorigins[(objcop->playerno)*2], LOADED->_playermenuorigins[1+((objcop->playerno)*2)]
- };
- if (line.find("$j$")!=std::string::npos)
- {
- int abcd=11;
- }
- if (line.find("$")!=std::string::npos)
- {
- for (int reg=0; reg<52; reg++)
- {
- if (objcop->followerID==4321)
- {
- while (line.find("$"+regs.substr(reg, 1)+"$")!= std::string::npos)
- {
- line = line.replace(line.find("$"), 3, stringify(objcop->regs[reg]));
- }
- }
- else
- {
- while (line.find("$"+regs.substr(reg, 1)+"$")!= std::string::npos)
- {
- line = line.replace(line.find("$"+regs.substr(reg, 1)+"$"), 3, stringify(LOADED->ON_SCREEN_REAL_OBJS[objcop->followerID].regs[reg]));
- }
- }
- }
- while (line.find("$G_")!=std::string::npos)
- {
- std::string greg=line.substr(line.find("G_")+2, line.find("$", line.find("G_"))-(line.find("G_")+2));
- line=line.replace(line.find("$G_"), 4+greg.length(), stringify(LOADED->GLOBALREGS[Evaluate(greg)]));
- }
- /*while (line.find("$G_"+regs.substr(reg, 1)+"$")!= std::string::npos){
- //line = line.replace(line.find("$"), 3, std::stringify(objcop->regs[reg]));
- line = line.replace(line.find("$"), 3, std::stringify(LOADED->GLOBALREGS[greg]));
- }*/
- }
- /*for (int greg=0; greg<650; greg++){
- while (line.find("$"+stringify(greg)+"$")!= std::string::npos){
- line = line.replace(line.find("$"), 3, std::stringify(LOADED->GLOBALREGS[greg]));
- }
- }*/
- if (line.find("@")!=std::string::npos)
- {
- for (int var=0; var<25; var++)
- {
- while (line.find("@"+vars[var]+"@")!= std::string::npos)
- {
- line = line.replace(line.find("@"+vars[var]+"@"), vars[var].length()+2, stringify(s_thevars[var]));
- }
- //while (line.find("@farthest^"))
- }
- }
- line=Evaluayh(line);
- //conditionalz
- while (line.find("~")!=std::string::npos)
- {
- int temp1=line.rfind("~");
- int temp3=line.find(";", temp1);
- std::string temp2=line.substr(temp1+1,temp3-temp1);
- std::string temp4=temp2.substr(0, temp2.find("?", temp1));
- if (BEvaluate(Evaluayh(temp4)))
- {
- line.replace(temp1, temp3-temp1+1, line.substr(line.find("?", temp1)+1, line.find(":", temp1)-line.find("?", temp1)-1) );
- }
- else
- {
- line.replace(temp1, temp3-temp1+1, line.substr(line.find(":", temp1)+1, line.find(";", temp1)-line.find(":", temp1)-1) );
- }
- }
- /*while (line.find("}")!=std::string::npos && line.find("&")!=string.npos){
- for (int func1=0; func1<9; func1++){
- if (funcs1arg[func1]==line.substr(line.rfind("{")-funcs1arg[func1].length(), funcs1arg[func1].length()+1) ){
- switch(func1){
- 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 ) ))))
- }
- }
- }
- }*/
- return Evaluate(line);
- }
- /*
- void object::Update(objcopy *objcop){
- Adopt_Data(objcop);
- Update_Frame_If_Time(objcop);
- CallObject(objcop);
- Apply_FRICTION(objcop);
- Apply_GRAVITY(objcop);
- Regenerate_Deplete_Stuff(objcop);
- Set_IMG_No_On_Current_Grid(objcop);
- if (objcop->newid){
- objcop->newid=false;
- return;
- }
- Collision_Related(objcop);
- Apply_loop(objcop);
- Apply_max_limit_vx(objcop);
- Apply_max_limit_vy(objcop);
- Apply_f_x(objcop);
- Apply_f_y(objcop);
- Apply_f_z(objcop);
- Apply_x_z_hold_distance(objcop);
- Apply_acc(objcop);
- Respond_ToInput(objcop);
- Basic_Stand_Walk_Dash(objcop);
- Basic_Jump(objcop);
- Apply_max_limit_vx(objcop);
- Move(objcop->total_fx, 'x',objcop);
- Move(objcop->total_fy, 'y',objcop);
- Move(objcop->total_fz, 'z',objcop);
- }
- */
- void object::Update(objcopy *objcop)
- {
- Respond_ToInput(objcop);
- Adopt_Data(objcop);
- Update_Frame_If_Time(objcop);
- CallObject(objcop);
- Apply_FRICTION(objcop);
- Apply_GRAVITY(objcop);
- Regenerate_Deplete_Stuff(objcop);
- Set_IMG_No_On_Current_Grid(objcop);
- if (objcop->newid)
- {
- objcop->newid=false;
- return;
- }
- Apply_loop(objcop);
- //Collision_Related(objcop);
- Apply_max_limit_vx(objcop);
- Apply_max_limit_vy(objcop);
- Apply_f_x(objcop);
- Apply_f_y(objcop);
- Apply_f_z(objcop);
- Apply_x_z_hold_distance(objcop);
- Apply_acc(objcop);
- Basic_Stand_Walk_Dash(objcop);
- Basic_Jump(objcop);
- Apply_max_limit_vx(objcop);
- Move(objcop->total_fx, 'x',objcop);
- Move(objcop->total_fy, 'y',objcop);
- Move(objcop->total_fz, 'z',objcop);
- }
- void object::UpdateStat(objcopy *objcop)
- {
- Respond_ToInput(objcop);
- Adopt_Data(objcop);
- Update_Frame_If_Time(objcop);
- CallObject(objcop);
- Apply_FRICTION(objcop);
- Apply_GRAVITY(objcop);
- Regenerate_Deplete_Stuff(objcop);
- Set_IMG_No_On_Current_Grid(objcop);
- if (objcop->newid)
- {
- objcop->newid=false;
- return;
- }
- Apply_loop(objcop);
- }
- void object::CheckCollision(objcopy *objcop)
- {
- int r[6];
- int r_centerX;
- if (!Frames[objcop->currframe].flags[13]) //If |IGNORERECT| switch is off
- {
- for (int object_index=0; object_index < LOADED->ON_SCREEN_OBJCOUNT; object_index++)
- {
- objcopy* target_objcop=&LOADED->ON_SCREEN_REAL_OBJS[object_index];
- 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)
- {
- if (!target_objcop->deleted&&target_objcop->currframe!=4321 && objcop->currframe!=4321)
- {
- for (int rect_index=0; rect_index < LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].rectindx; rect_index++)
- {
- r_centerX=Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_X);
- r[0]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].x);
- r[1]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].y);
- r[2]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].z);
- r[3]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].w);
- r[4]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].h);
- r[5]=Evaluate(LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].RECTS[rect_index].z_w);
- r[0] = target_objcop->facing==1 ? LOADED->OBJECTS[target_objcop->id].IMGS[target_objcop->gridn].clip[0].w-r[0]-r[3] : r[0];
- 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);
- r[1] +=target_objcop->posy-Eval(target_objcop, LOADED->OBJECTS[target_objcop->id].Frames[target_objcop->currframe].center_Y);
- r[2] +=target_objcop->posz;
- Platforming_Solid(objcop, target_objcop, rect_index, r);
- Collision_Related(objcop, target_objcop, rect_index, r);
- }
- }
- }
- }
- }
- }
- void object::UpdateMove(objcopy *objcop)
- {
- Apply_max_limit_vx(objcop);
- Apply_max_limit_vy(objcop);
- Apply_f_x(objcop);
- Apply_f_y(objcop);
- Apply_f_z(objcop);
- Apply_x_z_hold_distance(objcop);
- Apply_acc(objcop);
- Basic_Stand_Walk_Dash(objcop);
- Apply_max_limit_vx(objcop);
- Move(objcop->total_fx, 'x',objcop);
- Move(objcop->total_fy, 'y',objcop);
- Move(objcop->total_fz, 'z',objcop);
- }
- void object::LiteUpdate(objcopy *objcop)
- {
- Respond_ToInput(objcop);
- Update_Frame_If_Time(objcop);
- CallObject(objcop);
- Apply_FRICTION(objcop);
- Apply_GRAVITY(objcop);
- Set_IMG_No_On_Current_Grid(objcop);
- Apply_loop(objcop);
- Apply_max_limit_vx(objcop);
- Apply_max_limit_vy(objcop);
- Apply_f_x(objcop);
- Apply_f_y(objcop);
- Apply_f_z(objcop);
- \
- Apply_x_z_hold_distance(objcop);
- Apply_acc(objcop);
- Apply_max_limit_vx(objcop);
- Move(objcop->total_fx, 'x',objcop);
- Move(objcop->total_fy, 'y',objcop);
- Move(objcop->total_fz, 'z',objcop);
- }
- /*-------------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement