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
|
#include "game.h"
#include "mouse.h"
#include <stdlib.h>
#include <dos.h>
byte * Glass (DAC far * pal, byte r, byte g, byte b)
{
byte * x = new byte[256];
if (x)
{
word i;
for (i = 0; i < 256; i ++)
{
x[i] = Closest(pal, MkDAC(((word)(pal[i].R) * r) / 255,
((word)(pal[i].G) * g) / 255,
((word)(pal[i].B) * b) / 255));
}
}
return x;
}
byte * Mark (DAC far * pal)
{
#define f(c) (c ^ 63)
byte * x = new byte[256];
if (x)
{
word i;
for (i = 0; i < 256; i ++)
{
x[i] = Closest(pal, MkDAC(f(pal[i].R),
f(pal[i].G),
f(pal[i].B)) );
}
}
return x;
#undef f
}
//--------------------------------------------------------------------------
int FLY::L = 20,
FLY::T = 40,
FLY::R = 110,
FLY::B = 100;
FLY::FLY (BITMAP ** shpl)
: SPRITE(shpl), Tx(0), Ty(0)
{
Step(random(2));
Goto(L+random(R-L-W), T+random(B-T-H));
}
void FLY::Tick (void)
{
Step();
if (! Flags.Kept)
{
if (random(10) < 1)
{
Tx = random(3) - 1;
Ty = random(3) - 1;
}
if (X + Tx < L || X + Tx + W > R) Tx = -Tx;
if (Y + Ty < T || Y + Ty + H > B) Ty = -Ty;
Goto(X + Tx, Y + Ty);
}
}
//--------------------------------------------------------------------------
|