Changeset 250

Show
Ignore:
Timestamp:
07/02/07 14:02:56 (1 year ago)
Author:
ajps
Message:

Alter self_knowledge to study equipment and player flags instead of the current player state. This allows for a 'no-spoil' mode for the knowledge screens. Fixes #169.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cmd4.c

    r249 r250  
    40074007 
    40084008 
     4009void do_cmd_self_knowledge(void *obj, const char *name) 
     4010{ 
     4011        /* display self knowledge we already know about. */ 
     4012        self_knowledge(FALSE); 
     4013} 
     4014 
    40094015/* 
    40104016 * Definition of the "player knowledge" menu. 
     
    40174023        {{0, "Display object knowledge", (action_f)do_cmd_knowledge_objects, 0}, '4'}, 
    40184024        {{0, "Display feature knowledge", (action_f)do_cmd_knowledge_features, 0}, '5'}, 
    4019         {{0, "Display self-knowledge", (action_f)self_knowledge, 0}, '6'}, 
     4025        {{0, "Display self-knowledge", do_cmd_self_knowledge, 0}, '6'}, 
    40204026}; 
    40214027 
  • trunk/src/externs.h

    r232 r250  
    518518extern bool remove_all_curse(void); 
    519519extern bool restore_level(void); 
    520 extern void self_knowledge(void); 
     520extern void self_knowledge(bool spoil); 
    521521extern bool lose_all_info(void); 
    522522extern void set_recall(void); 
  • trunk/src/spells2.c

    r163 r250  
    385385 * 
    386386 * List various information about the player and/or his current equipment. 
     387 * See also "identify_fully()". 
    387388 * 
    388  * See also "identify_fully()". 
     389 * This tests the flags of the equipment being carried and the innate player 
     390 * flags, so any changes made in calc_bonuses need to be shadowed here. 
    389391 * 
    390392 * Use the "roff()" routines, perhaps.  XXX XXX XXX 
     
    394396 * This function cannot display more than 20 lines.  XXX XXX XXX 
    395397 */ 
    396 void self_knowledge(void
     398void self_knowledge(bool spoil
    397399{ 
    398400        int i = 0, j, k; 
     401 
     402        u32b t1, t2, t3; 
    399403 
    400404        u32b f1 = 0L, f2 = 0L, f3 = 0L; 
     
    408412        for (k = INVEN_WIELD; k < INVEN_TOTAL; k++) 
    409413        { 
    410                 u32b t1, t2, t3; 
    411  
    412414                o_ptr = &inventory[k]; 
    413415 
     
    416418 
    417419                /* Extract the flags */ 
    418                 object_flags(o_ptr, &t1, &t2, &t3); 
     420                if (spoil) 
     421                        object_flags(o_ptr, &t1, &t2, &t3); 
     422                else  
     423                        object_flags_known(o_ptr, &t1, &t2, &t3); 
    419424 
    420425                /* Extract flags */ 
     
    424429        } 
    425430 
     431        /* And flags from the player */ 
     432        player_flags(&t1, &t2, &t3); 
     433 
     434        /* Extract flags */ 
     435        f1 |= t1; 
     436        f2 |= t2; 
     437        f3 |= t3; 
     438 
    426439 
    427440        if (p_ptr->timed[TMD_BLIND]) 
     
    454467        } 
    455468 
    456         if (p_ptr->aggravate
     469        if (f3 & TR3_AGGRAVATE
    457470        { 
    458471                info[i++] = "You aggravate monsters."; 
    459472        } 
    460         if (p_ptr->teleport
     473        if (f3 & TR3_TELEPORT
    461474        { 
    462475                info[i++] = "Your position is very uncertain."; 
     
    503516                info[i++] = "You will soon be recalled."; 
    504517        } 
    505         if (p_ptr->see_infra
     518        if (rp_ptr->infra || f1 & TR1_INFRA
    506519        { 
    507520                info[i++] = "Your eyes are sensitive to infrared light."; 
    508521        } 
    509522 
    510         if (p_ptr->slow_digest
     523        if (f3 & TR3_SLOW_DIGEST
    511524        { 
    512525                info[i++] = "Your appetite is small."; 
    513526        } 
    514         if (p_ptr->ffall
     527        if (f3 & TR3_FEATHER
    515528        { 
    516529                info[i++] = "You land gently."; 
    517530        } 
    518         if (p_ptr->regenerate
     531        if (f3 & TR3_REGEN
    519532        { 
    520533                info[i++] = "You regenerate quickly."; 
    521534        } 
    522         if (p_ptr->telepathy
     535        if (f3 & TR3_TELEPATHY
    523536        { 
    524537                info[i++] = "You have ESP."; 
    525538        } 
    526         if (p_ptr->see_inv
     539        if (f3 & TR3_SEE_INVIS
    527540        { 
    528541                info[i++] = "You can see invisible creatures."; 
    529542        } 
    530         if (p_ptr->free_act
     543        if (f3 & TR3_FREE_ACT
    531544        { 
    532545                info[i++] = "You have free action."; 
    533546        } 
    534         if (p_ptr->hold_life
     547        if (f3 & TR3_HOLD_LIFE
    535548        { 
    536549                info[i++] = "You have a firm hold on your life force."; 
    537550        } 
    538551 
    539         if (p_ptr->immune_acid
     552        if (f2 & TR2_IM_ACID
    540553        { 
    541554                info[i++] = "You are completely immune to acid."; 
    542555        } 
    543         else if ((p_ptr->resist_acid) && (p_ptr->timed[TMD_OPP_ACID])) 
     556        else if ((f2 & TR2_RES_ACID) && (p_ptr->timed[TMD_OPP_ACID])) 
    544557        { 
    545558                info[i++] = "You resist acid exceptionally well."; 
    546559        } 
    547         else if ((p_ptr->resist_acid) || (p_ptr->timed[TMD_OPP_ACID])) 
     560        else if ((f2 & TR2_RES_ACID) || (p_ptr->timed[TMD_OPP_ACID])) 
    548561        { 
    549562                info[i++] = "You are resistant to acid."; 
    550563        } 
    551564 
    552         if (p_ptr->immune_elec
     565        if (f2 & TR2_IM_ELEC
    553566        { 
    554567                info[i++] = "You are completely immune to lightning."; 
    555568        } 
    556         else if ((p_ptr->resist_elec) && (p_ptr->timed[TMD_OPP_ELEC])) 
     569        else if ((f2 & TR2_RES_ELEC) && (p_ptr->timed[TMD_OPP_ELEC])) 
    557570        { 
    558571                info[i++] = "You resist lightning exceptionally well."; 
    559572        } 
    560         else if ((p_ptr->resist_elec) || (p_ptr->timed[TMD_OPP_ELEC])) 
     573        else if ((f2 & TR2_RES_ELEC) || (p_ptr->timed[TMD_OPP_ELEC])) 
    561574        { 
    562575                info[i++] = "You are resistant to lightning."; 
    563576        } 
    564577 
    565         if (p_ptr->immune_fire
     578        if (f2 & TR2_IM_FIRE
    566579        { 
    567580                info[i++] = "You are completely immune to fire."; 
    568581        } 
    569         else if ((p_ptr->resist_fire) && (p_ptr->timed[TMD_OPP_FIRE])) 
     582        else if ((f2 & TR2_RES_FIRE) && (p_ptr->timed[TMD_OPP_FIRE])) 
    570583        { 
    571584                info[i++] = "You resist fire exceptionally well."; 
    572585        } 
    573         else if ((p_ptr->resist_fire) || (p_ptr->timed[TMD_OPP_FIRE])) 
     586        else if ((f2 & TR2_RES_FIRE) || (p_ptr->timed[TMD_OPP_FIRE])) 
    574587        { 
    575588                info[i++] = "You are resistant to fire."; 
    576589        } 
    577590 
    578         if (p_ptr->immune_cold
     591        if (f2 & TR2_IM_COLD
    579592        { 
    580593                info[i++] = "You are completely immune to cold."; 
    581594        } 
    582         else if ((p_ptr->resist_cold) && (p_ptr->timed[TMD_OPP_COLD])) 
     595        else if ((f2 & TR2_RES_COLD) && (p_ptr->timed[TMD_OPP_COLD])) 
    583596        { 
    584597                info[i++] = "You resist cold exceptionally well."; 
    585598        } 
    586         else if ((p_ptr->resist_cold) || (p_ptr->timed[TMD_OPP_COLD])) 
     599        else if ((f2 & TR2_RES_COLD) || (p_ptr->timed[TMD_OPP_COLD])) 
    587600        { 
    588601                info[i++] = "You are resistant to cold."; 
    589602        } 
    590603 
    591         if ((p_ptr->resist_pois) && (p_ptr->timed[TMD_OPP_POIS])) 
     604        if ((f2 & TR2_RES_POIS) && (p_ptr->timed[TMD_OPP_POIS])) 
    592605        { 
    593606                info[i++] = "You resist poison exceptionally well."; 
    594607        } 
    595         else if ((p_ptr->resist_pois) || (p_ptr->timed[TMD_OPP_POIS])) 
     608        else if ((f2 & TR2_RES_POIS) || (p_ptr->timed[TMD_OPP_POIS])) 
    596609        { 
    597610                info[i++] = "You are resistant to poison."; 
    598611        } 
    599612 
    600         if (p_ptr->resist_fear
     613        if (f2 & TR2_RES_FEAR
    601614        { 
    602615                info[i++] = "You are completely fearless."; 
    603616        } 
    604617 
    605         if (p_ptr->resist_lite
     618        if (f2 & TR2_RES_LITE
    606619        { 
    607620                info[i++] = "You are resistant to bright light."; 
    608621        } 
    609         if (p_ptr->resist_dark
     622        if (f2 & TR2_RES_DARK
    610623        { 
    611624                info[i++] = "You are resistant to darkness."; 
    612625        } 
    613         if (p_ptr->resist_blind
     626        if (f2 & TR2_RES_DARK
    614627        { 
    615628                info[i++] = "Your eyes are resistant to blindness."; 
    616629        } 
    617         if (p_ptr->resist_confu
     630        if (f2 & TR2_RES_CONFU
    618631        { 
    619632                info[i++] = "You are resistant to confusion."; 
    620633        } 
    621         if (p_ptr->resist_sound
     634        if (f2 & TR2_RES_SOUND
    622635        { 
    623636                info[i++] = "You are resistant to sonic attacks."; 
    624637        } 
    625         if (p_ptr->resist_shard
     638        if (f2 & TR2_RES_SHARD
    626639        { 
    627640                info[i++] = "You are resistant to blasts of shards."; 
    628641        } 
    629         if (p_ptr->resist_nexus
     642        if (f2 & TR2_RES_NEXUS
    630643        { 
    631644                info[i++] = "You are resistant to nexus attacks."; 
    632645        } 
    633         if (p_ptr->resist_nethr
     646        if (f2 & TR2_RES_NETHR
    634647        { 
    635648                info[i++] = "You are resistant to nether forces."; 
    636649        } 
    637         if (p_ptr->resist_chaos
     650        if (f2 & TR2_RES_CHAOS
    638651        { 
    639652                info[i++] = "You are resistant to chaos."; 
    640653        } 
    641         if (p_ptr->resist_disen
     654        if (f2 & TR2_RES_DISEN
    642655        { 
    643656                info[i++] = "You are resistant to disenchantment."; 
    644657        } 
    645658 
    646         if (p_ptr->sustain_str
     659        if (f2 & TR2_SUST_STR
    647660        { 
    648661                info[i++] = "Your strength is sustained."; 
    649662        } 
    650         if (p_ptr->sustain_int
     663        if (f2 & TR2_SUST_INT
    651664        { 
    652665                info[i++] = "Your intelligence is sustained."; 
    653666        } 
    654         if (p_ptr->sustain_wis
     667        if (f2 & TR2_SUST_WIS
    655668        { 
    656669                info[i++] = "Your wisdom is sustained."; 
    657670        } 
    658         if (p_ptr->sustain_dex
     671        if (f2 & TR2_SUST_DEX
    659672        { 
    660673                info[i++] = "Your dexterity is sustained."; 
    661674        } 
    662         if (p_ptr->sustain_con
     675        if (f2 & TR2_SUST_CON
    663676        { 
    664677                info[i++] = "Your constitution is sustained."; 
    665678        } 
    666         if (p_ptr->sustain_chr
     679        if (f2 & TR2_SUST_CHR
    667680        { 
    668681                info[i++] = "Your charisma is sustained."; 
  • trunk/src/use-obj.c

    r233 r250  
    672672                        (void)detect_objects_normal(); 
    673673                        identify_pack(); 
    674                         self_knowledge(); 
     674                        self_knowledge(TRUE); 
    675675                        *ident = TRUE; 
    676676                        break; 
     
    681681                        msg_print("You begin to know yourself a little better..."); 
    682682                        message_flush(); 
    683                         self_knowledge(); 
     683                        self_knowledge(TRUE); 
    684684                        *ident = TRUE; 
    685685                        break; 
  • trunk/src/wizard2.c

    r189 r250  
    16131613                case 'k': 
    16141614                { 
    1615                         self_knowledge(); 
     1615                        self_knowledge(TRUE); 
    16161616                        break; 
    16171617                }