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

Glitchless: Fix changetile sprite glitch (TEMP)

TODO: use color_valid for other commands?
This commit is contained in:
Misa 2024-08-30 11:51:43 -07:00
parent 01d256b408
commit 639f0e5229
2 changed files with 39 additions and 1 deletions

View file

@ -3953,6 +3953,10 @@ int entityclass::getscm(void)
} }
} }
if (game.glitchlessmode)
{
return -1;
}
return 0; return 0;
} }
@ -3970,6 +3974,10 @@ int entityclass::getlineat( int t )
} }
} }
if (game.glitchlessmode)
{
return -1;
}
return 0; return 0;
} }
@ -3989,6 +3997,10 @@ int entityclass::getcrewman( int t, int fallback /*= 0*/ )
} }
} }
if (game.glitchlessmode)
{
return -1;
}
return fallback; return fallback;
} }
@ -4013,6 +4025,10 @@ int entityclass::getcustomcrewman( int t )
} }
} }
if (game.glitchlessmode)
{
return -1;
}
return 0; return 0;
} }

View file

@ -157,6 +157,28 @@ static int getcrewmanfromname(const std::string& name)
return obj.getcrewman(color); return obj.getcrewman(color);
} }
static bool color_valid(const int index, const std::string& name)
{
if (!INBOUNDS_VEC(index, obj.entities))
{
return false;
}
if (!game.glitchlessmode)
{
return true;
}
const int color = getcolorfromname(name);
const bool using_aem = color == -1;
if (using_aem)
{
return true;
}
return obj.entities[index].colour == color;
}
/* Also used in gamestate 1001. */ /* Also used in gamestate 1001. */
void foundtrinket_textbox1(textboxclass* THIS); void foundtrinket_textbox1(textboxclass* THIS);
@ -1022,7 +1044,7 @@ void scriptclass::run(void)
int crewmate = getcrewmanfromname(words[1]); int crewmate = getcrewmanfromname(words[1]);
if (crewmate != -1) i = crewmate; // Ensure AEM is kept if (crewmate != -1) i = crewmate; // Ensure AEM is kept
if (INBOUNDS_VEC(i, obj.entities)) if (color_valid(i, words[1]))
{ {
obj.entities[i].tile = ss_toi(words[2]); obj.entities[i].tile = ss_toi(words[2]);
} }