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

Last change on this file since 682 was 555, checked in by Sam Hocevar, 9 years ago

ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.

File size: 1.0 KB
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, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <string.h>
16
17#include "common.h"
18
19#include "points.h"
20#include "dev.h"
21
22point_list::point_list(unsigned char how_many, unsigned char *Data)
23{
24  tot=how_many;
25  if (tot)
26  {
27    data=(unsigned char *)malloc((int)how_many*2);
28    memcpy(data,Data,(int)tot*2);
29  } else data=NULL;
30}
31
32point_list::point_list(bFILE *fp)
33{
34  fp->read(&tot,1);
35  if (tot)
36  {
37    data=(unsigned char *)malloc((int)tot*2);
38    fp->read(data,(int)tot*2);
39
40    int i;
41    for (i=0; i<tot*2; i++)
42      data[i]=data[i]*scale_mult/scale_div;
43
44  } else data=NULL;
45}
46
47void point_list::save(bFILE *fp)
48{
49  fp->write(&tot,1);
50  if (tot) fp->write(data,(int)tot*2);
51}
52
53
54
Note: See TracBrowser for help on using the repository browser.