DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

Common_dialog.h (9894B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
     10 it under the terms of the GNU General Public License as published by
     11 the Free Software Foundation, either version 3 of the License, or
     12 (at your option) any later version.
     13 
     14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
     15 but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 GNU General Public License for more details.
     18 
     19 You should have received a copy of the GNU General Public License
     20 along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.
     23 
     24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
     25 
     26 ===========================================================================
     27 */
     28 
     29 #ifndef __COMMON_DIALOG_H__
     30 #define __COMMON_DIALOG_H__
     31 
     32 static const int	MAX_DIALOGS			= 4;		// maximum dialogs that can be open at one time
     33 static const int	PC_KEYBOARD_WAIT	= 20000;
     34 
     35 /*
     36 ================================================
     37 Dialog box message types 
     38 ================================================
     39 */
     40 enum gameDialogMessages_t {
     41 	GDM_INVALID,
     42 	GDM_SWAP_DISKS_TO1,
     43 	GDM_SWAP_DISKS_TO2,
     44 	GDM_SWAP_DISKS_TO3,
     45 	GDM_NO_GAMER_PROFILE,
     46 	GDM_PLAY_ONLINE_NO_PROFILE,
     47 	GDM_LEADERBOARD_ONLINE_NO_PROFILE,
     48 	GDM_NO_STORAGE_SELECTED,
     49 	GDM_ONLINE_INCORRECT_PERMISSIONS,
     50 	GDM_SP_QUIT_SAVE,
     51 	GDM_SP_RESTART_SAVE,
     52 	GDM_SP_SIGNIN_CHANGE,
     53 	GDM_SERVER_NOT_AVAILABLE,
     54 	GDM_CONNECTION_LOST_HOST,
     55 	GDM_CONNECTION_LOST,
     56 	GDM_OPPONENT_CONNECTION_LOST,
     57 	GDM_HOST_CONNECTION_LOST,
     58 	GDM_HOST_CONNECTION_LOST_STATS,
     59 	GDM_FAILED_TO_LOAD_RANKINGS,
     60 	GDM_HOST_QUIT,
     61 	GDM_BECAME_HOST_PARTY,			// Became host of party
     62 	GDM_NEW_HOST_PARTY,				// Someone else became host of party
     63 	GDM_LOBBY_BECAME_HOST_GAME,		// In lobby, you became game host
     64 	GDM_LOBBY_NEW_HOST_GAME,		// In lobby, new game host was chosen (not you)
     65 	GDM_NEW_HOST_GAME,				// Host left/DC'd, someone else is new host, unranked game
     66 	GDM_NEW_HOST_GAME_STATS_DROPPED,// Host left/DC'd, someone else is new host, ranked game so stats were dropped
     67 	GDM_BECAME_HOST_GAME,				// Host left/DC'd, you became host, unranked game
     68 	GDM_BECAME_HOST_GAME_STATS_DROPPED, // Host left/DC'd, you became host, ranked game so stats were dropped
     69 	GDM_LOBBY_DISBANDED,
     70 	GDM_LEAVE_WITH_PARTY,
     71 	GDM_LEAVE_LOBBY_RET_MAIN,
     72 	GDM_LEAVE_LOBBY_RET_NEW_PARTY,
     73 	GDM_MIGRATING,
     74 	GDM_OPPONENT_LEFT,
     75 	GDM_NO_MATCHES_FOUND,
     76 	GDM_INVALID_INVITE,
     77 	GDM_KICKED,
     78 	GDM_BANNED,
     79 	GDM_SAVING,
     80 	GDM_OVERWRITE_SAVE,
     81 	GDM_LOAD_REQUEST,
     82 	GDM_AUTOSAVE_DISABLED_STORAGE_REMOVED,
     83 	GDM_STORAGE_INVALID,
     84 	GDM_STORAGE_REMOVED,
     85 	GDM_CONNECTING,
     86 	GDM_REFRESHING,
     87 	GDM_DELETE_SAVE,
     88 	GDM_DELETING,
     89 	GDM_BINDING_ALREDY_SET,
     90 	GDM_CANNOT_BIND,
     91 	GDM_OVERLAY_DISABLED,
     92 	GDM_DIRECT_MAP_CHANGE,
     93 	GDM_DELETE_AUTOSAVE,
     94 	GDM_QUICK_SAVE,
     95 	GDM_MULTI_RETRY,
     96 	GDM_MULTI_SELF_DESTRUCT,	
     97 	GDM_MULTI_VDM_QUIT,
     98 	GDM_MULTI_COOP_QUIT,
     99 	GDM_LOADING_PROFILE,
    100 	GDM_STORAGE_REQUIRED,
    101 	GDM_INSUFFICENT_STORAGE_SPACE,
    102 	GDM_PARTNER_LEFT,
    103 	GDM_RESTORE_CORRUPT_SAVEGAME,
    104 	GDM_UNRECOVERABLE_SAVEGAME,
    105 	GDM_PROFILE_SAVE_ERROR,
    106 	GDM_LOBBY_FULL,
    107 	GDM_QUIT_GAME,
    108 	GDM_CONNECTION_PROBLEMS,
    109 	GDM_VOICE_RESTRICTED,
    110 	GDM_LOAD_DAMAGED_FILE,
    111 	GDM_MUST_SIGNIN,
    112 	GDM_CONNECTION_LOST_NO_LEADERBOARD,
    113 	GDM_SP_SIGNIN_CHANGE_POST,
    114 	GDM_MIGRATING_WAITING,
    115 	GDM_MIGRATING_RELAUNCHING,
    116 	GDM_MIGRATING_FAILED_CONNECTION,
    117 	GDM_MIGRATING_FAILED_CONNECTION_STATS,
    118 	GDM_MIGRATING_FAILED_DISBANDED,
    119 	GDM_MIGRATING_FAILED_DISBANDED_STATS,
    120 	GDM_MIGRATING_FAILED_PARTNER_LEFT,
    121 	GDM_HOST_RETURNED_TO_LOBBY,
    122 	GDM_HOST_RETURNED_TO_LOBBY_STATS_DROPPED,
    123 	GDM_FAILED_JOIN_LOCAL_SESSION,
    124 	GDM_DELETE_CORRUPT_SAVEGAME,
    125 	GDM_LEAVE_INCOMPLETE_INSTANCE,
    126 	GDM_UNBIND_CONFIRM,
    127 	GDM_BINDINGS_RESTORE,
    128 	GDM_NEW_HOST,
    129 	GDM_CONFIRM_VIDEO_CHANGES,
    130 	GDM_UNABLE_TO_USE_SELECTED_STORAGE_DEVICE,
    131 	GDM_ERROR_LOADING_SAVEGAME,
    132 	GDM_ERROR_SAVING_SAVEGAME,
    133 	GDM_DISCARD_CHANGES,
    134 	GDM_LEAVE_LOBBY,
    135 	GDM_LEAVE_LOBBY_AND_TEAM,
    136 	GDM_CONTROLLER_DISCONNECTED_0,
    137 	GDM_CONTROLLER_DISCONNECTED_1,
    138 	GDM_CONTROLLER_DISCONNECTED_2,
    139 	GDM_CONTROLLER_DISCONNECTED_3,
    140 	GDM_CONTROLLER_DISCONNECTED_4,
    141 	GDM_CONTROLLER_DISCONNECTED_5,
    142 	GDM_CONTROLLER_DISCONNECTED_6,
    143 	GDM_DLC_ERROR_REMOVED,
    144 	GDM_DLC_ERROR_CORRUPT,
    145 	GDM_DLC_ERROR_MISSING,
    146 	GDM_DLC_ERROR_MISSING_GENERIC,
    147 	GDM_DISC_SWAP,
    148 	GDM_NEEDS_INSTALL,
    149 	GDM_NO_SAVEGAMES_AVAILABLE,
    150 	GDM_ERROR_JOIN_TWO_PROFILES_ONE_BOX,
    151 	GDM_WARNING_PLAYING_COOP_SOLO,
    152 	GDM_MULTI_COOP_QUIT_LOSE_LEADERBOARDS,
    153 	GDM_CORRUPT_CONTINUE,
    154 	GDM_MULTI_VDM_QUIT_LOSE_LEADERBOARDS,
    155 	GDM_WARNING_PLAYING_VDM_SOLO,
    156 	GDM_NO_GUEST_SUPPORT,
    157 	GDM_DISC_SWAP_CONFIRMATION,
    158 	GDM_ERROR_LOADING_PROFILE,
    159 	GDM_CANNOT_INVITE_LOBBY_FULL,
    160 	GDM_WARNING_FOR_NEW_DEVICE_ABOUT_TO_LOSE_PROGRESS,
    161 	GDM_DISCONNECTED,
    162 	GDM_INCOMPATIBLE_NEWER_SAVE,
    163 	GDM_ACHIEVEMENTS_DISABLED_DUE_TO_CHEATING,
    164 	GDM_INCOMPATIBLE_POINTER_SIZE,
    165 	GDM_TEXTUREDETAIL_RESTARTREQUIRED,
    166 	GDM_TEXTUREDETAIL_INSUFFICIENT_CPU,
    167 	GDM_CHECKPOINT_SAVE,
    168 	GDM_CALCULATING_BENCHMARK,
    169 	GDM_DISPLAY_BENCHMARK,
    170 	GDM_DISPLAY_CHANGE_FAILED,
    171 	GDM_GPU_TRANSCODE_FAILED,
    172 	GDM_OUT_OF_MEMORY,
    173 	GDM_CORRUPT_PROFILE,
    174 	GDM_PROFILE_TOO_OUT_OF_DATE_DEVELOPMENT_ONLY,
    175 	GDM_SP_LOAD_SAVE,
    176 	GDM_INSTALLING_TROPHIES,
    177 	GDM_XBOX_DEPLOYMENT_TYPE_FAIL,
    178 	GDM_SAVEGAME_WRONG_LANGUAGE,
    179 	GDM_GAME_RESTART_REQUIRED,
    180 	GDM_MAX
    181 };
    182 
    183 /*
    184 ================================================
    185 Dialog box types
    186 ================================================
    187 */
    188 enum dialogType_t {
    189 	DIALOG_INVALID = -1,
    190 	DIALOG_ACCEPT,
    191 	DIALOG_CONTINUE,
    192 	DIALOG_ACCEPT_CANCEL,
    193 	DIALOG_YES_NO,
    194 	DIALOG_CANCEL,
    195 	DIALOG_WAIT,
    196 	DIALOG_WAIT_BLACKOUT,
    197 	DIALOG_WAIT_CANCEL,
    198 	DIALOG_DYNAMIC,
    199 	DIALOG_QUICK_SAVE,
    200 	DIALOG_TIMER_ACCEPT_REVERT,
    201 	DIALOG_CRAWL_SAVE,
    202 	DIALOG_CONTINUE_LARGE,
    203 	DIALOG_BENCHMARK,
    204 };
    205 
    206 /*
    207 ================================================
    208 idDialogInfo
    209 ================================================
    210 */
    211 class idDialogInfo {
    212 public:
    213 	idDialogInfo() {
    214 		msg					= GDM_INVALID;
    215 		type				= DIALOG_ACCEPT;
    216 		acceptCB			= NULL;
    217 		cancelCB			= NULL;
    218 		altCBOne			= NULL;
    219 		altCBTwo			= NULL;
    220 		showing				= false;
    221 		clear				= false;
    222 		waitClear			= false;
    223 		pause				= false;
    224 		startTime			= 0;
    225 		killTime			= 0;
    226 		leaveOnClear		= false;
    227 		renderDuringLoad	= false;
    228 	}
    229 	gameDialogMessages_t	msg;
    230 	dialogType_t			type;
    231 	idSWFScriptFunction *	acceptCB;
    232 	idSWFScriptFunction *	cancelCB;
    233 	idSWFScriptFunction *	altCBOne;
    234 	idSWFScriptFunction *	altCBTwo;
    235 	bool					showing;
    236 	bool					clear;
    237 	bool					waitClear;
    238 	bool					pause;
    239 	bool					forcePause;
    240 	bool					leaveOnClear;
    241 	bool					renderDuringLoad;
    242 	int						startTime;
    243 	int						killTime;
    244 	idStrStatic< 256 >		overrideMsg;
    245 
    246 	idStrId					txt1;
    247 	idStrId					txt2;
    248 	idStrId					txt3;
    249 	idStrId					txt4;
    250 };
    251 
    252 /*
    253 ================================================
    254 idLoadScreenInfo 
    255 ================================================
    256 */
    257 class idLoadScreenInfo {
    258 public:
    259 	idStr	varName;
    260 	idStr	value;
    261 };
    262 
    263 /*
    264 ==============================================================
    265 
    266   Common Dialog
    267 
    268 ==============================================================
    269 */
    270 
    271 class idCommonDialog {
    272 public:
    273 	void	Init();
    274 	void	Render( bool loading );
    275 	void	Shutdown();
    276 	void	Restart();
    277 
    278 	bool	IsDialogPausing() { return dialogPause; }
    279 	void	ClearDialogs( bool forceClear = false );
    280 	bool	HasDialogMsg( gameDialogMessages_t msg, bool * isNowActive );
    281 	void	AddDialog( gameDialogMessages_t msg, dialogType_t type, idSWFScriptFunction * acceptCallback, idSWFScriptFunction * cancelCallback, bool pause, const char * location = NULL, int lineNumber = 0, bool leaveOnMapHeapReset = false, bool waitOnAtlas = false, bool renderDuringLoad = false );
    282 	void	AddDynamicDialog( gameDialogMessages_t msg, const idStaticList< idSWFScriptFunction *, 4 > & callbacks, const idStaticList< idStrId, 4 > & optionText, bool pause, idStrStatic< 256 > overrideMsg, bool leaveOnMapHeapReset = false, bool waitOnAtlas = false, bool renderDuringLoad = false );
    283 	void	AddDialogIntVal( const char * name, int val );
    284 	bool	IsDialogActive();
    285 	void	ClearDialog( gameDialogMessages_t msg, const char * location = NULL, int lineNumber = 0 );
    286 	void	ShowSaveIndicator( bool show );
    287 	bool	HasAnyActiveDialog() const { return ( messageList.Num() > 0 ) && ( !messageList[0].clear ); }
    288 
    289 	void	ClearAllDialogHack();
    290 	idStr	GetDialogMsg( gameDialogMessages_t msg, idStr & message, idStr & title );
    291 	bool	HandleDialogEvent( const sysEvent_t * sev );
    292 
    293 protected:
    294 	void	RemoveWaitDialogs();
    295 	void	ShowDialog( const idDialogInfo & info );
    296 	void	ShowNextDialog();
    297 	void	ActivateDialog( bool activate );
    298 	void	AddDialogInternal( idDialogInfo & info );
    299 	void	ReleaseCallBacks( int index );
    300 
    301 private:
    302 	bool	dialogPause;
    303 	idSWF *	dialog;
    304 	idSWF *	saveIndicator;
    305 	bool	dialogShowingSaveIndicatorRequested;
    306 	int		dialogShowingSaveIndicatorTimeRemaining;
    307 
    308 	idStaticList< idDialogInfo, MAX_DIALOGS > messageList;
    309 	idStaticList< idLoadScreenInfo, 16 > loadScreenInfo;
    310 
    311 	int		startSaveTime;		// with stopSaveTime, useful to pass 360 TCR# 047.  Need to keep the dialog on the screen for a minimum amount of time
    312 	int		stopSaveTime;
    313 	bool	dialogInUse;		// this is to prevent an active msg getting lost during a map heap reset
    314 };
    315 
    316 #endif