Files
Cesarus85--ringfall-mjolnir-vr/source/interface/ui_widget_game_data_input_functions.c
T

3127 lines
92 KiB
C

/*
UI_WIDGET_GAME_DATA_INPUT_FUNCTIONS.C
symbols in this file:
000E01B0 0060:
_ui_widget_game_data_function_invoke (0000)
000E0210 0010:
_code_000e0210 (0000)
000E0220 0110:
_code_000e0220 (0000)
000E0330 00b0:
_code_000e0330 (0000)
000E03E0 00b0:
_code_000e03e0 (0000)
000E0490 0080:
_code_000e0490 (0000)
000E0510 0110:
_code_000e0510 (0000)
000E0620 0090:
_code_000e0620 (0000)
000E06B0 07e0:
_code_000e06b0 (0000)
000E0E90 07c0:
_code_000e0e90 (0000)
000E1650 04c0:
_code_000e1650 (0000)
000E1B10 0120:
_code_000e1b10 (0000)
000E1C30 00b0:
_code_000e1c30 (0000)
000E1CE0 0130:
_code_000e1ce0 (0000)
000E1E10 0090:
_code_000e1e10 (0000)
000E1EA0 0130:
_code_000e1ea0 (0000)
000E1FD0 0090:
_code_000e1fd0 (0000)
000E2060 00b0:
_code_000e2060 (0000)
000E2110 00b0:
_code_000e2110 (0000)
000E21C0 00c0:
_code_000e21c0 (0000)
000E2280 0090:
_code_000e2280 (0000)
000E2310 01c0:
_code_000e2310 (0000)
000E24D0 0110:
_code_000e24d0 (0000)
000E25E0 0070:
_code_000e25e0 (0000)
000E2650 0090:
_code_000e2650 (0000)
000E26E0 00b0:
_code_000e26e0 (0000)
000E2790 01c0:
_code_000e2790 (0000)
000E2950 00b0:
_code_000e2950 (0000)
000E2A00 00a0:
_code_000e2a00 (0000)
000E2AA0 00b0:
_code_000e2aa0 (0000)
000E2B50 0030:
_code_000e2b50 (0000)
000E2B80 0140:
_code_000e2b80 (0000)
000E2CC0 0050:
_code_000e2cc0 (0000)
000E2D10 00b0:
_code_000e2d10 (0000)
000E2DC0 0050:
_code_000e2dc0 (0000)
000E2E10 00b0:
_code_000e2e10 (0000)
000E2EC0 0110:
_code_000e2ec0 (0000)
000E2FD0 0110:
_code_000e2fd0 (0000)
000E30E0 0030:
_code_000e30e0 (0000)
000E3110 0030:
_code_000e3110 (0000)
000E3140 02c0:
_code_000e3140 (0000)
000E3400 0590:
_code_000e3400 (0000)
000E3990 04d0:
_code_000e3990 (0000)
000E3E60 0480:
_code_000e3e60 (0000)
000E42E0 0190:
_code_000e42e0 (0000)
000E4470 01b0:
_code_000e4470 (0000)
00276E0C 0018:
_rdata_00276e0c (0000)
00276E24 002b:
??_C@_0CL@DNDKGOAJ@invalid?5game_data_input_referenc@ (0000)
00276E50 003f:
??_C@_0DP@OKLHFPEA@c?3?2halo?2SOURCE?2interface?2ui_widg@ (0000)
00276E90 0052:
??_C@_0FC@OBGFIFIH@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00276EE8 0052:
??_C@_0FC@LKBMLMHJ@expected?5a?5container?5widget?5for?5@ (0000)
00276F3C 0038:
??_C@_0DI@JCPEOBOE@this?5doesn?8t?5look?5like?5the?5setti@ (0000)
00276F74 003e:
??_C@_0DO@LONIMMNH@invalid?5widget?5trying?5to?5update?5@ (0000)
00276FB8 005e:
??_C@_0FO@FDLMAEGD@expected?5a?5container?5widget?5w?1?52@ (0000)
00277018 004d:
??_C@_0EN@HLAAGDPF@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277068 004d:
??_C@_0EN@KLLFONFN@expected?5a?5container?5widget?5for?5@ (0000)
002770B8 003a:
??_C@_0DK@ENICFAKO@this?5doesn?8t?5look?5like?5the?5diffi@ (0000)
002770F4 000e:
??_C@_0O@JEJFBGJL@01?401?414?42342?$AA@ (0000)
00277104 0008:
??_C@_07GIJHABND@longest?$AA@ (0000)
0027710C 0007:
??_C@_06KLBAJMAC@putput?$AA@ (0000)
00277114 0007:
??_C@_06CLLOKCD@wizard?$AA@ (0000)
0027711C 000b:
??_C@_0L@BAHFJNLA@bloodgulch?$AA@ (0000)
00277128 000f:
??_C@_0P@NBJBBIIG@boardingaction?$AA@ (0000)
00277138 0009:
??_C@_08CNOAMHDF@carousel?$AA@ (0000)
00277144 0009:
??_C@_08DIOAEAHJ@chillout?$AA@ (0000)
00277150 000b:
??_C@_0L@GMPBGCHN@hangemhigh?$AA@ (0000)
0027715C 0009:
??_C@_08HDGLKCD@prisoner?$AA@ (0000)
00277168 0008:
??_C@_07JLEJHHKP@ratrace?$AA@ (0000)
00277170 000a:
??_C@_09COCHMMPL@damnation?$AA@ (0000)
0027717C 000b:
??_C@_0L@IAKJCANM@sidewinder?$AA@ (0000)
00277188 000c:
??_C@_0M@PGDPDJHM@beavercreek?$AA@ (0000)
00277194 0024:
??_C@_0CE@OEFEPJGP@expected?5?8score?5limit?5type?8?5text@ (0000)
002771B8 001f:
??_C@_0BP@DNJAOFEP@expected?5?8score?5limit?8?5textbox?$AA@ (0000)
002771D8 0025:
??_C@_0CF@KNIJBDBO@expected?5?8number?5of?5players?8?5tex@ (0000)
00277200 0020:
??_C@_0CA@LGKDOIEO@expected?5?8teams?5on?1off?8?5textbox?$AA@ (0000)
00277220 001b:
??_C@_0BL@BDLKAALE@expected?5?8ruleset?8?5textbox?$AA@ (0000)
0027723C 001c:
??_C@_0BM@CJHKAJCC@expected?5?8map?5name?8?5textbox?$AA@ (0000)
00277258 0024:
??_C@_0CE@DLEPIMAK@expected?5?8open?1closed?5game?8?5text@ (0000)
00277280 0043:
??_C@_0ED@MOEHAAMO@this?5doesn?8t?5look?5like?5the?5serve@ (0000)
002772C4 000c:
??_C@_1M@MOFLFCEC@?$AA?$CF?$AAs?$AA?5?$AA?$CF?$AAs?$AA?$AA@ (0000)
002772D0 0037:
??_C@_0DH@HCIIGMBA@this?5doesn?8t?5look?5like?5the?5net?5g@ (0000)
00277308 0024:
??_C@_0CE@ICIOPGOK@j?$DM?$CIMAXIMUM_NETWORK_MACHINE_COUNT@ (0000)
0027732C 0036:
??_C@_0DG@MINPNJCD@expected?5a?5spinner?5list?5for?5loca@ (0000)
00277364 0030:
??_C@_0DA@DJJOFFI@expected?5a?5text?5box?5for?5local?5pl@ (0000)
00277394 003d:
??_C@_0DN@HELEDMHI@expected?5container?5widget?5for?5lo@ (0000)
002773D4 0004:
??_C@_13HGPDMIBE@?$AA?$DP?$AA?$AA@ (0000)
002773D8 001a:
??_C@_1BK@JLDDOLFH@?$AA?$CF?$AAd?$AA?3?$AA?$CF?$AA0?$AA2?$AAd?$AA?3?$AA?$CF?$AA0?$AA2?$AAd?$AA?$AA@ (0000)
002773F4 0014:
??_C@_1BE@HOCBODIC@?$AA?$CF?$AA0?$AA2?$AAd?$AA?3?$AA?$CF?$AA0?$AA2?$AAd?$AA?$AA@ (0000)
00277408 000e:
??_C@_1O@KKMDEBPC@?$AA0?$AA?3?$AA?$CF?$AA0?$AA2?$AAd?$AA?$AA@ (0000)
00277418 000a:
??_C@_19FLLBDBFH@?$AA?9?$AA?3?$AA?9?$AA?9?$AA?$AA@ (0000)
00277424 003b:
??_C@_0DL@IGDJEBKB@this?5doesn?8t?5look?5like?5the?5net?5p@ (0000)
00277460 0069:
??_C@_0GJ@GDGAOPKB@expected?5a?5container?5widget?5w?1?52@ (0000)
002774D0 005c:
??_C@_0FM@EACADPLD@expected?5a?5spinner?5list?5somewher@ (0000)
0027752C 003c:
??_C@_0DM@MLIDECNJ@expected?5some?5list?5items?5for?5mul@ (0000)
00277568 004b:
??_C@_0EL@PGAPPADO@expected?5a?5text?5box?5for?5multipla@ (0000)
002775B4 0037:
??_C@_0DH@NAJMEKMA@expected?5column?5list?5for?5multipl@ (0000)
002775EC 0027:
??_C@_0CH@OMEIFLEC@expected?5a?5text?5box?5for?5objectiv@ (0000)
00277614 0030:
??_C@_0DA@MCJKJCJL@expected?5some?5list?5items?5for?5gam@ (0000)
00277648 004a:
??_C@_0EK@NOJLKNLA@expected?5a?5picture?5?$CIcontainer?$CJ?5f@ (0000)
00277694 002b:
??_C@_0CL@LGIIOMBB@expected?5column?5list?5for?5game?5op@ (0000)
002776C0 004f:
??_C@_0EP@BOHIHIIA@expected?5a?5picture?5?$CIcontainer?$CJ?5f@ (0000)
00277710 0030:
??_C@_0DA@GGNAKDLF@expected?5column?5list?5for?5main?5me@ (0000)
00277740 0039:
??_C@_0DJ@NEPMGIAE@profile?5display?5name?5requires?5a?5@ (0000)
0027777C 0034:
??_C@_0DE@IDFNJNLE@expected?5a?5text?5box?5widget?5for?5p@ (0000)
002777B0 0025:
??_C@_0CF@LGDBPHO@not?5currently?5editing?5a?5game?5var@ (0000)
002777D8 003a:
??_C@_0DK@DJCOLPLF@profile?5color?5picture?5requires?5a@ (0000)
00277814 0010:
??_C@_0BA@NMGAHKFN@no?5network?5game?$AA@ (0000)
00277824 0033:
??_C@_0DD@GEABDGEJ@expected?5text?5box?5widget?5for?5mp?5@ (0000)
00277858 0036:
??_C@_0DG@FJNIMEAA@expected?5container?5widget?5for?5mp@ (0000)
00277890 0043:
??_C@_0ED@NCOLLMLO@expected?5a?5text?5box?5widget?5for?5m@ (0000)
002778D4 001e:
??_C@_0BO@DGGONLGF@network?5connection?5went?5down?$CB?$AA@ (0000)
002778F4 0032:
??_C@_0DC@LKBOPPAG@expected?5text?5box?5widget?5for?5tea@ (0000)
00277928 0039:
??_C@_0DJ@NJMHKDFJ@expected?5a?5container?5bitmap?5for?5@ (0000)
00277968 004e:
??_C@_0EO@HIEOEPPB@this?5doesn?8t?5look?5like?5the?5diffi@ (0000)
002779B8 0032:
??_C@_0DC@GEEGOIHG@this?5doesn?8t?5look?5like?5the?5diffi@ (0000)
002779EC 003a:
??_C@_0DK@NIBNNGB@expected?5a?5text?5box?5widget?5for?5s@ (0000)
00277A28 001f:
??_C@_0BP@PBNOOFFO@failed?5to?5cache?5player?5profile?$AA@ (0000)
00277A48 001a:
??_C@_0BK@NPAODFGK@not?5enough?5cache?5profiles?$AA@ (0000)
00277A64 0021:
??_C@_0CB@DCGNELO@failed?5to?5cache?5playlist?5profile@ (0000)
00277A88 0059:
??_C@_0FJ@HDIOHFBC@?$CIdisplayed_item_index?$FLi?$FN?$DO?$DN0?$CJ?5?$CG?$CG?5@ (0000)
00277AE8 004d:
??_C@_0EN@KBJCFCDK@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277B38 0047:
??_C@_0EH@BMDDKENI@expected?5a?5container?5widget?5for?5@ (0000)
00277B80 0046:
??_C@_0EG@BILAIBJ@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277BC8 003e:
??_C@_0DO@GFLPMCBB@expected?53?5children?5in?5solo?5leve@ (0000)
00277C08 003b:
??_C@_0DL@JGGBBFAD@expected?53?5children?5?$CIlist?5items?$CJ@ (0000)
00277C44 0032:
??_C@_0DC@NCJBNPIM@expected?5a?5spinner?5list?5for?5?8lev@ (0000)
00277C78 0045:
??_C@_0EF@FMFFIBMC@ui?2shell?2main_menu?2player_profil@ (0000)
00277CC0 0048:
??_C@_0EI@ELIPCFPI@expected?53?5children?5in?5multiplay@ (0000)
00277D08 004a:
??_C@_0EK@HCEDFOBE@expected?53?5children?5?$CIlist?5items?$CJ@ (0000)
00277D58 0041:
??_C@_0EB@FBEKHKKG@expected?5a?5spinner?5list?5for?5?8mul@ (0000)
00277D9C 002b:
??_C@_0CL@JILCPJHH@ui?2shell?2strings?2game_variant_de@ (0000)
00277DC8 002e:
??_C@_0CO@INDPLGAP@ui?2shell?2strings?2default_player_@ (0000)
00277DF8 0037:
??_C@_0DH@NLJJIMJD@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277E30 0032:
??_C@_0DC@JNCAIEDE@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277E68 004c:
??_C@_0EM@BLNIGFHJ@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277EB4 003d:
??_C@_0DN@HCKJKMCH@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277EF4 003c:
??_C@_0DM@MHGJENJN@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277F30 0037:
??_C@_0DH@MMEDOPKB@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277F68 0039:
??_C@_0DJ@ONHHKFOO@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00277FA4 003f:
??_C@_0DP@NCMBAOPB@expected?5a?5container?5widget?5for?5@ (0000)
00277FE4 003a:
??_C@_0DK@BBPFDPKF@expected?5a?5container?5widget?5for?5@ (0000)
00278020 002c:
??_C@_0CM@DEIEIGNN@expected?5a?5text?5box?5widget?5for?5p@ (0000)
0027804C 0033:
??_C@_0DD@FHDLHMLN@expected?5profile?5item?5descriptio@ (0000)
00278080 0045:
??_C@_0EF@EGDOMIGB@expected?53?5children?5?$CIlist?5items?$CJ@ (0000)
002780C8 003c:
??_C@_0DM@DDPGFGBL@expected?5a?5spinner?5list?5for?5?8pla@ (0000)
00278108 0048:
??_C@_0EI@EBGMHFNB@ui?2shell?2main_menu?2player_profil@ (0000)
00278150 004a:
??_C@_0EK@KOGGNIM@ui?2shell?2main_menu?2player_profil@ (0000)
0027819C 0010:
??_C@_1BA@KGLKGBLH@?$AA?$CF?$AAs?$AA?$CF?$AAh?$AAs?$AA?$CF?$AAs?$AA?$AA@ (0000)
002781B0 0047:
??_C@_0EH@KIGMJNHF@ui?2shell?2main_menu?2player_profil@ (0000)
002781F8 004d:
??_C@_0EN@HFOKHEMO@ui?2shell?2main_menu?2player_profil@ (0000)
00278248 0018:
??_C@_0BI@NPNPHOJO@invalid?5list?5item?5index?$AA@ (0000)
00278260 0034:
??_C@_0DE@PLLADONH@qtr?9screen?5profile?5list?5has?5inva@ (0000)
00278298 0074:
??_C@_0HE@COKMIIBF@expected?5qtr?9screen?5profile?5sele@ (0000)
00278310 004c:
??_C@_0EM@MHFANJGA@expected?50?5children?5?$CI1?9wide?5spin@ (0000)
0027835C 003f:
??_C@_0DP@KPGPKHEI@expected?5a?5spinner?5list?5for?5?8mp?5@ (0000)
002783A0 004c:
??_C@_0EM@HDAEPJAF@expected?5qtr?9screen?5profile?5sele@ (0000)
002783F0 0049:
??_C@_0EJ@GDOHFLDE@expected?5a?5container?5widget?5for?5@ (0000)
00278440 0048:
??_C@_0EI@LGHFKCIE@expected?5a?5text?5box?5widget?5for?5t@ (0000)
00278488 0041:
??_C@_0EB@BNHDKAMN@expected?52?5children?5in?5player?5co@ (0000)
002784D0 0042:
??_C@_0EC@LDEDNGKC@expected?53?5children?5?$CIlist?5items?$CJ@ (0000)
00278514 0039:
??_C@_0DJ@CBCMOOFM@expected?5a?5spinner?5list?5for?5?8pla@ (0000)
00278550 002c:
??_C@_0CM@CMCNFHCF@no?5list?5items?5associated?5with?5co@ (0000)
00306288 00a4:
_data_00306288 (0000)
00454C60 00a8:
_bss_00454c60 (0000)
*/
/* ---------- headers */
#include "cseries/cseries.h"
#include "interface/ui_widget.h"
#include "interface/ui_widget_definitions.h"
#include "interface/ui_widget_game_data_input_functions.h"
#include "interface/hud_messaging.h"
#include "interface/player_ui.h"
#include "game/game_engine.h"
#include "game/players.h"
#include "main/main.h"
#include "networking/network_client_manager.h"
#include "networking/network_game_globals.h"
#include "networking/network_game_manager.h"
#include "networking/network_messages.h"
#include "saved games/player_profile.h"
#include "saved games/playlist_profile.h"
#include "text/text_group.h"
#include "text/unicode.h"
/* ---------- constants */
enum
{
_ui_widget_type_bitmap = 0,
_ui_widget_type_text_box,
_ui_widget_type_spinner_list,
_ui_widget_type_column_list,
};
enum
{
_ui_error_network_connection_lost = 6,
};
enum multiplayer_game_text_string
{
_multiplayer_game_text_string_capture_the_flag = 3,
_multiplayer_game_text_string_slayer,
_multiplayer_game_text_string_oddball,
_multiplayer_game_text_string_king_of_the_hill,
_multiplayer_game_text_string_race,
_multiplayer_game_text_string_unknown_game_type,
_multiplayer_game_text_string_captures = 22,
_multiplayer_game_text_string_minutes,
_multiplayer_game_text_string_frags,
_multiplayer_game_text_string_laps,
_multiplayer_game_text_string_teams_ready,
_multiplayer_game_text_string_waiting_for_teams,
_multiplayer_game_text_string_single_flag_assault = 28,
_multiplayer_game_text_string_assault,
_multiplayer_game_text_string_single_flag_ctf,
_multiplayer_game_text_string_reverse_tag,
_multiplayer_game_text_string_juggernaut,
_multiplayer_game_text_string_rally,
_multiplayer_game_text_string_waiting_for_machine = 34,
_multiplayer_game_text_string_waiting_for_player,
};
enum multiplayer_game_bitmap_frame
{
_multiplayer_game_bitmap_ctf = 0,
_multiplayer_game_bitmap_king,
_multiplayer_game_bitmap_slayer,
_multiplayer_game_bitmap_oddball,
_multiplayer_game_bitmap_race,
_multiplayer_game_bitmap_unknown,
};
/* ---------- macros */
/* ---------- structures */
struct ui_widget_text_box_parameters
{
wchar_t *text;
short string_list_index;
byte padding06[0x0E];
};
struct ui_widget_list_parameters
{
short selected_list_item_index;
short list_item_top_index;
void *list_items;
word number_of_items;
word padding0E;
struct widget_instance *extended_description;
wchar_t *item_text;
};
union ui_widget_parameters
{
struct ui_widget_text_box_parameters text_box;
struct ui_widget_list_parameters list;
};
struct ui_widget_animation_data
{
short current_frame_index;
short first_frame_index;
short last_frame_index;
short number_of_sprite_frames;
};
struct widget_instance
{
long definition_tag_index;
char const *name;
short local_player_index;
short horizontal_offset;
short vertical_offset;
short type;
boolean visible;
boolean render_regardless_of_controller_index;
boolean never_receive_events;
boolean pause_game_time;
boolean delete_recursion_lock;
boolean error_dialog;
boolean close_if_local_player_controller_present;
byte padding17;
unsigned long creation_time;
unsigned long milliseconds_to_auto_close;
unsigned long auto_close_fade_time;
real alpha_modifier;
struct widget_instance *previous;
struct widget_instance *next;
struct widget_instance *parent;
struct widget_instance *child;
struct widget_instance *focused_child;
union ui_widget_parameters parameters;
struct ui_widget_animation_data animation;
};
struct ui_game_variant
{
byte padding00[0x18];
enum game_engine_type engine_type;
boolean has_teams;
byte padding1D[0x23];
long score_to_win;
byte padding44[0x08];
union
{
boolean ctf_assault;
long race_type;
} game_mode;
long single_flag_time;
byte padding54[0x08];
long oddball_ball_type;
byte padding60[0x08];
};
struct network_game
{
byte padding000[0x24];
char map_name[0x80];
struct ui_game_variant variant;
byte padding10C;
byte game_mode;
byte maximum_player_count;
byte padding10F;
short difficulty;
short machine_count;
byte machines[0x110];
short player_count;
struct network_player players[16];
};
struct player_profile_controller_settings
{
byte button_preset;
byte joystick_preset;
byte look_sensitivity;
boolean invert_look;
boolean vibration_disabled;
boolean flight_stick_aircraft_controls;
boolean autocenter;
boolean ingame_help_disabled;
};
struct player_profile
{
wchar_t name[12];
short primary_color_index;
word flags;
byte solo_levels[10];
short last_single_player_level;
struct player_profile_controller_settings controller_settings;
};
struct playlist_profile
{
wchar_t name[12];
enum game_engine_type engine_type;
boolean teams;
byte padding1D[0x47];
word flags;
byte padding66[2];
};
struct persistent_game_data_info_view
{
char map_name[0x100];
short difficulty;
byte map_index;
boolean valid;
boolean corrupted;
};
struct single_player_level_entry
{
char const *map_name;
boolean available;
boolean completion_marker;
boolean difficulty_marker;
boolean cooperative_marker;
};
struct cached_player_profile_entry
{
long profile_index;
struct player_profile profile;
};
struct cached_variant_profile_entry
{
long profile_index;
struct playlist_profile profile;
};
/* ---------- prototypes */
static int list_indices_sort_proc(
void const *index1,
void const *index2);
static void spinner_list_3wide_determine_displayed_item_indices(
struct widget_instance *list_widget,
long *displayed_item_indices);
static long filter_invalid_list_indices(
long *indices,
long number_of_items);
/* ---------- globals */
extern struct persistent_game_data_info_view persistant_game_data_info;
extern struct single_player_level_entry single_player_level_data[10];
extern struct cached_player_profile_entry cached_player_profile[3];
extern struct cached_variant_profile_entry cached_variant_profile[3];
static struct advertised_game_data *displayed_servers[10];
static wchar_t ui_widget_game_data_build_version_wide_string[64];
/* ---------- public code */
void ui_widget_game_data_function_invoke(
struct widget_instance *widget,
word function)
{
match_assert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x10A,
widget);
if ((short)function >= 0 && function < NUMBEROF(game_data_input_function_list))
{
game_data_input_function_list[(short)function](widget);
return;
}
error(2, "invalid game_data_input_reference_function");
return;
}
void widget_function_null(
struct widget_instance *widget)
{
(void)widget;
return;
}
void settings_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *description = list_widget->parameters.list.extended_description;
struct ui_widget_definition *description_definition =
ui_widget_definition_get(description->definition_tag_index);
struct widget_instance *description_picture;
struct widget_instance *description_text;
struct widget_instance *child;
short index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x12C,
list_widget->focused_child && description,
"this doesn't look like the settings select widget to me");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x12D,
description_definition->child_count == 2,
"this doesn't look like the settings select widget to me");
description_picture = description->child;
description_text = description_picture->next;
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x138,
description_picture->type == _ui_widget_type_bitmap,
"expected a container widget for the settings select list extended description pic");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x139,
description_text->type == _ui_widget_type_text_box,
"expected a text box widget for the settings select list extended description text");
description_picture->animation.current_frame_index = index;
description_text->parameters.text_box.string_list_index = index;
}
return;
}
void playlist_settings_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *child;
struct widget_instance *description_child;
struct ui_widget_definition *description_definition;
short index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x14D,
list_widget && list_widget->focused_child && list_widget->parameters.list.extended_description,
"invalid widget trying to update its extended list description");
index = 0;
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
description_definition = ui_widget_definition_get(
list_widget->parameters.list.extended_description->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x15B,
description_definition->child_count == 2,
"expected a container widget w/ 2 children for the playlist settings list extended description");
description_child = list_widget->parameters.list.extended_description->child;
description_child->parameters.text_box.string_list_index = index;
description_child->next->animation.current_frame_index = index;
}
return;
}
void playlist_gametype_select_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *child;
struct widget_instance *description_child;
struct ui_widget_definition *description_definition;
short index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x173,
list_widget && list_widget->focused_child && list_widget->parameters.list.extended_description,
"invalid widget trying to update its extended list description");
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
description_definition = ui_widget_definition_get(
list_widget->parameters.list.extended_description->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x181,
description_definition->child_count == 2,
"expected a container widget w/ 2 children for the playlist settings list extended description");
description_child = list_widget->parameters.list.extended_description->child;
description_child->parameters.text_box.string_list_index = index;
description_child->next->animation.current_frame_index = index;
}
return;
}
void multiplayer_type_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *child;
struct widget_instance *description_picture;
short index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1A6,
list_widget && list_widget->focused_child &&
list_widget->parameters.list.extended_description &&
list_widget->parameters.list.extended_description->child &&
list_widget->parameters.list.extended_description->child->next,
"invalid widget trying to update its extended list description");
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
description_picture = list_widget->parameters.list.extended_description->child;
description_picture->animation.current_frame_index = index;
description_picture->next->parameters.text_box.string_list_index = index;
}
return;
}
void difficulty_select_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *description = list_widget->parameters.list.extended_description;
struct ui_widget_definition *description_definition =
ui_widget_definition_get(description->definition_tag_index);
struct widget_instance *description_picture;
struct widget_instance *description_text;
struct widget_instance *child;
short index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x237,
list_widget->focused_child && description,
"this doesn't look like the difficulty select widget to me");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x238,
description_definition->child_count == 2,
"this doesn't look like the difficulty select widget to me");
description_picture = description->child;
description_text = description_picture->next;
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x243,
description_picture->type == _ui_widget_type_bitmap,
"expected a container widget for the difficulty list extended description pic");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x244,
description_text->type == _ui_widget_type_text_box,
"expected a text box widget for the difficulty list extended description text");
description_picture->animation.current_frame_index = index;
description_text->parameters.text_box.string_list_index = index;
}
return;
}
void netgame_prejoin_players(
struct widget_instance *widget)
{
struct network_game_client *client = global_network_game_client_get();
union
{
long index;
short client_state_data;
} state_or_index;
boolean local_player_wants_to_join[4];
(void)widget;
if (client &&
network_game_client_get_state(client, &state_or_index.client_state_data) == 2)
{
struct network_game *game = network_game_get_game();
match_assert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x614,
game);
for (state_or_index.index = 0; (short)state_or_index.index < 4; state_or_index.index++)
{
local_player_wants_to_join[(short)state_or_index.index] =
player_ui_local_player_wants_to_play_multiplayer((short)state_or_index.index);
}
for (state_or_index.index = 0; (short)state_or_index.index < 16; state_or_index.index++)
{
if (network_player_is_valid(&game->players[(short)state_or_index.index]) &&
network_game_player_is_local(&game->players[(short)state_or_index.index]))
{
local_player_wants_to_join[
game->players[(short)state_or_index.index].controller_index] = FALSE;
}
}
for (state_or_index.index = 0; (short)state_or_index.index < 4; state_or_index.index++)
{
if (local_player_wants_to_join[(short)state_or_index.index] &&
!network_game_client_add_player(client, (short)state_or_index.index))
{
network_event("failed to send join request");
}
}
}
return;
}
void set_textbox_to_build_number(
struct widget_instance *widget)
{
if (!ui_widget_game_data_build_version_wide_string[0])
{
ascii_to_wide(
"01.01.14.2342",
ui_widget_game_data_build_version_wide_string,
sizeof(ui_widget_game_data_build_version_wide_string));
}
if (!widget->parameters.text_box.text)
{
widget->parameters.text_box.text = ui_widget_realloc(
NULL,
sizeof(ui_widget_game_data_build_version_wide_string),
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x25E);
if (widget->parameters.text_box.text)
{
csmemset(
widget->parameters.text_box.text,
0,
sizeof(ui_widget_game_data_build_version_wide_string));
}
}
if (widget->parameters.text_box.text)
{
ustrncpy(
widget->parameters.text_box.text,
ui_widget_game_data_build_version_wide_string,
NUMBEROF(ui_widget_game_data_build_version_wide_string) - 1);
widget->parameters.text_box.text[NUMBEROF(ui_widget_game_data_build_version_wide_string) - 1] = 0;
}
return;
}
void solo_game_objective_text(
struct widget_instance *widget)
{
wchar_t const *objective = hud_messaging_get_objective();
long length = objective && *objective ? ustrlen(objective) : 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x924,
widget->type == _ui_widget_type_text_box,
"expected a text box for objective text");
if (length > 0)
{
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
(word)(2 * length + 2),
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x928);
if (widget->parameters.text_box.text)
{
ustrncpy(widget->parameters.text_box.text, objective, length);
widget->parameters.text_box.text[length] = 0;
}
}
return;
}
void main_menu_animation_fakery(
struct widget_instance *widget)
{
struct widget_instance *extended_description;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9AB,
widget->type == _ui_widget_type_column_list,
"expected column list for main menu options list");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9AE,
widget->parameters.list.extended_description &&
widget->parameters.list.extended_description->type == _ui_widget_type_bitmap,
"expected a picture (container) for main menu options list extended description");
extended_description = widget->parameters.list.extended_description;
extended_description->animation.current_frame_index = widget->parameters.list.selected_list_item_index;
extended_description->animation.current_frame_index =
extended_description->animation.current_frame_index < 0 ?
0 : extended_description->animation.current_frame_index;
return;
}
void get_active_player_profile_display_name(
struct widget_instance *widget)
{
struct player_profile profile;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9EC,
widget->type == _ui_widget_type_text_box,
"expected a text box widget for profile display name");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9EE,
widget->local_player_index >= 0 && widget->local_player_index < 4,
"profile display name requires a valid local player index");
player_ui_get_active_player_profile(widget->local_player_index, &profile);
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
sizeof(profile.name),
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9F0);
if (widget->parameters.text_box.text)
{
ustrncpy(widget->parameters.text_box.text, profile.name, NUMBEROF(profile.name) - 1);
widget->parameters.text_box.text[NUMBEROF(profile.name) - 1] = 0;
}
return;
}
void get_editable_player_profile_display_name(
struct widget_instance *widget)
{
struct player_profile *profile;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9FE,
widget->type == _ui_widget_type_text_box,
"expected a text box widget for profile display name");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA00,
widget->local_player_index >= 0 && widget->local_player_index < 4,
"profile display name requires a valid local player index");
profile = player_ui_get_edit_player_profile();
if (profile)
{
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
sizeof(profile->name),
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA04);
if (widget->parameters.text_box.text)
{
ustrncpy(widget->parameters.text_box.text, profile->name, NUMBEROF(profile->name) - 1);
widget->parameters.text_box.text[NUMBEROF(profile->name) - 1] = 0;
}
}
return;
}
void get_editable_playlist_profile_display_name(
struct widget_instance *widget)
{
struct playlist_profile *profile;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA13,
widget->type == _ui_widget_type_text_box,
"expected a text box widget for profile display name");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA15,
widget->local_player_index >= 0 && widget->local_player_index < 4,
"profile display name requires a valid local player index");
profile = player_ui_get_edit_playlist_profile();
if (profile)
{
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
sizeof(profile->name),
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA19);
if (widget->parameters.text_box.text)
{
ustrncpy(widget->parameters.text_box.text, profile->name, NUMBEROF(profile->name) - 1);
widget->parameters.text_box.text[NUMBEROF(profile->name) - 1] = 0;
}
}
else
error(2, "not currently editing a game variant");
return;
}
void get_active_player_profile_color_index(
struct widget_instance *widget)
{
struct player_profile profile;
word last_available_color;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA2D,
widget->local_player_index >= 0 && widget->local_player_index < 4,
"profile color picture requires a valid local player index");
player_ui_get_active_player_profile(widget->local_player_index, &profile);
if (profile.primary_color_index < 0)
{
widget->animation.current_frame_index = 0;
return;
}
last_available_color = player_profile_number_of_available_primary_colors() - 1;
if (profile.primary_color_index > last_available_color)
last_available_color = player_profile_number_of_available_primary_colors() - 1;
else
last_available_color = profile.primary_color_index;
widget->animation.current_frame_index = last_available_color;
return;
}
void player_profile_edit_select_menu_update_extended_description(
struct widget_instance *list_widget)
{
struct widget_instance *child;
struct widget_instance *description_child;
struct ui_widget_definition *description_definition;
short index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x836,
list_widget && list_widget->focused_child && list_widget->parameters.list.extended_description,
"invalid widget trying to update its extended list description");
index = 0;
child = list_widget->child;
while (child)
{
if (child == list_widget->focused_child)
break;
child = child->next;
index++;
}
if (index != NONE)
{
description_definition = ui_widget_definition_get(
list_widget->parameters.list.extended_description->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x844,
description_definition->child_count == 2,
"expected a container widget w/ 2 children for the player profile edit settings list extended description");
description_child = list_widget->parameters.list.extended_description->child;
description_child->parameters.text_box.string_list_index = index;
description_child->next->animation.current_frame_index = index;
}
return;
}
static void game_options_menu_update_text_desc(
struct widget_instance *widget)
{
struct widget_instance *column;
struct widget_instance *extended_description;
struct widget_instance *spinner_list;
struct ui_widget_definition *definition;
long description_index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x8F5,
widget->type == _ui_widget_type_column_list,
"expected column list for multiplayer game options list");
extended_description = widget->parameters.list.extended_description;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x8F8,
extended_description && extended_description->type == _ui_widget_type_text_box,
"expected a text box for multiplayer game options list extended description");
definition = ui_widget_definition_get(widget->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x8FE,
definition->child_count > 0,
"expected some list items for multiplayer game settings list");
if (widget->focused_child)
{
column = widget->child;
while (column)
{
spinner_list = column->child;
while (spinner_list && spinner_list->type != _ui_widget_type_spinner_list)
spinner_list = spinner_list->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x90C,
spinner_list,
"expected a spinner list somewhere in the multiplayer game options settings list item makeup");
if (column == widget->focused_child)
{
description_index += spinner_list->parameters.list.selected_list_item_index;
break;
}
description_index += spinner_list->parameters.list.number_of_items;
column = column->next;
}
}
extended_description->parameters.text_box.string_list_index = (short)description_index;
return;
}
static void game_options_menu_update_pic_desc(
struct widget_instance *widget)
{
struct widget_instance *column;
struct widget_instance *extended_description;
struct widget_instance *spinner_list;
struct ui_widget_definition *definition;
long description_index = 0;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x980,
widget->type == _ui_widget_type_column_list,
"expected column list for game options list");
extended_description = widget->parameters.list.extended_description;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x983,
extended_description && extended_description->type == _ui_widget_type_bitmap,
"expected a picture (container) for game options list extended description");
definition = ui_widget_definition_get(widget->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x988,
definition->child_count > 0,
"expected some list items for game settings list");
if (widget->focused_child)
{
column = widget->child;
while (column)
{
spinner_list = column->child;
while (spinner_list && spinner_list->type != _ui_widget_type_spinner_list)
spinner_list = spinner_list->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x996,
spinner_list,
"expected a spinner list somewhere in the multiplayer game options settings list item makeup");
if (column == widget->focused_child)
{
description_index += spinner_list->parameters.list.selected_list_item_index;
break;
}
description_index += spinner_list->parameters.list.number_of_items;
column = column->next;
}
}
extended_description->animation.current_frame_index = (short)description_index;
return;
}
void multiplayer_game_set_text_box_for_map_name(
struct widget_instance *widget)
{
struct network_game *game;
char const *map_name;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA39,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
map_name = game->map_name;
if (strstr(map_name, "beavercreek"))
{
widget->parameters.text_box.string_list_index = 0;
return;
}
if (strstr(map_name, "sidewinder"))
{
widget->parameters.text_box.string_list_index = 1;
return;
}
if (strstr(map_name, "damnation"))
{
widget->parameters.text_box.string_list_index = 2;
return;
}
if (strstr(map_name, "ratrace"))
{
widget->parameters.text_box.string_list_index = 3;
return;
}
if (strstr(map_name, "prisoner"))
{
widget->parameters.text_box.string_list_index = 4;
return;
}
if (strstr(map_name, "hangemhigh"))
{
widget->parameters.text_box.string_list_index = 5;
return;
}
if (strstr(map_name, "chillout"))
{
widget->parameters.text_box.string_list_index = 6;
return;
}
if (strstr(map_name, "carousel"))
{
widget->parameters.text_box.string_list_index = 7;
return;
}
if (strstr(map_name, "boardingaction"))
{
widget->parameters.text_box.string_list_index = 8;
return;
}
if (strstr(map_name, "bloodgulch"))
{
widget->parameters.text_box.string_list_index = 9;
return;
}
if (strstr(map_name, "wizard"))
{
widget->parameters.text_box.string_list_index = 10;
return;
}
if (strstr(map_name, "putput"))
{
widget->parameters.text_box.string_list_index = 11;
return;
}
widget->parameters.text_box.string_list_index = strstr(map_name, "longest") ? 12 : 13;
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_text_box_for_game_ruleset(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xA59,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
switch (game->variant.engine_type)
{
case game_engine_ctf:
if (game->variant.game_mode.ctf_assault == TRUE)
{
widget->parameters.text_box.string_list_index =
game->variant.single_flag_time ?
_multiplayer_game_text_string_single_flag_assault :
_multiplayer_game_text_string_assault;
}
else
{
widget->parameters.text_box.string_list_index =
game->variant.single_flag_time ?
_multiplayer_game_text_string_single_flag_ctf :
_multiplayer_game_text_string_capture_the_flag;
}
break;
case game_engine_slayer:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_slayer;
break;
case game_engine_oddball:
switch (game->variant.oddball_ball_type)
{
case 1:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_reverse_tag;
break;
case 2:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_juggernaut;
break;
default:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_oddball;
break;
}
break;
case game_engine_king:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_king_of_the_hill;
break;
case game_engine_race:
switch (game->variant.game_mode.race_type)
{
case 2:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_rally;
break;
default:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_race;
break;
}
break;
default:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_unknown_game_type;
break;
}
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_text_box_for_teams_noteams(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xAAA,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
widget->parameters.text_box.string_list_index = game->variant.has_teams != TRUE ? 13 : 12;
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_text_box_for_score_limit(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xAC3,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
0x10,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xAC8);
if (widget->parameters.text_box.text)
{
usnprintf(widget->parameters.text_box.text, 7, L"%d", game->variant.score_to_win);
widget->parameters.text_box.text[7] = 0;
}
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_text_box_for_score_limit_type(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xADC,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
switch (game->variant.engine_type)
{
case game_engine_ctf:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_captures;
break;
case game_engine_slayer:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_frags;
break;
case game_engine_oddball:
widget->parameters.text_box.string_list_index = game->variant.oddball_ball_type == 2 ?
_multiplayer_game_text_string_frags : _multiplayer_game_text_string_minutes;
break;
case game_engine_king:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_minutes;
break;
case game_engine_race:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_laps;
break;
default:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_frags;
break;
}
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_bitmap_for_map(
struct widget_instance *widget)
{
struct network_game *game;
char const *map_name;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xB09,
widget->type == _ui_widget_type_bitmap,
"expected container widget for mp game settings bitmap");
game = network_game_get_game();
if (game)
{
map_name = game->map_name;
if (strstr(map_name, "beavercreek"))
{
widget->animation.current_frame_index = 0;
return;
}
if (strstr(map_name, "sidewinder"))
{
widget->animation.current_frame_index = 1;
return;
}
if (strstr(map_name, "damnation"))
{
widget->animation.current_frame_index = 2;
return;
}
if (strstr(map_name, "ratrace"))
{
widget->animation.current_frame_index = 3;
return;
}
if (strstr(map_name, "prisoner"))
{
widget->animation.current_frame_index = 4;
return;
}
if (strstr(map_name, "hangemhigh"))
{
widget->animation.current_frame_index = 5;
return;
}
if (strstr(map_name, "chillout"))
{
widget->animation.current_frame_index = 6;
return;
}
if (strstr(map_name, "carousel"))
{
widget->animation.current_frame_index = 7;
return;
}
if (strstr(map_name, "boardingaction"))
{
widget->animation.current_frame_index = 8;
return;
}
if (strstr(map_name, "bloodgulch"))
{
widget->animation.current_frame_index = 9;
return;
}
if (strstr(map_name, "wizard"))
{
widget->animation.current_frame_index = 10;
return;
}
if (strstr(map_name, "putput"))
{
widget->animation.current_frame_index = 11;
return;
}
widget->animation.current_frame_index = strstr(map_name, "longest") ? 12 : 13;
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_bitmap_for_ruleset(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xB28,
widget->type == _ui_widget_type_bitmap,
"expected container widget for mp game settings bitmap");
game = network_game_get_game();
if (game)
{
switch (game->variant.engine_type)
{
case game_engine_ctf:
widget->animation.current_frame_index = _multiplayer_game_bitmap_ctf;
break;
case game_engine_slayer:
widget->animation.current_frame_index = _multiplayer_game_bitmap_slayer;
break;
case game_engine_oddball:
widget->animation.current_frame_index = _multiplayer_game_bitmap_oddball;
break;
case game_engine_king:
widget->animation.current_frame_index = _multiplayer_game_bitmap_king;
break;
case game_engine_race:
widget->animation.current_frame_index = _multiplayer_game_bitmap_race;
break;
default:
widget->animation.current_frame_index = _multiplayer_game_bitmap_unknown;
break;
}
return;
}
error(2, "no network game");
return;
}
void multiplayer_game_set_text_box_for_number_of_players(
struct widget_instance *widget)
{
struct network_game *game;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xB4E,
widget->type == _ui_widget_type_text_box,
"expected text box widget for mp game settings text");
game = network_game_get_game();
if (game)
{
widget->parameters.text_box.text = ui_widget_realloc(
widget->parameters.text_box.text,
8,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xB56);
if (widget->parameters.text_box.text)
{
usnprintf(widget->parameters.text_box.text, 3, L"%d", game->player_count);
widget->parameters.text_box.text[3] = 0;
}
return;
}
error(2, "no network game");
return;
}
void multiplayer_edit_profile_set_ruleset_textbox_string_index(
struct widget_instance *widget)
{
struct playlist_profile *profile;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xB69,
widget->type == _ui_widget_type_text_box,
"expected a text box widget for mp profile edit ruleset text widget");
profile = player_ui_get_edit_playlist_profile();
if (profile)
{
switch (profile->engine_type)
{
case game_engine_ctf:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_capture_the_flag;
break;
case game_engine_slayer:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_slayer;
break;
case game_engine_oddball:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_oddball;
break;
case game_engine_king:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_king_of_the_hill;
break;
case game_engine_race:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_race;
break;
default:
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_unknown_game_type;
break;
}
return;
}
error(2, "not currently editing a game variant");
return;
}
void system_link_status_check(
struct widget_instance *widget)
{
(void)widget;
if (!transport_network_available() && !network_game_is_splitscreen_local())
{
display_error_when_main_menu_loaded(_ui_error_network_connection_lost);
main_goto_main_menu();
error(2, "network connection went down!");
}
return;
}
void multiplayer_game_directions(
struct widget_instance *widget)
{
struct network_game *game = network_game_get_game();
struct network_game_server *server = global_network_game_server_get();
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xBAD,
widget->type == _ui_widget_type_text_box,
"expected text box widget for team game directions");
if (server)
{
if (!network_game_is_splitscreen_local() &&
game &&
game->machine_count < 2)
{
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_waiting_for_machine;
widget->visible = TRUE;
return;
}
if (network_game_is_splitscreen_local() &&
game &&
game->player_count < 2)
{
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_waiting_for_player;
widget->visible = TRUE;
return;
}
}
if (game &&
game->variant.has_teams == TRUE &&
network_game_client_get_seconds_to_game_start(global_network_game_client_get()) < 0)
{
long team_zero_player_count = 0;
long team_one_player_count = 0;
long player_index;
struct network_player *player = game->players;
for (player_index = 0;
player_index < NUMBEROF(game->players);
player_index++, player++)
{
if (network_player_is_valid(player))
{
switch (player->team_index)
{
case 0:
team_zero_player_count++;
break;
case 1:
team_one_player_count++;
break;
}
}
}
if (team_zero_player_count && team_one_player_count)
{
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_teams_ready;
widget->visible = TRUE;
return;
}
widget->parameters.text_box.string_list_index =
_multiplayer_game_text_string_waiting_for_teams;
widget->visible = TRUE;
return;
}
widget->visible = FALSE;
return;
}
void teams_no_teams_mp_game_bitmap_update(
struct widget_instance *widget)
{
struct network_game *game = network_game_get_game();
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xBFC,
widget->type == _ui_widget_type_bitmap,
"expected a container bitmap for mp pregame header widget");
if (game)
widget->animation.current_frame_index = game->variant.has_teams != TRUE;
return;
}
void warn_if_difficulty_will_nuke_saved_game(
struct widget_instance *difficulty_screen_widget)
{
struct widget_instance *difficulty_list = difficulty_screen_widget->child;
struct widget_instance *warning_widget;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xC1F,
difficulty_list && difficulty_list->type == _ui_widget_type_column_list,
"this doesn't look like the difficulty list widget");
warning_widget = difficulty_list->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xC23,
warning_widget && warning_widget->type == _ui_widget_type_text_box,
"this doesn't look like the difficulty list widget (expected warning text box)");
if (persistant_game_data_info.valid == TRUE &&
_stricmp(persistant_game_data_info.map_name, main_get_map_name()) == 0)
{
warning_widget->visible =
difficulty_list->parameters.list.selected_list_item_index !=
persistant_game_data_info.difficulty;
}
else
warning_widget->visible = FALSE;
return;
}
void dim_if_no_system_link_cable(
struct widget_instance *widget)
{
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xC3C,
widget->type == _ui_widget_type_text_box,
"expected a text box widget for system link menu text item");
widget->alpha_modifier = transport_network_available() ? 1.0f : 0.333f;
return;
}
static void spinner_list_3wide_determine_displayed_item_indices(
struct widget_instance *list_widget,
long *displayed_item_indices)
{
struct widget_instance *focused_child = list_widget->focused_child;
struct widget_instance *first_child = list_widget->child;
if (focused_child == first_child)
{
displayed_item_indices[0] = list_widget->parameters.list.selected_list_item_index;
displayed_item_indices[1] = displayed_item_indices[0] + 1;
if (displayed_item_indices[1] == list_widget->parameters.list.number_of_items)
displayed_item_indices[1] = 0;
displayed_item_indices[2] = displayed_item_indices[1] + 1;
if (displayed_item_indices[2] == list_widget->parameters.list.number_of_items)
displayed_item_indices[2] = 0;
}
else if (focused_child == first_child->next)
{
displayed_item_indices[1] = list_widget->parameters.list.selected_list_item_index;
displayed_item_indices[0] = displayed_item_indices[1] - 1;
if (displayed_item_indices[0] < 0)
{
displayed_item_indices[0] =
list_widget->parameters.list.number_of_items - 1;
}
displayed_item_indices[2] = displayed_item_indices[1] + 1;
if (displayed_item_indices[2] == list_widget->parameters.list.number_of_items)
displayed_item_indices[2] = 0;
}
else
{
displayed_item_indices[2] = list_widget->parameters.list.selected_list_item_index;
displayed_item_indices[1] = displayed_item_indices[2] - 1;
if (displayed_item_indices[1] < 0)
{
displayed_item_indices[1] =
list_widget->parameters.list.number_of_items - 1;
}
displayed_item_indices[0] = displayed_item_indices[1] - 1;
if (displayed_item_indices[0] < 0)
{
displayed_item_indices[0] =
list_widget->parameters.list.number_of_items - 1;
}
}
if (displayed_item_indices[0] >= list_widget->parameters.list.number_of_items)
displayed_item_indices[0] = NONE;
if (displayed_item_indices[1] >= list_widget->parameters.list.number_of_items)
displayed_item_indices[1] = NONE;
if (displayed_item_indices[2] >= list_widget->parameters.list.number_of_items)
displayed_item_indices[2] = NONE;
return;
}
void player_profile_update_cache_for_nwide_list(
long *profile_indices,
long profile_index_count)
{
boolean still_wanted[3] = { FALSE, FALSE, FALSE };
long cache_index;
long requested_index;
for (cache_index = 0; cache_index < NUMBEROF(cached_player_profile); cache_index++)
{
if (cached_player_profile[cache_index].profile_index == NONE)
continue;
for (requested_index = 0; requested_index < profile_index_count; requested_index++)
{
if (cached_player_profile[cache_index].profile_index == profile_indices[requested_index])
{
still_wanted[cache_index] = TRUE;
break;
}
}
}
for (requested_index = 0; requested_index < profile_index_count; requested_index++)
{
long requested_profile_index = profile_indices[requested_index];
if (requested_profile_index == NONE)
continue;
for (cache_index = 0; cache_index < NUMBEROF(cached_player_profile); cache_index++)
{
if (cached_player_profile[cache_index].profile_index == requested_profile_index)
break;
}
if (cache_index == NUMBEROF(cached_player_profile))
{
for (cache_index = 0;
cache_index < NUMBEROF(still_wanted) && still_wanted[cache_index] == TRUE;
cache_index++)
{
}
match_assert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xCA2,
cache_index < NUMBEROF(cached_player_profile));
if (player_profile_get(
requested_profile_index,
&cached_player_profile[cache_index].profile))
{
cached_player_profile[cache_index].profile_index = requested_profile_index;
still_wanted[cache_index] = TRUE;
}
else
error(2, "failed to cache player profile");
}
}
return;
}
void variant_profile_update_cache_for_nwide_list(
long *profile_indices,
long profile_index_count)
{
boolean still_wanted[3] = { FALSE, FALSE, FALSE };
long cache_index;
long requested_index;
for (cache_index = 0; cache_index < NUMBEROF(cached_variant_profile); cache_index++)
{
if (cached_variant_profile[cache_index].profile_index == NONE)
continue;
for (requested_index = 0; requested_index < profile_index_count; requested_index++)
{
if (cached_variant_profile[cache_index].profile_index == profile_indices[requested_index])
{
still_wanted[cache_index] = TRUE;
break;
}
}
}
for (requested_index = 0; requested_index < profile_index_count; requested_index++)
{
long requested_profile_index = profile_indices[requested_index];
if (requested_profile_index == NONE)
continue;
for (cache_index = 0; cache_index < NUMBEROF(cached_variant_profile); cache_index++)
{
if (cached_variant_profile[cache_index].profile_index == requested_profile_index)
break;
}
if (cache_index == NUMBEROF(cached_variant_profile))
{
for (cache_index = 0;
cache_index < NUMBEROF(still_wanted) && still_wanted[cache_index] == TRUE;
cache_index++)
{
}
match_assert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0xCD5,
cache_index < NUMBEROF(cached_variant_profile));
if (playlist_profile_get(
requested_profile_index,
&cached_variant_profile[cache_index].profile))
{
cached_variant_profile[cache_index].profile_index = requested_profile_index;
still_wanted[cache_index] = TRUE;
}
else
error(2, "failed to cache playlist profile");
}
}
return;
}
void mutliplayer_settings_select_list_update_displayed_items(
struct widget_instance *list_widget)
{
long descriptions_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
"ui\\shell\\strings\\game_variant_descriptions");
struct ui_widget_definition *definition = ui_widget_definition_get(
list_widget->definition_tag_index);
long displayed_item_indices[3];
long profile_indices[3];
long item_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x67D,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'multiplayer settings select' list");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x67E,
definition->child_count == 3,
"expected 3 children (list items) in multiplayer settings select list");
spinner_list_3wide_determine_displayed_item_indices(
list_widget,
displayed_item_indices);
for (item_index = 0; item_index < NUMBEROF(profile_indices); item_index++)
{
long displayed_item_index = displayed_item_indices[item_index];
profile_indices[item_index] = displayed_item_index == NONE ?
NONE : ((long *)list_widget->parameters.list.list_items)[displayed_item_index];
}
variant_profile_update_cache_for_nwide_list(
profile_indices,
NUMBEROF(profile_indices));
for (item_index = 0;
item_index < 3 &&
displayed_item_indices[item_index] != NONE;
item_index++)
{
struct widget_instance *item = widget_instance_get_nth_child(
list_widget,
item_index);
struct playlist_profile *profile = NULL;
long profile_index = ((long *)list_widget->parameters.list.list_items)
[displayed_item_indices[item_index]];
long cache_index;
if (profile_index != NONE)
{
for (cache_index = 0;
cache_index < NUMBEROF(cached_variant_profile);
cache_index++)
{
if (cached_variant_profile[cache_index].profile_index == profile_index)
{
profile = &cached_variant_profile[cache_index].profile;
break;
}
}
}
{
struct widget_instance *description_box = item->child;
struct widget_instance *icon = description_box->next;
struct widget_instance *label_box = icon->next;
struct widget_instance *description_container = label_box->next;
definition = ui_widget_definition_get(item->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x69E,
definition->child_count > 0,
"expected 3 children in multiplayer settings select list item");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x6A0,
ui_widget_definition_get(description_box->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the first child of the list item");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x6A2,
ui_widget_definition_get(icon->definition_tag_index)->type ==
_ui_widget_type_bitmap,
"expected a container widget for the second child of the list item");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x6A4,
ui_widget_definition_get(label_box->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the third child of the list item");
description_container->visible = FALSE;
if (!profile)
{
long labels_tag_index;
description_box->parameters.text_box.text = ui_widget_realloc(
description_box->parameters.text_box.text,
0x100,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x751);
if (description_box->parameters.text_box.text)
description_box->parameters.text_box.text[0] = 0;
icon->animation.current_frame_index = _multiplayer_game_bitmap_unknown;
label_box->parameters.text_box.text = ui_widget_realloc(
label_box->parameters.text_box.text,
0x200,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x756);
if (label_box->parameters.text_box.text)
{
label_box->parameters.text_box.text[0] = 0;
labels_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
"ui\\shell\\main_menu\\player_profiles_select\\profile_description_labels");
if (labels_tag_index != NONE)
{
ustrncpy(
label_box->parameters.text_box.text,
unicode_string_list_get_string(labels_tag_index, 5),
0xFF);
label_box->parameters.text_box.text[0xFF] = 0;
}
}
continue;
}
description_box->parameters.text_box.text = ui_widget_realloc(
description_box->parameters.text_box.text,
0x100,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x6BA);
if (description_box->parameters.text_box.text)
{
ustrncpy(description_box->parameters.text_box.text, profile->name, 0x7F);
description_box->parameters.text_box.text[0x7F] = 0;
}
icon->animation.current_frame_index = _multiplayer_game_bitmap_unknown;
label_box->parameters.text_box.text = ui_widget_realloc(
label_box->parameters.text_box.text,
0x200,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x6C1);
if (label_box->parameters.text_box.text)
label_box->parameters.text_box.text[0] = 0;
if (TEST_FLAG(profile->flags, 0))
{
short string_index = (short)((profile->flags >> 8) + 10);
switch (profile->engine_type)
{
case game_engine_ctf:
icon->animation.current_frame_index = _multiplayer_game_bitmap_ctf;
break;
case game_engine_slayer:
icon->animation.current_frame_index = _multiplayer_game_bitmap_slayer;
break;
case game_engine_oddball:
icon->animation.current_frame_index = _multiplayer_game_bitmap_oddball;
break;
case game_engine_king:
icon->animation.current_frame_index = _multiplayer_game_bitmap_king;
break;
case game_engine_race:
icon->animation.current_frame_index = _multiplayer_game_bitmap_race;
break;
}
if (descriptions_tag_index != NONE && label_box->parameters.text_box.text)
{
ustrncpy(
label_box->parameters.text_box.text,
unicode_string_list_get_string(
descriptions_tag_index,
string_index),
0xFF);
label_box->parameters.text_box.text[0xFF] = 0;
}
description_container->visible = TRUE;
continue;
}
if (profile->engine_type >= game_engine_ctf &&
profile->engine_type <= game_engine_race)
{
short string_index;
switch (profile->engine_type)
{
case game_engine_ctf:
icon->animation.current_frame_index = _multiplayer_game_bitmap_ctf;
string_index = profile->teams == TRUE ? 1 : 0;
break;
case game_engine_slayer:
icon->animation.current_frame_index = _multiplayer_game_bitmap_slayer;
string_index = profile->teams == TRUE ? 3 : 2;
break;
case game_engine_oddball:
icon->animation.current_frame_index = _multiplayer_game_bitmap_oddball;
string_index = profile->teams == TRUE ? 5 : 4;
break;
case game_engine_king:
icon->animation.current_frame_index = _multiplayer_game_bitmap_king;
string_index = profile->teams == TRUE ? 7 : 6;
break;
default:
icon->animation.current_frame_index = _multiplayer_game_bitmap_race;
string_index = profile->teams == TRUE ? 9 : 8;
break;
}
if (descriptions_tag_index != NONE && label_box->parameters.text_box.text)
{
ustrncpy(
label_box->parameters.text_box.text,
unicode_string_list_get_string(
descriptions_tag_index,
string_index),
0xFF);
label_box->parameters.text_box.text[0xFF] = 0;
}
}
}
}
return;
}
void player_profile_3wide_list_update(
struct widget_instance *list_widget)
{
long displayed_item_indices[3] = { NONE, NONE, NONE };
long profile_indices[3];
struct ui_widget_definition *definition = ui_widget_definition_get(
list_widget->definition_tag_index);
long item_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x78A,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'player settings select' widget");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x78B,
definition->child_count == 3,
"expected 3 children (list items) for 'player settings select' widget");
spinner_list_3wide_determine_displayed_item_indices(
list_widget,
displayed_item_indices);
for (item_index = 0; item_index < 3; item_index++)
{
if (displayed_item_indices[item_index] != NONE)
{
profile_indices[item_index] = ((long *)list_widget->parameters.list.list_items)
[displayed_item_indices[item_index]];
}
else
profile_indices[item_index] = NONE;
}
player_profile_update_cache_for_nwide_list(profile_indices, 3);
for (item_index = 0;
item_index < 3 && displayed_item_indices[item_index] != NONE;
item_index++)
{
struct widget_instance *item = widget_instance_get_nth_child(
list_widget,
item_index);
struct widget_instance *profile_name;
struct widget_instance *color_picture;
struct widget_instance *description_fields;
struct widget_instance *empty_profile_label;
struct widget_instance *current_level_label;
struct widget_instance *current_level_text;
struct widget_instance *current_skill_label;
struct widget_instance *current_skill_text;
struct widget_instance *controls_label;
struct widget_instance *controls_text;
struct player_profile *profile = NULL;
long profile_index;
long cache_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7AF,
item && item->type == _ui_widget_type_bitmap,
"expected profile item description container widget");
profile_name = item->child;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7B2,
profile_name && profile_name->type == _ui_widget_type_text_box,
"expected a text box widget for profile name");
color_picture = profile_name->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7B5,
color_picture && color_picture->type == _ui_widget_type_bitmap,
"expected a container widget for the profile color picture");
description_fields = color_picture->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7B8,
description_fields && description_fields->type == _ui_widget_type_bitmap,
"expected a container widget for the profile description fields");
empty_profile_label = description_fields->child;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7BB,
empty_profile_label && empty_profile_label->type == _ui_widget_type_text_box,
"expected a text box widget for the 'empty profile' label");
current_level_label = empty_profile_label->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7BE,
current_level_label && current_level_label->type == _ui_widget_type_text_box,
"expected a text box widget for the current level label");
current_level_text = current_level_label->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7C1,
current_level_text && current_level_text->type == _ui_widget_type_text_box,
"expected a text box widget for the current level text field");
current_skill_label = current_level_text->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7C4,
current_skill_label && current_skill_label->type == _ui_widget_type_text_box,
"expected a text box widget for the current skill level label");
current_skill_text = current_skill_label->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7C7,
current_skill_text && current_skill_text->type == _ui_widget_type_text_box,
"expected a text box widget for the profile's current skill level text field");
controls_label = current_skill_text->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7CA,
controls_label && controls_label->type == _ui_widget_type_text_box,
"expected a text box widget for the controls label");
controls_text = controls_label->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7CD,
controls_text && controls_text->type == _ui_widget_type_text_box,
"expected a text box widget for the controls text field");
profile_index = ((long *)list_widget->parameters.list.list_items)
[displayed_item_indices[item_index]];
if (profile_index != NONE)
{
for (cache_index = 0;
cache_index < (long)NUMBEROF(cached_player_profile);
cache_index++)
{
if (cached_player_profile[cache_index].profile_index == profile_index)
{
profile = &cached_player_profile[cache_index].profile;
break;
}
}
}
if (profile)
{
profile_name->visible = TRUE;
empty_profile_label->visible = FALSE;
current_level_label->visible = TRUE;
current_level_text->visible = TRUE;
current_skill_label->visible = TRUE;
current_skill_text->visible = TRUE;
controls_label->visible = TRUE;
controls_text->visible = TRUE;
profile_name->parameters.text_box.text = ui_widget_realloc(
profile_name->parameters.text_box.text,
0x18,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x7E7);
if (profile_name->parameters.text_box.text)
{
if (TEST_FLAG(profile->flags, 0))
{
wchar_t const *name;
long default_name_index = profile->flags >> 8;
long names_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
"ui\\shell\\strings\\default_player_profile_names");
name = L"<unknown>";
if (names_tag_index != NONE)
{
name = unicode_string_list_get_string(
names_tag_index,
(short)default_name_index);
}
ustrncpy(profile_name->parameters.text_box.text, name, 0xB);
profile_name->parameters.text_box.text[0xB] = 0;
}
else
{
ustrncpy(
profile_name->parameters.text_box.text,
profile->name,
0xB);
profile_name->parameters.text_box.text[0xB] = 0;
}
}
if (profile->primary_color_index < 0)
color_picture->animation.current_frame_index = 0;
else if (profile->primary_color_index >
player_profile_number_of_available_primary_colors() - 1)
{
color_picture->animation.current_frame_index =
player_profile_number_of_available_primary_colors() - 1;
}
else
color_picture->animation.current_frame_index = profile->primary_color_index;
if (TEST_FLAG(profile->flags, 0))
{
current_level_text->visible = FALSE;
current_skill_text->visible = FALSE;
}
else
{
short highest_level;
short highest_difficulty;
player_profile_get_highest_completed_solo_level(
profile,
&highest_level,
&highest_difficulty);
current_level_text->parameters.text_box.string_list_index =
(short)MIN(highest_level + 1, 9);
current_skill_text->parameters.text_box.string_list_index = highest_difficulty;
controls_text->parameters.text_box.string_list_index =
profile->controller_settings.invert_look == TRUE;
}
}
else
{
profile_name->visible = FALSE;
color_picture->animation.current_frame_index =
player_profile_number_of_available_primary_colors();
empty_profile_label->visible = TRUE;
current_level_label->visible = FALSE;
current_level_text->visible = FALSE;
current_skill_label->visible = FALSE;
current_skill_text->visible = FALSE;
controls_label->visible = FALSE;
controls_text->visible = FALSE;
}
}
return;
}
void player_profile_1wide_list_update(
struct widget_instance *list_widget)
{
struct widget_instance *name_bitmap;
struct widget_instance *profile_description;
struct player_profile *profile;
struct ui_widget_definition *definition;
long profile_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x85E,
list_widget->parent,
"expected qtr-screen profile selection list to have a parent");
definition = ui_widget_definition_get(list_widget->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x864,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'mp profile select' list");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x865,
definition->child_count == 0,
"expected 0 children (1-wide spinner list) in qtr-screen profile selection list");
definition = ui_widget_definition_get(list_widget->parent->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x867,
definition->child_count == 3,
"expected qtr-screen profile selection container to have exactly 3 children");
name_bitmap = list_widget->parent->child;
profile_description = name_bitmap->next;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x86D,
list_widget == profile_description->next,
"expected qtr-screen profile selection container children to end with the profile list");
for (;;)
{
short selected_item_index = list_widget->parameters.list.selected_list_item_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x86F,
selected_item_index >= 0 &&
selected_item_index < list_widget->parameters.list.number_of_items,
"qtr-screen profile list has invalid selected item index");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x872,
selected_item_index >= 0 &&
selected_item_index < list_widget->parameters.list.number_of_items,
"invalid list item index");
profile_index = ((long *)list_widget->parameters.list.list_items)[selected_item_index];
player_profile_update_cache_for_nwide_list(&profile_index, 1);
profile = NULL;
if (profile_index != NONE)
{
long cache_index;
for (cache_index = 0;
cache_index < NUMBEROF(cached_player_profile);
cache_index++)
{
if (cached_player_profile[cache_index].profile_index == profile_index)
{
profile = &cached_player_profile[cache_index].profile;
break;
}
}
}
if (profile)
break;
if (list_widget->parameters.list.number_of_items == 0)
{
list_widget->parameters.list.item_text = ui_widget_realloc(
list_widget->parameters.list.item_text,
4,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x8D2);
if (list_widget->parameters.list.item_text)
list_widget->parameters.list.item_text[0] = 0;
name_bitmap->animation.current_frame_index = 0;
profile_description->parameters.text_box.text = ui_widget_realloc(
profile_description->parameters.text_box.text,
4,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x8D7);
if (profile_description->parameters.text_box.text)
profile_description->parameters.text_box.text[0] = 0;
return;
}
{
long item_count = list_widget->parameters.list.number_of_items;
short selected_item_index = list_widget->parameters.list.selected_list_item_index;
long valid_item_count = filter_invalid_list_indices(
(long *)list_widget->parameters.list.list_items,
item_count);
list_widget->parameters.list.number_of_items = (word)valid_item_count;
if (selected_item_index < 0)
list_widget->parameters.list.selected_list_item_index = 0;
else
{
long last_item_index = valid_item_count - 1;
if (selected_item_index > last_item_index)
selected_item_index = (short)last_item_index;
list_widget->parameters.list.selected_list_item_index = selected_item_index;
}
}
}
list_widget->parameters.list.item_text = ui_widget_realloc(
list_widget->parameters.list.item_text,
0x18,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x886);
if (list_widget->parameters.list.item_text)
{
wchar_t const *profile_name;
if (TEST_FLAG(profile->flags, 0))
{
long default_name_index = profile->flags >> 8;
long names_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
"ui\\shell\\strings\\default_player_profile_names");
profile_name = L"";
if (names_tag_index != NONE)
{
profile_name = unicode_string_list_get_string(
names_tag_index,
(short)default_name_index);
}
}
else
profile_name = profile->name;
ustrncpy(list_widget->parameters.list.item_text, profile_name, 0xB);
list_widget->parameters.list.item_text[0xB] = 0;
if (profile->primary_color_index < 0)
name_bitmap->animation.current_frame_index = 0;
else
{
short last_color_index =
player_profile_number_of_available_primary_colors() - 1;
if (profile->primary_color_index > last_color_index)
{
last_color_index =
player_profile_number_of_available_primary_colors() - 1;
}
else
last_color_index = profile->primary_color_index;
name_bitmap->animation.current_frame_index = last_color_index;
}
profile_description->parameters.text_box.text = ui_widget_realloc(
profile_description->parameters.text_box.text,
0x200,
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x89C);
if (profile_description->parameters.text_box.text)
{
char const *joystick_descriptions_path;
char const *button_descriptions_path;
long joystick_descriptions_tag_index;
long button_descriptions_tag_index;
if (TEST_FLAG(profile->flags, 0))
{
joystick_descriptions_path =
"ui\\shell\\main_menu\\player_profiles_select\\joystick_set_defaults_descriptions";
button_descriptions_path =
"ui\\shell\\main_menu\\player_profiles_select\\button_set_long_descriptions";
}
else
{
joystick_descriptions_path =
"ui\\shell\\main_menu\\player_profiles_select\\joystick_set_short_descriptions";
button_descriptions_path =
"ui\\shell\\main_menu\\player_profiles_select\\button_set_short_descriptions";
}
joystick_descriptions_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
joystick_descriptions_path);
button_descriptions_tag_index = tag_loaded(
UNICODE_STRING_LIST_TAG,
button_descriptions_path);
if (joystick_descriptions_tag_index != NONE &&
button_descriptions_tag_index != NONE)
{
wchar_t const *joystick_description = unicode_string_list_get_string(
joystick_descriptions_tag_index,
profile->controller_settings.joystick_preset);
wchar_t const *button_description = unicode_string_list_get_string(
button_descriptions_tag_index,
profile->controller_settings.button_preset);
usnprintf(
profile_description->parameters.text_box.text,
0xFF,
L"%s%hs%s",
joystick_description,
"\r\n",
button_description);
}
else if (TEST_FLAG(profile->flags, 0))
profile_description->parameters.text_box.text[0] = 0;
profile_description->parameters.text_box.text[0xFF] = 0;
}
}
return;
}
void solo_level_select_list_update_displayed_items(
struct widget_instance *list_widget)
{
struct player_profile profile;
short highest_level;
short highest_difficulty;
struct ui_widget_definition *definition;
long item_index;
long displayed_item_indices[3];
player_ui_get_active_player_profile(0, &profile);
player_profile_get_highest_completed_solo_level(
&profile,
&highest_level,
&highest_difficulty);
definition = ui_widget_definition_get(list_widget->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1E0,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'level select' widget");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1E1,
definition->child_count == 3,
"expected 3 children (list items) for 'level select' widget");
spinner_list_3wide_determine_displayed_item_indices(
list_widget,
displayed_item_indices);
for (item_index = 0; item_index < 3; item_index++)
{
struct widget_instance *item;
struct widget_instance *map_name;
struct widget_instance *map_bitmap;
struct widget_instance *map_description;
struct widget_instance *completion_marker;
struct widget_instance *difficulty_marker;
struct widget_instance *cooperative_marker;
if (displayed_item_indices[item_index] == NONE)
break;
item = widget_instance_get_nth_child(
list_widget,
item_index);
map_name = item->child;
map_bitmap = map_name->next;
map_description = map_bitmap->next;
completion_marker = map_description->next;
difficulty_marker = completion_marker->next;
cooperative_marker = difficulty_marker->next;
definition = ui_widget_definition_get(item->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1F6,
definition->child_count,
"expected 3 children in solo level list item (name, pic, desc)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1F8,
ui_widget_definition_get(map_name->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the list item's first child (map name)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1FA,
ui_widget_definition_get(map_bitmap->definition_tag_index)->type ==
_ui_widget_type_bitmap,
"expected a container widget for the list item's second child (map pic)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x1FC,
ui_widget_definition_get(map_description->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the list item's third child (map description)");
completion_marker->animation.current_frame_index = 1;
difficulty_marker->animation.current_frame_index = 2;
cooperative_marker->animation.current_frame_index = 3;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x204,
displayed_item_indices[item_index] >= 0 &&
displayed_item_indices[item_index] < 10,
"(displayed_item_index[i]>=0) && (displayed_item_index[i]<NUMBER_OF_SINGLE_PLAYER_LEVELS)");
if (!single_player_level_data[displayed_item_indices[item_index]].available &&
!single_player_level_data[displayed_item_indices[item_index]].completion_marker &&
!single_player_level_data[displayed_item_indices[item_index]].difficulty_marker &&
!single_player_level_data[displayed_item_indices[item_index]].cooperative_marker)
{
map_name->parameters.text_box.string_list_index = 10;
map_bitmap->animation.current_frame_index = 10;
map_description->parameters.text_box.string_list_index = 10;
completion_marker->visible = FALSE;
difficulty_marker->visible = FALSE;
cooperative_marker->visible = FALSE;
}
else
{
map_name->parameters.text_box.string_list_index =
(short)displayed_item_indices[item_index];
map_bitmap->animation.current_frame_index =
(short)displayed_item_indices[item_index];
map_description->parameters.text_box.string_list_index =
(short)displayed_item_indices[item_index];
if (persistant_game_data_info.valid == TRUE &&
displayed_item_indices[item_index] ==
(char)persistant_game_data_info.map_index)
{
map_description->parameters.text_box.string_list_index = 11;
}
completion_marker->visible = single_player_level_data[
displayed_item_indices[item_index]].completion_marker;
difficulty_marker->visible = single_player_level_data[
displayed_item_indices[item_index]].difficulty_marker;
cooperative_marker->visible = single_player_level_data[
displayed_item_indices[item_index]].cooperative_marker;
}
}
return;
}
void player_profile_color_picker_update(
struct widget_instance *list_widget)
{
struct ui_widget_definition *definition;
long displayed_item_indices[3];
long item_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x944,
list_widget->parameters.list.list_items,
"no list items associated with color picker!");
definition = ui_widget_definition_get(list_widget->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x949,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'player color picker' widget");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x94A,
definition->child_count == 3,
"expected 3 children (list items) for 'player color picker' widget");
spinner_list_3wide_determine_displayed_item_indices(
list_widget,
displayed_item_indices);
for (item_index = 0;
item_index < 3 &&
displayed_item_indices[item_index] != NONE;
item_index++)
{
struct widget_instance *item = widget_instance_get_nth_child(
list_widget,
item_index);
struct widget_instance *text_box = item->child;
struct widget_instance *bitmap = text_box->next;
short color_index;
definition = ui_widget_definition_get(item->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x95B,
definition->child_count == 2,
"expected 2 children in player color picker list item (name, pic)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x95D,
ui_widget_definition_get(text_box->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the list item's first child (color name)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x95F,
ui_widget_definition_get(bitmap->definition_tag_index)->type ==
_ui_widget_type_bitmap,
"expected a container widget for the list item's second child (color pic)");
color_index = ((byte *)list_widget->parameters.list.list_items)
[displayed_item_indices[item_index]];
text_box->parameters.text_box.string_list_index = color_index;
bitmap->animation.current_frame_index = color_index;
}
return;
}
void mp_level_select_list_update_displayed_items(
struct widget_instance *list_widget)
{
struct ui_widget_definition *definition = ui_widget_definition_get(
list_widget->definition_tag_index);
long displayed_item_indices[3];
long item_index;
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9BF,
definition->type == _ui_widget_type_spinner_list,
"expected a spinner list for 'level select' widget");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9C0,
definition->child_count == 3,
"expected 3 children (list items) for 'level select' widget");
spinner_list_3wide_determine_displayed_item_indices(
list_widget,
displayed_item_indices);
for (item_index = 0;
item_index < 3 &&
displayed_item_indices[item_index] != NONE;
item_index++)
{
struct widget_instance *item = widget_instance_get_nth_child(
list_widget,
item_index);
struct widget_instance *map_name = item->child;
struct widget_instance *map_bitmap = map_name->next;
struct widget_instance *map_description = map_bitmap->next;
definition = ui_widget_definition_get(item->definition_tag_index);
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9D2,
definition->child_count,
"expected 3 children in solo level list item (name, pic, desc)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9D4,
ui_widget_definition_get(map_name->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the list item's first child (map name)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9D6,
ui_widget_definition_get(map_bitmap->definition_tag_index)->type ==
_ui_widget_type_bitmap,
"expected a container widget for the list item's second child (map pic)");
match_vassert(
"c:\\halo\\SOURCE\\interface\\ui_widget_game_data_input_functions.c",
0x9D8,
ui_widget_definition_get(map_description->definition_tag_index)->type ==
_ui_widget_type_text_box,
"expected a text box widget for the list item's third child (map description)");
map_name->parameters.text_box.string_list_index =
(short)displayed_item_indices[item_index];
map_bitmap->animation.current_frame_index =
(short)displayed_item_indices[item_index];
map_description->parameters.text_box.string_list_index =
(short)displayed_item_indices[item_index];
}
return;
}
/* ---------- private code */
static int list_indices_sort_proc(
void const *index1,
void const *index2)
{
long first = *(long const *)index1;
long second = *(long const *)index2;
if (first == NONE)
{
if (second != first)
return 1;
}
else if (second == NONE)
return second;
return 0;
}
static long filter_invalid_list_indices(
long *indices,
long number_of_items)
{
long count = 0;
qsort(indices, number_of_items, sizeof(long), list_indices_sort_proc);
if (number_of_items > 0)
{
long *index = indices;
do
{
if (*index == NONE)
break;
count++;
index++;
}
while (count < number_of_items);
}
return count;
}
/* ---------- callback table */
ui_widget_game_data_function game_data_input_function_list[41] =
{
widget_function_null,
settings_menu_update_extended_description,
widget_function_null,
playlist_settings_menu_update_extended_description,
playlist_gametype_select_menu_update_extended_description,
multiplayer_type_menu_update_extended_description,
solo_level_select_list_update_displayed_items,
difficulty_select_menu_update_extended_description,
set_textbox_to_build_number,
server_list_menu_update,
network_pregame_status_screen_update,
splitscreen_pregame_status_screen_update,
netgame_prejoin_players,
mutliplayer_settings_select_list_update_displayed_items,
player_profile_3wide_list_update,
player_profile_edit_select_menu_update_extended_description,
player_profile_1wide_list_update,
game_options_menu_update_text_desc,
solo_game_objective_text,
player_profile_color_picker_update,
game_options_menu_update_pic_desc,
main_menu_animation_fakery,
mp_level_select_list_update_displayed_items,
get_active_player_profile_display_name,
get_editable_player_profile_display_name,
get_editable_playlist_profile_display_name,
get_active_player_profile_color_index,
multiplayer_game_set_text_box_for_map_name,
multiplayer_game_set_text_box_for_game_ruleset,
multiplayer_game_set_text_box_for_teams_noteams,
multiplayer_game_set_text_box_for_score_limit,
multiplayer_game_set_text_box_for_score_limit_type,
multiplayer_game_set_bitmap_for_map,
multiplayer_game_set_bitmap_for_ruleset,
multiplayer_game_set_text_box_for_number_of_players,
multiplayer_edit_profile_set_ruleset_textbox_string_index,
system_link_status_check,
multiplayer_game_directions,
teams_no_teams_mp_game_bitmap_update,
warn_if_difficulty_will_nuke_saved_game,
dim_if_no_system_link_cable,
};