-
Notifications
You must be signed in to change notification settings - Fork 1
/
FAMESPR.CPP
82 lines (68 loc) · 1.63 KB
/
FAMESPR.CPP
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
#include "famegraf.h"
#include <alloc.h>
#include <stdlib.h>
#define MaxSprite 64
screen SpritesScreen;
// Ž¯à¥¤¥«¥¨¥ äãªæ¨© ¤«ï à ¡®âë á® á¯à ©â ¬¨
sprites sprite[MaxSprite]; //ᮧ¤ ¨¥ áâàãªâãàë ¤«ï á¯à ©â®¢
void InitSpr(void) { // ç «ì ï ¨¨æ¨ «¨§ æ¨ï
int i;
SpritesScreen=farmalloc((unsigned long)320*200);
for (i=0; i<MaxSprite; ++i) {
sprite[i].map=NULL; sprite[i].on=0;
sprite[i].ox=sprite[i].oy=0;
sprite[i].lx=sprite[i].ly=1;
}
return;
}
int CreateSpr(int lx,int ly, block map) { //ᮧ¤ âì á¯à ©â
int i;
for (i=0; i<MaxSprite; ++i) {
if (sprite[i].map==NULL) {
break;
}
}
sprite[i].map=map; sprite[i].on=1;
sprite[i].ox=sprite[i].x=sprite[i].oy=sprite[i].y=0;
sprite[i].lx=lx; sprite[i].ly=ly;
return i;
}
void ClearSpr(int num) { //㤠«¨âì á¯à ©â ¨§ ᯨáª
sprite[num].map=NULL;
return;
}
void SprOn(int num) {
sprite[num].on=1;
return;
}
void SprOff(int num) {
sprite[num].on=0;
return;
}
void MoveSpr(int num, int x, int y) {
sprite[num].x=x;
sprite[num].y=y;
return;
}
void SetSpr(int num, block buf) {
sprite[num].map=buf;
return;
}
void ShowSprites(void) {
int i;
for (i=0; i<MaxSprite; ++i) {
if (sprite[i].map!=NULL && sprite[i].on!=0)
PutCMas(sprite[i].x,sprite[i].y,sprite[i].lx,sprite[i].ly,sprite[i].map);
}
return;
}
void EraseSprites(void) {
int i;
//if (SpritesScreen==NULL)
// return;
for (i=0; i<MaxSprite; ++i) {
if (sprite[i].map!=NULL && sprite[i].on!=0)
CopyCBlock(sprite[i].x,sprite[i].y,sprite[i].lx,sprite[i].ly,CurrentScreen,sprite[i].x,sprite[i].y,SpritesScreen);
}
return;
}