mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Scan for trinkets and put them into shinytrinkets in customs
For showtrinkets() to work, we'll need the correct map data in custom levels.
This commit is contained in:
parent
3f7ed4b94a
commit
9e9b1b3c6d
3 changed files with 55 additions and 0 deletions
|
@ -397,6 +397,15 @@ std::string mapclass::getglitchname(int x, int y)
|
||||||
|
|
||||||
void mapclass::initmapdata()
|
void mapclass::initmapdata()
|
||||||
{
|
{
|
||||||
|
if (custommode)
|
||||||
|
{
|
||||||
|
initcustommapdata();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
teleporters.clear();
|
||||||
|
shinytrinkets.clear();
|
||||||
|
|
||||||
//Set up static map information like teleporters and shiny trinkets.
|
//Set up static map information like teleporters and shiny trinkets.
|
||||||
setteleporter(0, 0);
|
setteleporter(0, 0);
|
||||||
setteleporter(0, 16);
|
setteleporter(0, 16);
|
||||||
|
@ -436,6 +445,27 @@ void mapclass::initmapdata()
|
||||||
settrinket(10, 8);
|
settrinket(10, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mapclass::initcustommapdata()
|
||||||
|
{
|
||||||
|
shinytrinkets.clear();
|
||||||
|
|
||||||
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
|
for (size_t i = 0; i < edentity.size(); i++)
|
||||||
|
{
|
||||||
|
const edentities& ent = edentity[i];
|
||||||
|
if (ent.t != 9)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int rx = ent.x / 40;
|
||||||
|
const int ry = ent.y / 30;
|
||||||
|
|
||||||
|
settrinket(rx, ry);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int mapclass::finalat(int x, int y)
|
int mapclass::finalat(int x, int y)
|
||||||
{
|
{
|
||||||
//return the tile index of the final stretch tiles offset by the colour difference
|
//return the tile index of the final stretch tiles offset by the colour difference
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
std::string getglitchname(int x, int y);
|
std::string getglitchname(int x, int y);
|
||||||
|
|
||||||
void initmapdata();
|
void initmapdata();
|
||||||
|
void initcustommapdata();
|
||||||
|
|
||||||
int finalat(int x, int y);
|
int finalat(int x, int y);
|
||||||
|
|
||||||
|
|
|
@ -2612,6 +2612,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intro");
|
load("intro");
|
||||||
break;
|
break;
|
||||||
|
@ -2635,6 +2636,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 2: //Load Quicksave
|
case 2: //Load Quicksave
|
||||||
|
@ -2657,6 +2659,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
//a very special case for here needs to ensure that the tower is set correctly
|
//a very special case for here needs to ensure that the tower is set correctly
|
||||||
if (map.towermode)
|
if (map.towermode)
|
||||||
{
|
{
|
||||||
|
@ -2699,6 +2702,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -2727,6 +2731,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -2755,6 +2760,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
@ -2783,6 +2789,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
|
@ -2811,6 +2818,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -2845,6 +2853,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
@ -2869,6 +2878,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
|
|
||||||
load("intro");
|
load("intro");
|
||||||
|
@ -2897,6 +2907,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
|
|
||||||
load("intro");
|
load("intro");
|
||||||
|
@ -2932,6 +2943,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
music.play(11);
|
music.play(11);
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
|
@ -2967,6 +2979,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_1");
|
load("intermission_1");
|
||||||
break;
|
break;
|
||||||
|
@ -3002,6 +3015,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_1");
|
load("intermission_1");
|
||||||
break;
|
break;
|
||||||
|
@ -3037,6 +3051,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_1");
|
load("intermission_1");
|
||||||
break;
|
break;
|
||||||
|
@ -3072,6 +3087,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_1");
|
load("intermission_1");
|
||||||
break;
|
break;
|
||||||
|
@ -3104,6 +3120,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_2");
|
load("intermission_2");
|
||||||
break;
|
break;
|
||||||
|
@ -3136,6 +3153,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_2");
|
load("intermission_2");
|
||||||
break;
|
break;
|
||||||
|
@ -3168,6 +3186,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_2");
|
load("intermission_2");
|
||||||
break;
|
break;
|
||||||
|
@ -3200,6 +3219,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
load("intermission_2");
|
load("intermission_2");
|
||||||
break;
|
break;
|
||||||
|
@ -3223,6 +3243,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 21: //play custom level (in editor)
|
case 21: //play custom level (in editor)
|
||||||
|
@ -3258,6 +3279,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
if(ed.levmusic>0){
|
if(ed.levmusic>0){
|
||||||
music.play(ed.levmusic);
|
music.play(ed.levmusic);
|
||||||
}else{
|
}else{
|
||||||
|
@ -3295,6 +3317,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
|
|
||||||
ed.generatecustomminimap();
|
ed.generatecustomminimap();
|
||||||
map.customshowmm=true;
|
map.customshowmm=true;
|
||||||
|
@ -3340,6 +3363,7 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
map.initmapdata();
|
||||||
ed.generatecustomminimap();
|
ed.generatecustomminimap();
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue