//あたり判定とのチェック(プレイヤー番号) //渡されたプレイヤー番号側がCollisionSetで設置された相手の攻撃あたり判定と当たっているかチェックする int COLLISION::CollisionCheck( int player_num ) { //当たっているか判定 VECTOR Defense; for(int i=0;i<10;i++){ Defense = MV1GetFramePosition( ModelDataHandle[player_num], MV1SearchFrame( ModelDataHandle[player_num], HitDefense[i].FrameName ) ); if(player_num == 0){ if(isUseAttack[1] == TRUE){ if( ((Defense.x-Attack[1].x)*(Defense.x-Attack[1].x)) + ((Defense.y-Attack[1].y)*(Defense.y-Attack[1].y)) <= ((HitAttack[HitPart[1]].Radius+HitDefense[i].Radius)*(HitAttack[1].Radius+HitDefense[i].Radius)) ) { //チェック後全てのセットしたデータをリセット isUseAttack[player_num] = FALSE; return HitAttackPosition[1]; } } } if(player_num == 1){ if(isUseAttack[0] == TRUE){ if( ( (Defense.x-Attack[0].x)*(Defense.x-Attack[0].x) ) + ( (Defense.y-Attack[0].y)*(Defense.y-Attack[0].y) ) <= ((HitAttack[HitPart[0]].Radius+HitDefense[i].Radius)*(HitAttack[0].Radius+HitDefense[i].Radius)) ) { //チェック後全てのセットしたデータをリセット isUseAttack[player_num] = FALSE; return HitAttackPosition[0]; } } } } //チェック後全てのセットしたデータをリセット return -1; }
//あたり判定の設置(プレイヤー番号、攻撃判定の部位、上段中断下段の振り分け) void COLLISION::CollisionSet(int player_num, int hit_part ,int hit_attack_position ) { isUseAttack[player_num] = FALSE; if(hit_part == -1){ return; } //攻撃判定のある部位 HitPart[player_num] = hit_part; //攻撃のあたる部位 HitAttackPosition[player_num] = hit_attack_position; isUseAttack[player_num] = TRUE; Attack[player_num] = MV1GetFramePosition( ModelDataHandle[player_num], MV1SearchFrame( ModelDataHandle[player_num], HitAttack[hit_part].FrameName ) ) ; return; }
// 初期化をする Room *Room_Initialize() { Room *self; self = new Room(); self->room = MV1LoadModel("meta/room.mqo") ; //model画像ハンドルの格納 self->window = MV1SearchFrame(self->room, "window"); self->coffee = MV1SearchFrame(self->room, "coffee"); self->door = MV1LoadModel("meta/door.mqo") ; //model画像ハンドルの格納 self->glass = MV1LoadModel("meta/glass.mqo") ; self->hammer = MV1LoadModel("meta/hammer.mqo") ; self->pot = MV1LoadModel("meta/pot.mqo") ; self->paper0 = MV1LoadModel("meta/paper.mqo") ; self->paper1 = MV1DuplicateModel(self->paper0) ; self->paper2 = MV1DuplicateModel(self->paper1) ; self->paper3 = MV1DuplicateModel(self->paper1) ; self->table = MV1LoadModel("meta/table.mqo") ; self->bed = MV1LoadModel("meta/bed.mqo") ; self->makura = MV1SearchFrame(self->bed, "makura"); self->huton = MV1SearchFrame(self->bed, "huton"); self->stand = MV1SearchFrame(self->bed, "cover"); self->black_cap = MV1SearchFrame(self->table, "black_futa"); self->yellow_cap = MV1SearchFrame(self->table, "yellow_futa"); self->green_cap = MV1SearchFrame(self->table, "green_futa"); self->door_close_count = 0; self->rotY = 0.0f; self->swit = 0; self->count = 0; self->s_swit = 0; self->s_count = 0; self->slide = 0; self->role = 0; return self; }