---------------------------------------------------------------------------------
| 770 | } |
| 771 | //--------------------------------------------------------------------------------- |
| 772 | void consoleDrawChar(int c) { |
| 773 | //--------------------------------------------------------------------------------- |
| 774 | c -= currentConsole->font.asciiOffset; |
| 775 | if ( c < 0 || c > currentConsole->font.numChars ) return; |
| 776 | |
| 777 | u8 *fontdata = currentConsole->font.gfx + (8 * c); |
| 778 | |
| 779 | u16 fg = currentConsole->fg; |
| 780 | u16 bg = currentConsole->bg; |
| 781 | |
| 782 | if (!(currentConsole->flags & CONSOLE_FG_CUSTOM)) { |
| 783 | if (currentConsole->flags & (CONSOLE_COLOR_BOLD | CONSOLE_COLOR_FG_BRIGHT)) { |
| 784 | fg += 8; |
| 785 | } else if (currentConsole->flags & CONSOLE_COLOR_FAINT) { |
| 786 | fg += 16; |
| 787 | } |
| 788 | fg = colorTable[fg]; |
| 789 | } |
| 790 | |
| 791 | if (!(currentConsole->flags & CONSOLE_BG_CUSTOM)) { |
| 792 | if (currentConsole->flags & CONSOLE_COLOR_BG_BRIGHT) bg +=8; |
| 793 | bg = colorTable[bg]; |
| 794 | } |
| 795 | |
| 796 | if (currentConsole->flags & CONSOLE_COLOR_REVERSE) { |
| 797 | u16 tmp = fg; |
| 798 | fg = bg; |
| 799 | bg = tmp; |
| 800 | } |
| 801 | |
| 802 | u8 b1 = *(fontdata++); |
| 803 | u8 b2 = *(fontdata++); |
| 804 | u8 b3 = *(fontdata++); |
| 805 | u8 b4 = *(fontdata++); |
| 806 | u8 b5 = *(fontdata++); |
| 807 | u8 b6 = *(fontdata++); |
| 808 | u8 b7 = *(fontdata++); |
| 809 | u8 b8 = *(fontdata++); |
| 810 | |
| 811 | if (currentConsole->flags & CONSOLE_UNDERLINE) b8 = 0xff; |
| 812 | |
| 813 | if (currentConsole->flags & CONSOLE_CROSSED_OUT) b4 = 0xff; |
| 814 | |
| 815 | u8 mask = 0x80; |
| 816 | |
| 817 | |
| 818 | int i; |
| 819 | |
| 820 | int x = (currentConsole->cursorX - 1 + currentConsole->windowX - 1 ) * 8; |
| 821 | int y = ((currentConsole->cursorY - 1 + currentConsole->windowY - 1 ) *8 ); |
| 822 | |
| 823 | u16 *screen = ¤tConsole->frameBuffer[(x * 240) + (239 - (y + 7))]; |
| 824 | |
| 825 | for (i=0;i<8;i++) { |
| 826 | if (b8 & mask) { *(screen++) = fg; }else{ *(screen++) = bg; } |
| 827 | if (b7 & mask) { *(screen++) = fg; }else{ *(screen++) = bg; } |
| 828 | if (b6 & mask) { *(screen++) = fg; }else{ *(screen++) = bg; } |
| 829 | if (b5 & mask) { *(screen++) = fg; }else{ *(screen++) = bg; } |