Exemplo n.º 1
0
static void CheatPowerFunc(PlayerPawn *p, const byte *arg)
{
    if(p->powers[pw_weaponlevel2])
    {
        p->powers[pw_weaponlevel2] = 0;
        p->player->SetMessage(CHEAT_POWEROFF, false);
    }
    else
    {
        P_UseArtifact(p, arti_tomeofpower);
        p->player->SetMessage(CHEAT_POWERON, false);
    }
}
Exemplo n.º 2
0
boolean EV_LineSearchForPuzzleItem(line_t *line, byte *args, mobj_t *mo)
{
	player_t *player;
	int     i;
	artitype_t type, arti;

	if(!mo)
		return false;
	player = mo->player;
	if(!player)
		return false;

	// Search player's inventory for puzzle items
	for(i = 0; i < player->artifactCount; i++)
	{
		arti = player->inventory[i].type;
		type = arti - arti_firstpuzzitem;
		if(type < 0)
			continue;
		if(type == line->arg1)
		{
			// A puzzle item was found for the line
			if(P_UseArtifact(player, arti))
			{
				// A puzzle item was found for the line
				P_PlayerRemoveArtifact(player, i);
				if(arti < arti_firstpuzzitem)
				{
					S_ConsoleSound(SFX_ARTIFACT_USE, NULL, player - players);
				}
				else
				{
					S_ConsoleSound(SFX_PUZZLE_SUCCESS, NULL, player - players);
				}
				if(player == &players[consoleplayer])
				{
					ArtifactFlash = 4;
				}
				return true;
			}
		}
	}
	return false;
}