Mercurial > hg > Members > koba > t_dandy
view syokika.c @ 14:c7e7971a76d0
fix.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Dec 2010 15:29:43 +0900 |
parents | 435ac1cdb64e |
children | e0018f39f7e1 |
line wrap: on
line source
#include <stdlib.h> #include <stdio.h> #include <SDL.h> #include "SDL_opengl.h" #include "SDL_image.h" #include <math.h> #include "object.h" #include "xml.h" #include "tree_controll.h" #include "count2.h" #include "sgoex.h" #include "sankaku.h" #include "bom.h" #include "sound.h" #include "syokika.h" #include "debug.h" #include "LoadSprite.h" #define CHARACTER_FILE "xml/character.xml" #define FONT_FILE "xml/font.xml" #define EFFECT_FILE "xml/effect.xml" #define BOSS_FILE "xml/boss.xml" extern void all_object_load_texture(OBJECT *top); //extern void init_sprite(TEXTURE * tex); //extern int LoadSprite(); #define SEED_VALUE 1 struct SDL_Surface *screen; OBJECT *font; OBJECT *chara; OBJECT *effect; OBJECT *boss; void syokika(int argc, char *argv[]) { int i; //volatile unsigned char *bb0, *bb1; int width = 740; int height = 480; Uint8 video_bpp = 32; Uint32 videoflags; /* Initialize SDL */ if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 ) { fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); //return(1); } for (i = 1; argv[i]; i++) { if (strcmp(argv[i], "-width") == 0) { width = atoi(argv[++i]); } if (strcmp(argv[i], "-height") == 0) { height = atoi(argv[++i]); } if (strcmp(argv[i], "-bpp") == 0) { video_bpp = atoi(argv[++i]); } } videoflags = SDL_OPENGL; SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 3 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 3 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 2 ); //SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); /* Set video mode */ screen = SDL_SetVideoMode(width, height, video_bpp, videoflags); if ( ! screen ) { fprintf(stderr, "Couldn't set %dx%d video mode: %s\n", width, height, SDL_GetError()); } glClearColor( 0.0, 0.0, 0.0, 1.0 ); glClear( GL_COLOR_BUFFER_BIT ); /*glViewport(0, 0, screen->w, screen->h); glEnable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);*/ srand(SEED_VALUE); //LoadSprite(); // sankakuf(); font = read_xml_3d_file(FONT_FILE); boss = read_xml_3d_file(BOSS_FILE); chara = read_xml_3d_file(CHARACTER_FILE); effect = read_xml_3d_file(EFFECT_FILE); all_object_load_texture(font); all_object_load_texture(boss); all_object_load_texture(chara); all_object_load_texture(effect); init_sprite(font, boss, chara, effect); } void init_sprite(OBJECT *font, OBJECT *boss, OBJECT *chara, OBJECT *effect) { int i, i2; laser_lv3[0].r = 62; laser_lv3[0].r = 62; /* for (i = 0; i < BOX_NUM; i++) { boxdt[i].x = rand() % 320; boxdt[i].y = rand() % 240; boxdt[i].s = i % 5 + 1; } */ for (i2 = 0; i2 < 3; i2++) { tlv3[i2].y = -1; } for (i = 0; i < 50; i++) bchar[i].no = 8; /** * 1引数:キャラクターナンバー; * 2引数:キャラクタ名; * 3引数:幅 * 4引数:高さ * 5引数:カラー- 480のままでよろし * 6引数:OBJECT構造体のポインタを渡す * 下書き直し */ DefSprite(PLAYER_IDLE, "player_idle", 128, 128, 480, chara); DefSprite(PLAYER_LEFTMOVE, "player_leftmove", 128, 128, 480, chara); DefSprite(PLAYER_TURNTOLEFT, "player_turntoleft", 128, 128, 480, chara); DefSprite(PLAYER_TURNTORIGHT, "player_turntoright", 128, 128, 480, chara); //DefSprite(PLAYER_RIGHTMOVE, 1, 480, chara); DefSprite(PLAYER_RIGHTMOVE, "player_rightmove", 128, 128, 480, chara); DefSprite(BLUEBULLET_LEFT, "bulebullet_left", 45, 128, 480, effect); DefSprite(BLUEBULLET_RIGHT, "blebullet_right", 38, 128, 480, effect); DefSprite(REDBULLET, "redbullet", 128, 256, 480, effect); DefSprite(LONGLASER, "longlaser", 64, 256, 480, effect); DefSprite(GAUGE_PANEL, "gauge_panel", 128, 512, 480, effect); DefSprite(OFFENSIVEPOWER_GAUGE, "offensivepower_gauge", 27, 220, 480, effect); DefSprite(BURNER, "burner", 63, 122, 480, effect); DefSprite(LOCKON_SIGHT, "lockon_sight", 64, 64, 480, effect); //DefSprite(SPECIAL_LASERGAUGE, "special_lasergauge", 0, 0, 480, effect); DefSprite(DIFFENSIVEPOWER_GAUGE, "diffensivepower_gauge", 20, 215, 480, effect); DefSprite(GREENBULLET, "greenbullet", 128, 128, 480, effect); DefSprite(BULEBARRIER, "bulebarrier", 128, 128, 480, effect); DefSprite(FONT_PLAYER_1, "font_player_1", 128, 32, 480, font); //DefSprite(FONT_GAMEOVER, "font_gameover", 256, 32, 480, font); DefSprite(FONT_0, "font_0", 32, 32, 480, font); DefSprite(FONT_1, "font_1", 32, 32, 480, font); DefSprite(FONT_2, "font_2", 32, 32, 480, font); DefSprite(FONT_3, "font_3", 32, 32, 480, font); DefSprite(FONT_4, "font_4", 32, 32, 480, font); DefSprite(FONT_5, "font_5", 32, 32, 480, font); DefSprite(FONT_6, "font_6", 32, 32, 480, font); DefSprite(FONT_7, "font_7", 32, 32, 480, font); DefSprite(FONT_8, "font_8", 32, 32, 480, font); DefSprite(FONT_9, "font_9", 32, 32, 480, font); DefSprite(REDBOMB_ANIM_0, "redbomb_anim_0", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_1, "redbomb_anim_1", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_2, "redbomb_anim_2", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_3, "redbomb_anim_3", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_4, "redbomb_anim_4", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_5, "redbomb_anim_5", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_6, "redbomb_anim_6", 64, 64, 480, effect); DefSprite(REDBOMB_ANIM_7, "redbomb_anim_7", 64, 64, 480, effect); DefSprite(FONT_HIGE, "font_hige", 128, 32, 480, font); DefSprite(GREENBOMB_ANIM_0, "greenbomb_anim_0", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_1, "greenbomb_anim_1", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_2, "greenbomb_anim_2", 64, 64, 480, effect); //DefSprite(GREENBOMB_ANIM_3, "greenbomb_anim_3", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_4, "greenbomb_anim_4", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_5, "greenbomb_anim_5", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_6, "greenbomb_anim_6", 64, 64, 480, effect); DefSprite(GREENBOMB_ANIM_7, "greenbomb_anim_7", 64, 64, 480, effect); DefSprite(INFLATION_GAUGE, "inflation_gauge", 64, 512, 480, effect); DefSprite(INFLATION_METER, "inflation_meter", 32, 512, 480, effect); DefSprite(ENEMY_GREENCRAB, "enemy_greenclab", 128, 128, 480, chara); DefSprite(ENEMY_PLANE, "enemy_plane", 128, 128, 480, chara); DefSprite(ENEMY_REDBULLET, "enemy_redbullet", 32, 32, 480, effect); DefSprite(FONT_PUSHSTART, "font_pushstart", 512, 32, 480, font); DefSprite(BOSS1_ORGAN, "boss1_organ", 128, 256, 480, boss); DefSprite(ENEMY_LASER, "enemy_laser", 64, 251, 480, effect); DefSprite(ENEMY_BLUEBULLET, "enemy_bluebullet", 36, 28, 480, effect); DefSprite(ENEMY_LIGHTNING, "enemy_lightning", 64, 252, 480, effect); DefSprite(ENEMY_LASERSPLOSH_0, "enemy_lasersplosh_0", 126, 127, 480, effect); DefSprite(ENEMY_LASERSPLOSH_1, "enemy_lasersplosh_1", 124, 119, 480, effect); DefSprite(ENEMY_LASERSPLOSH_2, "enemy_lasersplosh_2", 126, 127, 480, effect); DefSprite(ENEMY_LASERSPLOSH_3, "enemy_lasersplosh_3", 112, 102, 480, effect); DefSprite(ASTEROID, "meteo", 128, 128, 480, chara); //inseki DefSprite(ORBITMACHINE, "orbitmachine", 128, 64, 480, chara); //inseki no shita maruiyatsu DefSprite(BOSS2_BODY, "boss2_body", 512, 512, 480, boss); DefSprite(BOSS2_RIGHTSHOULDER, "boss2_rightshoulder", 256, 256, 480, boss); DefSprite(BOSS2_LEFTSHOULDER, "boss2_leftshoulder", 256, 256, 480, boss); DefSprite(BOSS2_RIGHTARM, "boss2_rightarm", 128, 256, 480, boss); DefSprite(BOSS2_LEFTARM, "boss2_leftarm", 128, 256, 480, boss); DefSprite(BOSS2_BATTERY, "boss2_battery", 128, 128, 480, boss); DefSprite(BOSS2_OPENBATTERY, "boss2_openbattery", 256, 128, 480, boss); DefSprite(BOSS2_BROKENHATCH, "boss2_brokenhatch", 128, 64, 480, boss); DefSprite(BOSS2_DUMMY, "boss2_dummy", 128, 64, 480, boss); DefSprite(BOSS2_RIGHTSHOULDERUP, "boss2_r_shoulderup", 256, 128, 480, boss); DefSprite(BOSS2_LEFTSHOULDERUP, "boss2_left_s_up", 256, 128, 480, boss); DefSprite(BOSS2_LEFTSHOULDERGIRD, "boss2_left_s_gird", 256, 256, 480, boss); DefSprite(BOSS2_RIGHTARMBATTERY, "boss2_rightarm_b", 64, 64, 480, boss); DefSprite(BOSS2_LEFTARMBATTERY, "boss2_leftarmbattery", 64, 64, 480, boss); DefSprite(BOSS2_RIGHTHAND, "boss2_righthand", 64, 64, 480, boss); DefSprite(BOSS2_RIGHTPALM, "boss2_rightpalm", 64, 64, 480, boss); DefSprite(BOSS2_LEFTHAND, "boss2_lefthand", 64, 64, 480, boss); DefSprite(BOSS2_LEFTPALM, "boss2_leftpalm", 64, 64, 480, boss); DefSprite(PLAYER_LASERSPLOSH_0, "player_lasersplosh_0", 115, 91, 480, effect); DefSprite(PLAYER_LASERSPLOSH_1, "player_lasersplosh_1", 133, 121, 480, effect); DefSprite(PLAYER_LASERSPLOSH_2, "player_lasersplosh_2", 135, 119, 480, effect); DefSprite(PLAYER_LASERSPLOSH_3, "player_lasersplosh_3", 131, 120, 480, effect); DefSprite(BOSS_POWERGAUGE, "boss_powergauge", 69, 762, 480, effect); DefSprite(BLACKHOLE, "blackhole", 128, 128, 480, boss); DefSprite(FONT_DOYOUCONTINUE, "font_doyoucontinue", 512, 32, 480, font); DefSprite(FONT_ALLSTAGECLEAR, "font_allstageclear", 512, 32, 480, font); DefSprite(FONT_REST, "font_rest", 128, 32, 480, font); DefSprite(FONT_STAGE, "font_stage", 256, 32, 480, font); DefSprite(FONT_LINEOFZERO_000000, "font_000000", 256, 32, 480, font); DefSprite(FONT_LINEOFZERO_0000000, "font_0000000", 256, 32, 480, font); DefSprite(FONT_THANKYOU, "font_thankyou", 512, 32, 480, font); DefSprite(FONT_NYSOFT, "font_nysoft", 512, 32, 480, font); DefSprite(FONT_1997YGGDRASIL, "font_1997yggdrasil", 512, 32, 480, font); DefSprite(FONT_SUPERDANDY, "font_superdandy", 256, 64, 480, font); DefSprite(FONT_1997YAS_K, "font_1997yas_k", 512, 32, 480, font); DefSprite(GUNBATTERY, "gunbattery", 128, 128, 480, chara); DefSprite(PURPLECORE, "purplecore", 128, 128, 480, chara); DefSprite(SPACEFISH, "spacefish", 128, 128, 480, chara); DefSprite(MISSILE, "missile", 64, 128, 480, chara); DefSprite(BOSS3_BODY, "boss3_body", 256, 256, 480, boss); DefSprite(BODD4_BODY, "boss_4", 256, 256, 480, boss); DefSprite(TITLEFONT_SUPER, "titlefont_super", 256, 256, 480, font); DefSprite(TITLEFONT_BATTLE, "titlefont_battle", 256, 256, 480, font); DefSprite(TITLEFONT_EMPEROR, "titlefont_emperor", 256, 256, 480, font); DefSprite(GREENBARRIER, "greenbarrier", 130, 133, 480, effect); DefSprite(REMAINDER, "remainder", 126, 34, 480, effect); DefSprite(EARTH, "earth", 256, 256, 480, chara); DefSprite(BOSS_CORPSE, "boss_corpse", 64, 256, 480, boss); /* for (i = 0; i < 12; i++) { DefSprite(211 - i, 1, 0, 128 + i * 8, 16, 8, 480); } */ //rank DefSprite(211, "rank_c_mins", 64, 32, 480, font); DefSprite(210, "rank_c", 64, 32, 480, font); DefSprite(209, "rank_c_pla", 64, 32, 480, font); DefSprite(208, "rank_b_mins", 64, 32, 480, font); DefSprite(207, "rank_b", 64, 32, 480, font); DefSprite(206, "rank_b_pla", 64, 32, 480, font); DefSprite(205, "rank_a_mins", 64, 32, 480, font); DefSprite(204, "rank_a", 64, 32, 480, font); DefSprite(203, "rank_a_pla", 64, 32, 480, font); DefSprite(202, "rank_s", 64, 32, 480, font); }