SettingsMenuView.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. =======================================================================================
  3. Copyright (C) 2009-2011 id Software LLC, a ZeniMax Media company. All Right Reserved.
  4. This file is part of the DOOM Classic iOS v2.1 GPL Source Code.
  5. =======================================================================================
  6. */
  7. #import "SettingsMenuView.h"
  8. #import "doomAppDelegate.h"
  9. #include "doomiphone.h"
  10. @implementation SettingsMenuView
  11. - (void) resetSwitches {
  12. [ autoUseSwitch setOn: (BOOL)autoUse->value ];
  13. [ statusbarSwitch setOn: (BOOL)statusBar->value ];
  14. [ touchclickSwitch setOn: (BOOL)touchClick->value ];
  15. [ textMessageSwitch setOn: (BOOL)messages->value ];
  16. [ drawControlsSwitch setOn: (BOOL)drawControls->value ];
  17. [ musicSwitch setOn: (BOOL)music->value ];
  18. [ centerSticksSwitch setOn: (BOOL)centerSticks->value ];
  19. [ rampTurnSwitch setOn: (BOOL)rampTurn->value ];
  20. }
  21. - (void) initialize{
  22. }
  23. - (void)awakeFromNib {
  24. [self initialize];
  25. }
  26. - (id) initWithCoder:(NSCoder *)aCoder{
  27. if(self = [super initWithCoder:aCoder] ) {
  28. [self initialize];
  29. }
  30. return self;
  31. }
  32. - (id) initWithFrame:(CGRect)rect{
  33. if(self = [super initWithFrame:rect] ) {
  34. [self initialize];
  35. }
  36. return self;
  37. }
  38. - (IBAction) BackToMain {
  39. [gAppDelegate MainMenu];
  40. Sound_StartLocalSound( "iphone/controller_down_01_SILENCE.wav" );
  41. }
  42. - (IBAction) ResetToDefaults {
  43. // reset all cvars except the reverse-landscape mode value
  44. float value = revLand->value;
  45. Cvar_Reset_f();
  46. Cvar_SetValue( revLand->name, value );
  47. HudSetForScheme(0);
  48. iphoneStartMusic();
  49. Sound_StartLocalSound( "iphone/controller_down_01_SILENCE.wav" );
  50. [self resetSwitches];
  51. }
  52. - (IBAction) AutoUseChanged {
  53. Cvar_SetValue( autoUse->name, !autoUse->value );
  54. }
  55. - (IBAction) StatusBarChanged {
  56. Cvar_SetValue( statusBar->name, !statusBar->value );
  57. }
  58. - (IBAction) TouchClickChanged {
  59. Cvar_SetValue( touchClick->name, !touchClick->value );
  60. }
  61. - (IBAction) TextMessagesChanged {
  62. Cvar_SetValue( messages->name, !messages->value );
  63. }
  64. - (IBAction) DrawControlsChanged {
  65. Cvar_SetValue( drawControls->name, !drawControls->value );
  66. }
  67. - (IBAction) MusicChanged {
  68. if ( !SysIPhoneOtherAudioIsPlaying() ) {
  69. Cvar_SetValue( music->name, !music->value );
  70. if ( music->value ) {
  71. iphoneStartMusic();
  72. } else {
  73. iphoneStopMusic();
  74. }
  75. }
  76. }
  77. - (IBAction) CenterSticksChanged {
  78. Cvar_SetValue( centerSticks->name, !centerSticks->value );
  79. }
  80. - (IBAction) RampTurnChanged {
  81. Cvar_SetValue( rampTurn->name, !rampTurn->value );
  82. }
  83. @end