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

Move entityclass::settreadmillcolour() to entclass::settreadmillcolour()

This moves settreadmillcolour() onto the entity object, so I can invoke
it independent of an indice in obj.entities.
This commit is contained in:
Misa 2020-04-03 12:47:38 -07:00 committed by Ethan Lee
parent f5a84d7972
commit ae84de2c7e
4 changed files with 86 additions and 86 deletions

View file

@ -505,3 +505,86 @@ void entclass::setenemyroom( int rx, int ry )
break;
}
}
void entclass::settreadmillcolour( int rx, int ry )
{
rx -= 100;
ry -= 100;
rx += 50 - 12;
ry += 50 - 14; //Space Station
tile = 20; //default as blue
switch(rn(rx, ry))
{
case rn(52, 48):
tile = 791;
break; //Cyan
case rn(49, 47):
tile = 24;
break; //Yellow
case rn(56, 44):
tile = 24;
break; //Yellow
case rn(54, 49):
tile = 24;
break; //Yellow
case rn(49, 49):
tile = 36;
break; //Green
case rn(55, 44):
tile = 36;
break; //Green
case rn(54, 43):
tile = 36;
break; //Green
case rn(53, 49):
tile = 36;
break; //Green
case rn(54, 45):
tile = 711;
break; //Green (special)
case rn(51, 48):
tile = 711;
break; //Green (special)
case rn(50, 49):
tile = 28;
break; //Purple
case rn(54, 44):
tile = 28;
break; //Purple
case rn(49, 42):
tile = 28;
break; //Purple
case rn(55, 43):
tile = 28;
break; //Purple
case rn(54, 47):
tile = 28;
break; //Purple
case rn(53, 48):
tile = 28;
break; //Purple
case rn(51, 47):
tile = 32;
break; //Red
case rn(52, 49):
tile = 32;
break; //Red
case rn(48, 43):
tile = 32;
break; //Red
case rn(55, 47):
tile = 32;
break; //Red
case rn(54, 48):
tile = 32;
break; //Red
default:
return;
break;
}
}

View file

@ -16,6 +16,8 @@ public:
void setenemyroom(int rx, int ry);
void settreadmillcolour(int rx, int ry);
public:
//Fundamentals
bool active, invis;

View file

@ -1267,89 +1267,6 @@ int entityclass::crewcolour( int t )
return 0;
}
void entityclass::settreadmillcolour( int t, int rx, int ry )
{
rx -= 100;
ry -= 100;
rx += 50 - 12;
ry += 50 - 14; //Space Station
entities[t].tile = 20; //default as blue
switch(rn(rx, ry))
{
case rn(52, 48):
entities[t].tile = 791;
break; //Cyan
case rn(49, 47):
entities[t].tile = 24;
break; //Yellow
case rn(56, 44):
entities[t].tile = 24;
break; //Yellow
case rn(54, 49):
entities[t].tile = 24;
break; //Yellow
case rn(49, 49):
entities[t].tile = 36;
break; //Green
case rn(55, 44):
entities[t].tile = 36;
break; //Green
case rn(54, 43):
entities[t].tile = 36;
break; //Green
case rn(53, 49):
entities[t].tile = 36;
break; //Green
case rn(54, 45):
entities[t].tile = 711;
break; //Green (special)
case rn(51, 48):
entities[t].tile = 711;
break; //Green (special)
case rn(50, 49):
entities[t].tile = 28;
break; //Purple
case rn(54, 44):
entities[t].tile = 28;
break; //Purple
case rn(49, 42):
entities[t].tile = 28;
break; //Purple
case rn(55, 43):
entities[t].tile = 28;
break; //Purple
case rn(54, 47):
entities[t].tile = 28;
break; //Purple
case rn(53, 48):
entities[t].tile = 28;
break; //Purple
case rn(51, 47):
entities[t].tile = 32;
break; //Red
case rn(52, 49):
entities[t].tile = 32;
break; //Red
case rn(48, 43):
entities[t].tile = 32;
break; //Red
case rn(55, 47):
entities[t].tile = 32;
break; //Red
case rn(54, 48):
entities[t].tile = 32;
break; //Red
default:
return;
break;
}
}
void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, float vy /*= 0*/, int p1 /*= 0*/, int p2 /*= 0*/, int p3 /*= 320*/, int p4 /*= 240 */ )
{
//Find the first inactive case z that we can use to index the new entity
@ -1539,7 +1456,7 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo
if (int(vx) == 8) entities[k].tile += 4;
if (int(vx) == 9) entities[k].animate = 11;
}else{
settreadmillcolour(k, game.roomx, game.roomy);
entities[k].settreadmillcolour(game.roomx, game.roomy);
if (int(vx) == 8) entities[k].tile += 40;
if (int(vx) == 9) entities[k].animate = 11;
}

View file

@ -80,8 +80,6 @@ public:
int crewcolour(int t);
void settreadmillcolour(int t, int rx, int ry);
void createentity(float xp, float yp, int t, float vx = 0, float vy = 0,
int p1 = 0, int p2 = 0, int p3 = 320, int p4 = 240 );