source: abuse/trunk/src/points.cpp @ 528

Last change on this file since 528 was 512, checked in by Sam Hocevar, 11 years ago

imlib: use vec2i for image::size and unroll all necessary changes
everywhere else in the code.

File size: 988 bytes
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11#include "config.h"
12
13#include <string.h>
14
15#include "common.h"
16
17#include "points.h"
18#include "dev.h"
19
20point_list::point_list(unsigned char how_many, unsigned char *Data)
21{
22  tot=how_many;
23  if (tot)
24  {
25    data=(unsigned char *)malloc((int)how_many*2);
26    memcpy(data,Data,(int)tot*2);
27  } else data=NULL;
28}
29
30point_list::point_list(bFILE *fp)
31{
32  fp->read(&tot,1);
33  if (tot)
34  {
35    data=(unsigned char *)malloc((int)tot*2);
36    fp->read(data,(int)tot*2);
37
38    int i;
39    for (i=0; i<tot*2; i++)
40      data[i]=data[i]*scale_mult/scale_div;
41
42  } else data=NULL;
43}
44
45void point_list::save(bFILE *fp)
46{
47  fp->write(&tot,1);
48  if (tot) fp->write(data,(int)tot*2);
49}
50
51
52
Note: See TracBrowser for help on using the repository browser.