//------------------------------------------------------------------------------ // File: screens.c // Author: George Bain, // Date: May 13, 1997 // Description: Initialize opening graphic images // Copyright (C) 1997 George Bain, All Rights Reserved //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // I N C L U D E S //------------------------------------------------------------------------------ #include // standard Sony library #include "screens.h" #include "gfx.h" #include "t_left.img" // title screen images #include "t_right.img" #include "s_left.img" // story screen images #include "s_right.img" #include "c_left.img" // city scrolling image #include "c_right.img" //------------------------------------------------------------------------------ // G L O B A L S //------------------------------------------------------------------------------ object_handler t_left; // left half of title screen object_handler t_right; // right half of title screen object_handler s_left; // left half of story screen object_handler s_right; // right half of story screen object_handler c_left; // left half of city screen object_handler c_right; // right half of city screen //------------------------------------------------------------------------------ // Function: InitTitleScreen() // Description: Initialize member for the title screen // Parameters: none // Returns: void // Notes: Using tga2img by Mario Perdue //------------------------------------------------------------------------------ void InitTitleScreen( void ) { u_short tpage; // texture page RECT rect; // frame buffer rectangular area //--------------- Initialize the left half of title ------------------------ // load image into the frame buffer rect.x = IMG_T_LEFT_X; rect.y = IMG_T_LEFT_Y; rect.w = IMG_T_LEFT_WW; rect.h = IMG_T_LEFT_H; LoadImage(&rect, imgT_left); // load the palette into the frame buffer rect.x = PAL_T_LEFT_X; rect.y = PAL_T_LEFT_Y; rect.w = PAL_T_LEFT_WW; rect.h = 1; LoadImage(&rect, palT_left); // get the texture page for the image tpage = GetTPage(2, 0, IMG_T_LEFT_X, IMG_T_LEFT_Y); InitSprite( (object_ptr)&t_left.sprite,IMG_T_LEFT_ATTR,0,0,160,240,tpage,0,0,PAL_T_LEFT_X, PAL_T_LEFT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); //--------------- Initialize the right half of title ----------------------- // load image into the frame buffer rect.x = IMG_T_RIGHT_X; rect.y = IMG_T_RIGHT_Y; rect.w = IMG_T_RIGHT_WW; rect.h = IMG_T_RIGHT_H; LoadImage(&rect, imgT_right); // load palette into the frame buffer rect.x = PAL_T_RIGHT_X; rect.y = PAL_T_RIGHT_Y; rect.w = PAL_T_RIGHT_WW; rect.h = 1; LoadImage(&rect, palT_right); // get the texture page for the image tpage = GetTPage(2, 0, IMG_T_RIGHT_X, IMG_T_RIGHT_Y); InitSprite( (object_ptr)&t_right.sprite,IMG_T_RIGHT_ATTR,160,0,160,240,tpage,0,0,PAL_T_RIGHT_X, PAL_T_RIGHT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); printf("Init title screen complete \n"); }// end InitTitleScreen //------------------------------------------------------------------------------ // Function: InitStoryScreen() // Description: Initialize members for the story screen // Parameters: none // Returns: void // Notes: Using tga2img by Mario Perdue //------------------------------------------------------------------------------ void InitStoryScreen( void ) { u_short tpage; // texture page RECT rect; // frame buffer rectangular area //--------------- Initialize the left half of screen ------------------------ // load image into the frame buffer rect.x = IMG_S_LEFT_X; rect.y = IMG_S_LEFT_Y; rect.w = IMG_S_LEFT_WW; rect.h = IMG_S_LEFT_H; LoadImage(&rect, imgS_left); // load the palette into the frame buffer rect.x = PAL_S_LEFT_X; rect.y = PAL_S_LEFT_Y; rect.w = PAL_S_LEFT_WW; rect.h = 1; LoadImage(&rect, palS_left); // get the texture page for the mage tpage = GetTPage(2, 0, IMG_S_LEFT_X, IMG_S_LEFT_Y); InitSprite( (object_ptr)&s_left.sprite,IMG_S_LEFT_ATTR,0,0,160,240,tpage,0,0,PAL_S_LEFT_X, PAL_S_LEFT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); //--------------- Initialize the right half of screen ----------------------- // load image into the frame buffer rect.x = IMG_S_RIGHT_X; rect.y = IMG_S_RIGHT_Y; rect.w = IMG_S_RIGHT_WW; rect.h = IMG_S_RIGHT_H; LoadImage(&rect, imgS_right); // load the palette into the frame buffer rect.x = PAL_S_RIGHT_X; rect.y = PAL_S_RIGHT_Y; rect.w = PAL_S_RIGHT_WW; rect.h = 1; LoadImage(&rect, palS_right); // get the texture page for the image tpage = GetTPage(2, 0, IMG_S_RIGHT_X, IMG_S_RIGHT_Y); InitSprite( (object_ptr)&s_right.sprite,IMG_S_RIGHT_ATTR,160,0,160,240,tpage,0,0,PAL_S_RIGHT_X, PAL_S_RIGHT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); printf("Init story screen complete \n"); }// end InitStoryScreen //------------------------------------------------------------------------------ // Function: InitCityScreen() // Description: Initialize members for city image // Parameters: none // Returns: void // Notes: Using tga2img by Mario Perdue //------------------------------------------------------------------------------ void InitCityScreen( void ) { u_short tpage; // texture page RECT rect; // frame buffer rectangular area //--------------- Initialize the left half of screen ------------------------ // load image into the frame buffer rect.x = IMG_C_LEFT_X; rect.y = IMG_C_LEFT_Y; rect.w = IMG_C_LEFT_WW; rect.h = IMG_C_LEFT_H; LoadImage(&rect, imgC_left); // load the palette into the frame buffer rect.x = PAL_C_LEFT_X; rect.y = PAL_C_LEFT_Y; rect.w = PAL_C_LEFT_WW; rect.h = 1; LoadImage(&rect, palC_left); // get the texture page for the mage tpage = GetTPage(2, 0, IMG_C_LEFT_X, IMG_C_LEFT_Y); InitSprite( (object_ptr)&c_left.sprite,IMG_C_LEFT_ATTR,0,0,160,240,tpage,0,0,PAL_C_LEFT_X, PAL_C_LEFT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); printf("Loaded city screen left\n"); //--------------- Initialize the right half of screen ----------------------- // load image into the frame buffer rect.x = IMG_C_RIGHT_X; rect.y = IMG_C_RIGHT_Y; rect.w = IMG_C_RIGHT_WW; rect.h = IMG_C_RIGHT_H; LoadImage(&rect, imgC_right); // load the palette into the frame buffer rect.x = PAL_C_RIGHT_X; rect.y = PAL_C_RIGHT_Y; rect.w = PAL_C_RIGHT_WW; rect.h = 1; LoadImage(&rect, palC_right); // get the texture page for the image tpage = GetTPage(2, 0, IMG_C_RIGHT_X, IMG_C_RIGHT_Y); InitSprite( (object_ptr)&c_right.sprite,IMG_C_RIGHT_ATTR,160,0,160,240,tpage,0,0,PAL_C_RIGHT_X, PAL_C_RIGHT_Y,0x80,0x80,0x80,0,0,ONE,ONE,0 ); printf("Loaded city screen right\n"); printf("Init city screen complete \n"); }// end InitCityScreen //------------------------------------------------------------------------------ // Function: DrawStoryScreen() // Description: Register story screen image in OT // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ void DrawStoryScreen( void ) { GsSortFastSprite( &s_left.sprite, &world_ordering_table[output_buffer_index], 0 ); GsSortFastSprite( &s_right.sprite, &world_ordering_table[output_buffer_index], 0 ); } //------------------------------------------------------------------------------ // Function: DrawTitleScreen() // Description: Register title screen image in OT // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ void DrawTitleScreen( void ) { GsSortFastSprite( &t_left.sprite, &world_ordering_table[output_buffer_index], 0 ); GsSortFastSprite( &t_right.sprite, &world_ordering_table[output_buffer_index], 0 ); } //------------------------------------------------------------------------------ // Function: DrawCityScreen() // Description: Register city screen image in OT // Parameters: none // Returns: void // Notes: Special thanks to Colin of (SCEE) for clearing this up //------------------------------------------------------------------------------ void DrawCityScreen( void ) { c_left.sprite.x = game_info.scroll_counter; GsSortFastSprite( &c_left.sprite, &world_ordering_table[output_buffer_index], 0 ); c_right.sprite.x = game_info.scroll_counter + (SCREEN_WIDTH/2); GsSortFastSprite( &c_right.sprite, &world_ordering_table[output_buffer_index], 0 ); c_left.sprite.x = game_info.scroll_counter + SCREEN_WIDTH; GsSortFastSprite( &c_left.sprite, &world_ordering_table[output_buffer_index], 0 ); c_right.sprite.x = game_info.scroll_counter + SCREEN_WIDTH + (SCREEN_WIDTH/2); GsSortFastSprite( &c_right.sprite, &world_ordering_table[output_buffer_index], 0 ); }// end DrawCityScreen //-----------------------------------EOF----------------------------------------