"¥á¥â¥êÉÔÂ",
"ºÂɸÈϰϳ°",
"°ú¿ôÉÔÂ",
+ "̤ÄêµÁÃÏ·Á¥¿¥°",
#else
"parse error",
"obsolete file",
"out of memory",
"coordinates out of bounds",
"too few arguments",
+ "undefined terrain tag",
#endif
};
fd_read(fd, head->text_ptr, head->text_size);
}
+
+ if (head->tag_size)
+ {
+ /* Allocate the "*_tag" array */
+ C_MAKE(head->tag_ptr, head->tag_size, char);
+
+ /* Read the "*_tag" array */
+ fd_read(fd, head->tag_ptr, head->tag_size);
+ }
+
+
/* Success */
return (0);
}
* even if the string happens to be empty (everyone has a unique '\0').
*/
static errr init_info(cptr filename, header *head,
- void **info, char **name, char **text)
+ void **info, char **name, char **text, char **tag)
{
int fd;
/* Hack -- make "fake" arrays */
if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
+ if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
if (info) (*info) = head->info_ptr;
if (name) (*name) = head->name_ptr;
if (text) (*text) = head->text_ptr;
+ if (tag) (*tag) = head->tag_ptr;
/*** Load the ascii template file ***/
#ifdef JP
/* Error string */
- oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
+ oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
/* Oops */
msg_format("'%s.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line);
}
+ /*** Make final retouch on fake tags ***/
+
+ if (head->retouch)
+ {
+ (*head->retouch)(head);
+ }
+
+
/*** Dump the binary image file ***/
/* File type is "DATA" */
/* Dump the "*_text" array */
fd_write(fd, head->text_ptr, head->text_size);
+ /* Dump the "*_tag" array */
+ fd_write(fd, head->tag_ptr, head->tag_size);
+
/* Close */
(void)fd_close(fd);
}
/* Hack -- Free the "fake" arrays */
if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
+ if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
#endif /* ALLOW_TEMPLATES */
if (info) (*info) = head->info_ptr;
if (name) (*name) = head->name_ptr;
if (text) (*text) = head->text_ptr;
+ if (tag) (*tag) = head->tag_ptr;
/* Success */
return (0);
/* Save a pointer to the parsing function */
f_head.parse_info_txt = parse_f_info;
+ /* Save a pointer to the retouch fake tags */
+ f_head.retouch = retouch_f_info;
+
#endif /* ALLOW_TEMPLATES */
return init_info("f_info", &f_head,
- (void*)&f_info, (void*)&f_name, NULL);
+ (void*)&f_info, &f_name, NULL, &f_tag);
}
#endif /* ALLOW_TEMPLATES */
return init_info("k_info", &k_head,
- (void*)&k_info, (void*)&k_name, (void*)&k_text);
+ (void*)&k_info, &k_name, &k_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("a_info", &a_head,
- (void*)&a_info, (void*)&a_name, (void*)&a_text);
+ (void*)&a_info, &a_name, &a_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("e_info", &e_head,
- (void*)&e_info, (void*)&e_name, (void*)&e_text);
+ (void*)&e_info, &e_name, &e_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("r_info", &r_head,
- (void*)&r_info, (void*)&r_name, (void*)&r_text);
+ (void*)&r_info, &r_name, &r_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("d_info", &d_head,
- (void*)&d_info, (void*)&d_name, (void*)&d_text);
+ (void*)&d_info, &d_name, &d_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("v_info", &v_head,
- (void*)&v_info, (void*)&v_name, (void*)&v_text);
+ (void*)&v_info, &v_name, &v_text, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("s_info", &s_head,
- (void*)&s_info, NULL, NULL);
+ (void*)&s_info, NULL, NULL, NULL);
}
#endif /* ALLOW_TEMPLATES */
return init_info("m_info", &m_head,
- (void*)&m_info, NULL, NULL);
+ (void*)&m_info, NULL, NULL, NULL);
}
/* Magic-User store */
{ TV_RING, SV_RING_PROTECTION },
- { TV_RING, SV_RING_FEATHER_FALL },
+ { TV_RING, SV_RING_LEVITATION_FALL },
{ TV_RING, SV_RING_PROTECTION },
{ TV_RING, SV_RING_RESIST_FIRE },
{ TV_ARCANE_BOOK, 2 },
{ TV_ARCANE_BOOK, 3 },
- { TV_ENCHANT_BOOK, 0 },
- { TV_ENCHANT_BOOK, 0 },
- { TV_ENCHANT_BOOK, 1 },
- { TV_ENCHANT_BOOK, 1 },
+ { TV_CRAFT_BOOK, 0 },
+ { TV_CRAFT_BOOK, 0 },
+ { TV_CRAFT_BOOK, 1 },
+ { TV_CRAFT_BOOK, 1 },
{ TV_DAEMON_BOOK, 0 },
{ TV_DAEMON_BOOK, 0 },
/* Allocate and Wipe the monster list */
C_MAKE(m_list, max_m_idx, monster_type);
+ /* Allocate and Wipe the monster process list */
+ for (i = 0; i < MAX_MTIMED; i++)
+ {
+ C_MAKE(mproc_list[i], max_m_idx, s16b);
+ }
+
/* Allocate and Wipe the max dungeon level */
C_MAKE(max_dlv, max_d_idx, s16b);
C_MAKE(macro__buf, 1024, char);
/* Quark variables */
- C_MAKE(quark__str, QUARK_MAX, cptr);
+ quark_init();
/* Message variables */
C_MAKE(message__ptr, MESSAGE_MAX, u16b);
C_MAKE(inventory, INVEN_TOTAL, object_type);
- /*** Pre-allocate the basic "auto-inscriptions" ***/
-
- /* The "basic" feelings */
-#ifdef JP
- (void)quark_add("¼ö¤ï¤ì¤Æ¤¤¤ë");
- (void)quark_add("²õ¤ì¤Æ¤¤¤ë");
- (void)quark_add("ÊÂ");
- (void)quark_add("¾å¼Á");
-#else
- (void)quark_add("cursed");
- (void)quark_add("broken");
- (void)quark_add("average");
- (void)quark_add("good");
-#endif
-
-
- /* The "extra" feelings */
-#ifdef JP
- (void)quark_add("¹âµéÉÊ");
- (void)quark_add("̵²ÁÃÍ");
- (void)quark_add("ÆÃÊÌÀ½");
- (void)quark_add("¶²¤í¤·¤¤");
-#else
- (void)quark_add("excellent");
- (void)quark_add("worthless");
- (void)quark_add("special");
- (void)quark_add("terrible");
-#endif
-
-
- /* Some extra strings */
-#ifdef JP
- (void)quark_add("¼ö¤¤¤Ê¤·");
- (void)quark_add("Çä½ÐÃæ");
-#else
- (void)quark_add("uncursed");
- (void)quark_add("on sale");
-#endif
-
-
-
/*** Prepare the options ***/
/* Scan the options */
}
+/*
+ * Initialize some other arrays
+ */
+static errr init_object_alloc(void)
+{
+ int i, j;
+ object_kind *k_ptr;
+ alloc_entry *table;
+ s16b num[MAX_DEPTH];
+ s16b aux[MAX_DEPTH];
+
+
+ /*** Analyze object allocation info ***/
+
+ /* Clear the "aux" array */
+ (void)C_WIPE(&aux, MAX_DEPTH, s16b);
+
+ /* Clear the "num" array */
+ (void)C_WIPE(&num, MAX_DEPTH, s16b);
+
+ /* Free the old "alloc_kind_table" (if it exists) */
+ if (alloc_kind_table)
+ {
+ C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
+ }
+
+ /* Size of "alloc_kind_table" */
+ alloc_kind_size = 0;
+
+ /* Scan the objects */
+ for (i = 1; i < max_k_idx; i++)
+ {
+ k_ptr = &k_info[i];
+
+ /* Scan allocation pairs */
+ for (j = 0; j < 4; j++)
+ {
+ /* Count the "legal" entries */
+ if (k_ptr->chance[j])
+ {
+ /* Count the entries */
+ alloc_kind_size++;
+
+ /* Group by level */
+ num[k_ptr->locale[j]]++;
+ }
+ }
+ }
+
+ /* Collect the level indexes */
+ for (i = 1; i < MAX_DEPTH; i++)
+ {
+ /* Group by level */
+ num[i] += num[i-1];
+ }
+
+ /* Paranoia */
+#ifdef JP
+if (!num[0]) quit("Ä®¤Î¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡ª");
+#else
+ if (!num[0]) quit("No town objects!");
+#endif
+
+
+
+ /*** Initialize object allocation info ***/
+
+ /* Allocate the alloc_kind_table */
+ C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
+
+ /* Access the table entry */
+ table = alloc_kind_table;
+
+ /* Scan the objects */
+ for (i = 1; i < max_k_idx; i++)
+ {
+ k_ptr = &k_info[i];
+
+ /* Scan allocation pairs */
+ for (j = 0; j < 4; j++)
+ {
+ /* Count the "legal" entries */
+ if (k_ptr->chance[j])
+ {
+ int p, x, y, z;
+
+ /* Extract the base level */
+ x = k_ptr->locale[j];
+
+ /* Extract the base probability */
+ p = (100 / k_ptr->chance[j]);
+
+ /* Skip entries preceding our locale */
+ y = (x > 0) ? num[x-1] : 0;
+
+ /* Skip previous entries at this locale */
+ z = y + aux[x];
+
+ /* Load the entry */
+ table[z].index = i;
+ table[z].level = x;
+ table[z].prob1 = p;
+ table[z].prob2 = p;
+ table[z].prob3 = p;
+
+ /* Another entry complete for this locale */
+ aux[x]++;
+ }
+ }
+ }
+
+ /* Success */
+ return (0);
+}
+
/*
* Initialize some other arrays
#endif
+ /* Initialize vault info */
+#ifdef JP
+ if (init_v_info()) quit("vault ½é´ü²½ÉÔǽ");
+#else
+ if (init_v_info()) quit("Cannot initialize vaults");
+#endif
+
+
/* Initialize some other arrays */
#ifdef JP
note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]");