Example #1
0
//
// A_FireSound
//
void A_FireSound (player_t *player, const char *sound)
{
	if (!serverside && player->id != consoleplayer_id)
		return;

 	UV_SoundAvoidPlayer (player->mo, CHAN_WEAPON, sound, ATTN_NORM);
}
Example #2
0
BOOL EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
                int tag, int speed, int delay, card_t lock)
{
	BOOL		rtn = false;
	int 		secnum;
	sector_t*	sec;
    DDoor *door;

	if (lock && thing && !P_CheckKeys (thing->player, lock, tag))
		return false;

	if (tag == 0)
	{		// [RH] manual door
		if (!line)
			return false;

		// if the wrong side of door is pushed, give oof sound
		if (line->sidenum[1]==R_NOSIDE)				// killough
		{
			UV_SoundAvoidPlayer (thing, CHAN_VOICE, "player/male/grunt1", ATTN_NORM);
			return false;
		}

		// get the sector on the second side of activating linedef
		sec = sides[line->sidenum[1]].sector;
		secnum = sec-sectors;

		if (sec->ceilingdata && P_MovingCeilingCompleted(sec))
		{
			sec->ceilingdata->Destroy();
			sec->ceilingdata = NULL;
		}
		
		// if door already has a thinker, use it
		door = static_cast<DDoor *>(sec->ceilingdata);
		// cph 2001/04/05 -
		// Original Doom didn't distinguish floor/lighting/ceiling
		// actions, so we need to do the same in demo compatibility mode.
		//   [SL] 2011-06-20 - Credit to PrBoom for the fix
		if (!door)
			door = static_cast<DDoor *>(sec->floordata);
		if (!door)
			door = static_cast<DDoor *>(sec->lightingdata);

		if (door)
		{
			// ONLY FOR "RAISE" DOORS, NOT "OPEN"s
			if (door->m_Type == DDoor::doorRaise && type == DDoor::doorRaise)
			{
				if (sec->ceilingdata && sec->ceilingdata->IsKindOf (RUNTIME_CLASS(DDoor)))
				{
					if (door->m_Status == DDoor::closing)
					{
						// go back up
						door->m_Status = DDoor::reopening;
						return true;
					}
					else if (GET_SPAC(line->flags) == SPAC_PUSH)
					{
						// [RH] activate push doors don't go back down when you
						// run into them (otherwise opening them would be
						// a real pain).
						door->m_Line = line;
						return true;	
					}
					else if (thing && thing->player)
					{
						// go back down
						door->m_Status = DDoor::closing;
						return true;
					}
				}
				return false;
			}
		}
        else
        {
            door = new DDoor(sec, line, type, speed, delay);
            P_AddMovingCeiling(sec);
        }
		if (door)
        {
			rtn = true;
        }
	}
	else
	{	// [RH] Remote door
		secnum = -1;
		while ((secnum = P_FindSectorFromTag (tag,secnum)) >= 0)
		{
			sec = &sectors[secnum];
			// if the ceiling already moving, don't start the door action
			if (sec->ceilingdata)
				continue;

			door = new DDoor(sec, line, type, speed, delay);
			P_AddMovingCeiling(sec);
			
			if (door)
				rtn = true;
		}
	}
	
	return rtn;
}
Example #3
0
BOOL EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
                int tag, int speed, int delay, card_t lock)
{
    BOOL		rtn = false;
    int 		secnum;
    sector_t*	sec;
    DDoor *door;

    if (lock && thing && !P_CheckKeys (thing->player, lock, tag))
        return false;

    if (tag == 0)
    {   // [RH] manual door
        if (!line)
            return false;

        // if the wrong side of door is pushed, give oof sound
        if (line->sidenum[1]==-1)				// killough
        {
            UV_SoundAvoidPlayer (thing, CHAN_VOICE, "player/male/grunt1", ATTN_NORM);
            return false;
        }

        // get the sector on the second side of activating linedef
        sec = sides[line->sidenum[1]].sector;
        secnum = sec-sectors;

        // if door already has a thinker, use it
        if (sec->ceilingdata && sec->ceilingdata->IsKindOf (RUNTIME_CLASS(DDoor)))
        {
            door = static_cast<DDoor *>(sec->ceilingdata);
            door->m_Line = line;

            // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
            if (door->m_Type == DDoor::doorRaise && type == DDoor::doorRaise)
            {
                if (door->m_Direction == -1)
                {
                    door->m_Direction = 1;	// go back up
                }
                else if (GET_SPAC(line->flags) != SPAC_PUSH)
                    // [RH] activate push doors don't go back down when you
                    //		run into them (otherwise opening them would be
                    //		a real pain).
                {
                    if (thing && !thing->player)
                        return false;	// JDC: bad guys never close doors

                    // From Chocolate Doom:
                    // When is a door not a door?
                    // In Vanilla, door->direction is set, even though
                    // "specialdata" might not actually point at a door.

                    else if (sec->floordata && sec->floordata->IsKindOf (RUNTIME_CLASS(DPlat)))
                    {
                        // Erm, this is a plat, not a door.
                        // This notably causes a problem in ep1-0500.lmp where
                        // a plat and a door are cross-referenced; the door
                        // doesn't open on 64-bit.
                        // The direction field in vldoor_t corresponds to the wait
                        // field in plat_t.  Let's set that to -1 instead.

                        DPlat *plat = static_cast<DPlat *>(sec->floordata);
                        byte state;
                        int count;

                        plat->GetState(state, count);

                        if (count >= 16)    // ep1-0500 always returns a count of 16.
                            return false;   // We may be able to always return false?
                    }
                    else
                    {
                        door->m_Direction = -1;	// try going back down anyway?
                    }
                }
                return true;
            }
        }
        else
        {
            door = new DDoor(sec, line, type, speed, delay);
        }
        if (door)
        {
            rtn = true;
        }
    }
    else
    {   // [RH] Remote door

        secnum = -1;
        while ((secnum = P_FindSectorFromTag (tag,secnum)) >= 0)
        {
            sec = &sectors[secnum];
            // if the ceiling already moving, don't start the door action
            if (sec->ceilingdata)
                continue;

            if (new DDoor (sec, line, type, speed, delay))
                rtn = true;
        }

    }
    return rtn;
}