ssnfont.c
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <ultra64.h>
#include "ssnfont.h"
#include "font5x7.h"
#include "dldriver.h"
extern void *cfb_ptrs[2];
extern int draw_buffer;
char ssnstr[256];
void SsnPrintfxy(int chrx,int chry,char *ssnstr);
/*void SsnPutOneChar(int,int,int,unsigned char );*/
void SsnFontShow(void);
int col[8]={SSNCOL0,SSNCOL1,SSNCOL2,SSNCOL3,SSNCOL4,SSNCOL5,SSNCOL6,SSNCOL7};
void SsnPrintf(locate* loc,char* ssnstr){
int i=0;
while (ssnstr[i]!='\0') {
switch (ssnstr[i]){
case '\n':
loc->x=0;
loc->y++;
i++;
break;
case '\\':
i++;
switch (ssnstr[i]){
case 'c':
i++;
loc->c=col[(char)ssnstr[i++]-'0'];
break;
default:
break;
}
break;
default:
SsnPutOneChar(loc->c,loc->x++,loc->y,ssnstr[i++]);
break;
}
}
}
/*
void SsnPrintf(locate* loc,char* ssnstr){
int i=0;
while (ssnstr[i]!='\0') {
if (ssnstr[i] =='\n') {
loc->x=0;
loc->y++;
}
if (ssnstr[i] =='\\') {
i++;
switch (ssnstr[i]){
case 'c':
i++;
loc->c=col[(char)ssnstr[i++]-'0'];
break;
default:
break;
}
} else {
SsnPutOneChar(loc->c,loc->x++,loc->y,ssnstr[i++]);
}
}
}
*/
void SsnPrintfxy(int chrx,int chry,char *ssnstr){
int i=0;
while (ssnstr[i]!='\0') SsnPutOneChar(0xffff,chrx++,chry,ssnstr[i++]);
}
void SsnPutOneChar(int filter,int chrx,int chry,unsigned char c){
unsigned short *cfbPtr;
int x,y,d;
cfbPtr = cfb_ptrs[draw_buffer];
for (y=0;y<SSNFONTSIZEY;y++){
for (x=0;x<SSNFONTSIZEX;x++){
d = font5x7[SSNFONTSIZEXX*(y+SSNFONTSIZEY*(SSNFONTCHRY-c/SSNFONTCHRX))+x+(c%SSNFONTCHRX)*SSNFONTSIZEX] & filter;
/*
if (d != 0x0001 ) cfb_16[draw_buffer][(SCREEN_WD*(chry*SSNFONTSIZEY+(SSNFONTSIZEY-y)+SSNSCROFSTY))+chrx*SSNFONTSIZEX+x+SSNSCROFSTX]
*/
if (d != 0x0001 ) cfbPtr[(SCREEN_WD*(chry*SSNFONTSIZEY+(SSNFONTSIZEY-y)+SSNSCROFSTY))+chrx*SSNFONTSIZEX+x+SSNSCROFSTX]
=font5x7[SSNFONTSIZEXX*(y+SSNFONTSIZEY*(SSNFONTCHRY-c/SSNFONTCHRX))+x+(c%SSNFONTCHRX)*SSNFONTSIZEX] & filter;
}
}
}
void SsnFontShow(void){
int x,y;
unsigned short *cfbPtr;
cfbPtr = cfb_ptrs[draw_buffer];
for (y=0;y<SSNFONTSIZEYY;y++){
for (x=0;x<SSNFONTSIZEXX;x++){
/*
cfb_16[draw_buffer][(SCREEN_WD*(100+(SSNFONTSIZEYY-y)))+x+SSNSCROFSTX]=font5x7[y*(SSNFONTSIZEXX)+x];
*/
cfbPtr[(SCREEN_WD*(100+(SSNFONTSIZEYY-y)))+x+SSNSCROFSTX]=font5x7[y*(SSNFONTSIZEXX)+x];
}
}
}