OSDN Git Service

鏡の仕様変更. 前の地形をちゃんと保存し, 壊れたら強制的に床になるのではなく
authorhenkma <henkma@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 20 Jun 2002 17:40:50 +0000 (17:40 +0000)
committerhenkma <henkma@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 20 Jun 2002 17:40:50 +0000 (17:40 +0000)
前の地形になるようにした. 同じ方法で紋章についてもできるはずだけどそれにつ
いては今回は保留. 変更前のもので鏡のプレイをしていると問題あるが, セーブフ
ァイルコンバートのコードは次のバージョンナンバーアップの時にする予定.
ジョンup時

src/cave.c
src/defines.h
src/externs.h
src/melee1.c
src/mind.c
src/object2.c
src/racial.c
src/spells1.c
src/spells3.c
src/xtra2.c

index 1408fea..c590800 100644 (file)
@@ -878,6 +878,7 @@ void map_info(int y, int x, byte *ap, char *cp)
 
        /* Feature code */
        feat = c_ptr->mimic ? c_ptr->mimic : c_ptr->feat;
+       feat = (c_ptr->info & CAVE_IN_MIRROR) ? FEAT_MIRROR : c_ptr->feat;
 
        /* Floors (etc) */
        if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
@@ -4831,7 +4832,18 @@ void cave_set_feat(int y, int x, int feat)
        lite_spot(y, x);
 }
 
+/* Remove a mirror */
+void remove_mirror(int y, int x)
+{
+       /* Remove the mirror */
+       cave[y][x].info &= ~(CAVE_IN_MIRROR);
+
+       /* Notice */
+       note_spot(y, x);
 
+       /* Redraw */
+       lite_spot(y, x);
+}
 
 /*
  * Calculate "incremental motion". Used by project() and shoot().
index 80949ef..c5437aa 100644 (file)
 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT)
 
 /* Used only after cave generation */
+#define CAVE_XXXX1      0x0200
+#define CAVE_XXXX2      0x0400
+#define CAVE_XXXX3      0x0800
+#define CAVE_IN_MIRROR  0x1000    /* mirror */
 #define CAVE_UNSAFE     0x2000    /* Might have trap */
 #define CAVE_IN_DETECT  0x4000    /* trap detected area (inner circle only) */
 
          (cave[Y][X].feat == FEAT_GRASS) || \
          (cave[Y][X].feat == FEAT_DIRT)) && \
          !(cave[Y][X].info & CAVE_TRAP) && \
+         !(cave[Y][X].info & CAVE_IN_MIRROR) && \
          (cave[Y][X].o_idx == 0))
 
 
index ff3992c..9d0f9a3 100644 (file)
@@ -571,6 +571,7 @@ extern void map_area(int range);
 extern void wiz_lite(bool wizard, bool ninja);
 extern void wiz_dark(void);
 extern void cave_set_feat(int y, int x, int feat);
+extern void remove_mirror(int y, int x);
 extern void mmove2(int *y, int *x, int y1, int x1, int y2, int x2);
 extern bool projectable(int y1, int x1, int y2, int x2);
 extern void scatter(int *yp, int *xp, int y, int x, int d, int mode);
index 5700b81..4ae5203 100644 (file)
@@ -2148,7 +2148,7 @@ msg_format("%s
                                                        alive = FALSE;
                                                }
                                        }
-                                       if( cave[py][px].feat == FEAT_MIRROR ){
+                                       if( (cave[py][px].info & CAVE_IN_MIRROR)){
                                                teleport_player(10);
                                        }
                                }
index a29bec0..be4ed09 100644 (file)
@@ -1264,7 +1264,7 @@ static int number_of_mirrors( void )
   int val=0;
   for( x=0 ; x < cur_wid ; x++ ){
     for( y=0 ; y < cur_hgt ; y++ ){
-      if( cave[y][x].feat == FEAT_MIRROR )val++;
+      if( (cave[y][x].info & CAVE_IN_MIRROR) )val++;
     }
   }
   return val;
@@ -1282,7 +1282,7 @@ static bool cast_mirror_spell(int spell)
        {
        /* mirror of seeing */
        case 0:
-         tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 0;
+         tmp = (cave[py][px].info & CAVE_IN_MIRROR) ? 4 : 0;
          if( plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
          if( plev + tmp > 18 )detect_monsters_invis(DETECT_RAD_DEFAULT);
          if( plev + tmp > 28 )set_tim_esp(plev,FALSE);
@@ -1310,7 +1310,7 @@ msg_format("There are too many mirrors to control!");
          break;
        case 2:
          if (!get_aim_dir(&dir)) return FALSE;
-         if ( plev > 9 && cave[py][px].feat == FEAT_MIRROR ){
+         if ( plev > 9 && (cave[py][px].info & CAVE_IN_MIRROR) ){
            fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
          }
          else {
@@ -1348,7 +1348,7 @@ msg_format("There are too many mirrors to control!");
        case 9:
          for(x=0;x<cur_wid;x++){
            for(y=0;y<cur_hgt;y++){
-             if(cave[y][x].feat == FEAT_MIRROR){
+             if(cave[y][x].info & CAVE_IN_MIRROR){
                project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
              }
            }
@@ -1377,7 +1377,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* illusion light */
        case 14:
-         tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 3;
+         tmp = (cave[py][px].feat & CAVE_IN_MIRROR) ? 4 : 3;
          slow_monsters();
          stun_monsters(plev*tmp);
          confuse_monsters(plev*tmp);
@@ -1387,7 +1387,7 @@ msg_format("There are too many mirrors to control!");
          break;
        /* mirror shift */
        case 15:
-         if(  cave[py][px].feat != FEAT_MIRROR ){
+         if( !(cave[py][px].info & CAVE_IN_MIRROR) ){
 #ifdef JP
                msg_print("¶À¤Î¹ñ¤Î¾ì½ê¤¬¤ï¤«¤é¤Ê¤¤¡ª");
 #else
@@ -2142,7 +2142,7 @@ msg_format("%s
                        break;
                case MIND_MIRROR_MASTER:
                        /* Cast the spell */
-                       if( cave[py][px].feat == FEAT_MIRROR )on_mirror = TRUE;
+                       if( (cave[py][px].info & CAVE_IN_MIRROR) )on_mirror = TRUE;
                        cast = cast_mirror_spell(n);
                        break;
                case MIND_NINJUTSU:
index fee5f94..afcb410 100644 (file)
@@ -4848,8 +4848,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
                            (c_ptr->feat != FEAT_DEEP_GRASS) &&
                            (c_ptr->feat != FEAT_SHAL_LAVA) &&
                                (c_ptr->feat != FEAT_TREES)) continue;
-
-                       if (c_ptr->info & CAVE_TRAP) continue;
+                       if (c_ptr->info & (CAVE_TRAP | CAVE_IN_MIRROR)) continue;
 
                        /* No objects */
                        k = 0;
index 9f34f0b..549cdcd 100644 (file)
@@ -1379,8 +1379,8 @@ msg_print("
                            int x,y;
                              for( x=0 ; x < cur_wid ;x++){
                                for( y=0 ; y < cur_hgt ;y++){
-                                 if( cave[y][x].feat == FEAT_MIRROR){
-                                   cave_set_feat( y , x , FEAT_FLOOR );
+                                 if( (cave[y][x].info & CAVE_IN_MIRROR)){
+                                   remove_mirror(y,x);
                                    project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
                                  }
                                }
@@ -1399,7 +1399,7 @@ msg_print("
                                  return FALSE;
                          }
                          if (racial_aux(30, 0, A_INT, 20)){
-                               if( cave[py][px].feat == FEAT_MIRROR)
+                               if( (cave[py][px].info & CAVE_IN_MIRROR))
                                {
 #ifdef JP
 msg_print("¾¯¤·Æ¬¤¬¥Ï¥Ã¥­¥ê¤·¤¿¡£");
index 40cc487..301acb2 100644 (file)
@@ -49,7 +49,7 @@ static void next_mirror( int* next_y , int* next_x )
        {
                for( y=0 ; y < cur_hgt ; y++ )
                {
-                       if( cave[y][x].feat == FEAT_MIRROR ){
+                       if( (cave[y][x].info & CAVE_IN_MIRROR)){
                                mirror_y[mirror_num]=y;
                                mirror_x[mirror_num]=x;
                                mirror_num++;
@@ -1208,21 +1208,21 @@ msg_print("
                case GF_SHARDS:
                case GF_ROCKET:
                {
-                       if(     cave[y][x].feat == FEAT_MIRROR )
+                       if( (cave[y][x].info & CAVE_IN_MIRROR))
                        {
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
 #else
                                msg_print("The mirror was chashed!");
 #endif                         
-                               cave_set_feat(y,x, FEAT_FLOOR);
+                               remove_mirror(y,x);
                            project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
                        }
                        break;
                }
                case GF_SOUND:
                {
-                       if(     cave[y][x].feat == FEAT_MIRROR && p_ptr->lev < 40 )
+                       if( (cave[y][x].info & CAVE_IN_MIRROR) && p_ptr->lev < 40 )
                        {
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
@@ -8245,13 +8245,13 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                }
                        }
                        if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
-                       if( cave[y][x].feat == FEAT_MIRROR )
+                       if( (cave[y][x].info & CAVE_IN_MIRROR))
                        {
                          /* The target of monsterspell becomes tha mirror(broken) */
                                monster_target_y=(s16b)y;
                                monster_target_x=(s16b)x;
 
-                               cave_set_feat( y, x , FEAT_FLOOR );
+                               remove_mirror(y,x);
                                next_mirror( &oy,&ox );
 
                                path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
@@ -8385,13 +8385,13 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                if( second_step )continue;
                                break;
                        }
-                       if( cave[y][x].feat == FEAT_MIRROR && !second_step )
+                       if( (cave[y][x].info & CAVE_IN_MIRROR) && !second_step )
                        {
                          /* The target of monsterspell becomes tha mirror(broken) */
                                monster_target_y=(s16b)y;
                                monster_target_x=(s16b)x;
 
-                               cave_set_feat( y, x , FEAT_FLOOR );
+                               remove_mirror(y,x);
                                for( j = 0; j <=i ; j++ )
                                {
                                        y = GRID_Y(path_g[j]);
@@ -8999,7 +8999,7 @@ bool binding_field( int dam )
        {
                for( y=0 ; y < cur_hgt ; y++ )
                {
-                       if( cave[y][x].feat == FEAT_MIRROR &&
+                       if( (cave[y][x].info & CAVE_IN_MIRROR) &&
                            distance(py,px,y,x) <= MAX_RANGE &&
                            distance(py,px,y,x) != 0 &&
                            player_has_los_bold(y,x)
@@ -9118,7 +9118,7 @@ bool binding_field( int dam )
 #else
                msg_print("The field broke a mirror");
 #endif 
-               cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
+               remove_mirror(point_y[0],point_x[0]);
        }
 
        return TRUE;
@@ -9132,14 +9132,14 @@ void seal_of_mirror( int dam )
        {
                for( y = 0 ; y < cur_hgt ; y++ )
                {
-                       if( cave[y][x].feat == FEAT_MIRROR )
+                       if( (cave[y][x].info & CAVE_IN_MIRROR))
                        {
                                if(project_m(0,0,y,x,dam,GF_GENOCIDE,
                                                         (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
                                {
                                        if( !cave[y][x].m_idx )
                                        {
-                                               cave_set_feat( y,x, FEAT_FLOOR );
+                                               remove_mirror(y,x);
                                        }
                                }
                        }
index e1fce55..5d982d4 100644 (file)
@@ -1684,8 +1684,8 @@ msg_print("
                return FALSE;
        }
 
-       /* Create a glyph */
-       cave_set_feat(py, px, FEAT_MIRROR);
+       /* Create a mirror */
+       cave[py][px].info |= CAVE_IN_MIRROR;
        note_spot(py, px);
        lite_spot(py, px);
 
index b055071..cf3ad24 100644 (file)
@@ -2818,7 +2818,7 @@ static bool target_set_accept(int y, int x)
                /* Notice glyphs */
                if (c_ptr->feat == FEAT_GLYPH) return (TRUE);
                if (c_ptr->feat == FEAT_MINOR_GLYPH) return (TRUE);
-               if (c_ptr->feat == FEAT_MIRROR) return (TRUE);
+               if ((c_ptr->info & CAVE_IN_MIRROR)) return (TRUE);
 
                /* Notice the Pattern */
                if ((c_ptr->feat <= FEAT_PATTERN_XTRA2) &&
@@ -3553,6 +3553,14 @@ if (o_ptr->number != 1) s1 = "
                                name = "road";
 #endif
                        }
+                       else if ( (c_ptr->info & CAVE_IN_MIRROR) )
+                       {
+#ifdef JP
+                               name = "¶À";
+#else
+                               name = "mirror";
+#endif
+                       }
                        else
                        {
                                name = f_name + f_info[feat].name;