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

Last change on this file since 579 was 555, checked in by Sam Hocevar, 11 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
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]5 *
6 *  This software was released into the Public Domain. As with most public
[555]7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
[56]9 */
10
[555]11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
[56]14
[2]15#include <string.h>
16
[512]17#include "common.h"
18
[481]19#include "points.h"
20#include "dev.h"
[2]21
22point_list::point_list(unsigned char how_many, unsigned char *Data)
23{
24  tot=how_many;
25  if (tot)
26  {
[129]27    data=(unsigned char *)malloc((int)how_many*2);
[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  {
[129]37    data=(unsigned char *)malloc((int)tot*2);
[2]38    fp->read(data,(int)tot*2);
39
40    int i;
[494]41    for (i=0; i<tot*2; i++)
[124]42      data[i]=data[i]*scale_mult/scale_div;
[2]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.