mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-04 04:36:21 +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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
UINT16 i, j, num, id, tempid, work;
|
||||
|
|
@ -489,14 +503,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
|||
}
|
||||
else if (work < MAXUNLOCKABLES)
|
||||
{
|
||||
if (gamedata->unlocked[work] == true)
|
||||
{
|
||||
extradata[id].flags |= CHE_HINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
||||
}
|
||||
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -534,14 +541,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
|||
}
|
||||
else if (work < MAXUNLOCKABLES)
|
||||
{
|
||||
if (gamedata->unlocked[work] == true)
|
||||
{
|
||||
extradata[id].flags |= CHE_HINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
||||
}
|
||||
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -566,14 +566,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
|||
}
|
||||
else if (work < MAXUNLOCKABLES)
|
||||
{
|
||||
if (gamedata->unlocked[work] == true)
|
||||
{
|
||||
extradata[id].flags |= CHE_HINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
||||
}
|
||||
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -595,14 +588,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
|
|||
}
|
||||
else if (work < MAXUNLOCKABLES)
|
||||
{
|
||||
if (gamedata->unlocked[work] == true)
|
||||
{
|
||||
extradata[id].flags |= CHE_HINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
extradata[id].flags &= ~CHE_ALLCLEAR;
|
||||
}
|
||||
M_ChallengeGridExtraDataAdjacencyRules(extradata+id, work);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue