Mercurial > hg > Members > kono > tree_dandy2
view count2.c @ 35:3b92a4b17049 default tip
fix for macosx Yosemite
author | Nozomi |
---|---|
date | Thu, 19 May 2016 18:18:34 +0900 |
parents | 3b7e57614d93 |
children |
line wrap: on
line source
#include <stdlib.h> #include "object.h" #include "count2.h" #include "sound.h" #include "bom.h" #include "sankaku.h" //#include "libps.h" #include "sgoex.h" #include "debug.h" extern int SsUtKeyOn(int vabId, int prog, int tone, int note, int fine, int voll, int vlor); /* * debugging */ extern SGO_PAD pad[2]; player jiki = { 60, 200, 3, 0, FALSE, 120, 3, 3 }; laser laser_lv1[20]; laser laser_lv2[20]; stge lg = { 4096 }; stge pg = { 4096 }; int infg_level = { 0 }; stge infg = { 1 }; tama1 tama_lv1[20]; tama2 tama_lv2[20]; tama1 tlv3[3]; int py; int bomcount = { 0 }; int charcount = { 0 }; int bania; int pointkakudo(int playerno); int bf = { 0 }; int tama_lv1_end = { -1 }; int tama_lv2_end = { -1 }; int laser_lv1_end = { -1 }; int laser_lv2_end = { -1 }; laser laser_lv3[64] = { {0, 0, 0, 0, 64, 0} }; int se_key[6] = { -1, -1, -1, -1, -1, -1 }; void Player(int playerno) { int i; float wariai1, wariai2; /* if (jiki.zanki > 0) { DefSprite(194, "remainder.bmp", 8 * (jiki.zanki - 1), 8, 480, effect); count++; PutSprite(count, 128, 224, 194); } */ if (jiki.bf == FALSE) { Bom(jiki.x, jiki.y); return; } /*時機無敵時間計算 */ if (jiki.muteki > 0 && jiki.bf == TRUE) { count++; // PutSprite(count, jiki.x + 16, jiki.y + 16, 193); PutSpriteEx(193, jiki.x + 16, jiki.y + 16, 2, 2, 1); count++; // PutSprite(count, jiki.x + 16, jiki.y + 16, 193); PutSpriteEx(193, jiki.x + 16, jiki.y + 16, 2, 2, 1); jiki.muteki--; } /*コントローラ上限値-------------------------------- */ maxf(pad[0].right, 3); maxf(pad[0].left, 3); maxf(pad[0].up, 3); maxf(pad[0].down, 3); /*自機の動き---------------------------------------- */ jiki.x += pad[0].right - pad[0].left; jiki.y += pad[0].down - pad[0].up; /*自機の動き---------------------------------------- */ mini(jiki.x, 0); maxf(jiki.x, 1688 - 128); mini(jiki.y, 0); maxf(jiki.y, 964 - 128); if (pad[0].right > 0) { if (charcount < 0) charcount = 0; else charcount++; } if (pad[0].left > 0) { if (charcount > 0) charcount = 0; else charcount--; } if ((pad[0].left == 0) && (pad[0].right == 0)) charcount = 0; jiki.ch = 3 * (charcount <= 3) * (charcount > -3) + 2 * (charcount < -3) * (charcount >= -15) + 1 * (charcount < -15) + 4 * (charcount > 3) * (charcount <= 15) + 5 * (charcount > 15); /*玉レベル1登録------------------------------------ */ if ((pad[0].k4 % 3 == 1) && (pad[0].k3 % 3 == 0)) { PlaySdlMixer(0, SHOT_A);// output sound //se_voice[0] = SsUtKeyOn(vab[SHOT_A], 0, 0, 65, 0, 60, 60); pad[0].k4 = 1; tama_lv1_end++; i = tama_lv1_end; tama_lv1[i].x = jiki.x; tama_lv1[i].y = jiki.y; tama_lv1[i].r = 1; tama_lv1[i].l = 1; if (pg.stg <= MAXP) pg.stg += 1; } /*玉レベル2登録------------------------------------ */ if ((pad[0].k3 % 3 == 1) && (pad[0].k4 == 0) && (pg.stg > 64)) { PlaySdlMixer(0, SHOT_B);// output sound //se_key[1] = SsUtKeyOn(vab[SHOT_B], 0, 0, 65, 0, 80, 80); se_key[1] = SsUtKeyOn(vab[SHOT_B], 0, 0, 65, 0, 80, 80); pad[0].k3 = 1; tama_lv2_end++; i = tama_lv2_end; tama_lv2[i].x = jiki.x; tama_lv2[i].y = jiki.y; tama_lv2[i].rr = 1; tama_lv2[i].sr = 1; tama_lv2[i].sl = 1; tama_lv2[i].ll = 1; pg.stg -= 64; } /*玉レベル3登録------------------------------------- */ if ((pad[0].k3 % 5 > 0) && (pad[0].k4 % 5 > 0)) { pad[0].k3 = 1; pad[0].k4 = 1; i = 0; while (tlv3[i].y != -1) { i++; } if ((i < 1) && (pg.stg > 2000)) { PlaySdlMixer(0,SHOT_C); // re-za- //se_voice[0] = SsUtKeyOn(vab[SHOT_C], 0, 0, 65, 0, 75, 75); se_voice[0] = SsUtKeyOn(vab[SHOT_C], 0, 0, 65, 0, 75, 75); tlv3[i].x = jiki.x; tlv3[i].y = jiki.y; pg.stg -= 2000; tlv3[i].r = 90; jiki.muteki = 4; } } /*押してないときの玉ゲージ回復---------------------- */ if ((pad[0].k3 == 0) && (pad[0].k4 == 0)) if (pg.stg <= MAXP) pg.stg += 4; /*玉レベル1表示------------------------------ */ for (i = 0; i < tama_lv1_end + 1; i++) { tama_lv1[i].y -= 64; if (tama_lv1[i].r == 1) { count++; PutSprite(count, tama_lv1[i].x + 64, tama_lv1[i].y, 6); } if (tama_lv1[i].l == 1) { count++; PutSprite(count, tama_lv1[i].x, tama_lv1[i].y, 7); } if (tama_lv1[i].y < 0) { if (tama_lv1_end == i) { tama_lv1_end--; break; } if (tama_lv1_end > i) { tama_lv1[i] = tama_lv1[tama_lv1_end]; tama_lv1_end--; i--; } } } /*玉レベル2表示------------------------------ */ for (i = 0; i < tama_lv2_end + 1; i++) { tama_lv2[i].y -= 64; if (tama_lv2[i].rr == 1) { count++; PutSprite(count, tama_lv2[i].x + 128, tama_lv2[i].y-96, 8); } if (tama_lv2[i].sr == 1) { count++; PutSprite(count, tama_lv2[i].x + 64, tama_lv2[i].y - 192, 8); } if (tama_lv2[i].sl == 1) { count++; PutSprite(count, tama_lv2[i].x, tama_lv2[i].y - 192, 8); } if (tama_lv2[i].ll == 1) { count++; PutSprite(count, tama_lv2[i].x - 64, tama_lv2[i].y-92, 8); } if (tama_lv2[i].y < 0) { if (tama_lv2_end == i) { tama_lv2_end--; break; } if (tama_lv2_end > i) { tama_lv2[i] = tama_lv2[tama_lv2_end]; tama_lv2_end--; i--; } } } /*玉レベル3表示----------------------------------- */ if (tlv3[0].r > 0) { /*波動砲本体 */ tlv3[0].x = jiki.x + 96; tlv3[0].y = jiki.y; count++; // PutSprite(count, tlv3[0].x, tlv3[0].y - 128, 9); PutSpriteEx(9, tlv3[0].x, tlv3[0].y - 128, tlv3[0].r *2 /45, 3, 1); /*干渉部分 */ //DefSprite(39, 0, 16, 112 - ((tlv3[0].r % 8) / 2) * 16, 16, 16, // 480); /*波動砲干渉部分 */ count++; // PutSprite(count, jiki.x + 16, jiki.y + 32, 39); PutSpriteEx(39, jiki.x + 16, jiki.y + 32, 2, 2, 1); /*終了フラグ */ tlv3[0].r--; if (tlv3[0].r == 0) tlv3[0].y = -1; } /* } */ /*玉ゲージの中身表示------------------------- */ wariai2 = pg.stg; wariai1 = wariai2 / 4096.0; py = 64.0 * wariai1; //DefSprite(11, "offensivepower_gauge.bmp", 8, py, 480, effect); count++; //PutSprite(count, 0, 240 - 96 + 64 - py, 11); /*レーザーゲージの中身表示------------------------ */ wariai2 = lg.stg; wariai1 = wariai2 / 4096.0; py = 64.0 * wariai1; //DefSprite(15, "diffensivepower_gauge.bmp", 9, py, 480, effect); count++; //PutSprite(count, 18, 240 - 105, 15); /*インフレゲージ------------------------------------- */ if (infg.stg > 640) { infg.stg = 0; infg_level++; if (infg_level > 11) { infg_level = 11; infg.stg = 640; } } py = infg.stg / 8; //DefSprite(49, "inflation_meter.bmp", 16, py, 320, effect); #define REGULATION_PUTSIZE_X 5 count++; //PutSprite(count, REGULATION_PUTSIZE_X + 4 - 7, 24 + 83 - py, 49); count++; //PutSprite(count, REGULATION_PUTSIZE_X + 0, 40 + 80, 200 + infg_level); /*バーニアアニメーション----------------------------- */ bania++; bania %= 3; //DefSprite(12, "burner.bmp", 16, 16, 480, effect); count++; //PutSprite(count, jiki.x + 8, jiki.y + 32, 12); /*照準コントロール----------------------------------- */ if (pad[0].r1 % 2 == 1) { pad[0].r1 = 1; jiki.point += 10; } if (pad[0].l1 % 2 == 1) { pad[0].l1 = 1; jiki.point -= 10; } jiki.point %= 360; int siny = 50 * Mysin(jiki.point - 90) / SANKAKU; int cosx = 30 + 50 * Mycos(jiki.point - 90) / SANKAKU; count++; DefSpriteEx(13, 4, 64); // PutSprite(count, jiki.x + 16, jiki.y, 13); PutSpriteEx(13, jiki.x + cosx, jiki.y + siny, 2, 2, jiki.point); /*押してないときレーザーゲージ回復------------------- */ if ((pad[0].k1 == 0) && (pad[0].k0 == 0)) if (lg.stg <= MAXP) lg.stg += 4; /*レーザーレベル1登録------------------------------- */ if ((pad[0].k1 % 3 == 1) && (pad[0].k0 == 0) && (lg.stg > 16)) { PlaySdlMixer(0, RING) ; // RING //se_key[3] = SsUtKeyOn(vab[LASER_A], 0, 0, 65, 0, 50, 50); pad[0].k1 = 1; laser_lv1_end++; i = laser_lv1_end; laser_lv1[i].sx = 32 * Mysin(jiki.point) / SANKAKU; laser_lv1[i].sy = 32 * Mycos(jiki.point) / SANKAKU; laser_lv1[i].x = jiki.x + 128; laser_lv1[i].y = jiki.y + 128; laser_lv1[i].r = 1000; laser_lv1[i].s = 0.08; lg.stg -= 16; } /*--------------------------------------------------*/ for (i = 0; i < laser_lv1_end + 1; i++) { if (laser_lv1[i].r != -1) { laser_lv1[i].y -= laser_lv1[i].sy; laser_lv1[i].x += laser_lv1[i].sx; laser_lv1[i].r += 100; laser_lv1[i].s += 0.05; count++; DefSpriteEx(16, 16, 16); // PutSprite(count, laser_lv1[i].x, laser_lv1[i].y, 16); PutSpriteEx(16, laser_lv1[i].x, laser_lv1[i].y, laser_lv1[i].s, laser_lv1[i].s, 1); } if (waku(laser_lv1[i].x, laser_lv1[i].y)) { if (laser_lv1_end == i) { laser_lv1_end--; break; } if (laser_lv1_end > i) { laser_lv1[i] = laser_lv1[laser_lv1_end]; laser_lv1_end--; i--; } } } /*レーザーレベル2登録------------------------------- */ if ((pad[0].k1 == 0) && (pad[0].k0 != 0) && (lg.stg > 200)) { PlaySdlMixer(0, NEW) ;// SHIELD if (laser_lv2[0].r == 0) { laser_lv2[0].r = 1; lg.stg -= 100; } else { laser_lv2[0].r %= 45; laser_lv2[0].r++; lg.stg -= 10; } } else { laser_lv2[0].r = 0; } /*------------------------------------*/ if (laser_lv2[0].r != 0) { laser_lv2[0].x = jiki.x + 128 + 256 * Mysin(jiki.point) / SANKAKU; laser_lv2[0].y = jiki.y + 128 - 256 * Mycos(jiki.point) / SANKAKU; count++; // PutSprite(count, laser_lv2[0].x, laser_lv2[0].y, 17); PutSpriteEx(17, laser_lv2[0].x, laser_lv2[0].y, 2, 2, laser_lv2[0].r * 8); } /*ここに特殊兵器ボムの関数をよろしく*/ /*発射準備 (laser_lv3[playerno][0] は、爆発発生の種。)*/ if ((pad[0].k1 > 0) && (pad[0].k0 > 0) && (lg.stg > 2400) && (laser_lv3[0].r > 61)) { PlaySdlMixer(0, BOM) ;// BOM //se_voice[0] = SsUtKeyOn(vab[LASER_C], 0, 0, 65, 0, 70, 70); laser_lv3[0].x = jiki.x + 256 * Mysin(jiki.point) / SANKAKU; laser_lv3[0].y = jiki.y - 256 * Mycos(jiki.point) / SANKAKU; laser_lv3[0].r = 0; lg.stg -= 2400; jiki.muteki = 60; } if (laser_lv3[0].r < 62) { /*ボムフラグ継続か */ laser_lv3[0].r++; if (laser_lv3[0].r % 2 == 0) { /*爆風発生 */ laser_lv3[1 + laser_lv3[0].r / 2].r = 8; laser_lv3[1 + laser_lv3[0].r / 2].x = laser_lv3[0].x + rand() % 640 - 320; laser_lv3[1 + laser_lv3[0].r / 2].y = laser_lv3[0].y + rand() % 640 - 320; } } /*ボムノアニメーション */ for (i = 1; i < 32; i++) { if (laser_lv3[i].r > 0) { laser_lv3[i].r--; count++; // PutSprite(count, laser_lv3[i].x, laser_lv3[i].y, // 47 - (laser_lv3[i].r)); PutSpriteEx(47 - (laser_lv3[i].r), laser_lv3[i].x, laser_lv3[i].y, 4, 4, 1); } } }