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

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

style: remove trailing spaces, fix copyright statements.

File size: 967 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 "points.h"
16#include "dev.h"
17
18point_list::point_list(unsigned char how_many, unsigned char *Data)
19{
20  tot=how_many;
21  if (tot)
22  {
23    data=(unsigned char *)malloc((int)how_many*2);
24    memcpy(data,Data,(int)tot*2);
25  } else data=NULL;
26}
27
28point_list::point_list(bFILE *fp)
29{
30  fp->read(&tot,1);
31  if (tot)
32  {
33    data=(unsigned char *)malloc((int)tot*2);
34    fp->read(data,(int)tot*2);
35
36    int i;
37    for (i=0; i<tot*2; i++)
38      data[i]=data[i]*scale_mult/scale_div;
39
40  } else data=NULL;
41}
42
43void point_list::save(bFILE *fp)
44{
45  fp->write(&tot,1);
46  if (tot) fp->write(data,(int)tot*2);
47}
48
49
50
Note: See TracBrowser for help on using the repository browser.