ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.318 by root, Wed Dec 24 06:12:21 2014 UTC vs.
Revision 1.330 by root, Sun Nov 18 15:24:24 2018 UTC

15 15
16#include "EXTERN.h" 16#include "EXTERN.h"
17#include "perl.h" 17#include "perl.h"
18#include "XSUB.h" 18#include "XSUB.h"
19 19
20#include "flat_hash_map.hpp"
21
20#ifdef _WIN32 22#ifdef _WIN32
21# undef pipe 23# undef pipe
22// microsoft vs. C 24// microsoft vs. C
23# define sqrtf(x) sqrt(x) 25# define sqrtf(x) sqrt(x)
24# define atan2f(x,y) atan2(x,y) 26# define atan2f(x,y) atan2(x,y)
25# define M_PI 3.14159265f 27# define M_PI 3.14159265f
26#endif 28#endif
27 29
28#include <assert.h> 30#include <cassert>
29#include <math.h> 31#include <cmath>
30#include <string.h> 32#include <cstring>
31#include <stdio.h> 33#include <cstdio>
32#include <stdlib.h> 34#include <cstdlib>
35
36#include <utility>
37#include <bitset>
33 38
34#define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW 39#define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW
35 40
36#include <SDL.h> 41#include <SDL.h>
37#include <SDL_thread.h> 42#include <SDL_thread.h>
184{ 189{
185 GSList *attrs = run->item->analysis.extra_attrs; 190 GSList *attrs = run->item->analysis.extra_attrs;
186 191
187 while (attrs) 192 while (attrs)
188 { 193 {
189 PangoAttribute *attr = attrs->data; 194 PangoAttribute *attr = (PangoAttribute *)attrs->data;
190 195
191 if (attr->klass->type == PANGO_ATTR_SHAPE) 196 if (attr->klass->type == PANGO_ATTR_SHAPE)
192 return 1; 197 return 1;
193 198
194 attrs = attrs->next; 199 attrs = attrs->next;
195 } 200 }
196 201
197 return 0; 202 return 0;
198} 203}
199 204
200typedef struct cf_layout { 205struct cf_layout {
201 PangoLayout *pl; 206 PangoLayout *pl;
202 float r, g, b, a; // default color for rgba mode 207 float r, g, b, a; // default color for rgba mode
203 int base_height; 208 int base_height;
204 DC__Font font; 209 DC__Font font;
205 rc_t *rc; 210 rc_t rc;
206} *DC__Layout; 211};
212
213typedef cf_layout *DC__Layout;
207 214
208static DC__Font default_font; 215static DC__Font default_font;
209static PangoContext *opengl_context; 216static PangoContext *opengl_context;
210static PangoFontMap *opengl_fontmap; 217static PangoFontMap *opengl_fontmap;
211 218
212static void 219static void
213substitute_func (FcPattern *pattern, gpointer data) 220substitute_func (FcPattern *pattern, gpointer data)
214{ 221{
215 FcPatternAddBool (pattern, FC_HINTING, 1); 222 FcPatternAddBool (pattern, FC_HINTING, 1);
216#ifdef FC_HINT_STYLE 223#ifdef FC_HINT_STYLE
217 FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL); 224 FcPatternAddInteger (pattern, FC_HINT_STYLE, FC_HINT_FULL);
218#endif 225#endif
219 FcPatternAddBool (pattern, FC_AUTOHINT, 0); 226 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
220} 227}
221 228
222static void 229static void
252} 259}
253 260
254typedef uint16_t tileid; 261typedef uint16_t tileid;
255typedef uint16_t faceid; 262typedef uint16_t faceid;
256 263
257typedef struct { 264struct maptex
265{
258 GLuint name; 266 GLuint name;
259 int w, h; 267 int w, h;
260 float s, t; 268 float s, t;
261 uint8_t r, g, b, a; 269 uint8_t r, g, b, a;
262 tileid smoothtile; 270 tileid smoothtile;
263 uint8_t smoothlevel; 271 uint8_t smoothlevel;
264 uint8_t unused; /* set to zero on use */ 272 uint8_t unused; /* set to zero on use */
265} maptex; 273};
266 274
267typedef struct { 275struct mapcell
276{
268 uint32_t player; 277 uint32_t player;
269 tileid tile[3]; 278 tileid tile[3];
270 uint16_t darkness; 279 uint16_t darkness;
271 uint8_t stat_width, stat_hp, flags, smoothmax; 280 uint8_t stat_width, stat_hp, flags, smoothmax;
272} mapcell; 281};
273 282
274typedef struct { 283struct maprow
284{
275 int32_t c0, c1; 285 int32_t c0, c1;
276 mapcell *col; 286 mapcell *col;
277} maprow; 287};
278 288
279typedef struct map { 289struct mapgrid {
280 int x, y, w, h; 290 int x, y, w, h;
281 int ox, oy; /* offset to virtual global coordinate system */ 291 int ox, oy; /* offset to virtual global coordinate system */
282 int faces; tileid *face2tile; // [faceid] 292 int faces; tileid *face2tile; // [faceid]
283 int texs; maptex *tex; // [tileid] 293 int texs; maptex *tex; // [tileid]
284 294
285 int32_t rows; 295 int32_t rows;
286 maprow *row; 296 maprow *row;
287} *DC__Map; 297};
288 298
289static char * 299typedef mapgrid *DC__Map;
300
301template<typename T>
302static void
290prepend (char *ptr, int sze, int inc) 303prepend (T *&ptr, int sze, int inc)
291{ 304{
292 char *p; 305 T *p;
293 306
294 New (0, p, sze + inc, char); 307 Newxz (p, sze + inc, T);
295 Zero (p, inc, char);
296 Move (ptr, p + inc, sze, char); 308 Move (ptr, p + inc, sze, T);
297 Safefree (ptr); 309 Safefree (ptr);
298 310
299 return p; 311 ptr = p;
300} 312}
301 313
302static char * 314template<typename T>
303append (char *ptr, int sze, int inc)
304{
305 Renew (ptr, sze + inc, char);
306 Zero (ptr + sze, inc, char);
307
308 return ptr;
309}
310
311#define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type))
312#define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type))
313
314static void 315static void
316append (T *&ptr, int sze, int inc)
317{
318 Renew (ptr, sze + inc, T);
319 Zero (ptr + sze, inc, T);
320}
321
322static void
315need_facenum (struct map *self, faceid face) 323need_facenum (struct mapgrid *self, faceid face)
316{ 324{
317 while (self->faces <= face) 325 while (self->faces <= face)
318 { 326 {
319 Append (tileid, self->face2tile, self->faces, self->faces); 327 append (self->face2tile, self->faces, self->faces);
320 self->faces *= 2; 328 self->faces *= 2;
321 } 329 }
322} 330}
323 331
324static void 332static void
325need_texid (struct map *self, int texid) 333need_texid (struct mapgrid *self, int texid)
326{ 334{
327 while (self->texs <= texid) 335 while (self->texs <= texid)
328 { 336 {
329 Append (maptex, self->tex, self->texs, self->texs); 337 append (self->tex, self->texs, self->texs);
330 self->texs *= 2; 338 self->texs *= 2;
331 } 339 }
332} 340}
333 341
334static maprow * 342static maprow *
335map_get_row (DC__Map self, int y) 343map_get_row (mapgrid *self, int y)
336{ 344{
337 if (0 > y) 345 if (0 > y)
338 { 346 {
339 int extend = - y + MAP_EXTEND_Y; 347 int extend = - y + MAP_EXTEND_Y;
340 Prepend (maprow, self->row, self->rows, extend); 348 prepend (self->row, self->rows, extend);
341 349
342 self->rows += extend; 350 self->rows += extend;
343 self->y += extend; 351 self->y += extend;
344 y += extend; 352 y += extend;
345 } 353 }
346 else if (y >= self->rows) 354 else if (y >= self->rows)
347 { 355 {
348 int extend = y - self->rows + MAP_EXTEND_Y; 356 int extend = y - self->rows + MAP_EXTEND_Y;
349 Append (maprow, self->row, self->rows, extend); 357 append (self->row, self->rows, extend);
350 self->rows += extend; 358 self->rows += extend;
351 } 359 }
352 360
353 return self->row + y; 361 return self->row + y;
354} 362}
364 } 372 }
365 373
366 if (row->c0 > x) 374 if (row->c0 > x)
367 { 375 {
368 int extend = row->c0 - x + MAP_EXTEND_X; 376 int extend = row->c0 - x + MAP_EXTEND_X;
369 Prepend (mapcell, row->col, row->c1 - row->c0, extend); 377 prepend (row->col, row->c1 - row->c0, extend);
370 row->c0 -= extend; 378 row->c0 -= extend;
371 } 379 }
372 else if (x >= row->c1) 380 else if (x >= row->c1)
373 { 381 {
374 int extend = x - row->c1 + MAP_EXTEND_X; 382 int extend = x - row->c1 + MAP_EXTEND_X;
375 Append (mapcell, row->col, row->c1 - row->c0, extend); 383 append (row->col, row->c1 - row->c0, extend);
376 row->c1 += extend; 384 row->c1 += extend;
377 } 385 }
378 386
379 return row->col + (x - row->c0); 387 return row->col + (x - row->c0);
380} 388}
381 389
382static mapcell * 390static mapcell *
383map_get_cell (DC__Map self, int x, int y) 391map_get_cell (mapgrid *self, int x, int y)
384{ 392{
385 return row_get_cell (map_get_row (self, y), x); 393 return row_get_cell (map_get_row (self, y), x);
386} 394}
387 395
388static void 396static void
389map_clear (DC__Map self) 397map_clear (mapgrid *self)
390{ 398{
391 int r; 399 int r;
392 400
393 for (r = 0; r < self->rows; r++) 401 for (r = 0; r < self->rows; r++)
394 Safefree (self->row[r].col); 402 Safefree (self->row[r].col);
412 (cell)->flags = 0; \ 420 (cell)->flags = 0; \
413 (cell)->player = 0; \ 421 (cell)->player = 0; \
414 } while (0) 422 } while (0)
415 423
416static void 424static void
417map_blank (DC__Map self, int x0, int y0, int w, int h) 425map_blank (mapgrid *self, int x0, int y0, int w, int h)
418{ 426{
419 int x, y; 427 int x, y;
420 maprow *row; 428 maprow *row;
421 mapcell *cell; 429 mapcell *cell;
422 430
439 CELL_CLEAR (cell); 447 CELL_CLEAR (cell);
440 } 448 }
441 } 449 }
442} 450}
443 451
444typedef struct { 452struct smooth_key
453{
445 tileid tile; 454 tileid tile;
446 uint8_t x, y, level; 455 uint8_t x, y, level;
447} smooth_key; 456
457 bool operator == (const smooth_key &o) const
458 {
459 return tile == o.tile && x == o.x && y == o.y && level == o.level;
460 }
461};
462
463typedef ska::flat_hash_map<smooth_key, IV> smooth_hash;
464
465namespace std {
466 template <>
467 struct hash<smooth_key>
468 {
469 size_t operator () (const smooth_key &v) const
470 {
471 return v.tile + (v.x << 8) + (v.y << 16) + (v.level << 24);
472 }
473 };
474}
448 475
449static void 476static void
450smooth_or_bits (HV *hv, smooth_key *key, IV bits) 477smooth_or_bits (smooth_hash &h, smooth_key &key, IV bits)
451{ 478{
452 SV **sv = hv_fetch (hv, (char *)key, sizeof (*key), 1); 479 auto &&it = h.find (key);
453 480
454 if (SvIOK (*sv)) 481 if (it == h.end ())
455 SvIV_set (*sv, SvIVX (*sv) | bits); 482 h.insert (std::make_pair (key, bits));
456 else 483 else
457 sv_setiv (*sv, bits); 484 it->second |= bits;
458} 485}
459 486
460static void 487static void
461music_finished (void) 488music_finished (void)
462{ 489{
481 ev.data2 = 0; 508 ev.data2 = 0;
482 509
483 SDL_PushEvent ((SDL_Event *)&ev); 510 SDL_PushEvent ((SDL_Event *)&ev);
484} 511}
485 512
513// approximately divide by 255
486static unsigned int 514static unsigned int
487div255 (unsigned int n) 515div255 (unsigned int n)
488{ 516{
489 return (n + (n >> 8)) >> 8; 517 return (n + (n >> 8)) >> 8;
490} 518}
889void SDL_QuitSubSystem (U32 flags) 917void SDL_QuitSubSystem (U32 flags)
890 918
891void SDL_Quit () 919void SDL_Quit ()
892 920
893int SDL_GL_SetAttribute (int attr, int value) 921int SDL_GL_SetAttribute (int attr, int value)
922 C_ARGS: (SDL_GLattr)attr, value
894 923
895int SDL_GL_GetAttribute (int attr) 924int SDL_GL_GetAttribute (int attr)
896 CODE: 925 CODE:
897 if (SDL_GL_GetAttribute (attr, &RETVAL)) 926 if (SDL_GL_GetAttribute ((SDL_GLattr)attr, &RETVAL))
898 XSRETURN_UNDEF; 927 XSRETURN_UNDEF;
899 OUTPUT: 928 OUTPUT:
900 RETVAL 929 RETVAL
901 930
902void 931void
975void 1004void
976SDL_GL_SwapBuffers () 1005SDL_GL_SwapBuffers ()
977 1006
978char * 1007char *
979SDL_GetKeyName (int sym) 1008SDL_GetKeyName (int sym)
1009 C_ARGS: (SDLKey)sym
980 1010
981int 1011int
982SDL_GetAppState () 1012SDL_GetAppState ()
983 1013
984int 1014int
1081 OUTPUT: 1111 OUTPUT:
1082 RETVAL 1112 RETVAL
1083 1113
1084int 1114int
1085Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) 1115Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096)
1086 POSTCALL: 1116 POSTCALL:
1087 Mix_HookMusicFinished (music_finished); 1117 Mix_HookMusicFinished (music_finished);
1088 Mix_ChannelFinished (channel_finished); 1118 Mix_ChannelFinished (channel_finished);
1089 1119
1090void 1120void
1091Mix_QuerySpec () 1121Mix_QuerySpec ()
1212 1242
1213 SDL_LockSurface (surface2); 1243 SDL_LockSurface (surface2);
1214 EXTEND (SP, 6); 1244 EXTEND (SP, 6);
1215 PUSHs (sv_2mortal (newSViv (surface2->w))); 1245 PUSHs (sv_2mortal (newSViv (surface2->w)));
1216 PUSHs (sv_2mortal (newSViv (surface2->h))); 1246 PUSHs (sv_2mortal (newSViv (surface2->h)));
1217 PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); 1247 PUSHs (sv_2mortal (newSVpvn ((const char *)surface2->pixels, surface2->h * surface2->pitch)));
1218 PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); 1248 PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB)));
1219 PUSHs (sv_2mortal (newSViv (GL_RGBA))); 1249 PUSHs (sv_2mortal (newSViv (GL_RGBA)));
1220 PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); 1250 PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE)));
1221 SDL_UnlockSurface (surface2); 1251 SDL_UnlockSurface (surface2);
1222 1252
1294MODULE = Deliantra::Client PACKAGE = DC::Font 1324MODULE = Deliantra::Client PACKAGE = DC::Font
1295 1325
1296PROTOTYPES: DISABLE 1326PROTOTYPES: DISABLE
1297 1327
1298DC::Font 1328DC::Font
1299new_from_file (SV *class, char *path, int id = 0) 1329new_from_file (SV *klass, char *path, int id = 0)
1300 CODE: 1330 CODE:
1301{ 1331{
1302 int count; 1332 int count;
1303 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); 1333 FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count);
1304 RETVAL = pango_fc_font_description_from_pattern (pattern, 0); 1334 RETVAL = pango_fc_font_description_from_pattern (pattern, 0);
1333 PROTOTYPE: 1363 PROTOTYPE:
1334 CODE: 1364 CODE:
1335 tc_restore (); 1365 tc_restore ();
1336 1366
1337DC::Layout 1367DC::Layout
1338new (SV *class) 1368new (SV *klass)
1339 CODE: 1369 CODE:
1340 New (0, RETVAL, 1, struct cf_layout); 1370 RETVAL = new cf_layout;
1341 1371
1342 RETVAL->pl = pango_layout_new (opengl_context); 1372 RETVAL->pl = pango_layout_new (opengl_context);
1343 RETVAL->r = 1.; 1373 RETVAL->r = 1.;
1344 RETVAL->g = 1.; 1374 RETVAL->g = 1.;
1345 RETVAL->b = 1.; 1375 RETVAL->b = 1.;
1346 RETVAL->a = 1.; 1376 RETVAL->a = 1.;
1347 RETVAL->base_height = MIN_FONT_HEIGHT; 1377 RETVAL->base_height = MIN_FONT_HEIGHT;
1348 RETVAL->font = 0; 1378 RETVAL->font = 0;
1349 RETVAL->rc = rc_alloc ();
1350 1379
1351 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR); 1380 pango_layout_set_wrap (RETVAL->pl, PANGO_WRAP_WORD_CHAR);
1352 layout_update_font (RETVAL); 1381 layout_update_font (RETVAL);
1353 OUTPUT: 1382 OUTPUT:
1354 RETVAL 1383 RETVAL
1355 1384
1356void 1385void
1357DESTROY (DC::Layout self) 1386DESTROY (DC::Layout self)
1358 CODE: 1387 CODE:
1359 g_object_unref (self->pl); 1388 g_object_unref (self->pl);
1360 rc_free (self->rc);
1361 Safefree (self); 1389 delete self;
1362 1390
1363void 1391void
1364set_text (DC::Layout self, SV *text_) 1392set_text (DC::Layout self, SV *text_)
1365 CODE: 1393 CODE:
1366{ 1394{
1620} 1648}
1621 1649
1622void 1650void
1623render (DC::Layout self, float x, float y, int flags = 0) 1651render (DC::Layout self, float x, float y, int flags = 0)
1624 CODE: 1652 CODE:
1625 rc_clear (self->rc); 1653 self->rc.clear ();
1626 pango_opengl_render_layout_subpixel ( 1654 pango_opengl_render_layout_subpixel (
1627 self->pl, 1655 self->pl,
1628 self->rc, 1656 &self->rc,
1629 x * PANGO_SCALE, y * PANGO_SCALE, 1657 x * PANGO_SCALE, y * PANGO_SCALE,
1630 self->r, self->g, self->b, self->a, 1658 self->r, self->g, self->b, self->a,
1631 flags 1659 flags
1632 ); 1660 );
1633 // we assume that context_change actually clears/frees stuff 1661 // we assume that context_change actually clears/frees stuff
1644 gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1672 gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
1645 GL_ONE , GL_ONE_MINUS_SRC_ALPHA); 1673 GL_ONE , GL_ONE_MINUS_SRC_ALPHA);
1646 glEnable (GL_ALPHA_TEST); 1674 glEnable (GL_ALPHA_TEST);
1647 glAlphaFunc (GL_GREATER, 7.f / 255.f); 1675 glAlphaFunc (GL_GREATER, 7.f / 255.f);
1648 1676
1649 rc_draw (self->rc); 1677 self->rc.draw ();
1650 1678
1651 glDisable (GL_ALPHA_TEST); 1679 glDisable (GL_ALPHA_TEST);
1652 glDisable (GL_BLEND); 1680 glDisable (GL_BLEND);
1653 glDisable (GL_TEXTURE_2D); 1681 glDisable (GL_TEXTURE_2D);
1654} 1682}
1866MODULE = Deliantra::Client PACKAGE = DC::Map 1894MODULE = Deliantra::Client PACKAGE = DC::Map
1867 1895
1868PROTOTYPES: DISABLE 1896PROTOTYPES: DISABLE
1869 1897
1870DC::Map 1898DC::Map
1871new (SV *class) 1899new (SV *klass)
1872 CODE: 1900 CODE:
1873 New (0, RETVAL, 1, struct map); 1901 New (0, RETVAL, 1, mapgrid);
1874 RETVAL->x = 0; 1902 RETVAL->x = 0;
1875 RETVAL->y = 0; 1903 RETVAL->y = 0;
1876 RETVAL->w = 0; 1904 RETVAL->w = 0;
1877 RETVAL->h = 0; 1905 RETVAL->h = 0;
1878 RETVAL->ox = 0; 1906 RETVAL->ox = 0;
1915 1943
1916void 1944void
1917set_smooth (DC::Map self, int face, int smooth, int level) 1945set_smooth (DC::Map self, int face, int smooth, int level)
1918 CODE: 1946 CODE:
1919{ 1947{
1920 tileid texid; 1948 tileid texid;
1921 maptex *tex; 1949 maptex *tex;
1922 1950
1923 if (face < 0 || face >= self->faces) 1951 if (face < 0 || face >= self->faces)
1924 return; 1952 return;
1925 1953
1926 if (smooth < 0 || smooth >= self->faces) 1954 if (smooth < 0 || smooth >= self->faces)
1927 return; 1955 return;
1928 1956
1929 texid = self->face2tile [face]; 1957 texid = self->face2tile [face];
1930 1958
1931 if (!texid) 1959 if (!texid)
1932 return; 1960 return;
1933 1961
1934 tex = self->tex + texid; 1962 tex = self->tex + texid;
1967} 1995}
1968 1996
1969void 1997void
1970expire_textures (DC::Map self, int texid, int count) 1998expire_textures (DC::Map self, int texid, int count)
1971 PPCODE: 1999 PPCODE:
1972 for (; texid < self->texs && count; ++texid, --count) 2000 for (; texid < self->texs && count; ++texid, --count)
1973 { 2001 {
1974 maptex *tex = self->tex + texid; 2002 maptex *tex = self->tex + texid;
1975 2003
1976 if (tex->name) 2004 if (tex->name)
1977 { 2005 {
2024 self->ox += dx; self->x += dx; 2052 self->ox += dx; self->x += dx;
2025 self->oy += dy; self->y += dy; 2053 self->oy += dy; self->y += dy;
2026 2054
2027 while (self->y < 0) 2055 while (self->y < 0)
2028 { 2056 {
2029 Prepend (maprow, self->row, self->rows, MAP_EXTEND_Y); 2057 prepend (self->row, self->rows, MAP_EXTEND_Y);
2030 2058
2031 self->rows += MAP_EXTEND_Y; 2059 self->rows += MAP_EXTEND_Y;
2032 self->y += MAP_EXTEND_Y; 2060 self->y += MAP_EXTEND_Y;
2033 } 2061 }
2034} 2062}
2179 | (b << 16) 2207 | (b << 16)
2180 | (a << 24); 2208 | (a << 24);
2181 } 2209 }
2182 } 2210 }
2183 2211
2184 RETVAL = map_sv; 2212 RETVAL = map_sv;
2185} 2213}
2186 OUTPUT: 2214 OUTPUT:
2187 RETVAL 2215 RETVAL
2188 2216
2189void 2217void
2190draw (DC::Map self, int mx, int my, int sw, int sh, int Tw, int Th, U32 player = 0xffffffff, int sdx = 0, int sdy = 0) 2218draw (DC::Map self, int mx, int my, int sw, int sh, int Tw, int Th, U32 player = 0xffffffff, int sdx = 0, int sdy = 0)
2191 CODE: 2219 CODE:
2192{ 2220{
2193 int x, y, z; 2221 int x, y, z;
2194 2222
2195 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
2196 uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level
2197 static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) 2223 static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k), also, static!
2198 smooth_key skey;
2199 int pl_x, pl_y; 2224 int pl_x, pl_y;
2200 maptex pl_tex; 2225 maptex pl_tex;
2201 rc_t *rc = rc_alloc (); 2226 rc_t rc;
2202 rc_t *rc_ov = rc_alloc (); 2227 rc_t rc_ov;
2203 rc_key_t key; 2228 rc_key_t key;
2204 rc_array_t *arr; 2229 rc_t::array_t *arr;
2205 2230
2206 pl_tex.name = 0; 2231 pl_tex.name = 0;
2207 2232
2208 // that's current max. sorry. 2233 // that's current max. sorry.
2209 if (sw > 255) sw = 255; 2234 if (sw > 255) sw = 255;
2210 if (sh > 255) sh = 255; 2235 if (sh > 255) sh = 255;
2211
2212 // clear key, in case of extra padding
2213 memset (&skey, 0, sizeof (skey));
2214 2236
2215 memset (&key, 0, sizeof (key)); 2237 memset (&key, 0, sizeof (key));
2216 key.r = 255; 2238 key.r = 255;
2217 key.g = 255; 2239 key.g = 255;
2218 key.b = 255; 2240 key.b = 255;
2224 my += self->y; 2246 my += self->y;
2225 2247
2226 // first pass: determine smooth_max 2248 // first pass: determine smooth_max
2227 // rather ugly, if you ask me 2249 // rather ugly, if you ask me
2228 // could also be stored inside mapcell and updated on change 2250 // could also be stored inside mapcell and updated on change
2229 memset (smooth_max, 0, sizeof (smooth_max)); 2251 memset (smooth_max, 0, sizeof (smooth_max[0]) * (sh + 1));
2230 2252
2231 for (y = 0; y < sh; y++) 2253 for (y = 0; y < sh; y++)
2232 if (0 <= y + my && y + my < self->rows) 2254 if (0 <= y + my && y + my < self->rows)
2233 { 2255 {
2234 maprow *row = self->row + (y + my); 2256 maprow *row = self->row + (y + my);
2249 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 2271 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2250 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 2272 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
2251 2273
2252 for (z = 0; z <= 2; z++) 2274 for (z = 0; z <= 2; z++)
2253 { 2275 {
2254 memset (smooth_level, 0, sizeof (smooth_level)); 2276 std::bitset<256> smooth_level; // one bit for every possible smooth level
2277 smooth_key skey;
2278 smooth_hash smooth;
2255 key.texname = -1; 2279 key.texname = -1;
2256 2280
2257 for (y = 0; y < sh; y++) 2281 for (y = 0; y < sh; y++)
2258 if (0 <= y + my && y + my < self->rows) 2282 if (0 <= y + my && y + my < self->rows)
2259 { 2283 {
2276 2300
2277 if (!tex.name) 2301 if (!tex.name)
2278 tex = self->tex [TEXID_NOFACE]; /* missing, replace by noface */ 2302 tex = self->tex [TEXID_NOFACE]; /* missing, replace by noface */
2279 2303
2280 key.texname = tex.name; 2304 key.texname = tex.name;
2281 arr = rc_array (rc, &key); 2305 arr = &rc.array (key);
2282 } 2306 }
2283 2307
2284 px = (x + 1) * Th - tex.w; 2308 px = (x + 1) * Th - tex.w;
2285 py = (y + 1) * Tw - tex.h; 2309 py = (y + 1) * Tw - tex.h;
2286 2310
2290 pl_y = py; 2314 pl_y = py;
2291 pl_tex = tex; 2315 pl_tex = tex;
2292 continue; 2316 continue;
2293 } 2317 }
2294 2318
2295 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2319 arr->t2f_v3f (0 , 0 , px , py , 0);
2296 rc_t2f_v3f (arr, 0 , tex.t, px , py + tex.h, 0); 2320 arr->t2f_v3f (0 , tex.t, px , py + tex.h, 0);
2297 rc_t2f_v3f (arr, tex.s, tex.t, px + tex.w, py + tex.h, 0); 2321 arr->t2f_v3f (tex.s, tex.t, px + tex.w, py + tex.h, 0);
2298 rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); 2322 arr->t2f_v3f (tex.s, 0 , px + tex.w, py , 0);
2299 2323
2300 // update smooth hash 2324 // update smooth hash
2301 if (tex.smoothtile) 2325 if (tex.smoothtile)
2302 { 2326 {
2303 skey.tile = tex.smoothtile; 2327 skey.tile = tex.smoothtile;
2304 skey.level = tex.smoothlevel; 2328 skey.level = tex.smoothlevel;
2305 2329
2306 smooth_level [tex.smoothlevel >> 5] |= ((uint32_t)1) << (tex.smoothlevel & 31); 2330 smooth_level[tex.smoothlevel] = 1;
2307 2331
2308 // add bits to current tile and all neighbours. skey.x|y is 2332 // add bits to current tile and all neighbours. skey.x|y is
2309 // shifted +1|+1 so we always stay positive. 2333 // shifted +1|+1 so we always stay positive.
2310 2334
2311 // bits is ___n cccc CCCC bbbb 2335 // bits is ___n cccc CCCC bbbb
2319 2343
2320 // corners: 1 ┛· 2 ·┗ 4 ·· 8 ·· 2344 // corners: 1 ┛· 2 ·┗ 4 ·· 8 ··
2321 // ·· ·· ·┏ ┓· 2345 // ·· ·· ·┏ ┓·
2322 2346
2323 // full tile 2347 // full tile
2324 skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x1000); 2348 skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x1000);
2325 2349
2326 // borders 2350 // borders
2327 skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0091); 2351 skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x0091);
2328 skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0032); 2352 skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0032);
2329 skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0064); 2353 skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x0064);
2330 skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, &skey, 0x00c8); 2354 skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, skey, 0x00c8);
2331 2355
2332 // corners 2356 // corners
2333 skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100); 2357 skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0100);
2334 skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0200); 2358 skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0200);
2335 skey.x = x ; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0400); 2359 skey.x = x ; skey.y = y ; smooth_or_bits (smooth, skey, 0x0400);
2336 skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0800); 2360 skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, skey, 0x0800);
2337 } 2361 }
2338 } 2362 }
2339 2363
2340 if (expect_false (z == 2) && expect_false (cell->flags)) 2364 if (expect_false (z == 2) && expect_false (cell->flags))
2341 { 2365 {
2342 // overlays such as the speech bubble, probably more to come 2366 // overlays such as the speech bubble, probably more to come
2343 if (cell->flags & 1) 2367 if (cell->flags & 1)
2344 { 2368 {
2345 rc_key_t key_ov = key; 2369 rc_key_t key_ov = key;
2346 maptex tex = self->tex [TEXID_SPEECH]; 2370 maptex tex = self->tex[TEXID_SPEECH];
2347 rc_array_t *arr;
2348 int px = x * Tw + Tw * 2 / 32; 2371 int px = x * Tw + Tw * 2 / 32;
2349 int py = y * Th - Th * 6 / 32; 2372 int py = y * Th - Th * 6 / 32;
2350 2373
2351 key_ov.texname = tex.name; 2374 key_ov.texname = tex.name;
2352 arr = rc_array (rc_ov, &key_ov); 2375 rc_t::array_t &arr = rc_ov.array (key_ov);
2353 2376
2354 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2377 arr.t2f_v3f (0 , 0 , px , py , 0);
2355 rc_t2f_v3f (arr, 0 , tex.t, px , py + Th, 0); 2378 arr.t2f_v3f (0 , tex.t, px , py + Th, 0);
2356 rc_t2f_v3f (arr, tex.s, tex.t, px + Tw, py + Th, 0); 2379 arr.t2f_v3f (tex.s, tex.t, px + Tw, py + Th, 0);
2357 rc_t2f_v3f (arr, tex.s, 0 , px + Tw, py , 0); 2380 arr.t2f_v3f (tex.s, 0 , px + Tw, py , 0);
2358 } 2381 }
2359 } 2382 }
2360 } 2383 }
2361 } 2384 }
2362 2385
2363 rc_draw (rc); 2386 rc.draw ();
2364 rc_clear (rc); 2387 rc.clear ();
2365 2388
2366 // go through all smoothlevels, lowest to highest, then draw. 2389 // go through all smoothlevels, lowest to highest, then draw.
2367 // this is basically counting sort 2390 // this is basically counting sort
2368 { 2391 {
2369 int w, b; 2392 int w, b;
2370 2393
2371 glEnable (GL_TEXTURE_2D); 2394 glEnable (GL_TEXTURE_2D);
2372 glBegin (GL_QUADS); 2395 glBegin (GL_QUADS);
2373 for (w = 0; w < 256 / 32; ++w) 2396 for (int level = 0; level < smooth_level.size (); ++level)
2397 if (smooth_level[level])
2398 for (auto &&it = smooth.begin (); it != smooth.end (); ++it)
2374 { 2399 {
2375 uint32_t smask = smooth_level [w]; 2400 smooth_key &skey = it->first;
2376 if (smask) 2401 IV bits = it->second;
2377 for (b = 0; b < 32; ++b) 2402
2378 if (smask & (((uint32_t)1) << b)) 2403 if (!(bits & 0x1000)
2404 && skey.level == level
2405 && level > smooth_max [skey.x][skey.y])
2379 { 2406 {
2380 int level = (w << 5) | b; 2407 maptex tex = self->tex [skey.tile];
2408 int px = (((int)skey.x) - 1) * Tw;
2409 int py = (((int)skey.y) - 1) * Th;
2410 int border = bits & 15;
2411 int corner = (bits >> 8) & ~(bits >> 4) & 15;
2412 float dx = tex.s * .0625f; // 16 images/row
2413 float dy = tex.t * .5f ; // 2 images/column
2414
2381 HE *he; 2415 if (tex.name)
2382
2383 hv_iterinit (smooth);
2384 while ((he = hv_iternext (smooth)))
2385 { 2416 {
2386 smooth_key *skey = (smooth_key *)HeKEY (he); 2417 // this time avoiding texture state changes
2387 IV bits = SvIVX (HeVAL (he)); 2418 // save gobs of state changes.
2388 2419 if (key.texname != tex.name)
2389 if (!(bits & 0x1000)
2390 && skey->level == level
2391 && level > smooth_max [skey->x][skey->y])
2392 { 2420 {
2393 maptex tex = self->tex [skey->tile];
2394 int px = (((int)skey->x) - 1) * Tw;
2395 int py = (((int)skey->y) - 1) * Th;
2396 int border = bits & 15;
2397 int corner = (bits >> 8) & ~(bits >> 4) & 15;
2398 float dx = tex.s * .0625f; // 16 images/row
2399 float dy = tex.t * .5f ; // 2 images/column
2400
2401 if (tex.name)
2402 {
2403 // this time avoiding texture state changes
2404 // save gobs of state changes.
2405 if (key.texname != tex.name)
2406 {
2407 self->tex [skey->tile].unused = 0; 2421 self->tex [skey.tile].unused = 0;
2408 2422
2409 glEnd (); 2423 glEnd ();
2410 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); 2424 glBindTexture (GL_TEXTURE_2D, key.texname = tex.name);
2411 glBegin (GL_QUADS); 2425 glBegin (GL_QUADS);
2412 } 2426 }
2413 2427
2414 if (border) 2428 if (border)
2415 { 2429 {
2416 float ox = border * dx; 2430 float ox = border * dx;
2417 2431
2418 glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); 2432 glTexCoord2f (ox , 0.f ); glVertex2i (px , py );
2419 glTexCoord2f (ox , dy ); glVertex2i (px , py + Th); 2433 glTexCoord2f (ox , dy ); glVertex2i (px , py + Th);
2420 glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th); 2434 glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th);
2421 glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py ); 2435 glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py );
2422 } 2436 }
2423 2437
2424 if (corner) 2438 if (corner)
2425 { 2439 {
2426 float ox = corner * dx; 2440 float ox = corner * dx;
2427 2441
2428 glTexCoord2f (ox , dy ); glVertex2i (px , py ); 2442 glTexCoord2f (ox , dy ); glVertex2i (px , py );
2429 glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th); 2443 glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th);
2430 glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th); 2444 glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th);
2431 glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py ); 2445 glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py );
2432 }
2433 }
2434 } 2446 }
2435 } 2447 }
2436 } 2448 }
2437 } 2449 }
2438 2450
2439 glEnd (); 2451 glEnd ();
2440 glDisable (GL_TEXTURE_2D); 2452 glDisable (GL_TEXTURE_2D);
2441 key.texname = -1; 2453 key.texname = -1;
2442 } 2454 }
2443
2444 hv_clear (smooth);
2445 } 2455 }
2446 2456
2447 if (pl_tex.name) 2457 if (pl_tex.name)
2448 { 2458 {
2449 maptex tex = pl_tex; 2459 maptex tex = pl_tex;
2450 int px = pl_x + sdx; 2460 int px = pl_x + sdx;
2451 int py = pl_y + sdy; 2461 int py = pl_y + sdy;
2452 2462
2453 key.texname = tex.name; 2463 key.texname = tex.name;
2454 arr = rc_array (rc, &key); 2464 rc_t::array_t &arr = rc.array (key);
2455 2465
2456 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2466 arr.t2f_v3f (0 , 0 , px , py , 0);
2457 rc_t2f_v3f (arr, 0 , tex.t, px , py + tex.h, 0); 2467 arr.t2f_v3f (0 , tex.t, px , py + tex.h, 0);
2458 rc_t2f_v3f (arr, tex.s, tex.t, px + tex.w, py + tex.h, 0); 2468 arr.t2f_v3f (tex.s, tex.t, px + tex.w, py + tex.h, 0);
2459 rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); 2469 arr.t2f_v3f (tex.s, 0 , px + tex.w, py , 0);
2460 2470
2461 rc_draw (rc); 2471 rc.draw ();
2462 } 2472 }
2463 2473
2464 rc_draw (rc_ov); 2474 rc_ov.draw ();
2465 rc_clear (rc_ov); 2475 rc_ov.clear ();
2466 2476
2467 glDisable (GL_BLEND); 2477 glDisable (GL_BLEND);
2468 rc_free (rc);
2469 rc_free (rc_ov);
2470 2478
2471 // top layer: overlays such as the health bar 2479 // top layer: overlays such as the health bar
2472 for (y = 0; y < sh; y++) 2480 for (y = 0; y < sh; y++)
2473 if (0 <= y + my && y + my < self->rows) 2481 if (0 <= y + my && y + my < self->rows)
2474 { 2482 {
2718 else 2726 else
2719 *data++ = 0; 2727 *data++ = 0;
2720 } 2728 }
2721 } 2729 }
2722 2730
2723 /* if size is w*h + 5 then no data has been found */ 2731 /* if size is w*h + 5 then no data has been found */
2724 if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5) 2732 if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5)
2725 { 2733 {
2726 SvPOK_only (data_sv); 2734 SvPOK_only (data_sv);
2727 SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); 2735 SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv));
2728 } 2736 }
2729 2737
2730 RETVAL = data_sv; 2738 RETVAL = data_sv;
2731} 2739}
2732 OUTPUT: 2740 OUTPUT:
2733 RETVAL 2741 RETVAL
2734 2742
2735void 2743void
2742 STRLEN len; 2750 STRLEN len;
2743 uint8_t *data, *end; 2751 uint8_t *data, *end;
2744 2752
2745 len = SvLEN (data_sv); 2753 len = SvLEN (data_sv);
2746 SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more 2754 SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more
2747 data = SvPVbyte_nolen (data_sv); 2755 data = (uint8_t *)SvPVbyte_nolen (data_sv);
2748 end = data + len + 8; 2756 end = data + len + 8;
2749 2757
2750 if (len < 5) 2758 if (len < 5)
2751 XSRETURN_EMPTY; 2759 XSRETURN_EMPTY;
2752 2760
2813} 2821}
2814 2822
2815MODULE = Deliantra::Client PACKAGE = DC::RW 2823MODULE = Deliantra::Client PACKAGE = DC::RW
2816 2824
2817DC::RW 2825DC::RW
2818new (SV *class, SV *data_sv) 2826new (SV *klass, SV *data_sv)
2819 CODE: 2827 CODE:
2820{ 2828{
2821 STRLEN datalen; 2829 STRLEN datalen;
2822 char *data = SvPVbyte (data_sv, datalen); 2830 char *data = SvPVbyte (data_sv, datalen);
2823 2831
2825} 2833}
2826 OUTPUT: 2834 OUTPUT:
2827 RETVAL 2835 RETVAL
2828 2836
2829DC::RW 2837DC::RW
2830new_from_file (SV *class, const char *path, const char *mode = "rb") 2838new_from_file (SV *klass, const char *path, const char *mode = "rb")
2831 CODE: 2839 CODE:
2832 RETVAL = SDL_RWFromFile (path, mode); 2840 RETVAL = SDL_RWFromFile (path, mode);
2833 OUTPUT: 2841 OUTPUT:
2834 RETVAL 2842 RETVAL
2835 2843
2944#else 2952#else
2945 XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); 2953 XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0)));
2946#endif 2954#endif
2947 2955
2948DC::MixChunk 2956DC::MixChunk
2949new (SV *class, DC::RW rwops) 2957new (SV *klass, DC::RW rwops)
2950 CODE: 2958 CODE:
2951 RETVAL = Mix_LoadWAV_RW (rwops, 1); 2959 RETVAL = Mix_LoadWAV_RW (rwops, 1);
2952 OUTPUT: 2960 OUTPUT:
2953 RETVAL 2961 RETVAL
2954 2962
3024 RETVAL = Mix_PlayingMusic (); 3032 RETVAL = Mix_PlayingMusic ();
3025 OUTPUT: 3033 OUTPUT:
3026 RETVAL 3034 RETVAL
3027 3035
3028DC::MixMusic 3036DC::MixMusic
3029new (SV *class, DC::RW rwops) 3037new (SV *klass, DC::RW rwops)
3030 CODE: 3038 CODE:
3031 RETVAL = Mix_LoadMUS_RW (rwops); 3039 RETVAL = Mix_LoadMUS_RW (rwops);
3032 OUTPUT: 3040 OUTPUT:
3033 RETVAL 3041 RETVAL
3034 3042
3187 gl.BlendFuncSeparateEXT = 0; 3195 gl.BlendFuncSeparateEXT = 0;
3188 3196
3189void 3197void
3190apple_nvidia_bug (int enable) 3198apple_nvidia_bug (int enable)
3191 3199
3192char * 3200const char *
3193gl_vendor () 3201gl_vendor ()
3194 CODE: 3202 CODE:
3195 RETVAL = (char *)glGetString (GL_VENDOR); 3203 RETVAL = (const char *)glGetString (GL_VENDOR);
3196 OUTPUT: 3204 OUTPUT:
3197 RETVAL 3205 RETVAL
3198 3206
3199char * 3207const char *
3200gl_version () 3208gl_version ()
3201 CODE: 3209 CODE:
3202 RETVAL = (char *)glGetString (GL_VERSION); 3210 RETVAL = (const char *)glGetString (GL_VERSION);
3203 OUTPUT: 3211 OUTPUT:
3204 RETVAL 3212 RETVAL
3205 3213
3206char * 3214const char *
3207gl_extensions () 3215gl_extensions ()
3208 CODE: 3216 CODE:
3209 RETVAL = (char *)glGetString (GL_EXTENSIONS); 3217 RETVAL = (const char *)glGetString (GL_EXTENSIONS);
3210 OUTPUT: 3218 OUTPUT:
3211 RETVAL 3219 RETVAL
3212 3220
3213const char *glGetString (GLenum pname) 3221const char *glGetString (GLenum pname)
3222 CODE:
3223 RETVAL = (const char *)glGetString (pname);
3224 OUTPUT:
3225 RETVAL
3214 3226
3215GLint glGetInteger (GLenum pname) 3227GLint glGetInteger (GLenum pname)
3216 CODE: 3228 CODE:
3217 glGetIntegerv (pname, &RETVAL); 3229 glGetIntegerv (pname, &RETVAL);
3218 OUTPUT: 3230 OUTPUT:
3421 3433
3422void 3434void
3423find_widget (SV *self, NV x, NV y) 3435find_widget (SV *self, NV x, NV y)
3424 PPCODE: 3436 PPCODE:
3425{ 3437{
3426 if (within_widget (self, x, y)) 3438 if (within_widget (self, x, y))
3427 XPUSHs (self); 3439 XPUSHs (self);
3428} 3440}
3429 3441
3430BOOT: 3442BOOT:
3431{ 3443{
3439 3451
3440void 3452void
3441draw (SV *self) 3453draw (SV *self)
3442 CODE: 3454 CODE:
3443{ 3455{
3444 HV *hv; 3456 HV *hv;
3445 SV **svp; 3457 SV **svp;
3446 NV x, y, w, h; 3458 NV x, y, w, h;
3447 SV *draw_x_sv = GvSV (draw_x_gv); 3459 SV *draw_x_sv = GvSV (draw_x_gv);
3448 SV *draw_y_sv = GvSV (draw_y_gv); 3460 SV *draw_y_sv = GvSV (draw_y_gv);
3449 SV *draw_w_sv = GvSV (draw_w_gv); 3461 SV *draw_w_sv = GvSV (draw_w_gv);
3450 SV *draw_h_sv = GvSV (draw_h_gv); 3462 SV *draw_h_sv = GvSV (draw_h_gv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines