| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando *
- * *
- * $Archive:: /Commando/Code/Commando/gamemenu.cpp $*
- * *
- * $Author:: Bhayes $*
- * *
- * $Modtime:: 2/08/02 12:16p $*
- * *
- * $Revision:: 191 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include "gamemenu.h"
- #include "scene.h"
- #include "camera.h"
- #include "ww3d.h"
- #include "debug.h"
- #include "assets.h"
- #include "font3d.h"
- #include "render2d.h"
- #include "saveloadstatus.h"
- #include "cnetwork.h"
- #include "netinterface.h"
- #include "langmode.h"
- #include "wolgmode.h"
- #include "miscutil.h"
- #include "_globals.h"
- #include "player.h"
- #include "gamedata.h"
- #include "useroptions.h"
- #include "devoptions.h"
- #include "playertype.h"
- #include "singlepl.h"
- #include "translatedb.h"
- #include "string_ids.h"
- #include "playermanager.h"
- #include "teammanager.h"
- #include "thread.h"
- #include "textdisplay.h"
- #include "msgloop.h"
- #include "texture.h"
- #include "combatgmode.h"
- #include "font3d.h"
- #include "wwprofile.h"
- #include "wwmemlog.h"
- #include "physlist.h"
- #include "pscene.h"
- #include "dazzle.h"
- #include "decophys.h"
- #include "wwaudio.h"
- #include "audiblesound.h"
- #include "gametype.h"
- #include "dx8wrapper.h"
- #include "dx8renderer.h"
- #include "rect.h"
- #include "dialogmgr.h"
- #include "renegadedialogmgr.h"
- #include "textureloader.h"
- #include "input.h"
- #include "menudialog.h"
- #include "popupdialog.h"
- #include "resource.h"
- #include "gameinitmgr.h"
- #include "menubackdrop.h"
- #include "dlgmainmenu.h"
- #include "ccamera.h"
- bool g_is_loading = false;
- ////////////////////////////////////////////////////////////////////
- //
- // MenuGameModeClass2
- //
- ////////////////////////////////////////////////////////////////////
- MenuGameModeClass2::MenuGameModeClass2 (void) :
- MenuMusic (NULL)
- {
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Init
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Init (void)
- {
- const char *MENU_MUSIC_FILENAME = "menu.mp3";
- //
- // Create the background music
- //
- MenuMusic = WWAudioClass::Get_Instance ()->Create_Sound_Effect (MENU_MUSIC_FILENAME);
- if (MenuMusic != NULL) {
- MenuMusic->Set_Type (AudibleSoundClass::TYPE_MUSIC);
- MenuMusic->Set_Priority (1.0F);
- MenuMusic->Set_Loop_Count (0);
- MenuMusic->Set_Volume (1.0F);
- }
-
- if (MenuDialogClass::Get_BackDrop () && MenuDialogClass::Get_BackDrop ()->Peek_Model () == NULL) {
- MenuDialogClass::Get_BackDrop ()->Set_Model ("IF_BACK01");
- MenuDialogClass::Get_BackDrop ()->Set_Animation ("IF_BACK01.IF_BACK01");
- }
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Shutdown
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Shutdown (void)
- {
- if (MenuMusic != NULL) {
- MenuMusic->Stop ();
- REF_PTR_RELEASE (MenuMusic);
- }
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Think
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Think (void)
- {
- if (MenuMusic != NULL) {
-
- //
- // Start playing the music where necessary and stop the music
- // where necessary
- //
- if (Is_Active () && MenuMusic->Is_Playing () == false) {
- if (IS_SOLOPLAY || GameInitMgrClass::Is_Game_In_Progress () == false) {
- MenuMusic->Stop ();
- MenuMusic->Play ();
- }
- } else if (Is_Active () == false && MenuMusic->Is_Playing ()) {
- MenuMusic->Stop ();
- }
- }
- if (Is_Active () && DialogMgrClass::Get_Dialog_Count () == 0) {
- Deactivate ();
- }
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Think
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Render (void)
- {
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Activate
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Activate (void)
- {
- WWMEMLOG(MEM_GAMEDATA);
- GameModeClass::Activate();
- //
- // Pause game sounds and activate menu sounds
- //
- if (IS_SOLOPLAY && WWAudioClass::Get_Instance () != NULL) {
- WWAudioClass::Get_Instance ()->Set_Active_Sound_Page (WWAudioClass::PAGE_SECONDARY);
- }
- if (COMBAT_CAMERA != NULL) {
- COMBAT_CAMERA->Set_Snap_Shot_Mode (false);
- }
- return ;
- }
- ////////////////////////////////////////////////////////////////////
- //
- // Deactivate
- //
- ////////////////////////////////////////////////////////////////////
- void
- MenuGameModeClass2::Deactivate (void)
- {
- WWMEMLOG(MEM_GAMEDATA);
- //
- // Resume game sounds as necessary
- //
- if (WWAudioClass::Get_Instance () != NULL) {
- WWAudioClass::Get_Instance ()->Flush_Playlist (WWAudioClass::PAGE_SECONDARY);
- WWAudioClass::Get_Instance ()->Set_Active_Sound_Page (WWAudioClass::PAGE_PRIMARY);
- }
- DialogMgrClass::Flush_Dialogs ();
- GameModeClass::Deactivate();
- return ;
- }
|