/* For everything */
/******************************************************************************/
#include <stdio.h>
+#include <stdint.h>
#include "defs.h"
#include "hash.h"
#define PATH_SEPARATOR '/'
#endif
-/* typedef unsigned short zbyte; */
-typedef unsigned char zbyte;
-typedef unsigned short zword;
-typedef unsigned long zlong;
+typedef uint8_t zbyte;
+typedef uint16_t zword;
+typedef uint32_t zlong;
#ifndef USE_UTF8
typedef unsigned char zchar;
#include "sf_frotz.h"
#include <string.h>
-static byte Zfont3[] = {
+static zbyte Zfont3[] = {
/* 32*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* 33*/ 0x00,0x00,0x20,0x60,0xfe,0x60,0x20,0x00,
/* 34*/ 0x00,0x00,0x08,0x0c,0xfe,0x0c,0x08,0x00,
/* glyph buffer */
static struct {
- byte dx;
- byte w, h;
+ zbyte dx;
+ zbyte w, h;
char xof, yof;
- byte bitmap[16];
+ zbyte bitmap[16];
} myglyph = {8,8,8,0,-2};
static void nodestroy(SFONT *s){}
static int mydescent(SFONT *s){ return 2;}
static int myminchar(SFONT *s){ return 32;}
static int mymaxchar(SFONT *s){ return 126;}
-static int myhasglyph(SFONT *s, word c, int allowdef)
+static int myhasglyph(SFONT *s, zword c, int allowdef)
{
return (c >= 32 && c <= 126) || allowdef;
}
-static SF_glyph * mygetglyph(SFONT *s, word c, int allowdef)
+static SF_glyph * mygetglyph(SFONT *s, zword c, int allowdef)
{
- byte *src;
+ zbyte *src;
if (c < 32 || c > 126) {
if (!allowdef)
return NULL;
static int myheight2(SFONT *s){ return 16;}
static int myascent2(SFONT *s){ return 14;}
static int mydescent2(SFONT *s){ return 2;}
-static SF_glyph * mygetglyph2(SFONT *s, word c, int allowdef)
+static SF_glyph * mygetglyph2(SFONT *s, zword c, int allowdef)
{
- byte *src, *dst; int i;
+ zbyte *src, *dst; int i;
if (c < 32 || c > 126) {
if (!allowdef)
return NULL;
typedef struct {
int refcount;
- word minchar, maxchar, defchar;
- byte ascent, descent;
+ zword minchar, maxchar, defchar;
+ zbyte ascent, descent;
int glyphs[0]; /* offsets to glyphs from start of rec */
} SF_bdffont;
}
-static void gethex(char *p, byte * dst, int n)
+static void gethex(char *p, zbyte * dst, int n)
{
while (n--) {
*dst++ = 16 * hexd(p[0]) + hexd(p[1]);
static SF_bdffont *sBDXload(FILE * f, int *err, int *size, int MAXCHAR)
{
int totb, i, k = 0, wh[4];
- byte *po, *pbeg;
+ zbyte *po, *pbeg;
char *p, *q;
char *fontname = "", *copyright = "unknown";
int fngot = 0, cpgot = 0;
font->defchar = defchar;
font->ascent = ascent;
font->descent = descent;
- pbeg = (byte *) font;
- po = (byte *) (&(font->glyphs[maxch - minch + 1]));
+ pbeg = (zbyte *) font;
+ po = (zbyte *) (&(font->glyphs[maxch - minch + 1]));
k = strlen(fontname) + 1;
memmove(po, fontname, k);
po += k;
bg->h = h = wh[1];
bg->xof = wh[2];
bg->yof = wh[3];
- po = (byte *) (&(bg->bitmap[0]));
+ po = (zbyte *) (&(bg->bitmap[0]));
for (j = 0; j < h; j++) {
fgets(s, 1024, f);
if (feof(f))
return 0;
}
-static SF_glyph *getglyph(SFONT * fo, word c, int allowdef)
+static SF_glyph *getglyph(SFONT * fo, zword c, int allowdef)
{
int m;
SF_bdffont *b;
else
return NULL;
}
- return (SF_glyph *) (((byte *) b) + m);
+ return (SF_glyph *) (((zbyte *) b) + m);
}
-static int hasglyph(SFONT * fo, word c, int allowdef)
+static int hasglyph(SFONT * fo, zword c, int allowdef)
{
return (getglyph(fo, c, allowdef) != NULL);
}
void sf_initfonts()
{
int i, j, size = 0;
- byte *cfont, *bmp;
+ zbyte *cfont, *bmp;
SF_glyph *g;
SF_bdffont *norm, *emph, *bold, *bemp;
SFONT *Norm, *Emph = NULL, *Bold = NULL, *Bemp = NULL;
os_fatal("malloc() failure in initfonts()");
memmove(emph, norm, size);
/* emphasize (underline)... */
- cfont = (byte *) emph;
+ cfont = (zbyte *) emph;
for (i = norm->minchar; i <= norm->maxchar; i++) {
int m = norm->glyphs[i - norm->minchar];
if (!m)
continue;
g = (SF_glyph *) (cfont + m);
- bmp = (byte *) (&(g->bitmap[0]));
+ bmp = (zbyte *) (&(g->bitmap[0]));
bmp[g->h - 2] = 0xff;
}
/* make a copy for bold */
os_fatal("malloc() failure in initfonts()");
memmove(bold, norm, size);
/* boldify... */
- cfont = (byte *) bold;
+ cfont = (zbyte *) bold;
for (i = norm->minchar; i <= norm->maxchar; i++) {
int h, m = norm->glyphs[i - norm->minchar];
if (!m)
continue;
g = (SF_glyph *) (cfont + m);
h = g->h;
- bmp = (byte *) (&(g->bitmap[0]));
+ bmp = (zbyte *) (&(g->bitmap[0]));
for (j = 0; j < h; j++) {
int c = bmp[j];
bmp[j] = (c) | (c >> 1);
os_fatal("malloc() failure in initfonts()");
memmove(bemp, bold, size);
/* emphasize (underline)... */
- cfont = (byte *) bemp;
+ cfont = (zbyte *) bemp;
for (i = norm->minchar; i <= norm->maxchar; i++) {
int m = norm->glyphs[i - norm->minchar];
if (!m)
continue;
g = (SF_glyph *) (cfont + m);
- bmp = (byte *) (&(g->bitmap[0]));
+ bmp = (zbyte *) (&(g->bitmap[0]));
bmp[g->h - 2] = 0xff;
}
#include "../blorb/blorb.h"
#include <stdint.h>
-typedef uint8_t byte;
-typedef uint16_t word;
-#define ulong uint32_t
typedef struct {
bb_result_t bbres;
- ulong type;
+ zlong type;
FILE *file;
} myresource;
#endif
/* this assumes RGBA with lsb = R */
-static inline ulong RGB5ToTrue(word w)
+static inline zlong RGB5ToTrue(zword w)
{
int _r = w & 0x001F;
int _g = (w & 0x03E0) >> 5;
_r = (_r << 3) | (_r >> 2);
_g = (_g << 3) | (_g >> 2);
_b = (_b << 3) | (_b >> 2);
- return (ulong) (_r | (_g << 8) | (_b << 16));
+ return (zlong) (_r | (_g << 8) | (_b << 16));
}
-static inline word TrueToRGB5(ulong u)
+static inline zword TrueToRGB5(zlong u)
{
- return (word) (((u >> 3) & 0x001f) | ((u >> 6) & 0x03e0) |
+ return (zword) (((u >> 3) & 0x001f) | ((u >> 6) & 0x03e0) |
((u >> 9) & 0x7c00));
}
extern int m_v6scale;
extern double m_gfxScale_w;
extern double m_gfxScale_h;
-extern ulong m_defaultFore;
-extern ulong m_defaultBack;
-extern ulong m_colours[11];
-extern ulong m_nonStdColours[NON_STD_COLS];
+extern zlong m_defaultFore;
+extern zlong m_defaultBack;
+extern zlong m_colours[11];
+extern zlong m_nonStdColours[NON_STD_COLS];
extern int m_nonStdIndex;
extern bool m_exitPause;
extern bool m_lineInput;
typedef struct {
int number; /* 0 means unallocated */
int width, height;
- byte *pixels;
- ulong palette[16];
+ zbyte *pixels;
+ zlong palette[16];
int palette_entries;
int transparentcolor;
bool adaptive;
/* glyph */
typedef struct {
- byte dx;
- byte w, h;
+ zbyte dx;
+ zbyte w, h;
char xof, yof;
- byte bitmap[0];
+ zbyte bitmap[0];
} SF_glyph;
typedef struct sfontstruct SFONT;
int (*descent)(SFONT *);
int (*minchar)(SFONT *);
int (*maxchar)(SFONT *);
- int (*hasglyph)(SFONT *, word, int);
- SF_glyph *(*getglyph)(SFONT *, word, int);
+ int (*hasglyph)(SFONT *, zword, int);
+ SF_glyph *(*getglyph)(SFONT *, zword, int);
int antialiased;
void *data;
};
int style, zfontnum;
int cx, cy; /* cursor position - 0 based */
int oh; /* overhang */
- unsigned long fore, back;
+ zlong fore, back;
bool foreDefault, backDefault, backTransparent;
} SF_textsetting;
void sf_writeglyph(SF_glyph * g);
-void sf_fillrect(unsigned long color, int x, int y, int w, int h);
+void sf_fillrect(zlong color, int x, int y, int w, int h);
int sf_GetProfileInt(const char *sect, const char *id, int def);
double sf_GetProfileDouble(const char *sect, const char *id, double def);
void sf_readsettings();
-ulong sf_GetColour(int colour);
-ulong sf_GetDefaultColour(bool fore);
-int sf_GetColourIndex(ulong colour);
+zlong sf_GetColour(int colour);
+zlong sf_GetDefaultColour(bool fore);
+int sf_GetColourIndex(zlong colour);
void sf_initvideo(int w, int h, int full);
bool sf_IsInfocomV6(void);
-ulong sf_blend(int a, ulong s, ulong d);
+zlong sf_blend(int a, zlong s, zlong d);
void sf_sleep(int millisecs);
-unsigned long sf_ticks(void);
+zlong sf_ticks(void);
void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width,
bool cursor);
int sf_pkread(FILE * f, int foffs, void **out, int *size);
-ulong *sf_savearea(int x, int y, int w, int h);
-void sf_restoreareaandfree(ulong * s);
+zlong *sf_savearea(int x, int y, int w, int h);
+void sf_restoreareaandfree(zlong * s);
#define SF_NOTIMP (-9999)
zword sf_read_key(int timeout, bool cursor, bool allowed, bool text);
int sf_user_fdialog(bool exist, const char *def, const char *filt,
const char *title, char **res);
extern int (*sf_osdialog)(bool ex, const char *def, const char *filt,
- const char *tit, char **res, ulong * sbuf, int sbp,
+ const char *tit, char **res, zlong * sbuf, int sbp,
int ew, int eh, int isfull);
void sf_checksound(void);
char *sf_searchfile(char *, int, char *, char *);
-void sf_chline(int x, int y, ulong c, int n);
-void sf_cvline(int x, int y, ulong c, int n);
+void sf_chline(int x, int y, zlong c, int n);
+void sf_cvline(int x, int y, zlong c, int n);
bool sf_flushdisplay(void);
void sf_getclip(int *x, int *y, int *w, int *h);
-void sf_rect(unsigned long color, int x, int y, int w, int h);
+void sf_rect(zlong color, int x, int y, int w, int h);
void sf_setclip(int x, int y, int w, int h);
-void sf_wpixel(int x, int y, ulong c);
+void sf_wpixel(int x, int y, zlong c);
void sf_InitProfile(const char *fn);
void sf_FinishProfile(void);
static void setglyph(MYFONT * f, FT_Face face, int ch);
-static SF_glyph *getglyph(SFONT * s, word c, int allowdef)
+static SF_glyph *getglyph(SFONT * s, zword c, int allowdef)
{
if (s) {
MYFONT *f = (MYFONT *) s;
}
-static int hasglyph(SFONT * fo, word c, int allowdef)
+static int hasglyph(SFONT * fo, zword c, int allowdef)
{
return (getglyph(fo, c, allowdef) != NULL);
}
#include "../blorb/blorblow.h"
-static byte toLinear[256];
-static byte fromLinear[256];
+static zbyte toLinear[256];
+static zbyte fromLinear[256];
extern bool m_adaptiveMode;
-ulong sf_blend(int a, ulong s, ulong d)
+zlong sf_blend(int a, zlong s, zlong d)
{
- ulong r;
+ zlong r;
r = fromLinear[(toLinear[s & 0xff] * a +
toLinear[d & 0xff] * (256 - a)) >> 8];
s >>= 8;
*/
typedef struct {
- byte *gfxData;
- unsigned long offset;
+ zbyte *gfxData;
+ zlong offset;
} PNGData;
}
-static int loadpng(byte * data, int length, sf_picture * graphic)
+static int loadpng(zbyte * data, int length, sf_picture * graphic)
{
png_bytep *rowPointers = NULL;
png_structp png_ptr = NULL;
graphic->transparentcolor = trans[0];
size = width * height;
- graphic->pixels = (byte *) malloc(size);
+ graphic->pixels = (zbyte *) malloc(size);
rowPointers = malloc(sizeof(png_bytep) * height);
for (int i = 0; i < (int)height; i++)
if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) {
graphic->palette_entries = num_palette;
for (int i = 0; i < num_palette; i++) {
- ulong color =
+ zlong color =
palette[i].red | (palette[i].
green << 8) | (palette[i].
blue <<
png_set_filler(png_ptr,0xff,PNG_FILLER_AFTER);
size = width*height*4;
- graphic->pixels = (byte *) malloc(size);
+ graphic->pixels = (zbyte *) malloc(size);
rowPointers = malloc(sizeof(png_bytep) * height);
for (int i = 0; i < (int)height; i++)
rowPointers[i] = graphic->pixels + (width * i * 4);
}
-static int loadjpeg(byte * data, int length, sf_picture * graphic)
+static int loadjpeg(zbyte * data, int length, sf_picture * graphic)
{
struct jpeg_decompress_struct info;
struct JPEGErrorInfo error;
graphic->width = width;
graphic->height = height;
size = width * height * 4;
- graphic->pixels = (byte *) malloc(size);
+ graphic->pixels = (zbyte *) malloc(size);
/* Force RGB output */
info.out_color_space = JCS_RGB;
jpeg_start_decompress(&info);
while ((int)info.output_scanline < height) {
- byte *pixelRow;
+ zbyte *pixelRow;
int i;
jpeg_read_scanlines(&info, buffer, 1);
****************************************************************************
*/
-static int loadrect(byte * data, int length, sf_picture * graphic)
+static int loadrect(zbyte * data, int length, sf_picture * graphic)
{
graphic->width =
(data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
graphic->adaptive = sf_IsAdaptive(picture) ? TRUE : FALSE;
if (sf_getresource(picture, 1, bb_method_Memory, &res) == bb_err_None) {
- byte *data = (byte *) res.bbres.data.ptr;
+ zbyte *data = (zbyte *) res.bbres.data.ptr;
int length = res.bbres.length;
unsigned int id = res.type;
static zword pushed = 0;
static int wentry;
-static ulong *sbuffer = NULL;
+static zlong *sbuffer = NULL;
static int sbpitch; /* in longs */
static int ewidth, eheight;
static int X, Y, W, H, xdlg, ydlg, wdlg, hdlg;
typedef struct {
int x, y, w, h; /* internal */
zword(*click) (int, int);
- ulong back;
+ zlong back;
int isbutton;
} BAREA;
STATIC void frame_upframe(int x, int y, int w, int h)
{
- ulong v = O_WHITE;
+ zlong v = O_WHITE;
sf_chline(x, y, v, w);
sf_cvline(x, y, v, --h);
v = O_BLACK;
STATIC void frame_downframe(int x, int y, int w, int h)
{
- ulong v = O_BLACK;
+ zlong v = O_BLACK;
sf_chline(x, y, v, w);
sf_cvline(x, y, v, --h);
v = O_WHITE;
#endif /* USE_UTF8 */
-STATIC void writetext(ulong color, const char *s, int x, int y, int w,
+STATIC void writetext(zlong color, const char *s, int x, int y, int w,
int center)
{
int ox, oy, ow, oh;
STATIC int myosdialog(bool existing, const char *def, const char *filt,
- const char *tit, char **res, ulong * sbuf, int sbp,
+ const char *tit, char **res, zlong * sbuf, int sbp,
int ew, int eh, int isfull)
{
char *pp;
- ulong *saved;
+ zlong *saved;
int y0, y1, y2, x1;
zword c = 0;
int wtext, htext, buttw;
/*********************************************
* white, black, gray, yellow
*/
-static ulong bcolors[4] = { 0xfcfcfc, 0, 0xa0a0a0, 0xa0d0e0 };
+static zlong bcolors[4] = { 0xfcfcfc, 0, 0xa0a0a0, 0xa0d0e0 };
static unsigned char folderbmp[] = {
0, 0, 0, 0, 0, 0, 0, 0,
}
-extern void sf_videodata(ulong ** sb, int *sp, int *ew, int *eh);
+extern void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh);
zword sf_yesnooverlay(int xc, int yc, char *t, int saverest)
{
zword c = ZC_RETURN;
int nsav = nbareas;
- ulong *saved = NULL;
+ zlong *saved = NULL;
int hx = BUTTW + 3 * SPC, hy = HTEXT + 2 * SPC, heff;
heff = 8 * strlen(t);
int m_v6scale_y;
double m_gfxScale_w = 1.0;
double m_gfxScale_h = 1.0;
-ulong m_defaultFore;
-ulong m_defaultBack;
-ulong m_colours[11];
-ulong m_nonStdColours[NON_STD_COLS];
+zlong m_defaultFore;
+zlong m_defaultBack;
+zlong m_colours[11];
+zlong m_nonStdColours[NON_STD_COLS];
int m_nonStdIndex;
bool m_exitPause = 0;
bool m_lineInput = 0;
/* Get a colour */
-ulong sf_GetColour(int colour)
+zlong sf_GetColour(int colour)
{
/* Standard colours */
if ((colour >= BLACK_COLOUR) && (colour <= DARKGREY_COLOUR))
/* Get a default colour */
-ulong sf_GetDefaultColour(bool fore)
+zlong sf_GetDefaultColour(bool fore)
{
if (m_IsInfocomV6)
return sf_GetColour(fore ? WHITE_COLOUR : BLACK_COLOUR);
/* Get an index for a non-standard colour */
-int sf_GetColourIndex(ulong colour)
+int sf_GetColourIndex(zlong colour)
{
int i, index = -1;
/* Is this a standard colour? */
{
FILE *f;
int size;
- byte hd[4];
+ zbyte hd[4];
f = findlocal(ispic, num, &size);
if (!f)
int sf_getresource(int num, int ispic, int method, myresource * res)
{
int st;
- ulong usage;
+ zlong usage;
res->bbres.data.ptr = NULL;
res->file = NULL;
typedef struct {
void *next;
int num, ispic;
- ulong type;
+ zlong type;
char *name;
} LLENTRY;
static int numlocal = 0, numlocalpic = 0, numlocalsnd = 0;
static int p_ispic, p_num;
-static ulong p_type;
+static zlong p_type;
static char *p_name;
int volume;
int ended;
zword eos;
- ulong endtime;
+ zlong endtime;
} EFFECT;
/* no effects cache */
static EFFECT *getmodule(FILE * f, size_t pos, int len, int num)
{
EFFECT *res;
- byte h[2];
+ zbyte h[2];
res = new_effect(MOD_TYPE, num);
if (!res)
}
#ifdef WIN32
-unsigned long sf_ticks(void)
+zlong sf_ticks(void)
{
return (GetTickCount());
}
#else
-unsigned long sf_ticks(void)
+zlong sf_ticks(void)
{
struct timeval now;
static struct timeval start;
static int started = 0;
- unsigned long ticks;
+ zlong ticks;
now.tv_sec = now.tv_usec = 0;
gettimeofday(&now, NULL);
if (!started) {
if (!r)
break;
rq = r + nid;
- if ((*(byte *) (r - 1) <= ' ')
+ if ((*(zbyte *) (r - 1) <= ' ')
&& ((*rq == ' ') || (*rq == '='))) {
while (*rq)
if (*rq++ == '=')
p++;
break;
}
- if ((byte) (*p) > ' ')
+ if ((zbyte) (*p) > ' ')
break;
}
if (*p) {
#define pshort( b) (((int)((b)[1]) << 8) + (int)((b)[0]))
-static unsigned myin(void *d, byte ** b)
+static unsigned myin(void *d, zbyte ** b)
{
return 0;
}
-static int myout(void *udata, byte * b, unsigned n)
+static int myout(void *udata, zbyte * b, unsigned n)
{
memmove(udata, b, n);
udata += n;
}
-static int myunzip(int csize, byte * cdata, byte * udata)
+static int myunzip(int csize, zbyte * cdata, zbyte * udata)
{
- byte window[32768];
+ zbyte window[32768];
z_stream z;
int st;
int sf_pkread(FILE * f, int foffs, void **out, int *size)
{
- byte hd[30];
- byte *data, *cdata;
+ zbyte hd[30];
+ zbyte *data, *cdata;
int csize, usize, cmet, skip, st;
fseek(f, foffs, SEEK_SET);
static char banner[256];
static int isfullscreen;
-static ulong *sbuffer = NULL;
+static zlong *sbuffer = NULL;
static int sbpitch; /* in longs */
static int dirty = 0;
static int ewidth, eheight;
static void sf_quitconf();
static bool ApplyPalette(sf_picture *);
-static ulong screen_palette[16];
+static zlong screen_palette[16];
extern z_header_t z_header;
}
-void sf_wpixel(int x, int y, ulong c)
+void sf_wpixel(int x, int y, zlong c)
{
if (x < xmin || x >= xmax || y < ymin || y >= ymax)
return;
}
-ulong sf_rpixel(int x, int y)
+zlong sf_rpixel(int x, int y)
{
if (x < 0 || x >= ewidth || y < 0 || y >= eheight)
return 0;
}
#define MAXCUR 64
-static ulong savedcur[MAXCUR];
+static zlong savedcur[MAXCUR];
static void drawthecursor(int x, int y, int onoff)
{
}
-bool sf_IsValidChar(unsigned short c)
+bool sf_IsValidChar(zword c)
{
if (c >= ZC_ASCII_MIN && c <= ZC_ASCII_MAX)
return true;
}
-void sf_chline(int x, int y, ulong c, int n)
+void sf_chline(int x, int y, zlong c, int n)
{
- ulong *s;
+ zlong *s;
if (y < ymin || y >= ymax)
return;
if (x < xmin) {
}
-void sf_cvline(int x, int y, ulong c, int n)
+void sf_cvline(int x, int y, zlong c, int n)
{
- ulong *s;
+ zlong *s;
if (x < xmin || x >= xmax)
return;
if (y < xmin) {
}
-ulong sf_blendlinear(int a, ulong s, ulong d)
+zlong sf_blendlinear(int a, zlong s, zlong d)
{
- ulong r;
+ zlong r;
r = ((s & 0xff) * a + (d & 0xff) * (256 - a)) >> 8;
s >>= 8;
d >>= 8;
int w = g->dx;
int weff = g->xof + g->w;
- byte *bmp = (byte *) (&(g->bitmap[0]));
+ zbyte *bmp = (zbyte *) (&(g->bitmap[0]));
int h = g->h;
int nby = (g->w + 7) / 8;
int byw = g->w;
int height = ts->font->height(ts->font);
int width;
- ulong color, bc;
+ zlong color, bc;
if ((ts->style & REVERSE_STYLE) != 0) {
bc = ts->fore;
int t = *bmp++;
if (xx < byw) {
if (t) {
- ulong sval = color;
+ zlong sval = color;
if (t < 255)
sval = sf_blend((int) (t + (t >> 7)), sval, sf_rpixel(x + xx, y));
sf_wpixel(x + xx, y, sval);
}
-void sf_fillrect(unsigned long color, int x, int y, int w, int h)
+void sf_fillrect(zlong color, int x, int y, int w, int h)
{
- ulong *dst;
+ zlong *dst;
int i;
if (x < xmin) {
w += x - xmin;
}
-void sf_rect(unsigned long color, int x, int y, int w, int h)
+void sf_rect(zlong color, int x, int y, int w, int h)
{
sf_chline(x, y, color, w);
sf_chline(x, y + h - 1, color, w);
static void scroll(int x, int y, int w, int h, int n)
{
- ulong *src, *dst;
+ zlong *src, *dst;
int nmove, step;
if (n > 0) {
dst = sbuffer + x + sbpitch * y;
return;
if (nmove > 0) {
while (nmove--) {
- memmove(dst, src, w * sizeof(ulong));
+ memmove(dst, src, w * sizeof(zlong));
dst += step;
src += step;
}
{
if (dirty) {
SDL_UpdateTexture(texture, NULL, sbuffer,
- sbpitch * sizeof(ulong));
+ sbpitch * sizeof(zlong));
myGrefresh();
dirty = 0;
return true;
SDL_TEXTUREACCESS_STREAMING, W, H)))
os_fatal("Failed to create texture: %s", SDL_GetError());
- sbuffer = calloc(W * H, sizeof(ulong));
+ sbuffer = calloc(W * H, sizeof(zlong));
if (!sbuffer)
os_fatal("Could not create gc");
int ox, oy, ow, oh;
Zwindow *winpars;
sf_picture *pic = sf_getpic(picture);
- ulong *src, *dst, sval, dval, alpha;
+ zlong *src, *dst, sval, dval, alpha;
sf_flushtext();
return;
if (!pic->pixels)
return;
- src = (ulong *) pic->pixels;
+ src = (zlong *) pic->pixels;
x--;
y--;
for (yy = 0; yy < eh; yy++) {
for (xx = 0; xx < ew; xx++) {
dst =
- sbuffer + x + (uint32_t)(xx * m_gfxScale_w) +
- sbpitch * (y + (uint32_t)(yy * m_gfxScale_h));
+ sbuffer + x + (zlong)(xx * m_gfxScale_w) +
+ sbpitch * (y + (zlong)(yy * m_gfxScale_h));
sval = src[xx];
alpha = (sval >> 24);
if (alpha == 255)
}
-static ulong mytimeout;
+static zlong mytimeout;
int mouse_button;
static int numAltQ = 0;
*/
zword os_read_mouse(void)
{
- byte c;
+ zbyte c;
int x, y;
zword btn = 0;
/* Get the mouse position */
}
-ulong *sf_savearea(int x, int y, int w, int h)
+zlong *sf_savearea(int x, int y, int w, int h)
{
- ulong *r, *p, *s;
+ zlong *r, *p, *s;
int i;
if (x < 0) {
if (h <= 0)
return NULL;
- r = p = malloc((w * h + 4) * sizeof(ulong));
+ r = p = malloc((w * h + 4) * sizeof(zlong));
if (!r)
return NULL;
s = sbuffer + x + y * sbpitch;
for (i = 0; i < h; i++) {
- memmove(p, s, w * sizeof(ulong));
+ memmove(p, s, w * sizeof(zlong));
p += w;
s += sbpitch;
}
}
-void sf_restoreareaandfree(ulong * s)
+void sf_restoreareaandfree(zlong * s)
{
- ulong *p, *d;
+ zlong *p, *d;
int i, x, y, w, h;
if (!s)
return;
d = sbuffer + x + y * sbpitch;
for (i = 0; i < h; i++) {
- memmove(d, p, w * sizeof(ulong));
+ memmove(d, p, w * sizeof(zlong));
p += w;
d += sbpitch;
}
int (*sf_osdialog)(bool ex, const char *def, const char *filt, const char *tit,
- char **res, ulong * sbuf, int sbp, int ew, int eh,
+ char **res, zlong * sbuf, int sbp, int ew, int eh,
int isfull) = NULL;
}
-void sf_videodata(ulong ** sb, int *sp, int *ew, int *eh)
+void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh)
{
*sb = sbuffer;
*sp = sbpitch;
bool changed = FALSE;
int i, colors;
- memset(&screen_palette, 0, sizeof(ulong));
+ memset(&screen_palette, 0, sizeof(zlong));
if (graphic->usespalette) {
colors = graphic->palette_entries;