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

Move entityclass::setblockcolour() to blockclass::setblockcolour()

This moves the function setblockcolour(), so I can directly call it on a
particular block without having to have it be inside obj.blocks.
This commit is contained in:
Misa 2020-04-03 15:26:19 -07:00 committed by Ethan Lee
parent 2cb90afbda
commit 7edbebac92
4 changed files with 103 additions and 103 deletions

View file

@ -34,3 +34,68 @@ void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
rect.w = wi; rect.w = wi;
rect.h = hi; rect.h = hi;
} }
void blockclass::setblockcolour( std::string col )
{
if (col == "cyan")
{
r = 164;
g = 164;
b = 255;
}
else if (col == "red")
{
r = 255;
g = 60;
b = 60;
}
else if (col == "green")
{
r = 144;
g = 255;
b = 144;
}
else if (col == "yellow")
{
r = 255;
g = 255;
b = 134;
}
else if (col == "blue")
{
r = 95;
g = 95;
b = 255;
}
else if (col == "purple")
{
r = 255;
g = 134;
b = 255;
}
else if (col == "white")
{
r = 244;
g = 244;
b = 244;
}
else if (col == "gray")
{
r = 174;
g = 174;
b = 174;
}
else if (col == "orange")
{
r = 255;
g = 130;
b = 20;
}
else
{
//use a gray
r = 174;
g = 174;
b = 174;
}
}

View file

@ -12,6 +12,8 @@ public:
void clear(); void clear();
void rectset(const int xi, const int yi, const int wi, const int hi); void rectset(const int xi, const int yi, const int wi, const int hi);
void setblockcolour(std::string col);
public: public:
//Fundamentals //Fundamentals
bool active; bool active;

View file

@ -113,71 +113,6 @@ void entityclass::changeflag( int t, int s )
flags[t] = s; flags[t] = s;
} }
void entityclass::setblockcolour( int t, std::string col )
{
if (col == "cyan")
{
blocks[t].r = 164;
blocks[t].g = 164;
blocks[t].b = 255;
}
else if (col == "red")
{
blocks[t].r = 255;
blocks[t].g = 60;
blocks[t].b = 60;
}
else if (col == "green")
{
blocks[t].r = 144;
blocks[t].g = 255;
blocks[t].b = 144;
}
else if (col == "yellow")
{
blocks[t].r = 255;
blocks[t].g = 255;
blocks[t].b = 134;
}
else if (col == "blue")
{
blocks[t].r = 95;
blocks[t].g = 95;
blocks[t].b = 255;
}
else if (col == "purple")
{
blocks[t].r = 255;
blocks[t].g = 134;
blocks[t].b = 255;
}
else if (col == "white")
{
blocks[t].r = 244;
blocks[t].g = 244;
blocks[t].b = 244;
}
else if (col == "gray")
{
blocks[t].r = 174;
blocks[t].g = 174;
blocks[t].b = 174;
}
else if (col == "orange")
{
blocks[t].r = 255;
blocks[t].g = 130;
blocks[t].b = 20;
}
else
{
//use a gray
blocks[t].r = 174;
blocks[t].g = 174;
blocks[t].b = 174;
}
}
int entityclass::swncolour( int t ) int entityclass::swncolour( int t )
{ {
//given colour t, return colour in setcol //given colour t, return colour in setcol
@ -946,217 +881,217 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
case 0: //testing zone case 0: //testing zone
blocks[k].prompt = "Press ENTER to explode"; blocks[k].prompt = "Press ENTER to explode";
blocks[k].script = "intro"; blocks[k].script = "intro";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=1; trig=1;
break; break;
case 1: case 1:
blocks[k].prompt = "Press ENTER to talk to Violet"; blocks[k].prompt = "Press ENTER to talk to Violet";
blocks[k].script = "talkpurple"; blocks[k].script = "talkpurple";
setblockcolour(k, "purple"); blocks[k].setblockcolour("purple");
trig=0; trig=0;
break; break;
case 2: case 2:
blocks[k].prompt = "Press ENTER to talk to Vitellary"; blocks[k].prompt = "Press ENTER to talk to Vitellary";
blocks[k].script = "talkyellow"; blocks[k].script = "talkyellow";
setblockcolour(k, "yellow"); blocks[k].setblockcolour("yellow");
trig=0; trig=0;
break; break;
case 3: case 3:
blocks[k].prompt = "Press ENTER to talk to Vermilion"; blocks[k].prompt = "Press ENTER to talk to Vermilion";
blocks[k].script = "talkred"; blocks[k].script = "talkred";
setblockcolour(k, "red"); blocks[k].setblockcolour("red");
trig=0; trig=0;
break; break;
case 4: case 4:
blocks[k].prompt = "Press ENTER to talk to Verdigris"; blocks[k].prompt = "Press ENTER to talk to Verdigris";
blocks[k].script = "talkgreen"; blocks[k].script = "talkgreen";
setblockcolour(k, "green"); blocks[k].setblockcolour("green");
trig=0; trig=0;
break; break;
case 5: case 5:
blocks[k].prompt = "Press ENTER to talk to Victoria"; blocks[k].prompt = "Press ENTER to talk to Victoria";
blocks[k].script = "talkblue"; blocks[k].script = "talkblue";
setblockcolour(k, "blue"); blocks[k].setblockcolour("blue");
trig=0; trig=0;
break; break;
case 6: case 6:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_station_1"; blocks[k].script = "terminal_station_1";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 7: case 7:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_1"; blocks[k].script = "terminal_outside_1";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 8: case 8:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_2"; blocks[k].script = "terminal_outside_2";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 9: case 9:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_3"; blocks[k].script = "terminal_outside_3";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 10: case 10:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_4"; blocks[k].script = "terminal_outside_4";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 11: case 11:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_5"; blocks[k].script = "terminal_outside_5";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 12: case 12:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_outside_6"; blocks[k].script = "terminal_outside_6";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 13: case 13:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_finallevel"; blocks[k].script = "terminal_finallevel";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 14: case 14:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_station_2"; blocks[k].script = "terminal_station_2";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 15: case 15:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_station_3"; blocks[k].script = "terminal_station_3";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 16: case 16:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_station_4"; blocks[k].script = "terminal_station_4";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 17: case 17:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_warp_1"; blocks[k].script = "terminal_warp_1";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 18: case 18:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_warp_2"; blocks[k].script = "terminal_warp_2";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 19: case 19:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_lab_1"; blocks[k].script = "terminal_lab_1";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 20: case 20:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_lab_2"; blocks[k].script = "terminal_lab_2";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 21: case 21:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_secretlab"; blocks[k].script = "terminal_secretlab";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 22: case 22:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_shipcomputer"; blocks[k].script = "terminal_shipcomputer";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 23: case 23:
blocks[k].prompt = "Press ENTER to activate terminals"; blocks[k].prompt = "Press ENTER to activate terminals";
blocks[k].script = "terminal_radio"; blocks[k].script = "terminal_radio";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 24: case 24:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "terminal_jukebox"; blocks[k].script = "terminal_jukebox";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 25: case 25:
blocks[k].prompt = "Passion for Exploring"; blocks[k].prompt = "Passion for Exploring";
blocks[k].script = "terminal_juke1"; blocks[k].script = "terminal_juke1";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 26: case 26:
blocks[k].prompt = "Pushing Onwards"; blocks[k].prompt = "Pushing Onwards";
blocks[k].script = "terminal_juke2"; blocks[k].script = "terminal_juke2";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 27: case 27:
blocks[k].prompt = "Positive Force"; blocks[k].prompt = "Positive Force";
blocks[k].script = "terminal_juke3"; blocks[k].script = "terminal_juke3";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 28: case 28:
blocks[k].prompt = "Presenting VVVVVV"; blocks[k].prompt = "Presenting VVVVVV";
blocks[k].script = "terminal_juke4"; blocks[k].script = "terminal_juke4";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 29: case 29:
blocks[k].prompt = "Potential for Anything"; blocks[k].prompt = "Potential for Anything";
blocks[k].script = "terminal_juke5"; blocks[k].script = "terminal_juke5";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 30: case 30:
blocks[k].prompt = "Predestined Fate"; blocks[k].prompt = "Predestined Fate";
blocks[k].script = "terminal_juke6"; blocks[k].script = "terminal_juke6";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 31: case 31:
blocks[k].prompt = "Pipe Dream"; blocks[k].prompt = "Pipe Dream";
blocks[k].script = "terminal_juke7"; blocks[k].script = "terminal_juke7";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 32: case 32:
blocks[k].prompt = "Popular Potpourri"; blocks[k].prompt = "Popular Potpourri";
blocks[k].script = "terminal_juke8"; blocks[k].script = "terminal_juke8";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 33: case 33:
blocks[k].prompt = "Pressure Cooker"; blocks[k].prompt = "Pressure Cooker";
blocks[k].script = "terminal_juke9"; blocks[k].script = "terminal_juke9";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 34: case 34:
blocks[k].prompt = "ecroF evitisoP"; blocks[k].prompt = "ecroF evitisoP";
blocks[k].script = "terminal_juke10"; blocks[k].script = "terminal_juke10";
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
case 35: case 35:
blocks[k].prompt = "Press ENTER to activate terminal"; blocks[k].prompt = "Press ENTER to activate terminal";
blocks[k].script = "custom_"+customscript; blocks[k].script = "custom_"+customscript;
setblockcolour(k, "orange"); blocks[k].setblockcolour("orange");
trig=0; trig=0;
break; break;
} }

View file

@ -54,8 +54,6 @@ public:
createblock(DAMAGE, 312, -8, 16, 260); createblock(DAMAGE, 312, -8, 16, 260);
} }
void setblockcolour(int t, std::string col);
int swncolour(int t ); int swncolour(int t );
void swnenemiescol(int t); void swnenemiescol(int t);