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

Last change on this file since 97 was 56, checked in by Sam Hocevar, 12 years ago
  • Add licensing terms to most C / C++ files (Ref #5).
File size: 952 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.hpp"
15#include "dev.hpp"
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 *)jmalloc((int)how_many*2,"point list");
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 *)jmalloc((int)tot*2,"point list : loaded");
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.