Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Eval.h"
- using namespace std;
- struct Coord { GLfloat x; GLfloat y; };
- struct LVertexData2D { Coord position; Coord texCoord; };
- struct inputah {int click; int time; };
- class object;
- struct objcopy;
- struct objcopy{
- int rectdensity[20]={4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321};
- string hit_xNO="0";
- int inputarray[12]={4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321};
- int hit_xINTERVAL=0;
- int picn=0, gridn=0;
- int id;
- int delayU, nxt, facing, U_loop_length, hitground;
- float currhp, currsp, currrp, currdp, currkp;
- int previousframe=4321;
- bool showshadow=true;
- bool deleted=false;
- bool deleteobj=false;
- float total_fx, total_fy, total_fz=0;
- float GROUNDPOS =0;
- bool jumpforward=false, isdead;
- int doloop[2]={0, 4321};
- int posx , posz;
- int posy;
- int team, currframe;
- int lasthitby=4321;
- bool caught=false;
- int curse_id=4321;
- int hitcounter=0;
- bool iscom;
- int movedirx, movedirz=2;
- bool P_UP, P_DOWN, P_LEFT, P_RIGHT, P_ATTACK, P_DEFEND, P_JUMP, P_SPECIAL;
- bool P_ATTACK_C=false, P_DEFEND_C=false, P_JUMP_C=false, P_SPECIAL_C=false, P_UP_C=false, P_DOWN_C=false, P_LEFT_C=false, P_RIGHT_C=false;
- bool Tu=true, Td=true, Tl=true, Tr=true, TA=true, TJ=true, TD=true, TS=true;
- int DshClksIntrvlR, DshClksIntrvlL, DASHL, DASHR=0;
- bool newframe = true;
- int accU=0;
- float FRICTION;
- float GRAVITY;
- void init(object*, int, bool, float, float, int, int);
- };
- 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;
- return new_;
- }
- 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),0};
- #else
- SDL_Color color={(int_color & 0x000000ff),(int_color &
- 0x0000ff00)/0x100,(int_color & 0x00ff0000)/0x10000,0};
- #endif
- return color;
- }
- class LOAD;
- class bdy{
- public:
- string frameline;
- bool exists;
- int startpos;
- int endpos;
- string x, y, z, w, h, z_w, block, respond;
- bdy();
- void init(string);
- };
- bdy::bdy(){
- exists=false;
- }
- void bdy::init(string framelinee){
- exists=true;
- int positions[8];
- string tempao;
- string maintag="set_bdy[";
- string tags[] = {"x=", "y=", "z=", "w=", "h=", "d=", "block=", "respond="};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- bool done=false;
- if (frameline.find(tags[0])!=string::npos){positions[0] = frameline.find(tags[0])+tags[0].length();}else{positions[0]=0;}
- if (frameline.find(tags[1])!=string::npos){positions[1] = frameline.find(tags[1])+tags[1].length();}else{positions[1]=0;}
- if (frameline.find(tags[2])!=string::npos){positions[2] = frameline.find(tags[2])+tags[2].length();}else{positions[2]=0;}
- if (frameline.find(tags[3])!=string::npos){positions[3] = frameline.find(tags[3])+tags[3].length();}else{positions[3]=0;}
- if (frameline.find(tags[4])!=string::npos){positions[4] = frameline.find(tags[4])+tags[4].length();}else{positions[4]=0;}
- if (frameline.find(tags[5])!=string::npos){positions[5] = frameline.find(tags[5])+tags[5].length();}else{positions[5]=0;}
- if (frameline.find(tags[6])!=string::npos){positions[6] = frameline.find(tags[6])+tags[6].length();}else{positions[6]=0;}
- if (frameline.find(tags[7])!=string::npos){positions[7] = frameline.find(tags[7])+tags[7].length();}else{positions[7]=0;}
- 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
- done=false;
- while (!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)==")")){
- tempao+=frameline.substr(food+positions[ice],1);
- if (!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)==")"))){
- switch (ice){
- case 0: if (frameline.find(tags[0])!=string::npos){x=tempao;}else{x="0";}
- food=99999;done=true;tempao="";break;
- case 1: if (frameline.find(tags[1])!=string::npos){y=tempao;}else{y="0";
- }food=99999;done=true;tempao="";break;
- case 2: if (frameline.find(tags[2])!=string::npos){z=tempao;}else{z="-9";
- }food=99999;done=true;tempao="";break;
- case 3: if (frameline.find(tags[3])!=string::npos){w=tempao;}else{w="1";
- }food=99999;done=true;tempao="";break;
- case 4: if (frameline.find(tags[4])!=string::npos){h=tempao;}else{h="1";
- }food=99999;done=true;tempao="";break;
- case 5: if (frameline.find(tags[5])!=string::npos){z_w=tempao;}else{z_w="18";
- }food=99999;done=true;tempao="";break;
- case 6: if (frameline.find(tags[6])!=string::npos){block=tempao;}else{block="0";
- }food=99999;done=true;tempao="";break;
- case 7: if (frameline.find(tags[7])!=string::npos){respond=tempao;}else{respond="4321";
- }food=99999;done=true;tempao="";break;
- default:;}}
- else{
- food++;}
- }
- }
- }
- }
- class rect{
- public:
- string frameline;
- bool exists;
- int startpos;
- int endpos;
- bool flags[5]={false, false, false, false, false};
- string x, y, z, w, h, z_w, damage, sccss, x_impct, y_impct, z_impct, hitfreq, effect, strength, knock;
- string tfgoto, tbgoto, t_x, t_y, t_z, crsid, rctdnsty;
- rect();
- void init(string);
- };
- rect::rect(){
- exists=false;
- }
- void rect::init(string framelinee){
- exists=true;
- int positions[22];
- string tempao;
- string maintag="set_rect[";
- 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=", "target_x=", "target_y=", "target_z=", "set_curse_id=", "rect_density="};
- string flagslist[]={"|HITFALLING|", "|HITFALLINGX|", "|CATCHING|", "|NOEFFECT|", "|NOSOUND|"};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- for (int a=0; a<5; a++){
- if (frameline.find(flagslist[a])!=string::npos) flags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=string::npos){positions[0] = frameline.find(tags[0])+tags[0].length();}else{positions[0]=0;}
- if (frameline.find(tags[1])!=string::npos){positions[1] = frameline.find(tags[1])+tags[1].length();}else{positions[1]=0;}
- if (frameline.find(tags[2])!=string::npos){positions[2] = frameline.find(tags[2])+tags[2].length();}else{positions[2]=0;}
- if (frameline.find(tags[3])!=string::npos){positions[3] = frameline.find(tags[3])+tags[3].length();}else{positions[3]=0;}
- if (frameline.find(tags[4])!=string::npos){positions[4] = frameline.find(tags[4])+tags[4].length();}else{positions[4]=0;}
- if (frameline.find(tags[5])!=string::npos){positions[5] = frameline.find(tags[5])+tags[5].length();}else{positions[5]=0;}
- if (frameline.find(tags[6])!=string::npos){positions[6] = frameline.find(tags[6])+tags[6].length();}else{positions[6]=0;}
- if (frameline.find(tags[7])!=string::npos){positions[7] = frameline.find(tags[7])+tags[7].length();}else{positions[7]=0;}
- if (frameline.find(tags[8])!=string::npos){positions[8] = frameline.find(tags[8])+tags[8].length();}else{positions[8]=0;}
- if (frameline.find(tags[9])!=string::npos){positions[9] = frameline.find(tags[9])+tags[9].length();}else{positions[9]=0;}
- if (frameline.find(tags[10])!=string::npos){positions[10] = frameline.find(tags[10])+tags[10].length();}else{positions[10]=0;}
- if (frameline.find(tags[11])!=string::npos){positions[11] = frameline.find(tags[11])+tags[11].length();}else{positions[11]=0;}
- if (frameline.find(tags[12])!=string::npos){positions[12] = frameline.find(tags[12])+tags[12].length();}else{positions[12]=0;}
- if (frameline.find(tags[13])!=string::npos){positions[13] = frameline.find(tags[13])+tags[13].length();}else{positions[13]=0;}
- if (frameline.find(tags[14])!=string::npos){positions[14] = frameline.find(tags[14])+tags[14].length();}else{positions[14]=0;}
- if (frameline.find(tags[15])!=string::npos){positions[15] = frameline.find(tags[15])+tags[15].length();}else{positions[15]=0;}
- if (frameline.find(tags[16])!=string::npos){positions[16] = frameline.find(tags[16])+tags[16].length();}else{positions[16]=0;}
- if (frameline.find(tags[17])!=string::npos){positions[17] = frameline.find(tags[17])+tags[17].length();}else{positions[17]=0;}
- if (frameline.find(tags[18])!=string::npos){positions[18] = frameline.find(tags[18])+tags[18].length();}else{positions[18]=0;}
- if (frameline.find(tags[19])!=string::npos){positions[19] = frameline.find(tags[19])+tags[19].length();}else{positions[19]=0;}
- if (frameline.find(tags[20])!=string::npos){positions[20] = frameline.find(tags[20])+tags[20].length();}else{positions[20]=0;}
- if (frameline.find(tags[21])!=string::npos){positions[21] = frameline.find(tags[21])+tags[21].length();}else{positions[21]=0;}
- for (int ice=0; ice < 22; ice ++){ //iter on tags positions
- for (int food = 0; food < frameline.length(); food++){ //iter on characters of the line
- done=false;
- while (!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)==")")){
- tempao+=frameline.substr(food+positions[ice],1);
- if (!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)==")"))){
- switch (ice){
- case 0: if (frameline.find(tags[0])!=string::npos){x=tempao;}else{x="0";}
- food=99999;done=true;tempao="";break;
- case 1: if (frameline.find(tags[1])!=string::npos){y=tempao;}else{y="0";
- }food=99999;done=true;tempao="";break;
- case 2: if (frameline.find(tags[2])!=string::npos){z=tempao;}else{z="-9";
- }food=99999;done=true;tempao="";break;
- case 3: if (frameline.find(tags[3])!=string::npos){w=tempao;}else{w="1";
- }food=99999;done=true;tempao="";break;
- case 4: if (frameline.find(tags[4])!=string::npos){h=tempao;}else{h="1";
- }food=99999;done=true;tempao="";break;
- case 5: if (frameline.find(tags[5])!=string::npos){z_w=tempao;}else{z_w="18";
- }food=99999;done=true;tempao="";break;
- case 6: if (frameline.find(tags[6])!=string::npos){sccss=tempao;}else{sccss="4321";
- }food=99999;done=true;tempao="";break;
- case 7: if (frameline.find(tags[7])!=string::npos){damage=tempao;}else{damage="0";
- }food=99999;done=true;tempao="";break;
- case 8: if (frameline.find(tags[8])!=string::npos){x_impct=tempao;}else{x_impct="0";
- }food=99999;done=true;tempao="";break;
- case 9: if (frameline.find(tags[9])!=string::npos){y_impct=tempao;}else{y_impct="0";
- }food=99999;done=true;tempao="";break;
- case 10: if (frameline.find(tags[10])!=string::npos){z_impct=tempao;}else{z_impct="0";
- }food=99999;done=true;tempao="";break;
- case 11: if (frameline.find(tags[11])!=string::npos){hitfreq=tempao;}else{hitfreq="6";
- }food=99999;done=true;tempao="";break;
- case 12: if (frameline.find(tags[12])!=string::npos){effect=tempao;}else{effect="0";
- }food=99999;done=true;tempao="";break;
- case 13: if (frameline.find(tags[13])!=string::npos){strength=tempao;}else{strength="0";
- }food=99999;done=true;tempao="";break;
- case 14: if (frameline.find(tags[14])!=string::npos){knock=tempao;}else{knock="0";
- }food=99999;done=true;tempao="";break;
- case 15: if (frameline.find(tags[15])!=string::npos){tfgoto=tempao;}else{tfgoto="4321";
- }food=99999;done=true;tempao="";break;
- case 16: if (frameline.find(tags[16])!=string::npos){tbgoto=tempao;}else{tbgoto="4321";
- }food=99999;done=true;tempao="";break;
- case 17: if (frameline.find(tags[17])!=string::npos){t_x=tempao;}else{t_x="4321";
- }food=99999;done=true;tempao="";break;
- case 18: if (frameline.find(tags[18])!=string::npos){t_y=tempao;}else{t_y="4321";
- }food=99999;done=true;tempao="";break;
- case 19: if (frameline.find(tags[19])!=string::npos){t_z=tempao;}else{t_z="4321";
- }food=99999;done=true;tempao="";break;
- case 20: if (frameline.find(tags[20])!=string::npos){crsid=tempao;}else{crsid="4321";
- }food=99999;done=true;tempao="";break;
- case 21: if (frameline.find(tags[21])!=string::npos){rctdnsty=tempao;}else{rctdnsty="4321";
- }food=99999;done=true;tempao="";break;
- default:;}}
- else{
- food++;}
- }
- }
- }
- }
- class combination{
- public:
- bool exists;
- string input,time_interval, delay, nxt;
- int inputseq[6]={4321, 4321, 4321, 4321, 4321, 4321};//0-0:ca, 1:cd, 2:cj, 3:cs, 4:cf, 5:cb, 6:cu_a, 7:cd_a, 8:cl_a, 9:cr_a
- //1-0:ha, 1:hd, 2:hj, 3:hs, 4:hf, 5:hb, 6:hu_a, 7:hd_a, 8:hl_a, 9:hr_a
- int depth=0; int startpos;
- int endpos;
- combination();
- void init(string);
- };
- combination::combination(){
- exists=false;
- }
- void combination::init(string framelinee){
- exists=true;
- int positions[4];
- string tempao;
- string maintag="set_combination[";
- string tags[] = {"sequence=", "time_interval=", "delay_=", "goto_="};
- startpos=framelinee.find(maintag);
- endpos =framelinee.find("]", startpos);
- string frameline=framelinee.substr(startpos+maintag.length(), endpos-startpos-maintag.length());
- 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])!=string::npos){positions[0] = frameline.find(tags[0])+tags[0].length();}else{positions[0]=0;}
- if (frameline.find(tags[1])!=string::npos){positions[1] = frameline.find(tags[1])+tags[1].length();}else{positions[1]=0;}
- if (frameline.find(tags[2])!=string::npos){positions[2] = frameline.find(tags[2])+tags[2].length();}else{positions[2]=0;}
- if (frameline.find(tags[3])!=string::npos){positions[3] = frameline.find(tags[3])+tags[3].length();}else{positions[3]=0;}
- for (int ice=1; ice < 4; ice ++){ //iter on tags positions
- for (int food = 0; food < frameline.length(); food++){ //iter on characters of the line
- done=false;
- while (!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)==")")){
- tempao+=frameline.substr(food+positions[ice],1);
- if (!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)==")"))){
- switch (ice){
- case 1: if (frameline.find(tags[1])!=string::npos){time_interval=tempao;}else{time_interval="4321";
- }food=99999;done=true;tempao="";break;
- case 2: if (frameline.find(tags[2])!=string::npos){delay=tempao;}else{delay="0";
- }food=99999;done=true;tempao="";break;
- case 3: if (frameline.find(tags[3])!=string::npos){nxt=tempao;}else{nxt="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!=string::npos){input.erase (temp0, 1); //clear spaces
- temp0=input.find(" ", temp0);}
- for (int b=0; b<20; b++){
- while(input.find(inputparas[b])!=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(",")!=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];
- }
- }
- int e (std::string s){return Evaluate(s);}
- bool collide(bdy b, rect r, int bposx, std::string bcx_, int bposy, std::string bcy_, int bposz, int rposx,
- std::string rcx_, int rposy, std::string rcy_, int rposz, int bfc, int rfc, int * effx, int * effy,
- SDL_Rect bsize[], SDL_Rect rsize[]){
- int rx=e(r.x); int bx=e(b.x); int ry=e(r.y);int by=e(b.y); int rz=e(r.z); int bz=e(b.z);
- int rw=e(r.w); int bw=e(b.w); int rh=e(r.h); int bh=e(b.h); int rz_w=e(r.z_w); int bz_w=e(b.z_w);
- int bcx=e(bcx_); int bcy=e(bcy_); int rcx=e(rcx_); int rcy=e(rcy_);
- bx= bfc==1?(bsize[0].w-(bx))-bw:bx;
- rx = rfc==1?(rsize[0].w-(rx))-rw:rx;
- bx+= bfc==0 ? (bposx-bcx):(bposx-(bsize[0].w-bcx));
- by+=(bposy-bcy);
- bz+=(bposz);
- rx+= rfc==0 ? (rposx-rcx):(rposx-(rsize[0].w-rcx));
- ry+=(rposy-rcy);
- rz+=(rposz);
- *effx= rfc==0? bx:bx+bw;
- *effy=ry+(rh/2);
- /*if ((rx >= bx && ry >= by && rz >= bz && rx <= bx+bw && ry <= by+bh && rz <= bz+bz_w) || //(0, 0, 0)
- (rx >= bx && ry+rh >= by && rz >= bz && rx <= bx+bw && ry+rh <= by+bh && rz <= bz+bz_w) || //(0, 1, 0)
- (rx >= bx && ry >= by && rz+rz_w >= bz && rx <= bx+bw && ry <= by+bh && rz+rz_w <= bz+bz_w) || //(0, 0, 1)
- (rx+rw >= bx && ry >= by && rz >= bz && rx+rw <= bx+bw && ry <= by+bh && rz <= bz+bz_w) || //(1, 0, 0)
- (rx+rw >= bx && ry+rh >= by && rz >= bz && rx+rw <= bx+bw && ry+rh <= by+bh && rz <= bz+bz_w) || //(1, 1, 0)
- (rx+rw >= bx && ry >= by && rz+rz_w >= bz && rx+rw <= bx+bw && ry <= by+bh && rz+rz_w <= bz+bz_w) || //(1, 0, 1)
- (rx >= bx && ry+rh >= by && rz+rz_w >= bz && rx <= bx+bw && ry+rh <= by+bh && rz+rz_w <= bz+bz_w) || //(0, 1, 1)
- (rx+rw >= bx && ry+rh >= by && rz+rz_w >= bz && rx+rw <= bx+bw && ry+rh <= by+bh && rz+rz_w <= bz+bz_w))*/ //(1, 1, 1)
- if ((max(rx, bx) < min(rx+rw, bx+bw) && max(ry, by) < min(ry+rh, by+bh) && max(rz, bz) < min(rz+rz_w, bz+bz_w))||
- (max(rx, bx) < max(rx+rw, bx+bw) && max(rx, bx) < min(rx+rw, bx+bw) && max(ry, by) < min(ry+rh, by+bh) && max(rz, bz) < min(rz+rz_w, bz+bz_w))||
- (max(rx, bx) < min(rx+rw, bx+bw) && max(ry, by) < max(ry+rh, by+bh) && max(ry, by) < min(ry+rh, by+bh) && max(rz, bz) < min(rz+rz_w, bz+bz_w))||
- (max(rx, bx) < min(rx+rw, bx+bw) && max(ry, by) < min(ry+rh, by+bh) && max(rz, bz) < max(rz+rz_w, bz+bz_w)&& max(rz, bz) < min(rz+rz_w, bz+bz_w))||
- (rx < bx && rx+rw > bx+bw && ry<by && ry+rh > by+bh && rz<bz && rz+rz_w > bz+bz_w)||(bx < rx && bx+bw > rx+rw && by<ry && by+bh > ry+rh && bz<rz && bz+bz_w > rz+rz_w))
- {
- return true;
- }else{return false;}
- }
- class frame{
- string frameline;
- public:
- bool exists=false;
- bool flags[13]={false, false, false, false, false, false, false, false, false, false, false, false, false};
- int rectindx=0;
- int bdyindx=0;
- int combinationindx=0;
- vector<bdy> BDYS;
- vector<rect> RECTS;
- vector<combination> COMBINATIONS;
- string f, img, delay, nxt, state, center_X, center_Y, f_x, f_y, f_z, loop_length, loop_goto, loop_condition, acc;
- string zhlddstnc, xhlddstnc, zhldacc, xhldacc, mxlmtvx, mxlmtvy, mxlmtvz, counter, addhp, addsp, addrp, hitground;
- string c_a, c_j, c_d, c_s, c_b, c_f, c_ua, c_da, h_a, h_j, h_d, h_s, h_b, h_f, h_ua, h_da, c_ra, c_la, h_ra, h_la;
- string trans[3];
- int no;
- void init(string, int);
- };
- void frame::init(string frameline, int no_){
- exists=true;
- no=no_;
- bool validchar;
- int positions[39];
- string tempao;
- string tags[] = {"img=", "delay=", "goto=", "state=", "center=", "f_x=", "f_y=", "f_z=", "loop=", "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>=",
- "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="};
- string flagslist[]={"|STANDING|","|WALKING|", "|DEFENDING|", "|ALLOWTURN|", "|REGENDPMAX|", "|REGENKPMAX|", "|REGENSP|",
- "|REGENRP|", "|NOSHADOW|", "|NOBARS|", "|NOHPBAR|", "|NOSPBAR|", "|NORPBAR|"};
- for (int a=0; a<13; a++){
- if (frameline.find(flagslist[a])!=string::npos) flags[a]=true;
- }
- bool done=false;
- if (frameline.find(tags[0])!=string::npos){positions[0] = frameline.find(tags[0])+tags[0].length();}else{positions[0]=0;}
- if (frameline.find(tags[1])!=string::npos){positions[1] = frameline.find(tags[1])+tags[1].length();}else{positions[1]=0;}
- if (frameline.find(tags[2])!=string::npos){positions[2] = frameline.find(tags[2])+tags[2].length();}else{positions[2]=0;}
- if (frameline.find(tags[3])!=string::npos){positions[3] = frameline.find(tags[3])+tags[3].length();}else{positions[3]=0;}
- if (frameline.find(tags[4])!=string::npos){positions[4] = frameline.find(tags[4])+tags[4].length();}else{positions[4]=0;}
- if (frameline.find(tags[5])!=string::npos){positions[5] = frameline.find(tags[5])+tags[5].length();}else{positions[5]=0;}
- if (frameline.find(tags[6])!=string::npos){positions[6] = frameline.find(tags[6])+tags[6].length();}else{positions[6]=0;}
- if (frameline.find(tags[7])!=string::npos){positions[7] = frameline.find(tags[7])+tags[7].length();}else{positions[7]=0;}
- if (frameline.find(tags[8])!=string::npos){positions[8] = frameline.find(tags[8])+tags[8].length();}else{positions[8]=0;}
- if (frameline.find(tags[9])!=string::npos){positions[9] = frameline.find(tags[9])+tags[9].length();}else{positions[9]=0;}
- if (frameline.find(tags[10])!=string::npos){positions[10] = frameline.find(tags[10])+tags[10].length();}else{positions[10]=0;}
- if (frameline.find(tags[11])!=string::npos){positions[11] = frameline.find(tags[11])+tags[11].length();}else{positions[11]=0;}
- if (frameline.find(tags[12])!=string::npos){positions[12] = frameline.find(tags[12])+tags[12].length();}else{positions[12]=0;}
- if (frameline.find(tags[13])!=string::npos){positions[13] = frameline.find(tags[13])+tags[13].length();}else{positions[13]=0;}
- if (frameline.find(tags[14])!=string::npos){positions[14] = frameline.find(tags[14])+tags[14].length();}else{positions[14]=0;}
- if (frameline.find(tags[15])!=string::npos){positions[15] = frameline.find(tags[15])+tags[15].length();}else{positions[15]=0;}
- if (frameline.find(tags[16])!=string::npos){positions[16] = frameline.find(tags[16])+tags[16].length();}else{positions[16]=0;}
- if (frameline.find(tags[17])!=string::npos){positions[17] = frameline.find(tags[17])+tags[17].length();}else{positions[17]=0;}
- if (frameline.find(tags[18])!=string::npos){positions[18] = frameline.find(tags[18])+tags[18].length();}else{positions[18]=0;}
- if (frameline.find(tags[19])!=string::npos){positions[19] = frameline.find(tags[19])+tags[19].length();}else{positions[19]=0;}
- if (frameline.find(tags[20])!=string::npos){positions[20] = frameline.find(tags[20])+tags[20].length();}else{positions[20]=0;}
- if (frameline.find(tags[21])!=string::npos){positions[21] = frameline.find(tags[21])+tags[21].length();}else{positions[21]=0;}
- if (frameline.find(tags[22])!=string::npos){positions[22] = frameline.find(tags[22])+tags[22].length();}else{positions[22]=0;}
- if (frameline.find(tags[23])!=string::npos){positions[23] = frameline.find(tags[23])+tags[23].length();}else{positions[23]=0;}
- if (frameline.find(tags[24])!=string::npos){positions[24] = frameline.find(tags[24])+tags[24].length();}else{positions[24]=0;}
- if (frameline.find(tags[25])!=string::npos){positions[25] = frameline.find(tags[25])+tags[25].length();}else{positions[25]=0;}
- if (frameline.find(tags[26])!=string::npos){positions[26] = frameline.find(tags[26])+tags[26].length();}else{positions[26]=0;}
- if (frameline.find(tags[27])!=string::npos){positions[27] = frameline.find(tags[27])+tags[27].length();}else{positions[27]=0;}
- if (frameline.find(tags[28])!=string::npos){positions[28] = frameline.find(tags[28])+tags[28].length();}else{positions[28]=0;}
- if (frameline.find(tags[29])!=string::npos){positions[29] = frameline.find(tags[29])+tags[29].length();}else{positions[29]=0;}
- if (frameline.find(tags[30])!=string::npos){positions[30] = frameline.find(tags[30])+tags[30].length();}else{positions[30]=0;}
- if (frameline.find(tags[31])!=string::npos){positions[31] = frameline.find(tags[31])+tags[31].length();}else{positions[31]=0;}
- if (frameline.find(tags[32])!=string::npos){positions[32] = frameline.find(tags[32])+tags[32].length();}else{positions[32]=0;}
- if (frameline.find(tags[33])!=string::npos){positions[33] = frameline.find(tags[33])+tags[33].length();}else{positions[33]=0;}
- if (frameline.find(tags[34])!=string::npos){positions[34] = frameline.find(tags[34])+tags[34].length();}else{positions[34]=0;}
- if (frameline.find(tags[35])!=string::npos){positions[35] = frameline.find(tags[35])+tags[35].length();}else{positions[35]=0;}
- if (frameline.find(tags[36])!=string::npos){positions[36] = frameline.find(tags[36])+tags[36].length();}else{positions[36]=0;}
- if (frameline.find(tags[37])!=string::npos){positions[37] = frameline.find(tags[37])+tags[37].length();}else{positions[37]=0;}
- if (frameline.find(tags[38])!=string::npos){positions[38] = frameline.find(tags[38])+tags[38].length();}else{positions[38]=0;}
- for (int ice=0; ice < 39; ice ++){ //iter on tags positions
- for (int food = 0; food < frameline.length(); food++){ //iter on characters of the line
- done=false;
- while (!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)==")")){
- tempao+=frameline.substr(food+positions[ice],1);
- if (!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)==")"))){
- switch (ice){
- case 0: if (frameline.find(tags[0])!=string::npos){img=tempao;}else{img="0";}
- food=99999;done=true;tempao="";break;
- case 1: if (frameline.find(tags[1])!=string::npos){delay=tempao;}else{delay="0";
- }food=99999;done=true;tempao="";break;
- case 2: if (frameline.find(tags[2])!=string::npos){nxt=tempao;}else{nxt=stringify(no+1);
- }food=99999;done=true;tempao="";break;
- case 3: if (frameline.find(tags[3])!=string::npos){state=tempao;}else{state="2";
- }food=99999;done=true;tempao="";break;
- case 4: if (frameline.find(tags[4])!=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])!=string::npos){f_x=tempao;}else{f_x="0";
- }food=99999;done=true;tempao="";break;
- case 6: if (frameline.find(tags[6])!=string::npos){f_y=tempao;}else{f_y="0";
- }food=99999;done=true;tempao="";break;
- case 7: if (frameline.find(tags[7])!=string::npos){f_z=tempao;}else{f_z="0";
- }food=99999;done=true;tempao="";break;
- case 8: if (frameline.find(tags[8])!=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])!=string::npos){acc=tempao;}else{acc="0";
- }food=99999;done=true;tempao="";break;
- case 10: if (frameline.find(tags[10])!=string::npos){zhlddstnc=tempao;}else{zhlddstnc="0";
- }food=99999;done=true;tempao="";break;
- case 11: if (frameline.find(tags[11])!=string::npos){xhlddstnc=tempao;}else{xhlddstnc="0";
- }food=99999;done=true;tempao="";break;
- case 12: if (frameline.find(tags[12])!=string::npos){xhldacc=tempao;}else{xhldacc="0";
- }food=99999;done=true;tempao="";break;
- case 13: if (frameline.find(tags[13])!=string::npos){zhldacc=tempao;}else{zhldacc="0";
- }food=99999;done=true;tempao="";break;
- case 14: if (frameline.find(tags[14])!=string::npos){mxlmtvx=tempao;}else{mxlmtvx="4321";
- }food=99999;done=true;tempao="";break;
- case 15: if (frameline.find(tags[15])!=string::npos){mxlmtvy=tempao;}else{mxlmtvy="4321";
- }food=99999;done=true;tempao="";break;
- case 16: if (frameline.find(tags[16])!=string::npos){mxlmtvz=tempao;}else{mxlmtvz="4321";
- }food=99999;done=true;tempao="";break;
- case 17: if (frameline.find(tags[17])!=string::npos){counter=tempao;}else{counter="4321";
- }food=99999;done=true;tempao="";break;
- case 18: if (frameline.find(tags[18])!=string::npos){addhp=tempao;}else{addhp="4321";
- }food=99999;done=true;tempao="";break;
- case 19: if (frameline.find(tags[19])!=string::npos){addsp=tempao;}else{addsp="4321";
- }food=99999;done=true;tempao="";break;
- case 20: if (frameline.find(tags[20])!=string::npos){addrp=tempao;}else{addrp="4321";
- }food=99999;done=true;tempao="";break;
- case 21: if (frameline.find(tags[21])!=string::npos){c_a=tempao;}else{c_a="4321";
- }food=99999;done=true;tempao="";break;
- case 22: if (frameline.find(tags[22])!=string::npos){c_j=tempao;}else{c_j="4321";
- }food=99999;done=true;tempao="";break;
- case 23: if (frameline.find(tags[23])!=string::npos){c_d=tempao;}else{c_d="4321";
- }food=99999;done=true;tempao="";break;
- case 24: if (frameline.find(tags[24])!=string::npos){c_s=tempao;}else{c_s="4321";
- }food=99999;done=true;tempao="";break;
- case 25: if (frameline.find(tags[25])!=string::npos){h_a=tempao;}else{h_a="4321";
- }food=99999;done=true;tempao="";break;
- case 26: if (frameline.find(tags[26])!=string::npos){h_j=tempao;}else{h_j="4321";
- }food=99999;done=true;tempao="";break;
- case 27: if (frameline.find(tags[27])!=string::npos){h_d=tempao;}else{h_d="4321";
- }food=99999;done=true;tempao="";break;
- case 28: if (frameline.find(tags[28])!=string::npos){h_s=tempao;}else{h_s="4321";
- }food=99999;done=true;tempao="";break;
- case 29: if (frameline.find(tags[29])!=string::npos){h_b=tempao;}else{c_b="4321";
- }food=99999;done=true;tempao="";break;
- case 30: if (frameline.find(tags[30])!=string::npos){h_b=tempao;}else{h_b="4321";
- }food=99999;done=true;tempao="";break;
- case 31: if (frameline.find(tags[31])!=string::npos){hitground=tempao;}else{hitground="4321";
- }food=99999;done=true;tempao="";break;
- case 32: if (frameline.find(tags[32])!=string::npos){c_f=tempao;}else{c_f="4321";
- }food=99999;done=true;tempao="";break;
- case 33: if (frameline.find(tags[33])!=string::npos){c_ua=tempao;}else{c_ua="4321";
- }food=99999;done=true;tempao="";break;
- case 34: if (frameline.find(tags[34])!=string::npos){c_da=tempao;}else{c_da="4321";
- }food=99999;done=true;tempao="";break;
- case 35: if (frameline.find(tags[35])!=string::npos){h_f=tempao;}else{h_f="4321";
- }food=99999;done=true;tempao="";break;
- case 36: if (frameline.find(tags[36])!=string::npos){h_ua=tempao;}else{h_ua="4321";
- }food=99999;done=true;tempao="";break;
- case 37: if (frameline.find(tags[37])!=string::npos){h_da=tempao;}else{h_da="4321";
- }food=99999;done=true;tempao="";break;
- case 38: if (frameline.find(tags[38])!=string::npos){trans[0]=tempao.substr(0, tempao.find(","));
- trans[1]=tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(","));
- 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++;}
- }
- }
- }
- BDYS.resize(20);
- RECTS.resize(20);
- COMBINATIONS.resize(20);
- while (frameline.find("set_bdy[")!=string::npos){
- BDYS[bdyindx].init(frameline);
- frameline.erase(BDYS[bdyindx].startpos, BDYS[bdyindx].endpos - BDYS[bdyindx].startpos);
- bdyindx++;
- }
- while (frameline.find("set_rect[")!=string::npos){
- RECTS[rectindx].init(frameline);
- frameline.erase(RECTS[rectindx].startpos, RECTS[rectindx].endpos - RECTS[rectindx].startpos);
- rectindx++;
- }
- while (frameline.find("set_combination[")!=string::npos){
- COMBINATIONS[combinationindx].init(frameline);
- frameline.erase(COMBINATIONS[combinationindx].startpos, COMBINATIONS[combinationindx].endpos - COMBINATIONS[combinationindx].startpos);
- combinationindx++;
- }
- }
- class spritegrid{
- public:
- int w, h, col, row, frameno;
- int gw, gh;
- string colk;
- //SDL_Surface *grid, *grid_;
- //SDL_Texture *grid, *grid_;
- GLuint grid;
- GLuint shad;
- vector<SDL_Rect> clip;
- vector<SDL_Rect> clip_;
- void ini(string dir_, int w_, int h_, int col_, int row_, string colk_, int * number);
- };
- void spritegrid::ini(string dir_, int w_, int h_, int col_, int row_, string colk_, int * number){
- SDL_Surface *_grid, *_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);
- // clip, clip_ = new SDL_Rect[frameno];
- _grid = IMG_Load((dir_).c_str());
- _grid_ = IMG_Load((dir_).c_str());
- w=w_==4321?_grid->w:w_;
- h=h_==4321?_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=_grid->w;
- gh=_grid->h;
- int grid_h = (_grid->h)/row;
- int grid_w = (_grid->w)/col;
- 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);
- ((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;
- if (!(int(color.a)==0 && int(color.r)==0 && int(color.g)==0 && int(color.b)==0))
- {((unsigned int*)_grid_->pixels)[y*(_grid_->pitch/sizeof(unsigned int)) + x] = SDL_MapRGBA(_grid_->format, 0, 0, 0, 125);
- }
- }
- }
- 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);
- 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, _grid->format->BytesPerPixel, _grid->w, _grid->h,
- 0, tex_format, GL_UNSIGNED_BYTE, _grid->pixels);
- glGenTextures(1, &shad);
- glBindTexture(GL_TEXTURE_2D, shad);
- 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, _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_);
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class background{
- string name, bitmapfiledir;
- public:
- LVertexData2D V_DATA [4];
- GLuint I_DATA[4]={0, 1, 2, 3};
- GLuint VBO_ID, IBO_ID;
- //SDL_Texture *backgroundTex;
- //SDL_Texture *shadow;
- GLuint backgroundTex;
- GLuint shadow;
- SDL_Rect position;
- SDL_Rect shadowpos;
- int zbound, zboundwidth, xbound, xboundwidth;
- float shadangx, shadangy;
- background(int, int, int, int, string, string);
- void Blit (){
- //SDL_UpdateTexture(d, NULL,backgroundSurf->pixels, 960*sizeof (Uint32));
- //SDL_RenderCopy(MainRend, backgroundTex, NULL, &position); //SDL 2.0
- glBindTexture( GL_TEXTURE_2D, backgroundTex );
- glBegin(GL_QUADS);
- glTexCoord2i(0, 0);
- glVertex3f(float(position.x) +CAM[0], float(position.y) +CAM[1] +CAM[2], 0);
- glTexCoord2i(1, 0);
- glVertex3f(float(position.x+position.w) +CAM[0], float(position.y) +CAM[1] +CAM[2], 0);
- glTexCoord2i(1, 1);
- glVertex3f(float(position.x+position.w) +CAM[0], float(position.y+position.h) +CAM[1] +CAM[2], 0);
- glTexCoord2i(0, 1);
- glVertex3f(float(position.x) +CAM[0], float(position.y+position.h) +CAM[1] +CAM[2], 0);
- glEnd();
- //SDL_BlitSurface (backgroundSurf, NULL, d, &position); //SDL 1.2
- }
- };
- background::background(int a, int b, int c, int d, string e, string f){
- shadangx=0*(M_PI/180.0);
- shadangy=35*(M_PI/180.0);
- SDL_Surface *backgroundSurf;
- SDL_Surface *shadow_;
- GLenum tex_format;
- zbound = a;
- zboundwidth = b;
- xbound = c;
- xboundwidth = d;
- 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);
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class object{
- public:
- int wkspdx, wkspdz, frameno, w, h, facing=0, id, maxhp, maxsp, maxrp, inihp, inisp, inirp, delayU, nxt, currhp, currsp, currrp;
- int rphit, rpsec, rpdam, sphit, spsec, spdam, armor, armorrate, walking, standing, dashing, previousframe, U_loop_length, accU, falling, knockrate;
- int jumping, jmpspdx, jmpspdz, hitground, whenhit, whenhitb, type, knocked, maxdp, defendrate, maxkp, lying, hittxtwidth, hitnowidth, fatigue, inair;
- vector<frame> Frames;
- vector<spritegrid> IMGS;
- int spritecount=0, imgindx=0;
- string sprtfl, name, dpndncs, afildir;
- void init (int id, string dpndncs, string afildir);
- void Blit (background BG, objcopy * objcop, LOAD * LOADED);
- void Walk (background BG, objcopy *objcop){
- if (objcop->movedirx < 2 || objcop->movedirz < 2){
- if (objcop->facing == 0){
- if (objcop->movedirx == 0 && (objcop->posx+wkspdx < BG.xbound+BG.xboundwidth)) objcop->posx += wkspdx;
- if (objcop->movedirx == 1) objcop->facing = 1;
- if (objcop->movedirz == 0 && (objcop->posz-wkspdz > BG.zbound)) objcop->posz -= wkspdz;
- if (objcop->movedirz == 1 && (objcop->posz+wkspdz < BG.zbound+BG.zboundwidth)) objcop->posz += wkspdz;}
- if (objcop->facing == 1){
- if (objcop->movedirx == 0) objcop->facing = 0;
- if (objcop->movedirx == 1 && (objcop->posx-wkspdx > BG.xbound)) objcop->posx -= wkspdx;
- if (objcop->movedirz == 0 && (objcop->posz-wkspdz > BG.zbound)) objcop->posz -= wkspdz;
- if (objcop->movedirz == 1 && (objcop->posz+wkspdz < BG.zbound+BG.zboundwidth)) objcop->posz += wkspdz;}
- }}
- void Move (int value, char axis, background BG, objcopy * objcop){
- if (axis=='x'&&value > 0){
- if (objcop->posx+value > (BG.xbound+BG.xboundwidth)){
- objcop->posx=BG.xbound+BG.xboundwidth;
- }else{
- objcop->posx+=value;
- }
- }
- else if (axis=='x'&&value < 0){
- if (objcop->posx+value < BG.xbound){
- objcop->posx=BG.xbound;
- }else{
- objcop->posx+=value;
- }
- }
- if (axis=='z'&&value >= 0){
- if (objcop->posz+value > (BG.zbound+BG.zboundwidth)){
- objcop->posz=BG.zbound+BG.zboundwidth;
- }else{
- objcop->posz+=value;
- }
- }
- else if (axis=='z'&&value < 0){
- if (objcop->posz+value < BG.zbound){
- objcop->posz=BG.zbound;
- }else{
- objcop->posz+=value;
- }
- }
- if (axis=='y'){
- if (objcop->posy+value > objcop->GROUNDPOS){
- objcop->posy=objcop->GROUNDPOS;
- }else{
- objcop->posy+=value;
- }
- }
- }
- void Update_Frame_If_Time(objcopy * objcop, LOAD * LOADED);
- void Apply_loop(objcopy * objcop){
- if (objcop->previousframe!=4321 && Evaluate(Frames[objcop->currframe].loop_condition)==objcop->previousframe && !bool(objcop->doloop[0]) && Evaluate(Frames[objcop->currframe].loop_length)!=0&&objcop->newframe){ //loop tag
- objcop->U_loop_length= Evaluate(Frames[objcop->currframe].loop_length);
- objcop->doloop[0]=1;
- objcop->doloop[1]=objcop->currframe;
- }
- if (Evaluate(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=Evaluate(Frames[objcop->currframe].loop_goto);
- objcop->doloop[0]=0;objcop->newframe=true;
- }else{
- objcop->U_loop_length--;}
- }
- }
- void Apply_f_x(background A_Field, objcopy * objcop){
- if (Evaluate(Frames[objcop->currframe].f_x)!=0){ //f_x tag
- if (Evaluate(Frames[objcop->currframe].f_x)!=4321){
- if (objcop->facing==0){
- objcop->total_fx=Evaluate(Frames[objcop->currframe].f_x);
- }
- else{
- objcop->total_fx=(Evaluate(Frames[objcop->currframe].f_x)*-1);
- }
- }else{objcop->total_fx=0;}
- }
- }
- void Apply_f_y(background A_Field, objcopy * objcop){
- if (Evaluate(Frames[objcop->currframe].f_y)!=0){ //f_y tag
- if (Evaluate(Frames[objcop->currframe].f_y)!=4321){
- objcop->total_fy=Evaluate(Frames[objcop->currframe].f_y);
- }else{objcop->total_fy=0;}
- }
- }
- void 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;
- }
- }
- }}
- void Apply_GRAVITY(objcopy * objcop){
- if (type==0 && !objcop->caught){
- if(objcop->posy<objcop->GROUNDPOS&&Evaluate(Frames[objcop->currframe].f_y)!=4321){ //apply graviry
- objcop->total_fy+=objcop->GRAVITY;
- if (objcop->posy+objcop->total_fy>=objcop->GROUNDPOS){
- objcop->total_fy=0.0; objcop->posy=0.0;objcop->previousframe=objcop->currframe;objcop->newframe=true;
- if(Evaluate(Frames[objcop->currframe].hitground)!=4321){
- objcop->currframe=Evaluate(Frames[objcop->currframe].hitground);
- }else{
- objcop->currframe=hitground;
- }}
- }
- }}
- void Apply_acc(objcopy * objcop){
- if (objcop->facing ==0) objcop->total_fx+=Evaluate(Frames[objcop->currframe].acc); //acc tag
- if (objcop->facing ==1) objcop->total_fx-=Evaluate(Frames[objcop->currframe].acc);
- }
- void Apply_x_z_hold_distance(background A_Field, objcopy * objcop){
- if (type==0){
- if (objcop->P_UP==true){Move(-Evaluate(Frames[objcop->currframe].zhlddstnc), 'z', A_Field, objcop);} //z_hold_distance tag
- if (objcop->P_DOWN==true){Move(Evaluate(Frames[objcop->currframe].zhlddstnc), 'z', A_Field, objcop);}
- if (objcop->P_RIGHT==true){objcop->total_fx+= Evaluate(Frames[objcop->currframe].xhlddstnc);} //x_hold_distance tag
- if (objcop->P_LEFT==true){objcop->total_fx-= Evaluate(Frames[objcop->currframe].xhlddstnc);}
- }}
- void Apply_x_hold_distance(objcopy * objcop){
- if (objcop->P_RIGHT==true && objcop->facing == 0){
- objcop->total_fx+=Evaluate(Frames[objcop->currframe].xhldacc);
- }
- if (objcop->P_LEFT==true && objcop->facing == 1){
- objcop->total_fx-=Evaluate(Frames[objcop->currframe].xhldacc);
- }
- }
- void Basic_Stand_Walk_Dash(background A_Field, 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]){
- 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(A_Field, objcop);}
- }}
- void Apply_max_limit_vx(objcopy * objcop){
- if (Evaluate(Frames[objcop->currframe].mxlmtvx) != 4321){
- if (objcop->facing ==0){
- if (objcop->total_fx > Evaluate(Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Evaluate(Frames[objcop->currframe].mxlmtvx);
- if (objcop->total_fx < Evaluate(Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Evaluate(Frames[objcop->currframe].mxlmtvx)*-1;
- }else{
- if (objcop->total_fx < Evaluate(Frames[objcop->currframe].mxlmtvx)*-1) objcop->total_fx = Evaluate(Frames[objcop->currframe].mxlmtvx)*-1;
- if (objcop->total_fx > Evaluate(Frames[objcop->currframe].mxlmtvx)) objcop->total_fx = Evaluate(Frames[objcop->currframe].mxlmtvx);
- }
- }
- }
- void Apply_max_limit_vy(objcopy * objcop){
- if (Evaluate(Frames[objcop->currframe].mxlmtvy) != 4321){
- if (objcop->total_fy>0){
- if (objcop->total_fy > Evaluate(Frames[objcop->currframe].mxlmtvy)) objcop->total_fy = Evaluate(Frames[objcop->currframe].mxlmtvy);
- }else{
- if (objcop->total_fy < Evaluate(Frames[objcop->currframe].mxlmtvy)*-1) objcop->total_fy = Evaluate(Frames[objcop->currframe].mxlmtvy)*-1;
- }
- }
- }
- void Basic_Jump(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->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 BlitShadow(background BG, objcopy * objcop){
- if (objcop->showshadow && 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){float pos[] = {objcop->posx-Evaluate(Frames[objcop->currframe].center_X) , objcop->posz-Evaluate(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(BG.shadangx) +CAM[0], pos[1]+pos[3]+(pos[3])*tan(BG.shadangy));
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, cy/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2]+pos[2]*tan(BG.shadangx) +CAM[0], pos[1]+pos[3]+(pos[3]*tan(BG.shadangy)));
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2] +CAM[0], pos[1]+pos[3]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0] +CAM[0], pos[1]+pos[3]);
- glEnd();
- }
- if (objcop->facing==1 && objcop->picn!=999){int tempaval=(objcop->posx+Evaluate(Frames[objcop->currframe].center_X)+objcop->posx);
- float pos[] = {objcop->posx-((IMGS[objcop->gridn].clip_[objcop->picn].w)-Evaluate(Frames[objcop->currframe].center_X)) , objcop->posz-Evaluate(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(BG.shadangx) +CAM[0], pos[1]+pos[3]+pos[3]*tan(BG.shadangy));
- //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(BG.shadangx) +CAM[0], pos[1]+pos[3]+pos[3]*tan(BG.shadangy));
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0] +CAM[0], pos[1]+pos[3]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2] +CAM[0], pos[1]+pos[3]);
- glEnd(); } }
- }
- void Respond_ToInput(objcopy * objcop){
- 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 && Evaluate(Frames[objcop->currframe].c_la)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_la);objcop->newframe=true; }
- //if (objcop->P_RIGHT_C && Evaluate(Frames[objcop->currframe].c_ra)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(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 && Evaluate(Frames[objcop->currframe].h_ua)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_ua);objcop->newframe=true; }
- if (objcop->P_DOWN && Evaluate(Frames[objcop->currframe].h_da)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_da);objcop->newframe=true; }
- //if (objcop->P_LEFT && Evaluate(Frames[objcop->currframe].h_la)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_la);objcop->newframe=true; }
- //if (objcop->P_RIGHT && Evaluate(Frames[objcop->currframe].h_ra)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_ra);objcop->newframe=true; }
- if (objcop->P_ATTACK && Evaluate(Frames[objcop->currframe].h_a)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_a);objcop->newframe=true; }
- if (objcop->P_JUMP && Evaluate(Frames[objcop->currframe].h_j)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_j);objcop->newframe=true; }
- if (objcop->P_DEFEND && Evaluate(Frames[objcop->currframe].h_d)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_d);objcop->newframe=true; }
- if (objcop->P_SPECIAL && Evaluate(Frames[objcop->currframe].h_s)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_s);objcop->newframe=true; }
- if (((objcop->P_RIGHT && objcop->facing == 0)||(objcop->P_LEFT && objcop->facing == 1)) && Evaluate(Frames[objcop->currframe].h_f)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].h_f);objcop->newframe=true; }
- if (((objcop->P_RIGHT && objcop->facing == 1)||(objcop->P_LEFT && objcop->facing == 0)) && Evaluate(Frames[objcop->currframe].h_b)!=4321) {objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(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].depth>0 &&correctinput && (Evaluate(Frames[objcop->currframe].COMBINATIONS[y].time_interval)>=(objcop->inputarray[6]-objcop->inputarray[6+Frames[objcop->currframe].COMBINATIONS[y].depth-1])||Evaluate(Frames[objcop->currframe].COMBINATIONS[y].time_interval)==4321)){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].COMBINATIONS[y].nxt);objcop->newframe=true;
- smthisclicked=true;
- for (int xyz=0; xyz<tempameh; xyz++) objcop->inputarray[xyz]=4321;
- }
- }
- if (Evaluate(Frames[objcop->currframe].c_a)!=4321 && objcop->P_ATTACK_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_a);objcop->newframe=true;
- smthisclicked=true;
- }
- if (Evaluate(Frames[objcop->currframe].c_d)!=4321 && objcop->P_DEFEND_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_d);objcop->newframe=true;smthisclicked=true;
- }
- if (Evaluate(Frames[objcop->currframe].c_j)!=4321 && objcop->P_JUMP_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_j);objcop->newframe=true;smthisclicked=true;
- }
- if (Evaluate(Frames[objcop->currframe].c_s)!=4321 && objcop->P_SPECIAL_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_s);objcop->newframe=true; smthisclicked=true;
- }
- if (Evaluate(Frames[objcop->currframe].c_ua)!=4321 && objcop->P_UP_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_ua);objcop->newframe=true;smthisclicked=true;
- }
- if (Evaluate(Frames[objcop->currframe].c_da)!=4321 && objcop->P_DOWN_C && !smthisclicked){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].c_da);objcop->newframe=true; smthisclicked=true;
- }
- if (Evaluate(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=Evaluate(Frames[objcop->currframe].c_f);objcop->newframe=true; smthisclicked=true;
- }
- if (Evaluate(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=Evaluate(Frames[objcop->currframe].c_b);objcop->newframe=true;smthisclicked=true;
- }
- if (objcop->facing == 0){
- if(objcop->P_RIGHT)objcop->total_fx+=Evaluate(Frames[objcop->currframe].xhldacc);
- if(objcop->P_LEFT)objcop->total_fx-=Evaluate(Frames[objcop->currframe].xhldacc);
- }
- if (objcop->facing == 1){
- if(objcop->P_LEFT)objcop->total_fx-=Evaluate(Frames[objcop->currframe].xhldacc);
- if(objcop->P_RIGHT)objcop->total_fx+=Evaluate(Frames[objcop->currframe].xhldacc);
- }}
- 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 When_Player_Is_Hit(objcopy * objcop, LOAD * LOADED){
- for (int x=0;x < LOADED->ON_SCREEN_OBJCOUNT;x++){
- if (LOADED->ON_SCREEN_OBJS[x]->currframe!=4321){
- if(LOADED->ON_SCREEN_OBJS[x]->team!=objcop->team){
- for (int y=0; y < Frames[objcop->currframe].bdyindx; y++){
- int effx, effy;
- for (int z=0; z < LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].rectindx; z++){
- if (collide(Frames[objcop->currframe].BDYS[y], LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z],
- objcop->posx, Frames[objcop->currframe].center_X, objcop->posy, Frames[objcop->currframe].center_Y, objcop->posz,
- LOADED->ON_SCREEN_OBJS[x]->posx, LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X,
- LOADED->ON_SCREEN_OBJS[x]->posy, LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_Y,
- LOADED->ON_SCREEN_OBJS[x]->posz, objcop->facing, LOADED->ON_SCREEN_OBJS[x]->facing, &effx, &effy,
- &IMGS[objcop->gridn].clip[0], &LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].IMGS[LOADED->ON_SCREEN_OBJS[x]->gridn].clip[0])){
- if (!(objcop->lasthitby==x && objcop->hitcounter!=0)){
- objcop->currdp= objcop->currdp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].strength)>=0?objcop->currdp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].strength):0;
- objcop->currkp= objcop->currkp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].knock )>=0?objcop->currkp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].knock ):0;
- objcop->currhp= objcop->currhp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].damage )>=0?objcop->currhp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].damage ):0;
- objcop->lasthitby=x;
- objcop->hitcounter=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].hitfreq);
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct)!=0){
- if (LOADED->ON_SCREEN_OBJS[x]->facing ==0){objcop->total_fx=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct);}
- else{objcop->total_fx=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct)*-1;}
- }
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].y_impct)!=0){
- objcop->total_fy=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].y_impct);
- }
- if (Evaluate(Frames[objcop->currframe].BDYS[y].respond)!=4321){
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].BDYS[y].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=falling; 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+LOADED->ON_SCREEN_OBJS[x]->facing%2==1?whenhit:whenhitb;objcop->newframe=true;
- }
- LOADED->ON_SCREEN_OBJS[x]->hit_xNO= stringify(Evaluate(LOADED->ON_SCREEN_OBJS[x]->hit_xNO)+1);
- if(LOADED->HITSYS){
- CallObj(1010, 10, effx-(LOADED->OBJECTS[1010].hittxtwidth), effy-50, objcop->posz, 0, LOADED);//"HITX text
- for (int digit=0; digit<LOADED->ON_SCREEN_OBJS[x]->hit_xNO.length(); digit++){
- CallObj(1010, Evaluate(LOADED->ON_SCREEN_OBJS[x]->hit_xNO.substr(digit, 1)), effx+(LOADED->OBJECTS[1010].hitnowidth*digit), effy-50, objcop->posz, 0, LOADED);
- }
- /*if (hit_xNO>999) {CallObj(1010, (hit_xNO-hit_xNO%1000)/1000, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%1000;}
- if (hit_xNO>99) {CallObj(1010, (hit_xNO-hit_xNO%100)/100, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%100;}
- if (hit_xNO>9) {CallObj(1010, (hit_xNO-hit_xNO%10)/10, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%10;}
- if (hit_xNO>=0) {CallObj(1010, hit_xNO, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO=0;}*-/
- }
- CallObj(1000, 0, effx, effy, objcop->posz, objcop->facing, LOADED);
- }
- }
- }
- }
- }
- } }
- }*/
- void Regenerate_Deplete_Stuff(objcopy * objcop){
- if (Frames[objcop->currframe].flags[5]) objcop->currkp = maxkp;
- objcop->currsp=objcop->currsp+float(spsec/60)>=maxsp?maxsp:objcop->currsp+float(spsec/60); //Regen SP
- objcop->currkp=objcop->currkp+float(knockrate/60)>=maxkp?maxkp:objcop->currkp+float(knockrate/60); //Regen Knock Points
- objcop->currrp=objcop->currrp+float(rpsec/60)>=maxrp?maxrp:objcop->currrp+float(rpsec/60); //Regen RP
- objcop->hitcounter-=objcop->hitcounter!=0?1:0; //Regen Hit Counter
- //objcop->tempcount= objcop->tempcount==60?0:++objcop->tempcount;
- }
- void Set_IMG_No_On_Current_Grid(objcopy * objcop){
- 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 Update(background, LOAD*, objcopy * objcop);
- void Extract_bdys();
- void CallObj(int, int, int, int, int, int , LOAD* );
- };
- 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;
- posz=posz_;
- currhp=obj->inihp;
- currsp=obj->inisp;
- currrp=obj->inirp;
- currdp=obj->maxdp;
- currkp=obj->maxkp;
- currframe=obj->standing;
- 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;
- }
- void object::init(int id_, string dpndncs, string afildir){
- id=id_;
- name="AAAA4321";
- IMGS.resize(20);
- Frames.resize(650);
- previousframe=4321;
- string tags[] = {"NAME=","MAXPTS_HP_SP_RP=","INITPTS_HP_SP_RP=","WALKSPD_X_Z=","RPRATEPER_HIT_SEC_DAMAGE=",
- "ARMORPTS_MAX_RATE=","STANDING=","WALKING=", "DASHING=", "JUMPING=", "JUMPSPD_X_Z=","HIT_GROUND=","WHEN_HIT_FRONT=",
- "WHEN_HIT_BACK=", "KNOCKPTS_MAX_RATEPERSEC=", "KNOCKED=", "DEFENDPTS_MAX_RATEPERSEC=", "FALLING=", "LYING=",
- "TEXTWIDTH=", "NUMBERSWIDTH=", "SPRATEPER_HIT_SEC_DAMAGE=", "FATIGUE=", "IN_AIR=", "[img]"};
- fstream A_FILE(afildir.c_str());
- string tempariro, frameline, tempariro2;
- int trigger, triggahcomma=0;
- int positions[26];
- 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!=string::npos){frameline.erase (temp0, 1);
- temp0=frameline.find(" ", temp0);}
- if (frameline.find("{info}")!= string::npos) trigger = 1;
- while (trigger==1){
- getline(A_FILE, frameline);
- if (frameline.rfind(tags[0])!=string::npos)positions[0] = frameline.rfind(tags[0])+tags[0].length();
- if (frameline.rfind(tags[1])!=string::npos)positions[1] = frameline.rfind(tags[1])+tags[1].length();
- if (frameline.rfind(tags[2])!=string::npos)positions[2] = frameline.rfind(tags[2])+tags[2].length();
- if (frameline.rfind(tags[3])!=string::npos)positions[3] = frameline.rfind(tags[3])+tags[3].length();
- if (frameline.rfind(tags[4])!=string::npos)positions[4] = frameline.rfind(tags[4])+tags[4].length();
- if (frameline.rfind(tags[5])!=string::npos)positions[5] = frameline.rfind(tags[5])+tags[5].length();
- if (frameline.rfind(tags[6])!=string::npos)positions[6] = frameline.rfind(tags[6])+tags[6].length();
- if (frameline.rfind(tags[7])!=string::npos)positions[7] = frameline.rfind(tags[7])+tags[7].length();
- if (frameline.rfind(tags[8])!=string::npos)positions[8] = frameline.rfind(tags[8])+tags[8].length();
- if (frameline.rfind(tags[9])!=string::npos)positions[9] = frameline.rfind(tags[9])+tags[9].length();
- if (frameline.rfind(tags[10])!=string::npos)positions[10] = frameline.rfind(tags[10])+tags[10].length();
- if (frameline.rfind(tags[11])!=string::npos)positions[11] = frameline.rfind(tags[11])+tags[11].length();
- if (frameline.rfind(tags[12])!=string::npos)positions[12] = frameline.rfind(tags[12])+tags[12].length();
- if (frameline.rfind(tags[13])!=string::npos)positions[13] = frameline.rfind(tags[13])+tags[13].length();
- if (frameline.rfind(tags[14])!=string::npos)positions[14] = frameline.rfind(tags[14])+tags[14].length();
- if (frameline.rfind(tags[15])!=string::npos)positions[15] = frameline.rfind(tags[15])+tags[15].length();
- if (frameline.rfind(tags[16])!=string::npos)positions[16] = frameline.rfind(tags[16])+tags[16].length();
- if (frameline.rfind(tags[17])!=string::npos)positions[17] = frameline.rfind(tags[17])+tags[17].length();
- if (frameline.rfind(tags[18])!=string::npos)positions[18] = frameline.rfind(tags[18])+tags[18].length();
- if (frameline.rfind(tags[19])!=string::npos)positions[19] = frameline.rfind(tags[19])+tags[19].length();
- if (frameline.rfind(tags[20])!=string::npos)positions[20] = frameline.rfind(tags[20])+tags[20].length();
- if (frameline.rfind(tags[21])!=string::npos)positions[21] = frameline.rfind(tags[21])+tags[21].length();
- if (frameline.rfind(tags[22])!=string::npos)positions[22] = frameline.rfind(tags[22])+tags[22].length();
- if (frameline.rfind(tags[23])!=string::npos)positions[23] = frameline.rfind(tags[23])+tags[23].length();
- if (frameline.rfind(tags[24])!=string::npos){positions[24] = frameline.rfind(tags[24])+tags[24].length();trigger=0; A_FILE.seekp(ios::beg);getline(A_FILE, frameline);getline(A_FILE, frameline);}
- }
- if (trigger != 1){
- for (int ice=0; ice < 25; 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]")!=string::npos) {trigger =0; break;}
- string spgdarg0 = 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());
- string spgdarg5 = frameline.substr(frameline.rfind(','));
- sprtfl = spgdarg0;
- //*1*/string(frameline.substr(0, frameline.find(","))),
- //*2*/int(frameline.substr(frameline.find(",")+1,frameline.find(",", frameline.find(",")+1)).c_str()),
- //*3*/int(frameline.substr(frameline.find(",", frameline.find(",")+1)+1, frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)).c_str()),
- //*4*/int(frameline.substr( frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1, frameline.find(",", frameline.find(",", frameline.find(",", frameline.find(",")+1)+1)+1)).c_str()),
- //*5*/int(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()),
- //frameline.substr(frameline.rfind(',')));
- spritegrid a;
- a.ini(spgdarg0, spgdarg1, spgdarg2, spgdarg3, spgdarg4, spgdarg5, &spritecount);
- IMGS[imgindx]= a; imgindx ++;
- food = 10000;ice=100000;
- getline(A_FILE, frameline);
- }
- if (ice == 24 && (frameline.rfind(tags[ice])!=string::npos)){
- trigger =11;food=10000;ice=1000;
- }
- if (ice<=23){
- while (ice==21 && (frameline.rfind(tags[ice])!=string::npos) && !extraction){
- if (triggahcomma==0){ //RPRATEPEhjR_HIT
- if(frameline.substr(food+positions[ice],1).find(",")!=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(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //defendpts
- if(frameline.substr(food+positions[ice],1).find(",")!=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
- defendrate=atoi(frameline.substr(positions[ice]+food).c_str()); tempariro = "";triggahcomma=0;extraction=true;food=1000;}
- else{
- food++;}}
- while (ice==14 && (frameline.rfind(tags[ice])!=string::npos) && !extraction){
- if (triggahcomma==0){ //fallpts
- if(frameline.substr(food+positions[ice],1).find(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //JUMPSPDX
- if(frameline.substr(food+positions[ice],1).find(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //JUMPSPDX
- if(frameline.substr(food+positions[ice],1).find(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //RPRATEPEhjR_HIT
- if(frameline.substr(food+positions[ice],1).find(",")!=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(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //WALKSPDX
- if(frameline.substr(food+positions[ice],1).find(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //INIT_HP
- if(frameline.substr(food+positions[ice],1).find(",")!=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(",")!=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])!=string::npos) && !extraction){
- if (triggahcomma==0){ //MAX_HP
- if(frameline.substr(food+positions[ice],1).find(",")!=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(",")!=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 23: if (frameline.rfind(tags[ice])!=string::npos)inair=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 22: if (frameline.rfind(tags[ice])!=string::npos)fatigue=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 20: if (frameline.rfind(tags[ice])!=string::npos)hitnowidth=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 19: if (frameline.rfind(tags[ice])!=string::npos)hittxtwidth=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 18: if (frameline.rfind(tags[ice])!=string::npos)lying=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 17: if (frameline.rfind(tags[ice])!=string::npos)falling=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 15: if (frameline.rfind(tags[ice])!=string::npos)knocked=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 13: if (frameline.rfind(tags[ice])!=string::npos)whenhitb=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 12: if (frameline.rfind(tags[ice])!=string::npos)whenhit=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 11: if (frameline.rfind(tags[ice])!=string::npos)hitground=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 9: if (frameline.rfind(tags[ice])!=string::npos) jumping=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 8: if (frameline.rfind(tags[ice])!=string::npos) dashing=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 7: if (frameline.rfind(tags[ice])!=string::npos) walking=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 6: if (frameline.rfind(tags[ice])!=string::npos) standing=atoi(frameline.substr(positions[ice]).c_str());food=1000; break;
- case 0: if (frameline.rfind(tags[ice])!=string::npos) name=frameline.substr(positions[ice]);food=1000;break;
- default:;}
- }
- //cout<< "name: " << name << endl <<"WALKSPD_X_Z: "<<maxsp<<endl;
- if (frameline.find("{/info}")!= string::npos){
- tempariro2="";
- while(A_FILE.good()){
- getline(A_FILE, frameline);
- if(frameline.find("#")!=string::npos)frameline.erase(frameline.find("#"), frameline.length()-frameline.find("#"));
- tempariro2 +=frameline;
- }
- A_FILE.seekp(0, A_FILE.end);A_FILE.close();
- }}}}}}
- if (name == "AAAA4321"){
- type =1;
- }else{
- type =0;
- }
- //loadframes:
- //A_FILE.seekp(0, A_FILE.beg);
- //A_FILE.seekg(0, A_FILE.beg);
- //getline(A_FILE, tempariro2);
- temp0=tempariro2.find(" ");
- while(temp0!=string::npos){tempariro2.erase (temp0, 1); //clear spaces
- temp0=tempariro2.find(" ", temp0);}
- temp0=tempariro2.find("\n");
- while(temp0!=string::npos){tempariro2.erase (temp0, 1); //clear newline chars
- temp0=tempariro2.find("\n", temp0);}
- tempariro2=tempariro2.substr(tempariro2.find("[f="));
- int ideh;
- while(tempariro2.find("[f=") != string::npos && tempariro2.find("[/f]")!= string::npos){
- frame framah;
- ideh = atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str());
- framah.init(tempariro2.substr(tempariro2.find("]")+1,tempariro2.find("[/f]")), atoi(tempariro2.substr(3, tempariro2.find("]")-3).c_str()) );
- Frames[framah.no]=framah;
- if (tempariro2.find("[f=", 4) != string::npos){
- tempariro2=tempariro2.substr(tempariro2.find("[f=", 4));}else{break;
- }
- }
- accU=0;
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class LOAD{
- const char* LOAD_DIR;
- const char* LOAD_TOKEN;
- ifstream LOAD_TXT;
- string line;
- public:
- bool HITSYS=false;
- int CATCHINGIDS[100][5]; //0:framefront 1:frameback 2:x-pos 3:y-pos 4:z-pos
- int DELETED_OBJS[1000];
- int D_O_INDEX=0;
- int IDS[600];
- string settings[12]; //0-9 effects 10-gravity 11-friction
- string BARS[15]={"None", "None", "None", "", "", "", "", "", "", "", "", "", "None", "", ""};
- std::vector<spritegrid> BARSG;
- LOAD(string, string);
- std::vector<objcopy*> ON_SCREEN_OBJS;
- std::vector<objcopy> ON_SCREEN_REAL_OBJS;
- std::vector<objcopy> OBJS_STRUCTS;
- std::vector<object> OBJECTS;
- int OBJID_INDEX;
- float FRICTION, GRAVITY;
- int ON_SCREEN_OBJCOUNT=0;
- void LoadOBJ(void);};
- void LOAD::LoadOBJ(){
- BARSG.resize(4);
- for (int ID=0; ID<100; ID++){
- for (int data=0; data<5; data++){
- CATCHINGIDS[ID][data]=4321;
- }
- }
- fstream SYS_FILE("obj\\system.a");
- string tempasdf;
- string systemd;
- int tempadodi;
- while (SYS_FILE.good()){
- getline(SYS_FILE, tempasdf);
- systemd += tempasdf;
- }
- if (systemd.find("{main}")!=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)+"]=")!=string::npos) {
- settings[x]=tempasdf.substr(tempasdf.find("effect["+stringify(x)+"]=")+10, tempasdf.find(";")-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("showHitNo_Dir_Interval=")!=string::npos){
- HITSYS=true;
- object nums;
- tempadodi=tempasdf.find("showHitNo_Dir_Interval=");
- 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("img=");
- BARS[0]=tempasdf.substr(tempadodi+4, tempasdf.find(";", tempasdf.find("img="))-tempadodi-4);
- 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);
- BARSG[abcd]=a;
- }
- for (int asdfasdfasdf=0;asdfasdfasdf==0;asdfasdfasdf++){
- int momo;
- spritegrid a;
- a.ini(BARS[12], 4321, 4321, 1, 1, ",0xFFFFFF", &momo);
- BARSG[3]=a;}
- if (systemd.find("{defaults}")!=string::npos){
- tempasdf=systemd.substr(systemd.find("{defaults}")+10, systemd.find("{/defaults}")-10-systemd.find("{defaults}"));
- if (tempasdf.find("gravity=")!=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=")!=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());
- string paraid, paraind, paradir;
- size_t L_POS, temp0;
- if (LOAD_TXT.is_open()){
- while (LOAD_TXT.good()){
- getline(LOAD_TXT, line);
- temp0=line.find(" ");
- while(temp0!=string::npos){line.erase (temp0, 1);
- temp0=line.find(" ", temp0);}
- L_POS = line.find(LOAD_TOKEN);
- if (L_POS != string::npos){paraid= line.substr(0, L_POS); //the function
- temp0 =L_POS;
- L_POS = line.find(LOAD_TOKEN, L_POS+1, 2);}
- if (L_POS != string::npos){ paraind=line.substr(temp0+2, L_POS-temp0-2); //the function2
- temp0 =L_POS;
- L_POS = line.find(LOAD_TOKEN, L_POS+1, 2);}
- if (L_POS != string::npos){ paradir=line.substr(temp0+2, L_POS-temp0-2);
- object Stickman;
- Stickman.init(atoi(paraid.c_str()), paraind, paradir);
- //the function3
- OBJECTS[Stickman.id]= Stickman;IDS[OBJID_INDEX++]=Stickman.id;}
- // OBJECT_IDS_[OBJID_INDEX++]= Stickman;} //the function3
- }}
- ON_SCREEN_OBJCOUNT=OBJID_INDEX;
- srand (time(NULL));
- for (int x=0; x<OBJID_INDEX; x++){
- objcopy z;
- int randxpos=rand() % 800 + 50;
- int randzpos=rand() % 180 + 570;
- if (IDS[x]<9){
- z.init(&OBJECTS[IDS[x]],1, false, GRAVITY, FRICTION, randxpos, randzpos);
- }else{
- z.init(&OBJECTS[IDS[x]],2, true, GRAVITY, FRICTION, randxpos, randzpos);
- }
- OBJS_STRUCTS[IDS[x]]=z;
- ON_SCREEN_REAL_OBJS[x]=z;
- }
- for (int aa=0; aa<ON_SCREEN_OBJCOUNT; aa++){
- ON_SCREEN_OBJS[aa]=&ON_SCREEN_REAL_OBJS[aa];
- }
- }
- LOAD::LOAD (string dir, string TOKEN)
- :OBJECTS(1011)
- {
- OBJID_INDEX = 0;
- LOAD_DIR = dir.c_str ();
- LOAD_TOKEN = TOKEN.c_str ();
- LOAD_TXT.open (dir.c_str ());
- ON_SCREEN_OBJS.resize(1011);
- ON_SCREEN_REAL_OBJS.resize(1011);
- OBJS_STRUCTS.resize(1011);
- }
- void object::Update_Frame_If_Time(objcopy * objcop, LOAD * LOADED){
- if (objcop->newframe){
- for (int z=0; z<20; z++){
- objcop->rectdensity[z]=0;
- }
- if (objcop->newframe &&Evaluate(Frames[objcop->currframe].addsp)!=4321) objcop->currsp=objcop->currsp+Evaluate(Frames[objcop->currframe].addsp)>=maxsp?maxsp:objcop->currsp+Evaluate(Frames[objcop->currframe].addsp);
- objcop->delayU=Evaluate(Frames[objcop->currframe].delay);objcop->newframe=false;
- if (Evaluate(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){objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(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];
- }}}
- if (!Frames[objcop->currframe].exists){
- 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;
- }
- }
- }
- void object::Blit (background BG, objcopy * objcop, LOAD * LOADED){
- ///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);
- if (objcop->facing==0 && objcop->picn!=999){float pos[] = {objcop->posx-Evaluate(Frames[objcop->currframe].center_X) , (objcop->posz)-Evaluate(Frames[objcop->currframe].center_Y)+(objcop->posy), IMGS[objcop->gridn].clip[objcop->picn].w, 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+Evaluate(Frames[objcop->currframe].center_X)+objcop->posx);
- float pos[] = {objcop->posx-((IMGS[objcop->gridn].clip_[objcop->picn].w)-Evaluate(Frames[objcop->currframe].center_X)) , objcop->posz-Evaluate(Frames[objcop->currframe].center_Y)+objcop->posy, IMGS[objcop->gridn].clip[objcop->picn].w, 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[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[1]);
- glTexCoord2f((cx+cw)/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0], pos[1]+pos[3]);
- glTexCoord2f(cx/IMGS[objcop->gridn].gw, (cy+ch)/IMGS[objcop->gridn].gh);
- glVertex2f(pos[0]+pos[2], pos[1]+pos[3]);
- glEnd(); }
- //glClear( GL_COLOR_BUFFER_BIT );
- if (type!=1){
- if (LOADED->BARS[12]!="None"){
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[3].grid );
- glBegin(GL_QUADS);
- glTexCoord2f(0 , 0);
- glVertex2f(Evaluate(LOADED->BARS[13])+objcop->posx-(LOADED->BARSG[3].gw/2.0), Evaluate(LOADED->BARS[14])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(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(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(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{
- glBindTexture( GL_TEXTURE_2D, LOADED->BARSG[0].grid );
- }
- if (objcop->currhp >= 0){
- glBegin(GL_QUADS);
- if (LOADED->BARS[0]=="None") {
- glVertex2f(objcop->posx-20, objcop->posz+10);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currhp)/float(maxhp))), objcop->posz+10+5);
- glVertex2f(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(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(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(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(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(Evaluate(LOADED->BARS[6])+objcop->posx-(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(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(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(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(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(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(Evaluate(LOADED->BARS[6])+objcop->posx+(LOADED->BARSG[0].gw/2.0), Evaluate(LOADED->BARS[7])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(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(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(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(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(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(objcop->posx-20, objcop->posz+17);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+17);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currsp)/float(maxsp))), objcop->posz+20);
- glVertex2f(objcop->posx-20, objcop->posz+20);
- }else{
- switch(Evaluate(LOADED->BARS[4])){
- case 1:
- glTexCoord2f(1-float(float(objcop->currsp)/float(maxsp)) , 0);
- glVertex2f(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(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(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(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(Evaluate(LOADED->BARS[8])+objcop->posx-(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(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(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(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(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(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(Evaluate(LOADED->BARS[8])+objcop->posx+(LOADED->BARSG[1].gw/2.0), Evaluate(LOADED->BARS[9])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(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(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(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(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(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(objcop->posx-20, objcop->posz+17);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+17);
- glVertex2f(objcop->posx-20+(40*float(float(objcop->currrp)/float(maxrp))), objcop->posz+20);
- glVertex2f(objcop->posx-20, objcop->posz+20);
- }else{
- switch(Evaluate(LOADED->BARS[5])){
- case 1:
- glTexCoord2f(1-float(float(objcop->currrp)/float(maxrp)) , 0);
- glVertex2f(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(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(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(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(Evaluate(LOADED->BARS[10])+objcop->posx-(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(1 , 0);
- glVertex2f(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(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(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(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(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(Evaluate(LOADED->BARS[10])+objcop->posx+(LOADED->BARSG[2].gw/2.0), Evaluate(LOADED->BARS[11])+objcop->posz+10);
- glTexCoord2f(0 , 1);
- glVertex2f(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(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(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(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(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);
- ///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);
- ///}
- }}
- /*-------------------------------------------------------------------------------------------------------------*/
- void object::CallObj(int ID, int currframe, int posx, int posy, int posz, int facing, LOAD* LOADED){
- objcopy hiteff;
- hiteff=copy_object(LOADED->OBJS_STRUCTS[ID]);
- hiteff.posx=posx;
- hiteff.posy=posy;
- hiteff.posz=posz;
- hiteff.facing=facing;
- hiteff.currframe=currframe;
- hiteff.showshadow=false;
- hiteff.FRICTION= LOADED->FRICTION;
- hiteff.GRAVITY = LOADED->GRAVITY;
- 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++];
- return;
- }
- 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++];
- return;
- }
- 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--;
- return;
- }
- }
- }
- void object::Update(background A_Field, LOAD * LOADED, objcopy *objcop){
- Update_Frame_If_Time(objcop, LOADED);
- Regenerate_Deplete_Stuff(objcop);
- Set_IMG_No_On_Current_Grid(objcop);
- //When_Player_Is_Hit(objcop, LOADED);
- for (int x=0;x < LOADED->ON_SCREEN_OBJCOUNT;x++){
- if (LOADED->ON_SCREEN_OBJS[x]->currframe!=4321){
- if(LOADED->ON_SCREEN_OBJS[x]->team!=objcop->team){
- for (int y=0; y < Frames[objcop->currframe].bdyindx; y++){
- int effx, effy;
- for (int z=0; z < LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].rectindx; z++){
- if ((Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].rctdnsty)==4321 || LOADED->ON_SCREEN_OBJS[x]->rectdensity[z] < Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].rctdnsty)) &&
- collide(Frames[objcop->currframe].BDYS[y], LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z],
- objcop->posx, Frames[objcop->currframe].center_X, objcop->posy, Frames[objcop->currframe].center_Y, objcop->posz,
- LOADED->ON_SCREEN_OBJS[x]->posx, LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X,
- LOADED->ON_SCREEN_OBJS[x]->posy, LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_Y,
- LOADED->ON_SCREEN_OBJS[x]->posz, objcop->facing, LOADED->ON_SCREEN_OBJS[x]->facing, &effx, &effy,
- &IMGS[objcop->gridn].clip[0], &LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].IMGS[LOADED->ON_SCREEN_OBJS[x]->gridn].clip[0])){
- objcop->caught=LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].flags[2];
- LOADED->ON_SCREEN_OBJS[x]->rectdensity[z]=LOADED->ON_SCREEN_OBJS[x]->rectdensity[z]==4321?4321:LOADED->ON_SCREEN_OBJS[x]->rectdensity[z]+1;
- if (!(objcop->lasthitby==x && objcop->hitcounter!=0)){
- objcop->currdp= objcop->currdp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].strength)>=0?objcop->currdp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].strength):0;
- objcop->currkp= objcop->currkp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].knock )>=0?objcop->currkp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].knock ):0;
- objcop->currhp= objcop->currhp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].damage )>=0?objcop->currhp-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].damage ):0;
- objcop->lasthitby=x;
- objcop->hitcounter=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].hitfreq);
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct)!=0){ //X IMPACT
- if (LOADED->ON_SCREEN_OBJS[x]->facing ==0){objcop->total_fx=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct);}
- else{objcop->total_fx=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].x_impct)*-1;}
- }
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].y_impct)!=0){ //Y IMPACT
- objcop->total_fy=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].y_impct);
- }
- if (Evaluate(Frames[objcop->currframe].BDYS[y].respond)!=4321){ //BODY HOLDER SHOUDL GO TO IF RESPOND IS THERE:
- objcop->previousframe=objcop->currframe;objcop->currframe=Evaluate(Frames[objcop->currframe].BDYS[y].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=falling; 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+LOADED->ON_SCREEN_OBJS[x]->facing%2==1?whenhit:whenhitb;objcop->newframe=true;
- }
- if (objcop->facing == LOADED->ON_SCREEN_OBJS[x]->facing){ //if there is target back goto
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].tbgoto)!=4321){
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].tbgoto);
- objcop->newframe=true;
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][1]=
- objcop->currframe;
- }
- }else{ //if there is target front goto
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].tfgoto)!=4321){
- objcop->previousframe=objcop->currframe;
- objcop->currframe=Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].tfgoto);
- objcop->newframe=true;
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][0]=
- objcop->currframe;
- }
- }
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_x)!=4321){
- if (LOADED->ON_SCREEN_OBJS[x]->facing==0){
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)!=4321){
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][2]=
- LOADED->ON_SCREEN_OBJS[x]->posx+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_x)-
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X);
- }
- objcop->posx=LOADED->ON_SCREEN_OBJS[x]->posx+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_x)-
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X);
- }else{
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)!=4321){
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][2]=
- LOADED->ON_SCREEN_OBJS[x]->posx-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_x)+
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X);
- }
- objcop->posx=LOADED->ON_SCREEN_OBJS[x]->posx-Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_x)+
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_X);
- }
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][2]=objcop->posx;
- }
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_y)!=4321){
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)!=4321){
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][3]=
- LOADED->ON_SCREEN_OBJS[x]->posy+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_y)-
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_Y);
- }
- objcop->posy=LOADED->ON_SCREEN_OBJS[x]->posy+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_y)-
- Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].center_Y);
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][3]=objcop->posy;
- }
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_z)!=4321){
- if (Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)!=4321){
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][4]=
- LOADED->ON_SCREEN_OBJS[x]->posz+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_z);
- }
- objcop->posz=LOADED->ON_SCREEN_OBJS[x]->posz+Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].t_z);
- LOADED->CATCHINGIDS[Evaluate(LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].crsid)][4]=objcop->posz;
- }
- bool asfasdfasd=LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].flags[3];
- if (!LOADED->OBJECTS[LOADED->ON_SCREEN_OBJS[x]->id].Frames[LOADED->ON_SCREEN_OBJS[x]->currframe].RECTS[z].flags[3]){ // if flag NOEFFECT is off:
- LOADED->ON_SCREEN_OBJS[x]->hit_xNO= stringify(Evaluate(LOADED->ON_SCREEN_OBJS[x]->hit_xNO)+1);
- if(LOADED->HITSYS){
- CallObj(1010, 10, effx-(LOADED->OBJECTS[1010].hittxtwidth), effy-50, objcop->posz, 0, LOADED);//"HITX text
- for (int digit=0; digit<LOADED->ON_SCREEN_OBJS[x]->hit_xNO.length(); digit++){
- CallObj(1010, Evaluate(LOADED->ON_SCREEN_OBJS[x]->hit_xNO.substr(digit, 1)), effx+(LOADED->OBJECTS[1010].hitnowidth*digit), effy-50, objcop->posz, 0, LOADED);
- }
- /*if (hit_xNO>999) {CallObj(1010, (hit_xNO-hit_xNO%1000)/1000, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%1000;}
- if (hit_xNO>99) {CallObj(1010, (hit_xNO-hit_xNO%100)/100, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%100;}
- if (hit_xNO>9) {CallObj(1010, (hit_xNO-hit_xNO%10)/10, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO-=hit_xNO-hit_xNO%10;}
- if (hit_xNO>=0) {CallObj(1010, hit_xNO, 10+effx+(15*xposition++), effy-50, objcop->posz, 0, LOADED);hit_xNO=0;}*/
- }
- CallObj(1000, 0, effx, effy, objcop->posz, objcop->facing, LOADED);
- }}
- }
- }
- }
- }
- } }
- Apply_loop(objcop);
- Apply_max_limit_vx(objcop);
- Apply_max_limit_vy(objcop);
- Apply_f_x(A_Field, objcop);
- Apply_f_y(A_Field, objcop);
- Apply_x_z_hold_distance(A_Field, objcop);
- Apply_acc(objcop);
- Basic_Stand_Walk_Dash(A_Field, objcop);
- Basic_Jump(objcop);
- Apply_max_limit_vx(objcop);
- Move(objcop->total_fx, 'x',A_Field, objcop);
- Move(objcop->total_fy, 'y',A_Field, objcop);
- Apply_FRICTION(objcop);
- Apply_GRAVITY(objcop);
- Respond_ToInput(objcop);
- }
- /*-------------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement