//------------------------------------------------------------------------------ // File: bossone.c // Author: George Bain // Date: May 22, 1997 // Description: First boss related routines // Copyright (C) 1997 George Bain, All Rights Reserved //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // I N C L U D E S //------------------------------------------------------------------------------ #include // standard Sony library #include "gfx.h" #include "bossone.h" //------------------------------------------------------------------------------ // Function: DrawBossOne() // Description: Register first boss sprite into the OT // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ void DrawBossOne( void ) { if( boss_one.state == BOSS_ALIVE ) GsSortFastSprite( &boss_one.sprite, &world_ordering_table[output_buffer_index], 0 ); }// end DrawBossOne //------------------------------------------------------------------------------ // Function: ControlBossOne() // Description: Release the first boss based on a timer. When boss // is destroyed continue onto the next level. // Parameters: none // Returns: void // Notes: This needs improvement. //------------------------------------------------------------------------------ void ControlBossOne( void ) { static count=0; count++; if( (boss_one.state == BOSS_DEAD) && (GetRCnt(1) >= 65000) ) { boss_one.state = BOSS_ALIVE; boss_one.motion_speed = BOSS_SPEED; boss_one.dir = BOSS_LEFT; boss_one.sprite.x = SCREEN_WIDTH; boss_one.sprite.y = (SCREEN_HEIGHT/3); }// end if }// end ControlBossOne //------------------------------------------------------------------------------ // Function: MoveBossOne() // Description: Move the first boss based on the state and AI // Parameters: none // Returns: void // Notes: The AI for the boss needs much inprovement. //------------------------------------------------------------------------------ void MoveBossOne( void ) { int index; if( ( boss_one.state == BOSS_ALIVE) && (boss_one.dir == BOSS_LEFT) ) { boss_one.sprite.x += -(BOSS_SPEED+1); boss_one.sprite.y += cos_look[boss_one.sprite.x]; if( boss_one.sprite.x <= 2 ) boss_one.dir = BOSS_RIGHT; // change direction else if( boss_one.sprite.y <= BOSS_HEIGHT ) boss_one.sprite.y +=1; }// end if if( ( boss_one.state == BOSS_ALIVE) && (boss_one.dir == BOSS_RIGHT) ) { boss_one.sprite.x += (BOSS_SPEED+2); boss_one.sprite.y += 0; if( boss_one.sprite.x >= (SCREEN_WIDTH-BOSS_WIDTH) ) boss_one.dir = BOSS_LEFT; // change direction else if( boss_one.sprite.y >= (SCREEN_HEIGHT-BOSS_HEIGHT) ) boss_one.sprite.y +=1; }// end if if( (rand()%10 == 1) && (boss_one.state) == BOSS_ALIVE) { StartMissiles( boss_one.sprite.x+4,boss_one.sprite.y+9, -MISSILE_SPEED*2, 0, 0,255,0, ENEMY_MISSILE ); StartMissiles( boss_one.sprite.x+4,boss_one.sprite.y+19, -MISSILE_SPEED*2, 0, 0,255,0, ENEMY_MISSILE ); }// end if if( (rand()%25 == 1) && (boss_one.state) == BOSS_ALIVE) StartRockets( boss_one.sprite.x+4, boss_one.sprite.y+9 ); }// end MoveBossOne //-----------------------------------EOF----------------------------------------