components/prboom/p_switch.c
//
// P_ChangeSwitchTexture()
//
// Function that changes switch wall texture on activation.
//
// Passed the line which the switch is on, and whether its retriggerable.
// If not retriggerable, this function clears the line special to insure that
//
// No return
//
P_ChangeSwitchTexture()
Function that changes switch wall texture on activation.

Passed the line which the switch is on, and whether its retriggerable.
If not retriggerable, this function clears the line special to insure that

No return
P_ChangeSwitchTexture () Function that changes switch wall texture on activation . Passed the line which the switch is on and whether its retriggerable . If not retriggerable this function clears the line special to insure that No return
void P_ChangeSwitchTexture
( line_t*       line,
  int           useAgain )
{
  mobj_t  *soundorg;
  int     i, sound;
  short   *texture, *ttop, *tmid, *tbot;
  bwhere_e position;
  ttop = &sides[line->sidenum[0]].toptexture;
  tmid = &sides[line->sidenum[0]].midtexture;
  tbot = &sides[line->sidenum[0]].bottomtexture;
  sound = sfx_swtchn;
  soundorg = (mobj_t *)&line->soundorg;
  if (comp[comp_sound] || compatibility_level < prboom_6_compatibility) {
    soundorg = buttonlist->soundorg;
  } else {
  }
  if (!useAgain)
    line->special = 0;
  texture = NULL; position = 0;
  for (i = 0;i < numswitches*2;i++) { 
    if (switchlist[i] == *ttop) {
      texture = ttop; position = top; break;
    } else if (switchlist[i] == *tmid) {
      texture = tmid; position = middle; break;
    } else if (switchlist[i] == *tbot) {
      texture = tbot; position = bottom; break;
    }
  }
  if (texture == NULL)
    return; 
  *texture = switchlist[i^1];
  S_StartSound(soundorg, sound);
  if (useAgain)
    P_StartButton(line, position, switchlist[i], BUTTONTIME);
}
void P_ChangeSwitchTexture ( line_t * line , int useAgain ) { mobj_t * soundorg ; int i , sound ; short * texture , * ttop , * tmid , * tbot ; bwhere_e position ; ttop = & sides [ line -> sidenum [ 0 ] ] . toptexture ; tmid = & sides [ line -> sidenum [ 0 ] ] . midtexture ; tbot = & sides [ line -> sidenum [ 0 ] ] . bottomtexture ; sound = sfx_swtchn ; soundorg = ( mobj_t * ) & line -> soundorg ; if ( comp [ comp_sound ] || compatibility_level < prboom_6_compatibility ) { soundorg = buttonlist -> soundorg ; } else { } if ( ! useAgain ) line -> special = 0 ; texture = NULL ; position = 0 ; for ( i = 0 ; i < numswitches * 2 ; i ++ ) { if ( switchlist [ i ] == * ttop ) { texture = ttop ; position = top ; break ; } else if ( switchlist [ i ] == * tmid ) { texture = tmid ; position = middle ; break ; } else if ( switchlist [ i ] == * tbot ) { texture = tbot ; position = bottom ; break ; } } if ( texture == NULL ) return ; * texture = switchlist [ i ^ 1 ] ; S_StartSound ( soundorg , sound ) ; if ( useAgain ) P_StartButton ( line , position , switchlist [ i ] , BUTTONTIME ) ; }
P_ChangeSwitchTexture()
Function that changes switch wall texture on activation.
P_ChangeSwitchTexture () Function that changes switch wall texture on activation .
/* Rearranged a bit to avoid too much code duplication */ /* use the sound origin of the linedef (its midpoint)
   * unless in a compatibility mode */ /* usually NULL, unless there is another button already pressed in,
     * in which case it's the sound origin of that button press... */ // EXIT SWITCH? /* don't do this unless you're in a compatibility mode */ // proff - this works as advertised, but I don't like the sound // if (line->special == 11 || line->special == 51) // exit or secret exit //   sound = sfx_swtchx; /* don't zero line->special until after exit switch test */ /* search for a texture to change */ /* this could be more efficient... */ /* no switch texture was found to change */