mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-04 16:02:48 +00:00
Reduce code duplication in M_UpdateChallengeGridExtraData for adjacency rules
This commit is contained in:
parent
200b817f9d
commit
04214c05ec
1 changed files with 18 additions and 32 deletions
50
src/m_cond.c
50
src/m_cond.c
|
|
@ -398,6 +398,20 @@ badgrid:
|
||||||
gamedata->challengegridwidth = 0;
|
gamedata->challengegridwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void M_ChallengeGridExtraDataAdjacencyRules(challengegridextradata_t *extradata, UINT16 adjacent)
|
||||||
|
{
|
||||||
|
// Adjacent unlocked tile, permit hint/general key skip.
|
||||||
|
if (gamedata->unlocked[adjacent] == true)
|
||||||
|
{
|
||||||
|
extradata->flags |= CHE_HINT;
|
||||||
|
}
|
||||||
|
// Adjacent locked tile, prevent 10x key skip.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extradata->flags &= ~CHE_ALLCLEAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
||||||
{
|
{
|
||||||
UINT16 i, j, num, id, tempid, work;
|
UINT16 i, j, num, id, tempid, work;
|
||||||
|
|
@ -489,14 +503,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
||||||
}
|
}
|
||||||
else if (work < MAXUNLOCKABLES)
|
else if (work < MAXUNLOCKABLES)
|
||||||
{
|
{
|
||||||
if (gamedata->unlocked[work] == true)
|
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||||
{
|
|
||||||
extradata[id].flags |= CHE_HINT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,14 +541,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
||||||
}
|
}
|
||||||
else if (work < MAXUNLOCKABLES)
|
else if (work < MAXUNLOCKABLES)
|
||||||
{
|
{
|
||||||
if (gamedata->unlocked[work] == true)
|
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||||
{
|
|
||||||
extradata[id].flags |= CHE_HINT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -566,14 +566,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
||||||
}
|
}
|
||||||
else if (work < MAXUNLOCKABLES)
|
else if (work < MAXUNLOCKABLES)
|
||||||
{
|
{
|
||||||
if (gamedata->unlocked[work] == true)
|
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||||
{
|
|
||||||
extradata[id].flags |= CHE_HINT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -595,14 +588,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
||||||
}
|
}
|
||||||
else if (work < MAXUNLOCKABLES)
|
else if (work < MAXUNLOCKABLES)
|
||||||
{
|
{
|
||||||
if (gamedata->unlocked[work] == true)
|
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||||
{
|
|
||||||
extradata[id].flags |= CHE_HINT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue