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

Last change on this file since 489 was 481, checked in by Sam Hocevar, 10 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

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