From ae84de2c7ef1f306325b196d8bfe930dd9966703 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Apr 2020 12:47:38 -0700 Subject: [PATCH] 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. --- desktop_version/src/Ent.cpp | 83 +++++++++++++++++++++++++++++++++ desktop_version/src/Ent.h | 2 + desktop_version/src/Entity.cpp | 85 +--------------------------------- desktop_version/src/Entity.h | 2 - 4 files changed, 86 insertions(+), 86 deletions(-) diff --git a/desktop_version/src/Ent.cpp b/desktop_version/src/Ent.cpp index 88aad11a..1f2d5c12 100644 --- a/desktop_version/src/Ent.cpp +++ b/desktop_version/src/Ent.cpp @@ -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; + } +} diff --git a/desktop_version/src/Ent.h b/desktop_version/src/Ent.h index 155780c9..b8c2d7c0 100644 --- a/desktop_version/src/Ent.h +++ b/desktop_version/src/Ent.h @@ -16,6 +16,8 @@ public: void setenemyroom(int rx, int ry); + void settreadmillcolour(int rx, int ry); + public: //Fundamentals bool active, invis; diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index ede72bfb..e7c97c9f 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -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; } diff --git a/desktop_version/src/Entity.h b/desktop_version/src/Entity.h index 488dcc93..59e037de 100644 --- a/desktop_version/src/Entity.h +++ b/desktop_version/src/Entity.h @@ -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 );