Mercurial > hg > Members > kono > tree_dandy2
changeset 1:92dccc071a24
fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 07 Dec 2010 16:02:45 +0900 |
parents | 01387a2e419e |
children | 6d7a880b02ef |
files | Enemy.c atari.c back.c back.h make.c move.c move.h scheduletest.c tama.c tama.h testgl.c testgl.h |
diffstat | 11 files changed, 0 insertions(+), 2166 deletions(-) [+] |
line wrap: on
line diff
--- a/Enemy.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#include "Enemy.h" -#include"syokika.h" - -int filpcount = 0; -int stage = 0; - -teki enemy[300]; -teki *e; -BOOL tf = FALSE; - -#define ENEMY_STATUS(id,charno,score,hardness) {charno,score,hardness} -const state enemystate[] = ENEMY_STATUS_TABLE; - -void TFon() -{ - tf = TRUE; -} - -void TFoff() -{ - tf = FALSE; -} - -void Putenemy(int charno, float x, float y, float sx, float sy, int move) -{ - int ii = 0; - e = &enemy[0]; - while ((e->f) == TRUE) { - ii++; - if (ii == 100) - return; - e++; - } - e->x = x; - e->y = y; - e->sx = sx; - e->sy = sy; - e->charno = enemystate[charno].charno; - e->f = TRUE; - e->p = enemystate[charno].p; - e->move = move; - e->sc = enemystate[charno].sc; - e->dt1 = e->dt2 = 0; - e->tama = tf; -} - -void -Putenemyb(int b, int charno, float x, float y, float sx, float sy, - int move) -{ - //int ii=0; - e = &enemy[b]; - e->x = x; - e->y = y; - e->sx = sx; - e->sy = sy; - e->charno = enemystate[charno].charno; - e->f = TRUE; - e->p = enemystate[charno].p; - e->move = move; - e->sc = enemystate[charno].sc; - e->dt1 = e->dt2 = 0; - e->tama = tf; -}
--- a/atari.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -#include <SDL.h> -#include "atari.h" -#include "bom.h" -#include "count2.h" -#include "sound.h" -#include "Enemy.h" -//#include "libps.h" - -//#include<libps.h> -#include "SDL_image.h" -//#include "libps2.h" -#include "SDL_opengl.h" -//#include "texture.h" -#include "object.h" -//#include "tree_controll.h" -#include "sgoex.h" -//#include "trace.h" -//#include "syokika.h" -//#include "LoadSprite.h" - - -extern SpriteTable sptable[DEFOBJ]; - - -int atari(int playerno, int enemyno) -{ - int i1, i2, h, w, ex, ey, charno; - int n; - ex = enemy[enemyno].x; - ey = enemy[enemyno].y; - charno = enemy[enemyno].charno; - w = sptable[charno].w; - h = sptable[charno].h; - i2 = playerno; - - - //自機やられ -#ifndef INVISIBLE_MODE - if ((ex < jiki.x + 128 / 2) && (ex + w > jiki.x + 128 / 2) - && (ey < jiki.y + 128 / 2) && (ey + h > jiki.y + 128 / 2) - && jiki.muteki == 0) { - //se_voice[0] = SsUtKeyOn(vab[JIKIOUT], 0, 0, 65, 0, 60, 60); - Bom(jiki.x + 16, jiki.y + 16); - jiki.bf = FALSE; - jiki.zanki--; - jiki.muteki = 120; - - infg.stg = 0; - infg_level--; - if (infg_level < 0) - infg_level = 0; - - return (0); - } -#endif - - if (enemy[enemyno].tama == TRUE) - goto jumping; - for (i1 = 0; i1 < tama_lv1_end + 1; i1++) { - - if ((tama_lv1[i1].x + 64 + 64 > ex) - && (ex + w > tama_lv1[i1].x + 16) - && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h) - && (tama_lv1[i1].r != -1)) { - tama_lv1[i1].r = -1; - enemy[enemyno].p -= TAMALV1P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - if ((tama_lv1[i1].x + 64 > ex) && (ex + w > tama_lv1[i1].x) - && (tama_lv1[i1].y + 128 > ey) && (tama_lv1[i1].y < ey + h) - && (tama_lv1[i1].l != -1)) { - tama_lv1[i1].l = -1; - enemy[enemyno].p -= TAMALV1P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - } - - for (i1 = 0; i1 < tama_lv2_end + 1; i1++) { - if ((tama_lv2[i1].x + 128 + 64 > ex) - && (ex + w > tama_lv2[i1].x + 128) - && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h) - && (tama_lv2[i1].rr != -1)) { - tama_lv2[i1].rr = -1; - enemy[enemyno].p -= TAMALV2P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - - if ((tama_lv2[i1].x + 64 + 64 > ex) - && (ex + w > tama_lv2[i1].x + 16) - && (tama_lv2[i1].y - 32 + 192 > ey) - && (tama_lv2[i1].y - 32 < ey + h) - && (tama_lv2[i1].sr != -1)) { - tama_lv2[i1].sr = -1; - enemy[enemyno].p -= TAMALV2P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - if ((tama_lv2[i1].x + 64 > ex) && (ex + w > tama_lv2[i1].x) - && (tama_lv2[i1].y - 32 + 192 > ey) - && (tama_lv2[i1].y - 32 < ey + h) - && (tama_lv2[i1].sl != -1)) { - tama_lv2[i1].sl = -1; - enemy[enemyno].p -= TAMALV2P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - if ((tama_lv2[i1].x - 64 + 64 > ex) - && (ex + w > tama_lv2[i1].x - 64) - && (tama_lv2[i1].y + 192 > ey) && (tama_lv2[i1].y < ey + h) - && (tama_lv2[i1].ll != -1)) { - tama_lv2[i1].ll = -1; - enemy[enemyno].p -= TAMALV2P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - } - if ((tlv3[0].r > 0) && (jiki.x < ex + w) && (jiki.x + 128 > ex) - && (jiki.y > ey + h)) { - enemy[enemyno].p -= TAMALV3P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - jumping: - if ((tlv3[0].r > 0) && (jiki.x < ex + w) && (jiki.x + 128 > ex) - && (jiki.y + 128 > ey) && (jiki.y < ey + h)) { - enemy[enemyno].p -= TAMALV3P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - /*laser lv1 */ - for (i1 = 0; i1 < laser_lv1_end + 1; i1++) { - n = laser_lv1[i1].r * 128 / 4096; - - if ((laser_lv1[i1].x + n > ex) && (ex + w > laser_lv1[i1].x) - && (laser_lv1[i1].y + n > ey) && (laser_lv1[i1].y < ey + h) - && (laser_lv1[i1].r != -1)) { - laser_lv1[i1].r = -1; - laser_lv1[i1].y = -1; - enemy[enemyno].p -= LASERLV1P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - } - /*shield(laser lv2) */ - if ((enemy[enemyno].tama == TRUE) && (lg.stg > 0) && - (laser_lv2[0].x + 128 > ex) && (ex + w > laser_lv2[0].x - 128) - && (laser_lv2[0].y + 128 > ey) && (laser_lv2[0].y - 128 < ey + h) - && (laser_lv2[0].r != 0)) { - enemy[enemyno].p -= LASERLV2P; - lg.stg -= 26; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - /*bomber(laser lv3) */ - if (laser_lv3[0].r < 62) { - for (i1 = 1; i1 < 128; i1++) { - if ((laser_lv3[i1].x + 128 > ex) && (ex + w > laser_lv3[i1].x) - && (laser_lv3[i1].y + 128 > ey) - && (laser_lv3[i1].y < ey + h) - && (laser_lv3[i1].r > 0)) { - tama_lv2[i1].rr = -1; - enemy[enemyno].p -= LASERLV3P; - infg.stg++; - if (enemy[enemyno].p <= 0) { - infg.stg += 4; - return 1; - } - } - } - } - return (0); -}
--- a/back.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include <stdlib.h> -#include <SDL.h> -//#include "libps.h" -#include "back.h" -#include "debug.h" - -//GsBOXF *boxs, box[BOX_NUM]; - -//BOXDT boxdt[BOX_NUM]; - -void Back(GsOT * j) -{ - int i1; - - for (i1 = 0; i1 < BOX_NUM - 1; i1++) { - boxdt[i1].y += boxdt[i1].s; - if (boxdt[i1].y > 240) { - boxdt[i1].x = rand() % 320; - boxdt[i1].y = 0; - } - } - - boxs = box; - for (i1 = 1; i1 < BOX_NUM - 1; i1++, boxs++) { - boxs->attribute = 0; - boxs->x = boxdt[i1].x; - boxs->y = boxdt[i1].y; - boxs->w = 1; - boxs->h = 1; - boxs->r = rand() % 256; - boxs->g = rand() % 256; - boxs->b = rand() % 256; - GsSortBoxFill(boxs, j, 0); - } -}
--- a/back.h Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#ifndef _BACK_H_ -#define _BACK_H_ - -#define BOX_NUM 11 - -//extern GsBOXF *boxs, box[BOX_NUM]; - -typedef - struct boxdt { - int x; - int y; - int s; -} BOXDT; - -//extern void Back(GsOT * j); -extern BOXDT boxdt[BOX_NUM]; - -#endif // _BACK_H_
--- a/move.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,963 +0,0 @@ -#include <stdlib.h> -#include <SDL.h> -//#include "libps2.h" -#include "move.h" -#include "Enemy.h" -#include "count2.h" -#include "tokuten.h" -#include "schedule.h" -#include "bom.h" -#include "sankaku.h" -//#include "libps.h" -#include "sgoex.h" -#include "atari.h" -#include"debug.h" -#include "SDL_opengl.h" -extern SpriteView spview[MAXOBJ]; - - -int tekino0; -int rinkx; -int rinky; -int rinkf1 = 0, rinkf2 = 0; -int asteroiddt[200]; -int asteroidi = 0; -int enemyfaste = 0; -int sf; -int amari; -int fastebos = 0; - -void asteroid(int tekino); - -void Move() -{ - int tekino; - - for (tekino = 0; tekino < 100; tekino++) { - if (enemy[tekino].f == TRUE) { - if ((enemy[tekino].move != 8) && - (enemy[tekino].move != 9)) - if (jiki.bf == TRUE) - if (atari(0, tekino)) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - enemycount += (enemy[tekino].sc * - ((infg.stg / 128) + infg_level + 1)); - } - if (enemy[tekino].f == TRUE); - switch (enemy[tekino].move) { - case 0: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - break; - case 1: - enemy[tekino].x -= enemy[tekino].sx; - enemy[tekino].y -= enemy[tekino].sy; - break; - case 2: - enemy[tekino].sy -= 0.25; - enemy[tekino].y += enemy[tekino].sy; - break; - case 3: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - if ((enemy[tekino].dt1 == 60) || - (enemy[tekino].dt1 == 90) || - (enemy[tekino].dt1 == 30)) - Puttama(0, enemy[tekino].x, enemy[tekino].y); - enemy[tekino].dt1++; - break; - case 4: - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].x += enemy[tekino].sx; - if (enemy[tekino].y < jiki.y - && enemy[tekino].y + 16 > jiki.y) { - enemy[tekino].sy = -2; - enemy[tekino].sx = - ((jiki.x > enemy[tekino].x) ? 4 : -4); - enemy[tekino].move = 7; - } - break; - case 5: - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].x += enemy[tekino].sx; - if (enemy[tekino].y + 96 < jiki.y - && enemy[tekino].y + 128 > jiki.y) { - enemy[tekino].sy = -2; - enemy[tekino].sx = - ((jiki.x > enemy[tekino].x) ? 4 : -4); - enemy[tekino].move = 0; - } - break; - case 6: - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].x += enemy[tekino].sx; - if (enemy[tekino].y + 96 < jiki.y - && enemy[tekino].y + 128 > jiki.y) { - enemy[tekino].sy = 2; - enemy[tekino].sx = - ((jiki.x > enemy[tekino].x) ? 4 : -4); - enemy[tekino].move = 0; - } - break; - - case 7: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - if ((enemy[tekino].dt1 == 60) || (enemy[tekino].dt1 == 90) - || (enemy[tekino].dt1 == 30)) - Puttama(1, enemy[tekino].x, enemy[tekino].y); - enemy[tekino].dt1++; - break; -////////1面中ボスパターン///////////////////////////////// - case 8: /*8から11まで登場パターン */ - if (enemy[tekino].y < 520) { - tekino0 = tekino; - kyeenemyno = tekino; - enemy[tekino].y += enemy[tekino].sy; - count++; - DefSpriteEx(enemy[tekino].charno, 16*4, 32*4); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, - // enemy[tekino].charno); - PutSpriteEx(enemy[tekino].charno, enemy[tekino].x*4, enemy[tekino].y*4, 0.2, 0.2, 1); - enemy[tekino].dt1 = 512; - enemy[tekino].s = 0.125; - goto putout; - } - enemy[tekino].move = 9; - case 9: - if (enemy[tekino].s <= 2) { - enemy[tekino].s += 0.05; - enemy[tekino].y -= 12; - count++; - DefSpriteEx(54, 16*4, 32*4); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, 54); - PutSpriteEx(54, enemy[tekino].x*4, enemy[tekino].y*4, enemy[tekino].s, enemy[tekino].s, 1); - goto putout; - } - count++; - DefSpriteEx(54, 16, 32); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, 54); - PutSpriteEx(54, enemy[tekino].x, enemy[tekino].y, enemy[tekino].s, enemy[tekino].s, 1); - - rinkx = enemy[tekino].x; - rinky = enemy[tekino].y; - Putenemy(5, rinkx - 16, rinky - 16, 1, 0, 10); - Putenemy(5, rinkx - 16, rinky - 16, -1, 0, 10); - enemy[tekino].move = 11; - enemy[tekino].dt1 = 8192; - goto putout; - case 10: - if (enemy[tekino].dt1 < 48) { - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].dt1++; - break; - } - rinkf1 = 1; - enemy[tekino].dt1 = rinkx; - enemy[tekino].dt2 = rinky; - enemy[tekino].move = 13; - break; - case 11: - if (rinkf1 == 0) { - count++; - DefSpriteEx(54, 16, 32); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, 54); - PutSpriteEx(54, enemy[tekino].x, enemy[tekino].y, enemy[tekino].s, enemy[tekino].s, 1); - goto putout; - } - enemy[tekino].dt1 = 0; - enemy[tekino].dt2 = 0; - enemy[tekino].move = 12; - break; - case 12: - if (fastebos > 60 * 60) { - if (enemy[tekino].y > 240 + 32) - enemy[tekino].f = FALSE; - enemy[tekino].y += 3; - rinky += 3; - count++; - DefSpriteEx(54, 16, 32); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, 54); - PutSpriteEx(54, enemy[tekino].x, enemy[tekino].y, 2, 2, 1); - goto putout; - } - if (enemy[tekino].dt1 <= 60) { - if (jiki.x + 15 - rinkx < -5) - enemy[tekino].sx = -0.8; - else if (jiki.x + 15 - rinkx > 5) - enemy[tekino].sx = +0.8; - else - enemy[tekino].sx = 0; - enemy[tekino].x += enemy[tekino].sx; - rinkx = enemy[tekino].x; - rinky = enemy[tekino].y; - } - if ((enemy[tekino].dt1 > 60) && (enemy[tekino].dt1 <= 70)) { - if (enemy[tekino].dt1 % 2 == 1) { - Puttama(0, rinkx - 16, rinky); - Puttama(0, rinkx, rinky); - Puttama(0, rinkx + 16, rinky); - } - } - if ((enemy[tekino].dt1 > 180) - && (enemy[tekino].dt1 <= 240)) { - if (enemy[tekino].dt1 % 2 == 1) { - rinkf2 = 1; - Puttama(2, rinkx - 16, enemy[tekino].y - 32); - Puttama(3, rinkx + 32 - 16, enemy[tekino].y - 32); - } else - rinkf2 = 0; - } - if (enemy[tekino].dt1 > 240) { - rinkf2 = 2; - } - if ((enemy[tekino].dt1 > 240) - && (enemy[tekino].dt1 <= 400)) { - count++; - PutSprite(count, rinkx - 16, rinky + 32, - 58 + enemy[tekino].dt1 % 4); - } - if ((enemy[tekino].dt1 > 300) - && (enemy[tekino].dt1 <= 400)) { - rinkf2 = 3; - if (jiki.x + 15 - rinkx < -5) - enemy[tekino].sx = -1; - else if (jiki.x + 15 - rinkx > 5) - enemy[tekino].sx = +1; - else - enemy[tekino].sx = 0; - enemy[tekino].x += enemy[tekino].sx; - rinkx = enemy[tekino].x; - rinky = enemy[tekino].y; - Puttama(4, rinkx - 8, rinky + 16); - } - if ((enemy[tekino].dt1 > 400) - && (enemy[tekino].dt1 <= 500)) { - rinkf2 = 4; - if (jiki.x + 15 - rinkx < -5) - enemy[tekino].sx = -1; - else if (jiki.x + 15 - rinkx > 5) - enemy[tekino].sx = +1; - else - enemy[tekino].sx = 0; - enemy[tekino].x += enemy[tekino].sx; - rinkx = enemy[tekino].x; - rinky = enemy[tekino].y; - } - if (enemy[tekino].dt1 > 500) { - rinkf2 = 5; - if (jiki.x + 15 - rinkx < -5) - enemy[tekino].sx = -1; - else if (jiki.x + 15 - rinkx > 5) - enemy[tekino].sx = +1; - else - enemy[tekino].sx = 0; - enemy[tekino].x += enemy[tekino].sx; - rinkx = enemy[tekino].x; - rinky = enemy[tekino].y; - } - if (enemy[tekino].dt1 > 600) { - rinkf2 = 0; - enemy[tekino].dt1 = 0; - } - fastebos++; - enemy[tekino].dt1++; - count++; - DefSpriteEx(54, 16, 32); - // PutSprite(count, enemy[tekino].x, enemy[tekino].y, 54); - PutSpriteEx(54, enemy[tekino].x, enemy[tekino].y, 2, 2, 1); - goto putout; - case 13: - if (enemy[tekino0].f == FALSE) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - enemy[tekino].x += rinkx - enemy[tekino].dt1; - enemy[tekino].y += rinky - enemy[tekino].dt2; - enemy[tekino].dt1 = rinkx; - enemy[tekino].dt2 = rinky; - if (rinkf2 == 1) { - if (enemy[tekino].x > rinkx) { - Puttama(2, enemy[tekino].x + 32, enemy[tekino].y); - } - if (enemy[tekino].x < rinkx) { - Puttama(3, enemy[tekino].x, enemy[tekino].y); - } - } - if (rinkf2 == 4) { - count++; - PutSprite(count, enemy[tekino].x, enemy[tekino].y + 56, - 58 + filpcount % 4); - } - if (rinkf2 == 5) { - if (enemy[tekino].x > rinkx) { - Puttama(5, enemy[tekino].x + 8, - enemy[tekino].y + 24); - } - if (enemy[tekino].x < rinkx) { - Puttama(5, enemy[tekino].x + 8, - enemy[tekino].y + 24); - } - } - break; - case 20: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].sx -= 0.5; //-=1; - enemy[tekino].sy += 0.4; //+=0.8; - break; - case 21: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - enemy[tekino].sx += 0.5; //+=1; - enemy[tekino].sy += 0.4; //+=0.8; - break; -///////////ここまで/////////////////////// - case 22: - sf = rand() % 4; - if ((sf == 0) || (sf == 1)) { - enemy[tekino].x = -35; - enemy[tekino].y = rand() % (120 - 35); - enemy[tekino].sx = (rand() % 4 + 1); - enemy[tekino].sy = rand() % 3 - 1; - enemy[tekino].move = 23; - } - if ((sf == 2)) { - enemy[tekino].x = rand() % 290; - enemy[tekino].y = -30; - enemy[tekino].sx = rand() % 3 - 1; - enemy[tekino].sy = (rand() % 4 + 1); - enemy[tekino].move = 23; - } - if (sf == 3) { - enemy[tekino].x = 320; - enemy[tekino].y = rand() % (120 - 35); - enemy[tekino].sx = (rand() % 4 + 1) * -1; - enemy[tekino].sy = rand() % 3 - 1; - enemy[tekino].move = 23; - } - break; - case 23: - asteroid(tekino); - break; - //////////////////////////////////////// - case 24: - kyeenemyno = tekino; - tekino0 = 0; - rinkx = 0; - rinky = 0; - rinkf1 = 0; - rinkf2 = 0; - enemy[tekino].move = 25; - break; - case 25: - if (enemy[tekino].dt1 <= 360) { - enemy[tekino].x = - Mycos(enemy[tekino].dt1) * 30 / SANKAKU + 82 + 32; - enemy[tekino].y = - Mysin(enemy[tekino].dt1) * 30 / SANKAKU + 30; - } - if (enemy[tekino].dt1 > 360) { - enemy[tekino].x = - Mycos(enemy[tekino].dt1) * 30 * -1 / SANKAKU + - 142 + 32; - enemy[tekino].y = - Mysin(enemy[tekino].dt1) * 30 / SANKAKU + 30; - } - count++; - PutSprite(count, enemy[tekino].x - 42, enemy[tekino].y, - 64); - amari = rand() % 160; - if ((amari == 1) && (enemy[kyeenemyno + 5].f == TRUE)) { - enemy[tekino].move = 26; //バルカンパターン - rinkf1 = 1; - } - if ((amari == 2) && (enemy[kyeenemyno + 1].f == TRUE)) { - enemy[tekino].move = 27; //ロケットパンチパターン - rinkf1 = 5; - rinkx = 0; - break; - } - if ((enemy[kyeenemyno + 5].f != TRUE) - && (enemy[kyeenemyno + 1].f != TRUE)) - enemy[tekino].move = 28; - enemy[tekino].dt1 += 3; - if (enemy[tekino].dt1 == 720) - enemy[tekino].dt1 = 0; - break; - case 26: //バルカンパターン - if ((enemy[tekino].dt2 > 50) && (enemy[tekino].dt2 < 100)) { - rinkf1 = 2; - } - if (enemy[tekino].dt2 > 100) - rinkf1 = 3; - if (enemy[tekino].dt2 == 400) - rinkf1 = 4; - count++; - PutSprite(count, enemy[tekino].x - 42, enemy[tekino].y, - 64); - if (enemy[tekino].dt2 == 401) { - enemy[tekino].dt2 = 0; - rinkf1 = 0; - enemy[tekino].move = 25; - break; - } - enemy[tekino].dt2++; - break; - case 27: //ロケットパンチパターン - if ((enemy[tekino].dt2 > 50) && (enemy[tekino].dt2 < 60) - && (enemy[tekino].x > -24) - && (enemy[tekino].y > -24)) { - rinkf1 = 6; - rinkx -= 4; - enemy[tekino].x -= 4; - enemy[tekino].y -= 4; - } - if (enemy[tekino].dt2 == 80) { - rinkf1 = 7; - } - if (enemy[tekino].dt2 == 81) { - rinkf1 = 8; - } - if (enemy[tekino].dt2 == 124) { - rinkf1 = 9; - } - - if (enemy[tekino].dt2 == 400) { - rinkf1 = 10; - } - if (enemy[tekino].dt2 == 444) { - rinkf1 = 11; - } - if (enemy[tekino].dt2 == 500) { - rinkf1 = 12; - } - if ((enemy[tekino].dt2 > 80) && (enemy[tekino].dt2 < 200)) - if ((rinkx != 0) && (enemy[tekino].dt2 % 2 == 1)) { - rinkx++; - enemy[tekino].x++; - enemy[tekino].y++; - } - count++; - PutSprite(count, enemy[tekino].x - 32, enemy[tekino].y, 6); - if (rinkf1 == 12) { - enemy[tekino].dt2 = 0; - rinkf1 = 0; - rinkx = 0; - enemy[tekino].move = 25; - break; - } - enemy[tekino].dt2++; - break; - case 28: - if (enemy[tekino].dt1 <= 360) { - enemy[tekino].x = - Mycos(enemy[tekino].dt1) * 30 / SANKAKU + 82 + 32; - enemy[tekino].y = - Mysin(enemy[tekino].dt1) * 30 / SANKAKU + 30; - } - if (enemy[tekino].dt1 > 360) { - enemy[tekino].x = - Mycos(enemy[tekino].dt1) * 30 * -1 / SANKAKU + - 142 + 32; - enemy[tekino].y = - Mysin(enemy[tekino].dt1) * 30 / SANKAKU + 30; - } - count++; - PutSprite(count, enemy[tekino].x - 42, enemy[tekino].y, - 64); - if (enemy[tekino].dt1 % 30 == 3) - Putenemy(24, enemy[tekino].x + 14, - enemy[tekino].y + 14, - (rand() % 5 + 0.5) * (rand() % 2 == - 1 ? -1 : 1), - (rand() % 5 + 0.5) * (rand() % 2 == - 1 ? -1 : 1), 29); - enemy[tekino].dt1 += 3; - break; - case 29: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - if (enemy[tekino].dt1 % 18 == 1) - Puttama(0, enemy[tekino].x, enemy[tekino].y); - enemy[tekino].dt1++; - break; - case 30: //本体 - enemy[tekino].x = enemy[kyeenemyno].x - 32; - enemy[tekino].y = enemy[kyeenemyno].y; - break; - case 31: //右腕 - if ((enemy[kyeenemyno + 3].f == FALSE) - || (kyeenemyno == -1)) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - break; - } - - if (rinkf1 == 0) { - enemy[tekino].x = enemy[kyeenemyno].x + 40; - enemy[tekino].y = enemy[kyeenemyno].y + 28; - enemy[tekino].dt2 = 0; - } - if (rinkf1 == 5) { - enemy[tekino].x = enemy[kyeenemyno].x + 52; - enemy[tekino].y = enemy[kyeenemyno].y; - count++; - PutSprite(count, enemy[tekino].x - 4, - enemy[tekino].y - 20, - 80 + enemy[tekino].dt2 % 4); - enemy[tekino].dt2++; - } - if (rinkf1 == 6) { - if (enemy[tekino].y < 240 - 48) { - enemy[tekino].y += 6; - } else { - // rinkf1=7; - break; - } - count++; - PutSprite(count, enemy[tekino].x - 4, - enemy[tekino].y - 20, - 90 + enemy[tekino].dt2 % 4); - enemy[tekino].dt2++; - } - if (rinkf1 == 7) { - Putenemy(22, enemy[tekino].x + 14, - enemy[tekino].y + 14, 0, 0, 40); - // rinkf1=8; - break; - } - if (rinkf1 == 11) { - if (enemy[kyeenemyno].y + 20 != enemy[tekino].y) { - enemy[tekino].y--; - } else { - // rinkf1=12; - break; - } - count++; - PutSprite(count, enemy[tekino].x + 8, - enemy[tekino].y + 44, - 58 + enemy[tekino].dt2 % 4); - enemy[tekino].dt2++; - } - break; - case 32: //左腕 - if ((enemy[kyeenemyno + 4].f == FALSE) - || (kyeenemyno == -1)) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - break; - } - enemy[tekino].x = enemy[kyeenemyno].x - 40; - enemy[tekino].y = enemy[kyeenemyno].y + 28; - if (rinkf1 == 5) { - enemy[tekino].x = enemy[kyeenemyno].x - 24 + 4; - enemy[tekino].y = enemy[kyeenemyno].y + 28; - enemy[tekino].charno = enemystate[20].charno; - } - if (rinkf1 == 11) { - enemy[tekino].charno = enemystate[14].charno; - } - if (rinkf1 == 7) { - Putenemy(23, enemy[tekino].x + 14, - enemy[tekino].y + 14, 0, 0, 41); - // rinkf1=8; - break; - } - break; - case 33: //右肩 - if ((enemy[kyeenemyno].f == FALSE) || (kyeenemyno == -1)) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - enemy[tekino].x = enemy[kyeenemyno].x + 32; - enemy[tekino].y = enemy[kyeenemyno].y; - if (rinkf1 == 5) { - enemy[tekino].x = enemy[kyeenemyno].x + 32 - 4; - enemy[tekino].y = enemy[kyeenemyno].y; - enemy[tekino].charno = enemystate[19].charno; - } - if (rinkf1 == 6) { - enemy[tekino].charno = enemystate[11].charno; - } - break; - case 34: //左肩 - if ((enemy[kyeenemyno].f == FALSE) || (kyeenemyno == -1)) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - enemy[tekino].x = enemy[kyeenemyno].x - 32; - enemy[tekino].y = enemy[kyeenemyno].y; - if (rinkf1 == 5) { - enemy[tekino].charno = enemystate[21].charno; - } - if (rinkf1 == 6) { - enemy[tekino].charno = enemystate[12].charno; - } - break; - case 35: //胸 - if (kyeenemyno == -1) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - enemy[tekino].x = enemy[kyeenemyno].x; - enemy[tekino].y = enemy[kyeenemyno].y + 32; - if (rinkf1 == 1) { - enemy[tekino].charno = enemystate[16].charno; - } - if (rinkf1 == 2) { - count++; - PutSprite(count, enemy[tekino].x - 10, - enemy[tekino].y + 16, - 58 + enemy[tekino].dt2 % 4); - count++; - PutSprite(count, enemy[tekino].x + 10, - enemy[tekino].y + 16, - 58 + enemy[tekino].dt2 % 4); - enemy[tekino].dt2++; - } - if (rinkf1 == 3) { - count++; - PutSprite(count, enemy[tekino].x - 10, - enemy[tekino].y + 16, - 58 + enemy[tekino].dt2 % 4); - count++; - PutSprite(count, enemy[tekino].x + 10, - enemy[tekino].y + 16, - 58 + enemy[tekino].dt2 % 4); - if (enemy[tekino].dt2 % 20 == 1) { - Puttama(7, enemy[tekino].x, enemy[tekino].y + 16); - Puttama(7, enemy[tekino].x + 20, - enemy[tekino].y + 16); - } - enemy[tekino].dt2++; - } - if (rinkf1 == 4) { - enemy[tekino].charno = enemystate[15].charno; - enemy[tekino].dt2 = 0; - } - break; - case 40: //アームバルカン - if (enemy[kyeenemyno + 1].f == FALSE) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - if ((rinkf1 == 8) && (enemy[tekino].dt1 % 3 == 1)) { - if ((enemy[tekino].dt2 < 16)) { - enemy[tekino].dt2++; - DefSprite(76, 1, 112, 0, 16, enemy[tekino].dt2, - 480); - } else { - // rinkf1=9; - break; - } - } - if (rinkf1 == 9) { - if (enemy[tekino].dt1 % 15 == 1) { - Puttama(8, enemy[tekino].x, enemy[tekino].y); - } - } - if (rinkf1 == 10) { - if (enemy[tekino].dt2 != 0) { - enemy[tekino].dt2--; - DefSprite(76, 1, 112, 0, 16, enemy[tekino].dt2, - 480); - } else { - enemy[tekino].f = FALSE; - // rinkf1=11; - } - } - enemy[tekino].dt1++; - break; - case 41: //左腕アップアームバルカン - if (enemy[kyeenemyno + 2].f == FALSE) { - Bom(enemy[tekino].x, enemy[tekino].y); - enemy[tekino].f = FALSE; - } - enemy[tekino].x = enemy[kyeenemyno].x - 20 - 7; - enemy[tekino].y = enemy[kyeenemyno].y + 28 + 15; - if ((rinkf1 == 8) && (enemy[tekino].dt1 % 3 == 1)) { - if ((enemy[tekino].dt2 < 16)) { - enemy[tekino].dt2++; - DefSprite(77, 1, 112, 16, enemy[tekino].dt2, 16, 480); /*左腕アップアーム砲 */ - } else { - rinkf1 = 9; - break; - } - } - if (rinkf1 == 9) { - if (enemy[tekino].dt1 % 15 == 1) { - Puttama(9 + rand() % 2, enemy[tekino].x, - enemy[tekino].y); - } - } - if (rinkf1 == 10) { - if (enemy[tekino].dt2 != 0) { - enemy[tekino].dt2--; - DefSprite(77, 1, 112, 16, enemy[tekino].dt2, 16, - 480); - } else { - enemy[tekino].f = FALSE; - // rinkf1=11; - } - } - enemy[tekino].dt1++; - break; - case 400: - enemy[tekino].sy++; - enemy[tekino].y += enemy[tekino].sy / 4; - break; - case 401: - enemy[tekino].sx++; - enemy[tekino].x += enemy[tekino].sx / 8; - if (enemy[tekino].x > (jiki.x - 32)) { - enemy[tekino].sy--; - } - enemy[tekino].y += enemy[tekino].sy / 8; - if (enemy[tekino].dt1 % 50 == 37) { - Puttama(1, enemy[tekino].x + 8, enemy[tekino].y + 24); - } - enemy[tekino].dt1++; - break; - case 402: - enemy[tekino].sx--; - enemy[tekino].x += enemy[tekino].sx / 8; - if (enemy[tekino].x < (jiki.x + 32)) { - enemy[tekino].sy--; - } - enemy[tekino].y += enemy[tekino].sy / 8; - if (enemy[tekino].dt1 % 50 == 37) { - Puttama(1, enemy[tekino].x + 8, enemy[tekino].y + 24); - } - enemy[tekino].dt1++; - break; - case 410: - kyeenemyno = tekino; - case 411: - if (enemy[tekino].dt2 > 356) - enemy[tekino].sx = -1; - if (enemy[tekino].dt2 < -398) - enemy[tekino].sx = 1; - if ((enemy[tekino].dt1) % 62 == 0) - Putenemy(41, - enemy[tekino].x, - enemy[tekino].y, - (int) -Mycos(enemy[tekino].dt1 / 16) * 4 / - SANKAKU, - (int) -Mysin(enemy[tekino].dt1 / 16) * 4 / - SANKAKU, 7); - if ((enemy[tekino].dt1) % 13 == 0) - Puttama(11, enemy[tekino].x + 32, - enemy[tekino].y + 32); - - enemy[tekino].dt2 += enemy[tekino].sx; - enemy[tekino].dt1 += enemy[tekino].dt2 / 4; - - enemy[tekino].x = jiki.x - 16 + - Mycos(enemy[tekino].dt1 / 16) * 128 / SANKAKU; - enemy[tekino].y = jiki.y - 16 + - Mysin(enemy[tekino].dt1 / 16) * 128 / SANKAKU; - if (enemy[tekino].x < 0) - enemy[tekino].x = 0; - if (enemy[tekino].x > 260) - enemy[tekino].x = 260; - if (enemy[tekino].y < 0) - enemy[tekino].y = 0; - if (enemy[tekino].y > 232) - enemy[tekino].y = 232; - break; - case 500: - enemy[tekino].s = 0; - - kyeenemyno = tekino; - enemy[tekino].dt2++; - enemy[tekino].dt2 %= 512; - enemy[tekino].dt1++; - count++; - DefSpriteEx(100, 16, 16); - // PutSprite(count, enemy[tekino].x + 16, - // enemy[tekino].y + 16, 100); - PutSpriteEx(100, enemy[tekino].x + 16, enemy[tekino].y + 16, 2, 2, enemy[tekino].dt1); - - if (enemy[tekino].dt1 % (5 + enemy[tekino].dt2 / 8) == 1) { - if (rand() % 2 == 1) - Putenemy(24, enemy[tekino].x, enemy[tekino].y, - (rand() % 5 + 0.5) * (rand() % 2 == - 1 ? -1 : 1), - (rand() % 5 + 0.5) * (rand() % 2 == - 1 ? -1 : 1), 501); - else - Putenemy(rand() % 2 + 1, enemy[tekino].x, - enemy[tekino].y, - (int) Mycos(enemy[tekino].dt1 / 4) * 4 / - SANKAKU, - (int) -Mysin(enemy[tekino].dt1 / 4) * 4 / - SANKAKU, 501); - } - if (enemy[tekino].dt1 == 50) { - /*Putenemy(44,0,0,1,1,411); */ - } - goto putout; - case 501: - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - if (enemy[tekino].dt1 % 32 == 1) - Puttama(11, enemy[tekino].x, enemy[tekino].y); - enemy[tekino].dt1++; - break; - case 600: - kyeenemyno = tekino; - enemy[tekino].dt1 += 30; - enemy[tekino].dt2++; - enemy[tekino].dt1 %= 360; - enemy[tekino].x += Mycos(enemy[tekino].dt1) * 4 / SANKAKU; - enemy[tekino].y += Mysin(enemy[tekino].dt1) * 4 / SANKAKU; - Puttama(11, enemy[tekino].x + 16, enemy[tekino].y + 16); - Puttama(11, enemy[tekino].x + 32, enemy[tekino].y + 48); - Puttama(11, enemy[tekino].x + 48, enemy[tekino].y + 16); - if (enemy[tekino].dt2 > 240) - enemy[tekino].move = 601; - if (enemy[tekino].x < 0) - enemy[tekino].x = 0; - if (enemy[tekino].x > 260) - enemy[tekino].x = 260; - if (enemy[tekino].y < 0) - enemy[tekino].y = 0; - if (enemy[tekino].y > 232) - enemy[tekino].y = 232; - break; - case 601: - enemy[tekino].dt2++; - if (enemy[tekino].x < jiki.x) - enemy[tekino].sx++; - if (enemy[tekino].x > jiki.x) - enemy[tekino].sx--; - enemy[tekino].x += enemy[tekino].sx; - Putenemy(6, enemy[tekino].x + 16 + rand() % 32, - enemy[tekino].y, 0, rand() % 4, 400); - if (enemy[tekino].x < 0) - enemy[tekino].x = 0; - if (enemy[tekino].x > 260) - enemy[tekino].x = 260; - if (enemy[tekino].y < 0) - enemy[tekino].y = 0; - if (enemy[tekino].y > 232) - enemy[tekino].y = 232; - if (enemy[tekino].dt2 > 800) { - enemy[tekino].move = 602; - } - break; - case 602: - enemy[tekino].dt2++; - Putenemy(24, enemy[tekino].x + 14, enemy[tekino].y + 14, - (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1), - (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1), - 29); - if (enemy[tekino].dt2 > 1024) { - enemy[tekino].move = 600; - enemy[tekino].dt2 = 0; - } - break; - } - if ((enemy[tekino].y > 964 + 32) - || (enemy[tekino].x > 1688 + 50) - || (enemy[tekino].y < 0 - 128) - || (enemy[tekino].x < 0 - 200)) { - enemy[tekino].f = FALSE; - } - count++; - PutSprite(count, enemy[tekino].x, enemy[tekino].y, - enemy[tekino].charno); - } - putout:; - } - asteroidi = 0; -} -void asteroid(int tekino) -{ - int i; - - asteroiddt[asteroidi] = tekino; - // if(asteroidi==0) - // { - enemy[tekino].x += enemy[tekino].sx; - enemy[tekino].y += enemy[tekino].sy; - // } - if (asteroidi > 0) { - for (i = 0; i < asteroidi; i++) { - if ((enemy[asteroiddt[i]].x + 32 > enemy[tekino].x) - && (enemy[tekino].x + 32 > enemy[asteroiddt[i]].x) - && (enemy[asteroiddt[i]].y + 32 > enemy[tekino].y) - && (enemy[asteroiddt[i]].y < enemy[tekino].y + 32)) { - enemy[tekino].sx *= -1; - enemy[tekino].sy *= -1; - } - } - } - asteroidi++; -} - -void charpatern() -{ - /* - GsSPRITE gt; - SpriteView st; - int counttag; - counttag = count; - enemyfaste++; - while (counttag > enemyfaste) { - st = spview[counttag]; - gt = sprite[counttag]; - sprite[counttag] = sprite[enemyfaste]; - spview[counttag] = spview[enemyfaste]; - sprite[enemyfaste] = gt; - spview[enemyfaste] = st; - counttag--; - enemyfaste++; - } - */ -} -void cgcg(int p) -{ - /* - GsSPRITE gt; - SpriteView st; - int counttag; - counttag = count; - - st = spview[counttag]; - gt = sprite[counttag]; - sprite[counttag] = sprite[p]; - spview[counttag] = spview[p]; - sprite[p] = gt; - spview[p] = st; -*/ -} - -void bosguage() -{ - int h; - float py; - float wariai1, wariai2; - if (kyeenemyno != -1) { - if (stage == 0) - h = 4; - if (stage == 1) - h = 18; - if (stage == 2) - h = 44; - if (stage == 3) - h = 30; - if (stage == 4) - h = 49; - wariai2 = enemy[kyeenemyno].p; - wariai1 = wariai2 / enemystate[h].p; - py = 186.0 * wariai1; - DefSprite(94, 3, 48, 64 + (186 - py), 16, py, 480); - count++; - // PutSprite(count, 320 - 16, 220 - py, 94); - PutSpriteEx(94, 1500, 1100 - py, 4, 4, 0); - } -}
--- a/move.h Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#ifndef _MOVE_H_ -#define _MOVE_H_ - -extern void asteroid(int tekino); -extern void charpatern(); -extern void bosguage(); -extern void Move(); - -extern int fastebos; -extern void cgcg(int p); -extern void charpatern(); - -extern int enemyfaste; -#endif //_MOVE_H_
--- a/scheduletest.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <SDL.h> -#include "schedule.h" -#include "Character.h" -#include "Character_state.h" -#include "sound.h" -#include "bom.h" -#include "tokuten.h" -#include "count2.h" -//#include "libps.h" -#include"debug.h" -#include "SDL_opengl.h" -enum { - FRAME_RATE = 32, -}; - -/*enemy schedule*/ -int kyeenemyno = -1; -void schedule() -{ - int i; - if (stage == 0) - { - switch (filpcount) { - case 1: - SoundStop(); - SoundPlay(0); - break; - - case FRAME_RATE * 2: - Putenemy(1, 120, -128, 0, 4, chara_state0); - break; - case FRAME_RATE * 3: - Putenemy(1, 56, -128, 0, 8, chara_state0); - Putenemy(1, 184, -128, 0, 8, chara_state0); - break; - case FRAME_RATE * 4: - Putenemy(1, 120, -128, 0, 4, chara_state0); - break; - case FRAME_RATE * 5: - Putenemy(1, 224, -128, 1, 1, chara_state0); - Putenemy(1, 184, -128, 1, 1, chara_state0); - break; - case FRAME_RATE * 6: - Putenemy(1, 120, -128, 1, 2, chara_state0); - break; - case FRAME_RATE * 7: - Putenemy(1, 56, -128, 0, 1, chara_state0); - Putenemy(1, 184, -128, 0, 1, chara_state0); - break; - case FRAME_RATE * 8: - Putenemy(2, 120, -128, 0, 1, chara_state0); - break; - - case FRAME_RATE * 12: - Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 13: - Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 14: - Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 15: - Putenemy(2, 1280 - 128 - 120, -128, -1, 1, chara_state4); - break; - case FRAME_RATE * 16: - Putenemy(2, 1280 - 128 - 120, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 17: - Putenemy(2, 1280 - 128 - 120, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 18: - Putenemy(1, 1280 - 128 - 120, -32, 0, 1, chara_state4); - Putenemy(1, 1280 - 128, -128, -2, 1, chara_state4); - Putenemy(1, 800, -88, -1, 1, chara_state4); - break; - - case FRAME_RATE * 24: - Putenemy(1, 256, -128, 0, 1, chara_state4); - Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 25: - Putenemy(2, 512, -128, 0, 1, chara_state4); - Putenemy(2, 1280 - 128, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 26: - Putenemy(1, 384, -128, 0, 1, chara_state4); - Putenemy(1, 1280 - 256, -128, 0, 2, chara_state4); - Putenemy(1, 512, -128, 0, 3, chara_state4); - Putenemy(1, 1280 - 256, -128, 0, 2, chara_state4); - break; - case FRAME_RATE * 27: - Putenemy(2, 512, -128, 0, 3, chara_state2); - Putenemy(2, 256 - 128, -128, 0, 2, chara_state2); - Putenemy(2, 768, -128, 0, 4, chara_state2); - Putenemy(2, 128, -128, 0, 3, chara_state2); - break; - case FRAME_RATE * 28: - Putenemy(1, 256, -128, 0, 1, chara_state4); - Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 29: - Putenemy(2, 256, -128, 0, 1, chara_state4); - Putenemy(2, 1280 - 256 - 128, -128, 0, 1, chara_state4); - break; - case FRAME_RATE * 30: - Putenemy(1, 256, -128, 0, 1, chara_state4); - Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4); - break; - - case FRAME_RATE * 33: - Putenemy(1, 256, 1088, 0, -1, chara_state5); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5);//5/22/pm5:300 - break; - case FRAME_RATE * 34: - Putenemy(2, 256, 1088, 0, -1, chara_state5); - Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - case FRAME_RATE * 35: - Putenemy(1, 256, 1088, 0, -1, chara_state5); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - case FRAME_RATE * 36: - Putenemy(2, 256, 1088, 0, -1, chara_state5); - Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - case FRAME_RATE * 37: - Putenemy(1, 256, 1088, 0, -1, chara_state5); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - case FRAME_RATE * 38: - Putenemy(2, 256, 1088, 0, -1, chara_state5); - Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - case FRAME_RATE * 39: - Putenemy(1, 256, 1088, 0, -1, chara_state5); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5); - break; - - case FRAME_RATE * 50: - Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3); - break; - case FRAME_RATE * 46: - Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3); - break; - case FRAME_RATE * 54: - Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3); - break; - - case FRAME_RATE * 60: - Putenemy(1, 256, 1088, 0, -1, chara_state6); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - case FRAME_RATE * 61: - Putenemy(1, 256, 1088, 0, -1, chara_state6); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - case FRAME_RATE * 62: - Putenemy(1, 256, 1088, 0, -1, chara_state6); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - case FRAME_RATE * 63: - Putenemy(1, 256, 1088, 0, -1, chara_state6); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - case FRAME_RATE * 64: - Putenemy(1, 256, 1088, 0, -1, chara_state6); - Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - case FRAME_RATE * 65: - Putenemy(40, 256, 1088, 0, -1, chara_state6); - Putenemy(40, 1280 - 256 - 128, 1088, 0, -1, chara_state6); - break; - - case FRAME_RATE * 80: - Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 66: - Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 84: - Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 70: - Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 88: - Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 74: - Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 92: - Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 78: - Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7); - break; - - case FRAME_RATE * 100: - Putenemy(41, 256, -128, 0, 1, chara_state7); - Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 81: - Putenemy(42, 256, -128, 0, 1, chara_state7); - Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 104: - Putenemy(41, 256, -128, 0, 1, chara_state7); - Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 83: - Putenemy(42, 256, -128, 0, 1, chara_state7); - Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 108: - Putenemy(41, 256, -128, 0, 1, chara_state7); - Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 85: - Putenemy(42, 256, -128, 0, 1, chara_state7); - Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - case FRAME_RATE * 112: - Putenemy(41, 256, -128, 0, 1, chara_state7); - Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7); - break; - - } //case文 - } -}
--- a/tama.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -#include <stdlib.h> -#include "Enemy.h" -#include "sankaku.h" -#include"debug.h" -#include <SDL_mixer.h> -#include "sound.h" - -/*たまたまたま*/ -/*tama.h*/ -void Puttama(int type, float x, float y) -{ - PlaySdlMixer(0, SHOT_B) ;// Enemys atack !! - TFon(); - switch (type) { - case 0: - Putenemy(3, x, y, 0, 2, 0); - Putenemy(3, x, y, (float) Mysin(15) * 2 / SANKAKU, - (float) Mycos(15) * 2 / SANKAKU, 0); - Putenemy(3, x, y, (float) Mysin(30) * 2 / SANKAKU, - (float) Mycos(30) * 2 / SANKAKU, 0); - Putenemy(3, x, y, (float) Mysin(-15) * 2 / SANKAKU, - (float) Mycos(-15) * 2 / SANKAKU, 0); - Putenemy(3, x, y, (float) Mysin(-30) * 2 / SANKAKU, - (float) Mycos(-30) * 2 / SANKAKU, 0); - break; - case 1: - Putenemy(3, x, y, (float) Mysin(rand() % 15) * 2 / SANKAKU, - (float) Mycos(rand() % 15) * 2 / SANKAKU, 0); - Putenemy(3, x, y, (float) Mysin(rand() % 15) * 2 / SANKAKU, - (float) Mycos(rand() % 15) * 2 / SANKAKU, 0); -// Putenemy(3,x,y,(float) Mysin(rand()%15)*2/SANKAKU,(float)Mycos(rand()%15)*2/SANKAKU,0); -// Putenemy(3,x,y,(float) Mysin(rand()%15)*2/SANKAKU,(float)Mycos(rand()%15)*2/SANKAKU,0); -// Putenemy(3,x,y,(float) Mysin(rand()%15)*2/SANKAKU,(float)Mycos(rand()%15)*2/SANKAKU,0); - - Putenemy(3, x, y, (float) Mysin(rand() % 15 * -1) * 2 / SANKAKU, - (float) Mycos(rand() % 15 * -1) * 2 / SANKAKU, 0); - Putenemy(3, x, y, (float) Mysin(rand() % 15 * -1) * 2 / SANKAKU, - (float) Mycos(rand() % 15 * -1) * 2 / SANKAKU, 0); -// Putenemy(3,x,y,(float) Mysin(rand()%15*-1)*2/SANKAKU,(float)Mycos(rand()%15*-1)*2/SANKAKU,0); -// Putenemy(3,x,y,(float) Mysin(rand()%15*-1)*2/SANKAKU,(float)Mycos(rand()%15*-1)*2/SANKAKU,0); -// Putenemy(3,x,y,(float) Mysin(rand()%15*-1)*2/SANKAKU,(float)Mycos(rand()%15*-1)*2/SANKAKU,0); - break; - - case 2: - Putenemy(6, x, y, 10, -3, 20); - break; - case 3: - Putenemy(6, x, y, -10, -3, 21); - break; - case 4: - Putenemy(7, x, y, 0, 15, 0); - break; - case 5: - Putenemy(8, x, y, 0, 30, 0); - break; - case 6: //本体 - Putenemy(10, x, y, 0, 0, 30); - break; - case 7: - Putenemy(6, x, y, 0, 4, 0); - Putenemy(6, x, y, (float) Mysin(15) * 4 / SANKAKU, - (float) Mycos(15) * 4 / SANKAKU, 0); - Putenemy(6, x, y, (float) Mysin(30) * 4 / SANKAKU, - (float) Mycos(30) * 4 / SANKAKU, 0); - Putenemy(6, x, y, (float) Mysin(-15) * 4 / SANKAKU, - (float) Mycos(-15) * 4 / SANKAKU, 0); - Putenemy(6, x, y, (float) Mysin(-30) * 4 / SANKAKU, - (float) Mycos(-30) * 4 / SANKAKU, 0); - break; - case 8: - Putenemy(3, x + 8, y + 8, -4, 0, 0); - Putenemy(3, x + 8, y + 8, 4, 0, 0); - Putenemy(3, x + 8, y, -4, Mysin(30) * -8 / SANKAKU, 0); - Putenemy(3, x + 8, y, 4, Mysin(30) * -8 / SANKAKU, 0); - break; - case 9: - Putenemy(3, x + 8, y, -4, Mysin(30) * -8 / SANKAKU, 0); - Putenemy(3, x + 8, y, 4, Mysin(30) * -8 / SANKAKU, 0); - Putenemy(3, x + 8, y, -4, Mysin(30) * 8 / SANKAKU, 0); - Putenemy(3, x + 8, y, 4, Mysin(30) * 8 / SANKAKU, 0); - break; - case 10: - Putenemy(3, x + 8, y, -4, 0, 0); - Putenemy(3, x + 8, y, 4, 0, 0); - Putenemy(3, x + 8, y, 0, 4, 0); - Putenemy(3, x + 8, y, 0, -4, 0); - break; - case 11: - { - int a; - a = rand() % 360; - - Putenemy(3, x + 8, y, (float) Mycos(a) / SANKAKU, - (float) Mysin(a) / SANKAKU, 0); - } - } - TFoff(); -}
--- a/tama.h Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#ifndef _TAMA_H_ -#define _TAMA_H_ - -extern void Puttama(int type, float x, float y); - -#endif //_TAMA_H_
--- a/testgl.c Tue Dec 07 15:39:45 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,525 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <SDL.h> -#include <SDL_opengl.h> -#include <SDL_image.h> -#include "object.h" -#include "xml.h" -#include "Pad.h" - - -static int power_of_two(int input) -{ - int value = 1; - - while ( value < input ) - { - value <<= 1; - } - return value; -} - - -GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) -{ - GLuint texture; - int w, h; - SDL_Surface *image; - SDL_Rect area; - Uint32 saved_flags; - Uint8 saved_alpha; - - /* Use the surface width and height expanded to powers of 2 */ - w = power_of_two(surface->w); - h = power_of_two(surface->h); - texcoord[0] = 0.0f; /* Min X */ - texcoord[1] = 0.0f; /* Min Y */ - texcoord[2] = (GLfloat)surface->w / w; /* Max X */ - texcoord[3] = (GLfloat)surface->h / h; /* Max Y */ - - image = SDL_CreateRGBSurface( - SDL_SWSURFACE, - w, h, - 32, -#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ - 0x000000FF, - 0x0000FF00, - 0x00FF0000, - 0xFF000000 -#else - 0xFF000000, - 0x00FF0000, - 0x0000FF00, - 0x000000FF -#endif - ); - if ( image == NULL ) - { - return 0; - } - - /* Save the alpha blending attributes */ - saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK); - saved_alpha = surface->format->alpha; - if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) - { - SDL_SetAlpha(surface, 0, 0); - } - - /* Copy the surface into the GL texture image */ - area.x = 0; - area.y = 0; - area.w = surface->w; - area.h = surface->h; - SDL_BlitSurface(surface, &area, image, &area); - - /* Restore the alpha blending attributes */ - if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) - { - SDL_SetAlpha(surface, saved_flags, saved_alpha); - } - - /* Create an OpenGL texture for the image */ - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, - 0, - GL_RGBA, - w, h, - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - image->pixels); - SDL_FreeSurface(image); /* No longer needed */ - - return texture; -} - -/* -float tes_angle[3] = {0,0,0}; -void obj_draw(SURFACE *surfaces) -{ - int n; - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, (GLuint)surfaces->texture); - - glTranslatef(surfaces->xyz[0],surfaces->xyz[1],surfaces->xyz[2]); - - glTranslatef(*(surfaces->data[2][0]), *(surfaces->data[2][0]+1), *(surfaces->data[2][0]+2)); - - glRotatef(surfaces->angle[0], 1, 0, 0); - glRotatef(surfaces->angle[1], 0, 1, 0); - glRotatef(surfaces->angle[2], 0, 0, 1); - - glTranslatef(-*(surfaces->data[2][0]), -*(surfaces->data[2][0]+1), -*(surfaces->data[2][0]+2)); - - glBegin( GL_TRIANGLES); - for(n=0; n<surfaces->size; n++) - { - glTexCoord2f(*(surfaces->data[3][n]),*(surfaces->data[3][n]+1)); - glVertex3f(*(surfaces->data[0][n]),*(surfaces->data[0][n]+1),*(surfaces->data[0][n]+2)); - glNormal3f(*(surfaces->data[1][n]),*(surfaces->data[1][n]+1),*(surfaces->data[1][n]+2)); - } - glEnd( ); - glDisable(GL_TEXTURE_2D); -} -*/ - - -static SURFACE *next_draw_node(SURFACE *surfaces) -{ - SURFACE *node = surfaces; - if(node->child != NULL) - { - glPushMatrix(); - return node->child; - } - else if(node->brother != NULL) - { - glPopMatrix(); - glPushMatrix(); - return node->brother; - } - else - { - node = node->parent; - if(node != NULL) - { - glPopMatrix(); - } - while(node != NULL) - { - if(node->brother != NULL) - { - glPopMatrix(); - glPushMatrix(); - return node->brother; - } - else - { - node = node->parent; - if(node != NULL) - { - glPopMatrix(); - } - } - } - return NULL; - } -} - -SURFACE *search_node(OBJECT *top, char *name) -{ - SURFACE *node; - node = top->surfaces; - while(node != NULL) - { - node = next_draw_node(node); - if(!strcmp(node->image_name, name) - { - return node; - } - } -} - -void all_obj_draw(OBJECT *top) -{ - SURFACE *node; - node = top->surfaces; - glPushMatrix(); - while(node != NULL) - { - obj_draw(node); - //if(node->child != NULL) - { - node = next_draw_node(node); - } - /* - else - { - //node = node->next; - } - */ - } - glPopMatrix(); -} - - -static SURFACE *next_node(SURFACE *surfaces) -{ - SURFACE *node = surfaces; - if(node->child != NULL) - { - return node->child; - } - else if(node->brother != NULL) - { - return node->brother; - } - else - { - node = node->parent; - while(node != NULL) - { - if(node->brother != NULL) - { - return node->brother; - } - else - { - node = node->parent; - } - } - return NULL; - } -} - - - - - -void node_draw(OBJECT *top, char *name) -{ - SURFACE *node; - for(node=top->surfaces; node!=NULL; node=next_node(node)) - { - if(!strcmp(node->name, name)) - { - glPushMatrix(); - obj_draw(node); - glPopMatrix(); - } - } -} - - - -void node_prameter_change(OBJECT *top, char *name, float x, float y, float z, float ax, float ay, float az) -{ - SURFACE *node; - for(node=top->surfaces; node!=NULL; node=next_node(node)) - { - if(!strcmp(node->name, name)) - { - node->xyz[0] = x; - node->xyz[1] = y; - node->xyz[2] = z; - node->angle[0] = ax; - node->angle[1] = ay; - node->angle[2] = az; - } - } -} - -void all_object_load_texture(OBJECT *top) -{ - SURFACE *node; - SDL_Surface *image; - GLfloat texcoord[4]; - for(node=top->surfaces; node!=NULL; node=next_node(node)) - { - //image = SDL_LoadBMP(node->image_name); - //image = IMG_Load(node->image_name); - image = LoadSprite(node, image); - node->texture = (int *)SDL_GL_LoadTexture(image, texcoord); - SDL_FreeSurface(image); - } -} - - -int RunGLTest( int argc, char* argv[], int bpp, int width, int height) -{ - int i; - int rgb_size[3]; - int w = width; - int h = height; - int done = 0; - int frames; - Uint32 start_time, this_time; - - Uint32 video_flags; - int value; - - OBJECT *obj; - obj = read_xml_3d_file(argv[1]); - - - if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) - { - fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError()); - exit( 1 ); - } - - /* See if we should detect the display depth */ - if ( bpp == 0 ) - { - if ( SDL_GetVideoInfo()->vfmt->BitsPerPixel <= 8 ) - { - bpp = 8; - } - else - { - bpp = 16; /* More doesn't seem to work */ - } - } - - //video_flags = SDL_OPENGLBLIT; - video_flags = SDL_OPENGL; - - for ( i=1; argv[i]; ++i ) - { - if ( strcmp(argv[i], "-fullscreen") == 0 ) - { - video_flags |= SDL_FULLSCREEN; - } - } - - /* Initialize the display */ - switch (bpp) - { - case 8: - rgb_size[0] = 3; - rgb_size[1] = 3; - rgb_size[2] = 2; - break; - case 15: - case 16: - rgb_size[0] = 5; - rgb_size[1] = 5; - rgb_size[2] = 5; - break; - default: - rgb_size[0] = 8; - rgb_size[1] = 8; - rgb_size[2] = 8; - break; - } - SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] ); - SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] ); - SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] ); - SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); - SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - - SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); - - if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) - { - fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); - SDL_Quit(); - exit(1); - } - - printf("Screen BPP: %d\n", SDL_GetVideoSurface()->format->BitsPerPixel); - printf("\n"); - printf( "Vendor : %s\n", glGetString( GL_VENDOR ) ); - printf( "Renderer : %s\n", glGetString( GL_RENDERER ) ); - printf( "Version : %s\n", glGetString( GL_VERSION ) ); - printf( "Extensions : %s\n", glGetString( GL_EXTENSIONS ) ); - printf("\n"); - - SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &value ); - printf( "SDL_GL_RED_SIZE: requested %d, got %d\n", rgb_size[0],value); - SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &value ); - printf( "SDL_GL_GREEN_SIZE: requested %d, got %d\n", rgb_size[1],value); - SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &value ); - printf( "SDL_GL_BLUE_SIZE: requested %d, got %d\n", rgb_size[2],value); - SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &value ); - printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value ); - SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); - printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); - - - /* Set the window manager title bar */ - SDL_WM_SetCaption( "SDL GL test", "testgl" ); - - glViewport( 0, 0, w, h ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity( ); - - glOrtho( -40.0, 40.0, -40.0, 40.0, -400.0, 400.0 ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity( ); - - glEnable(GL_DEPTH_TEST); - - glDepthFunc(GL_LESS); - - glShadeModel(GL_SMOOTH); - - - //load texture image - all_object_load_texture(obj); - - - /* Loop until done. */ - start_time = SDL_GetTicks(); - frames = 0; - while( !done ) - { - GLenum gl_error; - char* sdl_error; - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if(event.type==SDL_QUIT) goto QUIT; - } - - /* Do our drawing, too. */ - glClearColor( 0.0, 0.0, 0.0, 1.0 ); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - Pad(); - - //node_prameter_change(obj, "Cube", 0, 0, 0, 0, 1, 0); - //node_prameter_change(obj, "Sphere.001", 0, 0, 0, 0, 1, 0); - //node_prameter_change(obj, "Plane", 0, 0, 0, 0, 1, 0); - //node_prameter_change(obj, "Plane.001", 0, 0, 0, 0, 1, 0); - //node_prameter_change(obj, "Sphere", 0, 0, 0, 0, 1, 0); - - all_obj_draw(obj); - //node_draw(obj, "Cube"); - - glMatrixMode(GL_MODELVIEW); - //glRotatef(1.0, 1.0, 1.0, 1.0); - /* - if(pad[0].up > 0) - { - node_prameter_change(obj, "Plane", 0, 1, 0, 0, 0, 0); - } - else if(pad[0].down > 0) - { - node_prameter_change(obj, "Plane", 0, -1, 0, 0, 0, 0); - } - - if(pad[0].right > 0) - { - node_prameter_change(obj, "Plane", 1, 0, 0, 0, 0, 0); - } - else if(pad[0].left > 0) - { - node_prameter_change(obj, "Plane", -1, 0, 0, 0, 0, 0); - } - */ - SDL_GL_SwapBuffers( ); - - /* Check for error conditions. */ - gl_error = glGetError( ); - - if( gl_error != GL_NO_ERROR ) - { - fprintf( stderr, "testgl: OpenGL error: %s\n", (char *)gl_error ); - } - - sdl_error = SDL_GetError( ); - - if( sdl_error[0] != '\0' ) - { - fprintf(stderr, "testgl: SDL error '%s'\n", sdl_error); - SDL_ClearError(); - } - - ++frames; - } - - /* Destroy our GL context, etc. */ - QUIT: - /* Print out the frames per second */ - this_time = SDL_GetTicks(); - if ( this_time != start_time ) - { - printf("%2.2f FPS\n",((float)frames/(this_time-start_time))*1000.0); - } - SDL_Quit( ); - return(0); -} - -int main(int argc, char *argv[]) -{ - int i; - int bpp = 0; - int width = 640; - int height = 480; - for ( i=1; argv[i]; ++i ) - { - if ( strcmp(argv[i], "-bpp") == 0 ) - { - bpp = atoi(argv[++i]); - } - if ( strcmp(argv[i], "-width") == 0 ) - { - width = atoi(argv[++i]); - } - if ( strcmp(argv[i], "-height") == 0 ) - { - height = atoi(argv[++i]); - } - } - RunGLTest(argc, argv, bpp, width, height); - return 0; -}