Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==========Interface.cpp===========
- #include "Interface.h"
- #include <math.h>
- #include "Eval.h"
- #include "globals.h"
- struct comp_by_zpos
- {
- //bool operator() (const objcopy * lhs, const objcopy * rhs) { return lhs->posz < rhs->posz; }
- bool operator() (const objcopy * lhs, const objcopy * rhs)
- {
- if (lhs->rndrbackid!=4321 && rhs->rndrbackid!=4321)
- {
- if (lhs->deleteobj)
- return true;
- else if (rhs->deleteobj)
- return false;
- if (lhs->rndrngpriority!=rhs->rndrngpriority)
- {
- return lhs->rndrngpriority > rhs->rndrngpriority;
- }
- else
- {
- return lhs->posz <= rhs->posz;
- }
- }
- if (lhs->rndrbackid!=4321) return false;
- if (rhs->rndrbackid!=4321) return true;
- if (lhs->deleteobj&&rhs->deleteobj) return false;
- if (lhs->deleteobj) return false;
- if (rhs->deleteobj) return true;
- if (lhs->rndrngpriority!=rhs->rndrngpriority)
- {
- return lhs->rndrngpriority > rhs->rndrngpriority;
- }
- else
- {
- return lhs->posz <= rhs->posz;
- }
- }
- };
- void BlitTexture(spritegrid griddy, int x, int y)
- {
- glBindTexture( GL_TEXTURE_2D, griddy.grid );
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(x, y);
- glTexCoord2f(1, 0);
- glVertex2f(x+griddy.gw, y);
- glTexCoord2f(1, 1);
- glVertex2f(x+griddy.gw, y+griddy.gh);
- glTexCoord2f(0, 1);
- glVertex2f(x, y+griddy.gh);
- glEnd();
- glColor4f(1.0f, 1.f, 1.f, 1.0f);
- }
- LoadMenuStuff::LoadMenuStuff(LOAD * LOADED)
- {
- //initiate input data
- P_INPUTDATA.resize(4);
- P_INPUTDATA[0].resize(8); //player 1 data
- P_INPUTDATA[1].resize(8); //player 2 data
- P_INPUTDATA[2].resize(8); //player 3 data
- P_INPUTDATA[3].resize(8); //player 4 data
- for (int a=0; a<4; a++)
- {
- for (int b=0; b<8; b++)
- {
- P_INPUTDATA[a][b]=0;
- }
- }
- //initiate _menusdata
- _menusdata.initLite();
- _menusdata.LoadLOADTXTLite(); //this function loads everything but the content of load.txt
- //Load system.a
- fstream SYS_FILE("obj\\system.a");
- std::string tempqwer; //stores the the data of a statement in the tag
- std::string tempabcd; //stores the content of a tag inside {}
- std::string tempasdf; //stores the lines of a tag..etc
- std::string systemd; //stores the whole text in system.a
- size_t tagposition;
- while (SYS_FILE.good())
- {
- getline(SYS_FILE, tempasdf);
- systemd += tempasdf; //add lines of system.a into this var
- }
- if (systemd.find("{selection_menu}")!=std::string::npos) //if this tag was found in system.a
- {
- //set tempasdf to the content of the tag
- tempasdf=systemd.substr(systemd.find("{selection_menu}")+16, systemd.find("{/selection_menu}")-16-systemd.find("{selection_menu}"));
- }
- tagposition=tempasdf.find("menu_bg=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+8, tempasdf.find(";", tagposition)-8-tagposition); //content of the tag
- //we actually load the bg into _menusdata
- _menusdata.LoadBG(tempqwer, 0);
- }
- tagposition=tempasdf.find("click_to_join=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+14, tempasdf.find(";", tagposition)-14-tagposition);//content of the tag
- //Load A.file to _menusdata
- _menusdata.LoadOBJ(tempqwer, 0);
- _menusdata.OBJECTS[0].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("highlight1=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+11, tempasdf.find(";", tagposition)-11-tagposition);//content of the tag
- //we load the highlight .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,1);
- _menusdata.OBJECTS[1].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("highlight2=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+11, tempasdf.find(";", tagposition)-11-tagposition);//content of the tag
- //we load the highlight .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,2);
- _menusdata.OBJECTS[2].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("highlight3=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+11, tempasdf.find(";", tagposition)-11-tagposition);//content of the tag
- //we load the highlight .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,3);
- _menusdata.OBJECTS[3].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("highlight4=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+11, tempasdf.find(";", tagposition)-11-tagposition);//content of the tag
- //we load the highlight .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,4);
- _menusdata.OBJECTS[4].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("common=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+7, tempasdf.find(";", tagposition)-7-tagposition);//content of the tag
- //we load the common .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,5);
- _menusdata.OBJECTS[5].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("stance=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+7, tempasdf.find(";", tagposition)-7-tagposition);//content of the tag
- //we load the common .a file into _menusdata
- _menusdata.LoadOBJ(tempqwer,6);
- _menusdata.OBJECTS[6].LOADED=&_menusdata;
- }
- tagposition=tempasdf.find("stageselect_key=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+16, tempasdf.find(";", tagposition)-16-tagposition);//content of the tag
- _bg_key=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("init_char_key1=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+15, tempasdf.find(";", tagposition)-15-tagposition);//content of the tag
- SelectionCurr_key[0]=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("init_char_key2=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+15, tempasdf.find(";", tagposition)-15-tagposition);//content of the tag
- SelectionCurr_key[1]=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("init_char_key3=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+15, tempasdf.find(";", tagposition)-15-tagposition);//content of the tag
- SelectionCurr_key[2]=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("init_char_key4=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+15, tempasdf.find(";", tagposition)-15-tagposition);//content of the tag
- SelectionCurr_key[3]=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("next_button=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+12, tempasdf.find(";", tagposition)-12-tagposition);//content of the tag
- if ("<u_a>"==tempqwer) tempqwer="0";
- if ("<d_a>"==tempqwer) tempqwer="1";
- if ("<l_a>"==tempqwer) tempqwer="2";
- if ("<r_a>"==tempqwer) tempqwer="3";
- if ("<a>"==tempqwer) tempqwer="4";
- if ("<d>"==tempqwer) tempqwer="5";
- if ("<j>"==tempqwer) tempqwer="6";
- if ("<s>"==tempqwer) tempqwer="7";
- _nextbutton=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("back_button=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+12, tempasdf.find(";", tagposition)-12-tagposition);//content of the tag
- if ("<u_a>"==tempqwer) tempqwer="0";
- if ("<d_a>"==tempqwer) tempqwer="1";
- if ("<l_a>"==tempqwer) tempqwer="2";
- if ("<r_a>"==tempqwer) tempqwer="3";
- if ("<a>"==tempqwer) tempqwer="4";
- if ("<d>"==tempqwer) tempqwer="5";
- if ("<j>"==tempqwer) tempqwer="6";
- if ("<s>"==tempqwer) tempqwer="7";
- _backbutton=Evaluate(tempqwer);
- }
- tagposition=tempasdf.find("init_bg_key=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+12, tempasdf.find(";", tagposition)-12-tagposition);//content of the tag
- _currbgkey=Evaluate(tempqwer);
- }
- for (int a=1; a<11; a++)
- {
- tagposition=tempasdf.find("player_origin"+stringify(a)+"=");
- if (tagposition!=std::string::npos) //if the tag was found
- {
- tempqwer=tempasdf.substr(tagposition+14+stringify(a).length(), tempasdf.find(";", tagposition)-(14+stringify(a).length())-tagposition);//content of the tag
- LOADED->_playermenuorigins[(a-1)*2]=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- LOADED->_playermenuorigins[1+((a-1)*2)]=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- }
- }
- for (int a=1; a<5; a++)
- {
- size_t tagposition=tempasdf.find("click_to_join"+stringify(a)+"["); //store the position of the tag
- if (tagposition!=std::string::npos) //if this tag was found in the {selection_menu} block
- {
- tempabcd=tempasdf.substr(tagposition+15, tempasdf.find("]", tagposition)-15-tagposition);//copy the content of "click_to_join[]"
- tempasdf.erase(tagposition, tempasdf.find("]", tagposition)-tagposition+1); //erase what copied
- tagposition=tempabcd.find("when_join="); //store the position of the tag "when_join="
- tempqwer=tempabcd.substr(tagposition+10, tempabcd.find(";", tagposition)-10-tagposition);//content of tag "when_join="
- _clicktojoinfrms[a+4-1]=Evaluate(tempqwer);
- tagposition=tempabcd.find("position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+9, tempabcd.find(";", tagposition)-9-tagposition); //content of tag "position="
- _clicktojoinpos[a-1]=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- _clicktojoinpos[a+4-1]=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("init_frame=");
- tempqwer=tempabcd.substr(tagposition+11, tempabcd.find(";", tagposition)-11-tagposition);//content of tag "init_frame="
- _clicktojoinfrms[a-1]=Evaluate(tempqwer);
- //_menusdata.CreateOBJECTCOPY(0, tempposx, tempposy, Evaluate(tempqwer));
- }
- }
- for (int a=1; a<5; a++)
- {
- size_t tagposition=tempasdf.find("highlight"+stringify(a)+"["); //store the position of the tag
- if (tagposition!=std::string::npos) //if this tag was found in the {selection_menu} block
- {
- tempabcd=tempasdf.substr(tagposition+11, tempasdf.find("]", tagposition)-11-tagposition);//copy the content of "highlight[]"
- tempasdf.erase(tagposition, tempasdf.find("]", tagposition)-tagposition+1); //erase what copied
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition);//content of tag "when_choose="
- _highlightframes[a+4-1]=Evaluate(tempqwer);
- tagposition=tempabcd.find("init_frame=");
- tempqwer=tempabcd.substr(tagposition+11, tempabcd.find(";", tagposition)-11-tagposition);//content of tag "init_frame="
- _highlightframes[a-1]=Evaluate(tempqwer);
- }
- }
- tagposition=tempasdf.find("[id=");
- while (tagposition!=std::string::npos)
- {
- tempabcd=tempasdf.substr(tagposition,tempasdf.find("[/id]",tagposition)-tagposition); //copy the content of "[id=x][/d]"
- tagposition=tempabcd.find("key="); //store the position of the tag "key="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find(";", tagposition)-4-tagposition); //content of tag "key="
- Chars_index=Evaluate(tempqwer);
- Chars[Chars_index].flags[0]=tempabcd.find("|USEPLAYERORIGIN|")!=std::string::npos?true:false; //we check the switch and declare true or false
- Chars[Chars_index].key=Chars_index; //Evaluate and assign
- tempasdf.erase(tempasdf.find("[id="), tempasdf.find("[/id]", tagposition)-tempasdf.find("[id=")+1);//erase what copied
- tagposition=tempabcd.find("[id="); //store the position of the tag "[id="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find("]", tagposition)-4-tagposition); //content of tag "[id="
- Chars[Chars_index].id=Evaluate(tempqwer); //Evaluate the parameter and assign it
- tagposition=tempabcd.find("highlight_position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+19, tempabcd.find(";", tagposition)-19-tagposition); //content of tag "position="
- Chars[Chars_index].posx=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- Chars[Chars_index].posy=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("left="); //store the position of the tag "left="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "left="
- Chars[Chars_index].left=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("right="); //store the position of the tag "right="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find(";", tagposition)-6-tagposition); //content of tag "right="
- Chars[Chars_index].right=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("up="); //store the position of the tag "up="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+3, tempabcd.find(";", tagposition)-3-tagposition); //content of tag "up="
- Chars[Chars_index].up=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("down="); //store the position of the tag "down="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "down="
- Chars[Chars_index].down=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_highlight="); //store the position of the tag "when_highlight="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "when_highlight="
- Chars[Chars_index].highlight=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "when_choose="
- Chars[Chars_index].whenchoose=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("show_stance="); //store the position of the tag "show_stance="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "show_stance="
- Chars[Chars_index]._showstance=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("destroy_stance="); //store the position of the tag "show_stance="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "destroy_stance="
- Chars[Chars_index]._destroystance=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("disjoin="); //store the position of the tag "show_stance="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+8, tempabcd.find(";", tagposition)-8-tagposition); //content of tag "disjoin="
- Chars[Chars_index]._disjoin=Evaluate(tempqwer); //Evaluate and assign
- }
- //Chars_index++; //done, so we increment the index value
- tagposition=tempasdf.find("[id="); //we check again if any other [id= tags exists
- }
- tagposition=tempasdf.find("]", tempasdf.find("[bgid="));
- while (tagposition!=std::string::npos)
- {
- tempabcd=tempasdf.substr(tagposition+1,tempasdf.find("[/bgid]",tagposition)-1-tagposition); //copy the content of "[id=x][/d]"
- tagposition=tempabcd.find("key="); //store the position of the tag "key="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find(";", tagposition)-4-tagposition); //content of tag "key="
- Chars_index=Evaluate(tempqwer);
- Chars[Chars_index].key=Chars_index; //Evaluate and assign
- tempasdf.erase(tempasdf.find("[bgid="), tempasdf.find("[/bgid]", tagposition)-tempasdf.find("[bgid=")+1);//erase what copied
- tagposition=tempabcd.find("[bgid="); //store the position of the tag "[id="
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find("]", tagposition)-6-tagposition); //content of tag "[id="
- Chars[Chars_index].id=Evaluate(tempqwer); //Evaluate the parameter and assign it
- Chars[Chars_index].isbg=true;
- Chars[Chars_index].flags[0]=tempabcd.find("|USEPLAYERORIGIN|")!=std::string::npos?true:false; //we check the switch and declare true or false
- tagposition=tempabcd.find("highlight_position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+19, tempabcd.find(";", tagposition)-19-tagposition); //content of tag "position="
- Chars[Chars_index].posx=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- Chars[Chars_index].posy=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("left="); //store the position of the tag "left="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "left="
- Chars[Chars_index].left=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("right="); //store the position of the tag "right="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find(";", tagposition)-6-tagposition); //content of tag "right="
- Chars[Chars_index].right=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("up="); //store the position of the tag "up="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+3, tempabcd.find(";", tagposition)-3-tagposition); //content of tag "up="
- Chars[Chars_index].up=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("down="); //store the position of the tag "down="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "down="
- Chars[Chars_index].down=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_highlight="); //store the position of the tag "when_highlight="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "when_highlight="
- Chars[Chars_index].highlight=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "when_choose="
- Chars[Chars_index].whenchoose=Evaluate(tempqwer); //Evaluate and assign
- }
- //Chars_index++; //done, so we increment the index value
- tagposition=tempasdf.find("]", tempasdf.find("[bgid=")); //we check again if any other [id= tags exists
- }
- tagposition=tempasdf.find("back_button[");
- while (tagposition!=std::string::npos)
- {
- tempabcd=tempasdf.substr(tagposition+1,tempasdf.find("]",tagposition)-1-tagposition); //copy the content of "back_button[]"
- tempasdf.erase(tempasdf.find("back_button["), tempasdf.find("]", tagposition)-tempasdf.find("back_button[")+1);//erase what copied
- tagposition=tempabcd.find("key="); //store the position of the tag "key="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find(";", tagposition)-4-tagposition); //content of tag "key="
- Chars_index=Evaluate(tempqwer);
- Chars[Chars_index].key=Chars_index; //Evaluate and assign
- Chars[Chars_index].id=6402; //Evaluate the parameter and assign it
- tagposition=tempabcd.find("highlight_position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+19, tempabcd.find(";", tagposition)-19-tagposition); //content of tag "position="
- Chars[Chars_index].posx=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- Chars[Chars_index].posy=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("left="); //store the position of the tag "left="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "left="
- Chars[Chars_index].left=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("right="); //store the position of the tag "right="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find(";", tagposition)-6-tagposition); //content of tag "right="
- Chars[Chars_index].right=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("up="); //store the position of the tag "up="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+3, tempabcd.find(";", tagposition)-3-tagposition); //content of tag "up="
- Chars[Chars_index].up=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("down="); //store the position of the tag "down="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "down="
- Chars[Chars_index].down=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_highlight="); //store the position of the tag "when_highlight="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "when_highlight="
- Chars[Chars_index].highlight=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "when_choose="
- Chars[Chars_index].whenchoose=Evaluate(tempqwer); //Evaluate and assign
- }
- //Chars_index++; //done, so we increment the index value
- tagposition=tempasdf.find("back_button["); //we check again if any other [id= tags exists
- }
- tagposition=tempasdf.find("gamestart_button[");
- while (tagposition!=std::string::npos)
- {
- tempabcd=tempasdf.substr(tagposition+1,tempasdf.find("]",tagposition)-1-tagposition); //copy the content of "menu_bg"
- tempasdf.erase(tempasdf.find("gamestart_button["), tempasdf.find("]", tagposition)-tempasdf.find("gamestart_button[")+1);//erase what copied
- tagposition=tempabcd.find("key="); //store the position of the tag "key="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find(";", tagposition)-4-tagposition); //content of tag "key="
- Chars_index=Evaluate(tempqwer);
- Chars[Chars_index].key=Chars_index; //Evaluate and assign
- Chars[Chars_index].id=6435727; //Evaluate the parameter and assign it
- tagposition=tempabcd.find("highlight_position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+19, tempabcd.find(";", tagposition)-19-tagposition); //content of tag "position="
- Chars[Chars_index].posx=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- Chars[Chars_index].posy=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("left="); //store the position of the tag "left="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "left="
- Chars[Chars_index].left=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("right="); //store the position of the tag "right="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find(";", tagposition)-6-tagposition); //content of tag "right="
- Chars[Chars_index].right=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("up="); //store the position of the tag "up="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+3, tempabcd.find(";", tagposition)-3-tagposition); //content of tag "up="
- Chars[Chars_index].up=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("down="); //store the position of the tag "down="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "down="
- Chars[Chars_index].down=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_highlight="); //store the position of the tag "when_highlight="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "when_highlight="
- Chars[Chars_index].highlight=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "when_choose="
- Chars[Chars_index].whenchoose=Evaluate(tempqwer); //Evaluate and assign
- }
- //Chars_index++; //done, so we increment the index value
- tagposition=tempasdf.find("gamestart_button["); //we check again if any other [id= tags exists //we check again if any other [id= tags exists
- }
- tagposition=tempasdf.find("settings_button[");
- while (tagposition!=std::string::npos)
- {
- tempabcd=tempasdf.substr(tagposition+1,tempasdf.find("]",tagposition)-1-tagposition); //copy the content of "menu_bg"
- tempasdf.erase(tempasdf.find("settings_button["), tempasdf.find("]", tagposition)-tempasdf.find("settings_button[")+1);//erase what copied
- tagposition=tempabcd.find("key="); //store the position of the tag "key="
- tempqwer=tempabcd.substr(tagposition+4, tempabcd.find(";", tagposition)-4-tagposition); //content of tag "key="
- Chars_index=Evaluate(tempqwer);
- Chars[Chars_index].key=Chars_index; //Evaluate and assign
- Chars[Chars_index].id=5377195; //Evaluate the parameter and assign it
- tagposition=tempabcd.find("highlight_position="); //store the position of the tag "position="
- tempqwer=tempabcd.substr(tagposition+19, tempabcd.find(";", tagposition)-19-tagposition); //content of tag "position="
- Chars[Chars_index].posx=Evaluate(tempqwer.substr(0, tempqwer.find(","))); //Evaluate the first x parameter and assign it
- Chars[Chars_index].posy=Evaluate(tempqwer.substr(tempqwer.find(",")+1)); //Evaluate the second y parameter and assign it
- tagposition=tempabcd.find("left="); //store the position of the tag "left="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "left="
- Chars[Chars_index].left=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("right="); //store the position of the tag "right="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+6, tempabcd.find(";", tagposition)-6-tagposition); //content of tag "right="
- Chars[Chars_index].right=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("up="); //store the position of the tag "up="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+3, tempabcd.find(";", tagposition)-3-tagposition); //content of tag "up="
- Chars[Chars_index].up=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("down="); //store the position of the tag "down="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+5, tempabcd.find(";", tagposition)-5-tagposition); //content of tag "down="
- Chars[Chars_index].down=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_highlight="); //store the position of the tag "when_highlight="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+15, tempabcd.find(";", tagposition)-15-tagposition); //content of tag "when_highlight="
- Chars[Chars_index].highlight=Evaluate(tempqwer); //Evaluate and assign
- }
- tagposition=tempabcd.find("when_choose="); //store the position of the tag "when_choose="
- if (tagposition!=std::string::npos)
- {
- tempqwer=tempabcd.substr(tagposition+12, tempabcd.find(";", tagposition)-12-tagposition); //content of tag "when_choose="
- Chars[Chars_index].whenchoose=Evaluate(tempqwer); //Evaluate and assign
- }
- //Chars_index++; //done, so we increment the index value
- tagposition=tempasdf.find("settings_button["); //we check again if any other [id= tags exists //we check again if any other [id= tags exists
- }
- _menusdata.CreateOBJECTCOPY(0, _clicktojoinpos[0], _clicktojoinpos[4], _clicktojoinfrms[0]);
- _menusdata.CreateOBJECTCOPY(1, 10000, 10000, _highlightframes[0]);
- _menusdata.CreateOBJECTCOPY(2, 10000, 10000, _highlightframes[1]);
- _menusdata.CreateOBJECTCOPY(3, 10000, 10000, _highlightframes[2]);
- _menusdata.CreateOBJECTCOPY(4, 10000, 10000, _highlightframes[3]);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.CreateOBJECTCOPY(6, 10000, 10000, 0);
- _menusdata.ON_SCREEN_REAL_OBJS[1].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[2].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[3].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[4].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[5].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[6].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[7].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[8].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[9].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[10].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[11].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[12].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[13].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[14].deleteobj=true;
- }
- void LoadMenuStuff::Update_Interface( LOAD *LOADED )
- {
- if (MenuID==10)
- {
- for (int p_no=0; p_no<4; p_no++)
- {
- P_INPUTDATA[p_no][0]=LOADED->PKEYS[p_no][0]&&P_INPUTDATA[p_no][0]==0?1:P_INPUTDATA[p_no][0];
- P_INPUTDATA[p_no][0]=!LOADED->PKEYS[p_no][0]&&P_INPUTDATA[p_no][0]==2?0:P_INPUTDATA[p_no][0];
- P_INPUTDATA[p_no][1]=LOADED->PKEYS[p_no][1]&&P_INPUTDATA[p_no][1]==0?1:P_INPUTDATA[p_no][1];
- P_INPUTDATA[p_no][1]=!LOADED->PKEYS[p_no][1]&&P_INPUTDATA[p_no][1]==2?0:P_INPUTDATA[p_no][1];
- P_INPUTDATA[p_no][2]=LOADED->PKEYS[p_no][2]&&P_INPUTDATA[p_no][2]==0?1:P_INPUTDATA[p_no][2];
- P_INPUTDATA[p_no][2]=!LOADED->PKEYS[p_no][2]&&P_INPUTDATA[p_no][2]==2?0:P_INPUTDATA[p_no][2];
- P_INPUTDATA[p_no][3]=LOADED->PKEYS[p_no][3]&&P_INPUTDATA[p_no][3]==0?1:P_INPUTDATA[p_no][3];
- P_INPUTDATA[p_no][3]=!LOADED->PKEYS[p_no][3]&&P_INPUTDATA[p_no][3]==2?0:P_INPUTDATA[p_no][3];
- P_INPUTDATA[p_no][4]=LOADED->PKEYS[p_no][4]&&P_INPUTDATA[p_no][4]==0?1:P_INPUTDATA[p_no][4];
- P_INPUTDATA[p_no][4]=!LOADED->PKEYS[p_no][4]&&P_INPUTDATA[p_no][4]==2?0:P_INPUTDATA[p_no][4];
- P_INPUTDATA[p_no][5]=LOADED->PKEYS[p_no][5]&&P_INPUTDATA[p_no][5]==0?1:P_INPUTDATA[p_no][5];
- P_INPUTDATA[p_no][5]=!LOADED->PKEYS[p_no][5]&&P_INPUTDATA[p_no][5]==2?0:P_INPUTDATA[p_no][5];
- }
- for (int objcopIndex=0; objcopIndex<_menusdata.ON_SCREEN_OBJCOUNT; objcopIndex++)
- {
- if (_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno!=4321)
- {
- int abcd=_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno;
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][0]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][0]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_UP=false;
- }
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][1]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][1]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DOWN=false;
- }
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][2]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][2]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_LEFT=false;
- }
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][3]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][3]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_RIGHT=false;
- }
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][4]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][4]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_ATTACK=false;
- }
- if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][5]==1)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND_C=true;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND=true;
- }
- else if (P_INPUTDATA[_menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].playerno-1][5]==2)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND=true;
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND_C=false;
- _menusdata.ON_SCREEN_REAL_OBJS[objcopIndex].P_DEFEND=false;
- }
- }
- }
- for (int p_no=0; p_no<4; p_no++) //loop on the players
- {
- /*0 means that the buttons isn't held nor clicked,
- 1 means that the buttons is clicked
- 2 means that the buttons has been clicked but is still being held */
- int indexno=0;
- for (int a=0; a<4; a++)
- {
- if (_humanplayersjoining[a]==p_no) //find the player number in game
- indexno=a+1;
- }
- if (_menusdata.OBJECTS[indexno].Frames[_menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe].menuflags[10])
- {
- if (P_INPUTDATA[p_no][0]==1)
- {
- P_INPUTDATA[p_no][0]=2;
- if (_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no)
- {
- if (Chars[SelectionCurr_key[p_no]].up!=4321 && Chars[SelectionCurr_key[p_no]].up!=_bg_key)
- {
- SelectionCurr_key[p_no]=Chars[SelectionCurr_key[p_no]].up;
- if (Chars[SelectionCurr_key[p_no]].isbg) _currbgkey=SelectionCurr_key[p_no];
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- if (_charschoices[indexno-1]==4321)
- _menusdata.ON_SCREEN_REAL_OBJS[5+p_no].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- else if(Chars[SelectionCurr_key[p_no]].up==_bg_key && indexno==1)
- {
- SelectionCurr_key[p_no]=_currbgkey;
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- }
- }
- if (P_INPUTDATA[p_no][1]==1)
- {
- P_INPUTDATA[p_no][1]=2;
- if (_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no)
- {
- if (Chars[SelectionCurr_key[p_no]].down!=4321 && Chars[SelectionCurr_key[p_no]].down!=_bg_key)
- {
- SelectionCurr_key[p_no]=Chars[SelectionCurr_key[p_no]].down;
- if (Chars[SelectionCurr_key[p_no]].isbg) _currbgkey=SelectionCurr_key[p_no];
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- if (_charschoices[indexno-1]==4321)
- _menusdata.ON_SCREEN_REAL_OBJS[5+p_no].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- else if(Chars[SelectionCurr_key[p_no]].down==_bg_key && indexno==1)
- {
- SelectionCurr_key[p_no]=_currbgkey;
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- }
- }
- if (P_INPUTDATA[p_no][2]==1)
- {
- P_INPUTDATA[p_no][2]=2;
- if (_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no)
- {
- if (Chars[SelectionCurr_key[p_no]].left!=4321 && Chars[SelectionCurr_key[p_no]].left!=_bg_key)
- {
- SelectionCurr_key[p_no]=Chars[SelectionCurr_key[p_no]].left;
- if (Chars[SelectionCurr_key[p_no]].isbg) _currbgkey=SelectionCurr_key[p_no];
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- if (_charschoices[indexno-1]==4321)
- _menusdata.ON_SCREEN_REAL_OBJS[5+p_no].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- else if(Chars[SelectionCurr_key[p_no]].left==_bg_key && indexno==1)
- {
- SelectionCurr_key[p_no]=_currbgkey;
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- }
- }
- if (P_INPUTDATA[p_no][3]==1)
- {
- P_INPUTDATA[p_no][3]=2;
- if (_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no)
- {
- if (Chars[SelectionCurr_key[p_no]].right!=4321 && Chars[SelectionCurr_key[p_no]].right!=_bg_key)
- {
- SelectionCurr_key[p_no]=Chars[SelectionCurr_key[p_no]].right;
- if (Chars[SelectionCurr_key[p_no]].isbg) _currbgkey=SelectionCurr_key[p_no];
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- if (_charschoices[indexno-1]==4321)
- _menusdata.ON_SCREEN_REAL_OBJS[5+p_no].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- else if(Chars[SelectionCurr_key[p_no]].right==_bg_key && indexno==1)
- {
- SelectionCurr_key[p_no]=_currbgkey;
- if (Chars[SelectionCurr_key[p_no]].flags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx+_playerorigins[(indexno-1)*2];
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy+_playerorigins[1+(indexno-1)*2];
- }
- else
- {
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].posz=Chars[SelectionCurr_key[p_no]].posy;
- }
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].previousframe=
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].currframe=Chars[SelectionCurr_key[p_no]].highlight;
- _menusdata.ON_SCREEN_REAL_OBJS[indexno].newframe=true;
- }
- }
- }
- }
- if (P_INPUTDATA[p_no][_nextbutton]==1)
- {
- P_INPUTDATA[p_no][_nextbutton]=2;
- if (Chars[SelectionCurr_key[p_no]].id==6435727 && _humanplayersjoining[0]==p_no)
- {
- //LOAD STUFFIES!
- LOADNOW=true;
- for (int p_index=0; p_index < 4; p_index++)
- {
- if (_humanplayersjoining[p_index]!=4321)
- {
- _objectstoload+=stringify(_charschoices[p_index])+"~"+stringify(_humanplayersjoining[p_index])+":";
- }
- }
- //OBJECTSTOLOAD=_objectstoload;
- return;
- }
- /*if (_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no){
- _menusdata.ON_SCREEN_REAL_OBJS[_humanplayersjoining[p_no]+1].currframe=Chars[SelectionCurr_key[p_no]].whenchoose;
- _menusdata.ON_SCREEN_REAL_OBJS[_humanplayersjoining[p_no]+1].newframe=true;
- }else{*/
- for (int b=0; b<4; b++)
- {
- if (_humanplayersjoining[b]==p_no && _charschoices[b]==4321)
- {
- if (_menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[b+1].id].Frames[_menusdata.ON_SCREEN_REAL_OBJS[b+1].currframe].menuflags[0])
- {
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].currframe=Chars[SelectionCurr_key[b]].whenchoose;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].newframe=true;
- _charschoices[b]=Chars[SelectionCurr_key[p_no]].id;
- break;
- }
- if (_menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[b+1].id].Frames[_menusdata.ON_SCREEN_REAL_OBJS[b+1].currframe].menuflags[1])
- {
- continue;
- }
- }
- if (_humanplayersjoining[b]==4321 && !(_humanplayersjoining[0]==p_no||_humanplayersjoining[1]==p_no
- ||_humanplayersjoining[2]==p_no||_humanplayersjoining[3]==p_no))
- {
- _humanplayersjoining[b]=p_no;
- _menusdata.ON_SCREEN_REAL_OBJS[0].currframe=_clicktojoinfrms[b+4];
- _menusdata.ON_SCREEN_REAL_OBJS[0].newframe=true;
- _menusdata.ON_SCREEN_REAL_OBJS[0].playerno=p_no+1;
- SelectionCurr_key[p_no]=0;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].posx=Chars[SelectionCurr_key[p_no]].posx;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].posz=Chars[SelectionCurr_key[p_no]].posy;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].deleteobj=false;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].currframe=Chars[SelectionCurr_key[p_no]]._whnhighlght;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].playerno=p_no+1;
- _menusdata.ON_SCREEN_REAL_OBJS[b+1].newframe=true;
- break;
- }
- }
- }
- if (P_INPUTDATA[p_no][_backbutton]==1)
- {
- P_INPUTDATA[p_no][_backbutton]=2;
- for (int b=0; b<4; b++)
- {
- if (_humanplayersjoining[b]==p_no)
- {
- if (_menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[b+1].id].Frames[_menusdata.ON_SCREEN_REAL_OBJS[b+1].currframe].menuflags[3])
- {
- }
- }
- }
- }
- }
- for (int b=_menusdata.ON_SCREEN_OBJCOUNT-(_menusdata.OBJSBEHIND_INDEX); b<_menusdata.ON_SCREEN_OBJCOUNT; b++)
- {
- if (_menusdata.ON_SCREEN_OBJS[b]->deleteobj==false)
- {
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_OBJS[b]->id].Blit(_menusdata.ON_SCREEN_OBJS[b]);
- }
- }
- _menusdata.BACKGROUNDS[0].Blit(&_menusdata);
- int humanplayers=0;
- for (int a=0; a<4; a++)
- if (_humanplayersjoining[a]==4321)
- //humanplayers++;
- //if (_menusdata.ON_SCREEN_REAL_OBJS[0].deleteobj && humanplayers<4){
- if (_menusdata.ON_SCREEN_REAL_OBJS[0].deleteobj)
- {
- _menusdata.ON_SCREEN_REAL_OBJS[0].deleteobj=false;
- _menusdata.ON_SCREEN_REAL_OBJS[0].currframe=_clicktojoinfrms[a];
- _menusdata.ON_SCREEN_REAL_OBJS[0].posx=_clicktojoinpos[a];
- _menusdata.ON_SCREEN_REAL_OBJS[0].posy=_clicktojoinpos[a+4];
- _menusdata.ON_SCREEN_REAL_OBJS[0].newframe=true;
- }
- for (int x=0; x < _menusdata.ON_SCREEN_OBJCOUNT; x++)
- {
- if (!(_menusdata.ON_SCREEN_REAL_OBJS[x].deleteobj || _menusdata.ON_SCREEN_REAL_OBJS[x].deleted))
- {
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[x].id].UpdateStat(&_menusdata.ON_SCREEN_REAL_OBJS[x]);
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[x].id].UpdateMove(&_menusdata.ON_SCREEN_REAL_OBJS[x]);
- if (_menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[x].id].Frames[_menusdata.ON_SCREEN_REAL_OBJS[x].currframe].menuflags[8]) //if |DISJOIN|
- {
- for (int playernoindx=0; playernoindx<4; playernoindx++)
- {
- if (_humanplayersjoining[playernoindx]==_menusdata.ON_SCREEN_REAL_OBJS[x].playerno-1)
- {
- _humanplayersjoining[playernoindx]=4321;
- _menusdata.ON_SCREEN_REAL_OBJS[playernoindx+1].posx=10000;
- _menusdata.ON_SCREEN_REAL_OBJS[playernoindx+1].posz=10000;
- _menusdata.ON_SCREEN_REAL_OBJS[playernoindx+1].deleteobj=true;
- _menusdata.ON_SCREEN_REAL_OBJS[0].deleteobj=false;
- _menusdata.ON_SCREEN_REAL_OBJS[0].currframe=_clicktojoinfrms[playernoindx];
- //_menusdata.ON_SCREEN_REAL_OBJS[0].posx=_clicktojoinpos[playernoindx];
- //_menusdata.ON_SCREEN_REAL_OBJS[0].posy=_clicktojoinpos[playernoindx+4];
- _menusdata.ON_SCREEN_REAL_OBJS[0].newframe=true;
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[0].id].UpdateStat(&_menusdata.ON_SCREEN_REAL_OBJS[x]);
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[0].id].UpdateMove(&_menusdata.ON_SCREEN_REAL_OBJS[x]);
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].deleteobj=true;
- _charschoices[playernoindx]=4321;
- }
- }
- }
- if (_menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[x].id].Frames[_menusdata.ON_SCREEN_REAL_OBJS[x].currframe].menuflags[9]) //if |SHOWSTANCE|
- {
- if (_menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].deleteobj&&Chars[SelectionCurr_key[_menusdata.ON_SCREEN_REAL_OBJS[x].playerno-1]]._showstance!=4321
- )
- {
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].deleteobj=false;
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].posx=LOADED->_playermenuorigins[_menusdata.ON_SCREEN_REAL_OBJS[x].playerno*2];
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].posz=LOADED->_playermenuorigins[1+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno*2];
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].currframe=Chars[SelectionCurr_key[_menusdata.ON_SCREEN_REAL_OBJS[x].playerno-1]]._showstance;
- _menusdata.ON_SCREEN_REAL_OBJS[4+_menusdata.ON_SCREEN_REAL_OBJS[x].playerno].newframe=true;
- }
- }
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_REAL_OBJS[x].id].BlitShadow(&_menusdata.ON_SCREEN_REAL_OBJS[x]);
- }
- }
- for (int a=_menusdata.ON_SCREEN_OBJCOUNT-1; a >14; a--)
- {
- if (_menusdata.ON_SCREEN_REAL_OBJS[a].deleteobj && _menusdata.ON_SCREEN_REAL_OBJS[a].deleted==false)
- {
- if (_menusdata.ON_SCREEN_REAL_OBJS[a].rndrbackid!=4321)
- _menusdata.OBJSBEHIND_INDEX--;
- _menusdata.DELETED_OBJS[_menusdata.D_O_INDEX++]=a;
- _menusdata.ON_SCREEN_REAL_OBJS[a].deleted=true;
- }
- }
- std::sort((_menusdata.ON_SCREEN_OBJS).begin(), (_menusdata.ON_SCREEN_OBJS).begin()+(_menusdata.ON_SCREEN_OBJCOUNT), comp_by_zpos());
- for (int b=0; b<_menusdata.ON_SCREEN_OBJCOUNT; b++)
- {
- if (_menusdata.ON_SCREEN_OBJS[b]->deleteobj==false && _menusdata.ON_SCREEN_OBJS[b]->rndrbackid==4321)
- {
- _menusdata.OBJECTS[_menusdata.ON_SCREEN_OBJS[b]->id].Blit(_menusdata.ON_SCREEN_OBJS[b]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement