OSDN Git Service

Merge branch 'For2.2.2-Refactoring' into For2.2.2-Refactoring-Cocoa2
authorEric Branlund <ebranlund@fastmail.com>
Wed, 22 Jul 2020 19:04:47 +0000 (12:04 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Wed, 22 Jul 2020 19:04:47 +0000 (12:04 -0700)
1  2 
src/Makefile.am
src/main-win.c
src/main.c
src/main/init.c
src/main/init.h
src/util/angband-files.c

diff --cc src/Makefile.am
@@@ -602,142 -774,24 +774,151 @@@ hengband_SOURCES = 
  
  EXTRA_hengband_SOURCES = \
        angband.ico angband.rc ang_eng.rc maid-x11.c main-win.c \
 -      makefile.bcc makefile.std term/readdib.c term/readdib.h wall.bmp
 +      main-cap.c main-xaw.c \
 +      makefile.bcc makefile.std term/readdib.c term/readdib.h wall.bmp 
 +
 +cocoa_xcode_files = \
 +      cocoa/AppDelegate.m \
 +      cocoa/Base.lproj/MainMenu.xib
 +cocoa_icon_files = \
 +      cocoa/hengband_Icons.icns \
 +      cocoa/Save.icns \
 +      cocoa/Edit.icns \
 +      cocoa/Data.icns
 +cocoa_plist_template = cocoa/Angband-Cocoa.xml
 +cocoa_plist_strings_template = cocoa/Angband-Cocoa.strings
 +cocoa_plist_files = \
 +      cocoa/CommandMenu.plist
 +cocoa_en_nib_files = \
 +      cocoa/Base.lproj/MainMenu.nib
 +cocoa_en_strings_files = \
 +      cocoa/en.lproj/Localizable.strings \
 +      cocoa/en.lproj/CommandMenu.strings \
 +      cocoa/en.lproj/GraphicsMenu.strings
 +cocoa_ja_strings_files = \
 +      cocoa/ja.lproj/MainMenu.strings \
 +      cocoa/ja.lproj/Localizable.strings \
 +      cocoa/ja.lproj/CommandMenu.strings \
 +      cocoa/ja.lproj/GraphicsMenu.strings
  
  EXTRA_DIST = \
 -      gcc-wrap
 +      gcc-wrap \
 +      $(cocoa_xcode_files) \
 +      $(cocoa_icon_files) \
 +      $(cocoa_plist_template) \
 +      $(cocoa_plist_strings_template) \
 +      $(cocoa_plist_files) \
 +      $(cocoa_en_nib_files) \
 +      $(cocoa_en_strings_files) \
 +      $(cocoa_ja_strings_files)
 +
 +if COCOA
 +hengband_SOURCES += main-cocoa.m grafmode.h grafmode.c cocoa/AppDelegate.h
 +AM_CFLAGS = -mmacosx-version-min=10.8 -Wunguarded-availability
 +AM_OBJCFLAGS = -fobjc-arc -mmacosx-version-min=10.8 -Wunguarded-availability
 +hengband_LDFLAGS = -framework cocoa $(AM_LDFLAGS)
 +hengband_LINK = MACOSX_DEPLOYMENT_TARGET=10.8 $(OBJCLINK) $(hengband_LDFLAGS) $(LDFLAGS) -o $@
 +APPNAME = $(PACKAGE_NAME)
 +APPEXE = hengband
 +APPDIR = $(APPNAME).app
 +BUNDLE_IDENTIFIER = jp.osdn.hengband
 +BUNDLE_VERSION = $(PACKAGE_VERSION)
 +BUNDLE_DISPLAY_NAME = $(APPNAME)
 +BUNDLE_NAME = $(BUNDLE_DISPLAY_NAME)
 +BUNDLE_DISPLAY_NAME_JA = 変愚蛮怒
 +BUNDLE_NAME_JA = $(BUNDLE_DISPLAY_NAME_JA)
 +# Be careful with characters (like '&') in the copyright that have special
 +# meanings to sed.
 +COPYRIGHT = Copyright © Mr. Hoge and many others
 +# For now, using the line that appears in news_j.txt.  Is that appropriate?
 +# The ampersand is a kanji so it doesn't seem to be treated as a special
 +# character by sed.
 +COPYRIGHT_JA = Mr.hoge (echizen@users.sourceforge.jp) & 多くの方々
 +APPBNDL = $(bindir)/$(APPDIR)
 +APPCONT = $(APPBNDL)/Contents
 +APPBIN = $(APPCONT)/MacOS
 +APPRES = $(APPCONT)/Resources
 +appbin_PROGRAMS = $(APPEXE)
 +appbindir = $(APPBIN)
 +dist_appicon_DATA = $(cocoa_icon_files)
 +appicondir = $(APPRES)
 +appplist_DATA = $(cocoa_plist_files)
 +appplistdir = $(APPRES)
 +appennib_DATA = $(cocoa_en_nib_files)
 +appennibdir = $(APPRES)/Base.lproj
 +appen_DATA = $(cocoa_en_strings_files)
 +appendir = $(APPRES)/en.lproj
 +appja_DATA = $(cocoa_ja_strings_files)
 +appjadir = $(APPRES)/ja.lproj
 +else
 +EXTRA_hengband_SOURCES += main-cocoa.m grafmode.h grafmode.c \
 +      cocoa/AppDelegate.h
 +hengband_LINK = $(LINK)
 +endif
  
-       -I$(srcdir)/cmd \
 +DEFAULT_INCLUDES = -I$(srcdir) \
++      -I$(srcdir)/artifact \
 +      -I$(srcdir)/art-definition \
 +      -I$(srcdir)/autopick \
 +      -I$(srcdir)/birth \
++      -I$(srcdir)/blue-magic \
 +      -I$(srcdir)/cmd-io \
 +      -I$(srcdir)/cmd-item \
++      -I$(srcdir)/cmd-visual \
 +      -I$(srcdir)/combat \
 +      -I$(srcdir)/core \
 +      -I$(srcdir)/dungeon \
 +      -I$(srcdir)/effect \
++      -I$(srcdir)/flavor \
 +      -I$(srcdir)/floor \
 +      -I$(srcdir)/game-option \
 +      -I$(srcdir)/grid \
 +      -I$(srcdir)/info-reader \
 +      -I$(srcdir)/inventory \
 +      -I$(srcdir)/io \
 +      -I$(srcdir)/io-dump \
 +      -I$(srcdir)/knowledge \
++      -I$(srcdir)/load \
 +      -I$(srcdir)/lore \
 +      -I$(srcdir)/market \
 +      -I$(srcdir)/melee \
 +      -I$(srcdir)/mind \
 +      -I$(srcdir)/monster \
 +      -I$(srcdir)/monster-attack \
 +      -I$(srcdir)/monster-floor \
 +      -I$(srcdir)/monster-race \
 +      -I$(srcdir)/mspell \
 +      -I$(srcdir)/mutation \
 +      -I$(srcdir)/object \
 +      -I$(srcdir)/object-enchant \
++      -I$(srcdir)/object-hook \
++      -I$(srcdir)/object-use \
 +      -I$(srcdir)/pet \
 +      -I$(srcdir)/player \
 +      -I$(srcdir)/player-attack \
++      -I$(srcdir)/racial \
 +      -I$(srcdir)/realm \
 +      -I$(srcdir)/room \
 +      -I$(srcdir)/specific-object \
 +      -I$(srcdir)/spell \
 +      -I$(srcdir)/spell-kind \
 +      -I$(srcdir)/spell-realm \
++      -I$(srcdir)/status \
 +      -I$(srcdir)/sv-definition \
 +      -I$(srcdir)/system \
 +      -I$(srcdir)/term \
 +      -I$(srcdir)/util \
 +      -I$(srcdir)/view \
++      -I$(srcdir)/window \
 +      -I$(srcdir)/wizard \
 +      -I$(srcdir)/world \
 +      -I$(top_builddir)/src
  CFLAGS += $(XFT_CFLAGS)
  LIBS += $(XFT_LIBS)
- COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 -      $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \
 -      -Iartifact -Iart-definition -Iautopick -Ibirth -Iblue-magic -Icmd-io \
 -      -Icmd-item -Icmd-visual -Icombat -Icore -Idungeon -Ieffect -Iflavor \
 -      -Ifloor -Igame-option -Igrid -Iinfo-reader -Iinventory -Iio -Iio-dump \
 -      -Iknowledge -Iload -Imarket -Imelee -Imind -Imonster -Imonster-attack \
 -      -Imonster-floor -Imonster-race -Ilore -Imspell -Imutation -Iobject \
 -      -Iobject-enchant -Iobject-hook -Iobject-use -Ipet -Iplayer -Iplayer-attack \
 -      -Iracial -Irealm -Iroom -Isave -Ispecific-object -Ispell -Ispell-kind \
 -      -Ispell-realm -Istatus -Isv-definition -Isystem -Iterm -Iutil -Iview \
 -      -Iwindow -Iwizard -Iworld
++      $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 +OBJCCOMPILE = $(srcdir)/gcc-wrap $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) \
 +      $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
  
  install-exec-hook:
  if SET_GID
diff --cc src/main-win.c
@@@ -3686,62 -3410,56 +3410,57 @@@ static void hook_quit(concptr str
   */
  static void init_stuff(void)
  {
-       char path[1024];
-       GetModuleFileName(hInstance, path, 512);
-       argv0 = path;
-       strcpy(path + strlen(path) - 4, ".INI");
-       ini_file = string_make(path);
-       int i = strlen(path);
-       for (; i > 0; i--)
-       {
-               if (path[i] == '\\')
-               {
-                       break;
-               }
-       }
-       strcpy(path + i + 1, "lib\\");
-       validate_dir(path, TRUE);
-       init_file_paths(path, path);
-       validate_dir(ANGBAND_DIR_APEX, FALSE);
-       validate_dir(ANGBAND_DIR_BONE, FALSE);
-       if (!check_dir(ANGBAND_DIR_EDIT))
-       {
-               validate_dir(ANGBAND_DIR_DATA, TRUE);
-       }
-       else
-       {
-               validate_dir(ANGBAND_DIR_DATA, FALSE);
-       }
-       validate_dir(ANGBAND_DIR_FILE, TRUE);
-       validate_dir(ANGBAND_DIR_HELP, FALSE);
-       validate_dir(ANGBAND_DIR_INFO, FALSE);
-       validate_dir(ANGBAND_DIR_PREF, TRUE);
-       validate_dir(ANGBAND_DIR_SAVE, FALSE);
-       validate_dir(ANGBAND_DIR_USER, TRUE);
-       validate_dir(ANGBAND_DIR_XTRA, TRUE);
-       path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
-       validate_file(path);
-       path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "graf");
-       ANGBAND_DIR_XTRA_GRAF = string_make(path);
-       validate_dir(ANGBAND_DIR_XTRA_GRAF, TRUE);
-       path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "sound");
-       ANGBAND_DIR_XTRA_SOUND = string_make(path);
-       validate_dir(ANGBAND_DIR_XTRA_SOUND, FALSE);
-       path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "music");
-       ANGBAND_DIR_XTRA_MUSIC = string_make(path);
-       validate_dir(ANGBAND_DIR_XTRA_MUSIC, FALSE);
-       path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "help");
-       ANGBAND_DIR_XTRA_HELP = string_make(path);
+     char path[1024];
+     GetModuleFileName(hInstance, path, 512);
+     argv0 = path;
+     strcpy(path + strlen(path) - 4, ".INI");
+     ini_file = string_make(path);
+     int i = strlen(path);
+     for (; i > 0; i--) {
+         if (path[i] == '\\') {
+             break;
+         }
+     }
+     strcpy(path + i + 1, "lib\\");
+     validate_dir(path, TRUE);
 -    init_file_paths(path);
++    init_file_paths(path, path);
+     validate_dir(ANGBAND_DIR_APEX, FALSE);
+     validate_dir(ANGBAND_DIR_BONE, FALSE);
+     if (!check_dir(ANGBAND_DIR_EDIT)) {
+         validate_dir(ANGBAND_DIR_DATA, TRUE);
+     } else {
+         validate_dir(ANGBAND_DIR_DATA, FALSE);
+     }
+     validate_dir(ANGBAND_DIR_FILE, TRUE);
+     validate_dir(ANGBAND_DIR_HELP, FALSE);
+     validate_dir(ANGBAND_DIR_INFO, FALSE);
+     validate_dir(ANGBAND_DIR_PREF, TRUE);
+     validate_dir(ANGBAND_DIR_SAVE, FALSE);
+     validate_dir(ANGBAND_DIR_USER, TRUE);
+     validate_dir(ANGBAND_DIR_XTRA, TRUE);
+     path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
+     validate_file(path);
+     path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "graf");
+     ANGBAND_DIR_XTRA_GRAF = string_make(path);
+     validate_dir(ANGBAND_DIR_XTRA_GRAF, TRUE);
+     path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "sound");
+     ANGBAND_DIR_XTRA_SOUND = string_make(path);
+     validate_dir(ANGBAND_DIR_XTRA_SOUND, FALSE);
+     path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "music");
+     ANGBAND_DIR_XTRA_MUSIC = string_make(path);
+     validate_dir(ANGBAND_DIR_XTRA_MUSIC, FALSE);
+     path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "help");
+     ANGBAND_DIR_XTRA_HELP = string_make(path);
++>>>>>>> f0c4eb8416cf7416d408fb3f0e83c29f2f4e59d1
  }
  
  /*!
   * todo よく見るとhMutexはちゃんと使われていない……?
   * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック
diff --cc src/main.c
   */
  
  
 -#if !defined(WINDOWS)
 +#if !defined(WINDOWS) && !defined(MACH_O_COCOA)
  
  /*
+  * Nuke a term
+  */
+ static errr term_nuke(term_type *t)
+ {
+     TERM_LEN w = t->wid;
+     TERM_LEN h = t->hgt;
+     /* Call the special "nuke" hook */
+     if (t->active_flag) {
+         /* Call the "nuke" hook */
+         if (t->nuke_hook)
+             (*t->nuke_hook)(t);
+         /* Remember */
+         t->active_flag = FALSE;
+         /* Assume not mapped */
+         t->mapped_flag = FALSE;
+     }
+     /* Nuke "displayed" */
+     term_win_nuke(t->old, w, h);
+     /* Kill "displayed" */
+     KILL(t->old, term_win);
+     /* Nuke "requested" */
+     term_win_nuke(t->scr, w, h);
+     /* Kill "requested" */
+     KILL(t->scr, term_win);
+     /* If needed */
+     if (t->mem) {
+         /* Nuke "memorized" */
+         term_win_nuke(t->mem, w, h);
+         /* Kill "memorized" */
+         KILL(t->mem, term_win);
+     }
+     /* If needed */
+     if (t->tmp) {
+         /* Nuke "temporary" */
+         term_win_nuke(t->tmp, w, h);
+         /* Kill "temporary" */
+         KILL(t->tmp, term_win);
+     }
+     /* Free some arrays */
+     C_KILL(t->x1, h, TERM_LEN);
+     C_KILL(t->x2, h, TERM_LEN);
+     /* Free the input queue */
+     C_KILL(t->key_queue, t->key_size, char);
+     return 0;
+ }
+ /*
   * A hook for "quit()".
   *
   * Close down, then fall back into "quit()".
diff --cc src/main/init.c
Simple merge
diff --cc src/main/init.h
@@@ -18,9 -18,8 +18,9 @@@
  
  void init_angband(player_type *player_ptr, void(*process_autopick_file_command)(char*));
  concptr get_check_sum(void);
 -void init_file_paths(char *path);
 +void init_file_paths(concptr libpath, concptr varpath);
 +void create_needed_dirs(void);
- errr init_v_info(void);
+ errr init_v_info(player_type *player_ptr);
  errr init_buildings(void);
  
  #endif /* INCLUDED_INIT_H */
Simple merge