]> icculus.org git repositories - taylor/freespace2.git/blob - src/hud/hudobserver.cpp
try to prevent random crashing from wing ai
[taylor/freespace2.git] / src / hud / hudobserver.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Hud/HUDObserver.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * $NoKeywords: $
16  *
17  */
18
19 #include "hud.h"
20 #include "hudobserver.h"
21 #include "freespace.h"
22 #include "multi.h"
23 #include "font.h"
24 #include "missiongoals.h"
25 #include "3d.h"
26 #include "linklist.h"
27 #include "debris.h"
28 #include "hudtargetbox.h"
29 #include "sound.h"
30 #include "gamesnd.h"
31 #include "radar.h"
32 #include "hudconfig.h"
33 #include "alphacolors.h"
34
35 // use these to redirect Player_ship and Player_ai when switching into ai mode
36 ship Hud_obs_ship;
37 ai_info Hud_obs_ai;
38
39
40 // initialize observer hud stuff
41 void hud_observer_init(ship *shipp,ai_info *aip)
42 {
43         // setup the pseduo ship and ai
44         memcpy(&Hud_obs_ship,shipp,sizeof(ship));
45         memcpy(&Hud_obs_ai,aip,sizeof(ai_info));
46
47         HUD_config.is_observer = 1;
48         HUD_config.show_flags = HUD_observer_default_flags;
49         HUD_config.show_flags2 = HUD_observer_default_flags2;
50
51         HUD_config.popup_flags = 0x0;
52         HUD_config.popup_flags2 = 0x0;
53
54         // shutdown any playing static animations
55         hud_targetbox_static_init();
56 }
57
58 void hud_obs_render_player(int loc,net_player *pl)
59 {
60 }
61
62 void hud_obs_render_players_all()
63 {
64         int idx,count;
65
66         // render kills and stats information for all players
67         count = 0;
68         for(idx=0;idx<MAX_PLAYERS;idx++){
69                 if(MULTI_CONNECTED(Net_players[idx]) && !MULTI_STANDALONE(Net_players[idx]) && !MULTI_PERM_OBSERVER(Net_players[idx]) ){
70                         hud_obs_render_player(count,&Net_players[idx]);
71                 }
72         }
73 }
74
75 void hud_render_observer()
76 {
77         SDL_assert((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER));
78
79         // render individual player text
80         hud_obs_render_players_all();
81 }
82