Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

MainSponsor.cpp

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00018 
00023 #include "Network.h"
00024 #include "Sound.h"
00025 #include "Typer.h"
00026 #include "..\AEngine\AEngine.h"
00027 #include "Overhead.h"
00028 #include "MainFuncs.h"
00029 #include "Globals.h"
00030 
00031 using namespace Overhead;
00032 using namespace NetworkMessages;
00033 
00034 //------------------------------------------------------------------------------------
00035 int time;
00036 const int PERIOD = 400;
00037 //------------------------------------------------------------------------------------
00038 //------------------------------------------------------------------------------------
00039 void switchToSponsor()
00040 {
00041         mode = MainModes::sponsor;
00042         time = 0;
00043 }
00044 //------------------------------------------------------------------------------------
00045 void updateSponsor()
00046 {
00047         time++;
00048         if( input_isKeyPressed(KeyCodes::key_ESCAPE) )                  // skip by pressing ESC
00049                 if( time < PERIOD ) time = PERIOD;
00050                 else if( time <2*PERIOD ) time = 2*PERIOD;
00051                 else if( time <3*PERIOD ) time = 3*PERIOD;
00052                 else if( time <4*PERIOD ) time = 4*PERIOD;
00053 
00054         if( time >= 4*PERIOD )
00055         {
00056                 Sound::playMusic( Sound::SMPL_SONG_MENU );
00057                 switchToMainMenu();                             // end of sponsor               
00058         }
00059 }
00060 //------------------------------------------------------------------------------------
00061 void renderSponsor()
00062 {
00063         int t = time % PERIOD;
00064         FLOAT alpha = abs(PERIOD/2 - t) * 2.0f / PERIOD;
00065         alpha = sqrtf( 1.0f - alpha );
00066 
00067         ATexture img;
00068         if( time < PERIOD )                     img = artWork->main_leftField;
00069         else if( time < 2*PERIOD )  img = artWork->main_sponsorMS;
00070         else if( time < 3*PERIOD )  img = artWork->main_sponsorNV;
00071         else                                            img = artWork->main_sponsorPF;
00072 
00073                 overlay_image( img, Vec2D(0.5f,0.5f), Vec2D(1.0f,1.0f), BlendModes::MIX, alpha );
00074 }
00075 //------------------------------------------------------------------------------------

Generated on Wed Apr 23 05:50:15 2003 for Modern Warfare by doxygen1.3-rc2