Changeset 7081 for lang/d

Show
Ignore:
Timestamp:
02/24/08 07:10:10 (9 months ago)
Author:
omega
Message:

運営レーザーを実装

Location:
lang/d/koke/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/d/koke/trunk/build.bat

    r6898 r7081  
    99@echo off 
    1010if NOT ERRORLEVEL 1 GOTO RUN 
     11pause 
    1112goto END 
    1213 
    1314:RUN 
    1415koke.exe 
    15 make -fMakefile.dmd.win32 obj-clean 
     16#make -fMakefile.dmd.win32 obj-clean 
    1617goto END 
    1718 
    1819:END 
    19 pause 
    2020 
  • lang/d/koke/trunk/character.d

    r6962 r7081  
    5252                [ false ,  true ,  true , false , false ,  true  ,  true ];             // 衝突判定の有無 
    5353        static const int type_life_dec[] = 
    54                 [         0 ,    40 ,     0 ,     0 ,     0 ,    40  ,    80 ];         // ライフ減少時間(フレーム) 
     54                [         0 ,    40 ,     0 ,     0 ,     0 ,    40  ,    40 ];         // ライフ減少時間(フレーム) 
    5555         
    5656        // 方向 
     
    211211                        case TYPE.RAINBOW_RAY: 
    212212                                if(motion == MOTION.NORMAL) setMotion(MOTION.WALK); 
    213                                 destroyNeigbor(); 
     213                                destroyNeighbor(); 
    214214                                break; 
    215215                         
     
    396396        } 
    397397         
     398        void destroyNeighbor(){ 
     399                destroyMap(cast(int)position.x , cast(int)position.y); 
     400        } 
    398401        // ぶっとばすぞー 
    399         void destroyNeigbor(){ 
    400                 for(int x=-1;x<2;x++){ 
    401                         for(int y=-1;y<2;y++){ 
    402                                 int px = cast(int)position.x + x; 
    403                                 int py = cast(int)position.y + y; 
    404                                  
    405                                 if(!gamemain.map.isMap( px , py , MapChip.TYPE.NONE)){ 
     402        void destroyMap(int xx,int yy,int size = 1, bool all = false){ 
     403                for(int x=-size;x<=size;x++){ 
     404                        for(int y=-size;y<=size;y++){ 
     405                                int px = xx + x; 
     406                                int py = yy + y; 
     407                                 
     408                                if(gamemain.map.isMap( px , py , MapChip.TYPE.MOVIE) || (all && !gamemain.map.isMap( px , py , MapChip.TYPE.NONE))){ 
     409                                        gamemain.map.set( px , py , MapChip.TYPE.NONE); 
    406410                                        Character c = gamemain.charpool.set( new Vec3(px , py , 0) , TYPE.EXPLODE); 
    407411                                        if(c){ 
     
    409413                                        } 
    410414                                } 
    411                                 gamemain.map.set( px , py , MapChip.TYPE.NONE); 
     415                                gamemain.map.setGrass( px , py , 0 ); 
    412416                                 
    413417                                Character ch[] = gamemain.charpool.getCharacterAtMap(px,py); 
  • lang/d/koke/trunk/gamecore.d

    r6962 r7081  
    2727private import map; 
    2828 
     29private import std.math; 
     30 
    2931/********************************************************************************/ 
    3032 
     
    6466        int config_reload_timer;                // 「コンフィグをリロードした」表示用 
    6567         
     68        int mray_timer;                                 // 運営レーザー用タイマ 
     69         
     70        int shake_power;                                // 画面ゆれ強度 
     71         
    6672        static const int CONFIG_RELOAD_CHECK_INTERVAL = 40 * 5;                 // コンフィグ再読み込み確認 
    6773        static const int CONFIG_RELOAD_SHOW_INTERVAL = 40 * 3;                  // 「コンフィグ読み込んだ」表示時間 
     74         
     75        // 運営レーザー用タイマー数値 
     76        static const int MRAY_TIMER_FIRST_WAIT = 40;                            // 待ち 
     77        static const int MRAY_TIMER_SECOND_TARGET = 80;                         // ターゲット 
    6878         
    6979        this() 
     
    7484                configparser.load(CONFIG_PATH); 
    7585                config_reload_timer = 0; 
     86                 
     87                mray_timer = 0; 
     88                shake_power = 0; 
    7689                 
    7790                int mapw = configparser.getint("MAP_WIDTH"); 
     
    187200                        case "manage_ray": 
    188201                                // 運営レーザー コマンド 
    189                                 // TODO:実装する 
     202                                mray_timer++; 
     203                                if(mray_timer > MRAY_TIMER_SECOND_TARGET){ 
     204                                        shake_power = 16; 
     205                                        Character c = charpool.set( new Vec3(cursor_x , cursor_y , 0) , Character.TYPE.EXPLODE); 
     206                                        c.destroyMap(cursor_x , cursor_y , Hell_randInt(0,5) , true);   // 一次的な対応 
     207                                        c.setMotion(Character.MOTION.VANISH); 
     208                                } 
    190209                                break; 
    191210                                 
     
    216235                                break; 
    217236                        } 
     237                }else{ 
     238                        mray_timer = 0; 
     239                        if(shake_power > 0)shake_power--; 
    218240                } 
    219241                // 右クリック 
     
    271293                resetPerspective(); 
    272294                Hell_setAlpha(HELL_ALPHA_NORMAL); 
     295                 
     296                // 画面ゆれ 
     297                double shake_x = 0 , shake_y = 0; 
     298                if(shake_power > 0){ 
     299                        shake_x = Hell_randInt(-shake_power , shake_power); 
     300                        shake_y = Hell_randInt(-shake_power , shake_power)/2; 
     301                } 
     302                map.draw_ofs_x += shake_x; 
     303                map.draw_ofs_y += shake_y; 
    273304                 
    274305                map.draw(); 
     
    296327                } 
    297328                 
     329                // 運営レーザー 
     330                if(mray_timer > 0 && map.inRange(cursor_x,cursor_y)){ 
     331                        static const int CHIP_CENTER_OFFSET_X = 16; 
     332                        static const int CHIP_CENTER_OFFSET_Y = 24; 
     333                         
     334                        double mx = map.toViewX(cursor_x,cursor_y); 
     335                        double my = map.toViewY(cursor_x,cursor_y); 
     336                        if(mray_timer < MRAY_TIMER_FIRST_WAIT){ 
     337                                int alpha = 255 * mray_timer / MRAY_TIMER_FIRST_WAIT; 
     338                                Hell_drawRect(cast(int)mx - 2 + CHIP_CENTER_OFFSET_X , 0 
     339                                                        , 5, cast(int)my + CHIP_CENTER_OFFSET_Y , 0 
     340                                                        , 0 , 255,160,32,alpha / 4); 
     341                                Hell_drawRect(cast(int)mx + CHIP_CENTER_OFFSET_X , 0 
     342                                                        , 1, cast(int)my + CHIP_CENTER_OFFSET_Y , 0 
     343                                                        , 0 , 255,160,32,alpha); 
     344                        }else if(mray_timer < MRAY_TIMER_SECOND_TARGET){ 
     345                                Hell_drawRect(cast(int)mx - 2 + CHIP_CENTER_OFFSET_X , 0 
     346                                                        , 5, cast(int)my + CHIP_CENTER_OFFSET_Y , 0 
     347                                                        , 0 , 255,160,32,64); 
     348                                Hell_drawRect(cast(int)mx + CHIP_CENTER_OFFSET_X , 0 
     349                                                        , 1, cast(int)my + CHIP_CENTER_OFFSET_Y , 0 
     350                                                        , 0 , 255,160,32); 
     351                                                         
     352                                for(double rr=1;rr<3;rr++){ 
     353                                        for(double t=0;t<PI*2;t+=PI/8){ 
     354                                                double tr = cast(double)(MRAY_TIMER_SECOND_TARGET - mray_timer) / (MRAY_TIMER_SECOND_TARGET - MRAY_TIMER_FIRST_WAIT); 
     355                                                double vx1 = 8.0 * rr*rr * std.math.sin(t+PI/8) * tr + cursor_x; 
     356                                                double vy1 = 8.0 * rr*rr * std.math.cos(t+PI/8) * tr + cursor_y; 
     357                                                double vx2 = 8.0 * rr*rr * std.math.sin(t) * tr + cursor_x; 
     358                                                double vy2 = 8.0 * rr*rr * std.math.cos(t) * tr + cursor_y; 
     359                                                 
     360                                                Hell_drawLine(  map.toViewX(vx1,vy1) + CHIP_CENTER_OFFSET_X , map.toViewY(vx1,vy1) + CHIP_CENTER_OFFSET_Y 
     361                                                                        ,       map.toViewX(vx2,vy2) + CHIP_CENTER_OFFSET_X , map.toViewY(vx2,vy2) + CHIP_CENTER_OFFSET_Y 
     362                                                                        , 8 ,255,196,32,92); 
     363                                                Hell_drawLine(  map.toViewX(vx1,vy1) + CHIP_CENTER_OFFSET_X , map.toViewY(vx1,vy1) + CHIP_CENTER_OFFSET_Y 
     364                                                                        ,       map.toViewX(vx2,vy2) + CHIP_CENTER_OFFSET_X , map.toViewY(vx2,vy2) + CHIP_CENTER_OFFSET_Y 
     365                                                                        , 1 ,255,196,32,196); 
     366                                        } 
     367                                } 
     368                        }else{ 
     369                                for(int t=0;t<32;t++){ 
     370                                        int w = Hell_randInt(1,16); 
     371                                        if(t > 24){ 
     372                                                Hell_drawRect(cast(int)mx + Hell_randInt(-8,8) - w/2 + CHIP_CENTER_OFFSET_X , 0 
     373                                                                        , w , cast(int)my + CHIP_CENTER_OFFSET_Y + Hell_randInt(-8,8) 
     374                                                                        , 0 , 0,  
     375                                                                        255,255,255,128); 
     376                                        }else if(t > 8){ 
     377                                                Hell_drawRect(cast(int)mx + Hell_randInt(-16,16) - w/2 + CHIP_CENTER_OFFSET_X , 0 
     378                                                                        , w , cast(int)my + CHIP_CENTER_OFFSET_Y + Hell_randInt(-8,8) 
     379                                                                        , 0 , 0,  
     380                                                                        255,255,32,128); 
     381                                        }else{ 
     382                                                Hell_drawRect(cast(int)mx + Hell_randInt(-32,32) - w/2 + CHIP_CENTER_OFFSET_X , 0 
     383                                                                        , w , cast(int)my + CHIP_CENTER_OFFSET_Y + Hell_randInt(-8,8) 
     384                                                                        , 0 , 0,  
     385                                                                        255,160,32,128); 
     386                                        } 
     387                                } 
     388                        } 
     389                        Hell_drawFont("T:" ~ std.string.toString(mray_timer) , mouse_x - 32 , mouse_y - 0); 
     390                } 
     391                 
    298392                // 種類別キャラクタ数表示(左上) 
    299393                for(int t=0;t<Character.TYPE.MAX;t++){ 
     
    320414                                        , 1 , 255,128,0); 
    321415                } 
     416                 
     417                // 画面ゆれ・ズレ分を元に戻す 
     418                map.draw_ofs_x -= shake_x; 
     419                map.draw_ofs_y -= shake_y; 
    322420                 
    323421                // fps/cpu