41 #define GOAL_TIMESTAMP 0 // make immediately eval
42 #define GOAL_TIMESTAMP_TRAINING 500 // every half second
44 #define MAX_GOALS_PER_LIST 15
45 #define MAX_GOAL_LINES 200
48 #define GOAL_SCREEN_X_COORD 0
49 #define GOAL_SCREEN_Y_COORD 1
50 #define GOAL_SCREEN_W_COORD 2
51 #define GOAL_SCREEN_H_COORD 3
136 #define NUM_GOAL_SCREEN_BUTTONS 3 // total number of buttons
137 #define GOAL_SCREEN_BUTTON_SCROLL_UP 0
138 #define GOAL_SCREEN_BUTTON_SCROLL_DOWN 1
139 #define GOAL_SCREEN_BUTTON_RETURN 2
168 int add(
const char *text = NULL);
183 #define DIRECTIVE_SOUND_DELAY 500 // time directive success sound effect is delayed
184 #define DIRECTIVE_SPECIAL_DELAY 7000 // mark special directives as true after 7 seconds
186 static int Mission_directive_sound_timestamp;
187 static int Mission_directive_special_timestamp;
193 return XSTR(
"Primary", 396);
196 return XSTR(
"Secondary", 397);
199 return XSTR(
"Bonus", 398);
205 static int Goal_screen_text_x;
206 static int Goal_screen_text_y;
207 static int Goal_screen_text_w;
208 static int Goal_screen_text_h;
209 static int Goal_screen_icon_x;
215 static int Scroll_offset;
216 static int Goals_screen_bg_bitmap;
217 static int Goal_complete_bitmap;
218 static int Goal_incomplete_bitmap;
219 static int Goal_failed_bitmap;
248 for (i=0; i<
count; i++) {
259 int i,
y, ys, bmp, font_height;
262 for (i=0; i<
count; i++) {
266 switch (
list[i]->satisfied) {
268 bmp = Goal_complete_bitmap;
272 bmp = Goal_incomplete_bitmap;
276 bmp = Goal_failed_bitmap;
282 y = Goal_screen_text_y
287 if ((y >= Goal_screen_text_y - ys / 2) && (y + ys <= Goal_screen_text_y + Goal_screen_text_h + ys / 2)) {
325 m_num_lines +=
count;
341 y += Goal_screen_text_y;
352 gr_line(Goal_screen_text_x + w + 1, y1, Goal_screen_icon_x + Goal_screen_text_w, y1,
GR_RESIZE_MENU);
371 Mission_goals[
i].
flags = 0;
372 Mission_goals[
i].
team = 0;
378 Mission_events[
i].
flags = 0;
379 Mission_events[
i].
count = 0;
382 Mission_events[
i].
team = -1;
387 Mission_directive_sound_timestamp = 0;
388 Mission_directive_special_timestamp =
timestamp(-1);
397 if (Mission_events[i].objective_text) {
398 vm_free(Mission_events[i].objective_text);
401 if (Mission_events[i].objective_key_text) {
402 vm_free(Mission_events[i].objective_key_text);
411 int i,
type, team_num=0;
415 Primary_goal_list.
count = 0;
416 Secondary_goal_list.
count = 0;
417 Bonus_goal_list.
count = 0;
423 Goal_screen_icon_x = Goal_screen_icon_xcoord[
gr_screen.
res];
438 Primary_goal_list.
add(&Mission_goals[i]);
442 Secondary_goal_list.
add(&Mission_goals[i]);
447 Bonus_goal_list.
add(&Mission_goals[i]);
452 Error(
LOCATION,
"Unknown goal priority encountered when displaying goals in mission\n");
459 Goal_text.
add(
XSTR(
"*Primary Objectives", 399));
461 Primary_goal_list.
set();
463 if (Secondary_goal_list.
count) {
466 Goal_text.
add(
XSTR(
"*Secondary Objectives", 400));
468 Secondary_goal_list.
set();
471 if (Bonus_goal_list.
count) {
474 Goal_text.
add(
XSTR(
"*Bonus Objectives", 401));
476 Bonus_goal_list.
set();
484 b = &Goal_buttons[
i];
486 b->
button.
create(&Goals_screen_ui_window,
"", b->
x, b->
y, 60, 30, (i < 2), 1);
497 Goals_screen_bg_bitmap =
bm_load(
"ObjectivesBG");
498 Goal_complete_bitmap =
bm_load(
"ObjComp");
499 Goal_incomplete_bitmap =
bm_load(
"ObjIncomp");
500 Goal_failed_bitmap =
bm_load(
"ObjFail");
502 if (Goals_screen_bg_bitmap < 0) {
503 Warning(
LOCATION,
"Could not load the background bitmap: ObjectivesBG.pcx");
510 if (Goals_screen_bg_bitmap >= 0)
513 if (Goal_complete_bitmap)
516 if (Goal_incomplete_bitmap)
519 if (Goal_failed_bitmap)
522 Goals_screen_ui_window.
destroy();
533 k = Goals_screen_ui_window.
process();
553 if (Goal_buttons[i].button.pressed()){
559 if (Goals_screen_bg_bitmap >= 0) {
563 Goals_screen_ui_window.
draw();
567 while (y + font_height <= Goal_screen_text_h) {
584 int i,
type, team_num;
586 Primary_goal_list.
count = 0;
587 Secondary_goal_list.
count = 0;
588 Bonus_goal_list.
count = 0;
591 Goal_screen_text_y =
y;
592 Goal_screen_text_w =
w;
593 Goal_screen_text_h =
h;
594 Goal_screen_icon_x =
x;
615 Primary_goal_list.
add(&Mission_goals[i]);
619 Secondary_goal_list.
add(&Mission_goals[i]);
624 Bonus_goal_list.
add(&Mission_goals[i]);
629 Error(
LOCATION,
"Unknown goal priority encountered when displaying goals in mission\n");
636 Goal_text.
add(
XSTR(
"*Primary Objectives", 399));
638 Primary_goal_list.
set();
640 if (Secondary_goal_list.
count) {
643 Goal_text.
add(
XSTR(
"*Secondary Objectives", 400));
645 Secondary_goal_list.
set();
648 if (Bonus_goal_list.
count) {
651 Goal_text.
add(
XSTR(
"*Bonus Objectives", 401));
653 Bonus_goal_list.
set();
657 Goal_complete_bitmap =
bm_load(
"ObjComp");
658 Goal_incomplete_bitmap =
bm_load(
"ObjIncomp");
659 Goal_failed_bitmap =
bm_load(
"ObjFail");
667 if (Goal_complete_bitmap >= 0) {
671 if (Goal_incomplete_bitmap >= 0) {
675 if (Goal_failed_bitmap >= 0) {
687 while (y + font_height <= Goal_screen_text_h) {
729 int players_in_team = 0;
748 if (!players_in_team) {
775 Mission_goals[goal_num].
satisfied = new_status;
832 if (!Mission_events[event].born_on_date){
836 if (Mission_events[event].
result) {
840 if (Mission_events[event].formula < 0) {
875 Mission_events[
event].
flags &= ~MEF_DIRECTIVE_TEMP_TRUE;
878 Mission_directive_special_timestamp =
timestamp(-1);
884 int store_flags = Mission_events[
event].
flags;
887 int store_count = Mission_events[
event].
count;
890 bool bump_timestamp =
false;
899 if (Mission_events[event].chain_delay >= 0) {
903 if (!Mission_events[event - 1].result || ((
fix) Mission_events[event - 1].satisfied_time +
i2f(Mission_events[event].chain_delay) >
Missiontime)){
911 if (!Mission_events[event - 1].result || ((
fix) Mission_events[event - 1].
timestamp +
i2f(Mission_events[event].chain_delay) >
Missiontime)){
916 if ((event <
Num_mission_events - 1) && Mission_events[event + 1].result && (Mission_events[event + 1].chain_delay >= 0)){
973 if (result && !Mission_events[event].satisfied_time) {
975 if ( Mission_events[event].objective_text ) {
982 if (Mission_events[event].trigger_count > 0)
984 if (Mission_events[event].trigger_count == 0) {
988 bump_timestamp =
true;
995 if ( Mission_events[event].repeat_count > 0 )
997 if ( Mission_events[event].repeat_count == 0 ) {
1012 else if (bump_timestamp || (!((Mission_events[event].repeat_count == -1) && (Mission_events[event].
flags & MEF_USING_TRIGGER_COUNT) && (Mission_events[event].trigger_count != 0)))) {
1019 if(
MULTIPLAYER_MASTER && ((store_flags != Mission_events[event].
flags) || (store_formula != Mission_events[event].formula) || (store_result != Mission_events[event].result) || (store_count != Mission_events[event].
count)) ){
1029 Mission_directive_sound_timestamp=0;
1041 if (Mission_events[i].formula != -1) {
1063 result =
eval_sexp(Mission_goals[i].formula);
1067 }
else if (result) {
1076 if ( Mission_events[i].formula != -1 ) {
1126 }
else if ( Mission_goals[i].satisfied ==
GOAL_FAILED ) {
1132 return primary_goals_complete;
1138 int i, all_goals_met = 1;
1150 }
else if ( Mission_goals[i].satisfied ==
GOAL_FAILED ) {
1157 return all_goals_met;
1190 if ( !
stricmp(Mission_goals[i].name, name) ) {
1203 if ( !
stricmp(Mission_goals[i].name, name) ) {
1239 if ( Mission_events[i].formula != -1 ) {
1269 DCF(show_mission_goals,
"Lists the status of mission goals")
1274 dc_printf(
"Usage: show_mission_goals\n\nList all mission goals and their current status.\n");
1289 else if ( Mission_goals[i].satisfied ==
GOAL_FAILED )
1292 dc_printf(
"Warning! Mission goal %i is in an invalid state! (value: %i)", i, Mission_goals[i].satisfied);
1298 DCF(change_mission_goal,
"Changes the mission goal status")
1305 dc_printf(
"Usage: change_mission_goal <goal_num> [status]\n");
1306 dc_printf(
"<goal_num> -- Integer number of goal to change. See show_mission_goals\n");
1307 dc_printf(
"[status] -- Goal status to change to.\n\n");
1309 dc_printf(
"The optional [status] field may be either a bool type or a string.\n");
1310 dc_printf(
"\ttrue -- Goal status set to 'complete'\n");
1311 dc_printf(
"\tfalse -- Goal status set to 'failed'\n\n");
1313 dc_printf(
"A string value of 'satisfied', 'failed', or 'unknown' will set the goal status to the respective state.\n");
1314 dc_printf(
"If [status] is not given, then the goal status will be set to 'unknown'");
1317 dc_printf(
"\t'change_mission_goal 1 true' makes goal 1 as successful.\n");
1318 dc_printf(
"\t'change_mission_goal 2' marks goal 2 as unknown/incomplete\n");
1319 dc_printf(
"\t'change_mission_goal 0 satisfied' marks goal 0 as satisfied\n");
1325 dc_printf (
" Error: Invalid value for <goal_num>. Valid values: 0 - %i\n",
Num_goals);
1346 switch(Mission_goals[num].satisfied) {
1348 string =
"satisfied";
1356 string =
"unsatisfied";
1360 dc_printf(
"Warning! Mission goal %i is in an invalid state! (value: %i)", num, Mission_goals[num].satisfied);
1363 dc_printf(
"Mission goal %i set to '%s'\n", num,
string);
1403 if (Scroll_offset) {
1416 if (Scroll_offset + max_lines < Goal_text.
m_num_lines) {
1435 if((team >= 0) && (Mission_goals[i].team != team)){
1444 if ( type != desired_type ) {
1448 *total = *total + 1;
1451 *num_resolved = *num_resolved + 1;
1463 if((team >= 0) && (Mission_goals[i].team != team)){
1472 if ( type != desired_type ) {
void set_highlight_action(void(*_user_function)(void))
int timestamp(int delta_ms)
#define MAX_GOALS_PER_LIST
void mission_eval_goals()
void icons_display(int y)
int m_line_sizes[MAX_GOAL_LINES]
void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
void mission_goal_mark_valid(char *name)
int ML_objectives_init(int x, int y, int w, int h)
GLfloat GLfloat GLfloat GLfloat h
SCP_vector< SCP_string > * Current_event_log_buffer
SCP_vector< game_snd > Snds
void mission_goal_fetch_num_resolved(int desired_type, int *num_resolved, int *total, int team)
GLsizei const GLfloat * value
SCP_vector< SCP_string > * Current_event_log_variable_buffer
#define MEF_DIRECTIVE_TEMP_TRUE
bool Alternate_chaining_behavior
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void goal_screen_scroll_down()
void goal_screen_button_pressed(int num)
#define GR_NUM_RESOLUTIONS
int line_spans[MAX_GOALS_PER_LIST]
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
#define DIRECTIVE_WING_ZERO
void add(mission_goal *m)
goal_list structure functions
general failure sound for any event
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
int line_offsets[MAX_GOALS_PER_LIST]
void display(int n, int y)
int hud_gauge_active(int gauge_index)
Determine if the specified HUD gauge should be displayed.
void mission_goal_validation_change(int goal_num, int valid)
SCP_vector< SCP_string > * Current_event_log_argument_buffer
void ML_render_objectives_key()
void mission_goal_fail_all()
SCP_vector< SCP_string > event_log_argument_buffer
void mission_goal_mark_all_true(int type)
void multi_team_maybe_add_score(int points, int team)
#define GR_MAYBE_CLEAR_RES(bmap)
#define MEF_DIRECTIVE_SPECIAL
int Mission_goal_timestamp
GLenum GLuint GLenum GLsizei const GLchar * message
void mission_maybe_play_directive_success_sound()
void gr_set_color_fast(color *dst)
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
SCP_vector< SCP_string > event_log_buffer
#define HUD_DIRECTIVES_VIEW
void HUD_sourced_printf(int source, const char *format,...)
int mission_goals_incomplete(int desired_type, int team)
GLenum GLuint GLenum GLsizei const GLchar * buf
void multi_sexp_flush_packet()
DCF(show_mission_goals,"Lists the status of mission goals")
mission_goal Mission_goals[MAX_GOALS]
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
void mission_init_goals()
#define PROFILE(name, function)
SCP_vector< SCP_string > event_log_variable_buffer
int mission_evaluate_primary_goals()
void mission_event_shutdown()
void common_set_interface_palette(char *filename)
void send_event_update_packet(int event)
void send_mission_goal_info_packet(int goal_num, int new_status, int valid)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
void set_mask_bmap(char *fname)
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
void common_free_interface_palette()
void mission_goal_mark_objectives_complete()
void mission_goal_status_change(int goal_num, int new_status)
int add(const char *text=NULL)
void ML_objectives_close()
#define LOG_GOAL_SATISFIED
void hud_add_objective_messsage(int type, int status)
Add objective status on the HUD.
ai_profile_t * ai_profile
mission_goal * list[MAX_GOALS_PER_LIST]
#define GOAL_SCREEN_BUTTON_RETURN
#define DIRECTIVE_SPECIAL_DELAY
void mission_event_set_directive_special(int event)
mission_event Mission_events[MAX_MISSION_EVENTS]
void mission_process_event(int event)
#define HUD_SOURCE_HIDDEN
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
float scoring_get_scale_factor()
bool dc_maybe_stuff_boolean(bool *b)
Tries to stuff a bool from the Command_string.
GLsizei const GLchar ** string
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char)
#define DIRECTIVE_SOUND_DELAY
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
#define GOAL_SCREEN_Y_COORD
#define GOAL_SCREEN_H_COORD
void maybe_write_to_event_log(int result)
GLint GLint GLint GLint GLint x
SCP_vector< game_snd > Snds_iface
int hud_disabled()
Checks if HUD disabled.
void mission_event_unset_directive_special(int event)
const char * XSTR(const char *str, int index)
void mission_show_goals_do_frame(float frametime)
#define PRIMARY_GOALS_FAILED
user_click (mouse selects a control)
void mission_goal_mark_invalid(char *name)
#define MEF_USING_TRIGGER_COUNT
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define GM_STANDALONE_SERVER
void set_hotkey(int keycode)
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
GLuint const GLchar * name
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
#define AIPF_ALLOW_MULTI_EVENT_SCORING
void mission_goal_fail_incomplete()
#define GOAL_SCREEN_X_COORD
void goal_screen_scroll_up()
#define MISSION_TYPE_TRAINING
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
GLboolean GLboolean GLboolean b
scroll pressed (and scroll)
void link_hotspot(int num)
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
GLubyte GLubyte GLubyte GLubyte w
#define GOAL_TIMESTAMP_TRAINING
#define MULTI_CONNECTED(np)
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
int eval_sexp(int cur_node, int referenced_node)
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
int event_music_primary_goal_failed()
#define GOAL_SCREEN_BUTTON_SCROLL_DOWN
#define MULTIPLAYER_MASTER
void std_multi_update_goals()
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void common_play_highlight_sound()
#define timestamp_elapsed(stamp)
#define GOAL_SCREEN_W_COORD
char * objective_key_text
void ML_objectives_do_frame(int scroll_offset)
#define MAX_MISSION_EVENTS
const char * Goal_type_text(int n)
void gr_bitmap(int _x, int _y, int resize_mode)
bool dc_optional_string(const char *pstr)
Searches for an optional string.
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
void mission_goal_mark_events_complete()
#define NUM_GOAL_SCREEN_BUTTONS
void gamesnd_play_iface(int n)
void multi_player_maybe_add_score(int score, int team)
goal_buttons Goal_buttons[NUM_GOAL_SCREEN_BUTTONS]
int process(int key_in=-1, int process_mouse=1)
void init()
goal_text structure functions
int event_music_primary_goals_met()
net_player Net_players[MAX_PLAYERS]
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
void gameseq_post_event(int event)
#define timestamp_valid(stamp)
#define PRIMARY_GOALS_COMPLETE
#define PRIMARY_GOALS_INCOMPLETE
void mission_show_goals_init()
int mission_get_event_status(int event)
const char * m_lines[MAX_GOAL_LINES]
#define GOAL_SCREEN_BUTTON_SCROLL_UP
#define MISSION_TYPE_MULTI_TEAMS
void mission_show_goals_close()