Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * OpenTyrian: A modern cross-platform port of Tyrian
  3.  * Copyright (C) 2007-2009  The OpenTyrian Development Team
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License
  7.  * as published by the Free Software Foundation; either version 2
  8.  * of the License, or (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  18.  */
  19.  
  20. #ifndef SIZEBUF_H
  21. #define SIZEBUF_H
  22.  
  23. #include "opentyr.h"
  24.  
  25. typedef struct sizebuf_s
  26. {
  27.         Uint8 *data;
  28.         unsigned int bufferLen;
  29.         unsigned int bufferPos;
  30.         bool error;
  31. } sizebuf_t;
  32.  
  33. void SZ_Init    ( sizebuf_t *, Uint8 *, unsigned int ); /* C style constructor */
  34. bool SZ_Error   ( sizebuf_t * );
  35. void SZ_Memset  ( sizebuf_t *, int, size_t ); /* memset with a sizebuf */
  36. void SZ_Memcpy  ( sizebuf_t *, const Uint8 *, size_t ); /* memcpy with a normal buffer */
  37. void SZ_Memcpy2 ( sizebuf_t *, sizebuf_t *, size_t );   /* memcpy with a sizebuf */
  38. void SZ_Seek    ( sizebuf_t *, long, int ); /* fseek with a sizebuf. */
  39.  
  40. const Uint8 * SZ_GetCurBufferPtr ( sizebuf_t * ); /* Mimic private member, const return */
  41.  
  42. void MSG_WriteByte  ( sizebuf_t *, unsigned int );
  43. void MSG_WriteWord  ( sizebuf_t *, unsigned int );
  44. void MSG_WriteDWord ( sizebuf_t *, unsigned int );
  45.  
  46. unsigned int MSG_ReadByte  ( sizebuf_t * );
  47. unsigned int MSG_ReadWord  ( sizebuf_t * );
  48. unsigned int MSG_ReadDWord ( sizebuf_t * );
  49.  
  50. #endif
  51.