Free Hero Mesh

Check-in [07386d0511]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Add a few functions into picture.c for dealing with multibyte encodings and font sizes other than 8x8; however, this feature is not implemented yet, and only one of these functions is implemented so far.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07386d0511b8f0ff735241b77f3c783e63b74e4f
User & Date: user on 2022-07-29 00:09:51
Other Links: manifest | tags
Context
2022-08-02
17:46
Implement /mod and ,/mod commands check-in: defb041af6 user: user tags: trunk
2022-07-29
00:09
Add a few functions into picture.c for dealing with multibyte encodings and font sizes other than 8x8; however, this feature is not implemented yet, and only one of these functions is implemented so far. check-in: 07386d0511 user: user tags: trunk
2022-07-28
03:23
Fix the version_change logic in edit.c to work with the new user state format. (It no longer works with the old format, although it will automatically be upgraded in game.c anyways, so it is unlikely to need to work with the old format.) check-in: 846874b02f user: user tags: trunk
Changes

Modified picture.c from [e6928b82be] to [292dc50f72].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39







+







Uint16 picture_size;
int left_margin;
Uint32 codepage;

static SDL_Surface*picts;
static Uint8*curpic;
static const unsigned char*fontdata;
static const Uint8 bytewidth[32];

static const char default_palette[]=
  "C020FF "
  "000000 222222 333333 444444 555555 666666 777777 888888 999999 AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE FFFFFF "
  "281400 412300 5F3200 842100 A05000 C35F14 E1731E FF8232 FF9141 FFA050 FFAF5F FFBE73 FFD282 FFE191 FFF0A0 "
  "321E1E 412220 5F2830 823040 A03A4C BE4658 E15464 FF6670 FF7F7B FF8E7F FF9F7F FFAF7F FFBF7F FFCF7F FFDF7F "
  "280D0D 401515 602020 802A2A A03535 C04040 E04A4A FF5555 FF6764 FF6F64 FF7584 FF849D FF94B7 FF9FD1 FFAEEA "
151
152
153
154
155
156
157


















158
159
160
161
162
163
164
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      ++f;
    }
    t++;
    if(!--len) return;
    pix+=8;
  }
}

void draw_text_v(int x,int y,const unsigned char*t,int bg,int fg) {
  // Draw text using sizes other than 8x8 and possible multibyte encodings.
  // To be called only when screen is locked!
  //TODO
}

int measure_text_v(const unsigned char*t,int len) {
  // Returns number of character cells of text (t).
  // If len is positive then it is the maximum number of bytes to measure.
  int r=0;
  int c;
  while((len<0 || len--) && (c=*t++)) {
    r++;
    if(c&0x80) r-=(bytewidth[(c&0x7C)>>2]>>((c&3)<<1))&3;
  }
  return r>0?r:0;
}

int draw_text_line(int x,int y,unsigned char*t,int cur,Uint8**cp) {
  // To be called only when screen is locked!
  int len=strlen(t);
  const unsigned char*s=t;
  Uint8*pix=screen->pixels;
  Uint8*p;
199
200
201
202
203
204
205








206
207
208
209
210
211
212
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239







+
+
+
+
+
+
+
+







    }
    if(*t=='\\') isimg=0;
    if(!--len || e) return t-s;
    t++;
    pix+=8;
  }
}

int draw_text_line_v(int x,int y,unsigned char*t,int cur,Uint8**cp) {
  //TODO
}

int measure_text_line_v(unsigned char*t,int len,Uint8**cp) {
  //TODO
}

void draw_key(int x,int y,int k,int bg,int fg) {
  // To be called only when screen is locked!
  Uint8*p=screen->pixels;
  Uint16 pitch=screen->pitch;
  int xx,yy;
  const unsigned char*f;