void far alt_menu_on() { int i,save_row_curser,save_col_curser; save_row_curser = row_curser; save_col_curser = col_curser; read_curser_pos(); turn_off_curser(); display_alt_menu = 't'; for(i = 0 ; i < 32 ; i++) { if(light_lines[i].is_on == 't') { if(light_lines[i].light_message[0] != '\0') { attribute_string(light_lines[i].light_message, light_lines[i].row, light_lines[i].col, the_light_color); } } } goto_row_col(row_curser,col_curser); row_curser = save_row_curser; col_curser = save_col_curser; turn_on_curser(); }
// i would like to apologise for this crappy crappy code.. but at least it checks for buffer overflows void list_print(u8 **list, TPOS *pos, AGISIZE *size, int status, int up, int down) { int i; u8 str[500]; window_clear(pos->row, pos->col, pos->row+size->h-1, pos->col+size->w-1, 0xFF); for (i=0; i<size->h; i++) { goto_row_col(pos->row+i, pos->col); if ((strlen(list[i]) > 550) || (size->w >= 500)) agi_printf(" - *TOO LONG*"); else { sprintf(str, " - %s", list[i]); str[size->w] = 0; agi_printf("%s", str); } } if (status) { goto_row_col(pos->row, pos->col+size->w+1); if (up) agi_printf("U"); else agi_printf(" "); goto_row_col(pos->row+size->h-1, pos->col+size->w+1); if (down) agi_printf("D"); else agi_printf(" "); } }
void far alt_menu_off() { int i,save_row_curser,save_col_curser; save_row_curser = row_curser; save_col_curser = col_curser; read_curser_pos(); turn_off_curser(); display_alt_menu = 'f'; for(i = 0 ; i < 28 ; i++) /*column 36 stuff*/ { if(light_lines[i].light_message[0] != '\0') { attribute_string(column36_blank, light_lines[i].row, light_lines[i].col, the_light_color); } } for(i = 28 ; i < 32 ; i++) /*column 61 stuff*/ { if(light_lines[i].light_message[0] != '\0') { attribute_string(column61_blank, light_lines[i].row, light_lines[i].col, the_light_color); } } goto_row_col(row_curser,col_curser); row_curser = save_row_curser; col_curser = save_col_curser; turn_on_curser(); }
// trace_add? // var8, vara, varc, vare, var10 void trace_add(u16 op, FUNC *table, u8 *log_data, u16 table_offset, u16 result) { AGI_EVENT *temp4 = 0; LOGIC *logic_orig = 0; // orig logic_cur u8 *msg; //table += op<<2; table += op; push_row_col(); text_attrib_push(); text_colour(0, 0xF); trace_scroll(); if (logic_called != 0) { logic_called = 0; agi_printf("=========================="); trace_scroll(); } logic_orig = logic_cur; if ((trace_logic==0) || ((logic_cur=logic_list_find(trace_logic)) == 0)) { agi_printf("%d: cmd.%d", logic_orig->num, op); } else { if (op == 0) agi_printf("%d: %s", logic_orig->num, "return"); else { msg = logic_msg(op + table_offset); if (msg != 0) agi_printf("%d: %s", logic_orig->num, logic_msg(op + table_offset)); else { if (result != 0xFFFF) agi_printf("%d: eval.%d", logic_orig->num, op); else agi_printf("%d: cmd.%d", logic_orig->num, op); } } } logic_cur = logic_orig; // print function name? trace_var_print(table, log_data); if (result != 0xFFFF) { goto_row_col(trace_bottom, trace_right-2); if (result == 0) agi_printf(" :%c", 'F'); else agi_printf(" :%c", 'T'); } ch_update(); while (trace_state != 0) { temp4 = event_read(); if (temp4 != 0) if (temp4->type == 1) break; } if (temp4 != 0) if (temp4->data == '+') trace_state = 2; pop_row_col(); text_attrib_pop(); ch_update(); }
void list_box_draw_blank(u16 var8) { goto_row_col(var8, msgstate.tpos.col); window_put_char(' '); }
void list_box_draw_arrow(u16 var8) { goto_row_col(var8, msgstate.tpos.col); window_put_char(0x1A); }
void far alt_functions() { int the_char,row,i,save_row_curser,save_col_curser; /*save the curser position*/ save_row_curser = row_curser; save_col_curser = col_curser; read_curser_pos(); turn_off_curser(); the_char = ' '; while(the_char != 13 /*cr*/) { read_more(1); the_char = megatek_data[0]; if(the_char == 24) /*CAN*/ { all_lights_off(); pfk_out(the_char); } else if(the_char == 25) /*EM*/ { all_lights_on(); pfk_out(the_char); } else if((the_char >= '@') && (the_char <= 95)) /*turn off line*/ { row = the_char - 64; pfk_out(the_char); light_lines[row].is_on = 'f'; if(display_alt_menu == 't') { if(light_lines[row].light_message[0] != '\0') { if(light_lines[row].col > 60) attribute_string(column61_blank, light_lines[row].row, light_lines[row].col, the_light_color); else attribute_string(column36_blank, light_lines[row].row, light_lines[row].col, the_light_color); } } } else if((the_char >= ' ') && (the_char <= '?')) /*turn on line*/ { row = the_char - 32; pfk_out(the_char); light_lines[row].is_on = 't'; if(display_alt_menu == 't') { if(light_lines[row].light_message[0] != '\0') { attribute_string(light_lines[row]. light_message, light_lines[row].row, light_lines[row].col, the_light_color); } } } } /*restore the cursor*/ goto_row_col(row_curser,col_curser); row_curser = save_row_curser; col_curser = save_col_curser; turn_on_curser(); }