From ffd38599967a02f9d31ae611d4a99ff2c1ccd867 Mon Sep 17 00:00:00 2001 From: Michael Thorp Date: Mon, 6 Jul 2026 12:11:21 -0700 Subject: [PATCH 1/3] Minimize changes, make compile-time options happen in project file --- Classes/iNethackAppDelegate.m | 14 +++++++++++- Settings.bundle/advancedgameplay.plist | 30 ++++++++++++++++++++++++++ iNetHack.xcodeproj/project.pbxproj | 4 ++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Classes/iNethackAppDelegate.m b/Classes/iNethackAppDelegate.m index d22c4f68..529d728f 100644 --- a/Classes/iNethackAppDelegate.m +++ b/Classes/iNethackAppDelegate.m @@ -39,6 +39,9 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; BOOL startAsBlind = [defaults boolForKey:@"blind"]; BOOL startAsNudist = [defaults boolForKey:@"nudist"]; + BOOL startAsDeaf = [defaults boolForKey:@"deaf"]; + BOOL startAsPauper = [defaults boolForKey:@"pauper"]; + BOOL allowSeduction = [defaults boolForKey:@"seduce"]; NSString *petType = [defaults stringForKey:@"pettype"]; NSString *dogName = [defaults stringForKey:@"dogname"]; NSString *catName = [defaults stringForKey:@"catname"]; @@ -51,6 +54,12 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { if (startAsNudist) { [activeOptions addObject:@"nudist"]; } + if (startAsDeaf) { + [activeOptions addObject:@"deaf"]; + } + if (startAsPauper) { + [activeOptions addObject:@"pauper"]; + } if (petType && [petType length] > 0 && ![petType isEqualToString:@"random"]) { NSString *petOption = [NSString stringWithFormat:@"pettype:%@", petType]; [activeOptions addObject:petOption]; @@ -67,7 +76,10 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { NSString *horseOption = [NSString stringWithFormat:@"horsename:%@", horseName]; [activeOptions addObject:horseOption]; } - if ([activeOptions count] > 0) { + + [activeOptions addObject:[NSString stringWithFormat:@"SEDUCE=%d", allowSeduction ? 1 : 0]]; + + if ([activeOptions count] > 0) { NSString *optionsString = [activeOptions componentsJoinedByString:@","]; setenv("NETHACKOPTIONS", [optionsString UTF8String], 1); } else { diff --git a/Settings.bundle/advancedgameplay.plist b/Settings.bundle/advancedgameplay.plist index fa462f1e..8aafdae7 100644 --- a/Settings.bundle/advancedgameplay.plist +++ b/Settings.bundle/advancedgameplay.plist @@ -49,6 +49,36 @@ DefaultValue + + Type + PSToggleSwitchSpecifier + Title + Deaf + Key + deaf + DefaultValue + + + + Type + PSToggleSwitchSpecifier + Title + Pauper + Key + pauper + DefaultValue + + + + Type + PSToggleSwitchSpecifier + Title + Allow Seduction + Key + seduce + DefaultValue + + diff --git a/iNetHack.xcodeproj/project.pbxproj b/iNetHack.xcodeproj/project.pbxproj index 4e1ffa52..ca053291 100755 --- a/iNetHack.xcodeproj/project.pbxproj +++ b/iNetHack.xcodeproj/project.pbxproj @@ -1911,6 +1911,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = iNetHack_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = ( + "SEDUCE=1", + "$(inherited)", + ); "HEADER_SEARCH_PATHS[arch=*]" = "lib/**"; INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; From 484c02b3c2b273d5f466b377a1f8cfcd2407a8c7 Mon Sep 17 00:00:00 2001 From: Michael Thorp Date: Mon, 6 Jul 2026 12:38:52 -0700 Subject: [PATCH 2/3] Set SYSOPT_SEDUCE to sysopt.seduce value, which defaults to 1 but can be overriden to 0 by the config --- Classes/iNethackAppDelegate.m | 6 ++++-- nethack/include/sys.h | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/iNethackAppDelegate.m b/Classes/iNethackAppDelegate.m index 529d728f..1fbed34d 100644 --- a/Classes/iNethackAppDelegate.m +++ b/Classes/iNethackAppDelegate.m @@ -76,8 +76,10 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { NSString *horseOption = [NSString stringWithFormat:@"horsename:%@", horseName]; [activeOptions addObject:horseOption]; } - - [activeOptions addObject:[NSString stringWithFormat:@"SEDUCE=%d", allowSeduction ? 1 : 0]]; + if (!allowSeduction) { + // Seduction is on by default, but it can be turned off with SEDUCE=0 + [activeOptions addObject:@"SEDUCE=0"]; + } if ([activeOptions count] > 0) { NSString *optionsString = [activeOptions componentsJoinedByString:@","]; diff --git a/nethack/include/sys.h b/nethack/include/sys.h index 8b823b0d..ed2f5785 100644 --- a/nethack/include/sys.h +++ b/nethack/include/sys.h @@ -51,7 +51,6 @@ struct sysopt { extern struct sysopt sysopt; -// iNethack2: enable seduce. -#define SYSOPT_SEDUCE 1 +#define SYSOPT_SEDUCE sysopt.seduce #endif /* SYS_H */ From 63625d5bd51f99b86d7dc8cb2bbc9921e50aa5b9 Mon Sep 17 00:00:00 2001 From: Michael Thorp Date: Mon, 6 Jul 2026 12:40:11 -0700 Subject: [PATCH 3/3] Compile time option is not needed --- iNetHack.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/iNetHack.xcodeproj/project.pbxproj b/iNetHack.xcodeproj/project.pbxproj index ca053291..4e1ffa52 100755 --- a/iNetHack.xcodeproj/project.pbxproj +++ b/iNetHack.xcodeproj/project.pbxproj @@ -1911,10 +1911,6 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = iNetHack_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "SEDUCE=1", - "$(inherited)", - ); "HEADER_SEARCH_PATHS[arch=*]" = "lib/**"; INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0;