Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- class frame{
- string frameline;
- public:
- int f, img, delay, nxt, state, center_X, center_Y, f_x, f_y, f_z, loop_length, loop_goto, loop_condition;
- int no;
- void init(string, int);
- };
- void frame::init(string frameline, int no_){
- no=no_;
- int positions[20];
- string tempao;
- string tags[] = {"img=", "delay=", "goto=", "state=", "center=", "f_x=", "f_y=", "f_z=", "loop="};
- 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;}
- for (int ice=0; ice < 9; 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)=="-")){
- 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)=="-")){
- switch (ice){
- case 0: if (frameline.find(tags[0])!=string::npos){img=atoi(tempao.c_str());}else{img=0;}
- food=99999;done=true;tempao="";break;
- case 1: if (frameline.find(tags[1])!=string::npos){delay=atoi(tempao.c_str());}else{delay=0;
- }food=99999;done=true;tempao="";break;
- case 2: if (frameline.find(tags[2])!=string::npos){nxt=atoi(tempao.c_str());}else{nxt=no+1;
- }food=99999;done=true;tempao="";break;
- case 3: if (frameline.find(tags[3])!=string::npos){state=atoi(tempao.c_str());}else{state=2;
- }food=99999;done=true;tempao="";break;
- case 4: if (frameline.find(tags[4])!=string::npos){center_X=atoi(tempao.substr(0, tempao.find(",")).c_str());
- center_Y=atoi(tempao.substr(tempao.find(",")+1, tempao.size()-tempao.find(",")).c_str());}else{center_X=0;center_Y=0;
- }
- food=99999;done=true;tempao="";break;
- case 5: if (frameline.find(tags[7])!=string::npos){f_x=atoi(tempao.c_str());}else{f_x=0;
- }food=99999;done=true;tempao="";break;
- case 6: if (frameline.find(tags[6])!=string::npos){f_y=atoi(tempao.c_str());}else{f_y=0;
- }food=99999;done=true;tempao="";break;
- case 7: if (frameline.find(tags[7])!=string::npos){f_z=atoi(tempao.c_str());}else{f_z=0;
- }food=99999;done=true;tempao="";break;
- case 8: if (frameline.find(tags[8])!=string::npos){loop_length=atoi(tempao.substr(0, tempao.find(",")).c_str());
- loop_condition=atoi(tempao.substr(tempao.find(",")+1, tempao.rfind(",")-tempao.find(",")).c_str());
- loop_goto=atoi(tempao.substr(tempao.rfind(",")+1).c_str());}else{loop_condition=4321; loop_length=4321; loop_goto=4321;
- }food=99999;done=true;tempao="";break;
- default:;}}
- else{
- food++;}
- }
- }
- }
- }
- class spritegrid{
- int w, h, col, row, frameno;
- public:
- string colk;
- SDL_Surface *grid, *grid_;
- vector<SDL_Rect> clip;
- vector<SDL_Rect> clip_;
- void ini(string dir_, int w_, int h_, int col_, int row_, string colk_);
- };
- void spritegrid::ini(string dir_, int w_, int h_, int col_, int row_, string colk_){
- colk = colk_;
- unsigned int col1, col2, col3;
- 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);
- col=col_;
- row=row_;
- frameno = row*col;
- w=w_;
- h=h_;
- clip.resize(frameno);
- clip_.resize(frameno);
- // clip, clip_ = new SDL_Rect[frameno];
- grid = SDL_LoadBMP((dir_).c_str());
- grid_= SDL_LoadBMP((dir_.substr(0, dir_.rfind("\\")+1 ) +"mirror_" + dir_.substr( dir_.rfind("\\")+1 , dir_.rfind(".BMP")-dir_.rfind("\\")+1 )).c_str());
- 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;
- }}
- Uint32 colorkey = SDL_MapRGB( grid->format, col1, col2, col3 );
- SDL_SetColorKey( grid, SDL_SRCCOLORKEY, colorkey );
- SDL_SetColorKey( grid_, SDL_SRCCOLORKEY, colorkey );
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class background{
- string name, bitmapfiledir;
- public:
- SDL_Surface *backgroundSurf;
- int zbound, zboundwidth, xbound, xboundwidth;
- background(int, int, int, int, string);
- void Blit (SDL_Surface *d){SDL_BlitSurface (backgroundSurf, NULL, d, NULL);}
- };
- background::background(int a, int b, int c, int d, string e){
- zbound = a;
- zboundwidth = b;
- xbound = c;
- xboundwidth = d;
- bitmapfiledir = e;
- backgroundSurf = SDL_LoadBMP(("sys\\"+bitmapfiledir).c_str());
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class object{
- int posx , posz, wkspdx, wkspdz, frameno, currframe, w, h, facing, id, maxhp, maxmp, maxrp, inihp, inimp, inirp, delayU, nxt;
- int rphit, rpsec, rpdam, armor, walking, standing, dashing, total_fx, total_fy, total_fz, previousframe, U_loop_length;
- int FRICTION, GRAVITY;
- SDL_Rect clip[4];
- Uint32 colorkey;
- vector<frame> Frames;
- vector<spritegrid> IMGS;
- bool newframe, doloop;
- public:
- int DshClksIntrvlR, DshClksIntrvlL, DASHL,DASHR;
- bool P_UP, P_DOWN, P_LEFT, P_RIGHT;
- SDL_Surface *charsheet;
- SDL_Surface *charsheet_;
- int movedirx, movedirz;
- string sprtfl, name, dpndncs, afildir;
- void init (int id, string dpndncs, string afildir, int a, int b);
- void Walk (int movedirx, int movedirz, background BG){
- if (movedirx < 2 || movedirz < 2){
- if (facing == 0){
- if (movedirx == 0 && (posx+wkspdx+20 < BG.xbound+BG.xboundwidth)) posx += wkspdx;
- if (movedirx == 1) facing = 1;
- if (movedirz == 0 && (posz-wkspdz > BG.zbound)) posz -= wkspdz;
- if (movedirz == 1 && (posz+wkspdz < BG.zbound+BG.zboundwidth)) posz += wkspdz;}
- if (facing == 1){
- if (movedirx == 0) facing = 0;
- if (movedirx == 1 && (posx-wkspdx-20 > BG.xbound)) posx -= wkspdx;
- if (movedirz == 0 && (posz-wkspdz > BG.zbound)) posz -= wkspdz;
- if (movedirz == 1 && (posz+wkspdz < BG.zbound+BG.zboundwidth)) posz += wkspdz;}
- }}
- void Blit (SDL_Surface *d){
- if (facing==0){SDL_Rect pos = {posx-Frames[currframe].center_X , posz-Frames[currframe].center_Y, 0, 0};
- SDL_BlitSurface (IMGS[0].grid, &IMGS[0].clip[Frames[currframe].img], d, &pos);}
- if (facing==1){SDL_Rect pos = {posx-((IMGS[0].clip_[Frames[currframe].img].w)-Frames[currframe].center_X), posz-Frames[currframe].center_Y, 0, 0};
- SDL_BlitSurface (IMGS[0].grid_, &IMGS[0].clip_[Frames[currframe].img], d, &pos);}
- }
- void Update(background);
- };
- void object::init(int id, string dpndncs, string afildir, int a, int b){
- IMGS.resize(20);
- Frames.resize(650);
- previousframe=4321;
- string tags[] = {"NAME=","MAXPTS_HP_MP_RP=","INITPTS_HP_MP_RP=","WALKSPD_X_Z=","RPRATEPER_HIT_SEC_DAMAGE=","ARMOR=","STANDING=","WALKING=","[img]", "DASHING="};
- P_UP, P_DOWN, P_LEFT, P_RIGHT = false;
- DshClksIntrvlR, DshClksIntrvlL, DASHL, DASHR=0;
- fstream A_FILE(afildir.c_str());
- string tempariro, frameline, tempariro2;
- int trigger, triggahcomma=0, imgindx=0;
- int positions[10];
- size_t starto, endo, temp0;
- bool extraction = false;
- newframe = true;
- doloop = false;
- FRICTION=1;
- GRAVITY =2;
- 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[9])!=string::npos){positions[9] = frameline.rfind(tags[9])+tags[9].length();}
- if (frameline.rfind(tags[8])!=string::npos){positions[8] = frameline.rfind(tags[8])+tags[8].length();trigger=0; A_FILE.seekp(ios::beg);getline(A_FILE, frameline);getline(A_FILE, frameline);
- }
- }
- if (trigger != 1){
- for (int ice=0; ice < 10; ice ++){ //iter on tags positions
- for (int food = 0; food < frameline.length(); food++){ //iter on characters of the line
- if (trigger==11){
- if (frameline.rfind("[/IMG]")==string::npos) trigger =0;
- 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);
- IMGS[imgindx]= a; imgindx ++;
- food = 10000;ice=100000;
- }
- else if (ice == 8 && (frameline.rfind(tags[ice])!=string::npos)){
- trigger =11;food=10000;ice=1000;
- }
- if (ice==0||ice ==1||ice==2||ice==3||ice==4||ice==5||ice==6||ice==7||ice==9){
- 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){ inimp=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){ maxmp=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 9: 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 5: if (frameline.rfind(tags[ice])!=string::npos)armor=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: "<<maxmp<<endl;
- if (frameline.find("{/info}")!= string::npos){
- tempariro2="";
- while(A_FILE.good()){
- getline(A_FILE, frameline);
- tempariro2 +=frameline;
- }
- A_FILE.seekp(0, A_FILE.end);A_FILE.close();
- }}}}}}
- posx = a;
- posz = b;
- facing = 0;
- movedirx=2;
- movedirz=2;
- //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;
- }
- }
- currframe = standing;
- }
- void object::Update(background A_Field){
- if(Frames[currframe].state==0){
- if (total_fx > 0){
- total_fx-=FRICTION;
- if (total_fx <0) total_fx=0;
- }
- if (total_fx < 0){
- total_fx+=FRICTION;
- if (total_fx >0) total_fx=0;
- }
- }
- if (newframe){delayU=Frames[currframe].delay;if (Frames[currframe].f_x!=0 && Frames[currframe].f_x!=4321){
- total_fx=Frames[currframe].f_x;}else if(Frames[currframe].f_x!=4321){total_fx=0;}newframe=false;}
- if (delayU==0){previousframe=currframe;currframe=Frames[currframe].nxt;newframe=true;}else{
- delayU--;}
- if (previousframe!=4321 && Frames[currframe].loop_condition==previousframe && !doloop && Frames[currframe].loop_length!=0&&newframe){
- U_loop_length= Frames[currframe].loop_length;
- doloop=true;
- }
- if (Frames[currframe].loop_condition==previousframe && doloop&&newframe){
- if (U_loop_length == 0){
- previousframe=currframe;currframe=Frames[currframe].loop_goto;
- doloop=false;newframe=true;
- }else{
- U_loop_length--;}
- }
- if ((P_UP==true||P_DOWN==true||P_LEFT==true||P_RIGHT==true)&&Frames[currframe].state==0){
- if (DASHR==1&&P_RIGHT==true){
- previousframe=currframe;currframe=dashing;newframe=true;DASHR=0;DASHL=0;DshClksIntrvlL,DshClksIntrvlR=0;
- }else if(DASHL==1&&P_LEFT==true){
- previousframe=currframe;currframe=dashing;newframe=true;DASHL=0;DASHR=0;DshClksIntrvlL,DshClksIntrvlR=0;
- }else{
- previousframe=currframe;currframe=walking;newframe=true;}}
- if (Frames[currframe].state==1 && !(P_UP==true||P_DOWN==true||P_LEFT==true||P_RIGHT==true)){
- currframe=standing;newframe=true;previousframe=currframe;
- }
- if (Frames[currframe].state==1){
- if (P_UP==true){movedirz = 0;}
- else if (P_DOWN==true){movedirz =1;}else movedirz = 2;
- if (P_LEFT==true){movedirx = 1;}
- else if (P_RIGHT==true){movedirx= 0;}else movedirx = 2;
- Walk(movedirx, movedirz, A_Field);}
- if (facing==0)posx += total_fx;
- if (facing==1)posx -= total_fx;
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- class LOAD{
- const char* LOAD_DIR;
- const char* LOAD_TOKEN;
- ifstream LOAD_TXT;
- string line;
- public:
- LOAD(string, string);
- //object OBJECT_IDS[500];
- std::vector<object> OBJECT_IDS;
- int OBJID_INDEX;
- void LoadOBJ(){
- 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, 200, 450); //the function3
- OBJECT_IDS[OBJID_INDEX++]= Stickman;} //the function3
- }}}};
- LOAD::LOAD (string dir, string TOKEN)
- :OBJECT_IDS(500)
- {
- OBJID_INDEX = 0;
- LOAD_DIR = dir.c_str ();
- LOAD_TOKEN = TOKEN.c_str ();
- LOAD_TXT.open (dir.c_str ());
- }
- /*-------------------------------------------------------------------------------------------------------------*/
- /*-------------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement