Changeset 6347 for lang/d

Show
Ignore:
Timestamp:
02/07/08 20:12:30 (10 months ago)
Author:
itkz
Message:

update to 7

Location:
lang/d/koke/trunk
Files:
8 modified
1 copied

Legend:

Unmodified
Added
Removed
  • lang/d/koke/trunk/boot.d

    r6336 r6347  
    2626 
    2727// 画面サイズ 
    28 const int g_width = 640; 
    29 const int g_height = 480; 
     28static int g_width; 
     29static int g_height; 
    3030const char[] g_title = "hoge";          // タイトルバー 
    3131 
     
    4141{ 
    4242        // オプション解釈 
    43         bool is_fullscreen = false; 
    44         foreach(int t,char[] buf;args) 
     43        bool is_fullscreen = false;     // デフォルトはウインドウ 
     44        g_width = 640; 
     45        g_height = 480; 
     46        foreach(int t,string buf;args) 
    4547        { 
    46                 if(std.string.ifind(buf,"-w") > -1 || std.string.ifind(buf,"-window") > -1) is_fullscreen = false; 
    47                 if(std.string.ifind(buf,"-f") > -1 || std.string.ifind(buf,"-fullscreen") > -1) is_fullscreen = true; 
     48                if(buf == "-window") is_fullscreen = false; 
     49                if(buf == "-fullscreen") is_fullscreen = true; 
     50                if(buf == "-res"){ 
     51                        g_width = cast(int)std.string.atoi(args[t + 1]); 
     52                        g_height = cast(int)std.string.atoi(args[t + 2]); 
     53                        t+=2; 
     54                } 
    4855        } 
    4956         
  • lang/d/koke/trunk/character.d

    r6336 r6347  
    7777        static const int motion_interval[] = [ 0 , 999 , 20 , 2 , 24 , 40 , 20 , 40]; 
    7878         
    79         static const int NICOCHU_TRANSFORM_INTERVAL = 40 * 60; 
    80          
    8179        DIRECTION direction;    // 方向 
    8280        MOTION motion;                  // モーション 
     
    127125                int x = cast(int)position.x , y = cast(int)position.y; 
    128126                 
     127                // 画面外 
    129128                if(x < 0 || y < 0 || x >= map.width || y >= map.height){ 
    130129                        exist = false; 
     
    148147                 
    149148                // 死亡モーション遷移 
    150                 //if(life < 1 && motion != MOTION.DYING && motion != MOTION.VANISH){ 
    151                 if(life < 1  && motion != MOTION.VANISH && motion != MOTION.DYING && type_life_max[type] > 0){ 
     149                if(life < 0  && motion != MOTION.VANISH && motion != MOTION.DYING && type_life_max[type] > 0){ 
    152150                        setMotion(MOTION.DYING); 
     151                        life = 0; 
    153152                } 
    154153                if(motion == MOTION.DYING) return; 
     
    156155                // キャラクタ固有行動 
    157156                switch(type){ 
     157                 
     158                        // ニコ厨 
    158159                        case TYPE.NICOCHU: 
    159160                                if(motion == MOTION.NORMAL && Hell_randInt(0,10) < 5){ 
     
    165166                                if(motion == MOTION.EATING) map.setGrass(x,y,0); 
    166167                                if(motion == MOTION.NORMAL){ 
    167                                         int t = Hell_randInt(0,10); 
    168                                         //if(t < 3) direction = cast(DIRECTION) Hell_randInt(0,DIRECTION.MAX); 
    169                                          
    170                                         if(t < 1){ 
    171                                                 selectNewDirection(); 
    172                                         }else if(t < 5){ 
     168                                        int t = Hell_randInt(0,100); 
     169                                        if(t < configparser.getint("NICOCHU_TURN_RATIO")){ 
    173170                                                int gl = cast(int)map.getGrassLevel(x-1,y); 
    174171                                                int gr = cast(int)map.getGrassLevel(x+1,y); 
     
    195192                                } 
    196193                                 
    197                                 if(timer == NICOCHU_TRANSFORM_INTERVAL && Hell_randInt(0,10) < 2 ){ 
     194                                if(timer % (configparser.getint("UPNUSHI_TRANSFORM_INTERVAL") * 40) == 0 
     195                                        && Hell_randInt(0,100) < configparser.getint("UPNUSHI_TRANSFORM_RATIO") ) 
     196                                { 
    198197                                        exist = false; 
    199198                                         
     
    201200                                } 
    202201                                break; 
    203                                  
     202                         
     203                        // ソワカちゃん 
    204204                        case TYPE.VC_MK: 
    205205                                controlCharacter(); 
    206                                 life = type_life_max[type]; 
     206                                life = type_life_max[type];     // 常時初期ライフ 
    207207                                break; 
    208208                                 
     209                        // びーむ 
    209210                        case TYPE.RAINBOW_RAY: 
    210211                                if(motion == MOTION.NORMAL) setMotion(MOTION.WALK); 
    211212                                destroyNeigbor(); 
    212213                                break; 
    213                                  
     214                         
     215                        // 爆風 
    214216                        case TYPE.EXPLODE: 
    215217                                break; 
     218                         
     219                        // うp主 
    216220                        case TYPE.UP_NUSHI: 
    217221                                if(motion == MOTION.NORMAL){ 
     
    222226                                } 
    223227                                 
    224                                 if(life < 2){ 
     228                                if(life < 1){ 
    225229                                        map.set(cast(int)position.x , cast(int)position.y , MapChip.TYPE.MOVIE); 
    226230                                        setMotion(MOTION.DYING); 
     
    228232                                 
    229233                                break; 
     234                         
    230235                        default: 
    231236                                break; 
     
    234239        } 
    235240         
     241        // 移動とか汎用処理 
    236242        void actCharacter(){ 
    237243                if(motion == MOTION.WALK){ 
     
    261267        } 
    262268         
     269        // 移動方向をランダム決定する(障害物のない方向を向く) 
    263270        void selectNewDirection(){ 
    264271                bool chk; 
     
    273280        } 
    274281         
     282        // ソワカちゃん専用処理(プレーヤー操作) 
    275283        void controlCharacter(){ 
    276284                // 七色レーザー発射 
     
    335343                } 
    336344                gamemain.map.setGrass(x,y,0); 
    337                 /* 
    338                 gamemain.map.setGrass(x+1,y+0,0); 
    339                 gamemain.map.setGrass(x+0,y-1,0); 
    340                 gamemain.map.setGrass(x+0,y+0,0); 
    341                 gamemain.map.setGrass(x+0,y+1,0); 
    342                 gamemain.map.setGrass(x-1,y+0,0); 
    343                 */ 
    344345                return true; 
    345346        } 
     
    363364                                 
    364365                                foreach(inout c;ch){ 
    365                                         if(c && c.exist && c.type == TYPE.NICOCHU){ 
     366                                        // VC_MKでなく、ライフがあるキャラば爆発しろ! 
     367                                        if(c && c.exist && c.type != TYPE.VC_MK && type_life_max[c.type] > 0){ 
    366368                                                c.destroy(); 
    367369                                        } 
     
    399401                        // 影 
    400402                        if(type_shadow[cast(int)type]){ 
     403                                /* 速度を稼ぐため、下半分だけコピーする */ 
     404                                Hell_drawTexture("char" , map.toViewX(mx,my) , map.toViewY(mx,my) + CHIP_SIZE / 2 
     405                                        ,CHIP_SIZE * 0 + CHIP_SIZE * 5 
     406                                        ,CHIP_SIZE * TYPE.SHADOW + CHIP_SIZE / 2 
     407                                        ,CHIP_SIZE , CHIP_SIZE / 2 , 1 , 1 
     408                                        ,0,255,255,255,alpha); 
     409                                /* 本来のコード 
    401410                                Hell_drawTexture("char" , map.toViewX(mx,my) , map.toViewY(mx,my) 
    402411                                        ,CHIP_SIZE * 0 + CHIP_SIZE * 5 
     
    404413                                        ,CHIP_SIZE , CHIP_SIZE , 1 , 1 
    405414                                        ,0,255,255,255,alpha); 
     415                                */ 
    406416                        } 
    407417                         
     
    526536                        } 
    527537                } 
    528                  
    529                 /* 
    530                 void drawStatus(){ 
    531                         for(int t=0;t<BACKET_MAX;t++){ 
    532                                 if(char_ptr[t]){ 
    533                                         char_ptr[t].drawStatus(); 
    534                                         break; 
    535                                 } 
    536                         } 
    537                 } 
    538                 */ 
    539538        } 
    540539        CharacterBacket charbacket[]; 
     
    575574                // 動かす 
    576575                super.move(); 
    577                  
     576                updateBacket(); 
     577        } 
     578         
     579        // バケットソートを更新する 
     580        void updateBacket(){ 
    578581                // バケット初期化 
    579582                foreach(inout c;charbacket) c.init(); 
     
    603606                charbacket[x + y * width].draw(); 
    604607        } 
    605         /* 
    606         // ステータス作画(with バケットソート) 
    607         void drawStatusAtMap(int x,int y){ 
    608                 if(!inRange(x,y)) return; 
    609                 charbacket[x + y * width].drawStatus(); 
    610         } 
    611         */ 
     608         
    612609        // キャラ取得(with バケットソート) 
    613610        Character[] getCharacterAtMap(int x,int y){ 
     
    651648        } 
    652649         
     650        // キャラクタを取り除く 
     651        void removeCharacter(Character.TYPE type){ 
     652                foreach(inout c;actors){ 
     653                        if(c.exist && c.type == type) c.exist = false; 
     654                } 
     655        } 
     656         
    653657        bool inRange(int x,int y){ 
    654658                if(x < 0 || y < 0 || x >= width || y >= height) return false; 
  • lang/d/koke/trunk/clickable.d

    r6336 r6347  
    2525         
    2626        int type; 
     27        Vec3 position; 
    2728         
    2829        enum TYPE{ 
    29                 UP_DEL,                 // うp&削除 
     30                DEL,                    // 削除 
    3031                HERBICIDE,              // 除草剤 
    3132                MANAGE_RAY,             // 運営レーザー 
    3233                CALL_NICO,              // ニコ厨を呼ぶ 
    33                 ROAD_ROLLER,    // ロードローラー 
    34         } 
     34                UP,                             // うp 
     35                FENCE,                  // 柵 
     36                 
     37                ECONOMY,                // エコノミー 
     38                CHART,                  // チャート 
     39                 
     40                STOP,                   // 停止 
     41                PLAY,                   // 通常 
     42                KSK,                    // 加速 
     43                DANGER,                 // 危 
     44        } 
     45         
     46        enum{ 
     47                LRG,    // 大 
     48                SML,    // 小 
     49                MIN,    // 極小 
     50        } 
     51        //                                                  del    he    ray   ni    up   fen   eco   crt   stp   ply   ksk   dgr 
     52        const int type_width[]  = [  80 ,  80 ,  80 ,  80 ,  80 ,  80 ,  64 ,  64 ,  32 ,  32 ,  32 ,  32 ]; 
     53        const int type_height[] = [  32 ,  32 ,  32 ,  32 ,  32 ,  32 ,  16 ,  16 ,  16 ,  16 ,  16 ,  16 ]; 
     54        const int type_style[]  = [ LRG , LRG , LRG , LRG , LRG , LRG , SML , SML , MIN , MIN , MIN , MIN ]; 
    3555         
    3656        this(TYPE type){ 
    3757                this.type = type; 
     58        } 
     59         
     60        void setPosition(Vec3 pos){ 
     61                position = pos; 
     62        } 
     63         
     64        int getWidth(){return type_width[type];} 
     65        int getHeight(){return type_height[type];} 
     66         
     67        void draw(bool selected,bool onMouse){ 
     68                if(type_style[type] == LRG){ 
     69                        // イメージボタン大 
     70                        if(selected){                   // 選択状態 
     71                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     72                                                , getWidth() * 2 , 0 , getWidth() , getHeight()); 
     73                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     74                                                , 0 , (cast(int)type + 1) * getHeight() 
     75                                                , getWidth() , getHeight() 
     76                                                ,1,1,0, 255,255,255); 
     77                        }else if(onMouse){              // onMouse状態 
     78                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     79                                                , getWidth() , 0 , getWidth() , getHeight()); 
     80                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     81                                                , 0 , (cast(int)type + 1) * getHeight() 
     82                                                , getWidth() , getHeight() 
     83                                                ,1,1,0, 64,64,64); 
     84                        }else{                                  // 他 
     85                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     86                                                , 0 , 0 , getWidth() , getHeight()); 
     87                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     88                                                , 0 , (cast(int)type + 1) * getHeight() 
     89                                                , getWidth() , getHeight() 
     90                                                ,1,1,0, 64,64,64); 
     91                        } 
     92                         
     93                }else if(type_style[type] == SML){ 
     94                        // イメージボタン小 
     95                        int alpha = (onMouse || selected) ? 255 : 128; 
     96                        if(selected){                   // 選択状態 
     97                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     98                                                , 242 , (cast(int)type - TYPE.ECONOMY) * getHeight() 
     99                                                , getWidth() , getHeight() 
     100                                                ,1,1,0, 255,255,255,alpha); 
     101                        }else{                                  // 非選択状態 
     102                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     103                                                , 242 , (cast(int)type - TYPE.ECONOMY) * getHeight() 
     104                                                , getWidth() , getHeight() 
     105                                                ,1,1,0, 128,128,128,alpha); 
     106                        } 
     107                 
     108                }else if(type_style[type] == MIN){ 
     109                        // イメージボタン極小 
     110                        int alpha = (onMouse || selected) ? 255 : 128; 
     111                        if(selected){                   // 選択状態 
     112                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     113                                                , 306 , (cast(int)type - TYPE.STOP) * getHeight() 
     114                                                , getWidth() , getHeight() 
     115                                                ,1,1,0, 255,255,255,alpha); 
     116                        }else{                                  // 非選択状態 
     117                                Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
     118                                                , 306 , (cast(int)type - TYPE.STOP) * getHeight() 
     119                                                , getWidth() , getHeight() 
     120                                                ,1,1,0, 128,128,128,alpha); 
     121                        } 
     122                } 
    38123        } 
    39124} 
     
    42127        Clickable clist[]; 
    43128        int count; 
     129         
     130        bool none_enable; 
     131        string selected; 
     132         
    44133        const int MAX_COUNT = 32; 
    45134         
    46         string selected; 
    47          
    48         this(){ 
     135        this(bool none_enable = true){ 
    49136                clist = new Clickable[MAX_COUNT]; 
    50137                foreach(inout click ; clist) click = null; 
     
    52139                this.count = count; 
    53140                this.selected = ""; 
     141                this.none_enable = none_enable; 
    54142        } 
    55143         
     
    65153        } 
    66154        void add(string str,Vec3 pos,ImageButton.TYPE type){ 
    67                 Vec3 size = new Vec3(ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT , 0); 
    68                 Clickable newc = new Clickable(str , pos , size , 0 , new ImageButton(type)); 
     155                ImageButton imgb = new ImageButton(type); 
     156                Vec3 size = new Vec3(imgb.getWidth(), imgb.getHeight() , 0); 
     157                Clickable newc = new Clickable(str , pos , size , 0 , imgb); 
    69158                 
    70159                foreach(inout c ; clist){ 
    71160                        if(!c){ 
    72161                                c = newc; 
     162                                if(selected == "" && none_enable == false) selected = str; 
    73163                                return; 
    74164                        } 
     
    88178                if(Hell_isPushMouse()) { 
    89179                        string mov = getMouseOver(); 
    90                         if(mov != "") selected = getMouseOver(); 
     180                        if(mov != ""){ 
     181                                if(selected == mov && none_enable == true){ 
     182                                        selected = ""; 
     183                                }else{ 
     184                                        selected = mov; 
     185                                } 
     186                        } 
    91187                        return mov; 
    92188                } 
     
    127223                this.imagebutton = imagebutton; 
    128224                this.selected = false; 
     225                 
     226                if(imagebutton){ 
     227                        imagebutton.setPosition(pos); 
     228                } 
    129229        } 
    130230         
     
    147247                        } 
    148248                }else{ 
    149                         // イメージボタンモード 
    150                         if(selected){                   // 選択状態 
    151                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    152                                                 , ImageButton.BUTTON_WIDTH * 2 , 0 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT); 
    153                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    154                                                 , 0 , (cast(int)imagebutton.type + 1) * ImageButton.BUTTON_HEIGHT 
    155                                                 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT 
    156                                                 ,1,1,0, 255,255,255); 
    157                         }else if(onMouse()){    // onMouse状態 
    158                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    159                                                 , ImageButton.BUTTON_WIDTH , 0 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT); 
    160                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    161                                                 , 0 , (cast(int)imagebutton.type + 1) * ImageButton.BUTTON_HEIGHT 
    162                                                 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT 
    163                                                 ,1,1,0, 64,64,64); 
    164                         }else{                                  // 他 
    165                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    166                                                 , 0 , 0 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT); 
    167                                 Hell_drawTexture("menu" , cast(int)position.x , cast(int)position.y 
    168                                                 , 0 , (cast(int)imagebutton.type + 1) * ImageButton.BUTTON_HEIGHT 
    169                                                 , ImageButton.BUTTON_WIDTH , ImageButton.BUTTON_HEIGHT 
    170                                                 ,1,1,0, 64,64,64); 
    171                         } 
     249                        imagebutton.draw(selected , onMouse()); 
    172250                } 
    173251        } 
  • lang/d/koke/trunk/config.ini

    r6336 r6347  
    1111# 
    1212 
     13 
     14 
     15# -------------------------------------------------------------------- 
     16# マップの大きさ 
     17 
    1318# MAP_WIDTH 
    14 # マップ横幅(標準:32) 
     19# マップ横幅(標準:48) 
    1520#  マップサイズが大きくなるの合わせて 
    1621#  CPU負荷が大きくなるため、極端に大きな値には注意 
     
    1823 
    1924# MAP_HEIGHT 
    20 # マップ縦幅(標準:32) 
     25# マップ縦幅(標準:48) 
    2126#  同上 
    2227MAP_HEIGHT = 48 
     28 
     29 
     30 
     31# -------------------------------------------------------------------- 
     32# マップの設定(システム寄り 
     33 
     34# MAP_GRASS_COLOR_R/G/B 
     35# 芝の色(標準:すべて128) 
     36#  芝だけはchar.bmpからコピーされるときにこの色で乗算される(黒に近づく) 
     37#  詳しくはRGBカラーでぐぐれ (値範囲:0~255) 
     38#  芝のキャラ絵を書き換えるときは、ここをすべて255にするといいカモよ? 
     39MAP_GRASS_COLOR_R = 128 
     40MAP_GRASS_COLOR_G = 128 
     41MAP_GRASS_COLOR_B = 128 
    2342 
    2443# MAP_GRASS_AFFECT 
     
    2948MAP_GRASS_AFFECT = 0.90 
    3049 
     50# MAP_GRASS_AFFECT_LIMIT 
     51# 芝の影響量(標準:0.5) 
     52#  芝えねるぎーのフレームあたりの増加量上限値 
     53#  芝の生えすぎを抑制する値 
    3154MAP_GRASS_AFFECT_LIMIT = 0.5 
    3255 
     
    4063# MAP_MOVIE_GRASS_FEED 
    4164# 動画の芝えねるぎー供給上限(標準:200) 
    42 #  動画が隣接4マスに供給する場合の上限。 
    43 #  これ以上の芝えねるぎーを持つマス目には、芝えねるぎーを供給しない 
    44 #  増殖しすぎるのを防止するためのパラメータ 
     65#  動画の下にあるマスは常にこの芝えねるぎー量になる。 
    4566MAP_MOVIE_GRASS_FEED = 200 
     67 
     68 
     69 
     70# -------------------------------------------------------------------- 
     71# ニコ厨 
     72 
     73# NICOCHU_TURN_RATIO 
     74# ニコ厨が方向を変える確率%(標準:50) 
     75#  ニコ厨が一マス歩くごとにこの確率で方向を変えます。 
     76#  変えるとき、芝の濃い方に高い確率で向きます。(低確率で芝の薄い方にも) 
     77NICOCHU_TURN_RATIO = 50 
     78 
     79 
     80 
     81# --------------------------------------------------------------------