void debug_print_line(byte* line, int size, byte color) { // Максимальная длина строки 29 символов const byte left = 50; const byte right = 79; const byte up = 0; const byte down = 24; const byte writex = 50; const byte writey = 24; Mouse_Hide(); asm { pusha // Прокрутка на одну строку вверх перед печатью очередной mov ah, 6 mov al, 1 mov bx, 0000h mov ch, up mov cl, left mov dh, down mov dl, right int 10h popa } write_line(line, size, writex, writey, color); Mouse_Show(); }
/* ================= UI_SPPostgameMenu_f ================= */ void UI_SPPostgameMenu_f( void ) { int playerGameRank; // int oldFrags, newFrags; const char *arena; char map[MAX_QPATH]; char info[MAX_INFO_STRING]; Mouse_Show(); memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) ); trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) ); postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) ); postgameMenuInfo.menu.nobackground = qtrue; trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ); Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) ); arena = UI_GetArenaInfoByMap( map ); if ( !arena ) { return; } Q_strncpyz( arenainfo, arena, sizeof(arenainfo) ); postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) ); playerGameRank = 8; // in case they ended game as a spectator playerGameRank = atoi( UI_Argv(1)); UI_SetBestScore( postgameMenuInfo.level, playerGameRank+1 ); postgameMenuInfo.starttime = uis.realtime; postgameMenuInfo.scoreboardtime = uis.realtime; trap_Key_SetCatcher( KEYCATCH_UI ); uis.menusp = 0; UI_SPPostgameMenu_Init(); UI_PushMenu( &postgameMenuInfo.menu ); if (playerGameRank == 0) { postgameMenuInfo.won = 1; Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next ); } else { Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_menu ); } // trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" ); //?? always win? should this be deleted and playing cg_scoreboard now? postgameMenuInfo.lastTier = UI_GetNumSPTiers(); if ( UI_GetSpecialArenaInfo( "final" ) ) { postgameMenuInfo.lastTier++; } }
void paint_buttons() { Mouse_Hide(); const byte writex = 45; const byte writey = 5; const byte color = 7; const int size = 2; byte* line = "NGD2D3FF"; for (int i=0; i<8; i+=2) { const int y_step = 28; rectangle(354, 379, 52+y_step*i, 52+y_step*i+2, 8); rectangle(354, 379, 102+y_step*i-2, 102+y_step*i, 8); rectangle(354, 354+2, 52+y_step*i, 102+y_step*i, 8); rectangle(379-2, 379, 52+y_step*i, 102+y_step*i, 8); write_line(line+i, size, writex, writey+2*i, color); } Mouse_Show(); }
/* =============== UI_MotdMenu =============== */ void UI_MotdMenu( void ) { memset( &s_motdstuff, 0, sizeof( s_motdstuff ) ); uis.menusp = 0; ingameFlag = qtrue; Mouse_Show(); UI_MotdMenu_Cache(); MotdMenu_Init(); UI_PushMenu( &s_motdstuff.menu ); Menu_AdjustCursor( &s_motdstuff.menu, 1 ); }
void apply_color(byte x, byte y) { byte color; switch (board[y][x]) { case White: color = 8; break; case WDamka: color = 15; break; case Black: color = 1; break; case BDamka: color = 3; break; default: color = 0; } if (MyColor == White) { y = 7-y; } else { x = 7-x; } Mouse_Hide(); circle(8 + x*43, 8 + y*43, 29, color); Mouse_Show(); }
void apply_select(byte x, byte y, byte select) { byte color = 0; if (select) { color = 14; selected_x = x; selected_y = y; } if (MyColor == White) { y = 7-y; } else { x = 7-x; } int x1 = 43 - 5 + x*43; int x2 = 43 - 2 + x*43; int y1 = 3 + y*43; int y2 = 6 + y*43; Mouse_Hide(); rectangle(x1, x2, y1, y2, color); Mouse_Show(); }
/* =============== UI_TurboliftMenu =============== */ void UI_TurboliftMenu ( int liftNum ) { if ( !liftNum ) return; memset( &s_turbolift, 0, sizeof( s_turbolift ) ); s_turbolift.liftNum = liftNum; uis.menusp = 0; ingameFlag = qtrue; // true when in game menu is in use Mouse_Show(); UI_TurboliftMenu_Cache(); TurboliftMenu_Init(); UI_PushMenu( &s_turbolift.menu ); Menu_AdjustCursor( &s_turbolift.menu, 1 ); }
void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) ) { // uiClientState_t cstate; int n1, n2, n3; int l1, l2, l3; // zero set all our globals memset( &s_confirm, 0, sizeof(s_confirm) ); ConfirmMenu_Cache(); Mouse_Show(); n1 = UI_ProportionalStringWidth( "YES/NO",UI_SMALLFONT ); n2 = UI_ProportionalStringWidth( "YES",UI_SMALLFONT ) + PROP_GAP_WIDTH; n3 = UI_ProportionalStringWidth( "/",UI_SMALLFONT ) + PROP_GAP_WIDTH; l1 = 320 - ( n1 / 2 ); l2 = l1 + n2; l3 = l2 + n3; s_confirm.slashX = l2; s_confirm.question = question; s_confirm.draw = draw; s_confirm.action = action; s_confirm.menu.draw = ConfirmMenu_Draw; s_confirm.menu.key = ConfirmMenu_Key; s_confirm.menu.wrapAround = qtrue; s_confirm.menu.fullscreen = qtrue; s_confirm.menu.descX = MENU_DESC_X; s_confirm.menu.descY = MENU_DESC_Y; s_confirm.menu.titleX = MENU_TITLE_X; s_confirm.menu.titleY = MENU_TITLE_Y; s_confirm.menu.titleI = MNT_CONFIRMATIONMENU_TITLE; s_confirm.menu.footNoteEnum = MNT_CONFIRMATION; s_confirm.yes.generic.type = MTYPE_BITMAP; s_confirm.yes.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_confirm.yes.generic.x = 215; s_confirm.yes.generic.y = 365; s_confirm.yes.generic.callback = ConfirmMenu_Event; s_confirm.yes.generic.id = ID_CONFIRM_YES; s_confirm.yes.generic.name = GRAPHIC_SQUARE; s_confirm.yes.width = MENU_BUTTON_MED_WIDTH; s_confirm.yes.height = MENU_BUTTON_MED_HEIGHT; s_confirm.yes.color = CT_DKPURPLE1; s_confirm.yes.color2 = CT_LTPURPLE1; s_confirm.yes.textX = MENU_BUTTON_TEXT_X; s_confirm.yes.textY = MENU_BUTTON_TEXT_Y; s_confirm.yes.textEnum = MBT_GENERIC_YES; s_confirm.yes.textcolor = CT_BLACK; s_confirm.yes.textcolor2 = CT_WHITE; s_confirm.no.generic.type = MTYPE_BITMAP; s_confirm.no.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_confirm.no.generic.x = 371; s_confirm.no.generic.y = 365; s_confirm.no.generic.callback = ConfirmMenu_Event; s_confirm.no.generic.id = ID_CONFIRM_NO; s_confirm.no.generic.name = GRAPHIC_SQUARE; s_confirm.no.width = 103; s_confirm.no.height = MENU_BUTTON_MED_HEIGHT; s_confirm.no.color = CT_DKPURPLE1; s_confirm.no.color2 = CT_LTPURPLE1; s_confirm.no.textX = MENU_BUTTON_TEXT_X; s_confirm.no.textY = MENU_BUTTON_TEXT_Y; s_confirm.no.textEnum = MBT_GENERIC_NO; s_confirm.no.textcolor = CT_BLACK; s_confirm.no.textcolor2 = CT_WHITE; Menu_AddItem( &s_confirm.menu, &s_confirm.yes ); Menu_AddItem( &s_confirm.menu, &s_confirm.no ); UI_PushMenu( &s_confirm.menu ); // Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.no ); }
void mainloop() { connect: MyColor = None; timer18 = 0; whetherC0 = 0; while (MyColor == None) { Key_Is_Esc(); asm jc end_mainloop connect(); } gameloop(); if (ggs == GGCONNECT) goto connect; end_mainloop: } void gameloop() { byte NG_during_game = 0; newgame: debug_print("Ожидание начала новой игры", 26, 8); ggs = GGSTART; timer18 = 0; timer55 = 0; NG_is_sent = 0; if (NG_during_game) { NG_is_received = 1; NG_during_game = 0; } else { NG_is_received = 0; } getst = GETSTART; isNewCommand = 0; drawn_proposed_by_me = 0; drawn_proposed_by_him = 0; while (1) { Key_Is_Esc(); asm jc send_EX sendSS(); game(); if (ggs == GGNEW) goto newgame; if (ggs == GGCONNECT) goto end_gameloop; } send_EX: send_str("EX", 2); debug_print("EX", 2, Dmy); end_gameloop: } void graph_ini() { // Переход в 10h графический режим asm { mov ah, 00h mov al, 10h int 10h mov ah, 0fh int 10h mov Page, bh } } void graph_rst() { // Возвращение стандартного видео-режима asm { mov ah, 00h mov al, 3h int 10h } } void rectangle(int x1, int x2, int y1, int y2, byte color) { for (int i=y1; i<=y2; i++) { for (int j=x1; j<=x2; j++) { point(j, i, color); } } } #undef byte void read_args() { asm mov al, byte ptr cs:[80h] asm mov argslen, al if (argslen) argslen--; } #define byte unsigned char void point(int x, int y, byte color) { asm { mov ah, 0ch mov al, color mov cx, x mov dx, y mov bh, Page int 10h } } void paint_empty_board() { Mouse_Hide(); byte color = 6; int x1, x2, y1, y2; // Расчерчиваем по вертикали y1 = 0; y2 = 345; x1 = 0; x2 = x1 + 1; for (int i=0; i<=8; i++) { rectangle(x1, x2, y1, y2, color); x1 += 43; x2 += 43; } // Расчерчиваем по горизонтали y1 = 0; y2 = y1 + 1; x1 = 0; x2 = 345; for (int j=0; j<=8; j++) { rectangle(x1, x2, y1, y2, color); y1 += 43; y2 += 43; } Mouse_Show(); }