- Timestamp:
- 02/07/08 20:12:30 (10 months ago)
- Location:
- lang/d/koke/trunk
- Files:
-
- 8 modified
- 1 copied
-
Makefile (copied) (copied from lang/d/koke/trunk/Makefile)
-
boot.d (modified) (2 diffs)
-
character.d (modified) (20 diffs)
-
clickable.d (modified) (7 diffs)
-
config.ini (modified) (4 diffs)
-
gamecore.d (modified) (14 diffs)
-
hell2.d (modified) (4 diffs)
-
keypad.d (modified) (2 diffs)
-
map.d (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/d/koke/trunk/boot.d
r6336 r6347 26 26 27 27 // 画面サイズ 28 const int g_width = 640;29 const int g_height = 480;28 static int g_width; 29 static int g_height; 30 30 const char[] g_title = "hoge"; // タイトルバー 31 31 … … 41 41 { 42 42 // オプション解釈 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) 45 47 { 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 } 48 55 } 49 56 -
lang/d/koke/trunk/character.d
r6336 r6347 77 77 static const int motion_interval[] = [ 0 , 999 , 20 , 2 , 24 , 40 , 20 , 40]; 78 78 79 static const int NICOCHU_TRANSFORM_INTERVAL = 40 * 60;80 81 79 DIRECTION direction; // 方向 82 80 MOTION motion; // モーション … … 127 125 int x = cast(int)position.x , y = cast(int)position.y; 128 126 127 // 画面外 129 128 if(x < 0 || y < 0 || x >= map.width || y >= map.height){ 130 129 exist = false; … … 148 147 149 148 // 死亡モーション遷移 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){ 152 150 setMotion(MOTION.DYING); 151 life = 0; 153 152 } 154 153 if(motion == MOTION.DYING) return; … … 156 155 // キャラクタ固有行動 157 156 switch(type){ 157 158 // ニコ厨 158 159 case TYPE.NICOCHU: 159 160 if(motion == MOTION.NORMAL && Hell_randInt(0,10) < 5){ … … 165 166 if(motion == MOTION.EATING) map.setGrass(x,y,0); 166 167 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")){ 173 170 int gl = cast(int)map.getGrassLevel(x-1,y); 174 171 int gr = cast(int)map.getGrassLevel(x+1,y); … … 195 192 } 196 193 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 { 198 197 exist = false; 199 198 … … 201 200 } 202 201 break; 203 202 203 // ソワカちゃん 204 204 case TYPE.VC_MK: 205 205 controlCharacter(); 206 life = type_life_max[type]; 206 life = type_life_max[type]; // 常時初期ライフ 207 207 break; 208 208 209 // びーむ 209 210 case TYPE.RAINBOW_RAY: 210 211 if(motion == MOTION.NORMAL) setMotion(MOTION.WALK); 211 212 destroyNeigbor(); 212 213 break; 213 214 215 // 爆風 214 216 case TYPE.EXPLODE: 215 217 break; 218 219 // うp主 216 220 case TYPE.UP_NUSHI: 217 221 if(motion == MOTION.NORMAL){ … … 222 226 } 223 227 224 if(life < 2){228 if(life < 1){ 225 229 map.set(cast(int)position.x , cast(int)position.y , MapChip.TYPE.MOVIE); 226 230 setMotion(MOTION.DYING); … … 228 232 229 233 break; 234 230 235 default: 231 236 break; … … 234 239 } 235 240 241 // 移動とか汎用処理 236 242 void actCharacter(){ 237 243 if(motion == MOTION.WALK){ … … 261 267 } 262 268 269 // 移動方向をランダム決定する(障害物のない方向を向く) 263 270 void selectNewDirection(){ 264 271 bool chk; … … 273 280 } 274 281 282 // ソワカちゃん専用処理(プレーヤー操作) 275 283 void controlCharacter(){ 276 284 // 七色レーザー発射 … … 335 343 } 336 344 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 */344 345 return true; 345 346 } … … 363 364 364 365 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){ 366 368 c.destroy(); 367 369 } … … 399 401 // 影 400 402 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 /* 本来のコード 401 410 Hell_drawTexture("char" , map.toViewX(mx,my) , map.toViewY(mx,my) 402 411 ,CHIP_SIZE * 0 + CHIP_SIZE * 5 … … 404 413 ,CHIP_SIZE , CHIP_SIZE , 1 , 1 405 414 ,0,255,255,255,alpha); 415 */ 406 416 } 407 417 … … 526 536 } 527 537 } 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 */539 538 } 540 539 CharacterBacket charbacket[]; … … 575 574 // 動かす 576 575 super.move(); 577 576 updateBacket(); 577 } 578 579 // バケットソートを更新する 580 void updateBacket(){ 578 581 // バケット初期化 579 582 foreach(inout c;charbacket) c.init(); … … 603 606 charbacket[x + y * width].draw(); 604 607 } 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 612 609 // キャラ取得(with バケットソート) 613 610 Character[] getCharacterAtMap(int x,int y){ … … 651 648 } 652 649 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 653 657 bool inRange(int x,int y){ 654 658 if(x < 0 || y < 0 || x >= width || y >= height) return false; -
lang/d/koke/trunk/clickable.d
r6336 r6347 25 25 26 26 int type; 27 Vec3 position; 27 28 28 29 enum TYPE{ 29 UP_DEL, // うp&削除30 DEL, // 削除 30 31 HERBICIDE, // 除草剤 31 32 MANAGE_RAY, // 運営レーザー 32 33 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 ]; 35 55 36 56 this(TYPE type){ 37 57 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 } 38 123 } 39 124 } … … 42 127 Clickable clist[]; 43 128 int count; 129 130 bool none_enable; 131 string selected; 132 44 133 const int MAX_COUNT = 32; 45 134 46 string selected; 47 48 this(){ 135 this(bool none_enable = true){ 49 136 clist = new Clickable[MAX_COUNT]; 50 137 foreach(inout click ; clist) click = null; … … 52 139 this.count = count; 53 140 this.selected = ""; 141 this.none_enable = none_enable; 54 142 } 55 143 … … 65 153 } 66 154 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); 69 158 70 159 foreach(inout c ; clist){ 71 160 if(!c){ 72 161 c = newc; 162 if(selected == "" && none_enable == false) selected = str; 73 163 return; 74 164 } … … 88 178 if(Hell_isPushMouse()) { 89 179 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 } 91 187 return mov; 92 188 } … … 127 223 this.imagebutton = imagebutton; 128 224 this.selected = false; 225 226 if(imagebutton){ 227 imagebutton.setPosition(pos); 228 } 129 229 } 130 230 … … 147 247 } 148 248 }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()); 172 250 } 173 251 } -
lang/d/koke/trunk/config.ini
r6336 r6347 11 11 # 12 12 13 14 15 # -------------------------------------------------------------------- 16 # マップの大きさ 17 13 18 # MAP_WIDTH 14 # マップ横幅(標準: 32)19 # マップ横幅(標準:48) 15 20 # マップサイズが大きくなるの合わせて 16 21 # CPU負荷が大きくなるため、極端に大きな値には注意 … … 18 23 19 24 # MAP_HEIGHT 20 # マップ縦幅(標準: 32)25 # マップ縦幅(標準:48) 21 26 # 同上 22 27 MAP_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にするといいカモよ? 39 MAP_GRASS_COLOR_R = 128 40 MAP_GRASS_COLOR_G = 128 41 MAP_GRASS_COLOR_B = 128 23 42 24 43 # MAP_GRASS_AFFECT … … 29 48 MAP_GRASS_AFFECT = 0.90 30 49 50 # MAP_GRASS_AFFECT_LIMIT 51 # 芝の影響量(標準:0.5) 52 # 芝えねるぎーのフレームあたりの増加量上限値 53 # 芝の生えすぎを抑制する値 31 54 MAP_GRASS_AFFECT_LIMIT = 0.5 32 55 … … 40 63 # MAP_MOVIE_GRASS_FEED 41 64 # 動画の芝えねるぎー供給上限(標準:200) 42 # 動画が隣接4マスに供給する場合の上限。 43 # これ以上の芝えねるぎーを持つマス目には、芝えねるぎーを供給しない 44 # 増殖しすぎるのを防止するためのパラメータ 65 # 動画の下にあるマスは常にこの芝えねるぎー量になる。 45 66 MAP_MOVIE_GRASS_FEED = 200 67 68 69 70 # -------------------------------------------------------------------- 71 # ニコ厨 72 73 # NICOCHU_TURN_RATIO 74 # ニコ厨が方向を変える確率%(標準:50) 75 # ニコ厨が一マス歩くごとにこの確率で方向を変えます。 76 # 変えるとき、芝の濃い方に高い確率で向きます。(低確率で芝の薄い方にも) 77 NICOCHU_TURN_RATIO = 50 78 79 80 81 # --------------------------------------------------------------------
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)