aboutsummaryrefslogtreecommitdiff
path: root/util.h
blob: ef2f749aa6942d618d9bfc4abc5bfa80b61647b1 (plain)
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
#ifndef UTIL_WORM_HEADERS
#define UTIL_WORM_HEADERS

/* Mostly compatability stuff */

#include <string.h>

#ifdef __GNUC__

#include <gem.h>

#define HIWORD(x)  ((int16_t)((uint32_t)x >> 16))
#define LOWORD(x)  ((int16_t)((uint32_t)x & 0xFFFF)) 

#else

#include <portab.h>
#include <aes.h>
#include <vdi.h>

#endif /* __GNUC__ */

#ifndef WF_WXYWH
#define WF_WXYWH    WF_WORKXYWH
#endif

#ifndef WF_CXYWH
#define WF_CXYWH    WF_CURRXYWH
#endif

#define max(x,y)    x>y ? x : y
#define min(x,y)    x<y ? x : y

#ifndef MGEMLIB
static int rc_intersect(const GRECT *one, GRECT *two)
{
WORD tx,ty,tw,th;

    tw = min(one->g_x+one->g_w,two->g_x+two->g_w);
    th = min(one->g_y+one->g_h,two->g_y+two->g_h);
    tx = max(one->g_x,two->g_x);
    ty = max(one->g_y,two->g_y);
    two->g_x = tx;
    two->g_y = ty;
    two->g_w = tw-tx;
    two->g_h = th-ty;
    return ( (tw > tx) && (th > ty) );
}
#endif

static void set_resource_string(OBJECT *tree, short obj, const char *string)
{
long addr;

    /* What a freakin' nightmare... */
    addr = tree[obj].ob_spec.index;
    strcpy((char *)addr, string);
}

#endif /* UTIL_WORM_HEADERS */