1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Fix indentation of scriptclass::loadcustom()

It's now indented with tabs like the rest of the file. Furthermore, two
indentation levels have been knocked off.
This commit is contained in:
Misa 2020-05-18 10:09:57 -07:00 committed by Ethan Lee
parent fcea247c43
commit 7afe206a0d

View file

@ -3581,296 +3581,296 @@ void scriptclass::hardreset()
void scriptclass::loadcustom(std::string t) void scriptclass::loadcustom(std::string t)
{ {
//this magic function breaks down the custom script and turns into real scripting! //this magic function breaks down the custom script and turns into real scripting!
std::string cscriptname=""; std::string cscriptname="";
for(size_t i=0; i<t.length(); i++){ for(size_t i=0; i<t.length(); i++){
if(i>=7) cscriptname+=t[i]; if(i>=7) cscriptname+=t[i];
} }
int scriptstart=-1; int scriptstart=-1;
int scriptend=-1; int scriptend=-1;
std::string tstring; std::string tstring;
for(size_t i=0; i<customscript.size(); i++){ for(size_t i=0; i<customscript.size(); i++){
if(scriptstart==-1){ if(scriptstart==-1){
//Find start of the script //Find start of the script
if(script.customscript[i]==cscriptname+":"){ if(script.customscript[i]==cscriptname+":"){
scriptstart=i+1; scriptstart=i+1;
} }
}else if(scriptend==-1){ }else if(scriptend==-1){
//Find the end //Find the end
tstring=script.customscript[i]; tstring=script.customscript[i];
if (tstring.size() > 0) { if (tstring.size() > 0) {
tstring=tstring[tstring.size()-1]; tstring=tstring[tstring.size()-1];
} else { } else {
tstring=""; tstring="";
} }
if(tstring==":"){ if(tstring==":"){
scriptend=i; scriptend=i;
} }
} }
} }
if(scriptstart>-1){ if(scriptstart>-1){
if(scriptend==-1){ if(scriptend==-1){
scriptend=customscript.size(); scriptend=customscript.size();
} }
//Ok, we've got the relavent script segment, we do a pass to assess it, then run it! //Ok, we've got the relavent script segment, we do a pass to assess it, then run it!
int customcutscenemode=0; int customcutscenemode=0;
for(int i=scriptstart; i<scriptend; i++){ for(int i=scriptstart; i<scriptend; i++){
tokenize(script.customscript[i]); tokenize(script.customscript[i]);
if(words[0] == "say"){ if(words[0] == "say"){
customcutscenemode=1; customcutscenemode=1;
}else if(words[0] == "reply"){ }else if(words[0] == "reply"){
customcutscenemode=1; customcutscenemode=1;
} }
} }
if(customcutscenemode==1){ if(customcutscenemode==1){
add("cutscene()"); add("cutscene()");
add("untilbars()"); add("untilbars()");
} }
int customtextmode=0; int customtextmode=0;
int speakermode=0; //0, terminal, numbers for crew int speakermode=0; //0, terminal, numbers for crew
int squeakmode=0;//default on int squeakmode=0;//default on
//Now run the script //Now run the script
for(int i=scriptstart; i<scriptend; i++){ for(int i=scriptstart; i<scriptend; i++){
words[0]="nothing"; //Default! words[0]="nothing"; //Default!
words[1]="1"; //Default! words[1]="1"; //Default!
tokenize(script.customscript[i]); tokenize(script.customscript[i]);
std::transform(words[0].begin(), words[0].end(), words[0].begin(), ::tolower); std::transform(words[0].begin(), words[0].end(), words[0].begin(), ::tolower);
if(words[0] == "music"){ if(words[0] == "music"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="0"){ if(words[1]=="0"){
tstring="stopmusic()"; tstring="stopmusic()";
}else{ }else{
if(words[1]=="11"){ tstring="play(14)"; if(words[1]=="11"){ tstring="play(14)";
}else if(words[1]=="10"){ tstring="play(13)"; }else if(words[1]=="10"){ tstring="play(13)";
}else if(words[1]=="9"){ tstring="play(12)"; }else if(words[1]=="9"){ tstring="play(12)";
}else if(words[1]=="8"){ tstring="play(11)"; }else if(words[1]=="8"){ tstring="play(11)";
}else if(words[1]=="7"){ tstring="play(10)"; }else if(words[1]=="7"){ tstring="play(10)";
}else if(words[1]=="6"){ tstring="play(8)"; }else if(words[1]=="6"){ tstring="play(8)";
}else if(words[1]=="5"){ tstring="play(6)"; }else if(words[1]=="5"){ tstring="play(6)";
}else { tstring="play("+words[1]+")"; } }else { tstring="play("+words[1]+")"; }
} }
add(tstring); add(tstring);
}else if(words[0] == "playremix"){ }else if(words[0] == "playremix"){
add("play(15)"); add("play(15)");
}else if(words[0] == "flash"){ }else if(words[0] == "flash"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add("flash(5)"); add("flash(5)");
add("shake(20)"); add("shake(20)");
add("playef(9)"); add("playef(9)");
}else if(words[0] == "sad" || words[0] == "cry"){ }else if(words[0] == "sad" || words[0] == "cry"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="player"){ if(words[1]=="player"){
add("changemood(player,1)"); add("changemood(player,1)");
}else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){ }else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){
add("changecustommood(customcyan,1)"); add("changecustommood(customcyan,1)");
}else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){ }else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){
add("changecustommood(purple,1)"); add("changecustommood(purple,1)");
}else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){ }else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){
add("changecustommood(yellow,1)"); add("changecustommood(yellow,1)");
}else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){ }else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){
add("changecustommood(red,1)"); add("changecustommood(red,1)");
}else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){ }else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){
add("changecustommood(green,1)"); add("changecustommood(green,1)");
}else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){ }else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){
add("changecustommood(blue,1)"); add("changecustommood(blue,1)");
}else if(words[1]=="all" || words[1]=="everybody" || words[1]=="everyone"){ }else if(words[1]=="all" || words[1]=="everybody" || words[1]=="everyone"){
add("changemood(player,1)"); add("changemood(player,1)");
add("changecustommood(customcyan,1)"); add("changecustommood(customcyan,1)");
add("changecustommood(purple,1)"); add("changecustommood(purple,1)");
add("changecustommood(yellow,1)"); add("changecustommood(yellow,1)");
add("changecustommood(red,1)"); add("changecustommood(red,1)");
add("changecustommood(green,1)"); add("changecustommood(green,1)");
add("changecustommood(blue,1)"); add("changecustommood(blue,1)");
}else{ }else{
add("changemood(player,1)"); add("changemood(player,1)");
} }
if(squeakmode==0) add("squeak(cry)"); if(squeakmode==0) add("squeak(cry)");
}else if(words[0] == "happy"){ }else if(words[0] == "happy"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="player"){ if(words[1]=="player"){
add("changemood(player,0)"); add("changemood(player,0)");
if(squeakmode==0) add("squeak(player)"); if(squeakmode==0) add("squeak(player)");
}else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){ }else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){
add("changecustommood(customcyan,0)"); add("changecustommood(customcyan,0)");
if(squeakmode==0) add("squeak(player)"); if(squeakmode==0) add("squeak(player)");
}else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){ }else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){
add("changecustommood(purple,0)"); add("changecustommood(purple,0)");
if(squeakmode==0) add("squeak(purple)"); if(squeakmode==0) add("squeak(purple)");
}else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){ }else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){
add("changecustommood(yellow,0)"); add("changecustommood(yellow,0)");
if(squeakmode==0) add("squeak(yellow)"); if(squeakmode==0) add("squeak(yellow)");
}else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){ }else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){
add("changecustommood(red,0)"); add("changecustommood(red,0)");
if(squeakmode==0) add("squeak(red)"); if(squeakmode==0) add("squeak(red)");
}else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){ }else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){
add("changecustommood(green,0)"); add("changecustommood(green,0)");
if(squeakmode==0) add("squeak(green)"); if(squeakmode==0) add("squeak(green)");
}else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){ }else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){
add("changecustommood(blue,0)"); add("changecustommood(blue,0)");
if(squeakmode==0) add("squeak(blue)"); if(squeakmode==0) add("squeak(blue)");
}else if(words[1]=="all" || words[1]=="everybody" || words[1]=="everyone"){ }else if(words[1]=="all" || words[1]=="everybody" || words[1]=="everyone"){
add("changemood(player,0)"); add("changemood(player,0)");
add("changecustommood(customcyan,0)"); add("changecustommood(customcyan,0)");
add("changecustommood(purple,0)"); add("changecustommood(purple,0)");
add("changecustommood(yellow,0)"); add("changecustommood(yellow,0)");
add("changecustommood(red,0)"); add("changecustommood(red,0)");
add("changecustommood(green,0)"); add("changecustommood(green,0)");
add("changecustommood(blue,0)"); add("changecustommood(blue,0)");
}else{ }else{
add("changemood(player,0)"); add("changemood(player,0)");
if(squeakmode==0) add("squeak(player)"); if(squeakmode==0) add("squeak(player)");
} }
}else if(words[0] == "squeak"){ }else if(words[0] == "squeak"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="player"){ if(words[1]=="player"){
add("squeak(player)"); add("squeak(player)");
}else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){ }else if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="1"){
add("squeak(player)"); add("squeak(player)");
}else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){ }else if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2"){
add("squeak(purple)"); add("squeak(purple)");
}else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){ }else if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3"){
add("squeak(yellow)"); add("squeak(yellow)");
}else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){ }else if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4"){
add("squeak(red)"); add("squeak(red)");
}else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){ }else if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5"){
add("squeak(green)"); add("squeak(green)");
}else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){ }else if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6"){
add("squeak(blue)"); add("squeak(blue)");
}else if(words[1]=="cry" || words[1]=="sad"){ }else if(words[1]=="cry" || words[1]=="sad"){
add("squeak(cry)"); add("squeak(cry)");
}else if(words[1]=="on"){ }else if(words[1]=="on"){
squeakmode=0; squeakmode=0;
}else if(words[1]=="off"){ }else if(words[1]=="off"){
squeakmode=1; squeakmode=1;
} }
}else if(words[0] == "delay"){ }else if(words[0] == "delay"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add(script.customscript[i]); add(script.customscript[i]);
}else if(words[0] == "flag"){ }else if(words[0] == "flag"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add(script.customscript[i]); add(script.customscript[i]);
}else if(words[0] == "map"){ }else if(words[0] == "map"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add("custom"+script.customscript[i]); add("custom"+script.customscript[i]);
}else if(words[0] == "warpdir"){ }else if(words[0] == "warpdir"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add(script.customscript[i]); add(script.customscript[i]);
}else if(words[0] == "ifwarp"){ }else if(words[0] == "ifwarp"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add(script.customscript[i]); add(script.customscript[i]);
}else if(words[0] == "iftrinkets"){ }else if(words[0] == "iftrinkets"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add("custom"+script.customscript[i]); add("custom"+script.customscript[i]);
}else if(words[0] == "ifflag"){ }else if(words[0] == "ifflag"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add("custom"+script.customscript[i]); add("custom"+script.customscript[i]);
}else if(words[0] == "iftrinketsless"){ }else if(words[0] == "iftrinketsless"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
add("custom"+script.customscript[i]); add("custom"+script.customscript[i]);
}else if(words[0] == "destroy"){ }else if(words[0] == "destroy"){
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="gravitylines"){ if(words[1]=="gravitylines"){
add("destroy(gravitylines)"); add("destroy(gravitylines)");
}else if(words[1]=="warptokens"){ }else if(words[1]=="warptokens"){
add("destroy(warptokens)"); add("destroy(warptokens)");
}else if(words[1]=="platforms"){ }else if(words[1]=="platforms"){
add("destroy(platforms)"); add("destroy(platforms)");
} }
}else if(words[0] == "speaker"){ }else if(words[0] == "speaker"){
speakermode=0; speakermode=0;
if(words[1]=="gray" || words[1]=="grey" || words[1]=="terminal" || words[1]=="0") speakermode=0; if(words[1]=="gray" || words[1]=="grey" || words[1]=="terminal" || words[1]=="0") speakermode=0;
if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="player" || words[1]=="1") speakermode=1; if(words[1]=="cyan" || words[1]=="viridian" || words[1]=="player" || words[1]=="1") speakermode=1;
if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2") speakermode=2; if(words[1]=="purple" || words[1]=="violet" || words[1]=="pink" || words[1]=="2") speakermode=2;
if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3") speakermode=3; if(words[1]=="yellow" || words[1]=="vitellary" || words[1]=="3") speakermode=3;
if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4") speakermode=4; if(words[1]=="red" || words[1]=="vermilion" || words[1]=="4") speakermode=4;
if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5") speakermode=5; if(words[1]=="green" || words[1]=="verdigris" || words[1]=="5") speakermode=5;
if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6") speakermode=6; if(words[1]=="blue" || words[1]=="victoria" || words[1]=="6") speakermode=6;
}else if(words[0] == "say"){ }else if(words[0] == "say"){
//Speakers! //Speakers!
if(words[2]=="terminal" || words[2]=="gray" || words[2]=="grey" || words[2]=="0") speakermode=0; if(words[2]=="terminal" || words[2]=="gray" || words[2]=="grey" || words[2]=="0") speakermode=0;
if(words[2]=="cyan" || words[2]=="viridian" || words[2]=="player" || words[2]=="1") speakermode=1; if(words[2]=="cyan" || words[2]=="viridian" || words[2]=="player" || words[2]=="1") speakermode=1;
if(words[2]=="purple" || words[2]=="violet" || words[2]=="pink" || words[2]=="2") speakermode=2; if(words[2]=="purple" || words[2]=="violet" || words[2]=="pink" || words[2]=="2") speakermode=2;
if(words[2]=="yellow" || words[2]=="vitellary" || words[2]=="3") speakermode=3; if(words[2]=="yellow" || words[2]=="vitellary" || words[2]=="3") speakermode=3;
if(words[2]=="red" || words[2]=="vermilion" || words[2]=="4") speakermode=4; if(words[2]=="red" || words[2]=="vermilion" || words[2]=="4") speakermode=4;
if(words[2]=="green" || words[2]=="verdigris" || words[2]=="5") speakermode=5; if(words[2]=="green" || words[2]=="verdigris" || words[2]=="5") speakermode=5;
if(words[2]=="blue" || words[2]=="victoria" || words[2]=="6") speakermode=6; if(words[2]=="blue" || words[2]=="victoria" || words[2]=="6") speakermode=6;
switch(speakermode){ switch(speakermode){
case 0: case 0:
if(squeakmode==0) add("squeak(terminal)"); if(squeakmode==0) add("squeak(terminal)");
add("text(gray,0,114,"+words[1]+")"); add("text(gray,0,114,"+words[1]+")");
break; break;
case 1: //NOT THE PLAYER case 1: //NOT THE PLAYER
if(squeakmode==0) add("squeak(cyan)"); if(squeakmode==0) add("squeak(cyan)");
add("text(cyan,0,0,"+words[1]+")"); add("text(cyan,0,0,"+words[1]+")");
break; break;
case 2: case 2:
if(squeakmode==0) add("squeak(purple)"); if(squeakmode==0) add("squeak(purple)");
add("text(purple,0,0,"+words[1]+")"); add("text(purple,0,0,"+words[1]+")");
break; break;
case 3: case 3:
if(squeakmode==0) add("squeak(yellow)"); if(squeakmode==0) add("squeak(yellow)");
add("text(yellow,0,0,"+words[1]+")"); add("text(yellow,0,0,"+words[1]+")");
break; break;
case 4: case 4:
if(squeakmode==0) add("squeak(red)"); if(squeakmode==0) add("squeak(red)");
add("text(red,0,0,"+words[1]+")"); add("text(red,0,0,"+words[1]+")");
break; break;
case 5: case 5:
if(squeakmode==0) add("squeak(green)"); if(squeakmode==0) add("squeak(green)");
add("text(green,0,0,"+words[1]+")"); add("text(green,0,0,"+words[1]+")");
break; break;
case 6: case 6:
if(squeakmode==0) add("squeak(blue)"); if(squeakmode==0) add("squeak(blue)");
add("text(blue,0,0,"+words[1]+")"); add("text(blue,0,0,"+words[1]+")");
break; break;
} }
int ti=atoi(words[1].c_str()); int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){ if(ti>=0 && ti<=50){
for(int ti2=0; ti2<ti; ti2++){ for(int ti2=0; ti2<ti; ti2++){
i++; add(script.customscript[i]); i++; add(script.customscript[i]);
} }
}else{ }else{
i++; add(script.customscript[i]); i++; add(script.customscript[i]);
} }
switch(speakermode){ switch(speakermode){
case 0: add("customposition(center)"); break; case 0: add("customposition(center)"); break;
case 1: add("customposition(cyan,above)"); break; case 1: add("customposition(cyan,above)"); break;
case 2: add("customposition(purple,above)"); break; case 2: add("customposition(purple,above)"); break;
case 3: add("customposition(yellow,above)"); break; case 3: add("customposition(yellow,above)"); break;
case 4: add("customposition(red,above)"); break; case 4: add("customposition(red,above)"); break;
case 5: add("customposition(green,above)"); break; case 5: add("customposition(green,above)"); break;
case 6: add("customposition(blue,above)"); break; case 6: add("customposition(blue,above)"); break;
} }
add("speak_active"); add("speak_active");
customtextmode=1; customtextmode=1;
}else if(words[0] == "reply"){ }else if(words[0] == "reply"){
//For this version, terminal only //For this version, terminal only
if(squeakmode==0) add("squeak(player)"); if(squeakmode==0) add("squeak(player)");
add("text(cyan,0,0,"+words[1]+")"); add("text(cyan,0,0,"+words[1]+")");
int ti=atoi(words[1].c_str()); int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){ if(ti>=0 && ti<=50){
for(int ti2=0; ti2<ti; ti2++){ for(int ti2=0; ti2<ti; ti2++){
i++; add(script.customscript[i]); i++; add(script.customscript[i]);
} }
}else{ }else{
i++; add(script.customscript[i]); i++; add(script.customscript[i]);
} }
add("position(player,above)"); add("position(player,above)");
add("speak_active"); add("speak_active");
customtextmode=1; customtextmode=1;
} }
} }
if(customtextmode==1){ add("endtext"); customtextmode=0;} if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(customcutscenemode==1){ if(customcutscenemode==1){
add("endcutscene()"); add("endcutscene()");
add("untilbars()"); add("untilbars()");
} }
} }
} }