Changeset 636
- Timestamp:
- 12/23/07 18:14:14 (10 months ago)
- Files:
-
- trunk/src/Makefile.src (modified) (1 diff)
- trunk/src/birth.c (modified) (1 diff)
- trunk/src/cmd1.c (modified) (1 diff)
- trunk/src/cmd4.c (modified) (4 diffs)
- trunk/src/death.c (modified) (4 diffs)
- trunk/src/defines.h (modified) (1 diff)
- trunk/src/externs.h (modified) (2 diffs)
- trunk/src/history.c (added)
- trunk/src/load.c (modified) (2 diffs)
- trunk/src/object2.c (modified) (1 diff)
- trunk/src/save.c (modified) (2 diffs)
- trunk/src/spells2.c (modified) (1 diff)
- trunk/src/store.c (modified) (2 diffs)
- trunk/src/types.h (modified) (3 diffs)
- trunk/src/xtra2.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/Makefile.src
r631 r636 69 69 game-event.o \ 70 70 generate.o \ 71 history.o \ 71 72 init1.o \ 72 73 init2.o \ trunk/src/birth.c
r617 r636 1938 1938 } 1939 1939 1940 1941 /* Clear old messages, add new starting message */ 1942 history_clear(); 1943 history_add("Began the quest to destroy Morgoth.", HISTORY_PLAYER_BIRTH, 0); 1944 1940 1945 /* Note player birth in the message recall */ 1941 1946 message_add(" ", MSG_GENERIC); trunk/src/cmd1.c
r633 r636 285 285 } 286 286 287 /* Log if picking up an artifact. */ 288 if (artifact_p(o_ptr)) 289 history_add_artifact(o_ptr->name1, object_known_p(o_ptr)); 290 287 291 /* Delete the object */ 288 292 delete_object_idx(o_idx); trunk/src/cmd4.c
r606 r636 20 20 #include "option.h" 21 21 #include "ui.h" 22 #include "externs.h" 22 23 #include "ui-menu.h" 23 24 … … 4063 4064 } 4064 4065 4066 static void do_cmd_knowledge_history(void *obj, const char *name) 4067 { 4068 history_display(); 4069 } 4070 4071 4065 4072 /* 4066 4073 * Definition of the "player knowledge" menu. … … 4075 4082 {{0, "Display self-knowledge", do_cmd_self_knowledge, 0}, 'f'}, 4076 4083 {{0, "Display hall of fame", do_cmd_knowledge_scores, 0}, 'g'}, 4084 {{0, "Display character history", do_cmd_knowledge_history, 0}, 'h'}, 4077 4085 }; 4078 4086 … … 4254 4262 /* Add the note to the message recall */ 4255 4263 msg_format("Note: %s", tmp); 4264 4265 /* Add a history entry */ 4266 history_add(tmp, HISTORY_USER_INPUT, 0); 4256 4267 } 4257 4268 trunk/src/death.c
r632 r636 374 374 375 375 /* 376 * Menu command: view character history. 377 */ 378 static void death_history(void *unused, const char *title) 379 { 380 (void)unused; 381 (void)title; 382 383 history_display(); 384 } 385 386 387 /* 376 388 * Menu structures for the death menu. 377 389 */ … … 384 396 { 'v', "View scores", death_scores, NULL }, 385 397 { 'x', "Examine items", death_examine, NULL }, 398 { 'h', "History", death_history, NULL }, 386 399 { 'q', "Quit", death_examine, NULL }, 387 400 }; … … 422 435 menu_type *menu; 423 436 const char cmd_keys[] = { ARROW_LEFT, ARROW_RIGHT, '\0' }; 424 const region area = { 51, 2, 0, 6};437 const region area = { 51, 2, 0, 7 }; 425 438 426 439 int cursor = 0; … … 473 486 c = menu_select(&death_menu, &cursor, 0); 474 487 475 if (c.key == ESCAPE || cursor == 5)488 if (c.key == ESCAPE || cursor == 6) 476 489 { 477 490 if (get_check("Do you want to quit? ")) trunk/src/defines.h
r550 r636 212 212 */ 213 213 #define AUTOINSCRIPTIONS_MAX 216 214 215 /* History message types */ 216 #define HISTORY_PLAYER_BIRTH 0x0001 /* Player was born */ 217 #define HISTORY_ARTIFACT_UNKNOWN 0x0002 /* Player found but not IDd an artifact */ 218 #define HISTORY_ARTIFACT_KNOWN 0x0004 /* Player has IDed an artifact */ 219 #define HISTORY_ARTIFACT_LOST 0x0008 /* Player had an artifact and lost it */ 220 #define HISTORY_PLAYER_DEATH 0x0010 /* Player has been slain */ 221 #define HISTORY_SLAY_UNIQUE 0x0020 /* Player has slain a unique monster */ 222 #define HISTORY_USER_INPUT 0x0040 /* User-added note */ 223 #define HISTORY_SAVEFILE_IMPORT 0x0080 /* Added when an older version savefile is imported */ 224 #define HISTORY_GAIN_LEVEL 0x0100 /* Player gained a level */ 225 #define HISTORY_GENERIC 0x0200 /* Anything else not covered here (unused) */ 214 226 215 227 trunk/src/externs.h
r631 r636 246 246 extern u16b inscriptions_count; 247 247 248 /* history.c */ 249 extern history_info *history_list; 250 248 251 /* squelch.c */ 249 252 extern byte squelch_level[SQUELCH_BYTES]; … … 341 344 /* generate.c */ 342 345 extern void generate_cave(void); 346 347 /* history.c */ 348 void history_clear(void); 349 size_t history_get_num(void); 350 bool history_add_full(u16b type, byte a_idx, s16b dlev, s16b clev, s32b turn, const char *text); 351 bool history_add(const char *event, u16b type, byte a_idx); 352 bool history_add_artifact(byte a_idx, bool known); 353 void history_unmask_unknown(void); 354 bool history_lose_artifact(byte a_idx); 355 void history_display(void); 343 356 344 357 /* init2.c */ trunk/src/load.c
r581 r636 2050 2050 u32b o_x_check, o_v_check; 2051 2051 2052 char buf[80]; 2052 2053 2053 2054 /* Mention the savefile version */ … … 2258 2259 } 2259 2260 2261 /* Read in the history list if the savefile is new enough */ 2262 if (!older_than(3, 0, 11)) 2263 { 2264 size_t i; 2265 2266 history_clear(); 2267 2268 rd_u32b(&tmp32u); 2269 for (i = 0; i < tmp32u; i++) 2270 { 2271 s32b turn; 2272 s16b dlev, clev; 2273 u16b type; 2274 byte art_name; 2275 char text[80]; 2276 2277 rd_u16b(&type); 2278 rd_s32b(&turn); 2279 rd_s16b(&dlev); 2280 rd_s16b(&clev); 2281 rd_byte(&art_name); 2282 rd_string(text, sizeof(text)); 2283 2284 history_add_full(type, art_name, dlev, clev, turn, text); 2285 } 2286 } 2287 2288 /* 2289 * Savefile is from an older version: 2290 * Still have to initialize the variables correctly. 2291 * Then the game should correctly log future history entries. 2292 */ 2293 else 2294 { 2295 history_clear(); 2296 strnfmt(buf, sizeof(buf), "Imported an Angband %d.%d.%d savefile", 2297 sf_major, sf_minor, sf_patch); 2298 history_add(buf, HISTORY_SAVEFILE_IMPORT, 0); 2299 } 2260 2300 2261 2301 /* Save the checksum */ trunk/src/object2.c
r617 r636 464 464 a_info[o_ptr->name1].cur_num = 0; 465 465 } 466 467 /* Mark artifacts as lost in logs */ 468 if (artifact_p(o_ptr)) 469 history_lose_artifact(o_ptr->name1); 466 470 467 471 /* Monster */ trunk/src/save.c
r531 r636 814 814 815 815 u16b tmp16u; 816 816 u32b tmp32u; 817 817 818 818 /* Guess at the current time */ … … 996 996 } 997 997 998 /* NEW (jdw): dumping history entries */ 999 /* Dump the number of history entries */ 1000 tmp32u = history_get_num(); 1001 wr_u32b(tmp32u); 1002 1003 /* Dump the history entries one-by-one */ 1004 for (i = 0; i < tmp32u; i++) 1005 { 1006 wr_u16b(history_list[i].type); 1007 wr_s32b(history_list[i].turn); 1008 wr_s16b(history_list[i].dlev); 1009 wr_s16b(history_list[i].clev); 1010 wr_byte(history_list[i].a_idx); 1011 wr_string(history_list[i].event); 1012 } 1013 998 1014 999 1015 /* Write the "value check-sum" */ trunk/src/spells2.c
r633 r636 3690 3690 } 3691 3691 3692 /* Log artifacts to the history list. */ 3693 if (artifact_p(o_ptr)) 3694 history_add_artifact(o_ptr->name1, TRUE); 3695 3692 3696 /* Describe */ 3693 3697 if (item >= INVEN_WIELD) trunk/src/store.c
r633 r636 1078 1078 } 1079 1079 1080 /* Is the item an artifact? Mark it as lost if the player has it in history list */ 1081 if (artifact_p(o_ptr)) 1082 history_lose_artifact(o_ptr->name1); 1083 1080 1084 /* Delete the item */ 1081 1085 store_item_increase(st, what, -num); … … 2225 2229 object_known(o_ptr); 2226 2230 2231 /* Update the auto-history if selling an artifact that was previously un-IDed. (Ouch!) */ 2232 if (artifact_p(o_ptr)) 2233 history_add_artifact(o_ptr->name1, TRUE); 2234 2227 2235 /* Combine / Reorder the pack (later) */ 2228 2236 p_ptr->notice |= (PN_COMBINE | PN_REORDER); trunk/src/types.h
r589 r636 91 91 typedef struct start_item start_item; 92 92 typedef struct autoinscription autoinscription; 93 typedef struct history_info history_info; 93 94 94 95 … … 1035 1036 s16b pspeed; /* Current speed */ 1036 1037 1037 /* Generation fields (for quick start) */1038 /* Generation fields (for quick start) */ 1038 1039 s32b au_birth; /* Birth gold */ 1039 1040 s16b stat_birth[A_MAX]; /* Birth "natural" stat values */ … … 1115 1116 }; 1116 1117 1118 1119 struct history_info 1120 { 1121 u16b type; /* Kind of history item */ 1122 s16b dlev; /* Dungeon level when this item was recorded */ 1123 s16b clev; /* Character level when this item was recorded */ 1124 byte a_idx; /* Artifact this item relates to */ 1125 s32b turn; /* Turn this item was recorded on */ 1126 char event[80]; /* The text of the item */ 1127 }; 1117 1128 1118 1129 enum grid_light_level trunk/src/xtra2.c
r622 r636 992 992 p_ptr->expfact / 100L))) 993 993 { 994 char buf[80]; 995 994 996 /* Gain a level */ 995 997 p_ptr->lev++; 996 998 997 999 /* Save the highest level */ 998 if (p_ptr->lev > p_ptr->max_lev) p_ptr->max_lev = p_ptr->lev; 999 1000 if (p_ptr->lev > p_ptr->max_lev) 1001 { 1002 p_ptr->max_lev = p_ptr->lev; 1003 1004 /* Log level updates (TODO: perhaps only every other level or every 5) */ 1005 strnfmt(buf, sizeof(buf), "Reached level %d", p_ptr->lev); 1006 history_add(buf, HISTORY_GAIN_LEVEL, 0); 1007 1008 } 1009 1000 1010 /* Message */ 1001 1011 message_format(MSG_LEVEL, p_ptr->lev, "Welcome to level %d.", p_ptr->lev); … … 1409 1419 { 1410 1420 char m_name[80]; 1421 char buf[80]; 1411 1422 1412 1423 /* Assume normal death sound */ … … 1474 1485 } 1475 1486 1487 /* When the player kills a Unique, it stays dead */ 1488 if (r_ptr->flags1 & (RF1_UNIQUE)) 1489 { 1490 char unique_name[80]; 1491 r_ptr->max_num = 0; 1492 1493 /* This gets the correct name if we slay an invisible unique and don't have See Invisible. */ 1494 monster_desc(unique_name, sizeof(unique_name), m_ptr, 0x88); 1495 1496 /* Log the slaying of a unique */ 1497 strnfmt(buf, sizeof(buf), "Killed %s", unique_name); 1498 history_add(buf, HISTORY_SLAY_UNIQUE, 0); 1499 } 1500 1476 1501 /* Gain experience */ 1477 1502 gain_exp(new_exp);
