mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 21:20:54 +00:00
Randomize skin during signpost roulette
This commit is contained in:
parent
da226139f1
commit
6f5833f8b3
1 changed files with 13 additions and 21 deletions
|
@ -5189,33 +5189,25 @@ void A_SignPlayer(mobj_t *actor)
|
||||||
else if (locvar1 != -3) // set to a defined skin
|
else if (locvar1 != -3) // set to a defined skin
|
||||||
{
|
{
|
||||||
// I turned this function into a fucking mess. I'm so sorry. -Lach
|
// I turned this function into a fucking mess. I'm so sorry. -Lach
|
||||||
if (locvar1 == -2) // next skin
|
if (locvar1 == -2) // random skin
|
||||||
{
|
{
|
||||||
|
#define skincheck(num) (player ? !R_SkinUsable(player-players, num) : skins[num].availability > 0)
|
||||||
player_t *player = actor->target ? actor->target->player : NULL;
|
player_t *player = actor->target ? actor->target->player : NULL;
|
||||||
UINT8 skinnum;
|
UINT8 skinnum;
|
||||||
#define skincheck(num) (player ? !R_SkinUsable(player-players, num) : skins[num].availability > 0)
|
UINT8 skincount = 0;
|
||||||
if (ov->skin == NULL) // pick a random skin to start with!
|
for (skincount = 0; skincount < numskins; skincount++)
|
||||||
|
if (!skincheck(skincount))
|
||||||
|
skincount++;
|
||||||
|
skinnum = P_RandomKey(skincount);
|
||||||
|
for (skincount = 0; skincount < numskins; skincount++)
|
||||||
{
|
{
|
||||||
UINT8 skincount = 0;
|
if (skincount > skinnum)
|
||||||
for (skincount = 0; skincount < numskins; skincount++)
|
break;
|
||||||
if (!skincheck(skincount))
|
if (skincheck(skincount))
|
||||||
skincount++;
|
skinnum++;
|
||||||
skinnum = P_RandomKey(skincount);
|
|
||||||
for (skincount = 0; skincount < numskins; skincount++)
|
|
||||||
{
|
|
||||||
if (skincount > skinnum)
|
|
||||||
break;
|
|
||||||
if (skincheck(skincount))
|
|
||||||
skinnum++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise, advance 1 skin
|
|
||||||
{
|
|
||||||
skinnum = (skin_t*)ov->skin-skins;
|
|
||||||
while ((skinnum = (skinnum + 1) % numskins) && skincheck(skinnum));
|
|
||||||
}
|
|
||||||
#undef skincheck
|
|
||||||
skin = &skins[skinnum];
|
skin = &skins[skinnum];
|
||||||
|
#undef skincheck
|
||||||
}
|
}
|
||||||
else // specific skin
|
else // specific skin
|
||||||
skin = &skins[locvar1];
|
skin = &skins[locvar1];
|
||||||
|
|
Loading…
Reference in a new issue