-
Notifications
You must be signed in to change notification settings - Fork 1
/
points.cpp
54 lines (42 loc) · 1.02 KB
/
points.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
/*
* Abuse - dark 2D side-scrolling platform game
* Copyright (c) 1995 Crack dot Com
* Copyright (c) 2005-2011 Sam Hocevar <[email protected]>
*
* This software was released into the Public Domain. As with most public
* domain software, no warranty is made or implied by Crack dot Com, by
* Jonathan Clark, or by Sam Hocevar.
*/
#if defined HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "common.h"
#include "points.h"
#include "dev.h"
point_list::point_list(unsigned char how_many, unsigned char *Data)
{
tot=how_many;
if (tot)
{
data=(unsigned char *)malloc((int)how_many*2);
memcpy(data,Data,(int)tot*2);
} else data=NULL;
}
point_list::point_list(bFILE *fp)
{
fp->read(&tot,1);
if (tot)
{
data=(unsigned char *)malloc((int)tot*2);
fp->read(data,(int)tot*2);
int i;
for (i=0; i<tot*2; i++)
data[i]=data[i]*scale_mult/scale_div;
} else data=NULL;
}
void point_list::save(bFILE *fp)
{
fp->write(&tot,1);
if (tot) fp->write(data,(int)tot*2);
}