Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 155617 | Differences between
and this patch

Collapse All | Expand All

(-)abuse-sdl-0.7.0.orig/src/imlib/include/visobj.hpp (+1 lines)
Lines 10-15 Link Here
10
  virtual void draw(image *screen, int x, int y, window_manager *wm, filter *f) = 0;
10
  virtual void draw(image *screen, int x, int y, window_manager *wm, filter *f) = 0;
11
  virtual int width(window_manager *wm) = 0;
11
  virtual int width(window_manager *wm) = 0;
12
  virtual int height(window_manager *wm) = 0;
12
  virtual int height(window_manager *wm) = 0;
13
  virtual ~visual_object() {}
13
} ;
14
} ;
14
15
15
16
(-)abuse-sdl-0.7.0.orig/src/imlib/include/status.hpp (+1 lines)
Lines 11-16 Link Here
11
  virtual void update(int percentage) = 0;
11
  virtual void update(int percentage) = 0;
12
  virtual void pop() = 0;
12
  virtual void pop() = 0;
13
  virtual void force_display() { ; }
13
  virtual void force_display() { ; }
14
  virtual ~status_manager() {}
14
} ;
15
} ;
15
16
16
17
(-)abuse-sdl-0.7.0.orig/src/imlib/include/jmalloc.hpp (-5 / +5 lines)
Lines 7-20 Link Here
7
#ifdef MANAGE_MEM
7
#ifdef MANAGE_MEM
8
enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE};
8
enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE};
9
extern int alloc_space;
9
extern int alloc_space;
10
void *jmalloc(long size, char *what_for);
10
void *jmalloc(int32_t size, char *what_for);
11
void *jrealloc(void *ptr, long size, char *what_for);
11
void *jrealloc(void *ptr, int32_t size, char *what_for);
12
void jfree(void *ptr);
12
void jfree(void *ptr);
13
void mem_report(char *filename);
13
void mem_report(char *filename);
14
void jmalloc_init(long min_size);
14
void jmalloc_init(int32_t min_size);
15
void jmalloc_uninit();
15
void jmalloc_uninit();
16
long j_allocated();
16
int32_t j_allocated();
17
long j_available();
17
int32_t j_available();
18
extern void free_up_memory();
18
extern void free_up_memory();
19
#else
19
#else
20
#define jmalloc(x,y) malloc(x)
20
#define jmalloc(x,y) malloc(x)
(-)abuse-sdl-0.7.0.orig/src/imlib/include/palette.hpp (-1 / +1 lines)
Lines 27-33 Link Here
27
  palette(bFILE *fp);
27
  palette(bFILE *fp);
28
  void set(int x, unsigned char red, unsigned char green, unsigned char blue);
28
  void set(int x, unsigned char red, unsigned char green, unsigned char blue);
29
  void get(int x, unsigned char &red, unsigned char &green, unsigned char &blue);
29
  void get(int x, unsigned char &red, unsigned char &green, unsigned char &blue);
30
  long getquad(int x);
30
  uint32_t getquad(int x);
31
  unsigned int red(int x) { return pal[x].red; }
31
  unsigned int red(int x) { return pal[x].red; }
32
  unsigned int green(int x) { return pal[x].green; }
32
  unsigned int green(int x) { return pal[x].green; }
33
  unsigned int blue(int x) { return pal[x].blue; }
33
  unsigned int blue(int x) { return pal[x].blue; }
(-)abuse-sdl-0.7.0.orig/src/imlib/include/timage.hpp (-3 / +3 lines)
Lines 27-41 Link Here
27
27
28
  // if screen x & y offset already calculated save a mul
28
  // if screen x & y offset already calculated save a mul
29
  // and no clipping, but fast use this
29
  // and no clipping, but fast use this
30
  void put_image_offseted(image *screen, uchar *s_off);   
30
  void put_image_offseted(image *screen, uint8_t *s_off);   
31
  void put_image_filled(image *screen, int x, int y, 
31
  void put_image_filled(image *screen, int x, int y, 
32
			uchar fill_color);
32
			uint8_t fill_color);
33
  void put_fade(image *screen, int x, int y,
33
  void put_fade(image *screen, int x, int y,
34
			   int frame_on, int total_frames, 
34
			   int frame_on, int total_frames, 
35
			   color_filter *f, palette *pal);
35
			   color_filter *f, palette *pal);
36
  void put_fade_tint(image *screen, int x, int y,
36
  void put_fade_tint(image *screen, int x, int y,
37
		     int frame_on, int total_frames, 
37
		     int frame_on, int total_frames, 
38
		     uchar *tint,
38
		     uint8_t *tint,
39
		     color_filter *f, palette *pal);
39
		     color_filter *f, palette *pal);
40
  void put_color(image *screen, int x, int y, int color);
40
  void put_color(image *screen, int x, int y, int color);
41
  unsigned char *clip_y(image *screen, int x1, int y1, int x2, int y2, 
41
  unsigned char *clip_y(image *screen, int x1, int y1, int x2, int y2, 
(-)abuse-sdl-0.7.0.orig/src/imlib/include/packet.hpp (-8 / +8 lines)
Lines 4-27 Link Here
4
class packet
4
class packet
5
{
5
{
6
  public :
6
  public :
7
  uchar *buf;
7
  uint8_t *buf;
8
  long buf_size,ro,wo,rend;
8
  int32_t buf_size,ro,wo,rend;
9
  int pre_size;
9
  int pre_size;
10
  void make_bigger(int max);
10
  void make_bigger(int max);
11
11
12
  int get_read_position() { return ro; }
12
  int get_read_position() { return ro; }
13
  void set_read_position(int x) { ro=x; }
13
  void set_read_position(int x) { ro=x; }
14
  int read(uchar *buffer, int size);
14
  int read(uint8_t *buffer, int size);
15
  int write(uchar *buffer, int size);
15
  int write(uint8_t *buffer, int size);
16
  int eop() { return ro>=rend; }
16
  int eop() { return ro>=rend; }
17
  void reset();
17
  void reset();
18
  packet(int prefix_size=2);
18
  packet(int prefix_size=2);
19
  void get_string(char *st, int len);
19
  void get_string(char *st, int len);
20
  int advance(long offset);
20
  int advance(int32_t offset);
21
21
22
  void write_long(ulong x);      // writes can't fail...
22
  void write_uint32(uint32_t x);      // writes can't fail...
23
  void write_short(ushort x);
23
  void write_uint16(uint16_t x);
24
  void write_byte(uchar x);
24
  void write_uint8(uint8_t x);
25
  void insert_into(packet &pk);
25
  void insert_into(packet &pk);
26
  int size() { return rend-pre_size; }
26
  int size() { return rend-pre_size; }
27
  ~packet();
27
  ~packet();
(-)abuse-sdl-0.7.0.orig/src/imlib/include/jwindow.hpp (-3 / +2 lines)
Lines 68-76 Link Here
68
68
69
struct jwindow_properties
69
struct jwindow_properties
70
{
70
{
71
  uchar moveable,
71
  uint8_t moveable,
72
        hidden;
72
          hidden;
73
  
74
} ;
73
} ;
75
74
76
75
(-)abuse-sdl-0.7.0.orig/src/imlib/include/image.hpp (-81 / +81 lines)
Lines 18-27 Link Here
18
#define imWRITE_ERROR          7
18
#define imWRITE_ERROR          7
19
#define imMAX_ERROR 	       7
19
#define imMAX_ERROR 	       7
20
20
21
short current_error();
21
int16_t current_error();
22
void clear_errors();
22
void clear_errors();
23
void set_error(short x);
23
void set_error(int16_t x);
24
short last_error();
24
int16_t last_error();
25
void make_block(size_t size);
25
void make_block(size_t size);
26
void image_init();
26
void image_init();
27
void image_uninit();
27
void image_uninit();
Lines 29-37 Link Here
29
29
30
typedef struct image_color_t
30
typedef struct image_color_t
31
{
31
{
32
	unsigned short r;
32
	uint16_t r;
33
	unsigned short g;
33
	uint16_t g;
34
	unsigned short b;
34
	uint16_t b;
35
} image_color;
35
} image_color;
36
36
37
class filter;
37
class filter;
Lines 40-83 Link Here
40
class dirty_rect : public linked_node
40
class dirty_rect : public linked_node
41
{
41
{
42
public :
42
public :
43
  short dx1,dy1,dx2,dy2;
43
  int16_t dx1,dy1,dx2,dy2;
44
  dirty_rect(short x1, short y1, short x2, short y2)
44
  dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
45
  { dx1=x1; dy1=y1; dx2=x2; dy2=y2; 
45
  { dx1=x1; dy1=y1; dx2=x2; dy2=y2; 
46
    if (x2<x1 || y2<y1) 
46
    if (x2<x1 || y2<y1) 
47
      printf("add inccorect dirty\n");
47
      printf("add inccorect dirty\n");
48
  }
48
  }
49
  virtual short compare(void *n1, short field)
49
  virtual int16_t compare(void *n1, int16_t field)
50
  { return ((dirty_rect *)n1)->dy1>dy1; }
50
  { return ((dirty_rect *)n1)->dy1>dy1; }
51
} ;
51
} ;
52
52
53
class image_descriptor
53
class image_descriptor
54
{
54
{
55
  short l,h;
55
  int16_t l,h;
56
  short clipx1, clipy1, clipx2, clipy2;
56
  int16_t clipx1, clipy1, clipx2, clipy2;
57
public :  
57
public :  
58
  unsigned char keep_dirt,
58
  uint8_t keep_dirt,
59
	        static_mem;      // if this flag is set then don't free memory on exit
59
	  static_mem;      // if this flag is set then don't free memory on exit
60
  
60
  
61
  linked_list dirties;
61
  linked_list dirties;
62
  void *extended_descriptor;              // type depends on current system
62
  void *extended_descriptor;              // type depends on current system
63
63
64
  image_descriptor(short length, short height,
64
  image_descriptor(int16_t length, int16_t height,
65
		  int keep_dirties=1, int static_memory=0);
65
		  int keep_dirties=1, int static_memory=0);
66
  short bound_x1(short x1)  { return x1<clipx1 ? clipx1 : x1; }
66
  int16_t bound_x1(int16_t x1)  { return x1<clipx1 ? clipx1 : x1; }
67
  short bound_y1(short y1)  { return y1<clipy1 ? clipy1 : y1; }
67
  int16_t bound_y1(int16_t y1)  { return y1<clipy1 ? clipy1 : y1; }
68
  short bound_x2(short x2)  { return x2>clipx2 ? clipx2 : x2; }
68
  int16_t bound_x2(int16_t x2)  { return x2>clipx2 ? clipx2 : x2; }
69
  short bound_y2(short y2)  { return y2>clipy2 ? clipy2 : y2; }
69
  int16_t bound_y2(int16_t y2)  { return y2>clipy2 ? clipy2 : y2; }
70
  short x1_clip() { return clipx1; }
70
  int16_t x1_clip() { return clipx1; }
71
  short y1_clip() { return clipy1; }
71
  int16_t y1_clip() { return clipy1; }
72
  short x2_clip() { return clipx2; }
72
  int16_t x2_clip() { return clipx2; }
73
  short y2_clip() { return clipy2; }
73
  int16_t y2_clip() { return clipy2; }
74
  void dirty_area(short x1, short y1, short x2, short y2) { ;}
74
  void dirty_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ;}
75
  void clean_area(short x1, short y1, short x2, short y2) { ; }
75
  void clean_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ; }
76
  void clear_dirties();
76
  void clear_dirties();
77
  short get_dirty_area(short &x1, short &y1, short &x2, short &y2) { return 0; }
77
  int16_t get_dirty_area(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) { return 0; }
78
  void get_clip(short &x1, short &y1, short &x2, short &y2)
78
  void get_clip(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
79
    { x1=clipx1; y1=clipy1; x2=clipx2; y2=clipy2; }
79
    { x1=clipx1; y1=clipy1; x2=clipx2; y2=clipy2; }
80
  void set_clip(short x1, short y1, short x2, short y2)
80
  void set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
81
    { if (x2<x1) x2=x1;
81
    { if (x2<x1) x2=x1;
82
      if (y2<y1) y2=y1;
82
      if (y2<y1) y2=y1;
83
      if (x1<0) clipx1=0; else clipx1=x1;
83
      if (x1<0) clipx1=0; else clipx1=x1;
Lines 88-162 Link Here
88
  void reduce_dirties();
88
  void reduce_dirties();
89
  void add_dirty(int x1, int y1, int x2, int y2);
89
  void add_dirty(int x1, int y1, int x2, int y2);
90
  void delete_dirty(int x1, int y1, int x2, int y2);
90
  void delete_dirty(int x1, int y1, int x2, int y2);
91
  void resize(short length, short height)
91
  void resize(int16_t length, int16_t height)
92
   { l=length; h=height; clipx1=0; clipy1=0; clipx2=l-1; clipy2=h-1; }
92
   { l=length; h=height; clipx1=0; clipy1=0; clipx2=l-1; clipy2=h-1; }
93
} ;
93
} ;
94
94
95
class image : public linked_node
95
class image : public linked_node
96
{ 
96
{ 
97
  unsigned char *data;
97
  uint8_t *data;
98
  short w,h;
98
  int16_t w,h;
99
  void make_page(short width, short height, unsigned char *page_buffer);
99
  void make_page(int16_t width, int16_t height, uint8_t *page_buffer);
100
  void delete_page();
100
  void delete_page();
101
public :
101
public :
102
  image_descriptor *special;
102
  image_descriptor *special;
103
  image(spec_entry *e, bFILE *fp);
103
  image(spec_entry *e, bFILE *fp);
104
  image(bFILE *fp);
104
  image(bFILE *fp);
105
  image(short width, short height,                 // required
105
  image(int16_t width, int16_t height,                 // required
106
	unsigned char *page_buffer=NULL,
106
	uint8_t *page_buffer=NULL,
107
	short create_descriptor=0);        // 0=no, 1=yes, 2=yes & keep dirties
107
	int16_t create_descriptor=0);        // 0=no, 1=yes, 2=yes & keep dirties
108
  unsigned char  pixel              (short x, short y);
108
  uint8_t  pixel              (int16_t x, int16_t y);
109
  void           putpixel           (short x, short y, char color);
109
  void     putpixel           (int16_t x, int16_t y, char color);
110
  unsigned char *scan_line          (short y) { return data+y*w; }
110
  uint8_t *scan_line          (int16_t y) { return data+y*w; }
111
  unsigned char *next_line          (short lasty, unsigned char *last_scan) 
111
  uint8_t *next_line          (int16_t lasty, uint8_t *last_scan) 
112
                                    { return last_scan+w; }          
112
                                    { return last_scan+w; }          
113
  long           total_pixels       (unsigned char background=0);
113
  int32_t  total_pixels       (uint8_t background=0);
114
  image         *copy               ();    // makes a copy of an image
114
  image    *copy               ();    // makes a copy of an image
115
  void           clear              (short color=-1);  // -1 is background color
115
  void     clear              (int16_t color=-1);  // -1 is background color
116
  void           to_24bit           (palette &pal);
116
  void     to_24bit           (palette &pal);
117
  short          width              () { return (short)w; }
117
  int16_t  width              () { return (int16_t)w; }
118
  short          height             () { return (short)h; }
118
  int16_t  height             () { return (int16_t)h; }
119
  void           scroll             (short x1, short y1, short x2, short y2, short xd, short yd);
119
  void     scroll             (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd);
120
  void           fill_image         (image *screen, short x1, short y1, short x2, short y2, 
120
  void     fill_image         (image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, 
121
				     short allign=1);
121
			      int16_t align=1);
122
  void           put_image          (image *screen, short x, short y, char transparent=0);
122
  void     put_image          (image *screen, int16_t x, int16_t y, char transparent=0);
123
  void           put_part           (image *screen, short x, short y, short x1, short y1, 
123
  void     put_part           (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1, 
124
				     short x2, short y2, char transparent=0);
124
				     int16_t x2, int16_t y2, char transparent=0);
125
  void           put_part_xrev      (image *screen, short x, short y, short x1, short y1, 
125
  void     put_part_xrev      (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1, 
126
				     short x2, short y2, char transparent=0);
126
				     int16_t x2, int16_t y2, char transparent=0);
127
  void           put_part_masked    (image *screen, image *mask, short x, short y, 
127
  void     put_part_masked    (image *screen, image *mask, int16_t x, int16_t y, 
128
				     short maskx, short masky, short x1, short y1, short x2, short y2);
128
				     int16_t maskx, int16_t masky, int16_t x1, int16_t y1, int16_t x2, int16_t y2);
129
  image         *copy_part_dithered (short x1, short y1, short x2, short y2);
129
  image    *copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
130
  void           bar                (short x1, short y1, short x2, short y2, unsigned char color);
130
  void     bar                (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
131
  void           xor_bar            (short x1, short y1, short x2, short y2, unsigned char color);
131
  void     xor_bar            (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
132
  void 	         wiget_bar          (short x1, short y1, short x2, short y2, 
132
  void 	   wiget_bar          (int16_t x1, int16_t y1, int16_t x2, int16_t y2, 
133
				     unsigned char light, unsigned char med, unsigned char dark);
133
				     uint8_t light, uint8_t med, uint8_t dark);
134
  void           line               (short x1, short y1, short x2, short y2, unsigned char color);
134
  void     line               (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
135
  void           rectangle          (short x1, short y1, short x2, short y2, unsigned char color);
135
  void     rectangle          (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
136
  void           burn_led           (short x, short y, long num, short color, short scale=1);
136
  void     burn_led           (int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale=1);
137
  void           set_clip           (short x1, short y1, short x2, short y2);
137
  void     set_clip           (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
138
  void           get_clip           (short &x1,short &y1,short &x2,short &y2);
138
  void     get_clip           (int16_t &x1,int16_t &y1,int16_t &x2,int16_t &y2);
139
  void           in_clip            (short x1, short y1, short x2, short y2);
139
  void     in_clip            (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
140
140
141
  void           dirt_off           () { if (special && special->keep_dirt) special->keep_dirt=0; }
141
  void     dirt_off           () { if (special && special->keep_dirt) special->keep_dirt=0; }
142
  void           dirt_on            () { if (special) special->keep_dirt=1; }
142
  void     dirt_on            () { if (special) special->keep_dirt=1; }
143
143
144
  void           add_dirty          (int x1, int y1, int x2, int y2) 
144
  void     add_dirty          (int x1, int y1, int x2, int y2) 
145
                                    { if (special) special->add_dirty(x1,y1,x2,y2); }
145
                                    { if (special) special->add_dirty(x1,y1,x2,y2); }
146
  void           delete_dirty       (int x1, int y1, int x2, int y2) 
146
  void     delete_dirty       (int x1, int y1, int x2, int y2) 
147
                                    { if (special) special->delete_dirty(x1,y1,x2,y2); }
147
                                    { if (special) special->delete_dirty(x1,y1,x2,y2); }
148
  void           clear_dirties      () { if (special) special->clear_dirties(); }
148
  void     clear_dirties      () { if (special) special->clear_dirties(); }
149
  void           dither             (palette *pal); // use a b&w palette!
149
  void     dither             (palette *pal); // use a b&w palette!
150
  void           resize             (short new_width, short new_height);
150
  void     resize             (int16_t new_width, int16_t new_height);
151
  void           change_size        (short new_width, short new_height, unsigned char *page=NULL);
151
  void     change_size        (int16_t new_width, int16_t new_height, uint8_t *page=NULL);
152
  void           flood_fill         (short x, short y, unsigned char color);
152
  void     flood_fill         (int16_t x, int16_t y, uint8_t color);
153
  image         *create_smooth      (short smoothness=1); // 0 no smoothness
153
  image    *create_smooth     (int16_t smoothness=1); // 0 no smoothness
154
  void           unpack_scanline    (short line, char bitsperpixel=1);
154
  void     unpack_scanline    (int16_t line, char bitsperpixel=1);
155
  unsigned char  brightest_color    (palette *pal);
155
  uint8_t  brightest_color    (palette *pal);
156
  void           flip_x	  	    ();
156
  void     flip_x	      ();
157
  void           flip_y             ();
157
  void     flip_y             ();
158
  void           make_color         (unsigned char color);
158
  void     make_color         (uint8_t color);
159
  unsigned char  darkest_color      (palette *pal, short noblack=0);
159
  uint8_t  darkest_color      (palette *pal, int16_t noblack=0);
160
160
161
  ~image();
161
  ~image();
162
} ;
162
} ;
(-)abuse-sdl-0.7.0.orig/src/imlib/include/macs.hpp (-5 / +5 lines)
Lines 23-34 Link Here
23
#define max(x,y) (x>y ? x:y)
23
#define max(x,y) (x>y ? x:y)
24
#endif
24
#endif
25
25
26
#define uchar  unsigned char
26
//#define uchar  unsigned char
27
#define schar  signed char
27
//#define schar  signed char
28
//#define ushort unsigned short
28
//#define ushort unsigned short
29
typedef unsigned short int ushort;
29
//typedef unsigned short int ushort;
30
#define sshort signed short
30
//#define sshort signed short
31
//#define ulong  unsigned long
31
//#define ulong  unsigned long
32
typedef unsigned long int ulong;
32
//typedef unsigned long int ulong;
33
33
34
#endif
34
#endif
(-)abuse-sdl-0.7.0.orig/src/imlib/include/system.h (-22 / +23 lines)
Lines 25-60 Link Here
25
#else
25
#else
26
  // so apps can find unlink
26
  // so apps can find unlink
27
  #include <unistd.h>
27
  #include <unistd.h>
28
  #include <stdint.h>
28
#endif
29
#endif
29
30
30
31
31
#define short_swap(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
32
#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
32
#define long_swap(x) \
33
#define uint32_swap(x) \
33
   ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
34
   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
34
   ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
35
   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
35
36
36
#if defined BIG_ENDIANS
37
#if defined BIG_ENDIANS
37
#define LONG int
38
#define LONG int32_t
38
#define int_to_intel(x) short_swap(x)
39
#define uint16_to_intel(x) uint16_swap(x)
39
#define int_to_local(x) int_to_intel(x)
40
#define uint16_to_local(x) uint16_to_intel(x)
40
#define big_long_to_local(x) (x)
41
#define big_uint32_to_local(x) (x)
41
#define big_short_to_local(x) (x)
42
#define big_uint16_to_local(x) (x)
42
#define long_to_intel(x) long_swap(x)
43
#define uint32_to_intel(x) uint32_swap(x)
43
#define long_to_local(x) long_to_intel(x)
44
#define uint32_to_local(x) uint32_to_intel(x)
44
#else
45
#else
45
#define LONG long
46
#define LONG int32_t
46
#define int_to_intel(x) (x)
47
#define uint16_to_intel(x) (x)
47
#define int_to_local(x) (x)
48
#define uint16_to_local(x) (x)
48
#define long_to_local(x) (x)
49
#define uint32_to_local(x) (x)
49
#define long_to_intel(x) (x)
50
#define uint32_to_intel(x) (x)
50
#define big_long_to_local(x) long_swap(x)
51
#define big_uint32_to_local(x) uint32_swap(x)
51
#define big_short_to_local(x) short_swap(x)
52
#define big_uint16_to_local(x) uint16_swap(x)
52
#endif
53
#endif
53
54
54
#define bltl(x) big_long_to_local(x)
55
#define bltl(x) big_uint32_to_local(x)
55
#define bstl(x) big_short_to_local(x)
56
#define bstl(x) big_uint16_to_local(x)
56
#define lltl(x) long_to_intel(x)
57
#define lltl(x) uint32_to_intel(x)
57
#define lstl(x) int_to_intel(x)
58
#define lstl(x) uint16_to_intel(x)
58
59
59
#endif
60
#endif
60
61
(-)abuse-sdl-0.7.0.orig/src/imlib/include/scroller.hpp (-1 / +1 lines)
Lines 50-56 Link Here
50
{
50
{
51
  protected :
51
  protected :
52
  int r,c,m,last_sel,cur_sel;
52
  int r,c,m,last_sel,cur_sel;
53
  uchar *select;
53
  uint8_t *select;
54
  public :
54
  public :
55
  spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next);
55
  spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next);
56
  int vis() { if (vert) return r; else return c; }
56
  int vis() { if (vert) return r; else return c; }
(-)abuse-sdl-0.7.0.orig/src/imlib/include/specs.hpp (-17 / +18 lines)
Lines 6-11 Link Here
6
#include "system.h"
6
#include "system.h"
7
#include <fcntl.h>
7
#include <fcntl.h>
8
#include <stdlib.h>
8
#include <stdlib.h>
9
#include <stdint.h>
9
10
10
extern char *spec_types[];
11
extern char *spec_types[];
11
12
Lines 95-107 Link Here
95
96
96
97
97
  // these read and writes, allways read/write Intel endian-ness
98
  // these read and writes, allways read/write Intel endian-ness
98
  unsigned short read_short();
99
  uint16_t read_uint16();
99
  unsigned long read_long();
100
  uint32_t read_uint32();
100
  unsigned char read_byte();
101
  uint8_t read_uint8();
101
  double read_double();
102
  double read_double();
102
  void write_short(unsigned short x);
103
  void write_uint16(uint16_t x);
103
  void write_long(unsigned long x);
104
  void write_uint32(uint32_t x);
104
  void write_byte(unsigned char x);
105
  void write_uint8(uint8_t x);
105
  void write_double(double x);
106
  void write_double(double x);
106
  void set_read_buffer_size(long size);
107
  void set_read_buffer_size(long size);
107
} ;
108
} ;
Lines 192-208 Link Here
192
                         unsigned long data_size,
193
                         unsigned long data_size,
193
                         char *link_filename=NULL);*/
194
                         char *link_filename=NULL);*/
194
195
195
unsigned short read_short(FILE *fp);
196
uint16_t read_uint16(FILE *fp);
196
unsigned long read_long(FILE *fp);
197
uint32_t read_uint32(FILE *fp);
197
unsigned short read_other_long(FILE *fp);
198
uint32_t read_other_uint32(FILE *fp);
198
unsigned long read_other_short(FILE *fp);
199
uint16_t read_other_uint16(FILE *fp);
199
unsigned char read_byte(FILE *fp);
200
uint8_t read_uint8(FILE *fp);
200
201
201
void write_short(FILE *fp, unsigned short x);
202
void write_uint16(FILE *fp, uint16_t x);
202
void write_long(FILE *fp, unsigned long x);
203
void write_uint32(FILE *fp, uint32_t x);
203
void write_other_short(FILE *fp, unsigned short x);
204
void write_other_uint16(FILE *fp, uint16_t x);
204
void write_other_long(FILE *fp, unsigned long x);
205
void write_other_uint32(FILE *fp, uint32_t x);
205
void write_byte(FILE *fp, unsigned char x);
206
void write_uint8(FILE *fp, uint8_t x);
206
207
207
void set_spec_main_file(char *filename, int Search_order);
208
void set_spec_main_file(char *filename, int Search_order);
208
void set_file_opener(bFILE *(*open_fun)(char *, char *));
209
void set_file_opener(bFILE *(*open_fun)(char *, char *));
(-)abuse-sdl-0.7.0.orig/src/imlib/targa.cpp (-17 / +17 lines)
Lines 13-23 Link Here
13
    return 0;
13
    return 0;
14
  }
14
  }
15
  
15
  
16
  unsigned char id,color_map,im_type;
16
  uint8_t id,color_map,im_type;
17
17
18
  id=fp->read_byte();
18
  id=fp->read_uint8();
19
  color_map=fp->read_byte();
19
  color_map=fp->read_uint8();
20
  im_type=fp->read_byte();
20
  im_type=fp->read_uint8();
21
21
22
  if (color_map!=0)
22
  if (color_map!=0)
23
  {
23
  {
Lines 31-48 Link Here
31
    return 0;
31
    return 0;
32
  }
32
  }
33
33
34
  fp->read_short();
34
  fp->read_uint16();
35
  fp->read_short();
35
  fp->read_uint16();
36
  fp->read_byte();
36
  fp->read_uint8();
37
37
38
  fp->read_short();
38
  fp->read_uint16();
39
  fp->read_short();
39
  fp->read_uint16();
40
40
41
41
42
  int w=fp->read_short();
42
  int w=fp->read_uint16();
43
  int h=fp->read_short();
43
  int h=fp->read_uint16();
44
  unsigned char bpp=fp->read_byte();
44
  uint8_t bpp=fp->read_uint8();
45
  unsigned char im_des=fp->read_byte();
45
  uint8_t im_des=fp->read_uint8();
46
46
47
  if (bpp!=32)
47
  if (bpp!=32)
48
  {
48
  {
Lines 53-60 Link Here
53
  image *im=new image(w,h);
53
  image *im=new image(w,h);
54
54
55
  int x,y;
55
  int x,y;
56
  unsigned char ctrl;
56
  uint8_t ctrl;
57
  unsigned char bgra[4],*sl,c,lr,lg,lb,ll=0,lc;
57
  uint8_t bgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0;
58
  
58
  
59
  
59
  
60
  
60
  
Lines 67-73 Link Here
67
67
68
      for (x=0;x<w;)
68
      for (x=0;x<w;)
69
      {
69
      {
70
        ctrl=fp->read_byte();
70
        ctrl=fp->read_uint8();
71
        if (ctrl&0x80)
71
        if (ctrl&0x80)
72
        {
72
        {
73
          fp->read(bgra,4);
73
          fp->read(bgra,4);
(-)abuse-sdl-0.7.0.orig/src/imlib/input.cpp (-5 / +5 lines)
Lines 256-273 Link Here
256
    {
256
    {
257
      case JK_LEFT : if (cur) { draw_cur(wm->dark_color(),screen,wm); cur--;
257
      case JK_LEFT : if (cur) { draw_cur(wm->dark_color(),screen,wm); cur--;
258
                           draw_cur(wm->bright_color(),screen,wm); } break; 
258
                           draw_cur(wm->bright_color(),screen,wm); } break; 
259
      case JK_RIGHT : if (cur<strlen(format)-1) { draw_cur(wm->dark_color(),screen,wm); cur++;
259
      case JK_RIGHT : if (cur<(int)strlen(format)-1) { draw_cur(wm->dark_color(),screen,wm); cur++;
260
                           draw_cur(wm->bright_color(),screen,wm); } break; 
260
                           draw_cur(wm->bright_color(),screen,wm); } break; 
261
      case JK_END : if (cur!=last_spot()) 
261
      case JK_END : if (cur!=last_spot()) 
262
                          { draw_cur(wm->dark_color(),screen,wm); cur=last_spot(); 
262
                          { draw_cur(wm->dark_color(),screen,wm); cur=last_spot(); 
263
                            if (cur==strlen(format)-1) cur--; 
263
                            if (cur==(int)strlen(format)-1) cur--; 
264
                           draw_cur(wm->bright_color(),screen,wm); } break; 
264
                           draw_cur(wm->bright_color(),screen,wm); } break; 
265
      case JK_HOME : if (cur) 
265
      case JK_HOME : if (cur) 
266
                          { draw_cur(wm->dark_color(),screen,wm); cur=0;
266
                          { draw_cur(wm->dark_color(),screen,wm); cur=0;
267
                           draw_cur(wm->bright_color(),screen,wm); } break; 
267
                           draw_cur(wm->bright_color(),screen,wm); } break; 
268
      case JK_BACKSPACE : if (cur)
268
      case JK_BACKSPACE : if (cur)
269
         { draw_cur(wm->dark_color(),screen,wm); cur--;
269
         { draw_cur(wm->dark_color(),screen,wm); cur--;
270
           for (xx=cur;xx<strlen(format)-1;xx++)
270
           for (xx=cur;xx<(int)strlen(format)-1;xx++)
271
             data[xx]=data[xx+1];
271
             data[xx]=data[xx+1];
272
           data[strlen(format)-1]=' ';
272
           data[strlen(format)-1]=' ';
273
           draw_text(screen,wm);
273
           draw_text(screen,wm);
Lines 280-286 Link Here
280
           for (xx=strlen(format)-1;xx>cur && xx>0;xx--)
280
           for (xx=strlen(format)-1;xx>cur && xx>0;xx--)
281
             data[xx]=data[xx-1];
281
             data[xx]=data[xx-1];
282
           data[cur]=ev.key;
282
           data[cur]=ev.key;
283
           if (cur<strlen(format)-1)
283
           if (cur<(int)strlen(format)-1)
284
             cur++;
284
             cur++;
285
	   data[strlen(format)]=0;
285
	   data[strlen(format)]=0;
286
           draw_text(screen,wm);
286
           draw_text(screen,wm);
Lines 334-340 Link Here
334
                               double Data, ifield *Next)
334
                               double Data, ifield *Next)
335
{
335
{
336
  char num[20];
336
  char num[20];
337
  sprintf(num,"%Lg",Data);  
337
  sprintf(num,"%g",Data);  
338
  int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num));
338
  int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num));
339
  x=X; y=Y; id=ID;
339
  x=X; y=Y; id=ID;
340
  prompt=strcpy((char *)jmalloc(strlen(Prompt)+1,"text_field::prompt"),Prompt);
340
  prompt=strcpy((char *)jmalloc(strlen(Prompt)+1,"text_field::prompt"),Prompt);
(-)abuse-sdl-0.7.0.orig/src/imlib/dprint.cpp (-2 / +1 lines)
Lines 20-27 Link Here
20
{
20
{
21
	if (dprint_fun)
21
	if (dprint_fun)
22
	{
22
	{
23
		char st[1000],a,*sp;
23
		char st[1000];
24
		int y;
25
		va_list ap;
24
		va_list ap;
26
25
27
		va_start(ap, format);
26
		va_start(ap, format);
(-)abuse-sdl-0.7.0.orig/src/imlib/gifread.cpp (-32 / +32 lines)
Lines 14-43 Link Here
14
14
15
15
16
struct {
16
struct {
17
	unsigned short int	Width;
17
	uint16_t	Width;
18
	unsigned short int	Height;
18
	uint16_t	Height;
19
	unsigned char	ColorMap[3][256];
19
	uint8_t 	ColorMap[3][256];
20
	unsigned short int	BitPixel;
20
	uint16_t	BitPixel;
21
	unsigned short int	ColorResolution;
21
	uint16_t	ColorResolution;
22
	unsigned short int	Background;
22
	uint16_t	Background;
23
	unsigned short int	AspectRatio;
23
	uint16_t	AspectRatio;
24
} GifScreen;
24
} GifScreen;
25
25
26
struct {
26
struct {
27
  unsigned short int w,h;
27
  uint16_t w,h;
28
  unsigned char color_info,background,reserved;
28
  uint8_t color_info,background,reserved;
29
} gif_screen;
29
} gif_screen;
30
30
31
struct {
31
struct {
32
  unsigned short int xoff,yoff,w,h;
32
  uint16_t xoff,yoff,w,h;
33
  unsigned char color_info;
33
  uint8_t color_info;
34
} gif_image;
34
} gif_image;
35
35
36
image *read_gif(char *fn, palette *&pal)
36
image *read_gif(char *fn, palette *&pal)
37
{
37
{
38
  char buf[100],er;
38
  char buf[100],er;
39
  unsigned char sep;
39
  uint8_t sep;
40
  int ncolors;
40
  unsigned int ncolors;
41
  FILE *fp;
41
  FILE *fp;
42
  image *im;
42
  image *im;
43
  clear_errors();
43
  clear_errors();
Lines 52-64 Link Here
52
      buf[6]=0;
52
      buf[6]=0;
53
      if (!strcmp("GIF87a",buf))
53
      if (!strcmp("GIF87a",buf))
54
      {
54
      {
55
        fread((char *)&gif_screen.w,2,1,fp);
55
        fread((uint8_t *)&gif_screen.w,2,1,fp);
56
        gif_screen.w=int_to_local(gif_screen.w);
56
        gif_screen.w=uint16_to_local(gif_screen.w);
57
        fread((char *)&gif_screen.h,2,1,fp);
57
        fread((uint8_t *)&gif_screen.h,2,1,fp);
58
        gif_screen.h=int_to_local(gif_screen.h);
58
        gif_screen.h=uint16_to_local(gif_screen.h);
59
        fread((char *)&gif_screen.color_info,1,1,fp);
59
        fread((uint8_t *)&gif_screen.color_info,1,1,fp);
60
        fread((char *)&gif_screen.background,1,1,fp);
60
        fread((uint8_t *)&gif_screen.background,1,1,fp);
61
        if (fread((char *)&gif_screen.reserved,1,1,fp)==1)
61
        if (fread((uint8_t *)&gif_screen.reserved,1,1,fp)==1)
62
	{
62
	{
63
	  if (gif_screen.color_info&128)
63
	  if (gif_screen.color_info&128)
64
	  {
64
	  {
Lines 68-91 Link Here
68
	    pal=new palette(256);
68
	    pal=new palette(256);
69
	    if (pal)
69
	    if (pal)
70
	    {  
70
	    {  
71
              if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
71
              if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
72
	    } else er=imMEMORY_ERROR;
72
	    } else er=imMEMORY_ERROR;
73
	  }
73
	  }
74
	  if (!er)
74
	  if (!er)
75
	  { do
75
	  { do
76
	    {
76
	    {
77
	      if (fread((char *)&sep,1,1,fp)!=1)
77
	      if (fread((uint8_t *)&sep,1,1,fp)!=1)
78
		er=imREAD_ERROR;
78
		er=imREAD_ERROR;
79
	    } while (!er && sep!=',');
79
	    } while (!er && sep!=',');
80
            fread((char *)&gif_image.xoff,2,1,fp);
80
            fread((uint8_t *)&gif_image.xoff,2,1,fp);
81
            gif_image.xoff=int_to_local(gif_image.xoff);
81
            gif_image.xoff=uint16_to_local(gif_image.xoff);
82
            fread((char *)&gif_image.yoff,2,1,fp);
82
            fread((uint8_t *)&gif_image.yoff,2,1,fp);
83
            gif_image.yoff=int_to_local(gif_image.yoff);
83
            gif_image.yoff=uint16_to_local(gif_image.yoff);
84
            fread((char *)&gif_image.w,2,1,fp);
84
            fread((uint8_t *)&gif_image.w,2,1,fp);
85
            gif_image.w=int_to_local(gif_image.w);
85
            gif_image.w=uint16_to_local(gif_image.w);
86
            fread((char *)&gif_image.h,2,1,fp);
86
            fread((uint8_t *)&gif_image.h,2,1,fp);
87
            gif_image.h=int_to_local(gif_image.h);
87
            gif_image.h=uint16_to_local(gif_image.h);
88
	    if (!er && (fread((char *)&gif_image.color_info,1,1,fp)==1))
88
	    if (!er && (fread((uint8_t *)&gif_image.color_info,1,1,fp)==1))
89
	    {
89
	    {
90
	      if (gif_image.color_info&128)
90
	      if (gif_image.color_info&128)
91
	      {
91
	      {
Lines 94-100 Link Here
94
		make_block(sizeof(palette));
94
		make_block(sizeof(palette));
95
		pal = new palette(ncolors);
95
		pal = new palette(ncolors);
96
		if (pal)
96
		if (pal)
97
		{ if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
97
		{ if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
98
		} else er=imMEMORY_ERROR;
98
		} else er=imMEMORY_ERROR;
99
	      }
99
	      }
100
100
(-)abuse-sdl-0.7.0.orig/src/imlib/jmalloc.cpp (-108 / +112 lines)
Lines 1-23 Link Here
1
#include <stdlib.h>
1
#include <stdlib.h>
2
#include <string.h>
2
#include <string.h>
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <stdint.h>
4
5
5
#include <specs.hpp>
6
#include <specs.hpp>
6
//#include <new.h>
7
//#include <new.h>
7
8
9
#define MEM_CHECK
8
//#ifdef MEM_CHECK
10
//#ifdef MEM_CHECK
9
//#define MEM_CLEAR
11
//#define MEM_CLEAR
10
//#endif
12
//#endif
11
13
12
#include "jmalloc.hpp"
14
#include "jmalloc.hpp"
13
#define uchar unsigned char
14
#define JM_SMALL_SIZE 128      // above 128 bytes is considered to be a big block and no hashing is done
15
#define JM_SMALL_SIZE 128      // above 128 bytes is considered to be a big block and no hashing is done
15
int alloc_space=ALLOC_SPACE_STATIC;
16
int alloc_space=ALLOC_SPACE_STATIC;
16
17
17
extern void free_up_memory();
18
extern void free_up_memory();
18
19
19
#ifdef MEM_CHECK
20
#ifdef MEM_CHECK
20
long break_mem_point=0;       // can be set in debugger, break mem fun will be called when this address is allocated
21
intptr_t break_mem_point=0;       // can be set in debugger, break mem fun will be called when this address is allocated
21
void break_mem_fun()
22
void break_mem_fun()
22
{
23
{
23
  printf("memory breakpoint\n");
24
  printf("memory breakpoint\n");
Lines 26-32 Link Here
26
27
27
struct memory_node
28
struct memory_node
28
{
29
{
29
  long size;
30
  int32_t size;
30
#ifdef MEM_CHECK
31
#ifdef MEM_CHECK
31
  char *name;                     // name is allocated on regular heap
32
  char *name;                     // name is allocated on regular heap
32
#endif                            // because it is used for debugging purposes
33
#endif                            // because it is used for debugging purposes
Lines 37-45 Link Here
37
38
38
struct small_block
39
struct small_block
39
{  
40
{  
40
  unsigned long size;                     // size of blocks...
41
  uint32_t size;             // size of blocks...
41
  unsigned long alloc_list;               // bit field saying weither each block is allocated or not.
42
  uint32_t alloc_list;            // bit field saying weither each block is allocated or not.
42
  small_block *next;                      // next small block of same size
43
  small_block *next;              // next small block of same size
43
#ifdef MEM_CHECK
44
#ifdef MEM_CHECK
44
  char *name[32];
45
  char *name[32];
45
#endif 
46
#endif 
Lines 51-73 Link Here
51
{
52
{
52
  public :
53
  public :
53
54
54
  long block_size;                             // size of this memory_block
55
  int32_t block_size;                             // size of this memory_block
55
  small_block *sblocks[JM_SMALL_SIZE];
56
  small_block *sblocks[JM_SMALL_SIZE];
56
  small_block *cblocks[JM_SMALL_SIZE];
57
  small_block *cblocks[JM_SMALL_SIZE];
57
  void *addr;
58
  void *addr;
58
59
59
  memory_node *sfirst,*slast,
60
  memory_node *sfirst,*slast,
60
              *cfirst;
61
              *cfirst;
61
  unsigned char block_type;
62
  uint8_t block_type;
62
63
63
  void init(void *block, long Block_size, uchar type);
64
  void init(void *block, int32_t Block_size, uint8_t type);
64
  void *static_alloc(long size, char *name);
65
  void *static_alloc(int32_t size, char *name);
65
  void *cache_alloc(long size, char *name);
66
  void *cache_alloc(int32_t size, char *name);
66
  void static_free(void *ptr);
67
  void static_free(void *ptr);
67
  void cache_free(void *ptr);
68
  void cache_free(void *ptr);
68
  long available();
69
  int32_t available();
69
  long allocated();
70
  int32_t allocated();
70
  long pointer_size(void *ptr);
71
  int32_t pointer_size(void *ptr);
71
  void report(FILE *fp);
72
  void report(FILE *fp);
72
  void inspect();
73
  void inspect();
73
74
Lines 87-93 Link Here
87
88
88
int block_manager::valid_static_ptr(void *ptr)
89
int block_manager::valid_static_ptr(void *ptr)
89
{
90
{
90
  void *next=(void *)(*(((long *)ptr)-1));
91
  void *next=(void *)(*(((int32_t *)ptr)-1));
91
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
92
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
92
  {
93
  {
93
    small_block *s=(small_block *)next;
94
    small_block *s=(small_block *)next;
Lines 108-114 Link Here
108
109
109
int block_manager::valid_cache_ptr(void *ptr)
110
int block_manager::valid_cache_ptr(void *ptr)
110
{
111
{
111
  void *next=(void *)(*(((long *)ptr)-1));
112
  void *next=(void *)(*(((int32_t *)ptr)-1));
112
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
113
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
113
  {
114
  {
114
    small_block *s=(small_block *)next;
115
    small_block *s=(small_block *)next;
Lines 143-163 Link Here
143
      small_block *s=bmanage[i].sblocks[size];
144
      small_block *s=bmanage[i].sblocks[size];
144
      while (s) 
145
      while (s) 
145
      { 
146
      { 
146
				for (x=0;x<32;x++)
147
	for (x=0;x<32;x++)
147
				  if (s->alloc_list&(1<<x))
148
	  if (s->alloc_list&(1<<x))
148
				    static_list[size]++; 
149
	    static_list[size]++; 
149
			
150
150
				s=s->next; 
151
	s=s->next; 
151
      }
152
      }
152
153
153
      s=bmanage[i].cblocks[size];
154
      s=bmanage[i].cblocks[size];
154
      while (s) 
155
      while (s) 
155
      { 
156
      { 
156
				for (x=0;x<32;x++)
157
	for (x=0;x<32;x++)
157
				  if (s->alloc_list&(1<<x))
158
	  if (s->alloc_list&(1<<x))
158
				    cache_list[size]++; 
159
	    cache_list[size]++; 
159
			
160
160
				s=s->next; 
161
	s=s->next; 
161
      }
162
      }
162
    }
163
    }
163
  }
164
  }
Lines 168-174 Link Here
168
  memory_node *f=sfirst;
169
  memory_node *f=sfirst;
169
  for (;f;f=f->next);               // scan through static big list
170
  for (;f;f=f->next);               // scan through static big list
170
171
171
  int i,bit;
172
  int i,bit=1;
172
  for (i=0;i<JM_SMALL_SIZE;i++)
173
  for (i=0;i<JM_SMALL_SIZE;i++)
173
  {
174
  {
174
    for (small_block *s=sblocks[i];s;s=s->next)
175
    for (small_block *s=sblocks[i];s;s=s->next)
Lines 176-192 Link Here
176
      char *addr=((char *)(s+1));
177
      char *addr=((char *)(s+1));
177
      for (int j=0;j<32;j++)
178
      for (int j=0;j<32;j++)
178
      {
179
      {
179
				if (s->alloc_list&bit)
180
	if (s->alloc_list&bit)
180
				{
181
	{
181
				  void *next=(void *)(*(((long *)addr)));
182
	  void *next=(void *)(*(((intptr_t *)addr)));
182
				  if ((long)next!=(long)s)
183
	  if ((intptr_t)next!=(intptr_t)s)
183
				  {
184
	  {
184
				    fprintf(stderr,"inspect : bad pointer\n");
185
	    fprintf(stderr,"inspect : bad pointer\n");
185
				    return ;	    
186
	    return ;	    
186
				  }
187
	  }
187
				}
188
	}
188
				bit=bit<<1;
189
	bit=bit<<1;
189
				addr+=s->size+4;
190
	addr+=s->size+4;
190
      }	
191
      }	
191
    }
192
    }
192
  }
193
  }
Lines 214-234 Link Here
214
    for (small_block *s=sblocks[i];s;s=s->next)
215
    for (small_block *s=sblocks[i];s;s=s->next)
215
    {      
216
    {      
216
      fprintf(fp,"*** Small Block size = %d ***\n",i);      
217
      fprintf(fp,"*** Small Block size = %d ***\n",i);      
217
      unsigned long x=0,bit=1;
218
      uint32_t bit=1;
218
      char *addr=((char *)(s+1));
219
      char *addr=((char *)(s+1));
219
      for (int j=0;j<32;j++)
220
      for (int j=0;j<32;j++)
220
      {
221
      {
221
				fprintf(fp,"%p   ",addr);
222
	fprintf(fp,"%p   ",addr);
222
				if (s->alloc_list&bit)
223
	if (s->alloc_list&bit)
223
				{
224
	{
224
#ifdef MEM_CHECK
225
#ifdef MEM_CHECK
225
				  fprintf(fp,"%s\n",s->name[j]);
226
	  fprintf(fp,"%s\n",s->name[j]);
226
#else
227
#else
227
				  fprintf(fp,"allocated\n");
228
	  fprintf(fp,"allocated\n");
228
#endif	  
229
#endif	  
229
				} else fprintf(fp,"FREE\n");
230
	} else fprintf(fp,"FREE\n");
230
				bit=bit<<1;
231
	bit=bit<<1;
231
				addr+=s->size+4;
232
	addr+=s->size+4;
232
      }
233
      }
233
    }
234
    }
234
  }
235
  }
Lines 251-257 Link Here
251
    for (small_block *s=cblocks[i];s;s=s->next)
252
    for (small_block *s=cblocks[i];s;s=s->next)
252
    {      
253
    {      
253
      fprintf(fp,"*** Small Block size = %d ***\n",i);      
254
      fprintf(fp,"*** Small Block size = %d ***\n",i);      
254
      unsigned long x=0,bit=1;
255
      uint32_t bit=1;
255
      char *addr=((char *)(s+1));
256
      char *addr=((char *)(s+1));
256
      for (int j=0;j<32;j++)
257
      for (int j=0;j<32;j++)
257
      {
258
      {
Lines 271-287 Link Here
271
  }
272
  }
272
}
273
}
273
274
274
long block_manager::pointer_size(void *ptr)
275
int32_t block_manager::pointer_size(void *ptr)
275
{
276
{
276
  void *next=(void *)(*(((long *)ptr)-1));
277
  void *next=(void *)(*(((intptr_t *)ptr)-1));
277
  if (next>ptr)
278
  if (next>ptr)
278
    return ((memory_node *)(((char *)ptr)-sizeof(memory_node)))->size;
279
    return ((memory_node *)(((char *)ptr)-sizeof(memory_node)))->size;
279
  else return ((small_block *)next)->size;
280
  else return ((small_block *)next)->size;
280
}
281
}
281
282
282
long block_manager::available()
283
int32_t block_manager::available()
283
{
284
{
284
  long size=0;
285
  int32_t size=0;
285
  memory_node *f;
286
  memory_node *f;
286
  for (f=sfirst;f;f=f->next)
287
  for (f=sfirst;f;f=f->next)
287
    if (f->size<0) size-=f->size;
288
    if (f->size<0) size-=f->size;
Lines 291-299 Link Here
291
  return size;
292
  return size;
292
}
293
}
293
294
294
long block_manager::allocated()
295
int32_t block_manager::allocated()
295
{
296
{
296
  long size=0;
297
  int32_t size=0;
297
  memory_node *f;
298
  memory_node *f;
298
  for (f=sfirst;f;f=f->next)
299
  for (f=sfirst;f;f=f->next)
299
    if (f->size>0) size+=f->size;
300
    if (f->size>0) size+=f->size;
Lines 303-309 Link Here
303
  return size;
304
  return size;
304
}
305
}
305
306
306
void block_manager::init(void *block, long Block_size, uchar type)
307
void block_manager::init(void *block, int32_t Block_size, uint8_t type)
307
{
308
{
308
  block_size=Block_size;
309
  block_size=Block_size;
309
  addr=block;
310
  addr=block;
Lines 323-329 Link Here
323
  block_type=type;
324
  block_type=type;
324
}
325
}
325
326
326
void *block_manager::static_alloc(long size, char *name)
327
void *block_manager::static_alloc(int32_t size, char *name)
327
{
328
{
328
  if (size<JM_SMALL_SIZE)
329
  if (size<JM_SMALL_SIZE)
329
  {
330
  {
Lines 339-353 Link Here
339
      s->size=size;
340
      s->size=size;
340
#ifdef MEM_CHECK
341
#ifdef MEM_CHECK
341
      s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
342
      s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
342
      if ((long)s==break_mem_point)
343
      if ((intptr_t)s==break_mem_point)
343
        break_mem_fun();
344
        break_mem_fun();
344
#endif      
345
#endif      
345
      long *addr=(long *)(((char *)s)+sizeof(small_block));
346
      intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
346
      *addr=(long)s;
347
      *addr=(intptr_t)s;
347
      return (void *)(addr+1);  // return first block
348
      return (void *)(addr+1);  // return first block
348
    } else
349
    } else
349
    {
350
    {
350
      int bit=1,i=0,offset=0;
351
      int bit=1,i=0;
351
      char *addr=((char *)s)+sizeof(small_block);
352
      char *addr=((char *)s)+sizeof(small_block);
352
      while (1)        // we already know there is a bit free
353
      while (1)        // we already know there is a bit free
353
      {
354
      {
Lines 357-366 Link Here
357
#ifdef MEM_CHECK
358
#ifdef MEM_CHECK
358
	  s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
359
	  s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
359
#endif      	 
360
#endif      	 
360
	  *((long *)addr)=(long)s;
361
	  *((intptr_t *)addr)=(intptr_t)s;
361
362
362
#ifdef MEM_CHECK
363
#ifdef MEM_CHECK
363
	  if ((long)addr==break_mem_point)
364
	  if ((intptr_t)addr==break_mem_point)
364
            break_mem_fun();
365
            break_mem_fun();
365
#endif
366
#endif
366
367
Lines 379-385 Link Here
379
  if (!s) return NULL;
380
  if (!s) return NULL;
380
  s->size=-s->size;
381
  s->size=-s->size;
381
382
382
  if (s->size-size>sizeof(memory_node)+4)  // is there enough space to split the block?
383
  if (s->size-size>(int)sizeof(memory_node)+4)  // is there enough space to split the block?
383
  {    
384
  {    
384
    memory_node *p=(memory_node *)((char *)s+sizeof(memory_node)+size);
385
    memory_node *p=(memory_node *)((char *)s+sizeof(memory_node)+size);
385
    if (s==slast)
386
    if (s==slast)
Lines 395-401 Link Here
395
#ifdef MEM_CHECK
396
#ifdef MEM_CHECK
396
  s->name=strcpy((char *)malloc(strlen(name)+1),name);
397
  s->name=strcpy((char *)malloc(strlen(name)+1),name);
397
398
398
  if ((long)s==break_mem_point)
399
  if ((intptr_t)s==break_mem_point)
399
    break_mem_fun();
400
    break_mem_fun();
400
401
401
#endif
402
#endif
Lines 403-409 Link Here
403
}
404
}
404
405
405
406
406
void *block_manager::cache_alloc(long size, char *name)
407
void *block_manager::cache_alloc(int32_t size, char *name)
407
{
408
{
408
  if (size<JM_SMALL_SIZE)
409
  if (size<JM_SMALL_SIZE)
409
  {
410
  {
Lines 421-436 Link Here
421
      s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
422
      s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
422
423
423
#endif      
424
#endif      
424
      long *addr=(long *)(((char *)s)+sizeof(small_block));
425
      intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
425
      *addr=(long)s;
426
      *addr=(intptr_t)s;
426
#ifdef MEM_CHECK
427
#ifdef MEM_CHECK
427
      if ((long)s==break_mem_point)
428
      if ((intptr_t)s==break_mem_point)
428
        break_mem_fun();
429
        break_mem_fun();
429
#endif
430
#endif
430
      return (void *)(addr+1);  // return first block
431
      return (void *)(addr+1);  // return first block
431
    } else
432
    } else
432
    {
433
    {
433
      int bit=1,i=0,offset=0;
434
      int bit=1,i=0;
434
      char *addr=((char *)s)+sizeof(small_block);
435
      char *addr=((char *)s)+sizeof(small_block);
435
      while (1)        // we already know there is a bit free
436
      while (1)        // we already know there is a bit free
436
      {
437
      {
Lines 439-448 Link Here
439
	  s->alloc_list|=bit;
440
	  s->alloc_list|=bit;
440
#ifdef MEM_CHECK
441
#ifdef MEM_CHECK
441
	  s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
442
	  s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
442
	  if ((long)s==break_mem_point)
443
	  if ((intptr_t)s==break_mem_point)
443
	    break_mem_fun();
444
	    break_mem_fun();
444
#endif      	 
445
#endif      	 
445
	  *((long *)addr)=(long)s;
446
	  *((intptr_t *)addr)=(intptr_t)s;
446
	  return (void *)(addr+4);
447
	  return (void *)(addr+4);
447
	}
448
	}
448
	i++;
449
	i++;
Lines 458-464 Link Here
458
  for (;s && -s->size<size;s=s->next) clast=s;
459
  for (;s && -s->size<size;s=s->next) clast=s;
459
  if (!s) // no current cache space for object, see if we can enlarge the cache space
460
  if (!s) // no current cache space for object, see if we can enlarge the cache space
460
  {
461
  {
461
    long size_avail=-slast->size;
462
    int32_t size_avail=-slast->size;
462
    size_avail-=sizeof(memory_node);
463
    size_avail-=sizeof(memory_node);
463
464
464
    if (slast->size>0 || size_avail<size) // not enough space
465
    if (slast->size>0 || size_avail<size) // not enough space
Lines 472-478 Link Here
472
      nc->size=size;
473
      nc->size=size;
473
#ifdef MEM_CHECK
474
#ifdef MEM_CHECK
474
      nc->name=strcpy((char *)malloc(strlen(name)+1),name);      
475
      nc->name=strcpy((char *)malloc(strlen(name)+1),name);      
475
      if ((long)nc==break_mem_point)
476
      if ((intptr_t)nc==break_mem_point)
476
        break_mem_fun();
477
        break_mem_fun();
477
#endif      
478
#endif      
478
      if (!clast)
479
      if (!clast)
Lines 485-494 Link Here
485
486
486
  s->size=-s->size;
487
  s->size=-s->size;
487
488
488
  if (s->size-size>sizeof(memory_node)+4)  // is there enough space to split the block?
489
  if (s->size-size>(int)sizeof(memory_node)+4)  // is there enough space to split the block?
489
  {
490
  {
490
    memory_node *p=s;    // store this position
491
    memory_node *p=s;    // store this position
491
    long psize=s->size-size-sizeof(memory_node);
492
    int32_t psize=s->size-size-sizeof(memory_node);
492
    s=(memory_node *)(((char *)s)+psize+sizeof(memory_node));
493
    s=(memory_node *)(((char *)s)+psize+sizeof(memory_node));
493
    p->size=-psize;
494
    p->size=-psize;
494
    s->next=p;
495
    s->next=p;
Lines 498-504 Link Here
498
  }
499
  }
499
#ifdef MEM_CHECK
500
#ifdef MEM_CHECK
500
  s->name=strcpy((char *)malloc(strlen(name)+1),name);
501
  s->name=strcpy((char *)malloc(strlen(name)+1),name);
501
  if ((long)s==break_mem_point)
502
  if ((intptr_t)s==break_mem_point)
502
    break_mem_fun();
503
    break_mem_fun();
503
#endif
504
#endif
504
  return (void *)(((char *)s)+sizeof(memory_node));
505
  return (void *)(((char *)s)+sizeof(memory_node));
Lines 512-518 Link Here
512
void block_manager::cache_free(void *ptr)
513
void block_manager::cache_free(void *ptr)
513
{
514
{
514
  // see if this was a small_block allocation
515
  // see if this was a small_block allocation
515
  void *next=(void *)(*(((long *)ptr)-1));
516
  void *next=(void *)(*(((int32_t *)ptr)-1));
516
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
517
  if (next && ((small_block *)next)->size<JM_SMALL_SIZE)  // small allocation
517
  {
518
  {
518
    small_block *s=(small_block *)next;
519
    small_block *s=(small_block *)next;
Lines 595-601 Link Here
595
void block_manager::static_free(void *ptr)
596
void block_manager::static_free(void *ptr)
596
{
597
{
597
  // see if this was a small_block allocation
598
  // see if this was a small_block allocation
598
  void *next=(void *)(*(((long *)ptr)-1));
599
  void *next=(void *)(*(((int32_t *)ptr)-1));
599
  if (next && next<ptr)  // small allocation
600
  if (next && next<ptr)  // small allocation
600
  {
601
  {
601
    small_block *s=(small_block *)next;
602
    small_block *s=(small_block *)next;
Lines 693-700 Link Here
693
				   "    - remove TSR's  & drivers not needed by ABUSE\n"
694
				   "    - remove TSR's  & drivers not needed by ABUSE\n"
694
				   "    - add memory to your system\n";
695
				   "    - add memory to your system\n";
695
696
696
void jmalloc_init(long min_size)
697
void jmalloc_init(int32_t min_size)
697
{
698
{
699
  fprintf(stderr,"Disabling memory manager, using libc instead\n");
700
  return;
701
698
  if (bmanage_total)
702
  if (bmanage_total)
699
    fprintf(stderr,"warning : jmalloc_init called twice\n");
703
    fprintf(stderr,"warning : jmalloc_init called twice\n");
700
  else
704
  else
Lines 703-709 Link Here
703
    void *mem;
707
    void *mem;
704
708
705
#ifdef __POWERPC__
709
#ifdef __POWERPC__
706
    long size=jmalloc_max_size-0x10000;
710
    int32_t size=jmalloc_max_size-0x10000;
707
    for (mem=NULL;!mem && size>0x10000;)
711
    for (mem=NULL;!mem && size>0x10000;)
708
    {
712
    {
709
      mem=malloc(size+0x10000);
713
      mem=malloc(size+0x10000);
Lines 712-718 Link Here
712
    free(mem);
716
    free(mem);
713
    mem = malloc(size);
717
    mem = malloc(size);
714
#else
718
#else
715
    long size=jmalloc_max_size;
719
    int32_t size=jmalloc_max_size;
716
    for (mem=NULL;!mem && size>0x4000;)
720
    for (mem=NULL;!mem && size>0x4000;)
717
    {
721
    {
718
      mem=malloc(size);
722
      mem=malloc(size);
Lines 721-729 Link Here
721
#endif
725
#endif
722
    if (mem)
726
    if (mem)
723
    {
727
    {
724
			bmanage[bmanage_total].init(mem,size,HI_BLOCK);
728
      bmanage[bmanage_total].init(mem,size,HI_BLOCK);
725
			bmanage_total++;      
729
      bmanage_total++;      
726
			fprintf(stderr,"Added himem block (%d bytes)\n",size);
730
      fprintf(stderr,"Added himem block (%d bytes)\n",size);
727
    }
731
    }
728
732
729
/*    bmanage[bmanage_total].init(malloc(2039552),2039552,HI_BLOCK);
733
/*    bmanage[bmanage_total].init(malloc(2039552),2039552,HI_BLOCK);
Lines 731-789 Link Here
731
    bmanage[bmanage_total].init(malloc(150224),150224,HI_BLOCK);
735
    bmanage[bmanage_total].init(malloc(150224),150224,HI_BLOCK);
732
    bmanage_total++;      */
736
    bmanage_total++;      */
733
737
734
735
736
#ifdef __WATCOMC__
738
#ifdef __WATCOMC__
737
    if (size!=jmalloc_max_size)
739
    if (size!=jmalloc_max_size)
738
    {
740
    {
739
      do
741
      do
740
      {
742
      {
741
				size=low_memory_available();
743
	size=low_memory_available();
742
				if (size>jmalloc_min_low_size+0x1000)              // save 64K for misc low memory needs
744
	if (size>jmalloc_min_low_size+0x1000)              // save 64K for misc low memory needs
743
				{
745
	{
744
				  bmanage[bmanage_total].init(alloc_low_memory(size-jmalloc_min_low_size-0x1000),size-jmalloc_min_low_size-0x1000,LOW_BLOCK);
746
	  bmanage[bmanage_total].init(alloc_low_memory(size-jmalloc_min_low_size-0x1000),size-jmalloc_min_low_size-0x1000,LOW_BLOCK);
745
				  bmanage_total++; 
747
	  bmanage_total++; 
746
				  fprintf(stderr,"Added low memory block (%d bytes)\n",size);
748
	  fprintf(stderr,"Added low memory block (%d bytes)\n",size);
747
				}
749
	}
748
      } while (size>jmalloc_min_low_size+0x1000);
750
      } while (size>jmalloc_min_low_size+0x1000);
749
      if (size<jmalloc_min_low_size)
751
      if (size<jmalloc_min_low_size)
750
      {
752
      {
751
				fprintf(stderr,not_enough_low_memory_message,size,jmalloc_min_low_size);
753
	fprintf(stderr,not_enough_low_memory_message,size,jmalloc_min_low_size);
752
				exit(0);
754
	exit(0);
753
      }
755
      }
754
    }
756
    }
755
#endif
757
#endif
756
 
758
 
757
758
    fprintf(stderr,"Memory available : %d\n",j_available());
759
    fprintf(stderr,"Memory available : %d\n",j_available());
759
    if (j_available()<min_size)
760
    if (j_available()<min_size)
760
    {
761
    {
761
      fprintf(stderr,not_enough_total_memory_message);
762
      fprintf(stderr,not_enough_total_memory_message);
762
      exit(0);
763
      exit(0);
763
    }
764
    }
764
765
  }
765
  }
766
}
766
}
767
767
768
768
769
long j_available()
769
int32_t j_available()
770
{
770
{
771
  long size=0;
771
  int32_t size=0;
772
  for (int i=0;i<bmanage_total;i++) 
772
  for (int i=0;i<bmanage_total;i++) 
773
    size+=bmanage[i].available();
773
    size+=bmanage[i].available();
774
  return size;
774
  return size;
775
}
775
}
776
776
777
long j_allocated()
777
int32_t j_allocated()
778
{
778
{
779
  long size=0;
779
  int32_t size=0;
780
  for (int i=0;i<bmanage_total;i++) 
780
  for (int i=0;i<bmanage_total;i++) 
781
    size+=bmanage[i].allocated();
781
    size+=bmanage[i].allocated();
782
  return size;
782
  return size;
783
}
783
}
784
784
785
785
786
void *jmalloc(long size, char *name)
786
void *jmalloc(int32_t size, char *name)
787
{  
787
{  
788
  if (!bmanage_total)
788
  if (!bmanage_total)
789
    return malloc(size);
789
    return malloc(size);
Lines 795-803 Link Here
795
    {
795
    {
796
      void *a;
796
      void *a;
797
      if (alloc_space==ALLOC_SPACE_STATIC)
797
      if (alloc_space==ALLOC_SPACE_STATIC)
798
      {
798
        a=bmanage[i].static_alloc(size,name);
799
        a=bmanage[i].static_alloc(size,name);
800
      }
799
      else
801
      else
802
      {
800
        a=bmanage[i].cache_alloc(size,name);
803
        a=bmanage[i].cache_alloc(size,name);
804
      }
801
      if (a) return a;
805
      if (a) return a;
802
    }
806
    }
803
    free_up_memory();
807
    free_up_memory();
Lines 832-845 Link Here
832
}
836
}
833
837
834
838
835
void *jrealloc(void *ptr, long size, char *name)
839
void *jrealloc(void *ptr, int32_t size, char *name)
836
{  
840
{  
837
  if (!ptr) return jmalloc(size,name);
841
  if (!ptr) return jmalloc(size,name);
838
  if (!bmanage_total) { return realloc(ptr,size); }
842
  if (!bmanage_total) { return realloc(ptr,size); }
839
843
840
  if (size==0) { jfree(ptr); return NULL; }
844
  if (size==0) { jfree(ptr); return NULL; }
841
845
842
  long old_size=0;
846
  int32_t old_size=0;
843
  for (int i=0;i<bmanage_total;i++)
847
  for (int i=0;i<bmanage_total;i++)
844
    if (ptr>=(void *)bmanage[i].sfirst && 
848
    if (ptr>=(void *)bmanage[i].sfirst && 
845
	ptr<=(void *)(((char *)bmanage[i].sfirst)+bmanage[i].block_size))
849
	ptr<=(void *)(((char *)bmanage[i].sfirst)+bmanage[i].block_size))
Lines 880-887 Link Here
880
void mem_report(char *filename)
884
void mem_report(char *filename)
881
{
885
{
882
	char *reportpath;
886
	char *reportpath;
883
	reportpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + strlen( filename ), "reportpath" );
887
	reportpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + strlen( filename ) + 1, "reportpath" );
884
	sprintf( reportpath, "%s%s\0", get_save_filename_prefix(), filename );
888
	sprintf( reportpath, "%s%s", get_save_filename_prefix(), filename );
885
889
886
	FILE *fp = fopen( reportpath, "wb" );
890
	FILE *fp = fopen( reportpath, "wb" );
887
	if( fp != NULL )	/* make sure we actually got a file */
891
	if( fp != NULL )	/* make sure we actually got a file */
Lines 906-914 Link Here
906
}
910
}
907
911
908
912
909
long small_ptr_size(void *ptr)
913
int32_t small_ptr_size(void *ptr)
910
{
914
{
911
  return ((small_block *)(((long *)ptr)[-1]))->size;
915
  return ((small_block *)(((int32_t *)ptr)[-1]))->size;
912
}
916
}
913
917
914
918
(-)abuse-sdl-0.7.0.orig/src/imlib/include.cpp (-1 / +2 lines)
Lines 5-11 Link Here
5
{
5
{
6
  char tmp_name[200];
6
  char tmp_name[200];
7
  strcpy(tmp_name,name);
7
  strcpy(tmp_name,name);
8
  int j,append=0,i;
8
  unsigned int j;
9
  int append=0,i;
9
  for (j=0;j<strlen(name);j++)
10
  for (j=0;j<strlen(name);j++)
10
    if (toupper(tmp_name[j])<'A' || toupper(tmp_name[j])>'Z')
11
    if (toupper(tmp_name[j])<'A' || toupper(tmp_name[j])>'Z')
11
      tmp_name[j]='_';
12
      tmp_name[j]='_';
(-)abuse-sdl-0.7.0.orig/src/imlib/scroller.cpp (-15 / +15 lines)
Lines 3-9 Link Here
3
#define HS_ICON_H 8
3
#define HS_ICON_H 8
4
4
5
5
6
unsigned char hs_left_arrow[10*8]={
6
uint8_t hs_left_arrow[10*8]={
7
    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
7
    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
8
    0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
8
    0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
9
    1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
9
    1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
Lines 12-18 Link Here
12
    2, 0, 0, 0, 0};
12
    2, 0, 0, 0, 0};
13
13
14
14
15
unsigned char hs_right_arrow[10*8]={
15
uint8_t hs_right_arrow[10*8]={
16
    0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
16
    0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
17
    0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
17
    0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
18
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
18
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
Lines 21-27 Link Here
21
    1, 1, 0, 0, 0};
21
    1, 1, 0, 0, 0};
22
22
23
23
24
unsigned char vs_up_arrow[8*10]={
24
uint8_t vs_up_arrow[8*10]={
25
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0,
25
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0,
26
    0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2,
26
    0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2,
27
    1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
27
    1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
Lines 30-36 Link Here
30
    0, 2, 2, 0, 0};
30
    0, 2, 2, 0, 0};
31
31
32
32
33
unsigned char vs_down_arrow[8*10]={
33
uint8_t vs_down_arrow[8*10]={
34
    0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0,
34
    0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0,
35
    0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 2,
35
    0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 2,
36
    0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
36
    0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
Lines 38-48 Link Here
38
    1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0,
38
    1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0,
39
    0, 0, 0, 0, 0};
39
    0, 0, 0, 0, 0};
40
40
41
void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, unsigned char *buf)
41
void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, uint8_t *buf)
42
{
42
{
43
  short cx1,cy1,cx2,cy2;
43
  short cx1,cy1,cx2,cy2;
44
  screen->get_clip(cx1,cy1,cx2,cy2);
44
  screen->get_clip(cx1,cy1,cx2,cy2);
45
  unsigned char remap[3];
45
  uint8_t remap[3];
46
  remap[0]=wm->medium_color();
46
  remap[0]=wm->medium_color();
47
  remap[1]=wm->bright_color();
47
  remap[1]=wm->bright_color();
48
  remap[2]=wm->dark_color();
48
  remap[2]=wm->dark_color();
Lines 51-57 Link Here
51
  {
51
  {
52
    if (y>=cy1 && y<=cy2)
52
    if (y>=cy1 && y<=cy2)
53
    {
53
    {
54
      unsigned char *sl=screen->scan_line(y)+x;
54
      uint8_t *sl=screen->scan_line(y)+x;
55
      for (int xc=icw,xo=x;xc;xc--,xo++,sl++,buf++)
55
      for (int xc=icw,xo=x;xc;xc--,xo++,sl++,buf++)
56
      {
56
      {
57
	if (xo>=cx1 && xo<=cx2)
57
	if (xo>=cx1 && xo<=cx2)
Lines 87-99 Link Here
87
int scroller::bh() { if (vert) return 15; else return 13; }
87
int scroller::bh() { if (vert) return 15; else return 13; }
88
int scroller::bw() { if (vert) return 12; else return 14; }
88
int scroller::bw() { if (vert) return 12; else return 14; }
89
89
90
unsigned char *scroller::b1()
90
uint8_t *scroller::b1()
91
{
91
{
92
  if (vert) return vs_up_arrow;
92
  if (vert) return vs_up_arrow;
93
  else return hs_left_arrow;
93
  else return hs_left_arrow;
94
}
94
}
95
95
96
unsigned char *scroller::b2()
96
uint8_t *scroller::b2()
97
{
97
{
98
  if (vert) return vs_down_arrow;
98
  if (vert) return vs_down_arrow;
99
  else return hs_right_arrow;
99
  else return hs_right_arrow;
Lines 347-353 Link Here
347
void scroller::scroll_event(int newx, image *screen, window_manager *wm)
347
void scroller::scroll_event(int newx, image *screen, window_manager *wm)
348
{
348
{
349
  screen->bar(x,y,x+l-1,y+h-1,wm->black());
349
  screen->bar(x,y,x+l-1,y+h-1,wm->black());
350
  int xa,ya,xo,yo;
350
  int xa,ya,xo=0,yo;
351
  if (vert) { xa=0; ya=30; yo=x+5; yo=y+5; } else { xa=30; ya=0; xo=x+5; yo=y+5; }
351
  if (vert) { xa=0; ya=30; yo=x+5; yo=y+5; } else { xa=30; ya=0; xo=x+5; yo=y+5; }
352
  for (int i=newx,c=0;c<30 && i<100;i++,c++)
352
  for (int i=newx,c=0;c<30 && i<100;i++,c++)
353
  {
353
  {
Lines 390-396 Link Here
390
  qsort((void *)lis,num_entries,sizeof(pick_list_item),lis_sort);
390
  qsort((void *)lis,num_entries,sizeof(pick_list_item),lis_sort);
391
391
392
  for (i=0;i<t;i++)
392
  for (i=0;i<t;i++)
393
    if (strlen(List[i])>wid) 
393
    if ((int)strlen(List[i])>wid) 
394
      wid=strlen(List[i]);
394
      wid=strlen(List[i]);
395
  cur_sel=sx=start_yoffset;
395
  cur_sel=sx=start_yoffset;
396
}
396
}
Lines 425-435 Link Here
425
  {
425
  {
426
    int found=-1;
426
    int found=-1;
427
    if (key_hist_total<20)
427
    if (key_hist_total<20)
428
      key_hist[key_hist_total++]=ev.key;
428
      key_hist[(int)(key_hist_total++)]=ev.key;
429
429
430
    for (int i=0;i<t && found==-1;i++)
430
    for (int i=0;i<t && found==-1;i++)
431
    {
431
    {
432
      if (strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0)
432
      if ((int)strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0)
433
	found=i;
433
	found=i;
434
    }
434
    }
435
    if (found!=-1)
435
    if (found!=-1)
Lines 479-485 Link Here
479
    screen->set_clip(x,y,x+l-1,y+h-1);
479
    screen->set_clip(x,y,x+l-1,y+h-1);
480
    int tw=(l+tex->width()-1)/tex->width();
480
    int tw=(l+tex->width()-1)/tex->width();
481
    int th=(h+tex->height()-1)/tex->height();
481
    int th=(h+tex->height()-1)/tex->height();
482
    int dy=y,dx;
482
    int dy=y;
483
    for (int j=0;j<th;j++,dy+=tex->height())
483
    for (int j=0;j<th;j++,dy+=tex->height())
484
      for (int i=0,dx=x;i<tw;i++,dx+=tex->width())      
484
      for (int i=0,dx=x;i<tw;i++,dx+=tex->width())      
485
        tex->put_image(screen,dx,dy);
485
        tex->put_image(screen,dx,dy);
Lines 552-558 Link Here
552
    sx=t-1;
552
    sx=t-1;
553
  if (m)
553
  if (m)
554
  {
554
  {
555
    select=(uchar *)jmalloc((t+7)/8,"selection bit array");
555
    select=(uint8_t *)jmalloc((t+7)/8,"selection bit array");
556
    memset(select,0,(t+7)/8);
556
    memset(select,0,(t+7)/8);
557
  } else cur_sel=0;
557
  } else cur_sel=0;
558
}
558
}
(-)abuse-sdl-0.7.0.orig/src/imlib/filter.cpp (-4 / +4 lines)
Lines 171-177 Link Here
171
color_filter::color_filter(spec_entry *e, bFILE *fp)
171
color_filter::color_filter(spec_entry *e, bFILE *fp)
172
{
172
{
173
  fp->seek(e->offset,0);
173
  fp->seek(e->offset,0);
174
  fp->read_short();
174
  fp->read_uint16();
175
  int colors=32;
175
  int colors=32;
176
  color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded");
176
  color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded");
177
  fp->read(color_table,colors*colors*colors);
177
  fp->read(color_table,colors*colors*colors);
Lines 186-192 Link Here
186
int color_filter::write(bFILE *fp)
186
int color_filter::write(bFILE *fp)
187
{
187
{
188
  int colors=32;
188
  int colors=32;
189
  fp->write_short(colors);
189
  fp->write_uint16(colors);
190
  return fp->write(color_table,colors*colors*colors)==colors*colors*colors;
190
  return fp->write(color_table,colors*colors*colors)==colors*colors*colors;
191
}
191
}
192
192
Lines 219-226 Link Here
219
219
220
  screen->add_dirty(x,y,x+xl-1,y+yl-1);
220
  screen->add_dirty(x,y,x+xl-1,y+yl-1);
221
221
222
  uchar *pg1=screen->scan_line(y),*source,*dest;
222
  uint8_t *pg1=screen->scan_line(y),*source,*dest;
223
  uchar *pg2=im->scan_line(y1);
223
  uint8_t *pg2=im->scan_line(y1);
224
  int i;
224
  int i;
225
  for (int j=0;j<yl;j++)        
225
  for (int j=0;j<yl;j++)        
226
  {
226
  {
(-)abuse-sdl-0.7.0.orig/src/imlib/pcxread.cpp (-16 / +16 lines)
Lines 17-33 Link Here
17
  if (!fread(&PCX_header.version,1,1,fp)) return 0;  
17
  if (!fread(&PCX_header.version,1,1,fp)) return 0;  
18
  if (!fread(&PCX_header.encoding,1,1,fp)) return 0;  
18
  if (!fread(&PCX_header.encoding,1,1,fp)) return 0;  
19
  if (!fread(&PCX_header.bits_per_pixel,1,1,fp)) return 0;  
19
  if (!fread(&PCX_header.bits_per_pixel,1,1,fp)) return 0;  
20
  PCX_header.xmin=read_short(fp);
20
  PCX_header.xmin=read_uint16(fp);
21
  PCX_header.ymin=read_short(fp);  
21
  PCX_header.ymin=read_uint16(fp);  
22
  PCX_header.xmax=read_short(fp);
22
  PCX_header.xmax=read_uint16(fp);
23
  PCX_header.ymax=read_short(fp);
23
  PCX_header.ymax=read_uint16(fp);
24
  PCX_header.hres=read_short(fp);
24
  PCX_header.hres=read_uint16(fp);
25
  PCX_header.vres=read_short(fp);
25
  PCX_header.vres=read_uint16(fp);
26
  if (!fread(PCX_header.palette,1,48,fp)) return 0;
26
  if (!fread(PCX_header.palette,1,48,fp)) return 0;
27
  if (!fread(&PCX_header.reserved,1,1,fp)) return 0;
27
  if (!fread(&PCX_header.reserved,1,1,fp)) return 0;
28
  if (!fread(&PCX_header.color_planes,1,1,fp)) return 0;
28
  if (!fread(&PCX_header.color_planes,1,1,fp)) return 0;
29
  PCX_header.bytes_per_line=read_short(fp); 
29
  PCX_header.bytes_per_line=read_uint16(fp); 
30
  PCX_header.palette_type=read_short(fp); 
30
  PCX_header.palette_type=read_uint16(fp); 
31
  if (!fread(PCX_header.filter,1,58,fp)) return 0;
31
  if (!fread(PCX_header.filter,1,58,fp)) return 0;
32
  return 1;
32
  return 1;
33
}
33
}
Lines 38-54 Link Here
38
  if (!fwrite(&PCX_header.version,1,1,fp)) return 0;  
38
  if (!fwrite(&PCX_header.version,1,1,fp)) return 0;  
39
  if (!fwrite(&PCX_header.encoding,1,1,fp)) return 0;  
39
  if (!fwrite(&PCX_header.encoding,1,1,fp)) return 0;  
40
  if (!fwrite(&PCX_header.bits_per_pixel,1,1,fp)) return 0;  
40
  if (!fwrite(&PCX_header.bits_per_pixel,1,1,fp)) return 0;  
41
  write_short(fp,PCX_header.xmin);
41
  write_uint16(fp,PCX_header.xmin);
42
  write_short(fp,PCX_header.ymin);  
42
  write_uint16(fp,PCX_header.ymin);  
43
  write_short(fp,PCX_header.xmax);
43
  write_uint16(fp,PCX_header.xmax);
44
  write_short(fp,PCX_header.ymax);
44
  write_uint16(fp,PCX_header.ymax);
45
  write_short(fp,PCX_header.hres);
45
  write_uint16(fp,PCX_header.hres);
46
  write_short(fp,PCX_header.vres);
46
  write_uint16(fp,PCX_header.vres);
47
  if (!fwrite(PCX_header.palette,1,48,fp)) return 0;
47
  if (!fwrite(PCX_header.palette,1,48,fp)) return 0;
48
  if (!fwrite(&PCX_header.reserved,1,1,fp)) return 0;
48
  if (!fwrite(&PCX_header.reserved,1,1,fp)) return 0;
49
  if (!fwrite(&PCX_header.color_planes,1,1,fp)) return 0;
49
  if (!fwrite(&PCX_header.color_planes,1,1,fp)) return 0;
50
  write_short(fp,PCX_header.bytes_per_line); 
50
  write_uint16(fp,PCX_header.bytes_per_line); 
51
  write_short(fp,PCX_header.palette_type); 
51
  write_uint16(fp,PCX_header.palette_type); 
52
  if (!fwrite(PCX_header.filter,1,58,fp)) return 0;
52
  if (!fwrite(PCX_header.filter,1,58,fp)) return 0;
53
  return 1;
53
  return 1;
54
}
54
}
(-)abuse-sdl-0.7.0.orig/src/imlib/readwav.cpp (-18 / +18 lines)
Lines 37-66 Link Here
37
void read_chunk(wav_chunk &chunk, bFILE *fp)
37
void read_chunk(wav_chunk &chunk, bFILE *fp)
38
{
38
{
39
  fp->read(&chunk.id,4);
39
  fp->read(&chunk.id,4);
40
  chunk.size=fp->read_long();
40
  chunk.size=fp->read_uint32();
41
  fp->read(&chunk.type,4);  
41
  fp->read(&chunk.type,4);  
42
}
42
}
43
43
44
void read_tag(wav_tag &tag, bFILE *fp)
44
void read_tag(wav_tag &tag, bFILE *fp)
45
{
45
{
46
  fp->read(&tag.id,4);
46
  fp->read(&tag.id,4);
47
  tag.size=fp->read_long();
47
  tag.size=fp->read_uint32();
48
}
48
}
49
49
50
void read_wav_format(wav_format &fmt, bFILE *fp)
50
void read_wav_format(wav_format &fmt, bFILE *fp)
51
{
51
{
52
  fmt.fmt_tag=fp->read_short();
52
  fmt.fmt_tag=fp->read_uint16();
53
  fmt.channels=fp->read_short(); 
53
  fmt.channels=fp->read_uint16(); 
54
  fmt.samplesps=fp->read_long();
54
  fmt.samplesps=fp->read_uint32();
55
  fmt.avg_bytesps=fp->read_long();  
55
  fmt.avg_bytesps=fp->read_uint32();  
56
  fmt.align=fp->read_short();  
56
  fmt.align=fp->read_uint16();  
57
}
57
}
58
58
59
59
60
void read_pcm(pcm_wave &pcm, bFILE *fp)
60
void read_pcm(pcm_wave &pcm, bFILE *fp)
61
{
61
{
62
  read_wav_format(pcm.wf,fp);
62
  read_wav_format(pcm.wf,fp);
63
  pcm.bitsps=fp->read_short();  
63
  pcm.bitsps=fp->read_uint16();  
64
}
64
}
65
65
66
66
Lines 77-102 Link Here
77
77
78
  /***************  Write the chunk ***************************/
78
  /***************  Write the chunk ***************************/
79
  fp->write((void *)"RIFF",4);  
79
  fp->write((void *)"RIFF",4);  
80
  fp->write_long(data_size+36);
80
  fp->write_uint32(data_size+36);
81
  fp->write((void *)"WAVE",4);
81
  fp->write((void *)"WAVE",4);
82
82
83
83
84
  /************** Write the tag *******************************/
84
  /************** Write the tag *******************************/
85
  fp->write((void *)"fmt ",4);
85
  fp->write((void *)"fmt ",4);
86
  fp->write_long(16);
86
  fp->write_uint32(16);
87
  
87
  
88
  
88
  
89
  /************** Write PCM ***********************************/
89
  /************** Write PCM ***********************************/
90
  fp->write_short(1);          // format_tag
90
  fp->write_uint16(1);          // format_tag
91
  fp->write_short(1);          // mono recording
91
  fp->write_uint16(1);          // mono recording
92
  fp->write_long(sample_rate);
92
  fp->write_uint32(sample_rate);
93
  fp->write_long(sample_rate);   // average bytes per sec
93
  fp->write_uint32(sample_rate);   // average bytes per sec
94
  fp->write_short(1);    // allignment? Don't know what this does?
94
  fp->write_uint16(1);    // alignment? Don't know what this does?
95
  fp->write_short(8);    // 8 bits per sample
95
  fp->write_uint16(8);    // 8 bits per sample
96
  
96
  
97
  /************* Write data tag ******************************/
97
  /************* Write data tag ******************************/
98
  fp->write((void *)"data",4);
98
  fp->write((void *)"data",4);
99
  fp->write_long(data_size);
99
  fp->write_uint32(data_size);
100
100
101
  /************ Now write sample data ************************/
101
  /************ Now write sample data ************************/
102
  fp->write(data,data_size);
102
  fp->write(data,data_size);
Lines 154-160 Link Here
154
  ERROR((unsigned int)fp->read(data,tag.size)==tag.size,"Premature end of file");
154
  ERROR((unsigned int)fp->read(data,tag.size)==tag.size,"Premature end of file");
155
  ERROR(pcm.bitsps==8,"Only 8-bit samples supported");
155
  ERROR(pcm.bitsps==8,"Only 8-bit samples supported");
156
  ERROR(pcm.wf.channels==1,"Only mono samples supported");  
156
  ERROR(pcm.wf.channels==1,"Only mono samples supported");  
157
  ERROR(pcm.wf.align==1,"Bad block allignment");   
157
  ERROR(pcm.wf.align==1,"Bad block alignment");   
158
  delete fp;
158
  delete fp;
159
  return data;
159
  return data;
160
}
160
}
(-)abuse-sdl-0.7.0.orig/src/imlib/xwdread.cpp (-61 / +56 lines)
Lines 122-146 Link Here
122
int bits_per_item, bits_used, bit_shift, bits_per_pixel, pixel_mask;
122
int bits_per_item, bits_used, bit_shift, bits_per_pixel, pixel_mask;
123
int bit_order, byte_swap;
123
int bit_order, byte_swap;
124
char buf[4];
124
char buf[4];
125
unsigned char *byteP;
125
uint8_t *byteP;
126
unsigned short *shortP;
126
uint16_t *shortP;
127
unsigned long *longP;
127
uint32_t *longP;
128
128
129
129
130
int bs_int(int s);
130
uint32_t bs_uint32(uint32_t s);
131
long bs_long(long s);
131
uint16_t bs_uint16(uint16_t s );
132
short bs_short(short s );
133
132
134
133
135
image *getinit(FILE *file, palette *&pal, int *padrightP)
134
image *getinit(FILE *file, palette *&pal, int *padrightP)
136
{
135
{
137
  /* Assume X11 headers are larger than X10 ones. */
136
  /* Assume X11 headers are larger than X10 ones. */
138
  unsigned char header[sizeof(X11WDFileHeader)];
137
  uint8_t header[sizeof(X11WDFileHeader)];
139
  image *im;
138
  image *im;
140
  X11WDFileHeader *h11P;
139
  X11WDFileHeader *h11P;
141
  char junk[800];
140
  char junk[800];
142
  int i, dummy1, dummy2, dummy3;
141
  unsigned int i;
143
  unsigned  short minred, maxred;
142
  int dummy1, dummy2, dummy3;
143
  uint16_t minred, maxred;
144
  X11XColor x11col;
144
  X11XColor x11col;
145
145
146
  h11P = (X11WDFileHeader *) header;
146
  h11P = (X11WDFileHeader *) header;
Lines 273-288 Link Here
273
  bit_order = h11P->bitmap_bit_order;
273
  bit_order = h11P->bitmap_bit_order;
274
  pixel_mask = ( 1 << bits_per_pixel ) - 1;
274
  pixel_mask = ( 1 << bits_per_pixel ) - 1;
275
275
276
  byteP = (unsigned char *) buf;
276
  byteP = (uint8_t *) buf;
277
  shortP = (unsigned short *) buf;
277
  shortP = (uint16_t *) buf;
278
  longP = (unsigned long *) buf;
278
  longP = (uint32_t *) buf;
279
  return im;
279
  return im;
280
}
280
}
281
281
282
void getimage(FILE *file,image *im,int pad)
282
void getimage(FILE *file,image *im,int pad)
283
{
283
{
284
  int i,j;
284
  int i,j;
285
  unsigned char *sl;
285
  uint8_t *sl;
286
#if BYTE_ORDER!=BIG_ENDIAN
286
#if BYTE_ORDER!=BIG_ENDIAN
287
  printf("little guys\n");
287
  printf("little guys\n");
288
#endif
288
#endif
Lines 312-320 Link Here
312
	  case 8:
312
	  case 8:
313
	    break;
313
	    break;
314
314
315
	  case 16: *shortP=short_swap(*shortP); break;
315
	  case 16: *shortP=uint16_swap(*shortP); break;
316
316
317
	  case 32: *longP=long_swap(*longP); break;
317
	  case 32: *longP=uint32_swap(*longP); break;
318
318
319
	  default:
319
	  default:
320
	    fprintf(stderr, "can't happen" );
320
	    fprintf(stderr, "can't happen" );
Lines 355-380 Link Here
355
}
355
}
356
356
357
357
358
short bs_short(short s )
358
uint16_t bs_uint16(uint16_t s )
359
{
359
{
360
  short ss;
360
  uint16_t ss;
361
  unsigned char *bp, t;
361
  uint8_t *bp, t;
362
362
363
  ss = s;
363
  ss = s;
364
  bp = (unsigned char *) &ss;
364
  bp = (uint8_t *) &ss;
365
  t = bp[0];
365
  t = bp[0];
366
  bp[0] = bp[1];
366
  bp[0] = bp[1];
367
  bp[1] = t;
367
  bp[1] = t;
368
  return ss;
368
  return ss;
369
}
369
}
370
370
371
int bs_int(int i )
371
uint32_t bs_uint32(uint32_t l )
372
{
372
{
373
  int ii;
373
  uint32_t ii;
374
  unsigned char *bp, t;
374
  uint8_t *bp, t;
375
375
376
  ii = i;
376
  ii = l;
377
  bp = (unsigned char *) &ii;
377
  bp = (uint8_t *) &ii;
378
  t = bp[0];
378
  t = bp[0];
379
  bp[0] = bp[3];
379
  bp[0] = bp[3];
380
  bp[3] = t;
380
  bp[3] = t;
Lines 384-401 Link Here
384
  return ii;
384
  return ii;
385
}
385
}
386
386
387
long bs_long(long l )
388
{
389
  return bs_int( l );
390
}
391
392
struct BMP_header
387
struct BMP_header
393
{
388
{
394
  char id[2];
389
  char id[2];
395
  long filesize;
390
  long filesize;
396
  short reserved[2];
391
  int16_t reserved[2];
397
  long headersize,infosize,width,height;
392
  long headersize,infosize,width,height;
398
  short biplanes,bits;
393
  int16_t biplanes,bits;
399
  long bicompression, bisizeimage, bixpelspermeter, biypelspermeter,
394
  long bicompression, bisizeimage, bixpelspermeter, biypelspermeter,
400
       biclrused,biclrimportant;
395
       biclrused,biclrimportant;
401
} bmp;
396
} bmp;
Lines 403-422 Link Here
403
int read_BMP_header(FILE *fp)
398
int read_BMP_header(FILE *fp)
404
{
399
{
405
  if (!fread(&bmp.id,1,2,fp)) return 0;         // 2 0
400
  if (!fread(&bmp.id,1,2,fp)) return 0;         // 2 0
406
  bmp.filesize=read_long(fp);                   // 4 4
401
  bmp.filesize=read_uint32(fp);                   // 4 4
407
  if (!fread(bmp.reserved,1,4,fp)) return 0;    // 4 8
402
  if (!fread(bmp.reserved,1,4,fp)) return 0;    // 4 8
408
  bmp.headersize=read_long(fp);                 // 4 12
403
  bmp.headersize=read_uint32(fp);                 // 4 12
409
  bmp.infosize=read_long(fp);                   // 4 16
404
  bmp.infosize=read_uint32(fp);                   // 4 16
410
  bmp.width=read_long(fp);                      // 4 20
405
  bmp.width=read_uint32(fp);                      // 4 20
411
  bmp.height=read_long(fp);                     // 4 24
406
  bmp.height=read_uint32(fp);                     // 4 24
412
  bmp.biplanes=read_short(fp);                  // 2 26
407
  bmp.biplanes=read_uint16(fp);                  // 2 26
413
  bmp.bits=read_short(fp);                      // 2 28
408
  bmp.bits=read_uint16(fp);                      // 2 28
414
  bmp.bicompression=read_long(fp);              // 4 32
409
  bmp.bicompression=read_uint32(fp);              // 4 32
415
  bmp.bisizeimage=read_long(fp);                // 4 36
410
  bmp.bisizeimage=read_uint32(fp);                // 4 36
416
  bmp.bixpelspermeter=read_long(fp);            // 4 40
411
  bmp.bixpelspermeter=read_uint32(fp);            // 4 40
417
  bmp.biypelspermeter=read_long(fp);            // 4 44
412
  bmp.biypelspermeter=read_uint32(fp);            // 4 44
418
  bmp.biclrused=read_long(fp);                  // 4 48
413
  bmp.biclrused=read_uint32(fp);                  // 4 48
419
  bmp.biclrimportant=read_long(fp);             // 4 52
414
  bmp.biclrimportant=read_uint32(fp);             // 4 52
420
  return 1;
415
  return 1;
421
  
416
  
422
}
417
}
Lines 458-468 Link Here
458
  if (!im)
453
  if (!im)
459
    return NULL;
454
    return NULL;
460
  
455
  
461
  unsigned char *sl;
456
  uint8_t *sl;
462
  int trailer=im->width()%4;
457
  int trailer=im->width()%4;
463
  if (trailer==1) trailer=3;
458
  if (trailer==1) trailer=3;
464
  else if (trailer==3) trailer=1;
459
  else if (trailer==3) trailer=1;
465
  uchar buf[9];
460
  uint8_t buf[9];
466
  for (i=im->height();i;i--)
461
  for (i=im->height();i;i--)
467
  {
462
  {
468
    sl=im->scan_line(i-1);
463
    sl=im->scan_line(i-1);
Lines 485-491 Link Here
485
{
480
{
486
  image *im;
481
  image *im;
487
  FILE *fp;
482
  FILE *fp;
488
  unsigned char pal_quad[4];
483
  uint8_t pal_quad[4];
489
  char *scrap;
484
  char *scrap;
490
  int bytes,i;
485
  int bytes,i;
491
  fp=fopen(filename,"rb");
486
  fp=fopen(filename,"rb");
Lines 528-547 Link Here
528
int write_BMP_header(FILE *fp)
523
int write_BMP_header(FILE *fp)
529
{
524
{
530
  if (!fwrite(&bmp.id,1,2,fp)) return 0;  
525
  if (!fwrite(&bmp.id,1,2,fp)) return 0;  
531
  write_long(fp,bmp.filesize);  
526
  write_uint32(fp,bmp.filesize);  
532
  if (!fwrite(bmp.reserved,1,4,fp)) return 0;   
527
  if (!fwrite(bmp.reserved,1,4,fp)) return 0;   
533
  write_long(fp,bmp.headersize);
528
  write_uint32(fp,bmp.headersize);
534
  write_long(fp,bmp.infosize);  
529
  write_uint32(fp,bmp.infosize);  
535
  write_long(fp,bmp.width);
530
  write_uint32(fp,bmp.width);
536
  write_long(fp,bmp.height);
531
  write_uint32(fp,bmp.height);
537
  write_short(fp,bmp.biplanes);
532
  write_uint16(fp,bmp.biplanes);
538
  write_short(fp,bmp.bits);
533
  write_uint16(fp,bmp.bits);
539
  write_long(fp,bmp.bicompression);
534
  write_uint32(fp,bmp.bicompression);
540
  write_long(fp,bmp.bisizeimage);
535
  write_uint32(fp,bmp.bisizeimage);
541
  write_long(fp,bmp.bixpelspermeter);
536
  write_uint32(fp,bmp.bixpelspermeter);
542
  write_long(fp,bmp.biypelspermeter);
537
  write_uint32(fp,bmp.biypelspermeter);
543
  write_long(fp,bmp.biclrused);
538
  write_uint32(fp,bmp.biclrused);
544
  write_long(fp,bmp.biclrimportant);   
539
  write_uint32(fp,bmp.biclrimportant);   
545
  return 1;
540
  return 1;
546
  
541
  
547
}
542
}
Lines 550-556 Link Here
550
{
545
{
551
  FILE *fp;
546
  FILE *fp;
552
  int i,bytes;
547
  int i,bytes;
553
  unsigned char pal_quad[4];
548
  uint8_t pal_quad[4];
554
  fp=fopen(filename,"wb");
549
  fp=fopen(filename,"wb");
555
  if (!fp)
550
  if (!fp)
556
  { printf("Error : unable to open %s for writing!\n",filename);
551
  { printf("Error : unable to open %s for writing!\n",filename);
(-)abuse-sdl-0.7.0.orig/src/imlib/readxwd.cpp (-20 / +14 lines)
Lines 105-113 Link Here
105
long *longP;
105
long *longP;
106
106
107
107
108
int bs_int(int s);
108
int32_t bs_int32(int32_t s);
109
long bs_long(long s);
109
int16_t bs_int16(int16_t s );
110
short bs_short(short s );
111
110
112
111
113
HBITMAP getinit(FILE *file, palette *&pal, int *padrightP, int &xres, int &yres);)
112
HBITMAP getinit(FILE *file, palette *&pal, int *padrightP, int &xres, int &yres);)
Lines 324-330 Link Here
324
}
323
}
325
324
326
325
327
short bs_short(short s )
326
short bs_int16(short s )
328
{
327
{
329
  short ss;
328
  short ss;
330
  unsigned char *bp, t;
329
  unsigned char *bp, t;
Lines 337-349 Link Here
337
  return ss;
336
  return ss;
338
}
337
}
339
338
340
int bs_int(int i )
339
int32_t bs_int32(int32_t l )
341
{
340
{
342
  int ii;
341
  int32_t ii;
343
  unsigned char *bp, t;
342
  uint8_t *bp, t;
344
343
345
  ii = i;
344
  ii = i;
346
  bp = (unsigned char *) &ii;
345
  bp = (uint8_t *) &ii;
347
  t = bp[0];
346
  t = bp[0];
348
  bp[0] = bp[3];
347
  bp[0] = bp[3];
349
  bp[3] = t;
348
  bp[3] = t;
Lines 353-363 Link Here
353
  return ii;
352
  return ii;
354
}
353
}
355
354
356
long bs_long(long l )
357
{
358
  return bs_int( l );
359
}
360
361
struct BMP_header
355
struct BMP_header
362
{
356
{
363
  char id[2];
357
  char id[2];
Lines 373-379 Link Here
373
{
367
{
374
  FILE *fp;
368
  FILE *fp;
375
  int i,bytes;
369
  int i,bytes;
376
  unsigned char pal_quad[4];
370
  uint8_t pal_quad[4];
377
//  fp=fopen("d:\\windows\\256color.bmp","rb");
371
//  fp=fopen("d:\\windows\\256color.bmp","rb");
378
//  fread(&bmp,1,sizeof(bmp),fp);
372
//  fread(&bmp,1,sizeof(bmp),fp);
379
//  fclose(fp);
373
//  fclose(fp);
Lines 410-418 Link Here
410
image *image24(image *im, palette *pal, int rev)
404
image *image24(image *im, palette *pal, int rev)
411
{
405
{
412
  image *ni;
406
  image *ni;
413
  unsigned char *sl1,*sl2;
407
  uint8_t *sl1,*sl2;
414
  int i,x;
408
  int i,x;
415
  unsigned char r,g,b;
409
  uint8_t r,g,b;
416
  printf("Creating image size (%d, %d)\n",im->width()*3,im->height());
410
  printf("Creating image size (%d, %d)\n",im->width()*3,im->height());
417
  ni=new image(im->width()*3,im->height());
411
  ni=new image(im->width()*3,im->height());
418
  printf("Image created\n");
412
  printf("Image created\n");
Lines 428-434 Link Here
428
  return ni;
422
  return ni;
429
}
423
}
430
424
431
unsigned char addb(int n1, int n2)
425
uint8_t addb(int n1, int n2)
432
{ int n3;
426
{ int n3;
433
  n3=n1+n2;
427
  n3=n1+n2;
434
  return n3>255 ? 255 : (n3<0 ? 0 : n3);
428
  return n3>255 ? 255 : (n3<0 ? 0 : n3);
Lines 440-446 Link Here
440
image *color_dither(image *im, palette *pal, int rev)
434
image *color_dither(image *im, palette *pal, int rev)
441
{
435
{
442
  image *i24;
436
  image *i24;
443
  unsigned char min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
437
  uint8_t min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
444
  int i,j,x,y,delta;
438
  int i,j,x,y,delta;
445
  (void *)ad=pal->addr();
439
  (void *)ad=pal->addr();
446
440
Lines 522-531 Link Here
522
      display=0,bad=0,bmp=0,land=0,ch,xo=0,yo=0;
516
      display=0,bad=0,bmp=0,land=0,ch,xo=0,yo=0;
523
  image *im,*i24;
517
  image *im,*i24;
524
  palette *pal;
518
  palette *pal;
525
  unsigned char *sl;
519
  uint8_t *sl;
526
  FILE *fp;
520
  FILE *fp;
527
  char def_name[10],*dev_name,*fname=NULL;
521
  char def_name[10],*dev_name,*fname=NULL;
528
  unsigned char cp[500],mp[500],yp[500],kp[500];
522
  uint8_t cp[500],mp[500],yp[500],kp[500];
529
  strcpy(def_name,"\\dev\\lp");  // set the default output device to /dev/lp
523
  strcpy(def_name,"\\dev\\lp");  // set the default output device to /dev/lp
530
		// since we are in vpix, however we will use the backslash
524
		// since we are in vpix, however we will use the backslash
531
  dev_name=def_name; rev=0;
525
  dev_name=def_name; rev=0;
(-)abuse-sdl-0.7.0.orig/src/imlib/palette.cpp (-12 / +16 lines)
Lines 11-17 Link Here
11
11
12
palette::palette(bFILE *fp)
12
palette::palette(bFILE *fp)
13
{
13
{
14
  ncolors=fp->read_short();
14
  ncolors=fp->read_uint16();
15
  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
15
  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
16
  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
16
  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
17
  set_all_unused();
17
  set_all_unused();
Lines 22-28 Link Here
22
palette::palette(spec_entry *e, bFILE *fp)
22
palette::palette(spec_entry *e, bFILE *fp)
23
{
23
{
24
  fp->seek(e->offset,0);
24
  fp->seek(e->offset,0);
25
  ncolors=fp->read_short();
25
  ncolors=fp->read_uint16();
26
  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
26
  pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
27
  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
27
  usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
28
  set_all_unused();
28
  set_all_unused();
Lines 37-43 Link Here
37
37
38
int palette::write(bFILE *fp)
38
int palette::write(bFILE *fp)
39
{
39
{
40
  fp->write_short(ncolors);
40
  fp->write_uint16(ncolors);
41
  return fp->write(pal,sizeof(color)*ncolors)==ncolors;
41
  return fp->write(pal,sizeof(color)*ncolors)==ncolors;
42
}
42
}
43
43
Lines 88-100 Link Here
88
  return find;
88
  return find;
89
}
89
}
90
90
91
long palette::getquad(int x)
91
uint32_t palette::getquad(int x)
92
{ char entry[4];
92
{ char entry[4];
93
  entry[3]=0;
93
  entry[3]=0;
94
  entry[2]=pal[x].red;
94
  entry[2]=pal[x].red;
95
  entry[1]=pal[x].green;
95
  entry[1]=pal[x].green;
96
  entry[0]=pal[x].blue;
96
  entry[0]=pal[x].blue;
97
  return *((long *)entry);
97
  return *((uint32_t *)entry);
98
}
98
}
99
99
100
100
Lines 481-487 Link Here
481
  long brv;
481
  long brv;
482
  brv=0; bri=0;
482
  brv=0; bri=0;
483
483
484
  for (i=0;i<ncolors;i++)
484
  for (i=0;i<(unsigned int)ncolors;i++)
485
  { if (all || used(i))
485
  { if (all || used(i))
486
    {
486
    {
487
      get(i,r,g,b);
487
      get(i,r,g,b);
Lines 501-507 Link Here
501
  long brv,x;
501
  long brv,x;
502
  brv=(long)258*(long)258*(long)258; bri=0;
502
  brv=(long)258*(long)258*(long)258; bri=0;
503
503
504
  for (i=0;i<ncolors;i++)
504
  for (i=0;i<(unsigned int)ncolors;i++)
505
  { if (all || used(i))
505
  { if (all || used(i))
506
    {
506
    {
507
      get(i,r,g,b);
507
      get(i,r,g,b);
Lines 522-533 Link Here
522
522
523
void palette::fade_to(int total_fades, int fade_on, int dest_r, int dest_g, int dest_b)
523
void palette::fade_to(int total_fades, int fade_on, int dest_r, int dest_g, int dest_b)
524
{
524
{
525
  unsigned char *sl=(unsigned char *)addr();
525
  uint8_t *sl=(uint8_t *)addr();
526
  int i;  
526
  uint8_t x;
527
  int i;
527
  for (i=0;i<ncolors;i++)
528
  for (i=0;i<ncolors;i++)
528
  {
529
  {
529
    *(sl++)=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
530
    x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
530
    *(sl++)=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
531
    *(sl++)=x;
531
    *(sl++)=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);    
532
    x=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
533
    *(sl++)=x;
534
    x=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);    
535
    *(sl++)=x;
532
  }  
536
  }  
533
}
537
}
(-)abuse-sdl-0.7.0.orig/src/imlib/glread.cpp (-12 / +12 lines)
Lines 8-19 Link Here
8
image *read_glfont(char *fn)
8
image *read_glfont(char *fn)
9
{
9
{
10
  image *im,*sub;
10
  image *im,*sub;
11
  unsigned short length,y;
11
  uint16_t length,y;
12
  unsigned char size,first,width,height,gsize,last;
12
  uint8_t size,first,width,height,gsize,last;
13
  FILE *fp;
13
  FILE *fp;
14
  fp=fopen(fn,"rb");
14
  fp=fopen(fn,"rb");
15
  if (!fp) return NULL;
15
  if (!fp) return NULL;
16
  fread(&length,1,2,fp);  length=int_to_local(length);
16
  fread(&length,1,2,fp);  length=uint16_to_local(length);
17
  fread(&size,1,1,fp);
17
  fread(&size,1,1,fp);
18
  fread(&first,1,1,fp);
18
  fread(&first,1,1,fp);
19
  if (size+first>255) { set_error(imFILE_CORRUPTED); fclose(fp); return NULL; }
19
  if (size+first>255) { set_error(imFILE_CORRUPTED); fclose(fp); return NULL; }
Lines 44-51 Link Here
44
{
44
{
45
  image *im;
45
  image *im;
46
  char x[4],bpp;
46
  char x[4],bpp;
47
  unsigned char *sl=NULL,esc,c,n,marker,vmode;
47
  uint8_t *sl=NULL,esc,c,n,marker,vmode;
48
  unsigned short w,h,len,bufsize,blocks,sn,esize,edesc;
48
  uint16_t w,h,len,bufsize,blocks,sn,esize,edesc;
49
  int xx,yy;
49
  int xx,yy;
50
  FILE *fp;
50
  FILE *fp;
51
  im=NULL;
51
  im=NULL;
Lines 54-60 Link Here
54
  fread(&x[0],1,2,fp);
54
  fread(&x[0],1,2,fp);
55
  fread(&w,1,2,fp);
55
  fread(&w,1,2,fp);
56
  fread(&h,1,2,fp);
56
  fread(&h,1,2,fp);
57
  w=int_to_local(w);  h=int_to_local(h);
57
  w=uint16_to_local(w);  h=uint16_to_local(h);
58
  fread(x,1,4,fp);
58
  fread(x,1,4,fp);
59
  fread(&bpp,1,1,fp);
59
  fread(&bpp,1,1,fp);
60
  fread(&marker,1,1,fp);
60
  fread(&marker,1,1,fp);
Lines 65-73 Link Here
65
65
66
  fread(&vmode,1,1,fp);
66
  fread(&vmode,1,1,fp);
67
  fread(&edesc,1,2,fp);
67
  fread(&edesc,1,2,fp);
68
  edesc=int_to_local(edesc);
68
  edesc=uint16_to_local(edesc);
69
  fread(&esize,1,2,fp);
69
  fread(&esize,1,2,fp);
70
  esize=int_to_local(esize);
70
  esize=uint16_to_local(esize);
71
  if (esize==768 && !pal)
71
  if (esize==768 && !pal)
72
  { pal=new palette(1<<bpp);
72
  { pal=new palette(1<<bpp);
73
    fread(pal->addr(),1,(1<<bpp)*3,fp);
73
    fread(pal->addr(),1,(1<<bpp)*3,fp);
Lines 76-91 Link Here
76
  else if (esize)
76
  else if (esize)
77
    fseek(fp,esize,SEEK_CUR);
77
    fseek(fp,esize,SEEK_CUR);
78
  fread(&blocks,1,2,fp);
78
  fread(&blocks,1,2,fp);
79
  blocks=int_to_local(blocks);
79
  blocks=uint16_to_local(blocks);
80
80
81
  yy=h; xx=w;
81
  yy=h; xx=w;
82
82
83
  while (blocks-- && w>=1 && yy>=0)
83
  while (blocks-- && w>=1 && yy>=0)
84
  {
84
  {
85
    fread(&bufsize,1,2,fp);
85
    fread(&bufsize,1,2,fp);
86
    bufsize=int_to_local(bufsize);
86
    bufsize=uint16_to_local(bufsize);
87
    fread(&len,1,2,fp);
87
    fread(&len,1,2,fp);
88
    len=int_to_local(len);
88
    len=uint16_to_local(len);
89
    fread(&esc,1,1,fp);
89
    fread(&esc,1,1,fp);
90
    while (yy>=0 && len)
90
    while (yy>=0 && len)
91
    {
91
    {
Lines 112-118 Link Here
112
	else
112
	else
113
	{
113
	{
114
	  fread(&sn,1,2,fp);
114
	  fread(&sn,1,2,fp);
115
	  sn=int_to_local(sn);
115
	  sn=uint16_to_local(sn);
116
	  fread(&c,1,1,fp);
116
	  fread(&c,1,1,fp);
117
	  while (sn-- && yy>=0 && len)
117
	  while (sn-- && yy>=0 && len)
118
	  {
118
	  {
(-)abuse-sdl-0.7.0.orig/src/imlib/lbmread.cpp (-13 / +13 lines)
Lines 19-25 Link Here
19
  }
19
  }
20
  else
20
  else
21
  {
21
  {
22
    long size=read_other_long(fp);
22
    int32_t size=read_other_uint32(fp);
23
    fread(type,1,4,fp);    
23
    fread(type,1,4,fp);    
24
    if (memcmp(type,"PBM ",4))
24
    if (memcmp(type,"PBM ",4))
25
    {
25
    {
Lines 29-59 Link Here
29
    }
29
    }
30
    else
30
    else
31
    {
31
    {
32
      long offset=12,ssize;    
32
      int32_t ssize;    
33
      char stype[4];
33
      char stype[4];
34
      short w=0,h=0,x,y,tcolor,pagew,pageh;
34
      int16_t w=0,h=0,x,y,tcolor,pagew,pageh;
35
      char planes,masking,compr,padl,xa,ya;
35
      char planes,masking,compr=0,padl,xa,ya;
36
      
36
      
37
      while (ftell(fp)+4<size)
37
      while (ftell(fp)+4<size)
38
      {
38
      {
39
	fread(stype,1,4,fp);
39
	fread(stype,1,4,fp);
40
	ssize=read_other_long(fp);
40
	ssize=read_other_uint32(fp);
41
        if (ssize &1) ssize++;            // specs say all chunks are padded by 2
41
        if (ssize &1) ssize++;            // specs say all chunks are padded by 2
42
	if (!memcmp(stype,"BMHD",4))
42
	if (!memcmp(stype,"BMHD",4))
43
	{
43
	{
44
	  w=read_other_short(fp);
44
	  w=read_other_uint16(fp);
45
	  h=read_other_short(fp);
45
	  h=read_other_uint16(fp);
46
	  x=read_other_short(fp);
46
	  x=read_other_uint16(fp);
47
	  y=read_other_short(fp);
47
	  y=read_other_uint16(fp);
48
	  planes=fgetc(fp);
48
	  planes=fgetc(fp);
49
	  masking=fgetc(fp);
49
	  masking=fgetc(fp);
50
	  compr=fgetc(fp);
50
	  compr=fgetc(fp);
51
	  padl=fgetc(fp);
51
	  padl=fgetc(fp);
52
	  tcolor=read_other_short(fp);
52
	  tcolor=read_other_uint16(fp);
53
	  xa=fgetc(fp);
53
	  xa=fgetc(fp);
54
	  ya=fgetc(fp);
54
	  ya=fgetc(fp);
55
	  pagew=read_other_short(fp);
55
	  pagew=read_other_uint16(fp);
56
	  pageh=read_other_short(fp);
56
	  pageh=read_other_uint16(fp);
57
	} else if (!memcmp(stype,"CMAP",4))
57
	} else if (!memcmp(stype,"CMAP",4))
58
	{
58
	{
59
	  pal=new palette(256);
59
	  pal=new palette(256);
Lines 62-68 Link Here
62
	{
62
	{
63
	  if (im) delete im;  // shouldn't be two BODY's butjust in case...
63
	  if (im) delete im;  // shouldn't be two BODY's butjust in case...
64
	  im=new image(w,h);
64
	  im=new image(w,h);
65
	  int x,y;
65
	  int y;
66
	  if (!compr)
66
	  if (!compr)
67
	  {
67
	  {
68
	    for (y=0;y<h;h++)
68
	    for (y=0;y<h;h++)
(-)abuse-sdl-0.7.0.orig/src/imlib/timage.cpp (-41 / +41 lines)
Lines 2-8 Link Here
2
2
3
void trans_image::make_color(int c)
3
void trans_image::make_color(int c)
4
{
4
{
5
  unsigned char *dp=data;
5
  uint8_t *dp=data;
6
  int y,x;
6
  int y,x;
7
  for (y=0;y<h;y++)
7
  for (y=0;y<h;y++)
8
  {
8
  {
Lines 24-30 Link Here
24
image *trans_image::make_image()
24
image *trans_image::make_image()
25
{
25
{
26
  image *im=new image(w,h);
26
  image *im=new image(w,h);
27
  unsigned char *d=im->scan_line(0),*dp=data,*dline;
27
  uint8_t *d=im->scan_line(0),*dp=data,*dline;
28
  int y,x;
28
  int y,x;
29
  for (y=0;y<h;y++)
29
  for (y=0;y<h;y++)
30
  {
30
  {
Lines 53-59 Link Here
53
trans_image::trans_image(image *im, char *name)
53
trans_image::trans_image(image *im, char *name)
54
{
54
{
55
  int size=0,x,y;
55
  int size=0,x,y;
56
  unsigned char *sl,*datap,*marker; 
56
  uint8_t *sl,*datap,*marker; 
57
  w=im->width();
57
  w=im->width();
58
  h=im->height();
58
  h=im->height();
59
  
59
  
Lines 83-91 Link Here
83
#ifdef MEM_CHECK
83
#ifdef MEM_CHECK
84
  char st[80];
84
  char st[80];
85
  sprintf(st,"trans_image::data (%s)",name);
85
  sprintf(st,"trans_image::data (%s)",name);
86
  data=(unsigned char *)jmalloc(size,st);
86
  data=(uint8_t *)jmalloc(size,st);
87
#else
87
#else
88
  data=(unsigned char *)jmalloc(size,"");
88
  data=(uint8_t *)jmalloc(size,"");
89
#endif
89
#endif
90
  int ww=im->width(),hh=im->height();
90
  int ww=im->width(),hh=im->height();
91
  datap=data;
91
  datap=data;
Lines 124-135 Link Here
124
124
125
void trans_image::put_scan_line(image *screen, int x, int y, int line)   // always transparent   
125
void trans_image::put_scan_line(image *screen, int x, int y, int line)   // always transparent   
126
{
126
{
127
  short x1,y1,x2,y2;
127
  int16_t x1,y1,x2,y2;
128
  screen->get_clip(x1,y1,x2,y2);
128
  screen->get_clip(x1,y1,x2,y2);
129
  if (y+line<y1 || y+line>y2 || x>x2 || x+w-1<x1)            // clipped off completely?
129
  if (y+line<y1 || y+line>y2 || x>x2 || x+w-1<x1)            // clipped off completely?
130
    return;
130
    return;
131
131
132
  unsigned char *datap=data;
132
  uint8_t *datap=data;
133
  int ix;  
133
  int ix;  
134
  while (line)            // skip scan line data until we get to the line of interest
134
  while (line)            // skip scan line data until we get to the line of interest
135
  {
135
  {
Lines 150-156 Link Here
150
  
150
  
151
  
151
  
152
  // now slam this list of runs to the screen
152
  // now slam this list of runs to the screen
153
  unsigned char *screen_line=screen->scan_line(y)+x;
153
  uint8_t *screen_line=screen->scan_line(y)+x;
154
    
154
    
155
  for (ix=0;ix<w;)             
155
  for (ix=0;ix<w;)             
156
  {      
156
  {      
Lines 201-214 Link Here
201
}
201
}
202
202
203
203
204
inline unsigned char *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2, 
204
inline uint8_t *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2, 
205
				   int x, int &y, int &ysteps)
205
				   int x, int &y, int &ysteps)
206
{
206
{
207
  // check to see if it is total clipped out first
207
  // check to see if it is total clipped out first
208
  if (y+h<=y1 || y>y2 || x>x2 || x+w<=x1)
208
  if (y+h<=y1 || y>y2 || x>x2 || x+w<=x1)
209
    return NULL;
209
    return NULL;
210
210
211
  register unsigned char *datap=data;  
211
  register uint8_t *datap=data;  
212
212
213
213
214
  ysteps=height();
214
  ysteps=height();
Lines 244-256 Link Here
244
} 
244
} 
245
245
246
void trans_image::put_image_filled(image *screen, int x, int y, 
246
void trans_image::put_image_filled(image *screen, int x, int y, 
247
				   uchar fill_color)
247
				   uint8_t fill_color)
248
{
248
{
249
 short x1,y1,x2,y2;
249
 int16_t x1,y1,x2,y2;
250
  int chop_length,ysteps;
250
  int chop_length,ysteps;
251
251
252
  screen->get_clip(x1,y1,x2,y2);
252
  screen->get_clip(x1,y1,x2,y2);
253
  register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
253
  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
254
  if (!datap) return ;     // if clip_y says nothing to draw, return
254
  if (!datap) return ;     // if clip_y says nothing to draw, return
255
  
255
  
256
  screen_line=screen->scan_line(y)+x;  
256
  screen_line=screen->scan_line(y)+x;  
Lines 315-325 Link Here
315
  }    
315
  }    
316
}
316
}
317
317
318
void trans_image::put_image_offseted(image *screen, uchar *s_off)   // if screen x & y offset already calculated save a mul
318
void trans_image::put_image_offseted(image *screen, uint8_t *s_off)   // if screen x & y offset already calculated save a mul
319
{
319
{
320
  int ix,ysteps=height();
320
  int ix,ysteps=height();
321
  int screen_skip=screen->width()-w;
321
  int screen_skip=screen->width()-w;
322
  uchar skip,*datap=data;
322
  uint8_t skip,*datap=data;
323
  for (;ysteps;ysteps--)
323
  for (;ysteps;ysteps--)
324
  {
324
  {
325
    for (ix=0;ix<w;)
325
    for (ix=0;ix<w;)
Lines 352-362 Link Here
352
352
353
void trans_image::put_image(image *screen, int x, int y) 
353
void trans_image::put_image(image *screen, int x, int y) 
354
{
354
{
355
  short x1,y1,x2,y2;
355
  int16_t x1,y1,x2,y2;
356
  int chop_length,ysteps;
356
  int chop_length,ysteps;
357
357
358
  screen->get_clip(x1,y1,x2,y2);
358
  screen->get_clip(x1,y1,x2,y2);
359
  register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
359
  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
360
  if (!datap) return ;     // if clip_y says nothing to draw, return
360
  if (!datap) return ;     // if clip_y says nothing to draw, return
361
  
361
  
362
  screen_line=screen->scan_line(y)+x;  
362
  screen_line=screen->scan_line(y)+x;  
Lines 413-425 Link Here
413
  }    
413
  }    
414
}
414
}
415
415
416
void trans_image::put_remaped(image *screen, int x, int y, unsigned char *remap) 
416
void trans_image::put_remaped(image *screen, int x, int y, uint8_t *remap) 
417
{
417
{
418
  short x1,y1,x2,y2;
418
  int16_t x1,y1,x2,y2;
419
  int chop_length,ysteps;
419
  int chop_length,ysteps;
420
420
421
  screen->get_clip(x1,y1,x2,y2);
421
  screen->get_clip(x1,y1,x2,y2);
422
  register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
422
  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
423
  if (!datap) return ;     // if clip_y says nothing to draw, return
423
  if (!datap) return ;     // if clip_y says nothing to draw, return
424
  
424
  
425
  screen_line=screen->scan_line(y)+x;  
425
  screen_line=screen->scan_line(y)+x;  
Lines 469-475 Link Here
469
	    else
469
	    else
470
	      counter=slam_length;
470
	      counter=slam_length;
471
471
472
	    register unsigned char *sl=screen_line+ix,*sl2=datap;
472
	    register uint8_t *sl=screen_line+ix,*sl2=datap;
473
	    ix+=slam_length;	    
473
	    ix+=slam_length;	    
474
	    datap+=slam_length;
474
	    datap+=slam_length;
475
	    while (counter)
475
	    while (counter)
Lines 489-501 Link Here
489
489
490
490
491
491
492
void trans_image::put_double_remaped(image *screen, int x, int y, unsigned char *remap, unsigned char *remap2) 
492
void trans_image::put_double_remaped(image *screen, int x, int y, uint8_t *remap, uint8_t *remap2) 
493
{
493
{
494
  short x1,y1,x2,y2;
494
  int16_t x1,y1,x2,y2;
495
  int chop_length,ysteps;
495
  int chop_length,ysteps;
496
496
497
  screen->get_clip(x1,y1,x2,y2);
497
  screen->get_clip(x1,y1,x2,y2);
498
  register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
498
  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
499
  if (!datap) return ;     // if clip_y says nothing to draw, return
499
  if (!datap) return ;     // if clip_y says nothing to draw, return
500
  
500
  
501
  screen_line=screen->scan_line(y)+x;  
501
  screen_line=screen->scan_line(y)+x;  
Lines 545-551 Link Here
545
	    else
545
	    else
546
	      counter=slam_length;
546
	      counter=slam_length;
547
547
548
	    register unsigned char *sl=screen_line+ix,*sl2=datap;
548
	    register uint8_t *sl=screen_line+ix,*sl2=datap;
549
	    ix+=slam_length;	    
549
	    ix+=slam_length;	    
550
	    datap+=slam_length;
550
	    datap+=slam_length;
551
	    while (counter)
551
	    while (counter)
Lines 569-583 Link Here
569
			   int frame_on, int total_frames, 
569
			   int frame_on, int total_frames, 
570
			   color_filter *f, palette *pal) 
570
			   color_filter *f, palette *pal) 
571
{
571
{
572
  short x1,y1,x2,y2;
572
  int16_t x1,y1,x2,y2;
573
  int ix,slam_length,chop_length,ysteps;
573
  int ix,slam_length,chop_length,ysteps;
574
574
575
  screen->get_clip(x1,y1,x2,y2);
575
  screen->get_clip(x1,y1,x2,y2);
576
  unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
576
  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
577
                *screen_line;
577
                *screen_line;
578
  if (!datap) return ;
578
  if (!datap) return ;
579
579
580
  unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
580
  uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
581
                *caddr1,*caddr2,r_dest,g_dest,b_dest;
581
                *caddr1,*caddr2,r_dest,g_dest,b_dest;
582
582
583
  long fixmul=(frame_on<<16)/total_frames;
583
  long fixmul=(frame_on<<16)/total_frames;
Lines 658-675 Link Here
658
658
659
void trans_image::put_fade_tint(image *screen, int x, int y,
659
void trans_image::put_fade_tint(image *screen, int x, int y,
660
				int frame_on, int total_frames, 
660
				int frame_on, int total_frames, 
661
				uchar *tint,
661
				uint8_t *tint,
662
				color_filter *f, palette *pal) 
662
				color_filter *f, palette *pal) 
663
{
663
{
664
  short x1,y1,x2,y2;
664
  int16_t x1,y1,x2,y2;
665
  int ix,slam_length,chop_length,ysteps;
665
  int ix,slam_length,chop_length,ysteps;
666
666
667
  screen->get_clip(x1,y1,x2,y2);
667
  screen->get_clip(x1,y1,x2,y2);
668
  unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
668
  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
669
                *screen_line;
669
                *screen_line;
670
  if (!datap) return ;
670
  if (!datap) return ;
671
671
672
  unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
672
  uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
673
                *caddr1,*caddr2,r_dest,g_dest,b_dest;
673
                *caddr1,*caddr2,r_dest,g_dest,b_dest;
674
674
675
  long fixmul=(frame_on<<16)/total_frames;
675
  long fixmul=(frame_on<<16)/total_frames;
Lines 752-762 Link Here
752
752
753
void trans_image::put_color(image *screen, int x, int y, int color) 
753
void trans_image::put_color(image *screen, int x, int y, int color) 
754
{
754
{
755
  short x1,y1,x2,y2;
755
  int16_t x1,y1,x2,y2;
756
  int ix,slam_length,chop_length,ysteps;
756
  int ix,slam_length,chop_length,ysteps;
757
  
757
  
758
  screen->get_clip(x1,y1,x2,y2);
758
  screen->get_clip(x1,y1,x2,y2);
759
  unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
759
  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
760
                *screen_line;
760
                *screen_line;
761
  if (!datap) return ;
761
  if (!datap) return ;
762
  
762
  
Lines 818-829 Link Here
818
   	           int blendx, int blendy, int blend_amount, color_filter *f, palette *pal)
818
   	           int blendx, int blendy, int blend_amount, color_filter *f, palette *pal)
819
819
820
{
820
{
821
  short x1,y1,x2,y2;
821
  int16_t x1,y1,x2,y2;
822
  int ix,slam_length,chop_length,ysteps;
822
  int ix,slam_length,chop_length,ysteps;
823
  unsigned char *paddr=(unsigned char *)pal->addr();  
823
  uint8_t *paddr=(uint8_t *)pal->addr();  
824
  
824
  
825
  screen->get_clip(x1,y1,x2,y2);
825
  screen->get_clip(x1,y1,x2,y2);
826
  unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
826
  uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
827
                *blend_line,*screen_line;
827
                *blend_line,*screen_line;
828
  if (!datap) return ;
828
  if (!datap) return ;
829
  CONDITION(y>=blendy && y+ysteps<blendy+blend->height()+1,"Blend doesn't fit on trans_image");
829
  CONDITION(y>=blendy && y+ysteps<blendy+blend->height()+1,"Blend doesn't fit on trans_image");
Lines 875-881 Link Here
875
	      chop_length=x2-x-ix;
875
	      chop_length=x2-x-ix;
876
	    else chop_length=slam_length;
876
	    else chop_length=slam_length;
877
877
878
	    unsigned char *screen_run=screen_line+x+ix,
878
	    uint8_t *screen_run=screen_line+x+ix,
879
	                  *blend_run=blend_line+x+ix-blendx,
879
	                  *blend_run=blend_line+x+ix-blendx,
880
	                  *caddr1,*caddr2,r_dest,g_dest,b_dest;      
880
	                  *caddr1,*caddr2,r_dest,g_dest,b_dest;      
881
              
881
              
Lines 917-927 Link Here
917
917
918
void trans_image::put_predator(image *screen, int x, int y) 
918
void trans_image::put_predator(image *screen, int x, int y) 
919
{
919
{
920
  short x1,y1,x2,y2;
920
  int16_t x1,y1,x2,y2;
921
  int chop_length,ysteps;
921
  int chop_length,ysteps;
922
922
923
  screen->get_clip(x1,y1,x2,y2);
923
  screen->get_clip(x1,y1,x2,y2);
924
  register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
924
  register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
925
  if (!datap) return ;     // if clip_y says nothing to draw, return
925
  if (!datap) return ;     // if clip_y says nothing to draw, return
926
926
927
  // see if the last scanline is clipped off
927
  // see if the last scanline is clipped off
Lines 1001-1007 Link Here
1001
1001
1002
int trans_image::size()
1002
int trans_image::size()
1003
{
1003
{
1004
  uchar *d=data;
1004
  uint8_t *d=data;
1005
  int t=0;
1005
  int t=0;
1006
  for (int y=0;y<h;y++)
1006
  for (int y=0;y<h;y++)
1007
  {
1007
  {
(-)abuse-sdl-0.7.0.orig/src/imlib/packet.cpp (-10 / +10 lines)
Lines 4-28 Link Here
4
#include <string.h>
4
#include <string.h>
5
5
6
6
7
int packet::advance(long offset)
7
int packet::advance(int32_t offset)
8
{
8
{
9
  ro+=offset;
9
  ro+=offset;
10
  return ro<=rend;
10
  return ro<=rend;
11
}
11
}
12
12
13
void packet::write_long(ulong x)
13
void packet::write_uint32(uint32_t x)
14
{
14
{
15
  x=lltl(x);
15
  x=lltl(x);
16
  write((uchar *)&x,4);
16
  write((uint8_t *)&x,4);
17
}
17
}
18
18
19
void packet::write_short(ushort x)
19
void packet::write_uint16(uint16_t x)
20
{
20
{
21
  x=lstl(x);
21
  x=lstl(x);
22
  write((uchar *)&x,2);
22
  write((uint8_t *)&x,2);
23
}
23
}
24
24
25
void packet::write_byte(uchar x)
25
void packet::write_uint8(uint8_t x)
26
{
26
{
27
  write(&x,1);
27
  write(&x,1);
28
}
28
}
Lines 40-46 Link Here
40
#endif
40
#endif
41
41
42
  buf_size=1000;
42
  buf_size=1000;
43
  buf=(uchar *)jmalloc(buf_size,"packet buffer");
43
  buf=(uint8_t *)jmalloc(buf_size,"packet buffer");
44
  reset(); 
44
  reset(); 
45
45
46
#ifdef MANAGE_MEM
46
#ifdef MANAGE_MEM
Lines 71-81 Link Here
71
  if (buf_size<max)
71
  if (buf_size<max)
72
  {
72
  {
73
    buf_size=max;
73
    buf_size=max;
74
    buf=(uchar *)jrealloc(buf,max,"packet buffer"); 
74
    buf=(uint8_t *)jrealloc(buf,max,"packet buffer"); 
75
  }
75
  }
76
}
76
}
77
77
78
int packet::read(uchar *buffer, int size)
78
int packet::read(uint8_t *buffer, int size)
79
{
79
{
80
  if (size>rend-ro)
80
  if (size>rend-ro)
81
    size=rend-ro;
81
    size=rend-ro;
Lines 89-95 Link Here
89
}
89
}
90
90
91
91
92
int packet::write(uchar *buffer, int size)
92
int packet::write(uint8_t *buffer, int size)
93
{
93
{
94
  if (size>buf_size-wo)
94
  if (size>buf_size-wo)
95
    make_bigger(wo+size);
95
    make_bigger(wo+size);
(-)abuse-sdl-0.7.0.orig/src/imlib/mdlread.cpp (-18 / +18 lines)
Lines 10-24 Link Here
10
// images.  Note, only the mode 320x200x256 is sopprted here for saving
10
// images.  Note, only the mode 320x200x256 is sopprted here for saving
11
// images.  All images should be sized so they will fit on an mdl screen
11
// images.  All images should be sized so they will fit on an mdl screen
12
// but no checking of that is done hhere.
12
// but no checking of that is done hhere.
13
void write_mdl(image **images, short total_images, palette *pal,char *fn,
13
void write_mdl(image **images, int16_t total_images, palette *pal,char *fn,
14
		short firstpage, short images_per_page)
14
		int16_t firstpage, int16_t images_per_page)
15
{
15
{
16
  FILE *fp;
16
  FILE *fp;
17
  char buf[18];
17
  char buf[18];
18
  unsigned short xy[2],x;
18
  uint16_t xy[2],x;
19
  char name[13],page;
19
  char name[13],page;
20
  unsigned char *c;
20
  unsigned char *c;
21
  short i;
21
  int16_t i;
22
  palette *np;
22
  palette *np;
23
  clear_errors();
23
  clear_errors();
24
  CONDITION(images && pal && fn && total_images>0,"bad parms");
24
  CONDITION(images && pal && fn && total_images>0,"bad parms");
Lines 42-48 Link Here
42
    {
42
    {
43
      memset(buf,0,6);            // each image has 6 bytes of reserved 0
43
      memset(buf,0,6);            // each image has 6 bytes of reserved 0
44
      fwrite(buf,6,1,fp);
44
      fwrite(buf,6,1,fp);
45
      xy[0]=int_to_intel(i%100+20); xy[1]=int_to_intel(30);  // the x and y position on the screen
45
      xy[0]=uint16_to_intel(i%100+20); xy[1]=uint16_to_intel(30);  // the x and y position on the screen
46
      fwrite(xy,4,1,fp);
46
      fwrite(xy,4,1,fp);
47
      sprintf(name,"JC%-10d",i);  // set the name of the image
47
      sprintf(name,"JC%-10d",i);  // set the name of the image
48
      fwrite(name,12,1,fp);
48
      fwrite(name,12,1,fp);
Lines 50-63 Link Here
50
      page=firstpage+i/images_per_page;
50
      page=firstpage+i/images_per_page;
51
51
52
      fwrite(&page,1,1,fp);         // put all of the image on the first page
52
      fwrite(&page,1,1,fp);         // put all of the image on the first page
53
      xy[0]=int_to_intel(images[i]->width()*images[i]->height()+4);  // calc the size of the image
53
      xy[0]=uint16_to_intel(images[i]->width()*images[i]->height()+4);  // calc the size of the image
54
    
54
    
55
      fwrite(xy,2,1,fp);
55
      fwrite(xy,2,1,fp);
56
      xy[0]=int_to_intel(images[i]->width());
56
      xy[0]=uint16_to_intel(images[i]->width());
57
      fwrite(xy,2,1,fp);
57
      fwrite(xy,2,1,fp);
58
      xy[0]=int_to_intel(images[i]->height());
58
      xy[0]=uint16_to_intel(images[i]->height());
59
      fwrite(xy,2,1,fp);
59
      fwrite(xy,2,1,fp);
60
      for (x=0;x<(unsigned short)images[i]->height();x++)   // write all the scan_lines for the
60
      for (x=0;x<(uint16_t)images[i]->height();x++)   // write all the scan_lines for the
61
      { c=images[i]->scan_line(x);            // image
61
      { c=images[i]->scan_line(x);            // image
62
	fwrite(c,images[i]->width(),1,fp);
62
	fwrite(c,images[i]->width(),1,fp);
63
      }
63
      }
Lines 66-75 Link Here
66
  }
66
  }
67
}
67
}
68
68
69
short mdl_total_images(char *fn)
69
int16_t mdl_total_images(char *fn)
70
{
70
{
71
  char buf[800];
71
  char buf[800];
72
  unsigned short xy[2],t;
72
  uint16_t xy[2],t;
73
  FILE *fp;
73
  FILE *fp;
74
  fp=fopen(fn,"rb");
74
  fp=fopen(fn,"rb");
75
  if (!fp)
75
  if (!fp)
Lines 91-97 Link Here
91
  { if (fread(buf,1,23,fp)==23)
91
  { if (fread(buf,1,23,fp)==23)
92
    {
92
    {
93
      fread(xy,2,1,fp);
93
      fread(xy,2,1,fp);
94
      xy[0]=int_to_local(xy[0]);
94
      xy[0]=uint16_to_local(xy[0]);
95
      fseek(fp,xy[0],SEEK_CUR);
95
      fseek(fp,xy[0],SEEK_CUR);
96
      t++;
96
      t++;
97
    }
97
    }
Lines 103-114 Link Here
103
// read_mdl returns an array containing pointers to all the desired images
103
// read_mdl returns an array containing pointers to all the desired images
104
// and a palette that is read form the file
104
// and a palette that is read form the file
105
// to load image numbers 4 through 9 let start =4, end=9
105
// to load image numbers 4 through 9 let start =4, end=9
106
image **read_mdl(char *fn, palette *&pal, short startn, short endn, short &total)
106
image **read_mdl(char *fn, palette *&pal, int16_t startn, int16_t endn, int16_t &total)
107
{
107
{
108
  FILE *fp;
108
  FILE *fp;
109
  image **im;
109
  image **im;
110
  char buf[50];
110
  char buf[50];
111
  unsigned short xy[2],i,j;
111
  uint16_t xy[2],i,j;
112
  clear_errors();
112
  clear_errors();
113
  make_block(sizeof(FILE));
113
  make_block(sizeof(FILE));
114
  im=NULL;
114
  im=NULL;
Lines 146-152 Link Here
146
      { if (fread(buf,1,23,fp)!=23)
146
      { if (fread(buf,1,23,fp)!=23)
147
	  set_error(imFILE_CORRUPTED);
147
	  set_error(imFILE_CORRUPTED);
148
	fread(xy,2,1,fp);
148
	fread(xy,2,1,fp);
149
	xy[0]=int_to_local(xy[0]);
149
	xy[0]=uint16_to_local(xy[0]);
150
	fseek(fp,xy[0],SEEK_CUR);
150
	fseek(fp,xy[0],SEEK_CUR);
151
	startn--; if (endn>0) endn--;
151
	startn--; if (endn>0) endn--;
152
      }
152
      }
Lines 160-172 Link Here
160
  	  if (fread(&j,1,2,fp)!=2) set_error(imFILE_CORRUPTED);
160
  	  if (fread(&j,1,2,fp)!=2) set_error(imFILE_CORRUPTED);
161
	  else
161
	  else
162
	  {
162
	  {
163
	    j=int_to_local(j);
163
	    j=uint16_to_local(j);
164
	    j-=4;
164
	    j-=4;
165
            xy[0]=5; xy[1]=5;
165
            xy[0]=5; xy[1]=5;
166
	    if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED);
166
	    if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED);
167
	    make_block(sizeof(image));
167
	    make_block(sizeof(image));
168
	    xy[0]=int_to_local(xy[0]);
168
	    xy[0]=uint16_to_local(xy[0]);
169
	    xy[1]=int_to_local(xy[1]);
169
	    xy[1]=uint16_to_local(xy[1]);
170
	    im[startn]=new image(xy[0],xy[1]);
170
	    im[startn]=new image(xy[0],xy[1]);
171
	    total++;
171
	    total++;
172
	    for (i=0;i<xy[1];i++)
172
	    for (i=0;i<xy[1];i++)
(-)abuse-sdl-0.7.0.orig/src/imlib/specs.cpp (-100 / +102 lines)
Lines 3-8 Link Here
3
#include "specs.hpp"
3
#include "specs.hpp"
4
#include <stdio.h>
4
#include <stdio.h>
5
#include <stdlib.h>
5
#include <stdlib.h>
6
#include <stdint.h>
6
#include <ctype.h>
7
#include <ctype.h>
7
#include <fcntl.h>
8
#include <fcntl.h>
8
#include "system.h"
9
#include "system.h"
Lines 23-47 Link Here
23
                    "Palette",                  // 2
24
                    "Palette",                  // 2
24
                    "Invalid Type",             // 3
25
                    "Invalid Type",             // 3
25
                    "Image",                    // 4
26
                    "Image",                    // 4
26
	            			"Fore Tile",
27
                    "Fore Tile",
27
                    "Back Tile",
28
                    "Back Tile",
28
                    "Character",
29
                    "Character",
29
                    "8 Morph",
30
                    "8 Morph",
30
                    "16 Morph",
31
                    "16 Morph",
31
		    "Grue objs",
32
                    "Grue objs",
32
		    "Extern WAV",
33
                    "Extern WAV",
33
		    "DMX MUS",
34
                    "DMX MUS",
34
		    "Patched morph",
35
                    "Patched morph",
35
		    "Normal file",
36
                    "Normal file",
36
		    "Compress1 file",
37
                    "Compress1 file",
37
		    "Vector Image",
38
                    "Vector Image",
38
		    "Light list",
39
                    "Light list",
39
		    "Grue fgmap",
40
                    "Grue fgmap",
40
		    "Grue bgmap",
41
                    "Grue bgmap",
41
		    "Data array",
42
                    "Data array",
42
		    "Character2",
43
                    "Character2",
43
		    "Particle",
44
                    "Particle",
44
		    "Extern lcache"
45
                    "Extern lcache"
45
};
46
};
46
47
47
48
Lines 150-156 Link Here
150
{
151
{
151
  if (wbuf_end!=0)
152
  if (wbuf_end!=0)
152
  {
153
  {
153
    long ret=unbuffered_write(wbuf,wbuf_end);
154
    unsigned long ret=unbuffered_write(wbuf,wbuf_end);
154
    if (ret!=wbuf_end && no_space_handle_fun)
155
    if (ret!=wbuf_end && no_space_handle_fun)
155
      no_space_handle_fun();
156
      no_space_handle_fun();
156
      
157
      
Lines 171-177 Link Here
171
  {
172
  {
172
    if (rbuf_start<rbuf_end)
173
    if (rbuf_start<rbuf_end)
173
    {
174
    {
174
      int avail_size=rbuf_end-rbuf_start;
175
      unsigned int avail_size=rbuf_end-rbuf_start;
175
      int copy_size=avail_size>count ? count : avail_size;
176
      int copy_size=avail_size>count ? count : avail_size;
176
      memcpy(buf,rbuf+rbuf_start,copy_size);
177
      memcpy(buf,rbuf+rbuf_start,copy_size);
177
      buf=(void *)(((unsigned char *)buf)+copy_size);
178
      buf=(void *)(((unsigned char *)buf)+copy_size);
Lines 208-214 Link Here
208
      count-=copy_size;
209
      count-=copy_size;
209
      buf=(void *)(((char *)buf)+copy_size);
210
      buf=(void *)(((char *)buf)+copy_size);
210
      if (wbuf_end==wbuf_size)
211
      if (wbuf_end==wbuf_size)
211
        if (flush_writes()!=wbuf_size)
212
        if ((unsigned int)flush_writes()!=wbuf_size)
212
	  return total_written;
213
	  return total_written;
213
      
214
      
214
      total_written+=copy_size;      
215
      total_written+=copy_size;      
Lines 216-222 Link Here
216
    return total_written;
217
    return total_written;
217
  } else
218
  } else
218
  {
219
  {
219
    long ret=unbuffered_write(buf,count);
220
    unsigned long ret=unbuffered_write(buf,count);
220
    if (ret!=count && no_space_handle_fun)
221
    if (ret!=count && no_space_handle_fun)
221
      no_space_handle_fun();
222
      no_space_handle_fun();
222
  }
223
  }
Lines 233-239 Link Here
233
  if (whence==SEEK_CUR) offset+=curpos;
234
  if (whence==SEEK_CUR) offset+=curpos;
234
  else if (whence==SEEK_END) offset=file_size()-offset;
235
  else if (whence==SEEK_END) offset=file_size()-offset;
235
236
236
  if (offset<realpos-rbuf_end || offset>=realpos)
237
  if (offset<realpos-(long)rbuf_end || offset>=realpos)
237
  {
238
  {
238
    rbuf_start=rbuf_end=0;
239
    rbuf_start=rbuf_end=0;
239
    unbuffered_seek(offset,SEEK_SET);
240
    unbuffered_seek(offset,SEEK_SET);
Lines 269-281 Link Here
269
  
270
  
270
#if (defined(__APPLE__) && !defined(__MACH__))
271
#if (defined(__APPLE__) && !defined(__MACH__))
271
  spec_main_jfile.open_external(filename,"rb",O_BINARY|O_RDONLY);
272
  spec_main_jfile.open_external(filename,"rb",O_BINARY|O_RDONLY);
272
  spec_main_fd = spec_main_jfile.get_fd();
273
  spec_main_sd.startup(&spec_main_jfile);
274
#else
273
#else
275
  spec_main_jfile.open_external(filename,"rb",O_RDONLY);
274
  spec_main_jfile.open_external(filename,"rb",O_RDONLY);
275
#endif
276
  spec_main_fd = spec_main_jfile.get_fd();
276
  spec_main_fd = spec_main_jfile.get_fd();
277
  if (spec_main_fd==-1)
278
    return;
277
  spec_main_sd.startup(&spec_main_jfile);
279
  spec_main_sd.startup(&spec_main_jfile);
278
#endif
279
}
280
}
280
281
281
void fast_load_start_recording(char *filename)
282
void fast_load_start_recording(char *filename)
Lines 334-340 Link Here
334
    if ((flags&O_APPEND)==0) 
335
    if ((flags&O_APPEND)==0) 
335
    {
336
    {
336
      skip_size=1;
337
      skip_size=1;
337
      int errval = unlink(tmp_name);
338
      //int errval = unlink(tmp_name);
338
    }
339
    }
339
340
340
    flags-=O_WRONLY;
341
    flags-=O_WRONLY;
Lines 419-432 Link Here
419
      spec_entry *se=spec_main_sd.find(filename);
420
      spec_entry *se=spec_main_sd.find(filename);
420
      if (se)    
421
      if (se)    
421
      {
422
      {
422
				start_offset=se->offset;
423
	start_offset=se->offset;
423
				current_offset = 0;
424
	current_offset = 0;
424
				file_length=se->size;
425
	file_length=se->size;
425
				rbuf_start=rbuf_end=0;
426
	rbuf_start=rbuf_end=0;
426
      } else 
427
      } else 
427
      {
428
      {
428
				close(fd);
429
	close(fd);
429
				fd=-1;
430
	fd=-1;
430
      }
431
      }
431
    }  
432
    }  
432
  }
433
  }
Lines 486-492 Link Here
486
487
487
int jFILE::unbuffered_read(void *buf, size_t count)
488
int jFILE::unbuffered_read(void *buf, size_t count)
488
{
489
{
489
	long len;
490
	unsigned long len;
490
491
491
	if (fd == spec_main_fd)
492
	if (fd == spec_main_fd)
492
	{
493
	{
Lines 504-510 Link Here
504
			
505
			
505
			len = ::read(fd,(char*)buf,count);
506
			len = ::read(fd,(char*)buf,count);
506
			::write(fast_load_fd,(char*)&len,sizeof(len));
507
			::write(fast_load_fd,(char*)&len,sizeof(len));
507
			::write(fast_load_fd,(char*)buf,count);
508
			::write(fast_load_fd,(char*)buf,len);
508
			break;
509
			break;
509
		case 2:
510
		case 2:
510
			::read(fast_load_fd,(char*)&len,sizeof(len));
511
			::read(fast_load_fd,(char*)&len,sizeof(len));
Lines 524-530 Link Here
524
		case 1:
525
		case 1:
525
	  	len = ::read(fd,(char*)buf,count);
526
	  	len = ::read(fd,(char*)buf,count);
526
			::write(fast_load_fd,(char*)&len,sizeof(len));
527
			::write(fast_load_fd,(char*)&len,sizeof(len));
527
			::write(fast_load_fd,(char*)buf,count);
528
			::write(fast_load_fd,(char*)buf,len);
528
	  	break;
529
	  	break;
529
		case 2:
530
		case 2:
530
			::read(fast_load_fd,(char*)&len,sizeof(len));
531
			::read(fast_load_fd,(char*)&len,sizeof(len));
Lines 547-574 Link Here
547
548
548
int jFILE::unbuffered_seek(long offset, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
549
int jFILE::unbuffered_seek(long offset, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
549
{
550
{
550
	long ret;
551
  long ret;
551
	
552
552
	if (fast_load_mode == 2)
553
  if (fast_load_mode == 2)
553
	{
554
  {
554
		switch (whence)
555
    switch (whence)
555
		{
556
    {
556
    case SEEK_SET : 
557
    case SEEK_SET : 
557
     	current_offset = start_offset+offset;
558
      current_offset = start_offset+offset;
558
     	break;
559
      break;
559
    case SEEK_END : 
560
    case SEEK_END : 
560
    	current_offset = start_offset+file_length-offset;
561
      current_offset = start_offset+file_length-offset;
561
    	break;
562
      break;
562
    case SEEK_CUR : 
563
    case SEEK_CUR : 
563
    	current_offset += offset;
564
      current_offset += offset;
564
    	break;
565
      break;
565
    default:
566
    default:
566
    	ret = -1;
567
      ret = -1;
567
    	break;
568
      break;
568
    }
569
    }
569
		return current_offset;
570
    return current_offset;
570
	}
571
  }
571
	
572
572
  switch (whence)
573
  switch (whence)
573
  {
574
  {
574
    case SEEK_SET : 
575
    case SEEK_SET : 
Lines 583-649 Link Here
583
  }
584
  }
584
  if (ret>=0)
585
  if (ret>=0)
585
  {
586
  {
586
  	current_offset = ret - start_offset;
587
    current_offset = ret - start_offset;
587
  	if (spec_main_fd == fd)
588
    if (spec_main_fd == fd)
588
  		spec_main_offset = ret;
589
      spec_main_offset = ret;
589
  	return ret;
590
    return ret;
590
  }
591
  }
591
  else
592
  else
592
	  return -1;  // if a bad whence, then failure
593
    return -1;  // if a bad whence, then failure
593
}
594
}
594
595
595
596
596
unsigned char bFILE::read_byte()
597
uint8_t bFILE::read_uint8()
597
{ unsigned char x;
598
{ uint8_t x;
598
  read(&x,1);
599
  read(&x,1);
599
  return x;
600
  return x;
600
}
601
}
601
602
602
unsigned short bFILE::read_short()
603
uint16_t bFILE::read_uint16()
603
{ 
604
{ 
604
  unsigned short x;
605
  uint16_t x;
605
  read(&x,2); 
606
  read(&x,2); 
606
  return int_to_local(x);
607
  return uint16_to_local(x);
607
}
608
}
608
609
609
610
610
unsigned long bFILE::read_long()
611
uint32_t bFILE::read_uint32()
611
{ 
612
{ 
612
  unsigned long x;
613
  uint32_t x;
613
  read(&x,4); 
614
  read(&x,4); 
614
  return long_to_local(x);
615
  return uint32_to_local(x);
615
}
616
}
616
617
617
void bFILE::write_byte(unsigned char x)
618
void bFILE::write_uint8(uint8_t x)
618
{
619
{
619
  write(&x,1);
620
  write(&x,1);
620
}
621
}
621
622
622
void bFILE::write_short(unsigned short x)
623
void bFILE::write_uint16(uint16_t x)
623
{ 
624
{ 
624
  x=int_to_local(x);
625
  x=uint16_to_local(x);
625
  write(&x,2);
626
  write(&x,2);
626
}
627
}
627
628
628
629
629
void bFILE::write_long(unsigned long x)
630
void bFILE::write_uint32(uint32_t x)
630
{
631
{
631
  x=long_to_local(x);
632
  x=uint32_to_local(x);
632
  write(&x,4);
633
  write(&x,4);
633
}
634
}
634
635
635
void bFILE::write_double(double x)
636
void bFILE::write_double(double x)
636
{
637
{
637
  double a;
638
  double a;
638
  write_long((long)(modf(x,&a)*(double)(1<<32-1)));
639
  write_uint32((long)(modf(x,&a)*(double)(1<<32-1)));
639
  write_long((long)a);
640
  write_uint32((long)a);
640
}
641
}
641
642
642
double bFILE::read_double()
643
double bFILE::read_double()
643
{
644
{
644
  long a,b;
645
  long a,b;
645
  a=read_long();
646
  a=read_uint32();
646
  b=read_long();
647
  b=read_uint32();
647
  return (double)b+a/(double)(1<<32-1);
648
  return (double)b+a/(double)(1<<32-1);
648
}
649
}
649
650
Lines 754-765 Link Here
754
void spec_directory::startup(bFILE *fp)
755
void spec_directory::startup(bFILE *fp)
755
{
756
{
756
  char buf[256];
757
  char buf[256];
758
  memset(buf,0,256);
757
  fp->read(buf,8);
759
  fp->read(buf,8);
758
  buf[9]=0;
760
  buf[9]=0;
759
  size=0;
761
  size=0;
760
  if (!strcmp(buf,SPEC_SIGNATURE))
762
  if (!strcmp(buf,SPEC_SIGNATURE))
761
  {    
763
  {    
762
    total=fp->read_short();   
764
    total=fp->read_uint16();   
763
    entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries");
765
    entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries");
764
    long start=fp->tell();
766
    long start=fp->tell();
765
767
Lines 790-797 Link Here
790
      fp->read(se->name,len);
792
      fp->read(se->name,len);
791
      fp->read(&flags,1); 
793
      fp->read(&flags,1); 
792
794
793
      se->size=fp->read_long();
795
      se->size=fp->read_uint32();
794
      se->offset=fp->read_long();
796
      se->offset=fp->read_uint32();
795
      dp+=((sizeof(spec_entry)+len)+3)&(~3);
797
      dp+=((sizeof(spec_entry)+len)+3)&(~3);
796
    }
798
    }
797
  }
799
  }
Lines 877-883 Link Here
877
  strcpy(sig,SPEC_SIGNATURE);
879
  strcpy(sig,SPEC_SIGNATURE);
878
880
879
  if (fp->write(sig,sizeof(sig))!=sizeof(sig))    return 0;
881
  if (fp->write(sig,sizeof(sig))!=sizeof(sig))    return 0;
880
  fp->write_short(total);
882
  fp->write_uint16(total);
881
883
882
884
883
  int i;
885
  int i;
Lines 888-896 Link Here
888
    flags=0;
890
    flags=0;
889
    if (fp->write(&flags,1)!=1)                     return 0; 
891
    if (fp->write(&flags,1)!=1)                     return 0; 
890
892
891
    data_size=long_to_intel((*e)->size); 
893
    data_size=uint32_to_intel((*e)->size); 
892
    if (fp->write((char *)&data_size,4)!=4)              return 0; 
894
    if (fp->write((char *)&data_size,4)!=4)              return 0; 
893
    offset=long_to_intel((*e)->offset);
895
    offset=uint32_to_intel((*e)->offset);
894
    if (fp->write((char *)&offset,4)!=4)                  return 0; 
896
    if (fp->write((char *)&offset,4)!=4)                  return 0; 
895
897
896
  }
898
  }
Lines 910-967 Link Here
910
912
911
}
913
}
912
914
913
unsigned short read_short(FILE *fp)
915
uint16_t read_uint16(FILE *fp)
914
{
916
{
915
  unsigned short x;
917
  uint16_t x;
916
  fread(&x,1,2,fp); 
918
  fread(&x,1,2,fp); 
917
  return int_to_local(x);
919
  return uint16_to_local(x);
918
}
920
}
919
921
920
unsigned long read_long(FILE *fp)
922
uint32_t read_uint32(FILE *fp)
921
{
923
{
922
  unsigned long x;
924
  uint32_t x;
923
  fread(&x,1,4,fp);
925
  fread(&x,1,4,fp);
924
  return (long)long_to_local(x);
926
  return uint32_to_local(x);
925
}
927
}
926
void write_short(FILE *fp, unsigned short x)
928
void write_uint16(FILE *fp, uint16_t x)
927
{
929
{
928
  x=int_to_local(x);
930
  x=uint16_to_local(x);
929
  fwrite(&x,1,2,fp);
931
  fwrite(&x,1,2,fp);
930
}
932
}
931
933
932
void write_long(FILE *fp, unsigned long x)
934
void write_uint32(FILE *fp, uint32_t x)
933
{
935
{
934
  x=long_to_local(x);
936
  x=uint32_to_local(x);
935
  fwrite(&x,1,4,fp);
937
  fwrite(&x,1,4,fp);
936
}
938
}
937
939
938
unsigned char read_byte(FILE *fp) { return fgetc(fp)&0xff; }
940
uint8_t read_uint8(FILE *fp) { return fgetc(fp)&0xff; }
939
void write_byte(FILE *fp, unsigned char x) { fputc(x,fp); }
941
void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }
940
942
941
unsigned short read_other_long(FILE *fp)
943
uint32_t read_other_int32(FILE *fp)
942
{
944
{
943
  unsigned long x;
945
  uint32_t x;
944
  fread(&x,1,4,fp);
946
  fread(&x,1,4,fp);
945
  return big_long_to_local(x);
947
  return big_uint32_to_local(x);
946
}
948
}
947
949
948
unsigned long read_other_short(FILE *fp)
950
uint16_t read_other_uint16(FILE *fp)
949
{
951
{
950
  unsigned short x;
952
  uint16_t x;
951
  fread(&x,1,2,fp);
953
  fread(&x,1,2,fp);
952
  return big_short_to_local(x);
954
  return big_uint16_to_local(x);
953
}
955
}
954
956
955
957
956
void write_other_short(FILE *fp, unsigned short x)
958
void write_other_uint16(FILE *fp, uint16_t x)
957
{
959
{
958
  x=big_short_to_local(x);
960
  x=big_uint16_to_local(x);
959
  fwrite(&x,1,2,fp);
961
  fwrite(&x,1,2,fp);
960
}
962
}
961
963
962
void write_other_long(FILE *fp, unsigned long x)
964
void write_other_int32(FILE *fp, uint32_t x)
963
{
965
{
964
  x=big_long_to_local(x);
966
  x=big_uint32_to_local(x);
965
  fwrite(&x,1,4,fp);
967
  fwrite(&x,1,4,fp);
966
}
968
}
967
969
(-)abuse-sdl-0.7.0.orig/src/imlib/image.cpp (-120 / +120 lines)
Lines 11-17 Link Here
11
#endif
11
#endif
12
#include <stdlib.h>
12
#include <stdlib.h>
13
13
14
extern unsigned char current_background;
14
extern uint8_t current_background;
15
char *imerr_messages[]={"No error",
15
char *imerr_messages[]={"No error",
16
      		 	"Error occured while reading",
16
      		 	"Error occured while reading",
17
			"Incorrect file type",
17
			"Incorrect file type",
Lines 22-31 Link Here
22
			"Error occured while writing, (disk full?)"};
22
			"Error occured while writing, (disk full?)"};
23
			
23
			
24
                         
24
                         
25
short imerror=0;
25
int16_t imerror=0;
26
short swpfile_num=0;
26
int16_t swpfile_num=0;
27
27
28
short current_error()
28
int16_t current_error()
29
{ return imerror; }
29
{ return imerror; }
30
30
31
void clear_errors()
31
void clear_errors()
Lines 47-58 Link Here
47
  }
47
  }
48
}
48
}
49
49
50
void set_error(short x)
50
void set_error(int16_t x)
51
{ imerror=x; }
51
{ imerror=x; }
52
52
53
short last_error()
53
int16_t last_error()
54
{
54
{
55
  short ec;
55
  int16_t ec;
56
  ec=imerror;
56
  ec=imerror;
57
  imerror=0;
57
  imerror=0;
58
  return ec;
58
  return ec;
Lines 61-67 Link Here
61
linked_list image_list;
61
linked_list image_list;
62
62
63
63
64
image_descriptor::image_descriptor(short length, short height,
64
image_descriptor::image_descriptor(int16_t length, int16_t height,
65
				   int keep_dirties, int static_memory)
65
				   int keep_dirties, int static_memory)
66
66
67
{ clipx1=0; clipy1=0; 
67
{ clipx1=0; clipy1=0; 
Lines 71-77 Link Here
71
  static_mem=static_memory;  
71
  static_mem=static_memory;  
72
}
72
}
73
73
74
void image::change_size(short new_width, short new_height, unsigned char *page)
74
void image::change_size(int16_t new_width, int16_t new_height, uint8_t *page)
75
{
75
{
76
  delete_page();
76
  delete_page();
77
  w=new_width;
77
  w=new_width;
Lines 96-109 Link Here
96
  if (dat) jfree((char *)dat);
96
  if (dat) jfree((char *)dat);
97
}
97
}
98
98
99
unsigned char image::pixel(short x, short y)
99
uint8_t image::pixel(int16_t x, int16_t y)
100
{
100
{
101
  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
101
  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
102
     "image::pixel Bad pixel xy");
102
     "image::pixel Bad pixel xy");
103
  return (*(scan_line(y)+x));
103
  return (*(scan_line(y)+x));
104
}
104
}
105
105
106
void image::putpixel(short x, short y, char color)
106
void image::putpixel(int16_t x, int16_t y, char color)
107
{
107
{
108
  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
108
  CONDITION(x>=0 && x<width() && y>=0 && y<height(),
109
     "image::putpixel Bad pixel xy");
109
     "image::putpixel Bad pixel xy");
Lines 115-121 Link Here
115
}
115
}
116
116
117
117
118
image::image(short width, short height, unsigned char *page_buffer, short create_descriptor)
118
image::image(int16_t width, int16_t height, uint8_t *page_buffer, int16_t create_descriptor)
119
{
119
{
120
  w=width;
120
  w=width;
121
  h=height;  
121
  h=height;  
Lines 131-140 Link Here
131
131
132
image::image(spec_entry *e, bFILE *fp)
132
image::image(spec_entry *e, bFILE *fp)
133
{
133
{
134
  short i; 
134
  int16_t i; 
135
  fp->seek(e->offset,0);
135
  fp->seek(e->offset,0);
136
  w=fp->read_short();
136
  w=fp->read_uint16();
137
  h=fp->read_short();
137
  h=fp->read_uint16();
138
  special=NULL;
138
  special=NULL;
139
  make_page(w,h,NULL);
139
  make_page(w,h,NULL);
140
  for (i=0;i<h;i++)
140
  for (i=0;i<h;i++)
Lines 144-152 Link Here
144
144
145
image::image(bFILE *fp)
145
image::image(bFILE *fp)
146
{
146
{
147
  short i; 
147
  int16_t i; 
148
  w=fp->read_short();
148
  w=fp->read_uint16();
149
  h=fp->read_short();
149
  h=fp->read_uint16();
150
  special=NULL;
150
  special=NULL;
151
  make_page(w,h,NULL);
151
  make_page(w,h,NULL);
152
  for (i=0;i<h;i++)
152
  for (i=0;i<h;i++)
Lines 171-182 Link Here
171
171
172
void image_init()
172
void image_init()
173
{
173
{
174
  unsigned char bt[2];
174
  uint8_t bt[2];
175
  unsigned short wrd,*up;
175
  uint16_t wrd,*up;
176
  bt[0]=1;
176
  bt[0]=1;
177
  bt[1]=0;
177
  bt[1]=0;
178
  up=(unsigned short *)bt;
178
  up=(uint16_t *)bt;
179
  wrd=int_to_intel(*up);
179
  wrd=uint16_to_intel(*up);
180
  if (wrd!=0x01)
180
  if (wrd!=0x01)
181
  { printf("Compiled under wrong ENDING-nes, edit system.h and try again\n");
181
  { printf("Compiled under wrong ENDING-nes, edit system.h and try again\n");
182
    printf("1 (intel) = %d\n",(int)wrd);
182
    printf("1 (intel) = %d\n",(int)wrd);
Lines 186-196 Link Here
186
}
186
}
187
187
188
188
189
long image::total_pixels(unsigned char background)
189
int32_t image::total_pixels(uint8_t background)
190
{
190
{
191
  short i,j;
191
  int16_t i,j;
192
  long co;
192
  int32_t co;
193
  unsigned char *c;
193
  uint8_t *c;
194
  for (co=0,i=height()-1;i>=0;i--)
194
  for (co=0,i=height()-1;i>=0;i--)
195
  { c=scan_line(i);
195
  { c=scan_line(i);
196
    for (j=width()-1;j>=0;j--,c++)
196
    for (j=width()-1;j>=0;j--,c++)
Lines 199-207 Link Here
199
  return co;
199
  return co;
200
}
200
}
201
201
202
void image::clear(short color)
202
void image::clear(int16_t color)
203
{
203
{
204
  short i;
204
  int16_t i;
205
  if (color==-1) color=current_background;
205
  if (color==-1) color=current_background;
206
  if (special)
206
  if (special)
207
  { if (special->x1_clip()<=special->x2_clip())
207
  { if (special->x1_clip()<=special->x2_clip())
Lines 219-227 Link Here
219
image *image::copy()
219
image *image::copy()
220
{
220
{
221
  image *im;
221
  image *im;
222
  unsigned char *c,*dat;
222
  uint8_t *c,*dat;
223
  int i;
223
  int i;
224
  dat=(unsigned char *)jmalloc(width(),"image copy");
224
  dat=(uint8_t *)jmalloc(width(),"image copy");
225
  im=new image(width(),height());
225
  im=new image(width(),height());
226
  for (i=height()-1;i>=0;i--)
226
  for (i=height()-1;i>=0;i--)
227
  { c=scan_line(i);
227
  { c=scan_line(i);
Lines 235-247 Link Here
235
235
236
236
237
237
238
void image::line(short x1, short y1,short x2, short y2, unsigned char color)
238
void image::line(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
239
{
239
{
240
  short i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
240
  int16_t i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
241
  unsigned dcy,dcx;
241
  unsigned dcy,dcx;
242
  // check to make sure that both endpoint are on the screen
242
  // check to make sure that both endpoint are on the screen
243
243
244
  short cx1,cy1,cx2,cy2;
244
  int16_t cx1,cy1,cx2,cy2;
245
245
246
  // check to see if the line is completly clipped off
246
  // check to see if the line is completly clipped off
247
  get_clip(cx1,cy1,cx2,cy2);  
247
  get_clip(cx1,cy1,cx2,cy2);  
Lines 377-386 Link Here
377
}
377
}
378
378
379
379
380
void image::put_image(image *screen, short x, short y, char transparent)
380
void image::put_image(image *screen, int16_t x, int16_t y, char transparent)
381
{
381
{
382
  short i,j,xl,yl;
382
  int16_t i,j,xl,yl;
383
  unsigned char *pg1,*pg2,*source,*dest;
383
  uint8_t *pg1,*pg2,*source,*dest;
384
  if (screen->special)  // the screen is clipped then we onl want to put
384
  if (screen->special)  // the screen is clipped then we onl want to put
385
		    // part of the image
385
		    // part of the image
386
    put_part(screen,x,y,0,0,width()-1,height()-1,transparent);
386
    put_part(screen,x,y,0,0,width()-1,height()-1,transparent);
Lines 416-425 Link Here
416
  }
416
  }
417
}
417
}
418
418
419
void image::fill_image(image *screen, short x1, short y1, short x2, short y2, short allign)
419
void image::fill_image(image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t align)
420
{
420
{
421
  short i,j,w,xx,start,xl,starty;
421
  int16_t i,j,w,xx,start,xl,starty;
422
  unsigned char *pg1,*pg2;
422
  uint8_t *pg1,*pg2;
423
  CHECK(x1<=x2 && y1<=y2);  // we should have gotten this
423
  CHECK(x1<=x2 && y1<=y2);  // we should have gotten this
424
424
425
  if (screen->special)
425
  if (screen->special)
Lines 438-444 Link Here
438
    return ;
438
    return ;
439
  screen->add_dirty(x1,y1,x2,y2);
439
  screen->add_dirty(x1,y1,x2,y2);
440
  w=width();
440
  w=width();
441
  if (allign)
441
  if (align)
442
  {
442
  {
443
    start=x1%w;
443
    start=x1%w;
444
    starty=y1%height();
444
    starty=y1%height();
Lines 466-477 Link Here
466
}
466
}
467
467
468
468
469
void image::put_part(image *screen, short x, short y,
469
void image::put_part(image *screen, int16_t x, int16_t y,
470
		short x1, short y1, short x2, short y2, char transparent)
470
		int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
471
{
471
{
472
  short xl,yl,j,i;
472
  int16_t xl,yl,j,i;
473
  short cx1,cy1,cx2,cy2;
473
  int16_t cx1,cy1,cx2,cy2;
474
  unsigned char *pg1,*pg2,*source,*dest;
474
  uint8_t *pg1,*pg2,*source,*dest;
475
  CHECK(x1<=x2 && y1<=y2);
475
  CHECK(x1<=x2 && y1<=y2);
476
476
477
  screen->get_clip(cx1,cy1,cx2,cy2);
477
  screen->get_clip(cx1,cy1,cx2,cy2);
Lines 532-543 Link Here
532
  }    
532
  }    
533
}
533
}
534
534
535
void image::put_part_xrev(image *screen, short x, short y,
535
void image::put_part_xrev(image *screen, int16_t x, int16_t y,
536
		short x1, short y1, short x2, short y2, char transparent)
536
		int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
537
{
537
{
538
  short xl,yl,j,i;
538
  int16_t xl,yl,j,i;
539
  short cx1,cy1,cx2,cy2;
539
  int16_t cx1,cy1,cx2,cy2;
540
  unsigned char *pg1,*pg2,*source,*dest;
540
  uint8_t *pg1,*pg2,*source,*dest;
541
  CHECK(x1<=x2 && y1<=y2);
541
  CHECK(x1<=x2 && y1<=y2);
542
542
543
  i=x1; x1=width()-x2-1;  // reverse the x locations
543
  i=x1; x1=width()-x2-1;  // reverse the x locations
Lines 595-607 Link Here
595
}
595
}
596
596
597
597
598
void image::put_part_masked(image *screen, image *mask, short x, short y,
598
void image::put_part_masked(image *screen, image *mask, int16_t x, int16_t y,
599
		short maskx, short masky,
599
		int16_t maskx, int16_t masky,
600
		short x1, short y1, short x2, short y2)
600
		int16_t x1, int16_t y1, int16_t x2, int16_t y2)
601
{
601
{
602
  short xl,yl,j,i,ml,mh;
602
  int16_t xl,yl,j,i,ml,mh;
603
  short cx1,cy1,cx2,cy2;
603
  int16_t cx1,cy1,cx2,cy2;
604
  unsigned char *pg1,*pg2,*pg3;
604
  uint8_t *pg1,*pg2,*pg3;
605
  CHECK(x1<=x2 && y1<=y2);
605
  CHECK(x1<=x2 && y1<=y2);
606
606
607
  if (screen->special)
607
  if (screen->special)
Lines 657-674 Link Here
657
657
658
658
659
659
660
unsigned char image::brightest_color(palette *pal)
660
uint8_t image::brightest_color(palette *pal)
661
{ unsigned char *p,r,g,b,bri;
661
{ uint8_t *p,r,g,b,bri;
662
  short i,j;
662
  int16_t i,j;
663
  long brv;
663
  int32_t brv;
664
  brv=0; bri=0;
664
  brv=0; bri=0;
665
  for (j=0;j<h;j++)
665
  for (j=0;j<h;j++)
666
  {
666
  {
667
    p=scan_line(j);
667
    p=scan_line(j);
668
    for (i=0;i<w;i++)
668
    for (i=0;i<w;i++)
669
    { pal->get(p[i],r,g,b);
669
    { pal->get(p[i],r,g,b);
670
      if ((long)r*(long)g*(long)b>brv)
670
      if ((int32_t)r*(int32_t)g*(int32_t)b>brv)
671
      { brv=(long)r*(long)g*(long)b;
671
      { brv=(int32_t)r*(int32_t)g*(int32_t)b;
672
	bri=p[i];
672
	bri=p[i];
673
      }
673
      }
674
    }
674
    }
Lines 676-692 Link Here
676
  return bri;
676
  return bri;
677
}
677
}
678
678
679
unsigned char image::darkest_color(palette *pal, short noblack)
679
uint8_t image::darkest_color(palette *pal, int16_t noblack)
680
{ unsigned char *p,r,g,b,bri;
680
{ uint8_t *p,r,g,b,bri;
681
  short i,j;
681
  int16_t i,j;
682
  long brv,x;
682
  int32_t brv,x;
683
  brv=(long)258*(long)258*(long)258; bri=0;
683
  brv=(int32_t)258*(int32_t)258*(int32_t)258; bri=0;
684
  for (j=0;j<h;j++)
684
  for (j=0;j<h;j++)
685
  {
685
  {
686
    p=scan_line(j);
686
    p=scan_line(j);
687
    for (i=0;i<w;i++)
687
    for (i=0;i<w;i++)
688
    { pal->get(p[i],r,g,b);
688
    { pal->get(p[i],r,g,b);
689
      x=(long)r*(long)g*(long)b;
689
      x=(int32_t)r*(int32_t)g*(int32_t)b;
690
      if (x<brv && (x || !noblack))
690
      if (x<brv && (x || !noblack))
691
      { brv=x;
691
      { brv=x;
692
	bri=p[i];
692
	bri=p[i];
Lines 696-702 Link Here
696
  return bri;
696
  return bri;
697
}
697
}
698
698
699
void image::rectangle(short x1, short y1,short x2, short y2, unsigned char color)
699
void image::rectangle(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
700
{
700
{
701
  line(x1,y1,x2,y1,color);
701
  line(x1,y1,x2,y1,color);
702
  line(x2,y1,x2,y2,color);
702
  line(x2,y1,x2,y2,color);
Lines 704-710 Link Here
704
  line(x1,y1,x1,y2,color);
704
  line(x1,y1,x1,y2,color);
705
}
705
}
706
706
707
void image::set_clip(short x1, short y1, short x2, short y2)
707
void image::set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
708
{
708
{
709
  // If the image does not already have an Image descriptor, allocate one.
709
  // If the image does not already have an Image descriptor, allocate one.
710
710
Lines 717-723 Link Here
717
		       // should be it will adjust to fit wiothin the image.
717
		       // should be it will adjust to fit wiothin the image.
718
}
718
}
719
719
720
void image::get_clip (short &x1, short &y1, short &x2, short &y2)
720
void image::get_clip (int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
721
{
721
{
722
  if (special)
722
  if (special)
723
    special->get_clip(x1,y1,x2,y2);
723
    special->get_clip(x1,y1,x2,y2);
Lines 725-731 Link Here
725
  { x1=0; y1=0; x2=width()-1; y2=height()-1; }
725
  { x1=0; y1=0; x2=width()-1; y2=height()-1; }
726
}
726
}
727
727
728
void image::in_clip  (short x1, short y1, short x2, short y2)
728
void image::in_clip  (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
729
{
729
{
730
  if (special)
730
  if (special)
731
  {
731
  {
Lines 746-752 Link Here
746
void image_descriptor::reduce_dirties()
746
void image_descriptor::reduce_dirties()
747
{
747
{
748
  dirty_rect *p,*q;
748
  dirty_rect *p,*q;
749
  short x1,y1,x2,y2,nn;
749
  int16_t x1,y1,x2,y2,nn;
750
  x1=6000; y1=6000;
750
  x1=6000; y1=6000;
751
  x2=0; y2=0;
751
  x2=0; y2=0;
752
  p=(dirty_rect *)dirties.first();
752
  p=(dirty_rect *)dirties.first();
Lines 768-774 Link Here
768
768
769
void image_descriptor::delete_dirty(int x1, int y1, int x2, int y2)
769
void image_descriptor::delete_dirty(int x1, int y1, int x2, int y2)
770
{
770
{
771
  short i,ax1,ay1,ax2,ay2;
771
  int16_t i,ax1,ay1,ax2,ay2;
772
  dirty_rect *p,*next;
772
  dirty_rect *p,*next;
773
  if (keep_dirt)
773
  if (keep_dirt)
774
  {
774
  {
Lines 868-874 Link Here
868
// specifies that an area is a dirty
868
// specifies that an area is a dirty
869
void image_descriptor::add_dirty(int x1, int y1, int x2, int y2)
869
void image_descriptor::add_dirty(int x1, int y1, int x2, int y2)
870
{
870
{
871
  short i;
871
  int16_t i;
872
  dirty_rect *p;
872
  dirty_rect *p;
873
  if (keep_dirt)
873
  if (keep_dirt)
874
  {
874
  {
Lines 940-948 Link Here
940
  }
940
  }
941
}
941
}
942
942
943
void image::bar      (short x1, short y1, short x2, short y2, unsigned char color)
943
void image::bar      (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
944
{
944
{
945
  short y;
945
  int16_t y;
946
  if (x1>x2 || y1>y2) return ;
946
  if (x1>x2 || y1>y2) return ;
947
  if (special)
947
  if (special)
948
  { x1=special->bound_x1(x1);
948
  { x1=special->bound_x1(x1);
Lines 963-971 Link Here
963
  add_dirty(x1,y1,x2,y2);
963
  add_dirty(x1,y1,x2,y2);
964
}
964
}
965
965
966
void image::xor_bar  (short x1, short y1, short x2, short y2, unsigned char color)
966
void image::xor_bar  (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
967
{
967
{
968
  short y,x;
968
  int16_t y,x;
969
  if (x1>x2 || y1>y2) return ;
969
  if (x1>x2 || y1>y2) return ;
970
  if (special)
970
  if (special)
971
  { x1=special->bound_x1(x1);
971
  { x1=special->bound_x1(x1);
Lines 982-991 Link Here
982
  if (x2<0 || y2<0 || x1>=width() || y1>=height() || x2<x1 || y2<y1)
982
  if (x2<0 || y2<0 || x1>=width() || y1>=height() || x2<x1 || y2<y1)
983
    return ;
983
    return ;
984
984
985
  unsigned char *sl=scan_line(y1)+x1; 
985
  uint8_t *sl=scan_line(y1)+x1; 
986
  for (y=y1;y<=y2;y++)
986
  for (y=y1;y<=y2;y++)
987
  {
987
  {
988
    unsigned char *s=sl;
988
    uint8_t *s=sl;
989
    for (x=x1;x<=x2;x++,s++)
989
    for (x=x1;x<=x2;x++,s++)
990
      *s=(*s)^color;
990
      *s=(*s)^color;
991
    sl+=w;
991
    sl+=w;
Lines 995-1005 Link Here
995
}
995
}
996
996
997
997
998
void image::unpack_scanline(short line, char bitsperpixel)
998
void image::unpack_scanline(int16_t line, char bitsperpixel)
999
{
999
{
1000
  short x;
1000
  int16_t x;
1001
  unsigned char *sl,*ex,mask,bt,sh;
1001
  uint8_t *sl,*ex,mask,bt,sh;
1002
  ex=(unsigned char *)jmalloc(width(),"image::unpacked scanline");
1002
  ex=(uint8_t *)jmalloc(width(),"image::unpacked scanline");
1003
  sl=scan_line(line);
1003
  sl=scan_line(line);
1004
  memcpy(ex,sl,width());
1004
  memcpy(ex,sl,width());
1005
1005
Lines 1017-1029 Link Here
1017
1017
1018
void image::dither(palette *pal)
1018
void image::dither(palette *pal)
1019
{
1019
{
1020
  short x,y,i,j;
1020
  int16_t x,y,i,j;
1021
  unsigned char dt_matrix[]={0,  136,24, 170,
1021
  uint8_t dt_matrix[]={0,  136,24, 170,
1022
		   68, 204,102,238,
1022
		   68, 204,102,238,
1023
		   51, 187, 17,153,
1023
		   51, 187, 17,153,
1024
		   119,255, 85,221};
1024
		   119,255, 85,221};
1025
1025
1026
  unsigned char *sl;
1026
  uint8_t *sl;
1027
  for (y=height()-1;y>=0;y--)
1027
  for (y=height()-1;y>=0;y--)
1028
  {
1028
  {
1029
    sl=scan_line(y);
1029
    sl=scan_line(y);
Lines 1048-1057 Link Here
1048
  }
1048
  }
1049
}
1049
}
1050
1050
1051
void image::resize(short new_width, short new_height)
1051
void image::resize(int16_t new_width, int16_t new_height)
1052
{
1052
{
1053
  int old_width=width(),old_height=height();
1053
  int old_width=width(),old_height=height();
1054
  unsigned char *im=(unsigned char *)jmalloc(width()*height(),"image::resized");
1054
  uint8_t *im=(uint8_t *)jmalloc(width()*height(),"image::resized");
1055
  memcpy(im,scan_line(0),width()*height());
1055
  memcpy(im,scan_line(0),width()*height());
1056
1056
1057
  delete_page();
1057
  delete_page();
Lines 1059-1066 Link Here
1059
  w=new_width;      // set the new hieght and width
1059
  w=new_width;      // set the new hieght and width
1060
  h=new_height;
1060
  h=new_height;
1061
1061
1062
  unsigned char *sl1,*sl2;
1062
  uint8_t *sl1,*sl2;
1063
  short y,y2,x2;
1063
  int16_t y,y2,x2;
1064
  double yc,xc,yd,xd;
1064
  double yc,xc,yd,xd;
1065
1065
1066
1066
Lines 1079-1095 Link Here
1079
  if (special) special->resize(new_width,new_height);
1079
  if (special) special->resize(new_width,new_height);
1080
}
1080
}
1081
1081
1082
void image::scroll(short x1, short y1, short x2, short y2, short xd, short yd)
1082
void image::scroll(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd)
1083
{
1083
{
1084
  short cx1,cy1,cx2,cy2;
1084
  int16_t cx1,cy1,cx2,cy2;
1085
  CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<width() && y2<height());
1085
  CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<width() && y2<height());
1086
  if (special)
1086
  if (special)
1087
  {
1087
  {
1088
    special->get_clip(cx1,cy1,cx2,cy2);
1088
    special->get_clip(cx1,cy1,cx2,cy2);
1089
    x1=max(x1,cx1); y1=max(cy1,y1); x2=min(x2,cx2); y2=min(y2,cy2);
1089
    x1=max(x1,cx1); y1=max(cy1,y1); x2=min(x2,cx2); y2=min(y2,cy2);
1090
  }
1090
  }
1091
  short xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
1091
  int16_t xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
1092
  unsigned char *src,*dst;
1092
  uint8_t *src,*dst;
1093
  if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; }
1093
  if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; }
1094
  if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; }
1094
  if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; }
1095
  for (ytot=y2-y1-abs(yd)+1;ytot;ytot--)
1095
  for (ytot=y2-y1-abs(yd)+1;ytot;ytot--)
Lines 1106-1114 Link Here
1106
}
1106
}
1107
1107
1108
1108
1109
image *image::create_smooth(short smoothness)
1109
image *image::create_smooth(int16_t smoothness)
1110
{
1110
{
1111
  short i,j,k,l,t,d;
1111
  int16_t i,j,k,l,t,d;
1112
  image *im;
1112
  image *im;
1113
  CHECK(smoothness>=0);
1113
  CHECK(smoothness>=0);
1114
  if (!smoothness) return NULL;
1114
  if (!smoothness) return NULL;
Lines 1128-1135 Link Here
1128
  return im;
1128
  return im;
1129
}
1129
}
1130
1130
1131
void image::wiget_bar(short x1, short y1, short x2, short y2, 
1131
void image::wiget_bar(int16_t x1, int16_t y1, int16_t x2, int16_t y2, 
1132
   	unsigned char light, unsigned char med, unsigned char dark)
1132
   	uint8_t light, uint8_t med, uint8_t dark)
1133
{
1133
{
1134
  line(x1,y1,x2,y1,light);
1134
  line(x1,y1,x2,y1,light);
1135
  line(x1,y1,x1,y2,light);
1135
  line(x1,y1,x1,y2,light);
Lines 1141-1157 Link Here
1141
class fill_rec
1141
class fill_rec
1142
{
1142
{
1143
public :
1143
public :
1144
  short x,y;
1144
  int16_t x,y;
1145
  fill_rec *last;
1145
  fill_rec *last;
1146
  fill_rec(short X, short Y, fill_rec *Last)
1146
  fill_rec(int16_t X, int16_t Y, fill_rec *Last)
1147
  { x=X; y=Y; last=Last; }
1147
  { x=X; y=Y; last=Last; }
1148
} ;
1148
} ;
1149
1149
1150
void image::flood_fill(short x, short y, unsigned char color)
1150
void image::flood_fill(int16_t x, int16_t y, uint8_t color)
1151
{
1151
{
1152
  unsigned char *sl,*above,*below;
1152
  uint8_t *sl,*above,*below;
1153
  fill_rec *recs=NULL,*r;
1153
  fill_rec *recs=NULL,*r;
1154
  unsigned char fcolor;
1154
  uint8_t fcolor;
1155
  sl=scan_line(y);
1155
  sl=scan_line(y);
1156
  fcolor=sl[x];
1156
  fcolor=sl[x];
1157
  if (fcolor==color) return ;
1157
  if (fcolor==color) return ;
Lines 1230-1245 Link Here
1230
1230
1231
#define LED_L 5
1231
#define LED_L 5
1232
#define LED_H 5
1232
#define LED_H 5
1233
void image::burn_led(short x, short y, long num, short color, short scale)
1233
void image::burn_led(int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale)
1234
{
1234
{
1235
  char st[100];
1235
  char st[100];
1236
  short ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
1236
  int16_t ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
1237
  short ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
1237
  int16_t ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
1238
1238
1239
  short dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,
1239
  int16_t dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,
1240
             2+64+1+8+16,64+32+1+8+16,2+4+8,1+2+4+8+16+32+64,64+2+4+1+8,1};
1240
             2+64+1+8+16,64+32+1+8+16,2+4+8,1+2+4+8+16+32+64,64+2+4+1+8,1};
1241
  short xx,yy,zz;
1241
  int16_t xx,yy,zz;
1242
  sprintf(st,"%8ld",num);
1242
  sprintf(st,"%8ld",(long int)num);
1243
  for (xx=0;xx<8;xx++)
1243
  for (xx=0;xx<8;xx++)
1244
  {
1244
  {
1245
    if (st[xx]!=' ')
1245
    if (st[xx]!=' ')
Lines 1257-1272 Link Here
1257
  }
1257
  }
1258
}
1258
}
1259
1259
1260
unsigned char dither_matrix[]={0,  136,24, 170,
1260
uint8_t dither_matrix[]={0,  136,24, 170,
1261
		     68, 204,102,238,
1261
		     68, 204,102,238,
1262
		     51, 187, 17,153,
1262
		     51, 187, 17,153,
1263
		     119,255, 85,221};
1263
		     119,255, 85,221};
1264
1264
1265
image *image::copy_part_dithered (short x1, short y1, short x2, short y2)
1265
image *image::copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
1266
{
1266
{
1267
  short x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
1267
  int16_t x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
1268
  image *ret;
1268
  image *ret;
1269
  unsigned char *sl1,*sl2;
1269
  uint8_t *sl1,*sl2;
1270
  get_clip(cx1,cy1,cx2,cy2);
1270
  get_clip(cx1,cy1,cx2,cy2);
1271
  if (y1<cy1) y1=cy1;
1271
  if (y1<cy1) y1=cy1;
1272
  if (x1<cx1) x1=cx1;
1272
  if (x1<cx1) x1=cx1;
Lines 1303-1309 Link Here
1303
1303
1304
void image::flip_x()
1304
void image::flip_x()
1305
{
1305
{
1306
  unsigned char *rev=(unsigned char *)jmalloc(width(),"image tmp::flipped_x"),*sl;
1306
  uint8_t *rev=(uint8_t *)jmalloc(width(),"image tmp::flipped_x"),*sl;
1307
  CONDITION(rev,"memory allocation"); 
1307
  CONDITION(rev,"memory allocation"); 
1308
  int y,x,i;
1308
  int y,x,i;
1309
  for (y=0;y<height();y++)
1309
  for (y=0;y<height();y++)
Lines 1317-1323 Link Here
1317
1317
1318
void image::flip_y()
1318
void image::flip_y()
1319
{
1319
{
1320
  unsigned char *rev=(unsigned char *)jmalloc(width(),"image::flipped_y"),*sl;
1320
  uint8_t *rev=(uint8_t *)jmalloc(width(),"image::flipped_y"),*sl;
1321
  CONDITION(rev,"memory allocation"); 
1321
  CONDITION(rev,"memory allocation"); 
1322
  int y;
1322
  int y;
1323
  for (y=0;y<height()/2;y++)
1323
  for (y=0;y<height()/2;y++)
Lines 1328-1336 Link Here
1328
  }
1328
  }
1329
}
1329
}
1330
1330
1331
void image::make_color(unsigned char color)
1331
void image::make_color(uint8_t color)
1332
{
1332
{
1333
  unsigned char *sl;
1333
  uint8_t *sl;
1334
  int y,x;
1334
  int y,x;
1335
  for (y=0;y<height();y++)
1335
  for (y=0;y<height();y++)
1336
  {
1336
  {
(-)abuse-sdl-0.7.0.orig/src/imlib/filesel.cpp (-4 / +4 lines)
Lines 56-64 Link Here
56
      wid=0;
56
      wid=0;
57
      int i=0;
57
      int i=0;
58
      for (;i<tf;i++)
58
      for (;i<tf;i++)
59
      if (strlen(f[i])>wid) wid=strlen(f[i]);
59
      if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
60
      for (i=0;i<td;i++)
60
      for (i=0;i<td;i++)
61
      if (strlen(d[i])+2>wid) wid=strlen(d[i])+2;
61
      if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
62
      sx=0;
62
      sx=0;
63
63
64
      
64
      
Lines 102-110 Link Here
102
  wid=0;
102
  wid=0;
103
  int i=0;
103
  int i=0;
104
  for (;i<tf;i++)
104
  for (;i<tf;i++)
105
    if (strlen(f[i])>wid) wid=strlen(f[i]);
105
    if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
106
  for (i=0;i<td;i++)
106
  for (i=0;i<td;i++)
107
    if (strlen(d[i])+2>wid) wid=strlen(d[i])+2;
107
    if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
108
  reconfigure();  
108
  reconfigure();  
109
}
109
}
110
110
(-)abuse-sdl-0.7.0.orig/src/imlib/pmenu.cpp (-1 / +1 lines)
Lines 275-281 Link Here
275
  int w=bar->screen->width();
275
  int w=bar->screen->width();
276
  
276
  
277
277
278
  int total=0,tx,tw,i=0,x;
278
  int total=0,tw,i=0,x=0;
279
  for (pmenu_item *pp=top;pp;pp=pp->next,i++) 
279
  for (pmenu_item *pp=top;pp;pp=pp->next,i++) 
280
  { if (pp==p) x=i;
280
  { if (pp==p) x=i;
281
    total++;
281
    total++;
(-)abuse-sdl-0.7.0.orig/src/imlib/morph.cpp (-19 / +19 lines)
Lines 354-373 Link Here
354
354
355
    for (i=0;i<total;i++)
355
    for (i=0;i<total;i++)
356
    { 
356
    { 
357
      ((morph_point16 *)p+i)->x1=fp->read_short();
357
      ((morph_point16 *)p+i)->x1=fp->read_uint16();
358
      ((morph_point16 *)p+i)->y1=fp->read_short();
358
      ((morph_point16 *)p+i)->y1=fp->read_uint16();
359
      ((morph_point16 *)p+i)->x2=fp->read_short();
359
      ((morph_point16 *)p+i)->x2=fp->read_uint16();
360
      ((morph_point16 *)p+i)->y2=fp->read_short();
360
      ((morph_point16 *)p+i)->y2=fp->read_uint16();
361
      fp->read( &((morph_point16 *)p+i)->start_color,1);
361
      fp->read( &((morph_point16 *)p+i)->start_color,1);
362
      fp->read( &((morph_point16 *)p+i)->end_color,1);
362
      fp->read( &((morph_point16 *)p+i)->end_color,1);
363
    }
363
    }
364
364
365
    small=0;
365
    small=0;
366
  }
366
  }
367
  w[0]=fp->read_short();
367
  w[0]=fp->read_uint16();
368
  h[0]=fp->read_short();  
368
  h[0]=fp->read_uint16();  
369
  w[1]=fp->read_short();
369
  w[1]=fp->read_uint16();
370
  h[1]=fp->read_short();
370
  h[1]=fp->read_uint16();
371
}
371
}
372
372
373
void jmorph::show_frame(image *screen, int x, int y, 
373
void jmorph::show_frame(image *screen, int x, int y, 
Lines 677-683 Link Here
677
  int i;
677
  int i;
678
678
679
  
679
  
680
  fp->write_long(total);  
680
  fp->write_uint32(total);  
681
  if (small)
681
  if (small)
682
  {
682
  {
683
683
Lines 690-707 Link Here
690
  else
690
  else
691
  {
691
  {
692
    for (i=0;i<total;i++)
692
    for (i=0;i<total;i++)
693
    { fp->write_short(((morph_point16 *)p+i)->x1);
693
    { fp->write_uint16(((morph_point16 *)p+i)->x1);
694
      fp->write_short(((morph_point16 *)p+i)->y1);
694
      fp->write_uint16(((morph_point16 *)p+i)->y1);
695
      fp->write_short(((morph_point16 *)p+i)->x2);
695
      fp->write_uint16(((morph_point16 *)p+i)->x2);
696
      fp->write_short(((morph_point16 *)p+i)->y2);
696
      fp->write_uint16(((morph_point16 *)p+i)->y2);
697
      fp->write( &((morph_point16 *)p+i)->start_color,1);
697
      fp->write( &((morph_point16 *)p+i)->start_color,1);
698
      fp->write( &((morph_point16 *)p+i)->end_color,1);
698
      fp->write( &((morph_point16 *)p+i)->end_color,1);
699
    }
699
    }
700
  }
700
  }
701
  fp->write_short(w[0]);
701
  fp->write_uint16(w[0]);
702
  fp->write_short(h[0]);
702
  fp->write_uint16(h[0]);
703
  fp->write_short(w[1]);
703
  fp->write_uint16(w[1]);
704
  fp->write_short(h[1]);
704
  fp->write_uint16(h[1]);
705
  return 1;
705
  return 1;
706
}
706
}
707
707
Lines 876-887 Link Here
876
{
876
{
877
  int i;
877
  int i;
878
  
878
  
879
  patches=fp->read_short();
879
  patches=fp->read_uint16();
880
  pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
880
  pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
881
  
881
  
882
  for (i=0;i<patches;i++)
882
  for (i=0;i<patches;i++)
883
  {
883
  {
884
    pats[i].patches=fp->read_short();
884
    pats[i].patches=fp->read_uint16();
885
    if (pats[i].patches)
885
    if (pats[i].patches)
886
    {      
886
    {      
887
      pats[i].patch_data=(unsigned char *)jmalloc(3*pats[i].patches,"patched_morph::patch_data");
887
      pats[i].patch_data=(unsigned char *)jmalloc(3*pats[i].patches,"patched_morph::patch_data");
(-)abuse-sdl-0.7.0.orig/src/imlib/fonts.cpp (-3 / +3 lines)
Lines 36-46 Link Here
36
36
37
void JCFont::put_char(image *screen,  int x, int y, char ch, int color)
37
void JCFont::put_char(image *screen,  int x, int y, char ch, int color)
38
{
38
{
39
  if (let[ch])
39
  if (let[(int)ch])
40
  {
40
  {
41
    if (color>=0)
41
    if (color>=0)
42
      let[ch]->put_color(screen,x,y,color);
42
      let[(int)ch]->put_color(screen,x,y,color);
43
    else let[ch]->put_image(screen,x,y);
43
    else let[(int)ch]->put_image(screen,x,y);
44
  }
44
  }
45
}
45
}
46
46
(-)abuse-sdl-0.7.0.orig/src/include/compiled.hpp (-2 / +2 lines)
Lines 1-7 Link Here
1
#ifndef __COMPILED_HPP_
1
#ifndef __COMPILED_HPP_
2
#define __COMPILED_HPP_
2
#define __COMPILED_HPP_
3
#include "macs.hpp"
3
#include "macs.hpp"
4
extern long S_fall_start,S_falling,S_landing,S_pounce_wait,
4
extern int32_t S_fall_start,S_falling,S_landing,S_pounce_wait,
5
            S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
5
            S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
6
            S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
6
            S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
7
	    S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
7
	    S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
Lines 24-30 Link Here
24
void compiled_init();
24
void compiled_init();
25
void compiled_uninit();
25
void compiled_uninit();
26
26
27
extern uchar *bad_guy_array;    // list flaging each character saying they are a bad bug or not
27
extern uint8_t *bad_guy_array;  // list flaging each character saying they are a bad bug or not
28
                                // mainly used by the rocket to find targets
28
                                // mainly used by the rocket to find targets
29
29
30
#endif
30
#endif
(-)abuse-sdl-0.7.0.orig/src/include/netface.hpp (-22 / +22 lines)
Lines 95-119 Link Here
95
95
96
struct net_packet
96
struct net_packet
97
{
97
{
98
  unsigned char data[PACKET_MAX_SIZE];
98
  uint8_t data[PACKET_MAX_SIZE];
99
  int packet_prefix_size()                 { return 5; }    // 2 byte size, 2 byte check sum, 1 byte packet order
99
  int packet_prefix_size()                 { return 5; }    // 2 byte size, 2 byte check sum, 1 byte packet order
100
  unsigned short packet_size()             { unsigned short size=(*(unsigned short *)data); return lstl(size); }
100
  uint16_t packet_size()             { uint16_t size=(*(uint16_t *)data); return lstl(size); }
101
  unsigned char tick_received()            { return data[4]; }  
101
  uint8_t tick_received()            { return data[4]; }  
102
  void set_tick_received(unsigned char x)  { data[4]=x; }
102
  void set_tick_received(uint8_t x)  { data[4]=x; }
103
  unsigned char *packet_data()             { return data+packet_prefix_size(); }
103
  uint8_t *packet_data()             { return data+packet_prefix_size(); }
104
  unsigned short get_checksum()            { unsigned short cs=*((unsigned short *)data+1); return lstl(cs); }
104
  uint16_t get_checksum()            { uint16_t cs=*((uint16_t *)data+1); return lstl(cs); }
105
  unsigned short calc_checksum()
105
  uint16_t calc_checksum()
106
  {
106
  {
107
    *((unsigned short *)data+1)=0;
107
    *((uint16_t *)data+1)=0;
108
    int i,size=packet_prefix_size()+packet_size();
108
    int i,size=packet_prefix_size()+packet_size();
109
    unsigned char c1=0,c2=0,*p=data;
109
    uint8_t c1=0,c2=0,*p=data;
110
    for (i=0;i<size;i++,p++)
110
    for (i=0;i<size;i++,p++)
111
    {
111
    {
112
      c1+=*p;
112
      c1+=*p;
113
      c2+=c1;
113
      c2+=c1;
114
    }
114
    }
115
    unsigned short cs=( (((unsigned short)c1)<<8) | c2);
115
    uint16_t cs=( (((uint16_t)c1)<<8) | c2);
116
    *((unsigned short *)data+1)=lstl(cs);
116
    *((uint16_t *)data+1)=lstl(cs);
117
    return cs;
117
    return cs;
118
  }
118
  }
119
119
Lines 128-138 Link Here
128
      set_packet_size(packet_size()+size);
128
      set_packet_size(packet_size()+size);
129
    }
129
    }
130
  }
130
  }
131
  void write_byte(unsigned char x) { add_to_packet(&x,1); }
131
  void write_uint8(uint8_t x) { add_to_packet(&x,1); }
132
  void write_short(unsigned short x) { x=lstl(x); add_to_packet(&x,2); }
132
  void write_uint16(uint16_t x) { x=lstl(x); add_to_packet(&x,2); }
133
  void write_long(unsigned long x) { x=lltl(x); add_to_packet(&x,4); }
133
  void write_uint32(uint32_t x) { x=lltl(x); add_to_packet(&x,4); }
134
134
135
  void set_packet_size(unsigned short x) { *((unsigned short *)data)=lstl(x); }
135
  void set_packet_size(uint16_t x) { *((uint16_t *)data)=lstl(x); }
136
136
137
137
138
} ;
138
} ;
Lines 142-154 Link Here
142
  net_packet packet,                        // current tick data
142
  net_packet packet,                        // current tick data
143
             last_packet;                   // last tick data (in case a client misses input, we can resend)
143
             last_packet;                   // last tick data (in case a client misses input, we can resend)
144
144
145
  short mem_lock;
145
  int16_t mem_lock;
146
  short calc_crcs;
146
  int16_t calc_crcs;
147
  short get_lsf;
147
  int16_t get_lsf;
148
  short wait_reload;
148
  int16_t wait_reload;
149
  short need_reload;
149
  int16_t need_reload;
150
  short input_state;            // COLLECTING or PROCESSING
150
  int16_t input_state;          // COLLECTING or PROCESSING
151
  short current_tick;           // set by engine, used by driver to confirm packet is not left over
151
  int16_t current_tick;         // set by engine, used by driver to confirm packet is not left over
152
  
152
  
153
  join_struct *join_list;
153
  join_struct *join_list;
154
} ;
154
} ;
(-)abuse-sdl-0.7.0.orig/src/include/transp.hpp (-1 / +1 lines)
Lines 2-7 Link Here
2
#define __TRANSP_HPP_
2
#define __TRANSP_HPP_
3
#include "image.hpp"
3
#include "image.hpp"
4
#include "macs.hpp"
4
#include "macs.hpp"
5
void transp_put(image *im, image *screen, uchar *table, int x, int y);
5
void transp_put(image *im, image *screen, uint8_t *table, int x, int y);
6
6
7
#endif
7
#endif
(-)abuse-sdl-0.7.0.orig/src/include/lisp.hpp (-14 / +16 lines)
Lines 1-6 Link Here
1
#ifndef __LISP_HPP_
1
#ifndef __LISP_HPP_
2
#define __LISP_HPP_
2
#define __LISP_HPP_
3
3
4
#include <stdint.h>
5
4
#include "lisp_opt.hpp"
6
#include "lisp_opt.hpp"
5
7
6
#ifdef L_PROFILE
8
#ifdef L_PROFILE
Lines 34-41 Link Here
34
       L_OBJECT_VAR, L_1D_ARRAY,
36
       L_OBJECT_VAR, L_1D_ARRAY,
35
       L_FIXED_POINT, L_COLLECTED_OBJECT };
37
       L_FIXED_POINT, L_COLLECTED_OBJECT };
36
38
37
typedef long ltype;    // make sure structures aren't packed differently on various compiler
39
typedef uint64_t ltype;    // make sure structures aren't packed differently on various compiler
38
                       // and sure that word, etc are word alligned
40
                       // and sure that word, etc are word aligned
39
41
40
struct lisp_object_var
42
struct lisp_object_var
41
{  
43
{  
Lines 82-88 Link Here
82
{
84
{
83
  ltype type;
85
  ltype type;
84
#ifndef NO_LIBS
86
#ifndef NO_LIBS
85
  long alist,blist;      // id for cached blocks
87
  intptr_t alist,blist;      // id for cached blocks
86
#else
88
#else
87
  void *arg_list,*block_list;
89
  void *arg_list,*block_list;
88
#endif
90
#endif
Lines 103-110 Link Here
103
struct lisp_character
105
struct lisp_character
104
{
106
{
105
  ltype type;
107
  ltype type;
106
  short pad;
108
  int16_t pad;
107
  unsigned short ch;
109
  uint16_t ch;
108
} ;
110
} ;
109
111
110
struct lisp_pointer
112
struct lisp_pointer
Lines 117-123 Link Here
117
struct lisp_fixed_point
119
struct lisp_fixed_point
118
{
120
{
119
  ltype type;
121
  ltype type;
120
  long x;
122
  int32_t x;
121
} ;
123
} ;
122
124
123
125
Lines 127-133 Link Here
127
#define item_type(c) ((c) ? *((ltype *)c) : (ltype)L_CONS_CELL)
129
#define item_type(c) ((c) ? *((ltype *)c) : (ltype)L_CONS_CELL)
128
void *lget_array_element(void *a, long x);
130
void *lget_array_element(void *a, long x);
129
void *lpointer_value(void *lpointer);
131
void *lpointer_value(void *lpointer);
130
long lnumber_value(void *lnumber);
132
int32_t lnumber_value(void *lnumber);
131
char *lstring_value(void *lstring);
133
char *lstring_value(void *lstring);
132
unsigned short lcharacter_value(void *c);
134
unsigned short lcharacter_value(void *c);
133
long lfixed_point_value(void *c);
135
long lfixed_point_value(void *c);
Lines 155-161 Link Here
155
lisp_symbol *make_find_symbol(char *name);
157
lisp_symbol *make_find_symbol(char *name);
156
158
157
void push_onto_list(void *object, void *&list);
159
void push_onto_list(void *object, void *&list);
158
lisp_symbol *add_c_object(void *symbol, short number);
160
lisp_symbol *add_c_object(void *symbol, int16_t number);
159
lisp_symbol *add_c_function(char *name, short min_args, short max_args, short number);
161
lisp_symbol *add_c_function(char *name, short min_args, short max_args, short number);
160
lisp_symbol *add_c_bool_fun(char *name, short min_args, short max_args, short number);
162
lisp_symbol *add_c_bool_fun(char *name, short min_args, short max_args, short number);
161
lisp_symbol *add_lisp_function(char *name, short min_args, short max_args, short number);
163
lisp_symbol *add_lisp_function(char *name, short min_args, short max_args, short number);
Lines 166-178 Link Here
166
168
167
lisp_number *new_lisp_number(long num);
169
lisp_number *new_lisp_number(long num);
168
lisp_pointer *new_lisp_pointer(void *addr);
170
lisp_pointer *new_lisp_pointer(void *addr);
169
lisp_character *new_lisp_character(unsigned short ch);
171
lisp_character *new_lisp_character(uint16_t ch);
170
lisp_string *new_lisp_string(char *string);
172
lisp_string *new_lisp_string(char *string);
171
lisp_string *new_lisp_string(char *string, int length);
173
lisp_string *new_lisp_string(char *string, int length);
172
lisp_string *new_lisp_string(long length);
174
lisp_string *new_lisp_string(int length);
173
lisp_fixed_point *new_lisp_fixed_point(long x);
175
lisp_fixed_point *new_lisp_fixed_point(int32_t x);
174
lisp_object_var *new_lisp_object_var(short number);
176
lisp_object_var *new_lisp_object_var(int16_t number);
175
lisp_1d_array   *new_lisp_1d_array(unsigned short size, void *rest);
177
lisp_1d_array   *new_lisp_1d_array(int size, void *rest);
176
lisp_sys_function *new_lisp_sys_function(int min_args, int max_args, int fun_number);
178
lisp_sys_function *new_lisp_sys_function(int min_args, int max_args, int fun_number);
177
lisp_sys_function *new_lisp_c_function(int min_args, int max_args, int fun_number);
179
lisp_sys_function *new_lisp_c_function(int min_args, int max_args, int fun_number);
178
lisp_sys_function *new_lisp_c_bool(int min_args, int max_args, int fun_number);
180
lisp_sys_function *new_lisp_c_bool(int min_args, int max_args, int fun_number);
Lines 180-186 Link Here
180
#ifdef NO_LIBS
182
#ifdef NO_LIBS
181
lisp_user_function *new_lisp_user_function(void *arg_list, void *block_list);
183
lisp_user_function *new_lisp_user_function(void *arg_list, void *block_list);
182
#else
184
#else
183
lisp_user_function *new_lisp_user_function(long arg_list, long block_list);
185
lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list);
184
#endif
186
#endif
185
187
186
lisp_sys_function *new_user_lisp_function(int min_args, int max_args, int fun_number);
188
lisp_sys_function *new_user_lisp_function(int min_args, int max_args, int fun_number);
(-)abuse-sdl-0.7.0.orig/src/include/view.hpp (-22 / +22 lines)
Lines 11-19 Link Here
11
11
12
struct suggest_struct
12
struct suggest_struct
13
{
13
{
14
  long cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y;
14
  int32_t cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y;
15
  long new_weapon;
15
  int32_t new_weapon;
16
  uchar send_view,send_weapon_change;
16
  uint8_t send_view,send_weapon_change;
17
} ;
17
} ;
18
18
19
19
Lines 22-28 Link Here
22
22
23
class view
23
class view
24
{
24
{
25
  uchar keymap[512/8];
25
  uint8_t keymap[512/8];
26
  char chat_buf[60];
26
  char chat_buf[60];
27
  public : 
27
  public : 
28
  int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
28
  int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
Lines 32-38 Link Here
32
32
33
  char name[100];
33
  char name[100];
34
  struct suggest_struct suggest;
34
  struct suggest_struct suggest;
35
  long cx1,cy1,cx2,cy2,                    // view area to show
35
  int32_t cx1,cy1,cx2,cy2,                    // view area to show
36
      shift_down,shift_right;             // shift of view
36
      shift_down,shift_right;             // shift of view
37
37
38
  int god;                                // :) if you believe in such things
38
  int god;                                // :) if you believe in such things
Lines 40-48 Link Here
40
  
40
  
41
  int draw_solid;                         // -1 if don't draw solid
41
  int draw_solid;                         // -1 if don't draw solid
42
42
43
  long *weapons;                          // [0..total_weapons-1]
43
  int32_t *weapons;                          // [0..total_weapons-1]
44
  long *last_weapons;                     // last history of above array (for updating statbar)
44
  int32_t *last_weapons;                     // last history of above array (for updating statbar)
45
  long current_weapon;
45
  int32_t current_weapon;
46
46
47
47
48
  game_object *focus;                     // object we are focusing on (player)
48
  game_object *focus;                     // object we are focusing on (player)
Lines 58-85 Link Here
58
58
59
59
60
  short ambient;                        // ambient lighting setting, used by draw
60
  short ambient;                        // ambient lighting setting, used by draw
61
  long pan_x,pan_y,no_xleft,no_xright,no_ytop,no_ybottom,
61
  int32_t pan_x,pan_y,no_xleft,no_xright,no_ytop,no_ybottom,
62
       last_x,last_y,last_last_x,last_last_y,view_percent;
62
       last_x,last_y,last_last_x,last_last_y,view_percent;
63
63
64
  long last_left,last_right,last_up,last_down,   // how many frames ago were these pressed (<=0)
64
  int32_t last_left,last_right,last_up,last_down,   // how many frames ago were these pressed (<=0)
65
       last_b1,last_b2,last_b3,last_b4,last_hp,last_ammo,last_type;
65
       last_b1,last_b2,last_b3,last_b4,last_hp,last_ammo,last_type;
66
  long secrets,kills,tsecrets,tkills;
66
  int32_t secrets,kills,tsecrets,tkills;
67
67
68
  view(game_object *Focus, view *Next, int number);
68
  view(game_object *Focus, view *Next, int number);
69
  void draw_character_damage();           // draws the characters 'status' on the viewer
69
  void draw_character_damage();           // draws the characters 'status' on the viewer
70
70
71
  long x_center();                        // center of attention
71
  int32_t x_center();                        // center of attention
72
  long y_center();
72
  int32_t y_center();
73
  long xoff();                            // top left and right corner of the screen
73
  int32_t xoff();                            // top left and right corner of the screen
74
  long interpolated_xoff();
74
  int32_t interpolated_xoff();
75
  long yoff();
75
  int32_t yoff();
76
  long interpolated_yoff();
76
  int32_t interpolated_yoff();
77
  int drawable();                        // network viewables are not drawable
77
  int drawable();                        // network viewables are not drawable
78
  int local_player();                    //  just in case I ever need non-viewable local players.
78
  int local_player();                    //  just in case I ever need non-viewable local players.
79
79
80
  view *next;                             // next viewable player (singly linked list)  
80
  view *next;                             // next viewable player (singly linked list)  
81
  void get_input();
81
  void get_input();
82
  int process_input(char cmd, uchar *&pk);
82
  int process_input(char cmd, uint8_t *&pk);
83
83
84
  void add_ammo   (int weapon_type, int total);
84
  void add_ammo   (int weapon_type, int total);
85
  int has_weapon  (int weapon_type) { return god || (weapons[weapon_type]!=-1); }
85
  int has_weapon  (int weapon_type) { return god || (weapons[weapon_type]!=-1); }
Lines 93-99 Link Here
93
  void draw_hp();
93
  void draw_hp();
94
  void draw_ammo();
94
  void draw_ammo();
95
  void draw_logo();
95
  void draw_logo();
96
  void resize_view(long Cx1, long Cy1, long Cx2, long Cy2);
96
  void resize_view(int32_t Cx1, int32_t Cy1, int32_t Cx2, int32_t Cy2);
97
  void set_input(int cx, int cy, int b1, int b2, int b3, int b4, int px, int py);
97
  void set_input(int cx, int cy, int b1, int b2, int b3, int b4, int px, int py);
98
  int view_changed() { return suggest.send_view; }
98
  int view_changed() { return suggest.send_view; }
99
  int weapon_changed() { return suggest.send_weapon_change; }
99
  int weapon_changed() { return suggest.send_weapon_change; }
Lines 103-110 Link Here
103
103
104
  void reset_player();
104
  void reset_player();
105
  int receive_failed() { return focus==NULL; }
105
  int receive_failed() { return focus==NULL; }
106
  long get_view_var_value(int num);
106
  int32_t get_view_var_value(int num);
107
  long set_view_var_value(int num, long x);
107
  int32_t set_view_var_value(int num, int32_t x);
108
  void configure_for_area(area_controller *a);
108
  void configure_for_area(area_controller *a);
109
  ~view();
109
  ~view();
110
} ;
110
} ;
Lines 114-120 Link Here
114
int total_local_players();
114
int total_local_players();
115
void recalc_local_view_space();
115
void recalc_local_view_space();
116
116
117
void process_packet_commands(uchar *pk, int size);
117
void process_packet_commands(uint8_t *pk, int size);
118
118
119
object_node *make_player_onodes(int player_num=-1);
119
object_node *make_player_onodes(int player_num=-1);
120
int total_view_vars();
120
int total_view_vars();
(-)abuse-sdl-0.7.0.orig/src/include/dev.hpp (-3 / +3 lines)
Lines 18-24 Link Here
18
18
19
class pal_win
19
class pal_win
20
{
20
{
21
  long scale,w,h,x,y,last_selected;
21
  int32_t scale,w,h,x,y,last_selected;
22
  unsigned short *pat;
22
  unsigned short *pat;
23
  void draw();
23
  void draw();
24
24
Lines 100-107 Link Here
100
  void close_ai_window();
100
  void close_ai_window();
101
  void make_ambient();
101
  void make_ambient();
102
  int ok_to_scroll();
102
  int ok_to_scroll();
103
  long snap_x(long x);
103
  int32_t snap_x(int32_t x);
104
  long snap_y(long y);
104
  int32_t snap_y(int32_t y);
105
  void area_handle_input(event &ev);
105
  void area_handle_input(event &ev);
106
  void pick_handle_input(event &ev);
106
  void pick_handle_input(event &ev);
107
  void close_area_win(int read_values);
107
  void close_area_win(int read_values);
(-)abuse-sdl-0.7.0.orig/src/include/fakelib.hpp (-5 / +1 lines)
Lines 4-18 Link Here
4
#define jmalloc(x,y) malloc(x)
4
#define jmalloc(x,y) malloc(x)
5
#define jrealloc(x,y,z) realloc(x,y)
5
#define jrealloc(x,y,z) realloc(x,y)
6
#define jfree(x) free(x)
6
#define jfree(x) free(x)
7
#define uchar  unsigned char
8
#define schar  signed char
9
#define sshort signed short
10
7
11
#ifdef __sgi
8
#ifdef __sgi
12
#include <sys/bsd_types.h>
9
#include <sys/bsd_types.h>
13
#else
10
#else
14
#define ulong  unsigned long
11
#include <stdint.h>
15
#define ushort unsigned short
16
#endif
12
#endif
17
13
18
class bFILE
14
class bFILE
(-)abuse-sdl-0.7.0.orig/src/include/particle.hpp (-1 / +1 lines)
Lines 16-22 Link Here
16
struct part
16
struct part
17
{
17
{
18
  short x,y;
18
  short x,y;
19
  uchar color;
19
  uint8_t color;
20
} ;
20
} ;
21
21
22
class part_frame
22
class part_frame
(-)abuse-sdl-0.7.0.orig/src/include/items.hpp (-11 / +11 lines)
Lines 14-20 Link Here
14
{
14
{
15
public :  
15
public :  
16
  boundary(bFILE *fp,char *er_name);
16
  boundary(bFILE *fp,char *er_name);
17
  unsigned char *inside;     // tells which side of the line is on the inside
17
  uint8_t *inside;     // tells which side of the line is on the inside
18
  boundary(boundary *p);      // flips the *inside list
18
  boundary(boundary *p);      // flips the *inside list
19
  ~boundary() { if (tot) jfree(inside); }
19
  ~boundary() { if (tot) jfree(inside); }
20
} ;
20
} ;
Lines 22-32 Link Here
22
class backtile
22
class backtile
23
{
23
{
24
public :
24
public :
25
  unsigned short next;
25
  uint16_t next;
26
  image *im;
26
  image *im;
27
  backtile(spec_entry *e, bFILE *fp);
27
  backtile(spec_entry *e, bFILE *fp);
28
  backtile(bFILE *fp);
28
  backtile(bFILE *fp);
29
  long size() { return 2+4+im->width()*im->height(); }
29
  int32_t size() { return 2+4+im->width()*im->height(); }
30
  ~backtile() { delete im; }
30
  ~backtile() { delete im; }
31
} ;
31
} ;
32
32
Lines 34-49 Link Here
34
{
34
{
35
public :
35
public :
36
  trans_image *im;
36
  trans_image *im;
37
  unsigned short next;
37
  uint16_t next;
38
  unsigned char damage;
38
  uint8_t damage;
39
  uchar ylevel;            // for fast intersections, this is the y level offset for the ground
39
  uint8_t ylevel;            // for fast intersections, this is the y level offset for the ground
40
                           // if ground is not level this is 255
40
                           // if ground is not level this is 255
41
  boundary *points;
41
  boundary *points;
42
42
43
  image *micro_image;
43
  image *micro_image;
44
44
45
  foretile(bFILE *fp);
45
  foretile(bFILE *fp);
46
  long size() { return im->width()*im->height()+4+2+1+points->size(); }
46
  int32_t size() { return im->width()*im->height()+4+2+1+points->size(); }
47
  ~foretile() { delete im; delete points; delete micro_image; }
47
  ~foretile() { delete im; delete points; delete micro_image; }
48
} ;
48
} ;
49
49
Lines 51-58 Link Here
51
{
51
{
52
public :
52
public :
53
  trans_image *forward,*backward;
53
  trans_image *forward,*backward;
54
  unsigned char hit_damage,xcfg;
54
  uint8_t hit_damage,xcfg;
55
  signed char advance;
55
  int8_t advance;
56
  point_list *hit;
56
  point_list *hit;
57
  boundary *f_damage,*b_damage;
57
  boundary *f_damage,*b_damage;
58
  int size();
58
  int size();
Lines 61-67 Link Here
61
  int width() { return forward->width(); }
61
  int width() { return forward->width(); }
62
  int height() { return forward->height(); }
62
  int height() { return forward->height(); }
63
63
64
/*  long size(int type)         // taken from spaint items
64
/*  int32_t size(int type)         // taken from spaint items
65
  {
65
  {
66
    if 
66
    if 
67
    return forward->width()*backward->height()+4+
67
    return forward->width()*backward->height()+4+
Lines 79-85 Link Here
79
class char_tint
79
class char_tint
80
{
80
{
81
  public :
81
  public :
82
  uchar data[256];
82
  uint8_t data[256];
83
  ~char_tint() { ; }
83
  ~char_tint() { ; }
84
  char_tint(bFILE *fp);               // should be a palette entry
84
  char_tint(bFILE *fp);               // should be a palette entry
85
} ;
85
} ;
(-)abuse-sdl-0.7.0.orig/src/include/demo.hpp (-1 / +1 lines)
Lines 33-39 Link Here
33
33
34
34
35
35
36
extern int last_demo_mx,last_demo_my,last_demo_mbut;
36
extern int32_t last_demo_mx,last_demo_my,last_demo_mbut;
37
//extern ulong demo_tick_on;
37
//extern ulong demo_tick_on;
38
#endif
38
#endif
39
39
(-)abuse-sdl-0.7.0.orig/src/include/objects.hpp (-14 / +14 lines)
Lines 27-35 Link Here
27
27
28
28
29
29
30
#define RC_C 0
30
#define RC_8 0
31
#define RC_S 1
31
#define RC_16 1
32
#define RC_L 2
32
#define RC_32 2
33
33
34
34
35
35
Lines 47-53 Link Here
47
  sequence *current_sequence() { return figures[otype]->get_sequence(state); }
47
  sequence *current_sequence() { return figures[otype]->get_sequence(state); }
48
public :
48
public :
49
  game_object *next,*next_active;
49
  game_object *next,*next_active;
50
  long *lvars;
50
  int32_t *lvars;
51
51
52
  int size();
52
  int size();
53
  int decide();        // returns 0 if you want to be deleted
53
  int decide();        // returns 0 if you want to be deleted
Lines 71-78 Link Here
71
71
72
  void drawer();
72
  void drawer();
73
  void draw_above(view *v);
73
  void draw_above(view *v);
74
  void do_damage(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel);
74
  void do_damage(int amount, game_object *from, int32_t hitx, int32_t hity, int32_t push_xvel, int32_t push_yvel);
75
  void damage_fun(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel);
75
  void damage_fun(int amount, game_object *from, int32_t hitx, int32_t hity, int32_t push_xvel, int32_t push_yvel);
76
76
77
77
78
  void note_attack(game_object *whom);
78
  void note_attack(game_object *whom);
Lines 93-106 Link Here
93
  void set_state(character_state s, int frame_direction=1);
93
  void set_state(character_state s, int frame_direction=1);
94
  int has_sequence(character_state s) { return figures[otype]->has_sequence(s); }
94
  int has_sequence(character_state s) { return figures[otype]->has_sequence(s); }
95
95
96
  game_object *try_move(long x, long y, long &xv, long &yv, int checks);  // 1=down,2=up,3=both
96
  game_object *try_move(int32_t x, int32_t y, int32_t &xv, int32_t &yv, int checks);  // 1=down,2=up,3=both
97
  game_object *bmove(int &whit, game_object *exclude);  // ballestic move, return hit object, 
97
  game_object *bmove(int &whit, game_object *exclude);  // ballestic move, return hit object, 
98
                                                        // or NULL (whit is 1 if hit wall)
98
                                                        // or NULL (whit is 1 if hit wall)
99
  trans_image *picture() { return current_sequence()->get_frame(current_frame,direction); }
99
  trans_image *picture() { return current_sequence()->get_frame(current_frame,direction); }
100
												    
100
												    
101
  int next_picture();
101
  int next_picture();
102
  long x_center();  
102
  int32_t x_center();  
103
  long height();
103
  int32_t height();
104
104
105
  void stop_acel() { set_xacel(0);  set_yacel(0); set_fxacel(0); set_fyacel(0); }
105
  void stop_acel() { set_xacel(0);  set_yacel(0); set_fxacel(0); set_fyacel(0); }
106
  void stop_vel() {  set_xvel(0);   set_yvel(0); set_fxvel(0);  set_fyvel(0); }
106
  void stop_vel() {  set_xvel(0);   set_yvel(0); set_fxvel(0);  set_fyvel(0); }
Lines 114-120 Link Here
114
  int mover(int cx, int cy, int button);
114
  int mover(int cx, int cy, int button);
115
  figure *current_figure() { return current_sequence()->get_figure(current_frame); }
115
  figure *current_figure() { return current_sequence()->get_figure(current_frame); }
116
  int total_frames() { return current_sequence()->length(); }
116
  int total_frames() { return current_sequence()->length(); }
117
  void picture_space(long &x1, long &y1,long &x2, long &y2);
117
  void picture_space(int32_t &x1, int32_t &y1,int32_t &x2, int32_t &y2);
118
  int tx(int x) { if (direction>0) return x-x_center(); else return x_center()-x; }
118
  int tx(int x) { if (direction>0) return x-x_center(); else return x_center()-x; }
119
  int ty(int y) { return y-picture()->height()+1; }
119
  int ty(int y) { return y-picture()->height()+1; }
120
  void defaults();
120
  void defaults();
Lines 133-140 Link Here
133
  void reload_notify();
133
  void reload_notify();
134
134
135
  void change_type(int new_type);
135
  void change_type(int new_type);
136
  int set_var_by_name(char *name, long value);
136
  int set_var_by_name(char *name, int32_t value);
137
  long get_var_by_name(char *name, int &error);
137
  int32_t get_var_by_name(char *name, int &error);
138
  game_object *copy();
138
  game_object *copy();
139
  void change_aitype(int new_type);
139
  void change_aitype(int new_type);
140
  ~game_object();
140
  ~game_object();
Lines 150-161 Link Here
150
150
151
extern game_object *current_object;
151
extern game_object *current_object;
152
extern view *current_view;
152
extern view *current_view;
153
game_object *create(int type, long x, long y, int skip_constructor=0, int aitype=0);
153
game_object *create(int type, int32_t x, int32_t y, int skip_constructor=0, int aitype=0);
154
int base_size();
154
int base_size();
155
155
156
void delete_object_list(object_node *first);
156
void delete_object_list(object_node *first);
157
int          object_to_number_in_list(game_object *who, object_node *list);
157
int          object_to_number_in_list(game_object *who, object_node *list);
158
game_object *number_to_object_in_list(long x, object_node *list);
158
game_object *number_to_object_in_list(int32_t x, object_node *list);
159
159
160
160
161
#endif
161
#endif
(-)abuse-sdl-0.7.0.orig/src/include/cache.hpp (-17 / +17 lines)
Lines 22-31 Link Here
22
struct cache_item
22
struct cache_item
23
{
23
{
24
  void *data;
24
  void *data;
25
  long last_access;   
25
  int32_t last_access;   
26
  unsigned char type;
26
  uint8_t type;
27
  short file_number;
27
  int16_t file_number;
28
  long offset;
28
  int32_t offset;
29
} ;
29
} ;
30
30
31
31
Lines 34-40 Link Here
34
{
34
{
35
  public :
35
  public :
36
  int crc_calculated;
36
  int crc_calculated;
37
  ulong crc;
37
  uint32_t crc;
38
  char *filename;
38
  char *filename;
39
  crced_file(char *name);
39
  crced_file(char *name);
40
  ~crced_file();
40
  ~crced_file();
Lines 47-55 Link Here
47
  public :
47
  public :
48
  crc_manager();
48
  crc_manager();
49
  int get_filenumber(char *filename);
49
  int get_filenumber(char *filename);
50
  ulong get_crc(long filenumber, int &failed);
50
  uint32_t get_crc(int32_t filenumber, int &failed);
51
  void set_crc(long filenumber, ulong crc);
51
  void set_crc(int32_t filenumber, uint32_t crc);
52
  char *get_filename(long filenumber);
52
  char *get_filename(int32_t filenumber);
53
  void clean_up();
53
  void clean_up();
54
  int total_filenames() { return total_files; }
54
  int total_filenames() { return total_files; }
55
  int write_crc_file(char *filename);
55
  int write_crc_file(char *filename);
Lines 61-77 Link Here
61
class cache_list
61
class cache_list
62
{
62
{
63
  cache_item *list;
63
  cache_item *list;
64
  long total,last_registered,last_access,poll_start_access;
64
  int32_t total,last_registered,last_access,poll_start_access;
65
  short last_file;           // for speed leave the last file accessed open
65
  int16_t last_file;           // for speed leave the last file accessed open
66
66
67
  bFILE *fp,*cache_file,*cache_read_file;
67
  bFILE *fp,*cache_file,*cache_read_file;
68
  spec_directory *last_dir;
68
  spec_directory *last_dir;
69
  long last_offset;          // store the last offset so we don't have to seek if
69
  int32_t last_offset;          // store the last offset so we don't have to seek if
70
                             // we don't need to
70
                             // we don't need to
71
  
71
  
72
72
73
  short lcache_number;
73
  int16_t lcache_number;
74
  long alloc_id();
74
  int32_t alloc_id();
75
  void locate(cache_item *i, int local_only=0);    // set up file and offset for this item
75
  void locate(cache_item *i, int local_only=0);    // set up file and offset for this item
76
  void normalize();
76
  void normalize();
77
  void unmalloc(cache_item *i);
77
  void unmalloc(cache_item *i);
Lines 86-94 Link Here
86
  void free_oldest();
86
  void free_oldest();
87
  int in_use() { if (used) { used=0; return 1; } else return 0; }
87
  int in_use() { if (used) { used=0; return 1; } else return 0; }
88
  int full() { if (ful) { ful=0; return 1; } else return 0; }
88
  int full() { if (ful) { ful=0; return 1; } else return 0; }
89
  long reg_object(char *filename, void *object, int type, int rm_dups);      // lisp object
89
  int32_t reg_object(char *filename, void *object, int type, int rm_dups);      // lisp object
90
  long reg(char *filename, char *name, int type=-1, int rm_dups=0);          // returns id to item
90
  int32_t reg(char *filename, char *name, int type=-1, int rm_dups=0);          // returns id to item
91
  long reg_lisp_block(Cell *block);
91
  int32_t reg_lisp_block(Cell *block);
92
  int loaded(int id);
92
  int loaded(int id);
93
  void unreg(int id);
93
  void unreg(int id);
94
  void note_need(int id);
94
  void note_need(int id);
Lines 113-119 Link Here
113
  int offset_compare(int a, int b);
113
  int offset_compare(int a, int b);
114
114
115
  void load_cache_prof_info(char *filename, level *lev);
115
  void load_cache_prof_info(char *filename, level *lev);
116
  int search(int *sarray, ushort filenum, long offset);  // sarray is a index table sorted by offset/filenum
116
  int search(int *sarray, uint16_t filenum, int32_t offset);  // sarray is a index table sorted by offset/filenum
117
117
118
  void show_accessed();
118
  void show_accessed();
119
  void empty();
119
  void empty();
(-)abuse-sdl-0.7.0.orig/src/include/level.hpp (-40 / +40 lines)
Lines 26-48 Link Here
26
class area_controller
26
class area_controller
27
{
27
{
28
  public :
28
  public :
29
  long x,y,w,h,active;
29
  int32_t x,y,w,h,active;
30
  long ambient,view_xoff,view_yoff;
30
  int32_t ambient,view_xoff,view_yoff;
31
  long ambient_speed, view_xoff_speed,view_yoff_speed;
31
  int32_t ambient_speed, view_xoff_speed,view_yoff_speed;
32
  area_controller *next;
32
  area_controller *next;
33
  area_controller(long X, long Y, long W, long H, area_controller *Next);
33
  area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next);
34
} ;
34
} ;
35
35
36
extern long last_tile_hit_x,last_tile_hit_y;
36
extern int32_t last_tile_hit_x,last_tile_hit_y;
37
extern int dev;
37
extern int dev;
38
class level        // contain map info and objects
38
class level        // contain map info and objects
39
{
39
{
40
  unsigned short *map_fg,        // just big 2d arrays
40
  uint16_t *map_fg,        // just big 2d arrays
41
                 *map_bg,
41
           *map_bg,
42
	         bg_width,bg_height,
42
	   bg_width,bg_height,
43
	         fg_width,fg_height;  
43
	   fg_width,fg_height;  
44
  char *Name,*first_name;
44
  char *Name,*first_name;
45
  long total_objs;
45
  int32_t total_objs;
46
  game_object *first,*first_active,*last;
46
  game_object *first,*first_active,*last;
47
47
48
  game_object **attack_list;                // list of characters for tick which can attack someone
48
  game_object **attack_list;                // list of characters for tick which can attack someone
Lines 63-74 Link Here
63
  game_object **all_block_list;            // list of characters who can block a character or can be hurt
63
  game_object **all_block_list;            // list of characters who can block a character or can be hurt
64
  int all_block_list_size,all_block_total;
64
  int all_block_list_size,all_block_total;
65
  void add_all_block(game_object *who);
65
  void add_all_block(game_object *who);
66
  ulong ctick;
66
  uint32_t ctick;
67
  
67
  
68
public :
68
public :
69
  char *original_name() { if (first_name) return first_name; else return Name; }
69
  char *original_name() { if (first_name) return first_name; else return Name; }
70
  ulong tick_counter() { return ctick; }
70
  uint32_t tick_counter() { return ctick; }
71
  void set_tick_counter(ulong x);
71
  void set_tick_counter(uint32_t x);
72
  area_controller *area_list;
72
  area_controller *area_list;
73
 
73
 
74
  void clear_active_list() { first_active=NULL; }
74
  void clear_active_list() { first_active=NULL; }
Lines 79-88 Link Here
79
79
80
  game_object *first_object() { return first; }
80
  game_object *first_object() { return first; }
81
  game_object *first_active_object() { return first_active; }
81
  game_object *first_active_object() { return first_active; }
82
  unsigned short foreground_width() { return fg_width; }
82
  uint16_t foreground_width() { return fg_width; }
83
  unsigned short foreground_height() { return fg_height; }
83
  uint16_t foreground_height() { return fg_height; }
84
  unsigned short background_width() { return bg_width; }
84
  uint16_t background_width() { return bg_width; }
85
  unsigned short background_height() { return bg_height; }
85
  uint16_t background_height() { return bg_height; }
86
  int load_failed() { return map_fg==NULL; } 
86
  int load_failed() { return map_fg==NULL; } 
87
  level(spec_directory *sd, bFILE *fp, char *lev_name);
87
  level(spec_directory *sd, bFILE *fp, char *lev_name);
88
  void load_fail();             
88
  void load_fail();             
Lines 97-122 Link Here
97
  int fg_raised(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
97
  int fg_raised(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
98
				 return (*(map_fg+x+y*fg_width))&0x4000; }
98
				 return (*(map_fg+x+y*fg_width))&0x4000; }
99
  void fg_set_raised(int x, int y, int r) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
99
  void fg_set_raised(int x, int y, int r) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
100
					    ushort v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000);
100
					    uint16_t v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000);
101
					    if (r) (*(map_fg+x+y*fg_width))=v|0x4000;
101
					    if (r) (*(map_fg+x+y*fg_width))=v|0x4000;
102
					    else (*(map_fg+x+y*fg_width))=v;
102
					    else (*(map_fg+x+y*fg_width))=v;
103
					  }
103
					  }
104
  void mark_seen(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
104
  void mark_seen(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
105
					  (*(map_fg+x+y*fg_width))|=0x8000; }
105
					  (*(map_fg+x+y*fg_width))|=0x8000; }
106
  void clear_fg(long x, long y) { *(map_fg+x+y*fg_width)&=0x7fff; }
106
  void clear_fg(int32_t x, int32_t y) { *(map_fg+x+y*fg_width)&=0x7fff; }
107
107
108
  unsigned short *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }
108
  uint16_t *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }
109
  unsigned short *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }
109
  uint16_t *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }
110
  unsigned short get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)
110
  uint16_t get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)
111
        			          return fgvalue(*(map_fg+x+y*fg_width)); 
111
        			          return fgvalue(*(map_fg+x+y*fg_width)); 
112
	                                else return 0;
112
	                                else return 0;
113
				      }
113
				      }
114
  unsigned short get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)
114
  uint16_t get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)
115
					  return *(map_bg+x+y*bg_width); 
115
					  return *(map_bg+x+y*bg_width); 
116
	                                 else return 0;
116
	                                 else return 0;
117
					}
117
					}
118
  void put_fg(int x, int y, unsigned short tile) { *(map_fg+x+y*fg_width)=tile; }   
118
  void put_fg(int x, int y, uint16_t tile) { *(map_fg+x+y*fg_width)=tile; }   
119
  void put_bg(int x, int y, unsigned short tile) { *(map_bg+x+y*bg_width)=tile; }
119
  void put_bg(int x, int y, uint16_t tile) { *(map_bg+x+y*bg_width)=tile; }
120
  void draw_objects(view *v); 
120
  void draw_objects(view *v); 
121
  void interpolate_draw_objects(view *v);
121
  void interpolate_draw_objects(view *v);
122
  void draw_areas(view *v);
122
  void draw_areas(view *v);
Lines 140-163 Link Here
140
140
141
  void unactivate_all();
141
  void unactivate_all();
142
  // forms all the objects in processing range into a linked list
142
  // forms all the objects in processing range into a linked list
143
  int add_actives(long x1, long y1, long x2, long y2);  //returns total added
143
  int add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2);  //returns total added
144
  void pull_actives(game_object *o, game_object *&last_active, int &t);
144
  void pull_actives(game_object *o, game_object *&last_active, int &t);
145
  int add_drawables(long x1, long y1, long x2, long y2);  //returns total added
145
  int add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2);  //returns total added
146
146
147
  game_object *find_object(long x, long y);
147
  game_object *find_object(int32_t x, int32_t y);
148
148
149
  game_object *damage_intersect(long x1, long y1, long &x2, long &y2, game_object *exclude);
149
  game_object *damage_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2, game_object *exclude);
150
  game_object *boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2);
150
  game_object *boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
151
  game_object *all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2);
151
  game_object *all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
152
  int crush(game_object *by_who, int xamount, int yamount);
152
  int crush(game_object *by_who, int xamount, int yamount);
153
  int push_characters(game_object *by_who, int xamount, int yamount);  // return 0 if fail on any.
153
  int push_characters(game_object *by_who, int xamount, int yamount);  // return 0 if fail on any.
154
  int platform_push(game_object *by_who, int xamount, int yamount);
154
  int platform_push(game_object *by_who, int xamount, int yamount);
155
  void foreground_intersect(long x1, long y1, long &x2, long &y2);
155
  void foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
156
  void vforeground_intersect(long x1, long y1, long &y2);
156
  void vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2);
157
157
158
  void hurt_radius(long x, long y,long r, long m, game_object *from, game_object *exclude,
158
  void hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude,
159
		   int max_push);
159
		   int max_push);
160
  void send_signal(long signal);
160
  void send_signal(int32_t signal);
161
  void next_focus();
161
  void next_focus();
162
  void to_front(game_object *o);
162
  void to_front(game_object *o);
163
  void to_back(game_object *o);
163
  void to_back(game_object *o);
Lines 181-191 Link Here
181
  bFILE *create_dir(char *filename, int save_all,
181
  bFILE *create_dir(char *filename, int save_all,
182
		    object_node *save_list, object_node *exclude_list);
182
		    object_node *save_list, object_node *exclude_list);
183
  view *make_view_list(int nplayers);
183
  view *make_view_list(int nplayers);
184
  long total_light_links(object_node *list);
184
  int32_t total_light_links(object_node *list);
185
  long total_object_links(object_node *save_list);
185
  int32_t total_object_links(object_node *save_list);
186
  game_object *find_object_in_area(long x, long y, long x1, long y1, 
186
  game_object *find_object_in_area(int32_t x, int32_t y, int32_t x1, int32_t y1, 
187
				   long x2, long y2, Cell *list, game_object *exclude);
187
				   int32_t x2, int32_t y2, Cell *list, game_object *exclude);
188
  game_object *find_object_in_angle(long x, long y, long start_angle, long end_angle,
188
  game_object *find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle,
189
				    void *list, game_object *exclude);
189
				    void *list, game_object *exclude);
190
  object_node *make_not_list(object_node *list);
190
  object_node *make_not_list(object_node *list);
191
  int load_player_info(bFILE *fp, spec_directory *sd, object_node *save_list);
191
  int load_player_info(bFILE *fp, spec_directory *sd, object_node *save_list);
(-)abuse-sdl-0.7.0.orig/src/include/game.hpp (-8 / +8 lines)
Lines 45-51 Link Here
45
45
46
extern char **start_argv;
46
extern char **start_argv;
47
extern int start_argc;
47
extern int start_argc;
48
extern long current_vxadd,current_vyadd;
48
extern int32_t current_vxadd,current_vyadd;
49
extern int frame_panic,massive_frame_panic;
49
extern int frame_panic,massive_frame_panic;
50
extern int demo_start,idle_ticks;
50
extern int demo_start,idle_ticks;
51
51
Lines 57-63 Link Here
57
  int bright_color,med_color,dark_color,     // for boundaries and windows, etc
57
  int bright_color,med_color,dark_color,     // for boundaries and windows, etc
58
      morph_bright_color,morph_med_color,morph_dark_color;
58
      morph_bright_color,morph_med_color,morph_dark_color;
59
59
60
  long last_time,fps;
60
  int32_t last_time,fps;
61
  char mapname[100],command[200],help_text[200];
61
  char mapname[100],command[200],help_text[200];
62
  int refresh,mousex,mousey,help_text_frames;
62
  int refresh,mousex,mousey,help_text_frames;
63
  int has_joystick,no_delay;
63
  int has_joystick,no_delay;
Lines 65-71 Link Here
65
65
66
  jwindow *top_menu,*joy_win,*last_input;
66
  jwindow *top_menu,*joy_win,*last_input;
67
  JCFont *game_font;
67
  JCFont *game_font;
68
  uchar keymap[512/8];
68
  uint8_t keymap[512/8];
69
69
70
public : 
70
public : 
71
  int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
71
  int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
Lines 92-105 Link Here
92
                           return cash.foret(foretiles[BLACK]); else 
92
                           return cash.foret(foretiles[BLACK]); else 
93
			   return cash.foret(foretiles[x]); }
93
			   return cash.foret(foretiles[x]); }
94
94
95
  void ftile_on(int screenx, int screeny, long &x, long &y);
95
  void ftile_on(int screenx, int screeny, int32_t &x, int32_t &y);
96
  void btile_on(int screenx, int screeny, long &x, long &y);
96
  void btile_on(int screenx, int screeny, int32_t &x, int32_t &y);
97
  void toggle_delay();
97
  void toggle_delay();
98
  void set_delay(int on) { no_delay=!on; }
98
  void set_delay(int on) { no_delay=!on; }
99
  void pan(int xv, int yv);
99
  void pan(int xv, int yv);
100
100
101
  void mouse_to_game(long x, long y, long &gamex, long &gamey, view *v=NULL);
101
  void mouse_to_game(int32_t x, int32_t y, int32_t &gamex, int32_t &gamey, view *v=NULL);
102
  void game_to_mouse(long gamex, long gamey, view *which, long &x, long &y);
102
  void game_to_mouse(int32_t gamex, int32_t gamey, view *which, int32_t &x, int32_t &y);
103
  view *view_in(int mousex, int mousey);
103
  view *view_in(int mousex, int mousey);
104
104
105
  int calc_speed();
105
  int calc_speed();
Lines 138-144 Link Here
138
  void set_state(int new_state);
138
  void set_state(int new_state);
139
  int game_over();
139
  int game_over();
140
  void grow_views(int amount);
140
  void grow_views(int amount);
141
  void play_sound(int id, int vol, long x, long y);
141
  void play_sound(int id, int vol, int32_t x, int32_t y);
142
  void request_level_load(char *name);
142
  void request_level_load(char *name);
143
  void request_end();
143
  void request_end();
144
  ~game();
144
  ~game();
(-)abuse-sdl-0.7.0.orig/src/include/extend.hpp (-69 / +69 lines)
Lines 22-39 Link Here
22
class simple_object
22
class simple_object
23
{
23
{
24
  public :
24
  public :
25
  schar Fade_dir;
25
  int8_t Fade_dir;
26
  uchar Fade_count,Fade_max;
26
  uint8_t Fade_count,Fade_max;
27
  uchar Flags,grav_on,targetable_on;
27
  uint8_t Flags,grav_on,targetable_on;
28
  long Xvel,Yvel,Xacel,Yacel;
28
  int32_t Xvel,Yvel,Xacel,Yacel;
29
  uchar Fx,Fy,Fxvel,Fyvel,Fxacel,Fyacel;
29
  uint8_t Fx,Fy,Fxvel,Fyvel,Fxacel,Fyacel;
30
  uchar Aitype;
30
  uint8_t Aitype;
31
  ushort Aistate,Aistate_time;
31
  uint16_t Aistate,Aistate_time;
32
  unsigned short Hp,Mp,Fmp;
32
  uint16_t Hp,Mp,Fmp;
33
  schar Frame_dir;        
33
  int8_t Frame_dir;        
34
34
35
35
36
  uchar tobjs,tlights;
36
  uint8_t tobjs,tlights;
37
  game_object **objs,*link;
37
  game_object **objs,*link;
38
  light_source **lights;
38
  light_source **lights;
39
39
Lines 42-56 Link Here
42
  int total_vars();
42
  int total_vars();
43
  char *var_name(int x);
43
  char *var_name(int x);
44
  int   var_type(int x);
44
  int   var_type(int x);
45
  void set_var(int x, ulong v);
45
  void set_var(int x, uint32_t v);
46
  long get_var(int x);
46
  int32_t get_var(int x);
47
47
48
  // leave these public, so I don't have monster code changes.
48
  // leave these public, so I don't have monster code changes.
49
  simple_object();
49
  simple_object();
50
  long x,y,
50
  int32_t x,y,
51
       last_x,last_y;              // used for frame interpolation on fast machines
51
       last_x,last_y;              // used for frame interpolation on fast machines
52
  schar direction,active;
52
  int8_t direction,active;
53
  ushort otype;
53
  uint16_t otype;
54
  character_state state;
54
  character_state state;
55
  short current_frame;
55
  short current_frame;
56
56
Lines 59-96 Link Here
59
  int floating()             { return flags()&FLOATING_FLAG; }
59
  int floating()             { return flags()&FLOATING_FLAG; }
60
60
61
  int keep_ai_info()         { return 1; }
61
  int keep_ai_info()         { return 1; }
62
  uchar flags()              { return Flags; }
62
  uint8_t flags()            { return Flags; }
63
  long xvel()                { return Xvel; }
63
  int32_t xvel()             { return Xvel; }
64
  long yvel()                { return Yvel; }
64
  int32_t yvel()             { return Yvel; }
65
  long xacel()               { return Xacel; }
65
  int32_t xacel()            { return Xacel; }
66
  long yacel()               { return Yacel; }
66
  int32_t yacel()            { return Yacel; }
67
67
68
  uchar fx()                 { return Fx; }
68
  uint8_t fx()               { return Fx; }
69
  uchar fy()                 { return Fy; }
69
  uint8_t fy()               { return Fy; }
70
  uchar fxvel()              { return Fxvel; }
70
  uint8_t fxvel()            { return Fxvel; }
71
  uchar fyvel()              { return Fyvel; }
71
  uint8_t fyvel()            { return Fyvel; }
72
  uchar fxacel()             { return Fxacel; }
72
  uint8_t fxacel()           { return Fxacel; }
73
  uchar fyacel()             { return Fyacel; }
73
  uint8_t fyacel()           { return Fyacel; }
74
74
75
  uchar sfx()                { return Fx; }  // x & y should always be positive
75
  uint8_t sfx()              { return Fx; }  // x & y should always be positive
76
  uchar sfy()                { return Fy; }
76
  uint8_t sfy()              { return Fy; }
77
  uchar sfxvel()             { if (Xvel>=0) return Fxvel; else return -Fxvel; }
77
  uint8_t sfxvel()           { if (Xvel>=0) return Fxvel; else return -Fxvel; }
78
  uchar sfyvel()             { if (Yvel>=0) return Fyvel; else return -Fyvel; }
78
  uint8_t sfyvel()           { if (Yvel>=0) return Fyvel; else return -Fyvel; }
79
  uchar sfxacel()            { if (Xacel>=0) return Fxacel; else return -Fxacel; }
79
  uint8_t sfxacel()          { if (Xacel>=0) return Fxacel; else return -Fxacel; }
80
  uchar sfyacel()            { if (Yacel>=0) return Fyacel; else return -Fyacel; }
80
  uint8_t sfyacel()          { if (Yacel>=0) return Fyacel; else return -Fyacel; }
81
81
82
  uchar aitype()             { return Aitype; }
82
  uint8_t aitype()           { return Aitype; }
83
  ushort aistate()           { return Aistate; }
83
  uint16_t aistate()         { return Aistate; }
84
  ushort aistate_time()      { return Aistate_time; }
84
  uint16_t aistate_time()    { return Aistate_time; }
85
  ushort hp()                { return Hp;         }
85
  uint16_t hp()              { return Hp;         }
86
  ushort mp()                { return Mp;         }
86
  uint16_t mp()              { return Mp;         }
87
  ushort fmp()               { return Fmp;        }
87
  uint16_t fmp()             { return Fmp;        }
88
  schar fade_dir()           { return Fade_dir;   }
88
  int8_t fade_dir()          { return Fade_dir;   }
89
  schar frame_dir()          { return Frame_dir;  }
89
  int8_t frame_dir()         { return Frame_dir;  }
90
  uchar fade_count()         { return Fade_count; }
90
  uint8_t fade_count()       { return Fade_count; }
91
  uchar fade_max()           { return Fade_max;   }
91
  uint8_t fade_max()         { return Fade_max;   }
92
  uchar total_objects()      { return tobjs;      }
92
  uint8_t total_objects()    { return tobjs;      }
93
  uchar total_lights()       { return tlights;    }
93
  uint8_t total_lights()     { return tlights;    }
94
94
95
  morph_char *morph_status()     { return mc; }
95
  morph_char *morph_status()     { return mc; }
96
  light_source *get_light(int x)     
96
  light_source *get_light(int x)     
Lines 99-130 Link Here
99
  { if (x>=tobjs) { lbreak("bad x for object\n"); exit(0); } return objs[x]; }
99
  { if (x>=tobjs) { lbreak("bad x for object\n"); exit(0); } return objs[x]; }
100
  view *controller()             { return Controller; }
100
  view *controller()             { return Controller; }
101
101
102
  void set_targetable(uchar x)    { targetable_on=x; }
102
  void set_targetable(uint8_t x)  { targetable_on=x; }
103
  void set_flags(uchar f)         { Flags=f; }
103
  void set_flags(uint8_t f)       { Flags=f; }
104
  void set_xvel(long xv)          { Xvel=xv; }
104
  void set_xvel(int32_t xv)       { Xvel=xv; }
105
  void set_yvel(long yv)          { Yvel=yv; }
105
  void set_yvel(int32_t yv)       { Yvel=yv; }
106
  void set_xacel(long xa)         { Xacel=xa; }
106
  void set_xacel(int32_t xa)      { Xacel=xa; }
107
  void set_yacel(long ya)         { Yacel=ya; }
107
  void set_yacel(int32_t ya)      { Yacel=ya; }
108
  void set_fx(uchar x)            { Fx=x; }
108
  void set_fx(uint8_t x)          { Fx=x; }
109
  void set_fy(uchar y)            { Fy=y; }
109
  void set_fy(uint8_t y)          { Fy=y; }
110
  void set_fxvel(uchar xv)        { Fxvel=abs(xv); }
110
  void set_fxvel(uint8_t xv)      { Fxvel=abs(xv); }
111
  void set_fyvel(uchar yv)        { Fyvel=abs(yv); }
111
  void set_fyvel(uint8_t yv)      { Fyvel=abs(yv); }
112
  void set_fxacel(uchar xa)       { Fxacel=abs(xa); }
112
  void set_fxacel(uint8_t xa)     { Fxacel=abs(xa); }
113
  void set_fyacel(uchar ya)       { Fyacel=abs(ya); }
113
  void set_fyacel(uint8_t ya)     { Fyacel=abs(ya); }
114
  void set_aitype(uchar t)        { Aitype=t; }
114
  void set_aitype(uint8_t t)      { Aitype=t; }
115
  void set_aistate(ushort s)      { Aistate=s; }
115
  void set_aistate(uint16_t s)      { Aistate=s; }
116
  void set_aistate_time(ushort t) { Aistate_time=t; }
116
  void set_aistate_time(uint16_t t) { Aistate_time=t; }
117
  void set_hp(ushort h)           { Hp=h; }
117
  void set_hp(uint16_t h)           { Hp=h; }
118
  void set_mp(ushort m)           { Mp=m; }
118
  void set_mp(uint16_t m)           { Mp=m; }
119
  void set_fmp(ushort m)          { Fmp=m; }
119
  void set_fmp(uint16_t m)          { Fmp=m; }
120
120
121
121
122
122
123
  void set_fade_count(uchar f)          { Fade_count=f; }
123
  void set_fade_count(uint8_t f)        { Fade_count=f; }
124
  void set_fade_max(uchar m)            { Fade_max=m;  }
124
  void set_fade_max(uint8_t m)          { Fade_max=m;  }
125
  void set_fade_dir(schar d)            { Fade_dir=d; }
125
  void set_fade_dir(int8_t d)            { Fade_dir=d; }
126
126
127
  void set_frame_dir(schar d)           { Frame_dir=d; }
127
  void set_frame_dir(int8_t d)           { Frame_dir=d; }
128
  void add_light(light_source *ls);
128
  void add_light(light_source *ls);
129
  void add_object(game_object *o);
129
  void add_object(game_object *o);
130
130
(-)abuse-sdl-0.7.0.orig/src/include/light.hpp (-20 / +20 lines)
Lines 7-32 Link Here
7
#include "crc.hpp"
7
#include "crc.hpp"
8
8
9
#define TTINTS 9
9
#define TTINTS 9
10
extern uchar *tints[TTINTS];
10
extern uint8_t *tints[TTINTS];
11
extern unsigned char *white_light,*white_light_initial,*green_light,*trans_table;
11
extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
12
extern short ambient_ramp;
12
extern int16_t ambient_ramp;
13
#define REVERSE_GREEN_TINT 8
13
#define REVERSE_GREEN_TINT 8
14
14
15
extern short shutdown_lighting_value,shutdown_lighting;
15
extern int16_t shutdown_lighting_value,shutdown_lighting;
16
16
17
class light_source
17
class light_source
18
{
18
{
19
  public :
19
  public :
20
  long type,x,xshift,y,yshift;
20
  int32_t type,x,xshift,y,yshift;
21
  long outer_radius,mul_div,inner_radius;
21
  int32_t outer_radius,mul_div,inner_radius;
22
22
23
  long x1,y1,x2,y2;
23
  int32_t x1,y1,x2,y2;
24
  char known;
24
  char known;
25
  light_source *next;
25
  light_source *next;
26
26
27
  void calc_range();
27
  void calc_range();
28
  light_source(char Type, long X, long Y, long Inner_radius, long Outer_radius, 
28
  light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, int32_t Outer_radius, 
29
	       long Xshift, long Yshift,
29
	       int32_t Xshift, int32_t Yshift,
30
	       light_source *Next);
30
	       light_source *Next);
31
  light_source *copy();
31
  light_source *copy();
32
} ;
32
} ;
Lines 34-58 Link Here
34
class light_patch
34
class light_patch
35
{
35
{
36
  public :
36
  public :
37
  long total,x1,y1,x2,y2;
37
  int32_t total,x1,y1,x2,y2;
38
  light_source **lights;  
38
  light_source **lights;  
39
  light_patch *next;
39
  light_patch *next;
40
  light_patch(long X1, long Y1, long X2, long Y2, light_patch *Next)
40
  light_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_patch *Next)
41
  { 
41
  { 
42
    x1=X1; y1=Y1; x2=X2; y2=Y2;
42
    x1=X1; y1=Y1; x2=X2; y2=Y2;
43
    next=Next;
43
    next=Next;
44
    total=0;
44
    total=0;
45
    lights=NULL;
45
    lights=NULL;
46
  }
46
  }
47
  void add_light(long X1, long Y1, long X2, long Y2, light_source *who);
47
  void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who);
48
  light_patch *copy(light_patch *Next);
48
  light_patch *copy(light_patch *Next);
49
  ~light_patch() { if (total) jfree(lights); }
49
  ~light_patch() { if (total) jfree(lights); }
50
} ;
50
} ;
51
51
52
void delete_all_lights();
52
void delete_all_lights();
53
void delete_light(light_source *which);
53
void delete_light(light_source *which);
54
light_source *add_light_source(char type, long x, long y, 
54
light_source *add_light_source(char type, int32_t x, int32_t y, 
55
			       long inner, long outer, long xshift, long yshift);
55
			       int32_t inner, int32_t outer, int32_t xshift, int32_t yshift);
56
56
57
void add_light_spec(spec_directory *sd, char *level_name);
57
void add_light_spec(spec_directory *sd, char *level_name);
58
void write_lights(bFILE *fp);
58
void write_lights(bFILE *fp);
Lines 61-76 Link Here
61
61
62
void delete_patch_list(light_patch *first);
62
void delete_patch_list(light_patch *first);
63
light_patch *find_patch(int screenx, int screeny, light_patch *list);
63
light_patch *find_patch(int screenx, int screeny, light_patch *list);
64
int calc_light_value(long x, long y, light_patch *which);			       
64
int calc_light_value(int32_t x, int32_t y, light_patch *which);			       
65
void light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient);
65
void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
66
void double_light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient,
66
void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
67
			 image *out, long out_x, long out_y);
67
			 image *out, int32_t out_x, int32_t out_y);
68
68
69
void calc_light_table(palette *pal);
69
void calc_light_table(palette *pal);
70
extern light_source *first_light_source;
70
extern light_source *first_light_source;
71
extern int light_detail;
71
extern int light_detail;
72
72
73
extern long light_to_number(light_source *l);
73
extern int32_t light_to_number(light_source *l);
74
extern light_source *number_to_light(long x);
74
extern light_source *number_to_light(int32_t x);
75
75
76
#endif
76
#endif
(-)abuse-sdl-0.7.0.orig/src/include/crc.hpp (-2 / +2 lines)
Lines 3-10 Link Here
3
#include "specs.hpp"
3
#include "specs.hpp"
4
#include "macs.hpp"
4
#include "macs.hpp"
5
5
6
unsigned short calc_crc(unsigned char *buf, long len);
6
uint16_t calc_crc(uint8_t *buf, int len);
7
ulong crc_file(bFILE *fp);
7
uint32_t crc_file(bFILE *fp);
8
8
9
9
10
#endif
10
#endif
(-)abuse-sdl-0.7.0.orig/src/include/intsect.hpp (-2 / +2 lines)
Lines 1-8 Link Here
1
#ifndef __INTSECT_HPP_
1
#ifndef __INTSECT_HPP_
2
#define __INTSECT_HPP_
2
#define __INTSECT_HPP_
3
3
4
int setback_intersect(long x1, long y1, long &x2, long &y2,
4
int setback_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2,
5
		      long xp1, long yp1, long xp2, long yp2, long inside);
5
		      int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2, int32_t inside);
6
6
7
#endif
7
#endif
8
8
(-)abuse-sdl-0.7.0.orig/src/sdlport/setup.cpp (-4 / +5 lines)
Lines 39-44 Link Here
39
	printf( "** Abuse Options **\n" );
39
	printf( "** Abuse Options **\n" );
40
	printf( "  -size <arg>       Set the size of the screen\n" );
40
	printf( "  -size <arg>       Set the size of the screen\n" );
41
	printf( "  -edit             Startup in editor mode\n" );
41
	printf( "  -edit             Startup in editor mode\n" );
42
	printf( "  -a <arg>          Use addon named <arg>\n" );
42
	printf( "  -f <arg>          Load map file named <arg>\n" );
43
	printf( "  -f <arg>          Load map file named <arg>\n" );
43
	printf( "  -lisp             Startup in lisp interpreter mode\n" );
44
	printf( "  -lisp             Startup in lisp interpreter mode\n" );
44
	printf( "  -nodelay          Run at maximum speed\n" );
45
	printf( "  -nodelay          Run at maximum speed\n" );
Lines 72-78 Link Here
72
	if( (fd = fopen( rcfile, "w" )) != NULL )
73
	if( (fd = fopen( rcfile, "w" )) != NULL )
73
	{
74
	{
74
		fputs( "; Abuse-SDL Configuration file\n\n", fd );
75
		fputs( "; Abuse-SDL Configuration file\n\n", fd );
75
		fputs( "; Location of the datafiles\ndatadir=/usr/local/share/games/abuse\n\n", fd );
76
		fputs( "; Location of the datafiles\ndatadir=/usr/share/games/abuse\n\n", fd );
76
		fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd );
77
		fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd );
77
		fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd );
78
		fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd );
78
		fputs( "; Use mono audio only\nmono=0\n\n", fd );
79
		fputs( "; Use mono audio only\nmono=0\n\n", fd );
Lines 105-111 Link Here
105
	char *result;
106
	char *result;
106
107
107
	rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
108
	rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
108
	sprintf( rcfile, "%s/abuserc\0", get_save_filename_prefix() );
109
	sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() );
109
	if( (fd = fopen( rcfile, "r" )) != NULL )
110
	if( (fd = fopen( rcfile, "r" )) != NULL )
110
	{
111
	{
111
		while( fgets( buf, sizeof( buf ), fd ) != NULL )
112
		while( fgets( buf, sizeof( buf ), fd ) != NULL )
Lines 358-365 Link Here
358
359
359
	if( (homedir = getenv( "HOME" )) != NULL )
360
	if( (homedir = getenv( "HOME" )) != NULL )
360
	{
361
	{
361
		savedir = (char *)jmalloc( strlen( homedir ) + 8, "savedir" );
362
		savedir = (char *)jmalloc( strlen( homedir ) + 9, "savedir" );
362
		sprintf( savedir, "%s/.abuse/\0", homedir );
363
		sprintf( savedir, "%s/.abuse/", homedir );
363
		// Check if we already have a savegame directory
364
		// Check if we already have a savegame directory
364
		if( (fd = fopen( savedir, "r" )) == NULL )
365
		if( (fd = fopen( savedir, "r" )) == NULL )
365
		{
366
		{
(-)abuse-sdl-0.7.0.orig/src/sdlport/event.cpp (-16 / +3 lines)
Lines 149-170 Link Here
149
			{
149
			{
150
				case SDL_QUIT:
150
				case SDL_QUIT:
151
				{
151
				{
152
					if( the_game->state == RUN_STATE )
152
					exit(0);
153
					{
154
						// We're in the actual game so just confirm the user
155
						// wishes to quit and exit the game.
156
						if( confirm_quit() )
157
						{
158
							the_game->end_session();
159
						}
160
					}
161
					else
162
					{
163
						// We're at the menu screen so simluate the user
164
						// pressing the ESC key.
165
						ev.type = EV_KEY;
166
						ev.key = JK_ESC;
167
					}
168
					break;
153
					break;
169
				}
154
				}
170
				case SDL_MOUSEBUTTONUP:
155
				case SDL_MOUSEBUTTONUP:
Lines 343-348 Link Here
343
											ev.key = SDLK_COLON; break;
328
											ev.key = SDLK_COLON; break;
344
										case SDLK_QUOTE:
329
										case SDLK_QUOTE:
345
											ev.key = SDLK_QUOTEDBL; break;
330
											ev.key = SDLK_QUOTEDBL; break;
331
										default:
332
											break;
346
									}
333
									}
347
								}
334
								}
348
							}
335
							}
(-)abuse-sdl-0.7.0.orig/src/sdlport/video.cpp (-2 / +1 lines)
Lines 225-237 Link Here
225
//
225
//
226
void put_part_image( image *im, int x, int y, int x1, int y1, int x2, int y2 )
226
void put_part_image( image *im, int x, int y, int x1, int y1, int x2, int y2 )
227
{
227
{
228
	int xs, xe, ys, ye;
228
	int xe, ye;
229
	SDL_Rect srcrect, dstrect;
229
	SDL_Rect srcrect, dstrect;
230
	int ii, jj;
230
	int ii, jj;
231
	int srcx, srcy, xstep, ystep;
231
	int srcx, srcy, xstep, ystep;
232
	Uint8 *dpixel;
232
	Uint8 *dpixel;
233
	Uint16 dinset;
233
	Uint16 dinset;
234
	int dest_addr, line_width;
235
234
236
	if( (unsigned)y > yres || (unsigned)x > xres )
235
	if( (unsigned)y > yres || (unsigned)x > xres )
237
	{
236
	{
(-)abuse-sdl-0.7.0.orig/src/sdlport/sound.cpp (-3 / +3 lines)
Lines 66-72 Link Here
66
	{
66
	{
67
		if( handle->length > 0 && handle->pos )
67
		if( handle->length > 0 && handle->pos )
68
		{
68
		{
69
			len = ( len > handle->length ? handle->length : len );
69
			len = ( len > (int)handle->length ? handle->length : len );
70
			SDL_MixAudio( stream, handle->pos, len, handle->volume );
70
			SDL_MixAudio( stream, handle->pos, len, handle->volume );
71
			handle->pos += len;
71
			handle->pos += len;
72
			handle->length -= len;
72
			handle->length -= len;
Lines 111-118 Link Here
111
111
112
	// Check for the sfx directory, disable sound if we can't find it.
112
	// Check for the sfx directory, disable sound if we can't find it.
113
	datadir = get_filename_prefix();
113
	datadir = get_filename_prefix();
114
	sfxdir = (char *)jmalloc( strlen( datadir ) + 6, "sfxdir" );
114
	sfxdir = (char *)jmalloc( strlen( datadir ) + 5 + 1, "sfxdir" );
115
	sprintf( sfxdir, "%s/sfx/\0", datadir );
115
	sprintf( sfxdir, "%s/sfx/", datadir );
116
	if( (fd = fopen( sfxdir,"r" )) == NULL )
116
	if( (fd = fopen( sfxdir,"r" )) == NULL )
117
	{
117
	{
118
		// Didn't find the directory, so disable sound.
118
		// Didn't find the directory, so disable sound.
(-)abuse-sdl-0.7.0.orig/src/net/include/fileman.hpp (-9 / +9 lines)
Lines 18-26 Link Here
18
    net_socket *sock;
18
    net_socket *sock;
19
    int file_fd;
19
    int file_fd;
20
20
21
    long size_to_read;  
22
    long size;
23
    nfs_client *next;
21
    nfs_client *next;
22
    int32_t size_to_read;  
23
    int32_t size;
24
    nfs_client(net_socket *sock, int file_fd, nfs_client *next);
24
    nfs_client(net_socket *sock, int file_fd, nfs_client *next);
25
    int send_read();     // flushes as much of size_to_read as possible
25
    int send_read();     // flushes as much of size_to_read as possible
26
    ~nfs_client();
26
    ~nfs_client();
Lines 32-47 Link Here
32
    public :
32
    public :
33
    net_socket *sock;
33
    net_socket *sock;
34
    void r_close(char *reason);
34
    void r_close(char *reason);
35
    long size;   // server tells us the size of the file when we open it
35
    int32_t size;   // server tells us the size of the file when we open it
36
    int open_local;
36
    int open_local;
37
    remote_file *next; 
37
    remote_file *next; 
38
    remote_file(net_socket *sock, char *filename, char *mode, remote_file *Next);
38
    remote_file(net_socket *sock, char *filename, char *mode, remote_file *Next);
39
39
40
    int unbuffered_read(void *buffer, size_t count);
40
    int unbuffered_read(void *buffer, size_t count);
41
    int unbuffered_write(void *buf, size_t count) { return 0; } // not supported
41
    int unbuffered_write(void *buf, size_t count) { return 0; } // not supported
42
    long unbuffered_tell();
42
    int32_t unbuffered_tell();
43
    long unbuffered_seek(long offset);
43
    int32_t unbuffered_seek(int32_t offset);
44
    long file_size() { return size; }
44
    int32_t file_size() { return size; }
45
    int open_failure() { return sock==NULL; }    
45
    int open_failure() { return sock==NULL; }    
46
    ~remote_file();
46
    ~remote_file();
47
    int fd() { if (sock) return sock->get_fd(); else return -1; }
47
    int fd() { if (sock) return sock->get_fd(); else return -1; }
Lines 63-73 Link Here
63
63
64
64
65
  int rf_open_file(char *&filename, char *mode);
65
  int rf_open_file(char *&filename, char *mode);
66
  long rf_tell(int fd);
66
  int32_t rf_tell(int fd);
67
  long rf_seek(int fd, long offset);
67
  int32_t rf_seek(int fd, int32_t offset);
68
  int rf_read(int fd, void *buffer, size_t count);
68
  int rf_read(int fd, void *buffer, size_t count);
69
  int rf_close(int fd);
69
  int rf_close(int fd);
70
  long rf_file_size(int fd);
70
  int32_t rf_file_size(int fd);
71
  void set_default_fs(net_address *def) { default_fs=def->copy(); }
71
  void set_default_fs(net_address *def) { default_fs=def->copy(); }
72
  ~file_manager() { if (default_fs) delete default_fs; }
72
  ~file_manager() { if (default_fs) delete default_fs; }
73
} ;
73
} ;
(-)abuse-sdl-0.7.0.orig/src/net/include/gserver.hpp (-1 / +1 lines)
Lines 35-42 Link Here
35
    int need_reload_start_ok() { return get_flag(Need_reload_start_ok); }
35
    int need_reload_start_ok() { return get_flag(Need_reload_start_ok); }
36
    void set_need_reload_start_ok(int x) { set_flag(Need_reload_start_ok,x); }
36
    void set_need_reload_start_ok(int x) { set_flag(Need_reload_start_ok,x); }
37
37
38
    net_socket *comm;
39
    int client_id; 
38
    int client_id; 
39
    net_socket *comm;
40
    net_address *data_address;
40
    net_address *data_address;
41
    player_client *next;
41
    player_client *next;
42
    player_client(int client_id, net_socket *comm, net_address *data_address, player_client *next) : 
42
    player_client(int client_id, net_socket *comm, net_address *data_address, player_client *next) : 
(-)abuse-sdl-0.7.0.orig/src/net/include/endian.hpp (-8 / +6 lines)
Lines 18-35 Link Here
18
// across the net as the other computer might have a different endianess
18
// across the net as the other computer might have a different endianess
19
19
20
#ifdef BIGUNS
20
#ifdef BIGUNS
21
#define swap_short(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
21
#define swap_uint16(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
22
#define swap_long(x) \
22
#define swap_uint32(x) \
23
   ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
23
   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
24
   ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
24
   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
25
#else
25
#else
26
#define swap_short(x) (x)
26
#define swap_uint16(x) (x)
27
#define swap_long(x) (x)
27
#define swap_uint32(x) (x)
28
28
29
#endif
29
#endif
30
30
31
#define uchar unsigned char
32
33
#endif
31
#endif
34
32
35
33
(-)abuse-sdl-0.7.0.orig/src/net/include/sock.hpp (+1 lines)
Lines 16-21 Link Here
16
  virtual void print()               { ; }
16
  virtual void print()               { ; }
17
  virtual net_address *copy()    = 0;
17
  virtual net_address *copy()    = 0;
18
  virtual void store_string(char *st, int st_length) = 0;    // this should be able to be used get_node_address()
18
  virtual void store_string(char *st, int st_length) = 0;    // this should be able to be used get_node_address()
19
  virtual ~net_address() {;}
19
} ;
20
} ;
20
21
21
22
(-)abuse-sdl-0.7.0.orig/src/net/include/tcpip.hpp (-2 / +3 lines)
Lines 84-97 Link Here
84
  };
84
  };
85
  typedef isllist<RequestItem *>::iterator p_request;
85
  typedef isllist<RequestItem *>::iterator p_request;
86
  isllist<RequestItem*> servers,returned;
86
  isllist<RequestItem*> servers,returned;
87
  net_socket *responder;
88
  ip_address *bcast;
89
87
90
  // Notification Data
88
  // Notification Data
91
  net_socket *notifier;
89
  net_socket *notifier;
92
  char notify_data[512];
90
  char notify_data[512];
93
  int notify_len;
91
  int notify_len;
94
92
93
  net_socket *responder;
94
  ip_address *bcast;
95
95
  int handle_notification();
96
  int handle_notification();
96
  int handle_responder();
97
  int handle_responder();
97
public :
98
public :
(-)abuse-sdl-0.7.0.orig/src/net/include/ipx.hpp (-3 / +3 lines)
Lines 140-148 Link Here
140
    
140
    
141
    void add_to_packet(void *buf, int size);
141
    void add_to_packet(void *buf, int size);
142
142
143
    void write_byte(unsigned char x) { add_to_packet(&x,1); }
143
    void write_uint8(uint8_t x) { add_to_packet(&x,1); }
144
    void write_short(unsigned short x) { x=lstl(x); add_to_packet(&x,2); }
144
    void write_uint16(uint16_t x) { x=lstl(x); add_to_packet(&x,2); }
145
    void write_long(unsigned long x) { x=lltl(x); add_to_packet(&x,4); }
145
    void write_uint32(uint32_t x) { x=lltl(x); add_to_packet(&x,4); }
146
146
147
147
148
  } *pk;
148
  } *pk;
(-)abuse-sdl-0.7.0.orig/src/net/include/indian.hpp (-5 / +3 lines)
Lines 9-26 Link Here
9
// across the net as the other computer might have a different endianess
9
// across the net as the other computer might have a different endianess
10
10
11
#ifdef BIGUNS
11
#ifdef BIGUNS
12
#define lstl(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
12
#define lstl(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
13
#define lltl(x) \
13
#define lltl(x) \
14
   ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
14
   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
15
   ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
15
   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
16
#else
16
#else
17
#define lstl(x) (x)
17
#define lstl(x) (x)
18
#define lltl(x) (x)
18
#define lltl(x) (x)
19
19
20
#endif
20
#endif
21
21
22
#define uchar unsigned char
23
24
#endif
22
#endif
25
23
26
24
(-)abuse-sdl-0.7.0.orig/src/net/tcpip.cpp (-2 / +4 lines)
Lines 98-104 Link Here
98
#else
98
#else
99
  char my_name[100];						// check to see if this address is 'hostname'
99
  char my_name[100];						// check to see if this address is 'hostname'
100
  gethostname(my_name,100);
100
  gethostname(my_name,100);
101
  ip_address *ret = 0;
101
  //ip_address *ret = 0;
102
  
102
  
103
  if (my_name[0]<'0' || my_name[0]>'9')
103
  if (my_name[0]<'0' || my_name[0]>'9')
104
  {
104
  {
Lines 378-385 Link Here
378
    {
378
    {
379
			buf[len] = 0;
379
			buf[len] = 0;
380
      if  (strcmp(buf, notify_signature)==0) {
380
      if  (strcmp(buf, notify_signature)==0) {
381
				char s[256];
382
#ifdef TCPIP_DEBUG
381
#ifdef TCPIP_DEBUG
382
				char s[256];
383
				addr->store_string(s,256);
383
				addr->store_string(s,256);
384
				printf("responding to %s",s);
384
				printf("responding to %s",s);
385
#endif
385
#endif
Lines 536-542 Link Here
536
      		 	
536
      		 	
537
      	if (!found)
537
      	if (!found)
538
      	{
538
      	{
539
#ifdef TCPIP_DEBUG
539
					char s[256];
540
					char s[256];
541
#endif
540
					RequestItem *r = new RequestItem;
542
					RequestItem *r = new RequestItem;
541
					r->addr = addr;
543
					r->addr = addr;
542
					strcpy(r->name,buf+5);					// ack hard coded numbers for now
544
					strcpy(r->name,buf+5);					// ack hard coded numbers for now
(-)abuse-sdl-0.7.0.orig/src/net/netdrv.cpp (-27 / +27 lines)
Lines 23-30 Link Here
23
#include <bstring.h>
23
#include <bstring.h>
24
#include <netdb.h>
24
#include <netdb.h>
25
25
26
#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((char *)(ptr)-(char *)base)))
26
#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((uint8_t *)(ptr)-(uint8_t *)base)))
27
#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((long)(ptr)+(long)(base))))
27
#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((intptr_t)(ptr)+(intptr_t)(base))))
28
28
29
net_driver *driver=NULL;
29
net_driver *driver=NULL;
30
30
Lines 137-143 Link Here
137
    comm_failed();
137
    comm_failed();
138
138
139
  // wait for engine to ack it has attached
139
  // wait for engine to ack it has attached
140
  uchar ack=0;
140
  uint8_t ack=0;
141
  if (in->read(&ack,1)!=1 || ack!=1)
141
  if (in->read(&ack,1)!=1 || ack!=1)
142
    comm_failed();
142
    comm_failed();
143
143
Lines 215-221 Link Here
215
  int ret=0;
215
  int ret=0;
216
  if (in->ready_to_read())       // commands from engine?
216
  if (in->ready_to_read())       // commands from engine?
217
  {
217
  {
218
    uchar cmd;
218
    uint8_t cmd;
219
    if (in->read(&cmd,1)!=1) return 0;
219
    if (in->read(&cmd,1)!=1) return 0;
220
220
221
    if (debug)
221
    if (debug)
Lines 280-290 Link Here
280
280
281
      case NFCMD_REQUEST_ENTRY :
281
      case NFCMD_REQUEST_ENTRY :
282
      {
282
      {
283
	uchar len;
283
	uint8_t len;
284
	char name[256];
284
	char name[256];
285
	if (in->read(&len,1)!=1) { mdie("could not read server name length"); }
285
	if (in->read(&len,1)!=1) { mdie("could not read server name length"); }
286
	if (in->read(name,len)!=len) { mdie("could not read server name"); }
286
	if (in->read(name,len)!=len) { mdie("could not read server name"); }
287
	ushort success=join_server(name);
287
	uint16_t success=join_server(name);
288
	if (out->write(&success,2)!=2) mdie("cound not send lsf read failure");      
288
	if (out->write(&success,2)!=2) mdie("cound not send lsf read failure");      
289
      } break;
289
      } break;
290
      case NFCMD_BECOME_SERVER :
290
      case NFCMD_BECOME_SERVER :
Lines 294-300 Link Here
294
      } break;
294
      } break;
295
      case NFCMD_REQUEST_LSF :
295
      case NFCMD_REQUEST_LSF :
296
      {
296
      {
297
	uchar len;
297
	uint8_t len;
298
	char name[256];
298
	char name[256];
299
	if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
299
	if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
300
	if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
300
	if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
Lines 312-318 Link Here
312
312
313
      case NFCMD_PROCESS_LSF :
313
      case NFCMD_PROCESS_LSF :
314
      {
314
      {
315
	uchar len,name[256];
315
	uint8_t len,name[256];
316
	if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
316
	if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
317
	if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
317
	if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
318
318
Lines 320-326 Link Here
320
	{
320
	{
321
	  lsf_waiter *c=lsf_wait_list;
321
	  lsf_waiter *c=lsf_wait_list;
322
	  lsf_wait_list=lsf_wait_list->next;
322
	  lsf_wait_list=lsf_wait_list->next;
323
	  uchar status=1;
323
	  uint8_t status=1;
324
	  c->sock->write(&len,1);
324
	  c->sock->write(&len,1);
325
	  c->sock->write(name,len);
325
	  c->sock->write(name,len);
326
	  delete c;
326
	  delete c;
Lines 333-339 Link Here
333
	{
333
	{
334
	  crc_waiter *c=crc_wait_list;
334
	  crc_waiter *c=crc_wait_list;
335
	  crc_wait_list=crc_wait_list->next;
335
	  crc_wait_list=crc_wait_list->next;
336
	  uchar status=1;
336
	  uint8_t status=1;
337
	  c->sock->write(&status,1);
337
	  c->sock->write(&status,1);
338
	  delete c;
338
	  delete c;
339
	}
339
	}
Lines 341-347 Link Here
341
341
342
      case NFCMD_SET_FS :
342
      case NFCMD_SET_FS :
343
      {
343
      {
344
	uchar size;
344
	uint8_t size;
345
	char sn[256];
345
	char sn[256];
346
	if (in->read(&size,1)!=1) mdie("could not read filename length");
346
	if (in->read(&size,1)!=1) mdie("could not read filename length");
347
	if (in->read(sn,size)!=size) mdie("could not read server name");
347
	if (in->read(sn,size)!=size) mdie("could not read server name");
Lines 353-359 Link Here
353
353
354
      case NFCMD_OPEN :
354
      case NFCMD_OPEN :
355
      {
355
      {
356
	uchar size[2];
356
	uint8_t size[2];
357
	char filename[300],mode[20],*fn;
357
	char filename[300],mode[20],*fn;
358
	fn=filename;
358
	fn=filename;
359
	if (in->read(size,2)!=2  ||
359
	if (in->read(size,2)!=2  ||
Lines 364-381 Link Here
364
	int fd=fman->rf_open_file(fn,mode);
364
	int fd=fman->rf_open_file(fn,mode);
365
	if (fd==-2)
365
	if (fd==-2)
366
	{
366
	{
367
	  uchar st[2];
367
	  uint8_t st[2];
368
	  st[0]=NF_OPEN_LOCAL_FILE;
368
	  st[0]=NF_OPEN_LOCAL_FILE;
369
	  st[1]=strlen(fn)+1;
369
	  st[1]=strlen(fn)+1;
370
	  if (out->write(st,2)!=2) comm_failed();
370
	  if (out->write(st,2)!=2) comm_failed();
371
	  if (out->write(fn,st[1])!=st[1]) comm_failed();
371
	  if (out->write(fn,st[1])!=st[1]) comm_failed();
372
	} else if (fd==-1)
372
	} else if (fd==-1)
373
	{
373
	{
374
	  uchar st=NF_OPEN_FAILED;
374
	  uint8_t st=NF_OPEN_FAILED;
375
	  if (out->write(&st,1)!=1) comm_failed(); 
375
	  if (out->write(&st,1)!=1) comm_failed(); 
376
	} else
376
	} else
377
	{
377
	{
378
	  uchar st=NF_OPEN_REMOTE_FILE;
378
	  uint8_t st=NF_OPEN_REMOTE_FILE;
379
	  if (out->write(&st,1)!=1) comm_failed(); 	
379
	  if (out->write(&st,1)!=1) comm_failed(); 	
380
	  if (out->write(&fd,sizeof(fd))!=sizeof(fd)) comm_failed(); 	
380
	  if (out->write(&fd,sizeof(fd))!=sizeof(fd)) comm_failed(); 	
381
	}
381
	}
Lines 394-422 Link Here
394
	  case NFCMD_CLOSE : 
394
	  case NFCMD_CLOSE : 
395
	  { 
395
	  { 
396
	    fman->rf_close(fd);
396
	    fman->rf_close(fd);
397
	    uchar st=1;
397
	    uint8_t st=1;
398
	    if (out->write(&st,1)!=1) comm_failed(); 	
398
	    if (out->write(&st,1)!=1) comm_failed(); 	
399
	  } break;
399
	  } break;
400
	  case NFCMD_SIZE  :
400
	  case NFCMD_SIZE  :
401
	  {
401
	  {
402
	    long x=fman->rf_file_size(fd);
402
	    int32_t x=fman->rf_file_size(fd);
403
	    if (out->write(&x,sizeof(x))!=sizeof(x)) comm_failed(); 		  
403
	    if (out->write(&x,sizeof(x))!=sizeof(x)) comm_failed(); 		  
404
	  } break;
404
	  } break;
405
	  case NFCMD_TELL :
405
	  case NFCMD_TELL :
406
	  {
406
	  {
407
	    long offset=fman->rf_tell(fd);
407
	    int32_t offset=fman->rf_tell(fd);
408
	    if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();  
408
	    if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();  
409
	  } break;
409
	  } break;
410
	  case NFCMD_SEEK :
410
	  case NFCMD_SEEK :
411
	  {
411
	  {
412
	    long offset;
412
	    int32_t offset;
413
	    if (in->read(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();
413
	    if (in->read(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();
414
	    offset=fman->rf_seek(fd,offset);
414
	    offset=fman->rf_seek(fd,offset);
415
	    if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();  
415
	    if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();  
416
	  } break;
416
	  } break;
417
	  case NFCMD_READ :
417
	  case NFCMD_READ :
418
	  {
418
	  {
419
	    long size;
419
	    int32_t size;
420
	    if (in->read(&size,sizeof(size))!=sizeof(size)) comm_failed();
420
	    if (in->read(&size,sizeof(size))!=sizeof(size)) comm_failed();
421
	    fman->rf_read(fd,out,size);
421
	    fman->rf_read(fd,out,size);
422
	  } break;
422
	  } break;
Lines 445-454 Link Here
445
    return 0;
445
    return 0;
446
  }
446
  }
447
447
448
  uchar ctype=CLIENT_ABUSE;
448
  uint8_t ctype=CLIENT_ABUSE;
449
  ushort port=lstl(game_port),cnum;
449
  uint16_t port=lstl(game_port),cnum;
450
450
451
  uchar reg;
451
  uint8_t reg;
452
  if (sock->write(&ctype,1)!=1 ||   // send server out game port
452
  if (sock->write(&ctype,1)!=1 ||   // send server out game port
453
      sock->read(&reg,1)!=1)        // is remote engine registered?
453
      sock->read(&reg,1)!=1)        // is remote engine registered?
454
  { delete sock; return 0; }
454
  { delete sock; return 0; }
Lines 483-489 Link Here
483
  if (getlogin())
483
  if (getlogin())
484
    strcpy(uname,getlogin());
484
    strcpy(uname,getlogin());
485
  else strcpy(uname,"unknown");
485
  else strcpy(uname,"unknown");
486
  uchar len=strlen(uname)+1;
486
  uint8_t len=strlen(uname)+1;
487
487
488
  if (sock->write(&len,1)!=1 ||
488
  if (sock->write(&len,1)!=1 ||
489
      sock->write(uname,len)!=len || 
489
      sock->write(uname,len)!=len || 
Lines 531-538 Link Here
531
  net_socket *sock=connect_to_server(name);
531
  net_socket *sock=connect_to_server(name);
532
  if (!sock) return 0;
532
  if (!sock) return 0;
533
533
534
  uchar ctype=CLIENT_LSF_WAITER;
534
  uint8_t ctype=CLIENT_LSF_WAITER;
535
  uchar len;
535
  uint8_t len;
536
536
537
  if (sock->write(&ctype,1)!=1 ||
537
  if (sock->write(&ctype,1)!=1 ||
538
      sock->read(&len,1)!=1 || len==0 ||
538
      sock->read(&len,1)!=1 || len==0 ||
Lines 552-558 Link Here
552
{
552
{
553
  net_socket *sock=connect_to_server(server);
553
  net_socket *sock=connect_to_server(server);
554
  if (!sock) return 0;
554
  if (!sock) return 0;
555
  uchar cmd=CLIENT_CRC_WAITER;
555
  uint8_t cmd=CLIENT_CRC_WAITER;
556
  if (sock->write(&cmd,1)!=1 ||
556
  if (sock->write(&cmd,1)!=1 ||
557
      sock->read(&cmd,1)!=1)  
557
      sock->read(&cmd,1)!=1)  
558
  { delete sock; return 0; }
558
  { delete sock; return 0; }
(-)abuse-sdl-0.7.0.orig/src/net/engine.cpp (-29 / +29 lines)
Lines 245-251 Link Here
245
      comm_failed();
245
      comm_failed();
246
246
247
    // wait for engine to ack it has attached
247
    // wait for engine to ack it has attached
248
    uchar ack=0;
248
    uint8_t ack=0;
249
    if (read(driver_in_fd,&ack,1)!=1 || ack!=1)
249
    if (read(driver_in_fd,&ack,1)!=1 || ack!=1)
250
      comm_failed();
250
      comm_failed();
251
  }
251
  }
Lines 466-474 Link Here
466
  char *name_start=name;
466
  char *name_start=name;
467
  int fd=connect_to_server(name);
467
  int fd=connect_to_server(name);
468
  if (fd<0) return 0;
468
  if (fd<0) return 0;
469
  uchar ctype=CLIENT_LSF_WAITER;
469
  uint8_t ctype=CLIENT_LSF_WAITER;
470
  if (write(fd,&ctype,1)!=1) { close(fd); return 0; } 
470
  if (write(fd,&ctype,1)!=1) { close(fd); return 0; } 
471
  uchar len;
471
  uint8_t len;
472
  if (read(fd,&len,1)!=1 || len==0) { close(fd); return 0; }
472
  if (read(fd,&len,1)!=1 || len==0) { close(fd); return 0; }
473
  if (read(fd,name_start,len)!=len) { close(fd); return 0; }
473
  if (read(fd,name_start,len)!=len) { close(fd); return 0; }
474
  close(fd);
474
  close(fd);
Lines 481-498 Link Here
481
  strcpy(sn_start,server_name);
481
  strcpy(sn_start,server_name);
482
482
483
  int fd=connect_to_server(server_name);
483
  int fd=connect_to_server(server_name);
484
  uchar ctype=CLIENT_ABUSE;
484
  uint8_t ctype=CLIENT_ABUSE;
485
  if (write(fd,&ctype,1)!=1) { close(fd); return 0; } 
485
  if (write(fd,&ctype,1)!=1) { close(fd); return 0; } 
486
486
487
  // send server out game port
487
  // send server out game port
488
  ushort port=lstl(packet_port);
488
  uint16_t port=lstl(packet_port);
489
  if (write(fd,&port,2)!=2) { close(fd); return 0; }
489
  if (write(fd,&port,2)!=2) { close(fd); return 0; }
490
490
491
  // read server's game port
491
  // read server's game port
492
  if (read(fd,&port,2)!=2) { close(fd); return 0; }
492
  if (read(fd,&port,2)!=2) { close(fd); return 0; }
493
  port=lstl(port);
493
  port=lstl(port);
494
494
495
  ushort cnum;
495
  uint16_t cnum;
496
  if (read(fd,&cnum,2)!=2 || cnum==0) { close(fd); return 0; }
496
  if (read(fd,&cnum,2)!=2 || cnum==0) { close(fd); return 0; }
497
  cnum=lstl(cnum);
497
  cnum=lstl(cnum);
498
498
Lines 515-527 Link Here
515
  {
515
  {
516
    if (!c->has_joined)
516
    if (!c->has_joined)
517
    {
517
    {
518
      ushort cnum=lstl(c->client_id);
518
      uint16_t cnum=lstl(c->client_id);
519
      if (write(c->socket_fd,&cnum,2)!=2) { c->delete_me=1; }
519
      if (write(c->socket_fd,&cnum,2)!=2) { c->delete_me=1; }
520
      c->wait_reload=1;
520
      c->wait_reload=1;
521
      c->has_joined=1;
521
      c->has_joined=1;
522
    } else if (!c->delete_me)
522
    } else if (!c->delete_me)
523
    {
523
    {
524
      uchar reload=CLCMD_RELOAD;
524
      uint8_t reload=CLCMD_RELOAD;
525
      if (write(c->socket_fd,&reload,1)!=1) { c->delete_me=1; }
525
      if (write(c->socket_fd,&reload,1)!=1) { c->delete_me=1; }
526
      c->wait_reload=1;
526
      c->wait_reload=1;
527
    }
527
    }
Lines 581-587 Link Here
581
581
582
void process_engine_command()
582
void process_engine_command()
583
{
583
{
584
  uchar cmd;
584
  uint8_t cmd;
585
  if (read(driver_in_fd,&cmd,1)!=1) { mdie("could not read command from engine"); }
585
  if (read(driver_in_fd,&cmd,1)!=1) { mdie("could not read command from engine"); }
586
  switch (cmd)
586
  switch (cmd)
587
  {
587
  {
Lines 643-649 Link Here
643
    {
643
    {
644
      if (game_server_fd>0)
644
      if (game_server_fd>0)
645
      {
645
      {
646
	uchar ok=CLCMD_RELOADED;
646
	uint8_t ok=CLCMD_RELOADED;
647
        if (!write(game_server_fd,&ok,1)) { mdie("could not send join_ok msg"); }	
647
        if (!write(game_server_fd,&ok,1)) { mdie("could not send join_ok msg"); }	
648
	next_process();
648
	next_process();
649
      }
649
      }
Lines 656-674 Link Here
656
656
657
    case NFCMD_REQUEST_ENTRY :
657
    case NFCMD_REQUEST_ENTRY :
658
    {
658
    {
659
      uchar len;
659
      uint8_t len;
660
      char name[256];
660
      char name[256];
661
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read server name length"); }
661
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read server name length"); }
662
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read server name"); }
662
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read server name"); }
663
      strcpy(net_server,name);
663
      strcpy(net_server,name);
664
      ushort success=join_game(name);
664
      uint16_t success=join_game(name);
665
      if (write(driver_out_fd,&success,2)!=2) mdie("cound not send lsf read failure");      
665
      if (write(driver_out_fd,&success,2)!=2) mdie("cound not send lsf read failure");      
666
      next_process();
666
      next_process();
667
    } break;
667
    } break;
668
668
669
    case NFCMD_REQUEST_LSF :
669
    case NFCMD_REQUEST_LSF :
670
    {
670
    {
671
      uchar len;
671
      uint8_t len;
672
      char name[256];
672
      char name[256];
673
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
673
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
674
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
674
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
Lines 687-700 Link Here
687
687
688
    case NFCMD_PROCESS_LSF :
688
    case NFCMD_PROCESS_LSF :
689
    {
689
    {
690
      uchar len,name[256];
690
      uint8_t len,name[256];
691
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
691
      if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
692
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
692
      if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
693
      while (lsf_wait_list)
693
      while (lsf_wait_list)
694
      {
694
      {
695
	lsf_waiter *c=lsf_wait_list;
695
	lsf_waiter *c=lsf_wait_list;
696
	lsf_wait_list=lsf_wait_list->next;
696
	lsf_wait_list=lsf_wait_list->next;
697
	uchar status=1;
697
	uint8_t status=1;
698
	write(c->socket_fd,&len,1);
698
	write(c->socket_fd,&len,1);
699
	write(c->socket_fd,name,len);
699
	write(c->socket_fd,name,len);
700
	delete c;
700
	delete c;
Lines 708-714 Link Here
708
      {
708
      {
709
	crc_waiter *c=crc_wait_list;
709
	crc_waiter *c=crc_wait_list;
710
	crc_wait_list=crc_wait_list->next;
710
	crc_wait_list=crc_wait_list->next;
711
	uchar status=1;
711
	uint8_t status=1;
712
	write(c->socket_fd,&status,1);
712
	write(c->socket_fd,&status,1);
713
	delete c;
713
	delete c;
714
      }
714
      }
Lines 717-723 Link Here
717
717
718
    case NFCMD_SET_FS :
718
    case NFCMD_SET_FS :
719
    {
719
    {
720
      uchar size;
720
      uint8_t size;
721
      char sn[256];
721
      char sn[256];
722
      if (read(driver_in_fd,&size,1)!=1) mdie("could not read filename length");
722
      if (read(driver_in_fd,&size,1)!=1) mdie("could not read filename length");
723
      if (read(driver_in_fd,sn,size)!=size) mdie("could not read server name");
723
      if (read(driver_in_fd,sn,size)!=size) mdie("could not read server name");
Lines 729-735 Link Here
729
729
730
    case NFCMD_OPEN :
730
    case NFCMD_OPEN :
731
    {
731
    {
732
      uchar size[2];
732
      uint8_t size[2];
733
      char filename[300],mode[20],*fn;
733
      char filename[300],mode[20],*fn;
734
      fn=filename;
734
      fn=filename;
735
      if (read(driver_in_fd,size,2)!=2) mdie("could not read fd on open");
735
      if (read(driver_in_fd,size,2)!=2) mdie("could not read fd on open");
Lines 739-745 Link Here
739
      int fd=open_file(fn,mode);
739
      int fd=open_file(fn,mode);
740
      if (fd==-2)
740
      if (fd==-2)
741
      {
741
      {
742
	uchar st[2];
742
	uint8_t st[2];
743
	st[0]=NF_OPEN_LOCAL_FILE;
743
	st[0]=NF_OPEN_LOCAL_FILE;
744
	st[1]=strlen(fn)+1;
744
	st[1]=strlen(fn)+1;
745
	if (write(driver_out_fd,st,2)!=2) comm_failed();
745
	if (write(driver_out_fd,st,2)!=2) comm_failed();
Lines 749-759 Link Here
749
	if (size!=st[1]) comm_failed();
749
	if (size!=st[1]) comm_failed();
750
      } else if (fd==-1)
750
      } else if (fd==-1)
751
      {
751
      {
752
	uchar st=NF_OPEN_FAILED;
752
	uint8_t st=NF_OPEN_FAILED;
753
	if (write(driver_out_fd,&st,1)!=1) comm_failed(); 
753
	if (write(driver_out_fd,&st,1)!=1) comm_failed(); 
754
      } else
754
      } else
755
      {
755
      {
756
	uchar st=NF_OPEN_REMOTE_FILE;
756
	uint8_t st=NF_OPEN_REMOTE_FILE;
757
	if (write(driver_out_fd,&st,1)!=1) comm_failed(); 	
757
	if (write(driver_out_fd,&st,1)!=1) comm_failed(); 	
758
	if (write(driver_out_fd,&fd,sizeof(fd))!=sizeof(fd)) comm_failed(); 	
758
	if (write(driver_out_fd,&fd,sizeof(fd))!=sizeof(fd)) comm_failed(); 	
759
      }
759
      }
Lines 777-783 Link Here
777
	{ 
777
	{ 
778
	  unlink_remote_file(rf);
778
	  unlink_remote_file(rf);
779
	  delete rf; 
779
	  delete rf; 
780
	  uchar st=1;
780
	  uint8_t st=1;
781
	  if (write(driver_out_fd,&st,1)!=1) comm_failed(); 	
781
	  if (write(driver_out_fd,&st,1)!=1) comm_failed(); 	
782
	} break;
782
	} break;
783
	case NFCMD_SIZE  :
783
	case NFCMD_SIZE  :
Lines 813-819 Link Here
813
813
814
int process_client_command(client *c)
814
int process_client_command(client *c)
815
{
815
{
816
  uchar cmd;
816
  uint8_t cmd;
817
  if (read(c->socket_fd,&cmd,1)!=1) return 0;
817
  if (read(c->socket_fd,&cmd,1)!=1) return 0;
818
  switch (cmd)
818
  switch (cmd)
819
  {
819
  {
Lines 828-834 Link Here
828
    } break;
828
    } break;
829
    case CLCMD_REQUEST_RESEND :
829
    case CLCMD_REQUEST_RESEND :
830
    {
830
    {
831
      uchar tick;
831
      uint8_t tick;
832
      if (read(c->socket_fd,&tick,1)!=1) return 0;
832
      if (read(c->socket_fd,&tick,1)!=1) return 0;
833
833
834
834
Lines 877-887 Link Here
877
877
878
int add_game_client(int fd, sockaddr *from)     // returns false if could not join client
878
int add_game_client(int fd, sockaddr *from)     // returns false if could not join client
879
{  
879
{  
880
  ushort port;
880
  uint16_t port;
881
  if (read(fd,&port,2)!=2) { close(fd);  return 0; }
881
  if (read(fd,&port,2)!=2) { close(fd);  return 0; }
882
  port=lstl(port);
882
  port=lstl(port);
883
883
884
  ushort pport=lstl(packet_port);
884
  uint16_t pport=lstl(packet_port);
885
  if (write(fd,&pport,2)!=2) { close(fd);  return 0; }  
885
  if (write(fd,&pport,2)!=2) { close(fd);  return 0; }  
886
886
887
887
Lines 892-898 Link Here
892
892
893
  if (f===-1) { close(fd); return 0; }
893
  if (f===-1) { close(fd); return 0; }
894
894
895
  ushort client_id=lstl(f);
895
  uint16_t client_id=lstl(f);
896
  if (write(fd,&client_id,2)!=2) { close(fd);  return 0; }    
896
  if (write(fd,&client_id,2)!=2) { close(fd);  return 0; }    
897
897
898
898
Lines 1123-1129 Link Here
1123
	}
1123
	}
1124
      } else if (FD_ISSET(game_server_fd,&read_set))
1124
      } else if (FD_ISSET(game_server_fd,&read_set))
1125
      {
1125
      {
1126
	uchar cmd;
1126
	uint8_t cmd;
1127
	if (read(game_server_fd,&cmd,1)!=1) { mdie("unable to read command from server"); }
1127
	if (read(game_server_fd,&cmd,1)!=1) { mdie("unable to read command from server"); }
1128
	switch (cmd)
1128
	switch (cmd)
1129
	{
1129
	{
Lines 1133-1139 Link Here
1133
	  } break;
1133
	  } break;
1134
	  case CLCMD_REQUEST_RESEND :
1134
	  case CLCMD_REQUEST_RESEND :
1135
	  {
1135
	  {
1136
	    uchar tick;
1136
	    uint8_t tick;
1137
	    if (read(game_server_fd,&tick,1)!=1) { mdie("unable to read resend tick from server"); }
1137
	    if (read(game_server_fd,&tick,1)!=1) { mdie("unable to read resend tick from server"); }
1138
1138
1139
	    fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
1139
	    fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
(-)abuse-sdl-0.7.0.orig/src/net/gclient.cpp (-7 / +7 lines)
Lines 23-35 Link Here
23
23
24
int game_client::process_server_command()
24
int game_client::process_server_command()
25
{
25
{
26
  uchar cmd;
26
  uint8_t cmd;
27
  if (client_sock->read(&cmd,1)!=1) return 0;
27
  if (client_sock->read(&cmd,1)!=1) return 0;
28
  switch (cmd)
28
  switch (cmd)
29
  {
29
  {
30
    case CLCMD_REQUEST_RESEND :
30
    case CLCMD_REQUEST_RESEND :
31
    {
31
    {
32
      uchar tick;
32
      uint8_t tick;
33
      if (client_sock->read(&tick,1)!=1) return 0;
33
      if (client_sock->read(&tick,1)!=1) return 0;
34
34
35
      fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
35
      fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
Lines 37-43 Link Here
37
37
38
      if (tick==base->packet.tick_received() && !wait_local_input)    // asking for this tick?  make sure is collected
38
      if (tick==base->packet.tick_received() && !wait_local_input)    // asking for this tick?  make sure is collected
39
      {
39
      {
40
	fprintf(stderr,"resending client packet %d to server\n");
40
	fprintf(stderr,"resending client packet %d to server\n",base->packet.tick_received());
41
	net_packet *pack=&base->packet;
41
	net_packet *pack=&base->packet;
42
	game_sock->write(pack->data,pack->packet_size()+pack->packet_prefix_size(),server_data_port); 
42
	game_sock->write(pack->data,pack->packet_size()+pack->packet_prefix_size(),server_data_port); 
43
43
Lines 66-72 Link Here
66
    int bytes_received=game_sock->read(tmp.data,PACKET_MAX_SIZE);
66
    int bytes_received=game_sock->read(tmp.data,PACKET_MAX_SIZE);
67
    if (bytes_received==tmp.packet_size()+tmp.packet_prefix_size())   // was the packet complete?
67
    if (bytes_received==tmp.packet_size()+tmp.packet_prefix_size())   // was the packet complete?
68
    {
68
    {
69
      unsigned short rec_crc=tmp.get_checksum();
69
      uint16_t rec_crc=tmp.get_checksum();
70
      if (rec_crc==tmp.calc_checksum())
70
      if (rec_crc==tmp.calc_checksum())
71
      {
71
      {
72
	if (base->current_tick==tmp.tick_received())  
72
	if (base->current_tick==tmp.tick_received())  
Lines 140-153 Link Here
140
140
141
int game_client::end_reload(int disconnect)  // notify evryone you've reloaded the level (at server request)
141
int game_client::end_reload(int disconnect)  // notify evryone you've reloaded the level (at server request)
142
{
142
{
143
  uchar cmd=CLCMD_RELOAD_END;
143
  uint8_t cmd=CLCMD_RELOAD_END;
144
  if (client_sock->write(&cmd,1)!=1) return 0;
144
  if (client_sock->write(&cmd,1)!=1) return 0;
145
  return 1;
145
  return 1;
146
}
146
}
147
147
148
int game_client::start_reload()
148
int game_client::start_reload()
149
{
149
{
150
  uchar cmd=CLCMD_RELOAD_START;
150
  uint8_t cmd=CLCMD_RELOAD_START;
151
  if (client_sock->write(&cmd,1)!=1) return 0;
151
  if (client_sock->write(&cmd,1)!=1) return 0;
152
  if (client_sock->read(&cmd,1)!=1) return 0;
152
  if (client_sock->read(&cmd,1)!=1) return 0;
153
  return 1;
153
  return 1;
Lines 165-171 Link Here
165
165
166
int game_client::quit()
166
int game_client::quit()
167
{
167
{
168
  uchar cmd=CLCMD_UNJOIN;
168
  uint8_t cmd=CLCMD_UNJOIN;
169
  if (client_sock->write(&cmd,1)!=1) return 0;
169
  if (client_sock->write(&cmd,1)!=1) return 0;
170
  if (client_sock->read(&cmd,1)!=1) return 0;
170
  if (client_sock->read(&cmd,1)!=1) return 0;
171
  return 1;
171
  return 1;
(-)abuse-sdl-0.7.0.orig/src/net/netfile.cpp (-27 / +27 lines)
Lines 100-107 Link Here
100
    if (FD_ISSET(socket_fd,&write_check))            // ready to write?
100
    if (FD_ISSET(socket_fd,&write_check))            // ready to write?
101
    {
101
    {
102
      char buf[READ_PACKET_SIZE];   
102
      char buf[READ_PACKET_SIZE];   
103
      short read_total;
103
      int16_t read_total;
104
      short actual;
104
      int16_t actual;
105
105
106
      do
106
      do
107
      {      
107
      {      
Lines 159-165 Link Here
159
  {
159
  {
160
    case NFCMD_READ :
160
    case NFCMD_READ :
161
    {
161
    {
162
      long size;
162
      int32_t size;
163
      if (read(c->socket_fd,&size,sizeof(size))!=sizeof(size)) return 0;
163
      if (read(c->socket_fd,&size,sizeof(size))!=sizeof(size)) return 0;
164
      size=lltl(size);
164
      size=lltl(size);
165
165
Lines 172-178 Link Here
172
    } break;
172
    } break;
173
    case NFCMD_SEEK :
173
    case NFCMD_SEEK :
174
    {
174
    {
175
      long offset;
175
      int32_t offset;
176
      if (read(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
176
      if (read(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
177
      offset=lltl(offset);
177
      offset=lltl(offset);
178
      offset=lseek(c->file_fd,offset,0);
178
      offset=lseek(c->file_fd,offset,0);
Lines 182-188 Link Here
182
    } break;
182
    } break;
183
    case NFCMD_TELL :
183
    case NFCMD_TELL :
184
    {
184
    {
185
      long offset=lseek(c->file_fd,0,SEEK_CUR);
185
      int32_t offset=lseek(c->file_fd,0,SEEK_CUR);
186
      offset=lltl(offset);
186
      offset=lltl(offset);
187
      if (write(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
187
      if (write(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
188
      return 1;
188
      return 1;
Lines 199-205 Link Here
199
199
200
void add_nfs_client(int fd)
200
void add_nfs_client(int fd)
201
{
201
{
202
  uchar size[2];
202
  uint8_t size[2];
203
  char filename[300],mode[20],*mp;
203
  char filename[300],mode[20],*mp;
204
  if (read(fd,size,2)!=2) { close(fd); return ; }
204
  if (read(fd,size,2)!=2) { close(fd); return ; }
205
  if (read(fd,filename,size[0])!=size[0]) { close(fd); return ; }
205
  if (read(fd,filename,size[0])!=size[0]) { close(fd); return ; }
Lines 228-242 Link Here
228
    f=-1;  // make sure this is -1
228
    f=-1;  // make sure this is -1
229
  }
229
  }
230
230
231
  long ret=lltl(f);
231
  int32_t ret=lltl(f);
232
  if (write(fd,&ret,sizeof(ret))!=sizeof(ret)) { close(fd); return ; }
232
  if (write(fd,&ret,sizeof(ret))!=sizeof(ret)) { close(fd); return ; }
233
233
234
  if (f<0)    // no file, sorry
234
  if (f<0)    // no file, sorry
235
    close(fd);
235
    close(fd);
236
  else
236
  else
237
  {
237
  {
238
    long cur_pos=lseek(f,0,SEEK_CUR);
238
    int32_t cur_pos=lseek(f,0,SEEK_CUR);
239
    long size=lseek(f,0,SEEK_END);
239
    int32_t size=lseek(f,0,SEEK_END);
240
    lseek(f,cur_pos,SEEK_SET);
240
    lseek(f,cur_pos,SEEK_SET);
241
    size=lltl(size);
241
    size=lltl(size);
242
    if (write(fd,&size,sizeof(size))!=sizeof(size)) {  close(f); close(fd); return ; }
242
    if (write(fd,&size,sizeof(size))!=sizeof(size)) {  close(f); close(fd); return ; }
Lines 252-258 Link Here
252
    fprintf(stderr,"remote_file : %s\n",reason);
252
    fprintf(stderr,"remote_file : %s\n",reason);
253
  if (socket_fd>=0) 
253
  if (socket_fd>=0) 
254
  {
254
  {
255
    uchar cmd=NFCMD_CLOSE;
255
    uint8_t cmd=NFCMD_CLOSE;
256
    write(socket_fd,&cmd,1);
256
    write(socket_fd,&cmd,1);
257
    close(socket_fd); 
257
    close(socket_fd); 
258
  }
258
  }
Lines 271-291 Link Here
271
    return ;
271
    return ;
272
  }
272
  }
273
273
274
  uchar sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
274
  uint8_t sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
275
  if (write(socket_fd,sizes,3)!=3) { r_close("could not send open info"); return ; }
275
  if (write(socket_fd,sizes,3)!=3) { r_close("could not send open info"); return ; }
276
  if (write(socket_fd,filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
276
  if (write(socket_fd,filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
277
  if (write(socket_fd,mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
277
  if (write(socket_fd,mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
278
278
279
  long remote_file_fd;
279
  int32_t remote_file_fd;
280
  if (read(socket_fd,&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd)) 
280
  if (read(socket_fd,&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd)) 
281
  { r_close("could not read remote fd"); return ; }   
281
  { r_close("could not read remote fd"); return ; }   
282
  remote_file_fd=lltl(remote_file_fd);
282
  remote_file_fd=lltl(remote_file_fd);
283
  if (remote_file_fd<0) { r_close("remote fd is bad"); return ; }
283
  if (remote_file_fd<0) { r_close("remote fd is bad"); return ; }
284
284
285
  if (read(socket_fd,&size,sizeof(size))!=sizeof(size)) { r_close("could not read remote filesize"); return ; } 
285
  if (read(socket_fd,&size,sizeof(size))!=sizeof(size)) { r_close("could not read remote filesize"); return ; } 
286
//  ulong remote_crc;
286
//  uint32_t remote_crc;
287
//  if (read(socket_fd,&remote_crc,sizeof(remote_crc))!=sizeof(remote_crc)) { r_close("could not read remote checksum"); return ; }
287
//  if (read(socket_fd,&remote_crc,sizeof(remote_crc))!=sizeof(remote_crc)) { r_close("could not read remote checksum"); return ; }
288
//  ulong local_crc=
288
//  uint32_t local_crc=
289
289
290
  size=lltl(size);
290
  size=lltl(size);
291
}
291
}
Lines 294-310 Link Here
294
{
294
{
295
  if (socket_fd>=0 && count)
295
  if (socket_fd>=0 && count)
296
  {
296
  {
297
    uchar cmd=NFCMD_READ;
297
    uint8_t cmd=NFCMD_READ;
298
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
298
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
299
299
300
    long rsize=lltl(count);
300
    int32_t rsize=lltl(count);
301
    if (write(socket_fd,&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
301
    if (write(socket_fd,&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
302
302
303
    long total_read=0,total;
303
    int32_t total_read=0,total;
304
    char buf[READ_PACKET_SIZE];
304
    char buf[READ_PACKET_SIZE];
305
    ushort size;
305
    uint16_t size;
306
306
307
    ushort packet_size;    
307
    uint16_t packet_size;    
308
    do
308
    do
309
    {
309
    {
310
      if (read(socket_fd,&packet_size,sizeof(packet_size))!=sizeof(packet_size)) 
310
      if (read(socket_fd,&packet_size,sizeof(packet_size))!=sizeof(packet_size)) 
Lines 314-320 Link Here
314
      }
314
      }
315
      packet_size=lstl(packet_size);
315
      packet_size=lstl(packet_size);
316
316
317
      ushort size_read=read(socket_fd,buf+2,packet_size);   
317
      uint16_t size_read=read(socket_fd,buf+2,packet_size);   
318
318
319
      if (size_read!=packet_size) 
319
      if (size_read!=packet_size) 
320
      { 
320
      { 
Lines 325-331 Link Here
325
	}
325
	}
326
      }
326
      }
327
327
328
      *((short *)buf)=packet_size;
328
      *((int16_t *)buf)=packet_size;
329
      if (write(out_fd,buf,packet_size+2)!=packet_size+2) comm_failed();
329
      if (write(out_fd,buf,packet_size+2)!=packet_size+2) comm_failed();
330
330
331
      total_read+=packet_size;
331
      total_read+=packet_size;
Lines 340-363 Link Here
340
{
340
{
341
  if (socket_fd>=0)
341
  if (socket_fd>=0)
342
  {
342
  {
343
    uchar cmd=NFCMD_TELL;
343
    uint8_t cmd=NFCMD_TELL;
344
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
344
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
345
345
346
    long offset;
346
    int32_t offset;
347
    if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }    
347
    if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }    
348
    return lltl(offset);
348
    return lltl(offset);
349
  }    
349
  }    
350
  return 0;
350
  return 0;
351
}
351
}
352
352
353
int remote_file::unbuffered_seek(long offset)  // tell server to seek to a spot in a file
353
int remote_file::unbuffered_seek(int32_t offset)  // tell server to seek to a spot in a file
354
{
354
{
355
  if (socket_fd>=0)
355
  if (socket_fd>=0)
356
  {
356
  {
357
    uchar cmd=NFCMD_SEEK;
357
    uint8_t cmd=NFCMD_SEEK;
358
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
358
    if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
359
359
360
    long off=lltl(offset);
360
    int32_t off=lltl(offset);
361
    if (write(socket_fd,&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
361
    if (write(socket_fd,&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
362
362
363
    if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }    
363
    if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }    
Lines 449-455 Link Here
449
    return 0;
449
    return 0;
450
  }
450
  }
451
451
452
  uchar cmd=CLIENT_CRC_WAITER;
452
  uint8_t cmd=CLIENT_CRC_WAITER;
453
  if (write(socket_fd,&cmd,1)!=1)  { close(socket_fd); return 0; }
453
  if (write(socket_fd,&cmd,1)!=1)  { close(socket_fd); return 0; }
454
  if (read(socket_fd,&cmd,1)!=1)  { close(socket_fd); return 0; }
454
  if (read(socket_fd,&cmd,1)!=1)  { close(socket_fd); return 0; }
455
  close(socket_fd);
455
  close(socket_fd);
(-)abuse-sdl-0.7.0.orig/src/net/fileman.cpp (-21 / +21 lines)
Lines 80-86 Link Here
80
  {
80
  {
81
    case NFCMD_READ :
81
    case NFCMD_READ :
82
    {
82
    {
83
      long size;
83
      int32_t size;
84
      if (c->sock->read(&size,sizeof(size))!=sizeof(size)) return 0;
84
      if (c->sock->read(&size,sizeof(size))!=sizeof(size)) return 0;
85
      size=lltl(size);
85
      size=lltl(size);
86
86
Lines 93-99 Link Here
93
    } break;
93
    } break;
94
    case NFCMD_SEEK :
94
    case NFCMD_SEEK :
95
    {
95
    {
96
      long offset;
96
      int32_t offset;
97
      if (c->sock->read(&offset,sizeof(offset))!=sizeof(offset)) return 0;
97
      if (c->sock->read(&offset,sizeof(offset))!=sizeof(offset)) return 0;
98
      offset=lltl(offset);
98
      offset=lltl(offset);
99
      offset=lseek(c->file_fd,offset,0);
99
      offset=lseek(c->file_fd,offset,0);
Lines 103-109 Link Here
103
    } break;
103
    } break;
104
    case NFCMD_TELL :
104
    case NFCMD_TELL :
105
    {
105
    {
106
      long offset=lseek(c->file_fd,0,SEEK_CUR);
106
      int32_t offset=lseek(c->file_fd,0,SEEK_CUR);
107
      offset=lltl(offset);
107
      offset=lltl(offset);
108
      if (c->sock->write(&offset,sizeof(offset))!=sizeof(offset)) return 0;
108
      if (c->sock->write(&offset,sizeof(offset))!=sizeof(offset)) return 0;
109
      return 1;
109
      return 1;
Lines 214-220 Link Here
214
214
215
void file_manager::add_nfs_client(net_socket *sock)
215
void file_manager::add_nfs_client(net_socket *sock)
216
{
216
{
217
  uchar size[2];
217
  uint8_t size[2];
218
  char filename[300],mode[20],*mp;
218
  char filename[300],mode[20],*mp;
219
  if (sock->read(size,2)!=2) { delete sock; return ; }
219
  if (sock->read(size,2)!=2) { delete sock; return ; }
220
  if (sock->read(filename,size[0])!=size[0]) { delete sock; return ; }
220
  if (sock->read(filename,size[0])!=size[0]) { delete sock; return ; }
Lines 248-262 Link Here
248
    f=-1;  // make sure this is -1
248
    f=-1;  // make sure this is -1
249
249
250
250
251
  long ret=lltl(f);
251
  int32_t ret=lltl(f);
252
  if (sock->write(&ret,sizeof(ret))!=sizeof(ret)) { delete sock; return ; }
252
  if (sock->write(&ret,sizeof(ret))!=sizeof(ret)) { delete sock; return ; }
253
253
254
  if (f<0)    // no file, sorry
254
  if (f<0)    // no file, sorry
255
    delete sock;
255
    delete sock;
256
  else
256
  else
257
  {
257
  {
258
    long cur_pos=lseek(f,0,SEEK_CUR);
258
    int32_t cur_pos=lseek(f,0,SEEK_CUR);
259
    long size=lseek(f,0,SEEK_END);
259
    int32_t size=lseek(f,0,SEEK_END);
260
    lseek(f,cur_pos,SEEK_SET);
260
    lseek(f,cur_pos,SEEK_SET);
261
    size=lltl(size);
261
    size=lltl(size);
262
    if (sock->write(&size,sizeof(size))!=sizeof(size)) {  close(f); delete sock; sock=NULL; return ; }
262
    if (sock->write(&size,sizeof(size))!=sizeof(size)) {  close(f); delete sock; sock=NULL; return ; }
Lines 285-296 Link Here
285
  next=Next;
285
  next=Next;
286
  open_local=0;
286
  open_local=0;
287
287
288
  uchar sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
288
  uint8_t sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
289
  if (sock->write(sizes,3)!=3) { r_close("could not send open info"); return ; }
289
  if (sock->write(sizes,3)!=3) { r_close("could not send open info"); return ; }
290
  if (sock->write(filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
290
  if (sock->write(filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
291
  if (sock->write(mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
291
  if (sock->write(mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
292
292
293
  long remote_file_fd;
293
  int32_t remote_file_fd;
294
  if (sock->read(&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd)) 
294
  if (sock->read(&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd)) 
295
  { r_close("could not read remote fd"); return ; }   
295
  { r_close("could not read remote fd"); return ; }   
296
  remote_file_fd=lltl(remote_file_fd);
296
  remote_file_fd=lltl(remote_file_fd);
Lines 305-317 Link Here
305
{
305
{
306
  if (sock && count)
306
  if (sock && count)
307
  {
307
  {
308
    uchar cmd=NFCMD_READ;
308
    uint8_t cmd=NFCMD_READ;
309
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
309
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
310
310
311
    long rsize=lltl(count);
311
    int32_t rsize=lltl(count);
312
    if (sock->write(&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
312
    if (sock->write(&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
313
313
314
    long total_read=0;
314
    int32_t total_read=0;
315
    char buf[READ_PACKET_SIZE];
315
    char buf[READ_PACKET_SIZE];
316
316
317
    ushort packet_size;
317
    ushort packet_size;
Lines 347-374 Link Here
347
  return 0;
347
  return 0;
348
}
348
}
349
349
350
long file_manager::remote_file::unbuffered_tell()   // ask server where the offset of the file pointer is
350
int32_t file_manager::remote_file::unbuffered_tell()   // ask server where the offset of the file pointer is
351
{
351
{
352
  if (sock)
352
  if (sock)
353
  {
353
  {
354
    uchar cmd=NFCMD_TELL;
354
    uint8_t cmd=NFCMD_TELL;
355
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
355
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
356
356
357
    long offset;
357
    int32_t offset;
358
    if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }    
358
    if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }    
359
    return lltl(offset);
359
    return lltl(offset);
360
  }    
360
  }    
361
  return 0;
361
  return 0;
362
}
362
}
363
363
364
long file_manager::remote_file::unbuffered_seek(long offset)  // tell server to seek to a spot in a file
364
int32_t file_manager::remote_file::unbuffered_seek(int32_t offset)  // tell server to seek to a spot in a file
365
{
365
{
366
  if (sock)
366
  if (sock)
367
  {
367
  {
368
    uchar cmd=NFCMD_SEEK;
368
    uint8_t cmd=NFCMD_SEEK;
369
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
369
    if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
370
370
371
    long off=lltl(offset);
371
    int32_t off=lltl(offset);
372
    if (sock->write(&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
372
    if (sock->write(&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
373
373
374
    if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }    
374
    if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }    
Lines 465-478 Link Here
465
}
465
}
466
466
467
467
468
long file_manager::rf_tell(int fd)
468
int32_t file_manager::rf_tell(int fd)
469
{
469
{
470
  remote_file *rf=find_rf(fd);
470
  remote_file *rf=find_rf(fd);
471
  if (rf) return rf->unbuffered_tell();
471
  if (rf) return rf->unbuffered_tell();
472
  else return 0;
472
  else return 0;
473
}
473
}
474
474
475
long file_manager::rf_seek(int fd, long offset)
475
int32_t file_manager::rf_seek(int fd, int32_t offset)
476
{
476
{
477
  remote_file *rf=find_rf(fd);
477
  remote_file *rf=find_rf(fd);
478
  if (rf) return rf->unbuffered_seek(offset);
478
  if (rf) return rf->unbuffered_seek(offset);
Lines 503-509 Link Here
503
  }  
503
  }  
504
}
504
}
505
505
506
long file_manager::rf_file_size(int fd)
506
int32_t file_manager::rf_file_size(int fd)
507
{
507
{
508
  remote_file *rf=find_rf(fd);
508
  remote_file *rf=find_rf(fd);
509
  if (rf) return rf->file_size();
509
  if (rf) return rf->file_size();
(-)abuse-sdl-0.7.0.orig/src/net/gserver.cpp (-13 / +13 lines)
Lines 109-116 Link Here
109
    {
109
    {
110
      if (c->delete_me())
110
      if (c->delete_me())
111
      {
111
      {
112
	base->packet.write_byte(SCMD_DELETE_CLIENT);
112
	base->packet.write_uint8(SCMD_DELETE_CLIENT);
113
	base->packet.write_byte(c->client_id);
113
	base->packet.write_uint8(c->client_id);
114
	if (c->wait_reload())
114
	if (c->wait_reload())
115
	{
115
	{
116
	  c->set_wait_reload(0);
116
	  c->set_wait_reload(0);
Lines 179-191 Link Here
179
179
180
int game_server::process_client_command(player_client *c)
180
int game_server::process_client_command(player_client *c)
181
{
181
{
182
  uchar cmd;
182
  uint8_t cmd;
183
  if (c->comm->read(&cmd,1)!=1) return 0;
183
  if (c->comm->read(&cmd,1)!=1) return 0;
184
  switch (cmd)
184
  switch (cmd)
185
  {
185
  {
186
    case CLCMD_REQUEST_RESEND :
186
    case CLCMD_REQUEST_RESEND :
187
    {
187
    {
188
      uchar tick;
188
      uint8_t tick;
189
      if (c->comm->read(&tick,1)!=1) return 0;
189
      if (c->comm->read(&tick,1)!=1) return 0;
190
190
191
      fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
191
      fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
Lines 243-249 Link Here
243
      // make sure we got a complete packet and the packet was not a previous game tick packet
243
      // make sure we got a complete packet and the packet was not a previous game tick packet
244
      if (bytes_received==use->packet_size()+use->packet_prefix_size())
244
      if (bytes_received==use->packet_size()+use->packet_prefix_size())
245
      {
245
      {
246
	unsigned short rec_crc=use->get_checksum();
246
	uint16_t rec_crc=use->get_checksum();
247
	if (rec_crc==use->calc_checksum())
247
	if (rec_crc==use->calc_checksum())
248
	{
248
	{
249
	  player_client *f=player_list,*found=NULL;
249
	  player_client *f=player_list,*found=NULL;
Lines 350-356 Link Here
350
  {
350
  {
351
    if (!c->delete_me() && c->need_reload_start_ok())    // if the client is already waiting for reload state to start, send ok
351
    if (!c->delete_me() && c->need_reload_start_ok())    // if the client is already waiting for reload state to start, send ok
352
    {
352
    {
353
      uchar cmd=CLCMD_RELOAD_START;
353
      uint8_t cmd=CLCMD_RELOAD_START;
354
      if (c->comm->write(&cmd,1)!=1) { c->set_delete_me(1); }
354
      if (c->comm->write(&cmd,1)!=1) { c->set_delete_me(1); }
355
      c->set_need_reload_start_ok(0);
355
      c->set_need_reload_start_ok(0);
356
    }
356
    }
Lines 374-392 Link Here
374
	{
374
	{
375
		if( total_players() >= main_net_cfg->max_players )
375
		if( total_players() >= main_net_cfg->max_players )
376
		{
376
		{
377
			uchar too_many = 2;
377
			uint8_t too_many = 2;
378
			sock->write( &too_many, 1 );
378
			sock->write( &too_many, 1 );
379
			return 0;
379
			return 0;
380
		}
380
		}
381
381
382
		uchar reg = registered ? 1 : 0;
382
		uint8_t reg = registered ? 1 : 0;
383
		if( sock->write( &reg, 1 ) != 1 )
383
		if( sock->write( &reg, 1 ) != 1 )
384
			return 0;
384
			return 0;
385
385
386
		ushort our_port = lstl( main_net_cfg->port + 1 ), cport;
386
		uint16_t our_port = lstl( main_net_cfg->port + 1 ), cport;
387
		char name[256];
387
		char name[256];
388
		uchar len;
388
		uint8_t len;
389
		short nkills=lstl(main_net_cfg->kills);
389
		int16_t nkills=lstl(main_net_cfg->kills);
390
390
391
		if( sock->read(&len,1)!=1 ||
391
		if( sock->read(&len,1)!=1 ||
392
			sock->read(name,len)!=len ||
392
			sock->read(name,len)!=len ||
Lines 419-425 Link Here
419
419
420
		from->set_port( cport );
420
		from->set_port( cport );
421
421
422
		ushort client_id = lstl( f );
422
		uint16_t client_id = lstl( f );
423
		if( sock->write( &client_id, 2 ) != 2 )
423
		if( sock->write( &client_id, 2 ) != 2 )
424
		{
424
		{
425
			return 0;
425
			return 0;
Lines 457-463 Link Here
457
  {
457
  {
458
    player_client *d=c;
458
    player_client *d=c;
459
    c=c->next;
459
    c=c->next;
460
    delete c;
460
    delete d;
461
  }
461
  }
462
  player_list=NULL;
462
  player_list=NULL;
463
  return 1;
463
  return 1;
(-)abuse-sdl-0.7.0.orig/src/old_server.cpp (-88 / +88 lines)
Lines 48-54 Link Here
48
  if (f->connect)
48
  if (f->connect)
49
  {
49
  {
50
    packet pk;
50
    packet pk;
51
    uchar cmd=SCMD_QUIT;    // send quit command to server
51
    uint8_t cmd=SCMD_QUIT;    // send quit command to server
52
    pk.write(&cmd,1);
52
    pk.write(&cmd,1);
53
    send_pkt(f->connect,pk);
53
    send_pkt(f->connect,pk);
54
    delete f->connect;
54
    delete f->connect;
Lines 156-164 Link Here
156
  collect_inputs();
156
  collect_inputs();
157
}
157
}
158
158
159
ulong make_sync_long()
159
uint32_t make_sync_uint32()
160
{
160
{
161
  ulong x=0;
161
  uint32_t x=0;
162
  for (view *v=player_list;v;v=v->next)
162
  for (view *v=player_list;v;v=v->next)
163
  {
163
  {
164
    x^=v->focus->x;
164
    x^=v->focus->x;
Lines 167-173 Link Here
167
  return x^rand_on;
167
  return x^rand_on;
168
}
168
}
169
169
170
int server::process_command(view *f, uchar command, packet &pk)
170
int server::process_command(view *f, uint8_t command, packet &pk)
171
{
171
{
172
  switch (command)
172
  switch (command)
173
  {
173
  {
Lines 179-186 Link Here
179
179
180
    case SCMD_VIEW_RESIZE :                          // change view area
180
    case SCMD_VIEW_RESIZE :                          // change view area
181
    {
181
    {
182
      ulong view_size[8];          
182
      uint32_t view_size[8];          
183
      if (pk.read((uchar *)view_size,8*4)!=8*4)
183
      if (pk.read((uint8_t *)view_size,8*4)!=8*4)
184
      return 0;
184
      return 0;
185
      else
185
      else
186
      {
186
      {
Lines 192-210 Link Here
192
	f->suggest.send_view=0;
192
	f->suggest.send_view=0;
193
	if (is_server)                  // if we are a server, tell everybody about this.
193
	if (is_server)                  // if we are a server, tell everybody about this.
194
	{
194
	{
195
	  uchar cmd=SCMD_VIEW_RESIZE;
195
	  uint8_t cmd=SCMD_VIEW_RESIZE;
196
	  next_out.write((uchar *)&cmd,1);
196
	  next_out.write((uint8_t *)&cmd,1);
197
	  ushort pn=lstl(f->player_number);
197
	  uint16_t pn=lstl(f->player_number);
198
	  next_out.write((uchar *)&pn,2);
198
	  next_out.write((uint8_t *)&pn,2);
199
	  next_out.write((uchar *)view_size,8*4);
199
	  next_out.write((uint8_t *)view_size,8*4);
200
	}
200
	}
201
      }	      
201
      }	      
202
    } break;
202
    } break;
203
203
204
    case SCMD_WEAPON_CHANGE :                          // change weapon
204
    case SCMD_WEAPON_CHANGE :                          // change weapon
205
    {
205
    {
206
      ulong new_weap;
206
      uint32_t new_weap;
207
      if (pk.read((uchar *)&new_weap,4)!=4)
207
      if (pk.read((uint8_t *)&new_weap,4)!=4)
208
        return 0;
208
        return 0;
209
      else
209
      else
210
      {
210
      {
Lines 212-222 Link Here
212
	f->suggest.send_weapon_change=0;
212
	f->suggest.send_weapon_change=0;
213
	if (is_server)                      // if we are a server, tell everybody about this.
213
	if (is_server)                      // if we are a server, tell everybody about this.
214
	{
214
	{
215
	  uchar cmd=SCMD_WEAPON_CHANGE;
215
	  uint8_t cmd=SCMD_WEAPON_CHANGE;
216
	  next_out.write((uchar *)&cmd,1);
216
	  next_out.write((uint8_t *)&cmd,1);
217
	  ushort pn=lstl(f->player_number);
217
	  uint16_t pn=lstl(f->player_number);
218
	  next_out.write((uchar *)&pn,2);
218
	  next_out.write((uint8_t *)&pn,2);
219
	  next_out.write((uchar *)&new_weap,4);
219
	  next_out.write((uint8_t *)&new_weap,4);
220
	}
220
	}
221
      }	      
221
      }	      
222
    } break;
222
    } break;
Lines 225-231 Link Here
225
    case SCMD_SET_INPUT :                        // set the input from this player
225
    case SCMD_SET_INPUT :                        // set the input from this player
226
    {
226
    {
227
      signed char inp[5];
227
      signed char inp[5];
228
      if (pk.read((uchar *)inp,5)!=5)
228
      if (pk.read((uint8_t *)inp,5)!=5)
229
        return 0;
229
        return 0;
230
      else		
230
      else		
231
        f->set_input(inp[0],inp[1],inp[2],inp[3],inp[4]);		
231
        f->set_input(inp[0],inp[1],inp[2],inp[3],inp[4]);		
Lines 243-254 Link Here
243
    } break;
243
    } break;
244
    case SCMD_SYNC :
244
    case SCMD_SYNC :
245
    {
245
    {
246
      ulong x;
246
      uint32_t x;
247
      if (pk.read((uchar *)&x,4)!=4)
247
      if (pk.read((uint8_t *)&x,4)!=4)
248
        return 0;
248
        return 0;
249
      else 
249
      else 
250
      {
250
      {
251
	ulong s=make_sync_long();
251
	uint32_t s=make_sync_uint32();
252
	if (lltl(x)!=s)
252
	if (lltl(x)!=s)
253
	  printf("Out of sync, %x!=%x\n",lltl(x),s);
253
	  printf("Out of sync, %x!=%x\n",lltl(x),s);
254
	return 1;
254
	return 1;
Lines 265-282 Link Here
265
{
265
{
266
  if (f->view_changed())
266
  if (f->view_changed())
267
  {
267
  {
268
    uchar cmd=SCMD_VIEW_RESIZE;
268
    uint8_t cmd=SCMD_VIEW_RESIZE;
269
    pk.write(&cmd,1);
269
    pk.write(&cmd,1);
270
    if (number)
270
    if (number)
271
    {
271
    {
272
      ushort pn=lstl(f->player_number);
272
      uint16_t pn=lstl(f->player_number);
273
      pk.write((uchar *)&pn,2);
273
      pk.write((uint8_t *)&pn,2);
274
      dprintf("Server : %s resized view %d %d %d %d\n",f->name,
274
      dprintf("Server : %s resized view %d %d %d %d\n",f->name,
275
	      f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
275
	      f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
276
      f->resize_view(f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
276
      f->resize_view(f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
277
      f->suggest.send_view=0;
277
      f->suggest.send_view=0;
278
    } else dprintf("sending resize to server\n");
278
    } else dprintf("sending resize to server\n");
279
    ulong view_size[8];          	  
279
    uint32_t view_size[8];          	  
280
    view_size[0]=lltl(f->suggest.cx1);
280
    view_size[0]=lltl(f->suggest.cx1);
281
    view_size[1]=lltl(f->suggest.cy1);
281
    view_size[1]=lltl(f->suggest.cy1);
282
    view_size[2]=lltl(f->suggest.cx2);
282
    view_size[2]=lltl(f->suggest.cx2);
Lines 285-307 Link Here
285
    view_size[5]=lltl(f->suggest.pan_y);
285
    view_size[5]=lltl(f->suggest.pan_y);
286
    view_size[6]=lltl(f->suggest.shift_down);
286
    view_size[6]=lltl(f->suggest.shift_down);
287
    view_size[7]=lltl(f->suggest.shift_right);
287
    view_size[7]=lltl(f->suggest.shift_right);
288
    pk.write((uchar *)view_size,8*4);
288
    pk.write((uint8_t *)view_size,8*4);
289
  }
289
  }
290
290
291
  if (f->weapon_changed())
291
  if (f->weapon_changed())
292
  {
292
  {
293
    uchar cmd=SCMD_WEAPON_CHANGE;
293
    uint8_t cmd=SCMD_WEAPON_CHANGE;
294
    pk.write(&cmd,1);
294
    pk.write(&cmd,1);
295
    if (number)
295
    if (number)
296
    {
296
    {
297
      ushort pn=lstl(f->player_number);
297
      uint16_t pn=lstl(f->player_number);
298
      pk.write((uchar *)&pn,2);
298
      pk.write((uint8_t *)&pn,2);
299
      dprintf("Server : %s change weapon to %d\n",f->name,f->suggest.new_weapon);
299
      dprintf("Server : %s change weapon to %d\n",f->name,f->suggest.new_weapon);
300
      f->current_weapon=f->suggest.new_weapon;
300
      f->current_weapon=f->suggest.new_weapon;
301
      f->suggest.send_weapon_change=0;
301
      f->suggest.send_weapon_change=0;
302
    } else dprintf("sending resize to server\n");
302
    } else dprintf("sending resize to server\n");
303
    ulong nw=lltl(f->suggest.new_weapon);
303
    uint32_t nw=lltl(f->suggest.new_weapon);
304
    pk.write((uchar *)&nw,4);
304
    pk.write((uint8_t *)&nw,4);
305
  }
305
  }
306
}
306
}
307
307
Lines 316-322 Link Here
316
  inp[3]=f->b1_suggestion;
316
  inp[3]=f->b1_suggestion;
317
  inp[4]=f->b2_suggestion;
317
  inp[4]=f->b2_suggestion;
318
  inp[5]=f->b3_suggestion;
318
  inp[5]=f->b3_suggestion;
319
  if (pk.write((uchar *)inp,6)!=6)
319
  if (pk.write((uint8_t *)inp,6)!=6)
320
    return 0;
320
    return 0;
321
  if (!send_pkt(f->connect,pk))
321
  if (!send_pkt(f->connect,pk))
322
    return 0;
322
    return 0;
Lines 339-346 Link Here
339
	{
339
	{
340
	  while (!pk.eop())
340
	  while (!pk.eop())
341
	  {
341
	  {
342
	    uchar cmd;
342
	    uint8_t cmd;
343
	    if (pk.read((uchar *)&cmd,1)==1)
343
	    if (pk.read((uint8_t *)&cmd,1)==1)
344
	      if (!process_command(f,cmd,pk))
344
	      if (!process_command(f,cmd,pk))
345
	      { remove_player(f); f=NULL; }
345
	      { remove_player(f); f=NULL; }
346
	  }
346
	  }
Lines 397-405 Link Here
397
  for (view *f=player_list;f;f=f->next)
397
  for (view *f=player_list;f;f=f->next)
398
  {   
398
  {   
399
    cmd=SCMD_SET_INPUT;
399
    cmd=SCMD_SET_INPUT;
400
    next_out.write((uchar *)&cmd,1);
400
    next_out.write((uint8_t *)&cmd,1);
401
    ushort pn=lstl(f->player_number);
401
    uint16_t pn=lstl(f->player_number);
402
    next_out.write((uchar *)&pn,2);
402
    next_out.write((uint8_t *)&pn,2);
403
403
404
    signed char inp[5];
404
    signed char inp[5];
405
    inp[0]=f->x_suggestion;
405
    inp[0]=f->x_suggestion;
Lines 407-421 Link Here
407
    inp[2]=f->b1_suggestion;
407
    inp[2]=f->b1_suggestion;
408
    inp[3]=f->b2_suggestion;
408
    inp[3]=f->b2_suggestion;
409
    inp[4]=f->b3_suggestion;
409
    inp[4]=f->b3_suggestion;
410
    next_out.write((uchar *)inp,5);
410
    next_out.write((uint8_t *)inp,5);
411
  }
411
  }
412
412
413
  if (sync_check)
413
  if (sync_check)
414
  {
414
  {
415
    cmd=SCMD_SYNC;
415
    cmd=SCMD_SYNC;
416
    ulong x=lltl(make_sync_long());
416
    uint32_t x=lltl(make_sync_uint32());
417
    next_out.write((uchar *)&cmd,1);  
417
    next_out.write((uint8_t *)&cmd,1);  
418
    next_out.write((uchar *)&x,4);  
418
    next_out.write((uint8_t *)&x,4);  
419
  }
419
  }
420
420
421
  for (f=player_list;f;)  
421
  for (f=player_list;f;)  
Lines 437-443 Link Here
437
    if (nd)
437
    if (nd)
438
    {
438
    {
439
      packet pk;
439
      packet pk;
440
//      pk.write_long(file_server->get_port());      
440
//      pk.write_uint32(file_server->get_port());      
441
      if (!send_pkt(nd,pk))
441
      if (!send_pkt(nd,pk))
442
      {
442
      {
443
	printf("error writing to connection\n");
443
	printf("error writing to connection\n");
Lines 457-464 Link Here
457
	pk.get_string(name,100);
457
	pk.get_string(name,100);
458
	printf("Joined by player %s\n",name);
458
	printf("Joined by player %s\n",name);
459
	pk.reset();
459
	pk.reset();
460
	uchar ok=1;
460
	uint8_t ok=1;
461
	pk.write((uchar *)&ok,1);      // write ok to join
461
	pk.write((uint8_t *)&ok,1);      // write ok to join
462
	send_pkt(nd,pk);
462
	send_pkt(nd,pk);
463
463
464
	/**************** Read suggested view size from client ****/
464
	/**************** Read suggested view size from client ****/
Lines 467-477 Link Here
467
	  printf("error reading view info from connection\n");
467
	  printf("error reading view info from connection\n");
468
	  return ;	
468
	  return ;	
469
	}	
469
	}	
470
	long cx1,cy1,cx2,cy2;
470
	int32_t cx1,cy1,cx2,cy2;
471
	if (pk.read((uchar *)&cx1,4)!=4) return ;  cx1=lltl(cx1); 
471
	if (pk.read((uint8_t *)&cx1,4)!=4) return ;  cx1=lltl(cx1); 
472
	if (pk.read((uchar *)&cy1,4)!=4) return ;  cy1=lltl(cy1); 
472
	if (pk.read((uint8_t *)&cy1,4)!=4) return ;  cy1=lltl(cy1); 
473
	if (pk.read((uchar *)&cx2,4)!=4) return ;  cx2=lltl(cx2); 
473
	if (pk.read((uint8_t *)&cx2,4)!=4) return ;  cx2=lltl(cx2); 
474
	if (pk.read((uchar *)&cy2,4)!=4) return ;  cy2=lltl(cy2); 
474
	if (pk.read((uint8_t *)&cy2,4)!=4) return ;  cy2=lltl(cy2); 
475
475
476
	/**************** Create the player  *******************/
476
	/**************** Create the player  *******************/
477
	for (view *f=player_list;f && f->next;f=f->next);      // find last player, add one for pn
477
	for (view *f=player_list;f && f->next;f=f->next);      // find last player, add one for pn
Lines 500-516 Link Here
500
500
501
	if (current_level->send(nd))
501
	if (current_level->send(nd))
502
	{	
502
	{	
503
	  uchar cmd=SCMD_ADD_VIEW;
503
	  uint8_t cmd=SCMD_ADD_VIEW;
504
	  next_out.write((uchar *)&cmd,1);
504
	  next_out.write((uint8_t *)&cmd,1);
505
	  v->write_packet(next_out);
505
	  v->write_packet(next_out);
506
506
507
507
508
	  /********** Send all of the views to the player **********/ 
508
	  /********** Send all of the views to the player **********/ 
509
	  pk.reset();
509
	  pk.reset();
510
	  ushort tv=0;
510
	  uint16_t tv=0;
511
	  for (f=player_list;f;f=f->next) tv++;
511
	  for (f=player_list;f;f=f->next) tv++;
512
	  tv=lstl(tv);
512
	  tv=lstl(tv);
513
	  pk.write((uchar *)&tv,2);
513
	  pk.write((uint8_t *)&tv,2);
514
	  if (!send_pkt(nd,pk)) return ;
514
	  if (!send_pkt(nd,pk)) return ;
515
515
516
	  for (f=player_list;f;f=f->next)
516
	  for (f=player_list;f;f=f->next)
Lines 521-529 Link Here
521
	  }
521
	  }
522
522
523
	  pk.reset();
523
	  pk.reset();
524
	  ushort r=lstl(rand_on);
524
	  uint16_t r=lstl(rand_on);
525
	  pk.write((uchar *)&r,2);       // write current random seed
525
	  pk.write((uint8_t *)&r,2);       // write current random seed
526
	  pk.write((uchar *)rtable,1024*2);
526
	  pk.write((uint8_t *)rtable,1024*2);
527
	  send_pkt(nd,pk);
527
	  send_pkt(nd,pk);
528
528
529
	}
529
	}
Lines 542-549 Link Here
542
542
543
  if (!get_pkt(os,pk))                  // read join status packet, 0 means we can't join
543
  if (!get_pkt(os,pk))                  // read join status packet, 0 means we can't join
544
  { fputs(re,stderr); exit(0); }
544
  { fputs(re,stderr); exit(0); }
545
  long nfs_port;
545
  int32_t nfs_port;
546
  if (pk.read((uchar *)&nfs_port,4)!=4)
546
  if (pk.read((uint8_t *)&nfs_port,4)!=4)
547
  { fputs(re,stderr); exit(0); }
547
  { fputs(re,stderr); exit(0); }
548
548
549
//  connect_to_nfs_server(server_name,lltl(nfs_port));
549
//  connect_to_nfs_server(server_name,lltl(nfs_port));
Lines 551-557 Link Here
551
551
552
552
553
553
554
  pk.write((uchar *)name,strlen(name)+1);  // send or name and see if it's ok to join in
554
  pk.write((uint8_t *)name,strlen(name)+1);  // send or name and see if it's ok to join in
555
  if (!send_pkt(os,pk))
555
  if (!send_pkt(os,pk))
556
  {    
556
  {    
557
    printf("Unable to write to server\n");
557
    printf("Unable to write to server\n");
Lines 561-568 Link Here
561
  if (!get_pkt(os,pk))                  // read join status packet, 0 means we can't join
561
  if (!get_pkt(os,pk))                  // read join status packet, 0 means we can't join
562
  { fputs(re,stderr); exit(0); }
562
  { fputs(re,stderr); exit(0); }
563
  
563
  
564
  uchar stat;
564
  uint8_t stat;
565
  if (pk.read((uchar *)&stat,1)!=1)
565
  if (pk.read((uint8_t *)&stat,1)!=1)
566
  { fputs(re,stderr); exit(0); }
566
  { fputs(re,stderr); exit(0); }
567
567
568
  if (stat==0)
568
  if (stat==0)
Lines 575-582 Link Here
575
  if (current_level)
575
  if (current_level)
576
    delete current_level;
576
    delete current_level;
577
577
578
  long vs[4]={lltl(320/2-155),lltl(200/2-95),lltl(320/2+155),lltl(200/2+70)};
578
  int32_t vs[4]={lltl(320/2-155),lltl(200/2-95),lltl(320/2+155),lltl(200/2+70)};
579
  pk.write((uchar *)vs,4*4);
579
  pk.write((uint8_t *)vs,4*4);
580
  if (!send_pkt(os,pk))   { printf("Unable to write to server\n"); exit(0);  }
580
  if (!send_pkt(os,pk))   { printf("Unable to write to server\n"); exit(0);  }
581
  
581
  
582
582
Lines 592-599 Link Here
592
    printf("Unable to read views from server\n");
592
    printf("Unable to read views from server\n");
593
    exit(0);
593
    exit(0);
594
  }
594
  }
595
  ushort tv;
595
  uint16_t tv;
596
  if (pk.read((uchar *)&tv,2)!=2)
596
  if (pk.read((uint8_t *)&tv,2)!=2)
597
  { fputs(re,stderr); exit(0); }
597
  { fputs(re,stderr); exit(0); }
598
  tv=lstl(tv);
598
  tv=lstl(tv);
599
  view *last=NULL;
599
  view *last=NULL;
Lines 614-627 Link Here
614
  }   
614
  }   
615
615
616
  if (!get_pkt(os,pk)) { fputs(re,stderr); exit(0); }
616
  if (!get_pkt(os,pk)) { fputs(re,stderr); exit(0); }
617
  if (pk.read((uchar *)&rand_on,2)!=2)    // read the current random seed used by the server.
617
  if (pk.read((uint8_t *)&rand_on,2)!=2)    // read the current random seed used by the server.
618
  { fputs(re,stderr); exit(0); }
618
  { fputs(re,stderr); exit(0); }
619
  rand_on=lstl(rand_on);
619
  rand_on=lstl(rand_on);
620
  ushort *rtab=(ushort *)jmalloc(1024*2,"tmp rtab");
620
  uint16_t *rtab=(uint16_t *)jmalloc(1024*2,"tmp rtab");
621
  if (!pk.read((uchar *)rtab,1024*2)) { fputs(re,stderr); exit(0); }  // read the rand table
621
  if (!pk.read((uint8_t *)rtab,1024*2)) { fputs(re,stderr); exit(0); }  // read the rand table
622
622
623
  for (int j=0;j<1024*2;j++)
623
  for (int j=0;j<1024*2;j++)
624
    if (((uchar *)rtab)[j]!=((uchar *)rtable)[j])
624
    if (((uint8_t *)rtab)[j]!=((uint8_t *)rtable)[j])
625
    { printf("rtables differ on byte %d\n",j); exit(0); }
625
    { printf("rtables differ on byte %d\n",j); exit(0); }
626
    
626
    
627
  jfree(rtab);
627
  jfree(rtab);
Lines 646-655 Link Here
646
646
647
void server::remove_player(view *f)
647
void server::remove_player(view *f)
648
{
648
{
649
  uchar cmd=SCMD_REMOVE_VIEW;
649
  uint8_t cmd=SCMD_REMOVE_VIEW;
650
  next_out.write((uchar *)&cmd,1);
650
  next_out.write((uint8_t *)&cmd,1);
651
  ushort pn=lstl(f->player_number);
651
  uint16_t pn=lstl(f->player_number);
652
  next_out.write((uchar *)&pn,2);
652
  next_out.write((uint8_t *)&pn,2);
653
  if (f==player_list)
653
  if (f==player_list)
654
    player_list=player_list->next;
654
    player_list=player_list->next;
655
  else
655
  else
Lines 668-682 Link Here
668
{
668
{
669
669
670
	  cmd=SCMD_ADD_VIEW;
670
	  cmd=SCMD_ADD_VIEW;
671
	  next_out.write((uchar *)&cmd,1);
671
	  next_out.write((uint8_t *)&cmd,1);
672
672
673
    ushort pn=lstl(new_player->player_number);
673
    uint16_t pn=lstl(new_player->player_number);
674
    next_out.write((uchar *)&pn,2);
674
    next_out.write((uint8_t *)&pn,2);
675
    ushort type=lstlli(new_player->focus->otype);
675
    uint16_t type=lstlli(new_player->focus->otype);
676
    next_out.write((uchar *)&type,2);
676
    next_out.write((uint8_t *)&type,2);
677
    ulong x=lltl(new_player->focus->x),y=lltl(new_player->focus->y);
677
    uint32_t x=lltl(new_player->focus->x),y=lltl(new_player->focus->y);
678
    next_out.write((uchar *)&x,4);
678
    next_out.write((uint8_t *)&x,4);
679
    next_out.write((uchar *)&y,4);    
679
    next_out.write((uint8_t *)&y,4);    
680
  }*/
680
  }*/
681
681
682
682
Lines 684-691 Link Here
684
#define TOT_VIEW_VARS 32
684
#define TOT_VIEW_VARS 32
685
view *server::add_view(packet &pk)
685
view *server::add_view(packet &pk)
686
{
686
{
687
  ulong x[TOT_VIEW_VARS];
687
  uint32_t x[TOT_VIEW_VARS];
688
  if (!pk.read((uchar *)x,TOT_VIEW_VARS*4)) return NULL;
688
  if (!pk.read((uint8_t *)x,TOT_VIEW_VARS*4)) return NULL;
689
  for (int i=0;i<TOT_VIEW_VARS;i++) x[i]=lltl(x[i]);
689
  for (int i=0;i<TOT_VIEW_VARS;i++) x[i]=lltl(x[i]);
690
  int skip=0;
690
  int skip=0;
691
  for (view *f=player_list;f;f=f->next)
691
  for (view *f=player_list;f;f=f->next)
Lines 720-726 Link Here
720
    v->last_ammo=x[22];  v->last_type=x[23]; v->visor_time=x[28]; v->current_weapon=x[29];
720
    v->last_ammo=x[22];  v->last_type=x[23]; v->visor_time=x[28]; v->current_weapon=x[29];
721
    v->secrets=x[30];    v->kills=x[31];
721
    v->secrets=x[30];    v->kills=x[31];
722
722
723
    pk.read((uchar *)v->weapons,total_objects*4);
723
    pk.read((uint8_t *)v->weapons,total_objects*4);
724
    pk.get_string(v->name,100);
724
    pk.get_string(v->name,100);
725
725
726
726
Lines 740-746 Link Here
740
  int er=0;
740
  int er=0;
741
  while (!pk.eop() && !er)
741
  while (!pk.eop() && !er)
742
  {
742
  {
743
    uchar cmd;
743
    uint8_t cmd;
744
    if (pk.read(&cmd,1)!=1)
744
    if (pk.read(&cmd,1)!=1)
745
      er=1;
745
      er=1;
746
    else
746
    else
Lines 749-756 Link Here
749
      int fail=0;
749
      int fail=0;
750
      if (cmd!=SCMD_ADD_VIEW && cmd!=SCMD_SYNC)
750
      if (cmd!=SCMD_ADD_VIEW && cmd!=SCMD_SYNC)
751
      {	
751
      {	
752
	ushort player;
752
	uint16_t player;
753
	if (pk.read((uchar *)&player,2)!=2)
753
	if (pk.read((uint8_t *)&player,2)!=2)
754
	  er=1;
754
	  er=1;
755
	player=lstl(player);
755
	player=lstl(player);
756
	for (f=player_list;f && f->player_number!=player;f=f->next);
756
	for (f=player_list;f && f->player_number!=player;f=f->next);
(-)abuse-sdl-0.7.0.orig/src/chars.cpp (-1 / +1 lines)
Lines 412-418 Link Here
412
    else
412
    else
413
    {
413
    {
414
      lprint(lcar(field));
414
      lprint(lcar(field));
415
      lbreak("Unknown field for character definiltion");
415
      lbreak("Unknown field for character definition");
416
      exit(0);
416
      exit(0);
417
    }    
417
    }    
418
  }
418
  }
(-)abuse-sdl-0.7.0.orig/src/cache.cpp (-41 / +40 lines)
Lines 66-83 Link Here
66
    return 0; 
66
    return 0; 
67
  }
67
  }
68
68
69
  fp->write_short(total);
69
  fp->write_uint16(total);
70
  total=0;
70
  total=0;
71
  for (i=0;i<total_files;i++)
71
  for (i=0;i<total_files;i++)
72
  {
72
  {
73
    ulong crc;
73
    uint32_t crc;
74
    int failed=0;
74
    int failed=0;
75
    crc=get_crc(i,failed);
75
    crc=get_crc(i,failed);
76
    if (!failed)
76
    if (!failed)
77
    {
77
    {
78
      fp->write_long(crc);
78
      fp->write_uint32(crc);
79
      uchar len=strlen(get_filename(i))+1;
79
      uint8_t len=strlen(get_filename(i))+1;
80
      fp->write_byte(len);
80
      fp->write_uint8(len);
81
      fp->write(get_filename(i),len);
81
      fp->write(get_filename(i),len);
82
      total++;
82
      total++;
83
    }
83
    }
Lines 95-107 Link Here
95
    return 0;
95
    return 0;
96
  } else
96
  } else
97
  {
97
  {
98
    short total=fp->read_short();
98
    short total=fp->read_uint16();
99
    int i;
99
    int i;
100
    for (i=0;i<total;i++)
100
    for (i=0;i<total;i++)
101
    {
101
    {
102
      char name[256];
102
      char name[256];
103
      ulong crc=fp->read_long();
103
      uint32_t crc=fp->read_uint32();
104
      uchar len=fp->read_byte();
104
      uint8_t len=fp->read_uint8();
105
      fp->read(name,len);
105
      fp->read(name,len);
106
      set_crc(get_filenumber(name),crc);
106
      set_crc(get_filenumber(name),crc);
107
    }
107
    }
Lines 147-159 Link Here
147
  return total_files-1;
147
  return total_files-1;
148
}
148
}
149
149
150
char *crc_manager::get_filename(long filenumber)
150
char *crc_manager::get_filename(int32_t filenumber)
151
{
151
{
152
  CHECK(filenumber>=0 && filenumber<total_files);
152
  CHECK(filenumber>=0 && filenumber<total_files);
153
  return files[filenumber]->filename;
153
  return files[filenumber]->filename;
154
}
154
}
155
155
156
ulong crc_manager::get_crc(long filenumber, int &failed)
156
uint32_t crc_manager::get_crc(int32_t filenumber, int &failed)
157
{    
157
{    
158
  CHECK(filenumber>=0 && filenumber<total_files);
158
  CHECK(filenumber>=0 && filenumber<total_files);
159
  if (files[filenumber]->crc_calculated) 
159
  if (files[filenumber]->crc_calculated) 
Lines 165-171 Link Here
165
  return 0;
165
  return 0;
166
}
166
}
167
167
168
void crc_manager::set_crc(long filenumber, ulong crc)
168
void crc_manager::set_crc(int32_t filenumber, uint32_t crc)
169
{
169
{
170
  CHECK(filenumber>=0 && filenumber<total_files);
170
  CHECK(filenumber>=0 && filenumber<total_files);
171
  files[filenumber]->crc_calculated=1;
171
  files[filenumber]->crc_calculated=1;
Lines 247-274 Link Here
247
247
248
    if (fp)
248
    if (fp)
249
    {
249
    {
250
      fp->write_short(crc_man.total_filenames());
250
      fp->write_uint16(crc_man.total_filenames());
251
      for (i=0;i<crc_man.total_filenames();i++)
251
      for (i=0;i<crc_man.total_filenames();i++)
252
      {
252
      {
253
	int l=strlen(crc_man.get_filename(i))+1;
253
	int l=strlen(crc_man.get_filename(i))+1;
254
        fp->write_byte(l);
254
        fp->write_uint8(l);
255
	fp->write(crc_man.get_filename(i),l);
255
	fp->write(crc_man.get_filename(i),l);
256
      }
256
      }
257
257
258
      int tsaved=0;
258
      int tsaved=0;
259
      for (i=0;i<total;i++)
259
      for (i=0;i<total;i++)
260
        if (list[i].last_access>0) tsaved++;
260
        if (list[i].last_access>0) tsaved++;
261
      fp->write_long(tsaved);
261
      fp->write_uint32(tsaved);
262
262
263
      for (i=0;i<total;i++)
263
      for (i=0;i<total;i++)
264
      {
264
      {
265
	int id=ordered_ids[i];
265
	int id=ordered_ids[i];
266
        if (list[id].last_access>0)       // don't save unaccessed counts      
266
        if (list[id].last_access>0)       // don't save unaccessed counts      
267
	{
267
	{
268
	  fp->write_byte(list[id].type);    // save type, if type changed on reload 
268
	  fp->write_uint8(list[id].type);    // save type, if type changed on reload 
269
	                                    // don't cache in-> its a different refrence
269
	                                    // don't cache in-> its a different refrence
270
	  fp->write_short(list[id].file_number);
270
	  fp->write_uint16(list[id].file_number);
271
	  fp->write_long(list[id].offset);
271
	  fp->write_uint32(list[id].offset);
272
	}
272
	}
273
      }      
273
      }      
274
    }
274
    }
Lines 309-315 Link Here
309
}
309
}
310
310
311
311
312
int cache_list::search(int *sarray, ushort filenum, long offset)
312
int cache_list::search(int *sarray, uint16_t filenum, int32_t offset)
313
{
313
{
314
  int x1=0,x2=total-1;
314
  int x1=0,x2=total-1;
315
  int split;
315
  int split;
Lines 422-428 Link Here
422
422
423
423
424
  int j;
424
  int j;
425
  ushort *fg_line;
425
  uint16_t *fg_line;
426
  for (j=0;j<lev->foreground_height();j++)
426
  for (j=0;j<lev->foreground_height();j++)
427
  {
427
  {
428
    fg_line=lev->get_fgline(j);
428
    fg_line=lev->get_fgline(j);
Lines 438-444 Link Here
438
    }      
438
    }      
439
  }
439
  }
440
440
441
  ushort *bg_line;
441
  uint16_t *bg_line;
442
  for (j=0;j<lev->background_height();j++)
442
  for (j=0;j<lev->background_height();j++)
443
  {
443
  {
444
    bg_line=lev->get_bgline(j);
444
    bg_line=lev->get_bgline(j);
Lines 480-486 Link Here
480
      int tnames=0;
480
      int tnames=0;
481
      int *fnum_remap;    // remaps old filenumbers into current ones
481
      int *fnum_remap;    // remaps old filenumbers into current ones
482
      
482
      
483
      tnames=fp->read_short();
483
      tnames=fp->read_uint16();
484
      if (tnames)                     /// make sure there isn't bad info in the file
484
      if (tnames)                     /// make sure there isn't bad info in the file
485
      {
485
      {
486
	fnum_remap=(int *)jmalloc(sizeof(int)*tnames,"pfname remap");
486
	fnum_remap=(int *)jmalloc(sizeof(int)*tnames,"pfname remap");
Lines 488-494 Link Here
488
	int i;
488
	int i;
489
	for (i=0;i<tnames;i++)
489
	for (i=0;i<tnames;i++)
490
	{
490
	{
491
	  fp->read(name,fp->read_byte());
491
	  fp->read(name,fp->read_uint8());
492
	  fnum_remap[i]=-1;                    // initialize the map to no-map
492
	  fnum_remap[i]=-1;                    // initialize the map to no-map
493
493
494
	  int j;
494
	  int j;
Lines 497-503 Link Here
497
	      fnum_remap[i]=j;
497
	      fnum_remap[i]=j;
498
	}
498
	}
499
	
499
	
500
	long tsaved=fp->read_long();
500
	uint32_t tsaved=fp->read_uint32();
501
501
502
502
503
	int *priority=(int *)jmalloc(tsaved*sizeof(int),"priorities");
503
	int *priority=(int *)jmalloc(tsaved*sizeof(int),"priorities");
Lines 510-522 Link Here
510
510
511
	for (i=0;i<tsaved;i++)
511
	for (i=0;i<tsaved;i++)
512
	{
512
	{
513
	  uchar type=fp->read_byte();
513
	  uint8_t type=fp->read_uint8();
514
	  short file_num=fp->read_short();
514
	  short file_num=fp->read_uint16();
515
	  if (file_num>=tnames)  // bad data?
515
	  if (file_num>=tnames)  // bad data?
516
	    file_num=-1;
516
	    file_num=-1;
517
	  else file_num=fnum_remap[file_num];
517
	  else file_num=fnum_remap[file_num];
518
518
519
	  ulong offset=fp->read_long();
519
	  uint32_t offset=fp->read_uint32();
520
520
521
	  // search for a match 
521
	  // search for a match 
522
	  j=search(sorted_id_list,file_num,offset);	 
522
	  j=search(sorted_id_list,file_num,offset);	 
Lines 804-810 Link Here
804
  used=1;
804
  used=1;
805
}
805
}
806
806
807
long cache_list::alloc_id()
807
int32_t cache_list::alloc_id()
808
{
808
{
809
  int id;
809
  int id;
810
  if (prof_data)
810
  if (prof_data)
Lines 850-858 Link Here
850
850
851
851
852
852
853
long cache_list::reg_lisp_block(Cell *block)
853
int32_t cache_list::reg_lisp_block(Cell *block)
854
{ 
854
{ 
855
  long s;
855
  uint32_t s;
856
  if (lcache_number==-1)
856
  if (lcache_number==-1)
857
    lcache_number=crc_man.get_filenumber(lfname);
857
    lcache_number=crc_man.get_filenumber(lfname);
858
858
Lines 862-873 Link Here
862
    {
862
    {
863
      if (cache_read_file)
863
      if (cache_read_file)
864
      {
864
      {
865
				delete cache_read_file;
865
	delete cache_read_file;
866
				cache_read_file=NULL;
866
	cache_read_file=NULL;
867
			
868
				cache_file=new jFILE(lfname,"ab");	
869
      } else cache_file=new jFILE(lfname,"wb");	 // first time we opened
870
867
868
	cache_file=new jFILE(lfname,"ab");	
869
      } else cache_file=new jFILE(lfname,"wb");	 // first time we opened
871
    }
870
    }
872
    if (cache_file->open_failure()) 
871
    if (cache_file->open_failure()) 
873
    { 
872
    { 
Lines 893-904 Link Here
893
  ci->offset=cache_file->tell();
892
  ci->offset=cache_file->tell();
894
893
895
  s=block_size(block);
894
  s=block_size(block);
896
  cache_file->write_long(s);
895
  cache_file->write_uint32(s);
897
  write_level(cache_file,block);
896
  write_level(cache_file,block);
898
  return id;    
897
  return id;    
899
}
898
}
900
899
901
long cache_list::reg_object(char *filename, void *object, int type, int rm_dups)
900
int32_t cache_list::reg_object(char *filename, void *object, int type, int rm_dups)
902
{ 
901
{ 
903
  char *name;
902
  char *name;
904
  if (item_type(object)==L_CONS_CELL)      // see if we got a object with a filename included
903
  if (item_type(object)==L_CONS_CELL)      // see if we got a object with a filename included
Lines 912-918 Link Here
912
911
913
extern int total_files_open;
912
extern int total_files_open;
914
913
915
long cache_list::reg(char *filename, char *name, int type, int rm_dups)
914
int32_t cache_list::reg(char *filename, char *name, int type, int rm_dups)
916
{
915
{
917
	int id=alloc_id(),i,fn=crc_man.get_filenumber(filename);
916
	int id=alloc_id(),i,fn=crc_man.get_filenumber(filename);
918
	cache_item *ci=list+id;
917
	cache_item *ci=list+id;
Lines 1169-1175 Link Here
1169
      
1168
      
1170
      int cache_size=80*1024;                   // 80K
1169
      int cache_size=80*1024;                   // 80K
1171
      cache_read_file->set_read_buffer_size(cache_size); 
1170
      cache_read_file->set_read_buffer_size(cache_size); 
1172
      uchar mini_buf;
1171
      uint8_t mini_buf;
1173
      cache_read_file->read(&mini_buf,1);       // prime the buffer
1172
      cache_read_file->read(&mini_buf,1);       // prime the buffer
1174
    }
1173
    }
1175
1174
Lines 1177-1183 Link Here
1177
1176
1178
    int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
1177
    int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
1179
1178
1180
    long size=cache_read_file->read_long();
1179
    uint32_t size=cache_read_file->read_uint32();
1181
    void *space;
1180
    void *space;
1182
1181
1183
    if (size)
1182
    if (size)
Lines 1206-1212 Link Here
1206
1205
1207
void cache_list::free_oldest()
1206
void cache_list::free_oldest()
1208
{
1207
{
1209
  long i,old_time=last_access;
1208
  uint32_t i,old_time=last_access;
1210
  cache_item *ci=list,*oldest=NULL;
1209
  cache_item *ci=list,*oldest=NULL;
1211
  ful=1;
1210
  ful=1;
1212
1211
Lines 1257-1263 Link Here
1257
      old=ci->last_access;
1256
      old=ci->last_access;
1258
      printf("type=(%20s) file=(%20s) access=(%6ld)\n",spec_types[ci->type],
1257
      printf("type=(%20s) file=(%20s) access=(%6ld)\n",spec_types[ci->type],
1259
	     crc_man.get_filename(ci->file_number),
1258
	     crc_man.get_filename(ci->file_number),
1260
	     ci->last_access);
1259
	     (long int)ci->last_access);
1261
    }
1260
    }
1262
  } while (new_old);
1261
  } while (new_old);
1263
}
1262
}
(-)abuse-sdl-0.7.0.orig/src/sndserver.cpp (-12 / +12 lines)
Lines 36-46 Link Here
36
int numsounds;			// number of sound effects
36
int numsounds;			// number of sound effects
37
int longsound;			// longest sound effect
37
int longsound;			// longest sound effect
38
int lengths[NUMSFX];		// lengths of all sound effects
38
int lengths[NUMSFX];		// lengths of all sound effects
39
unsigned char mixbuffer[MIXBUFFERSIZE];	// mixing buffer
39
uint8_t mixbuffer[MIXBUFFERSIZE];	// mixing buffer
40
int sfxdevice;			// file descriptor of sfx device
40
int sfxdevice;			// file descriptor of sfx device
41
int musdevice;			// file descriptor of music device
41
int musdevice;			// file descriptor of music device
42
unsigned char *channels[8];	// the channel data pointers
42
uint8_t *channels[8];	// the channel data pointers
43
unsigned char *channelsend[8];	// the channel data end pointers
43
uint8_t *channelsend[8];	// the channel data end pointers
44
int channelstart[8];		// time that the channel started playing
44
int channelstart[8];		// time that the channel started playing
45
int channelhandles[8];		// the channel handles
45
int channelhandles[8];		// the channel handles
46
46
Lines 74-83 Link Here
74
    } while (j);
74
    } while (j);
75
    if (d > 127) mixbuffer[i] = 255;
75
    if (d > 127) mixbuffer[i] = 255;
76
    else if (d < -128) mixbuffer[i] = 0;
76
    else if (d < -128) mixbuffer[i] = 0;
77
    else mixbuffer[i] = (unsigned char) (d+128);
77
    else mixbuffer[i] = (uint8_t) (d+128);
78
//    if (d > 127) mixbuffer[i] = 0;
78
//    if (d > 127) mixbuffer[i] = 0;
79
//    else if (d < -128) mixbuffer[i] = 255;
79
//    else if (d < -128) mixbuffer[i] = 255;
80
//    else mixbuffer[i] = (unsigned char) (-d+127);
80
//    else mixbuffer[i] = (uint8_t) (-d+127);
81
  }
81
  }
82
82
83
  // check for freed channels
83
  // check for freed channels
Lines 196-202 Link Here
196
196
197
  int i;
197
  int i;
198
  int rc = -1;
198
  int rc = -1;
199
  static unsigned short handlenums = 0;
199
  static uint16_t handlenums = 0;
200
  int oldest = mytime;
200
  int oldest = mytime;
201
  int oldestnum = 0;
201
  int oldestnum = 0;
202
202
Lines 205-211 Link Here
205
    if (!channels[i])
205
    if (!channels[i])
206
    {
206
    {
207
      channelsend[i] =
207
      channelsend[i] =
208
        (channels[i] = (unsigned char *) S_sfx[sfxid].data) + lengths[sfxid];
208
        (channels[i] = (uint8_t *) S_sfx[sfxid].data) + lengths[sfxid];
209
      if (!handlenums) handlenums = 100;
209
      if (!handlenums) handlenums = 100;
210
      channelhandles[i] = rc = handlenums++;
210
      channelhandles[i] = rc = handlenums++;
211
      channelstart[i] = mytime;
211
      channelstart[i] = mytime;
Lines 225-231 Link Here
225
  if (i == 8)
225
  if (i == 8)
226
  {
226
  {
227
    channelsend[oldestnum] =
227
    channelsend[oldestnum] =
228
      (channels[oldestnum] = (unsigned char *) S_sfx[sfxid].data)
228
      (channels[oldestnum] = (uint8_t *) S_sfx[sfxid].data)
229
       + lengths[sfxid];
229
       + lengths[sfxid];
230
    if (!handlenums) handlenums = 100;
230
    if (!handlenums) handlenums = 100;
231
    channelhandles[oldestnum] = rc = handlenums++;
231
    channelhandles[oldestnum] = rc = handlenums++;
Lines 236-245 Link Here
236
236
237
}
237
}
238
238
239
void outputushort(int num)
239
void output_uint16(int num)
240
{
240
{
241
241
242
  static unsigned char buff[5] = { 0, 0, 0, 0, '\n' };
242
  static uint8_t buff[5] = { 0, 0, 0, 0, '\n' };
243
  static char *badbuff = "xxxx\n";
243
  static char *badbuff = "xxxx\n";
244
244
245
  // outputs a 16-bit # in hex or "xxxx" if -1.
245
  // outputs a 16-bit # in hex or "xxxx" if -1.
Lines 263-269 Link Here
263
void initdata(void)
263
void initdata(void)
264
{
264
{
265
  int i;
265
  int i;
266
  for (i=0 ; i<sizeof(channels)/sizeof(unsigned char *) ; i++) channels[i] = 0;
266
  for (i=0 ; i<sizeof(channels)/sizeof(uint8_t *) ; i++) channels[i] = 0;
267
  gettimeofday(&last, &whocares);
267
  gettimeofday(&last, &whocares);
268
  usleep(100000);
268
  usleep(100000);
269
}
269
}
Lines 273-279 Link Here
273
273
274
  int done = 0;
274
  int done = 0;
275
  int rc, nrc, sndnum, handle = 0;
275
  int rc, nrc, sndnum, handle = 0;
276
  unsigned char commandbuf[10];
276
  uint8_t commandbuf[10];
277
  fd_set fdset, scratchset;
277
  fd_set fdset, scratchset;
278
  struct timeval zerowait = { 0, 0 };
278
  struct timeval zerowait = { 0, 0 };
279
279
(-)abuse-sdl-0.7.0.orig/src/level.cpp (-263 / +264 lines)
Lines 23-42 Link Here
23
#include <sys/stat.h>
23
#include <sys/stat.h>
24
#endif
24
#endif
25
25
26
#include <limits.h>
26
#include <time.h>
27
#include <time.h>
27
28
28
level *current_level;
29
level *current_level;
29
30
30
game_object *level::attacker(game_object *who)
31
game_object *level::attacker(game_object *who)
31
{ 
32
{ 
32
  long d=0x7fffffff;
33
  int32_t d=0x7fffffff;
33
  game_object *c=NULL;
34
  game_object *c=NULL;
34
  view *f=the_game->first_view;
35
  view *f=the_game->first_view;
35
  for (;f;f=f->next)
36
  for (;f;f=f->next)
36
  {
37
  {
37
    if (f->focus)
38
    if (f->focus)
38
    {
39
    {
39
      long tmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y);
40
      int32_t tmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y);
40
      if (tmp_d<d)
41
      if (tmp_d<d)
41
      {
42
      {
42
	d=tmp_d;
43
	d=tmp_d;
Lines 197-203 Link Here
197
  }
198
  }
198
}
199
}
199
200
200
int level::add_actives(long x1, long y1, long x2, long y2)
201
int level::add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
201
{
202
{
202
  int t=0;
203
  int t=0;
203
  game_object *last_active=NULL;
204
  game_object *last_active=NULL;
Lines 209-215 Link Here
209
  {    
210
  {    
210
    if (!o->active)
211
    if (!o->active)
211
    {
212
    {
212
      long xr=figures[o->otype]->rangex,
213
      int32_t xr=figures[o->otype]->rangex,
213
           yr=figures[o->otype]->rangey;
214
           yr=figures[o->otype]->rangey;
214
215
215
      if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
216
      if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
Lines 241-247 Link Here
241
}
242
}
242
243
243
244
244
int level::add_drawables(long x1, long y1, long x2, long y2)
245
int level::add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
245
{
246
{
246
  int t=0,ft=0;
247
  int t=0,ft=0;
247
  game_object *last_active=NULL;
248
  game_object *last_active=NULL;
Lines 255-261 Link Here
255
  {    
256
  {    
256
    if (ft || !o->active)
257
    if (ft || !o->active)
257
    {
258
    {
258
      long xr=figures[o->otype]->draw_rangex,
259
      int32_t xr=figures[o->otype]->draw_rangex,
259
      yr=figures[o->otype]->draw_rangey;
260
      yr=figures[o->otype]->draw_rangey;
260
261
261
      if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
262
      if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
Lines 321-327 Link Here
321
322
322
void level::wall_push()
323
void level::wall_push()
323
{
324
{
324
  long sx1,sy1,sx2,sy2,xv,yv;
325
  int32_t sx1,sy1,sx2,sy2,xv,yv;
325
  game_object *o=first_active;
326
  game_object *o=first_active;
326
  for (;o;o=o->next_active)
327
  for (;o;o=o->next_active)
327
  {
328
  {
Lines 361-367 Link Here
361
    int b1=subject->push_range(),b2=target->push_range();
362
    int b1=subject->push_range(),b2=target->push_range();
362
    if (abs(subject->x-target->x)<b1+b2)
363
    if (abs(subject->x-target->x)<b1+b2)
363
    {
364
    {
364
      long tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;
365
      int32_t tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;
365
      if (subject->x>target->x)
366
      if (subject->x>target->x)
366
        xv=tmove/2;
367
        xv=tmove/2;
367
      else xv=-tmove/2;
368
      else xv=-tmove/2;
Lines 381-387 Link Here
381
void level::check_collisions()
382
void level::check_collisions()
382
{
383
{
383
  game_object *target,*reciever=NULL;
384
  game_object *target,*reciever=NULL;
384
  long sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
385
  int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
385
      s_centerx,t_centerx;
386
      s_centerx,t_centerx;
386
387
387
  for (game_object *subject=first_active;subject;subject=subject->next_active)
388
  for (game_object *subject=first_active;subject;subject=subject->next_active)
Lines 415-421 Link Here
415
	    {
416
	    {
416
	      for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !hit;j--)
417
	      for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !hit;j--)
417
	      {
418
	      {
418
		long x1,y1,x2,y2,          // define the two line segments to check
419
		int32_t x1,y1,x2,y2,          // define the two line segments to check
419
		xp1,yp1,xp2,yp2;
420
		xp1,yp1,xp2,yp2;
420
421
421
		xp1=target->x+target->tx(*t_dat);  t_dat++;	      
422
		xp1=target->x+target->tx(*t_dat);  t_dat++;	      
Lines 458-467 Link Here
458
}
459
}
459
*/
460
*/
460
461
461
game_object *level::boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
462
game_object *level::boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
462
{
463
{
463
  game_object *l=NULL;
464
  game_object *l=NULL;
464
  long tx1,ty1,tx2,ty2,t_centerx;
465
  int32_t tx1,ty1,tx2,ty2,t_centerx;
465
  game_object *target=first_active;
466
  game_object *target=first_active;
466
  game_object **blist=block_list;
467
  game_object **blist=block_list;
467
  int t=block_total;
468
  int t=block_total;
Lines 484-493 Link Here
484
	int iter=t_damage->tot-1;
485
	int iter=t_damage->tot-1;
485
	while(iter-->0)
486
	while(iter-->0)
486
	{
487
	{
487
	  long xp1=target->x+target->tx(*t_dat);  t_dat++;	      
488
	  int32_t xp1=target->x+target->tx(*t_dat);  t_dat++;	      
488
	  long yp1=target->y+target->ty(*t_dat);  t_dat++;
489
	  int32_t yp1=target->y+target->ty(*t_dat);  t_dat++;
489
	  long xp2=target->x+target->tx(*t_dat); 
490
	  int32_t xp2=target->x+target->tx(*t_dat); 
490
	  long yp2=target->y+target->ty(t_dat[1]); 
491
	  int32_t yp2=target->y+target->ty(t_dat[1]); 
491
492
492
	  // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
493
	  // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
493
	  if (*ins)
494
	  if (*ins)
Lines 510-519 Link Here
510
}
511
}
511
512
512
513
513
game_object *level::all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
514
game_object *level::all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
514
{
515
{
515
  game_object *l=NULL;
516
  game_object *l=NULL;
516
  long tx1,ty1,tx2,ty2,t_centerx;
517
  int32_t tx1,ty1,tx2,ty2,t_centerx;
517
  game_object *target=first_active;
518
  game_object *target=first_active;
518
  game_object **blist=all_block_list;
519
  game_object **blist=all_block_list;
519
  int t=all_block_total;
520
  int t=all_block_total;
Lines 536-545 Link Here
536
	int iter=t_damage->tot-1;
537
	int iter=t_damage->tot-1;
537
	while(iter-->0)
538
	while(iter-->0)
538
	{
539
	{
539
	  long xp1=target->x+target->tx(*t_dat);  t_dat++;	      
540
	  int32_t xp1=target->x+target->tx(*t_dat);  t_dat++;	      
540
	  long yp1=target->y+target->ty(*t_dat);  t_dat++;
541
	  int32_t yp1=target->y+target->ty(*t_dat);  t_dat++;
541
	  long xp2=target->x+target->tx(*t_dat); 
542
	  int32_t xp2=target->x+target->tx(*t_dat); 
542
	  long yp2=target->y+target->ty(t_dat[1]); 
543
	  int32_t yp2=target->y+target->ty(t_dat[1]); 
543
544
544
	  // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
545
	  // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
545
	  if (*ins)
546
	  if (*ins)
Lines 565-571 Link Here
565
566
566
void level::interpolate_draw_objects(view *v)
567
void level::interpolate_draw_objects(view *v)
567
{
568
{
568
  long old_x,old_y;
569
  int32_t old_x,old_y;
569
  current_view=v;
570
  current_view=v;
570
  
571
  
571
  game_object *o=first_active;
572
  game_object *o=first_active;
Lines 606-612 Link Here
606
  if (current_demo_mode()==DEMO_PLAY)
607
  if (current_demo_mode()==DEMO_PLAY)
607
  {
608
  {
608
    if (!rcheck) rcheck=open_file("rcheck","rb");
609
    if (!rcheck) rcheck=open_file("rcheck","rb");
609
    long x=rcheck->read_long();
610
    int32_t x=rcheck->read_uint32();
610
    if (x!=rand_on)
611
    if (x!=rand_on)
611
      dprintf("off!\n");
612
      dprintf("off!\n");
612
  } else if (current_demo_mode()==DEMO_RECORD)
613
  } else if (current_demo_mode()==DEMO_RECORD)
Lines 616-622 Link Here
616
      rcheck=open_file("rcheck","wb");
617
      rcheck=open_file("rcheck","wb");
617
      rcheck_lp=open_file("rcheck.lp","wb");
618
      rcheck_lp=open_file("rcheck.lp","wb");
618
    }
619
    }
619
    rcheck->write_long(rand_on);
620
    rcheck->write_uint32(rand_on);
620
  } else
621
  } else
621
  {
622
  {
622
    if (rcheck)
623
    if (rcheck)
Lines 644-654 Link Here
644
      if (c)
645
      if (c)
645
      {      
646
      {      
646
	area_controller *a,*smallest=NULL;
647
	area_controller *a,*smallest=NULL;
647
	long smallest_size=0xfffffff;
648
	int32_t smallest_size=0xffffffff;
648
	for (a=area_list;a;a=a->next)
649
	for (a=area_list;a;a=a->next)
649
	  if (o->x>=a->x && o->y>=a->y && o->x<=a->x+a->w && o->y<=a->y+a->h)
650
	  if (o->x>=a->x && o->y>=a->y && o->x<=a->x+a->w && o->y<=a->y+a->h)
650
	  {
651
	  {
651
	    long size=a->w*a->h;
652
	    int32_t size=a->w*a->h;
652
	    if (size<smallest_size)
653
	    if (size<smallest_size)
653
	    {
654
	    {
654
	      smallest=a;
655
	      smallest=a;
Lines 692-698 Link Here
692
693
693
	if (o->otype!=current_start_type)
694
	if (o->otype!=current_start_type)
694
	{
695
	{
695
	  long fmp=o->fmp();      
696
	  int32_t fmp=o->fmp();      
696
	  int reduce=figures[o->otype]->morph_power;
697
	  int reduce=figures[o->otype]->morph_power;
697
	  if (reduce)
698
	  if (reduce)
698
	  {
699
	  {
Lines 759-772 Link Here
759
  return ret;
760
  return ret;
760
}
761
}
761
762
762
void level::set_tick_counter(ulong x) 
763
void level::set_tick_counter(uint32_t x) 
763
{ 
764
{ 
764
  ctick=x; 
765
  ctick=x; 
765
}
766
}
766
767
767
void level::draw_areas(view *v)
768
void level::draw_areas(view *v)
768
{
769
{
769
  long sx1,sy1,sx2,sy2;
770
  int32_t sx1,sy1,sx2,sy2;
770
  area_controller *a=area_list;
771
  area_controller *a=area_list;
771
  for (;a;a=a->next)
772
  for (;a;a=a->next)
772
  {
773
  {
Lines 806-812 Link Here
806
  clear_tmp();
807
  clear_tmp();
807
}  
808
}  
808
809
809
void calc_bgsize(unsigned short fgw, unsigned short  fgh, unsigned short  &bgw, unsigned short  &bgh)
810
void calc_bgsize(uint16_t fgw, uint16_t  fgh, uint16_t  &bgw, uint16_t  &bgh)
810
{
811
{
811
  bgw=fgw/ASPECT+8;
812
  bgw=fgw/ASPECT+8;
812
  bgh=fgh/ASPECT+8;  
813
  bgh=fgh/ASPECT+8;  
Lines 821-837 Link Here
821
    return ; 
822
    return ; 
822
  }
823
  }
823
824
824
  unsigned short *new_fg,*new_bg;
825
  uint16_t *new_fg,*new_bg;
825
  new_fg=(unsigned short *)jmalloc(w*h*sizeof(short),"Map fg : resized");
826
  new_fg=(uint16_t *)jmalloc(w*h*sizeof(int16_t),"Map fg : resized");
826
  memset(new_fg,0,w*h*sizeof(short));
827
  memset(new_fg,0,w*h*sizeof(int16_t));
827
828
828
  int x,y,miny=(h<fg_height)? h : fg_height,minx=(w<fg_width)? w : fg_width;
829
  int x,y,miny=(h<fg_height)? h : fg_height,minx=(w<fg_width)? w : fg_width;
829
  
830
  
830
  unsigned short nbw,nbh;
831
  uint16_t nbw,nbh;
831
  calc_bgsize(w,h,nbw,nbh);
832
  calc_bgsize(w,h,nbw,nbh);
832
  
833
  
833
  new_bg=(unsigned short *)jmalloc((int)nbw*(int)nbh*sizeof(short),"map bg : resized");
834
  new_bg=(uint16_t *)jmalloc((int)nbw*(int)nbh*sizeof(int16_t),"map bg : resized");
834
  memset(new_bg,0,(int)nbw*(int)nbh*sizeof(short));
835
  memset(new_bg,0,(int)nbw*(int)nbh*sizeof(int16_t));
835
836
836
  for (y=0;y<miny;y++)
837
  for (y=0;y<miny;y++)
837
    for (x=0;x<minx;x++)
838
    for (x=0;x<minx;x++)
Lines 865-871 Link Here
865
  if (se)
866
  if (se)
866
  {
867
  {
867
    fp->seek(se->offset,0);
868
    fp->seek(se->offset,0);
868
    if (RC_type_size(fp->read_byte())!=size)
869
    if (RC_type_size(fp->read_uint8())!=size)
869
      return 0;
870
      return 0;
870
    else return 1;
871
    else return 1;
871
  } 
872
  } 
Lines 884-895 Link Here
884
  {
885
  {
885
    fp->seek(se->offset,0);
886
    fp->seek(se->offset,0);
886
    /******************************* Read debug info ******************************/
887
    /******************************* Read debug info ******************************/
887
    short old_tot=fp->read_short();  
888
    int16_t old_tot=fp->read_uint16();  
888
    unsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");    
889
    uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");    
889
    char old_name[150];      
890
    char old_name[150];      
890
    for (i=0;i<old_tot;i++)
891
    for (i=0;i<old_tot;i++)
891
    {
892
    {
892
      fp->read(old_name,fp->read_byte());    // read the name
893
      fp->read(old_name,fp->read_uint8());    // read the name
893
      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
894
      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
894
      {
895
      {
895
	if (!strcmp(old_name,object_names[j]))
896
	if (!strcmp(old_name,object_names[j]))
Lines 899-926 Link Here
899
900
900
901
901
    /***************************** Read state names *********************************/
902
    /***************************** Read state names *********************************/
902
    int old_stot=fp->read_short();
903
    int old_stot=fp->read_uint16();
903
    unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array");
904
    unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array");
904
    for (i=0;i<old_stot;i++)
905
    for (i=0;i<old_stot;i++)
905
    {
906
    {
906
      fp->read(old_name,fp->read_byte());
907
      fp->read(old_name,fp->read_uint8());
907
      s_remap[i]=stopped;           // non exsitant states get mapped into stopped state
908
      s_remap[i]=stopped;           // non exsitant states get mapped into stopped state
908
      for (j=0;j<MAX_STATE;j++)                  // see if old state exist now
909
      for (j=0;j<MAX_STATE;j++)                  // see if old state exist now
909
	if (!strcmp(state_names[j],old_name))
910
	if (!strcmp(state_names[j],old_name))
910
         s_remap[i]=j;
911
         s_remap[i]=j;
911
    }
912
    }
912
    total_objs=fp->read_long();    
913
    total_objs=fp->read_uint32();    
913
914
914
    se=sd->find("type");
915
    se=sd->find("type");
915
    if (se)
916
    if (se)
916
    {
917
    {
917
      fp->seek(se->offset,0);
918
      fp->seek(se->offset,0);
918
      last=NULL;
919
      last=NULL;
919
      if (fp->read_byte()==RC_S)    //  read type array, this should be type RC_S
920
      if (fp->read_uint8()==RC_16)    //  read type array, this should be type RC_16
920
      {
921
      {
921
	for (i=0;i<total_objs;i++)
922
	for (i=0;i<total_objs;i++)
922
	{
923
	{
923
	  ushort t=fp->read_short();
924
	  uint16_t t=fp->read_uint16();
924
	  game_object *p=new game_object(o_remap[t],1);
925
	  game_object *p=new game_object(o_remap[t],1);
925
	  clear_tmp();
926
	  clear_tmp();
926
	  if (!first) first=p; else last->next=p;
927
	  if (!first) first=p; else last->next=p;
Lines 932-943 Link Here
932
	if (se)
933
	if (se)
933
	{
934
	{
934
	  fp->seek(se->offset,0);
935
	  fp->seek(se->offset,0);
935
	  if (fp->read_byte()==RC_S)    //  read state array, this should be type RC_S
936
	  if (fp->read_uint8()==RC_16)    //  read state array, this should be type RC_16
936
	  {
937
	  {
937
	    game_object *l=first;
938
	    game_object *l=first;
938
	    for (i=0;i<total_objs;i++,l=l->next)
939
	    for (i=0;i<total_objs;i++,l=l->next)
939
	    {
940
	    {
940
	      character_state s=(character_state)s_remap[fp->read_short()];
941
	      character_state s=(character_state)s_remap[fp->read_uint16()];
941
	      if (l->otype!=0xffff)
942
	      if (l->otype!=0xffff)
942
	      {
943
	      {
943
		if (l->has_sequence((character_state)s))
944
		if (l->has_sequence((character_state)s))
Lines 963-969 Link Here
963
	  {
964
	  {
964
	    fp->seek(se->offset,0);
965
	    fp->seek(se->offset,0);
965
	    int t=object_descriptions[j].type;
966
	    int t=object_descriptions[j].type;
966
	    if (fp->read_byte()!=t)
967
	    if (fp->read_uint8()!=t)
967
	      dprintf("Warning : load level -> var '%s' size changed\n");
968
	      dprintf("Warning : load level -> var '%s' size changed\n");
968
	    else
969
	    else
969
	    {
970
	    {
Lines 972-980 Link Here
972
	      {	       
973
	      {	       
973
		switch (t)
974
		switch (t)
974
		{
975
		{
975
		  case RC_C : f->set_var(j,fp->read_byte()); break;
976
		  case RC_8 : f->set_var(j,fp->read_uint8()); break;
976
		  case RC_S : f->set_var(j,fp->read_short()); break;
977
		  case RC_16 : f->set_var(j,fp->read_uint16()); break;
977
		  case RC_L : f->set_var(j,fp->read_long()); break;
978
		  case RC_32 : f->set_var(j,fp->read_uint32()); break;
978
		}
979
		}
979
980
980
		// check to make sure the frame number is not out of bounds from the time
981
		// check to make sure the frame number is not out of bounds from the time
Lines 1016-1033 Link Here
1016
  else if (se)
1017
  else if (se)
1017
  {
1018
  {
1018
    fp->seek(se->offset,0);
1019
    fp->seek(se->offset,0);
1019
    short old_tot=fp->read_short();
1020
    int16_t old_tot=fp->read_uint16();
1020
    se=sd->find("describe_names");
1021
    se=sd->find("describe_names");
1021
    if (!se || !old_tot)
1022
    if (!se || !old_tot)
1022
      return ;
1023
      return ;
1023
1024
1024
    unsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");    
1025
    uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");    
1025
    unsigned short *o_backmap=(unsigned short *)jmalloc(total_objects*2,"obj remap array");    
1026
    uint16_t *o_backmap=(uint16_t *)jmalloc(total_objects*2,"obj remap array");    
1026
    memset(o_backmap,0xff,total_objects*2);
1027
    memset(o_backmap,0xff,total_objects*2);
1027
    char old_name[150];      
1028
    char old_name[150];      
1028
    for (i=0;i<old_tot;i++)
1029
    for (i=0;i<old_tot;i++)
1029
    {
1030
    {
1030
      fp->read(old_name,fp->read_byte());    // read the name
1031
      fp->read(old_name,fp->read_uint8());    // read the name
1031
      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
1032
      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
1032
      {
1033
      {
1033
	if (!strcmp(old_name,object_names[j]))
1034
	if (!strcmp(old_name,object_names[j]))
Lines 1040-1056 Link Here
1040
1041
1041
    se=sd->find("describe_states");
1042
    se=sd->find("describe_states");
1042
    if (!se) { jfree(o_remap); jfree(o_backmap); return ; }
1043
    if (!se) { jfree(o_remap); jfree(o_backmap); return ; }
1043
    short **s_remap=(short **)jmalloc(old_tot*sizeof(short *),"big state remap array");
1044
    int16_t **s_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big state remap array");
1044
    short *s_remap_totals=(short *)jmalloc(old_tot*sizeof(short),"big state rmp totals");
1045
    int16_t *s_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big state rmp totals");
1045
    fp->seek(se->offset,0);
1046
    fp->seek(se->offset,0);
1046
    int i=0;
1047
    int i=0;
1047
    for (;i<old_tot;i++)
1048
    for (;i<old_tot;i++)
1048
    {
1049
    {
1049
      short t=fp->read_short();
1050
      int16_t t=fp->read_uint16();
1050
      s_remap_totals[i]=t;
1051
      s_remap_totals[i]=t;
1051
      if (t)
1052
      if (t)
1052
      {
1053
      {
1053
        s_remap[i]=(short *)jmalloc(t*sizeof(short),"state remap");
1054
        s_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"state remap");
1054
	int j=0;
1055
	int j=0;
1055
	for (;j<t;j++)
1056
	for (;j<t;j++)
1056
	  *(s_remap[i]+j)=stopped;    // if no remap found, then go to stopped state
1057
	  *(s_remap[i]+j)=stopped;    // if no remap found, then go to stopped state
Lines 1060-1066 Link Here
1060
      int j=0;
1061
      int j=0;
1061
      for (;j<t;j++)
1062
      for (;j<t;j++)
1062
      {
1063
      {
1063
	fp->read(old_name,fp->read_byte());
1064
	fp->read(old_name,fp->read_uint8());
1064
	int new_type=o_remap[i];	
1065
	int new_type=o_remap[i];	
1065
	if (new_type<total_objects)     // make sure old object still exsist
1066
	if (new_type<total_objects)     // make sure old object still exsist
1066
	{
1067
	{
Lines 1075-1104 Link Here
1075
      }
1076
      }
1076
    }
1077
    }
1077
1078
1078
    short **v_remap=NULL;
1079
    int16_t **v_remap=NULL;
1079
    short *v_remap_totals=NULL;
1080
    int16_t *v_remap_totals=NULL;
1080
    int load_vars=1;
1081
    int load_vars=1;
1081
    se=sd->find("describe_lvars");
1082
    se=sd->find("describe_lvars");
1082
    if (se)
1083
    if (se)
1083
    {
1084
    {
1084
      v_remap=(short **)jmalloc(old_tot*sizeof(short *),"big var remap array");
1085
      v_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big var remap array");
1085
      v_remap_totals=(short *)jmalloc(old_tot*sizeof(short),"big var rmp totals");
1086
      v_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big var rmp totals");
1086
1087
1087
      fp->seek(se->offset,0);
1088
      fp->seek(se->offset,0);
1088
      int i=0;
1089
      int i=0;
1089
      for (;i<old_tot;i++)
1090
      for (;i<old_tot;i++)
1090
      {
1091
      {
1091
	short t=fp->read_short();
1092
	int16_t t=fp->read_uint16();
1092
	v_remap_totals[i]=t;
1093
	v_remap_totals[i]=t;
1093
	if (t)
1094
	if (t)
1094
	{
1095
	{
1095
	  v_remap[i]=(short *)jmalloc(t*sizeof(short),"var remap");
1096
	  v_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"var remap");
1096
	  memset(v_remap[i],0xff,t*sizeof(short));
1097
	  memset(v_remap[i],0xff,t*sizeof(int16_t));
1097
	} else { v_remap[i]=NULL; }
1098
	} else { v_remap[i]=NULL; }
1098
	int j=0;
1099
	int j=0;
1099
	for (;j<t;j++)
1100
	for (;j<t;j++)
1100
	{
1101
	{
1101
	  fp->read(old_name,fp->read_byte());
1102
	  fp->read(old_name,fp->read_uint8());
1102
	  int new_type=o_remap[i];
1103
	  int new_type=o_remap[i];
1103
	  if (new_type!=0xffff)        // make sure old object still exsist
1104
	  if (new_type!=0xffff)        // make sure old object still exsist
1104
	  {
1105
	  {
Lines 1120-1138 Link Here
1120
    se=sd->find("object_list");
1121
    se=sd->find("object_list");
1121
    if (se)
1122
    if (se)
1122
    {
1123
    {
1123
      total_objs=fp->read_long();    
1124
      total_objs=fp->read_uint32();    
1124
1125
1125
      se=sd->find("type");
1126
      se=sd->find("type");
1126
      if (se)
1127
      if (se)
1127
      {
1128
      {
1128
	fp->seek(se->offset,0);
1129
	fp->seek(se->offset,0);
1129
	last=NULL;
1130
	last=NULL;
1130
	if (fp->read_byte()==RC_S)    //  read type array, this should be type RC_S
1131
	if (fp->read_uint8()==RC_16)    //  read type array, this should be type RC_16
1131
	{
1132
	{
1132
	  int i=0;
1133
	  int i=0;
1133
	  for (;i<total_objs;i++)
1134
	  for (;i<total_objs;i++)
1134
	  {
1135
	  {
1135
	    ushort t=fp->read_short();
1136
	    uint16_t t=fp->read_uint16();
1136
	    game_object *p=new game_object(o_remap[t],1);
1137
	    game_object *p=new game_object(o_remap[t],1);
1137
	    clear_tmp();
1138
	    clear_tmp();
1138
	    if (!first) first=p; else last->next=p;
1139
	    if (!first) first=p; else last->next=p;
Lines 1143-1154 Link Here
1143
	  if (se)
1144
	  if (se)
1144
	  {
1145
	  {
1145
	    fp->seek(se->offset,0);
1146
	    fp->seek(se->offset,0);
1146
	    if (fp->read_byte()==RC_S)    //  read state array, this should be type RC_S
1147
	    if (fp->read_uint8()==RC_16)    //  read state array, this should be type RC_16
1147
	    {
1148
	    {
1148
	      game_object *l=first;
1149
	      game_object *l=first;
1149
	      for (i=0;i<total_objs;i++,l=l->next)
1150
	      for (i=0;i<total_objs;i++,l=l->next)
1150
	      {
1151
	      {
1151
		int st=fp->read_short();
1152
		int st=fp->read_uint16();
1152
		if (l->otype==0xffff)
1153
		if (l->otype==0xffff)
1153
		  l->state=stopped;
1154
		  l->state=stopped;
1154
		else
1155
		else
Lines 1171-1184 Link Here
1171
	    game_object *o=first;
1172
	    game_object *o=first;
1172
	    for (;o && !abort;o=o->next)
1173
	    for (;o && !abort;o=o->next)
1173
	    {
1174
	    {
1174
	      short ot=fp->read_short();
1175
	      int16_t ot=fp->read_uint16();
1175
	      int k=0;
1176
	      int k=0;
1176
	      for (;k<ot;k++)
1177
	      for (;k<ot;k++)
1177
	      {
1178
	      {
1178
		if (fp->read_byte()!=RC_L) abort=1;
1179
		if (fp->read_uint8()!=RC_32) abort=1;
1179
		else
1180
		else
1180
		{
1181
		{
1181
		  long v=fp->read_long();
1182
		  int32_t v=fp->read_uint32();
1182
		  if (o->otype!=0xffff)     // non-exstant object
1183
		  if (o->otype!=0xffff)     // non-exstant object
1183
		  {
1184
		  {
1184
		    int remap=*(v_remap[o_backmap[o->otype]]+k);
1185
		    int remap=*(v_remap[o_backmap[o->otype]]+k);
Lines 1206-1212 Link Here
1206
	    {
1207
	    {
1207
	      fp->seek(se->offset,0);
1208
	      fp->seek(se->offset,0);
1208
	      int t=object_descriptions[j].type;
1209
	      int t=object_descriptions[j].type;
1209
	      if (fp->read_byte()!=t)
1210
	      if (fp->read_uint8()!=t)
1210
	        dprintf("Warning : load level -> var '%s' size changed\n");
1211
	        dprintf("Warning : load level -> var '%s' size changed\n");
1211
	      else
1212
	      else
1212
	      {
1213
	      {
Lines 1215-1226 Link Here
1215
		{	       
1216
		{	       
1216
		  switch (t)
1217
		  switch (t)
1217
		  {
1218
		  {
1218
		    case RC_C : 
1219
		    case RC_8 : 
1219
		    { f->set_var(j,fp->read_byte()); } break;
1220
		    { f->set_var(j,fp->read_uint8()); } break;
1220
		    case RC_S : 
1221
		    case RC_16 : 
1221
		    { f->set_var(j,fp->read_short()); } break;
1222
		    { f->set_var(j,fp->read_uint16()); } break;
1222
		    case RC_L : 
1223
		    case RC_32 : 
1223
		    { f->set_var(j,fp->read_long()); } break;
1224
		    { f->set_var(j,fp->read_uint32()); } break;
1224
		  }
1225
		  }
1225
		  
1226
		  
1226
		  // check to make sure the frame number is not out of bounds from the time
1227
		  // check to make sure the frame number is not out of bounds from the time
Lines 1291-1297 Link Here
1291
  if (e)
1292
  if (e)
1292
  {
1293
  {
1293
    fp->seek(e->offset,0);
1294
    fp->seek(e->offset,0);
1294
    int len=fp->read_byte();   // read the length of the string
1295
    int len=fp->read_uint8();   // read the length of the string
1295
    first_name=(char *)jmalloc(len,"level first name");
1296
    first_name=(char *)jmalloc(len,"level first name");
1296
    fp->read(first_name,len);    // read the string
1297
    fp->read(first_name,len);    // read the string
1297
  } else
1298
  } else
Lines 1306-1317 Link Here
1306
  if (e)
1307
  if (e)
1307
  {    
1308
  {    
1308
    fp->seek(e->offset,0);
1309
    fp->seek(e->offset,0);
1309
    fg_width=fp->read_long();
1310
    fg_width=fp->read_uint32();
1310
    fg_height=fp->read_long();
1311
    fg_height=fp->read_uint32();
1311
    map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
1312
    map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
1312
    fp->read((char *)map_fg,2*fg_width*fg_height);
1313
    fp->read((char *)map_fg,2*fg_width*fg_height);
1313
    int t=fg_width*fg_height;
1314
    int t=fg_width*fg_height;
1314
    unsigned short *map=map_fg;
1315
    uint16_t *map=map_fg;
1315
    while (t) { *map=lstl(*map); map++; t--; }
1316
    while (t) { *map=lstl(*map); map++; t--; }
1316
  } else
1317
  } else
1317
  {
1318
  {
Lines 1324-1335 Link Here
1324
  if (e)
1325
  if (e)
1325
  {
1326
  {
1326
    fp->seek(e->offset,0);
1327
    fp->seek(e->offset,0);
1327
    bg_width=fp->read_long();
1328
    bg_width=fp->read_uint32();
1328
    bg_height=fp->read_long();
1329
    bg_height=fp->read_uint32();
1329
    map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
1330
    map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
1330
    fp->read((char *)map_bg,2*bg_width*bg_height);
1331
    fp->read((char *)map_bg,2*bg_width*bg_height);
1331
    int t=bg_width*bg_height;
1332
    int t=bg_width*bg_height;
1332
    unsigned short *map=map_bg;
1333
    uint16_t *map=map_bg;
1333
    while (t) { *map=lstl(*map); map++; t--; } 
1334
    while (t) { *map=lstl(*map); map++; t--; } 
1334
  } else
1335
  } else
1335
  {
1336
  {
Lines 1341-1347 Link Here
1341
  {
1342
  {
1342
    fg_width=bg_width;
1343
    fg_width=bg_width;
1343
    fg_height=bg_height;
1344
    fg_height=bg_height;
1344
    map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
1345
    map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
1345
    memset(map_fg,0,2*fg_width*fg_height);
1346
    memset(map_fg,0,2*fg_width*fg_height);
1346
  }
1347
  }
1347
1348
Lines 1349-1362 Link Here
1349
  {
1350
  {
1350
    bg_width=fg_width/8+8;
1351
    bg_width=fg_width/8+8;
1351
    bg_height=fg_height/8+8;
1352
    bg_height=fg_height/8+8;
1352
    map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
1353
    map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
1353
    memset(map_bg,0,2*bg_width*bg_height);
1354
    memset(map_bg,0,2*bg_width*bg_height);
1354
  }
1355
  }
1355
  stat_man->update(10);
1356
  stat_man->update(10);
1356
1357
1357
  /***************** Check map for non exsistant tiles **************************/
1358
  /***************** Check map for non exsistant tiles **************************/
1358
  long i,w;
1359
  int32_t i,w;
1359
  unsigned short *m;  
1360
  uint16_t *m;  
1360
  spec_entry *load_all=sd->find("player_info");
1361
  spec_entry *load_all=sd->find("player_info");
1361
  for (i=0,w=fg_width*fg_height,m=map_fg;i<w;i++,m++)
1362
  for (i=0,w=fg_width*fg_height,m=map_fg;i<w;i++,m++)
1362
  {
1363
  {
Lines 1568-1577 Link Here
1568
1569
1569
 
1570
 
1570
1571
1571
  // how many objects are we goint to save, use a long to specify how many
1572
  // how many objects are we goint to save, use a int32_t to specify how many
1572
  sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"object_list",NULL,4,0)); 
1573
  sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"object_list",NULL,4,0)); 
1573
  
1574
  
1574
  long t=0;
1575
  int32_t t=0;
1575
  object_node *o=save_list;
1576
  object_node *o=save_list;
1576
  for (;o;o=o->next)
1577
  for (;o;o=o->next)
1577
    t++;
1578
    t++;
Lines 1642-1649 Link Here
1642
  strftime(buf,80,"%T %A %B %d",localtime(&t));  
1643
  strftime(buf,80,"%T %A %B %d",localtime(&t));  
1643
  eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf);
1644
  eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf);
1644
1645
1645
  fp->write_short(i->width());
1646
  fp->write_uint16(i->width());
1646
  fp->write_short(i->height());
1647
  fp->write_uint16(i->height());
1647
  int y=0;
1648
  int y=0;
1648
  for (;y<i->height();y++)
1649
  for (;y<i->height();y++)
1649
    fp->write(i->scan_line(y),i->width());
1650
    fp->write(i->scan_line(y),i->width());
Lines 1653-1688 Link Here
1653
1654
1654
void level::write_player_info(bFILE *fp, object_node *save_list)
1655
void level::write_player_info(bFILE *fp, object_node *save_list)
1655
{
1656
{
1656
  long t=0;
1657
  int32_t t=0;
1657
  view *v=player_list;
1658
  view *v=player_list;
1658
  for (;v;v=v->next) t++; 
1659
  for (;v;v=v->next) t++; 
1659
  fp->write_long(t);
1660
  fp->write_uint32(t);
1660
1661
1661
  for (v=player_list;v;v=v->next)
1662
  for (v=player_list;v;v=v->next)
1662
    fp->write_long(object_to_number_in_list(v->focus,save_list));
1663
    fp->write_uint32(object_to_number_in_list(v->focus,save_list));
1663
1664
1664
  int tv=total_view_vars();
1665
  int tv=total_view_vars();
1665
  int i=0;
1666
  int i=0;
1666
  for (;i<tv;i++)
1667
  for (;i<tv;i++)
1667
  {
1668
  {
1668
    fp->write_byte(RC_L);
1669
    fp->write_uint8(RC_32);
1669
    for (v=player_list;v;v=v->next)
1670
    for (v=player_list;v;v=v->next)
1670
      fp->write_long(v->get_view_var_value(i));
1671
      fp->write_uint32(v->get_view_var_value(i));
1671
  }
1672
  }
1672
1673
1673
  fp->write_byte(RC_L);
1674
  fp->write_uint8(RC_32);
1674
  fp->write_long(rand_on);
1675
  fp->write_uint32(rand_on);
1675
1676
1676
  fp->write_byte(RC_L);
1677
  fp->write_uint8(RC_32);
1677
  fp->write_long(total_weapons);
1678
  fp->write_uint32(total_weapons);
1678
  for (v=player_list;v;v=v->next)
1679
  for (v=player_list;v;v=v->next)
1679
    for (i=0;i<total_weapons;i++)
1680
    for (i=0;i<total_weapons;i++)
1680
      fp->write_long(v->weapons[i]);
1681
      fp->write_uint32(v->weapons[i]);
1681
1682
1682
  for (v=player_list;v;v=v->next)
1683
  for (v=player_list;v;v=v->next)
1683
  {
1684
  {
1684
    int len=strlen(v->name)+1;
1685
    int len=strlen(v->name)+1;
1685
    fp->write_byte(len);
1686
    fp->write_uint8(len);
1686
    fp->write(v->name,len);
1687
    fp->write(v->name,len);
1687
  }
1688
  }
1688
}
1689
}
Lines 1724-1735 Link Here
1724
      delete v;
1725
      delete v;
1725
    }
1726
    }
1726
1727
1727
    long total_players=fp->read_long();
1728
    int32_t total_players=fp->read_uint32();
1728
    view *last=NULL;
1729
    view *last=NULL;
1729
    int i=0;
1730
    int i=0;
1730
    for (;i<total_players;i++)    
1731
    for (;i<total_players;i++)    
1731
    {
1732
    {
1732
      game_object *o=number_to_object_in_list(fp->read_long(),save_list);
1733
      game_object *o=number_to_object_in_list(fp->read_uint32(),save_list);
1733
      v=new view(o,NULL,0);
1734
      v=new view(o,NULL,0);
1734
      if (o) o->set_controller(v);
1735
      if (o) o->set_controller(v);
1735
      if (player_list)
1736
      if (player_list)
Lines 1748-1757 Link Here
1748
      if (se)
1749
      if (se)
1749
      {
1750
      {
1750
	fp->seek(se->offset,0);
1751
	fp->seek(se->offset,0);
1751
	if (fp->read_byte()==RC_L)
1752
	if (fp->read_uint8()==RC_32)
1752
	{
1753
	{
1753
	  for (v=player_list;v;v=v->next)
1754
	  for (v=player_list;v;v=v->next)
1754
            v->set_view_var_value(i,fp->read_long());
1755
            v->set_view_var_value(i,fp->read_uint32());
1755
	}
1756
	}
1756
      } else 
1757
      } else 
1757
      {
1758
      {
Lines 1764-1786 Link Here
1764
    if (se)
1765
    if (se)
1765
    {
1766
    {
1766
      fp->seek(se->offset,0);
1767
      fp->seek(se->offset,0);
1767
      if (fp->read_byte()==RC_L)
1768
      if (fp->read_uint8()==RC_32)
1768
        rand_on=fp->read_long();
1769
        rand_on=fp->read_uint32();
1769
    } else rand_on=0;
1770
    } else rand_on=0;
1770
1771
1771
    se=sd->find("weapon_array");
1772
    se=sd->find("weapon_array");
1772
    if (se)
1773
    if (se)
1773
    {
1774
    {
1774
      fp->seek(se->offset,0);
1775
      fp->seek(se->offset,0);
1775
      if (fp->read_byte()==RC_L)
1776
      if (fp->read_uint8()==RC_32)
1776
      {
1777
      {
1777
	long m=fp->read_long();  // read how many weapons exsisted when last saved
1778
	int32_t m=fp->read_uint32();  // read how many weapons exsisted when last saved
1778
	int i;
1779
	int i;
1779
	for (v=player_list;v;v=v->next)	  
1780
	for (v=player_list;v;v=v->next)	  
1780
	{
1781
	{
1781
	  for (i=0;i<m;i++)
1782
	  for (i=0;i<m;i++)
1782
	  {
1783
	  {
1783
	    long x=fp->read_long();
1784
	    int32_t x=fp->read_uint32();
1784
	    if (i<total_weapons)
1785
	    if (i<total_weapons)
1785
	    {
1786
	    {
1786
	      v->weapons[i]=x;
1787
	      v->weapons[i]=x;
Lines 1793-1800 Link Here
1793
    { 
1794
    { 
1794
      for (v=player_list;v;v=v->next)	  
1795
      for (v=player_list;v;v=v->next)	  
1795
      {
1796
      {
1796
	memset(v->last_weapons,0xff,total_weapons*sizeof(long));
1797
	memset(v->last_weapons,0xff,total_weapons*sizeof(int32_t));
1797
	memset(v->weapons,0xff,total_weapons*sizeof(long));
1798
	memset(v->weapons,0xff,total_weapons*sizeof(int32_t));
1798
      }
1799
      }
1799
    }
1800
    }
1800
1801
Lines 1804-1810 Link Here
1804
      fp->seek(se->offset,0);
1805
      fp->seek(se->offset,0);
1805
      for (v=player_list;v;v=v->next)	  
1806
      for (v=player_list;v;v=v->next)	  
1806
      {
1807
      {
1807
	uchar len=fp->read_byte();
1808
	uint8_t len=fp->read_uint8();
1808
	fp->read(v->name,len);
1809
	fp->read(v->name,len);
1809
      }
1810
      }
1810
    }
1811
    }
Lines 1852-1863 Link Here
1852
{
1853
{
1853
  // record information in the file about what the data structures look like
1854
  // record information in the file about what the data structures look like
1854
  // right now, so if they change later, they don't get get screwed up
1855
  // right now, so if they change later, they don't get get screwed up
1855
  fp->write_short(total_objects);   // mark how many objects we know about right now  
1856
  fp->write_uint16(total_objects);   // mark how many objects we know about right now  
1856
1857
1857
  int i=0;
1858
  int i=0;
1858
  for (;i<total_objects;i++)   // loop through all the object types we know of
1859
  for (;i<total_objects;i++)   // loop through all the object types we know of
1859
  {    
1860
  {    
1860
    fp->write_byte(strlen(object_names[i])+1);                    // sizeof name    
1861
    fp->write_uint8(strlen(object_names[i])+1);                    // sizeof name    
1861
    fp->write(object_names[i],strlen(object_names[i])+1);      // write object name
1862
    fp->write(object_names[i],strlen(object_names[i])+1);      // write object name
1862
  }
1863
  }
1863
    
1864
    
Lines 1869-1881 Link Here
1869
    int j=0;
1870
    int j=0;
1870
    for (;j<figures[i]->ts;j++)
1871
    for (;j<figures[i]->ts;j++)
1871
      if (figures[i]->seq[j]) total++;
1872
      if (figures[i]->seq[j]) total++;
1872
    fp->write_short(total);
1873
    fp->write_uint16(total);
1873
1874
1874
    for (j=0;j<figures[i]->ts;j++)
1875
    for (j=0;j<figures[i]->ts;j++)
1875
      if (figures[i]->seq[j])
1876
      if (figures[i]->seq[j])
1876
      {
1877
      {
1877
	char *state_name=lstring_value(symbol_name(figures[i]->seq_syms[j]));
1878
	char *state_name=lstring_value(symbol_name(figures[i]->seq_syms[j]));
1878
	fp->write_byte(strlen(state_name)+1);
1879
	fp->write_uint8(strlen(state_name)+1);
1879
	fp->write(state_name,strlen(state_name)+1);
1880
	fp->write(state_name,strlen(state_name)+1);
1880
      }
1881
      }
1881
  }
1882
  }
Lines 1884-1890 Link Here
1884
  // write object lvar names
1885
  // write object lvar names
1885
  for (i=0;i<total_objects;i++)
1886
  for (i=0;i<total_objects;i++)
1886
  {
1887
  {
1887
    fp->write_short(figures[i]->tv);
1888
    fp->write_uint16(figures[i]->tv);
1888
    int j,x;
1889
    int j,x;
1889
    
1890
    
1890
    for (x=0;x<figures[i]->tv;x++)
1891
    for (x=0;x<figures[i]->tv;x++)
Lines 1894-1959 Link Here
1894
        if (figures[i]->vars[j] && figures[i]->var_index[j]==x)
1895
        if (figures[i]->vars[j] && figures[i]->var_index[j]==x)
1895
	{
1896
	{
1896
	  char *var_name=lstring_value(symbol_name(figures[i]->vars[j]));
1897
	  char *var_name=lstring_value(symbol_name(figures[i]->vars[j]));
1897
	  fp->write_byte(strlen(var_name)+1);
1898
	  fp->write_uint8(strlen(var_name)+1);
1898
	  fp->write(var_name,strlen(var_name)+1);
1899
	  fp->write(var_name,strlen(var_name)+1);
1899
	}
1900
	}
1900
      }
1901
      }
1901
    }
1902
    }
1902
  }
1903
  }
1903
  
1904
  
1904
  long t=0;
1905
  int32_t t=0;
1905
  object_node *o=save_list;
1906
  object_node *o=save_list;
1906
  for (;o;o=o->next) t++;
1907
  for (;o;o=o->next) t++;
1907
  fp->write_long(t);
1908
  fp->write_uint32(t);
1908
1909
1909
1910
1910
  fp->write_byte(RC_S);                                    // save type info for each record
1911
  fp->write_uint8(RC_16);                                    // save type info for each record
1911
  for (o=save_list;o;o=o->next) fp->write_short(o->me->type());    
1912
  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->type());    
1912
1913
1913
  fp->write_byte(RC_S);                                    // save state info for each record
1914
  fp->write_uint8(RC_16);                                    // save state info for each record
1914
  for (o=save_list;o;o=o->next) fp->write_short(o->me->reduced_state());
1915
  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->reduced_state());
1915
1916
1916
  for (o=save_list;o;o=o->next)                            // save lvars
1917
  for (o=save_list;o;o=o->next)                            // save lvars
1917
  {
1918
  {
1918
    fp->write_short(figures[o->me->otype]->tv);
1919
    fp->write_uint16(figures[o->me->otype]->tv);
1919
    for (i=0;i<figures[o->me->otype]->tv;i++) 
1920
    for (i=0;i<figures[o->me->otype]->tv;i++) 
1920
    {
1921
    {
1921
      fp->write_byte(RC_L);                           // for now the only type allowed is long
1922
      fp->write_uint8(RC_32);                           // for now the only type allowed is int32_t
1922
      fp->write_long(o->me->lvars[i]);
1923
      fp->write_uint32(o->me->lvars[i]);
1923
    }
1924
    }
1924
  }
1925
  }
1925
1926
1926
  for (i=0;i<default_simple.total_vars();i++)
1927
  for (i=0;i<default_simple.total_vars();i++)
1927
  {
1928
  {
1928
    int t=object_descriptions[i].type;
1929
    int t=object_descriptions[i].type;
1929
    fp->write_byte(t);
1930
    fp->write_uint8(t);
1930
    for (o=save_list;o;o=o->next)
1931
    for (o=save_list;o;o=o->next)
1931
    {
1932
    {
1932
      switch (t)
1933
      switch (t)
1933
      { 	
1934
      { 	
1934
	case RC_C :
1935
	case RC_8 :
1935
	{ fp->write_byte(o->me->get_var(i)); } break;
1936
	{ fp->write_uint8(o->me->get_var(i)); } break;
1936
	case RC_S :
1937
	case RC_16 :
1937
	{ fp->write_short(o->me->get_var(i)); } break;
1938
	{ fp->write_uint16(o->me->get_var(i)); } break;
1938
	case RC_L :
1939
	case RC_32 :
1939
	{ fp->write_long(o->me->get_var(i)); } break;
1940
	{ fp->write_uint32(o->me->get_var(i)); } break;
1940
      }
1941
      }
1941
    }
1942
    }
1942
  }
1943
  }
1943
}
1944
}
1944
1945
1945
1946
1946
long level::total_object_links(object_node *list)
1947
int32_t level::total_object_links(object_node *list)
1947
{
1948
{
1948
  long tl=0;
1949
  int32_t tl=0;
1949
  for (object_node *o=list;o;o=o->next)
1950
  for (object_node *o=list;o;o=o->next)
1950
    tl+=o->me->total_objects();
1951
    tl+=o->me->total_objects();
1951
  return tl;
1952
  return tl;
1952
}
1953
}
1953
1954
1954
long level::total_light_links(object_node *list)
1955
int32_t level::total_light_links(object_node *list)
1955
{
1956
{
1956
  long tl=0;
1957
  int32_t tl=0;
1957
  for (object_node *o=list;o;o=o->next)
1958
  for (object_node *o=list;o;o=o->next)
1958
    tl+=o->me->total_lights();
1959
    tl+=o->me->total_lights();
1959
  return tl;
1960
  return tl;
Lines 1961-1968 Link Here
1961
1962
1962
void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list)
1963
void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list)
1963
{
1964
{
1964
  fp->write_byte(RC_L);  
1965
  fp->write_uint8(RC_32);  
1965
  fp->write_long(total_object_links(save_list));
1966
  fp->write_uint32(total_object_links(save_list));
1966
1967
1967
  int x=1;
1968
  int x=1;
1968
  object_node *o=save_list;
1969
  object_node *o=save_list;
Lines 1972-1988 Link Here
1972
    int i=0;
1973
    int i=0;
1973
    for (;i<o->me->total_objects();i++)
1974
    for (;i<o->me->total_objects();i++)
1974
    {
1975
    {
1975
      fp->write_long(x);
1976
      fp->write_uint32(x);
1976
      long x=object_to_number_in_list(o->me->get_object(i),save_list); 
1977
      int32_t x=object_to_number_in_list(o->me->get_object(i),save_list); 
1977
      if (x)
1978
      if (x)
1978
        fp->write_long(x);
1979
        fp->write_uint32(x);
1979
      else                            // save links to excluded items as negative
1980
      else                            // save links to excluded items as negative
1980
        fp->write_long((long)(-(object_to_number_in_list(o->me,exclude_list))));
1981
        fp->write_uint32((int32_t)(-(object_to_number_in_list(o->me,exclude_list))));
1981
    }
1982
    }
1982
  }
1983
  }
1983
1984
1984
  fp->write_byte(RC_L);  
1985
  fp->write_uint8(RC_32);  
1985
  fp->write_long(total_light_links(save_list));
1986
  fp->write_uint32(total_light_links(save_list));
1986
1987
1987
  x=1;
1988
  x=1;
1988
  for (o=save_list;o;o=o->next,x++)
1989
  for (o=save_list;o;o=o->next,x++)
Lines 1990-1997 Link Here
1990
    int i=0;
1991
    int i=0;
1991
    for (;i<o->me->total_lights();i++)
1992
    for (;i<o->me->total_lights();i++)
1992
    {
1993
    {
1993
      fp->write_long(x);
1994
      fp->write_uint32(x);
1994
      fp->write_long(light_to_number(o->me->get_light(i)));
1995
      fp->write_uint32(light_to_number(o->me->get_light(i)));
1995
    }
1996
    }
1996
  }
1997
  }
1997
1998
Lines 2005-2018 Link Here
2005
  if (se)
2006
  if (se)
2006
  {
2007
  {
2007
    fp->seek(se->offset,0);
2008
    fp->seek(se->offset,0);
2008
    if (fp->read_byte()==RC_L)
2009
    if (fp->read_uint8()==RC_32)
2009
    {
2010
    {
2010
      long t=fp->read_long();
2011
      int32_t t=fp->read_uint32();
2011
      while (t)
2012
      while (t)
2012
      {
2013
      {
2013
	long x1=fp->read_long();
2014
	int32_t x1=fp->read_uint32();
2014
	CONDITION(x1>=0,"expected x1 for object link to be > 0\n");
2015
	CONDITION(x1>=0,"expected x1 for object link to be > 0\n");
2015
	long x2=fp->read_long();
2016
	int32_t x2=fp->read_uint32();
2016
	game_object *p,*q=number_to_object_in_list(x1,save_list);
2017
	game_object *p,*q=number_to_object_in_list(x1,save_list);
2017
	if (x2>0)
2018
	if (x2>0)
2018
	  p=number_to_object_in_list(x2,save_list);
2019
	  p=number_to_object_in_list(x2,save_list);
Lines 2030-2042 Link Here
2030
  if (se)
2031
  if (se)
2031
  {
2032
  {
2032
    fp->seek(se->offset,0);
2033
    fp->seek(se->offset,0);
2033
    if (fp->read_byte()==RC_L)
2034
    if (fp->read_uint8()==RC_32)
2034
    {
2035
    {
2035
      long t=fp->read_long();
2036
      int32_t t=fp->read_uint32();
2036
      while (t)
2037
      while (t)
2037
      {
2038
      {
2038
	long x1=fp->read_long();
2039
	int32_t x1=fp->read_uint32();
2039
	long x2=fp->read_long();
2040
	int32_t x2=fp->read_uint32();
2040
	game_object *p=number_to_object_in_list(x1,save_list);
2041
	game_object *p=number_to_object_in_list(x1,save_list);
2041
	if (p)
2042
	if (p)
2042
	  p->add_light(number_to_light(x2));
2043
	  p->add_light(number_to_light(x2));
Lines 2052-2085 Link Here
2052
void level::write_options(bFILE *fp)
2053
void level::write_options(bFILE *fp)
2053
{
2054
{
2054
  // save background scroll rate
2055
  // save background scroll rate
2055
  fp->write_byte(RC_L);
2056
  fp->write_uint8(RC_32);
2056
  fp->write_long(bg_xmul);
2057
  fp->write_uint32(bg_xmul);
2057
  fp->write_long(bg_xdiv);
2058
  fp->write_uint32(bg_xdiv);
2058
  fp->write_long(bg_ymul);
2059
  fp->write_uint32(bg_ymul);
2059
  fp->write_long(bg_ydiv);
2060
  fp->write_uint32(bg_ydiv);
2060
2061
2061
  fp->write_byte(RC_L);
2062
  fp->write_uint8(RC_32);
2062
  int ta=0;
2063
  int ta=0;
2063
  area_controller *a=area_list;
2064
  area_controller *a=area_list;
2064
  for (;a;a=a->next) ta++;
2065
  for (;a;a=a->next) ta++;
2065
  fp->write_long(ta);
2066
  fp->write_uint32(ta);
2066
  for (a=area_list;a;a=a->next)
2067
  for (a=area_list;a;a=a->next)
2067
  {
2068
  {
2068
    fp->write_long(a->x);
2069
    fp->write_uint32(a->x);
2069
    fp->write_long(a->y);
2070
    fp->write_uint32(a->y);
2070
    fp->write_long(a->w);
2071
    fp->write_uint32(a->w);
2071
    fp->write_long(a->h);
2072
    fp->write_uint32(a->h);
2072
    fp->write_long(a->active);
2073
    fp->write_uint32(a->active);
2073
2074
2074
    fp->write_long(a->ambient);
2075
    fp->write_uint32(a->ambient);
2075
    fp->write_long(a->view_xoff);
2076
    fp->write_uint32(a->view_xoff);
2076
    fp->write_long(a->view_yoff);
2077
    fp->write_uint32(a->view_yoff);
2077
    fp->write_long(a->ambient_speed);
2078
    fp->write_uint32(a->ambient_speed);
2078
    fp->write_long(a->view_xoff_speed);
2079
    fp->write_uint32(a->view_xoff_speed);
2079
    fp->write_long(a->view_yoff_speed);
2080
    fp->write_uint32(a->view_yoff_speed);
2080
  }
2081
  }
2081
  fp->write_byte(RC_L);
2082
  fp->write_uint8(RC_32);
2082
  fp->write_long(tick_counter());
2083
  fp->write_uint32(tick_counter());
2083
}
2084
}
2084
2085
2085
void level::load_options(spec_directory *sd, bFILE *fp)
2086
void level::load_options(spec_directory *sd, bFILE *fp)
Lines 2088-2101 Link Here
2088
  if (se)
2089
  if (se)
2089
  {
2090
  {
2090
    fp->seek(se->offset,0);
2091
    fp->seek(se->offset,0);
2091
    if (fp->read_byte()!=RC_L)
2092
    if (fp->read_uint8()!=RC_32)
2092
    { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
2093
    { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
2093
    else
2094
    else
2094
    {
2095
    {
2095
      bg_xmul=fp->read_long();
2096
      bg_xmul=fp->read_uint32();
2096
      bg_xdiv=fp->read_long();
2097
      bg_xdiv=fp->read_uint32();
2097
      bg_ymul=fp->read_long();
2098
      bg_ymul=fp->read_uint32();
2098
      bg_ydiv=fp->read_long();
2099
      bg_ydiv=fp->read_uint32();
2099
    }
2100
    }
2100
  } else { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
2101
  } else { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
2101
2102
Lines 2103-2131 Link Here
2103
  if (se)
2104
  if (se)
2104
  {
2105
  {
2105
    fp->seek(se->offset,0);
2106
    fp->seek(se->offset,0);
2106
    if (fp->read_byte()==RC_L)
2107
    if (fp->read_uint8()==RC_32)
2107
    {
2108
    {
2108
      area_controller *l=NULL,*p;
2109
      area_controller *l=NULL,*p;
2109
      long ta=fp->read_long();
2110
      int32_t ta=fp->read_uint32();
2110
      int i=0;
2111
      int i=0;
2111
      for (;i<ta;i++)
2112
      for (;i<ta;i++)
2112
      {
2113
      {
2113
	long x,y,w,h;
2114
	int32_t x,y,w,h;
2114
	x=fp->read_long();
2115
	x=fp->read_uint32();
2115
	y=fp->read_long();
2116
	y=fp->read_uint32();
2116
	w=fp->read_long();
2117
	w=fp->read_uint32();
2117
	h=fp->read_long();	
2118
	h=fp->read_uint32();	
2118
	p=new area_controller(x,y,w,h,NULL);
2119
	p=new area_controller(x,y,w,h,NULL);
2119
	if (l) l->next=p;
2120
	if (l) l->next=p;
2120
	else area_list=p;
2121
	else area_list=p;
2121
	l=p;
2122
	l=p;
2122
	p->active=fp->read_long();
2123
	p->active=fp->read_uint32();
2123
	p->ambient=fp->read_long();
2124
	p->ambient=fp->read_uint32();
2124
	p->view_xoff=fp->read_long();
2125
	p->view_xoff=fp->read_uint32();
2125
	p->view_yoff=fp->read_long();
2126
	p->view_yoff=fp->read_uint32();
2126
	p->ambient_speed=fp->read_long();
2127
	p->ambient_speed=fp->read_uint32();
2127
	p->view_xoff_speed=fp->read_long();
2128
	p->view_xoff_speed=fp->read_uint32();
2128
	p->view_yoff_speed=fp->read_long();
2129
	p->view_yoff_speed=fp->read_uint32();
2129
      }
2130
      }
2130
    }
2131
    }
2131
  }
2132
  }
Lines 2134-2141 Link Here
2134
  if (se)
2135
  if (se)
2135
  {
2136
  {
2136
    fp->seek(se->offset,0);
2137
    fp->seek(se->offset,0);
2137
    if (fp->read_byte()==RC_L)    
2138
    if (fp->read_uint8()==RC_32)    
2138
      set_tick_counter(fp->read_long());
2139
      set_tick_counter(fp->read_uint32());
2139
    else set_tick_counter(0);
2140
    else set_tick_counter(0);
2140
  } else set_tick_counter(0);
2141
  } else set_tick_counter(0);
2141
}
2142
}
Lines 2202-2209 Link Here
2202
				dprintf("unable to open backup file %s\n", bkname );
2203
				dprintf("unable to open backup file %s\n", bkname );
2203
			else
2204
			else
2204
			{
2205
			{
2205
				long size = fp->file_size();
2206
				int32_t size = fp->file_size();
2206
				uchar *buf = (uchar *)jmalloc(0x1000,"copy buf");
2207
				uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf");
2207
				int tr = 1;
2208
				int tr = 1;
2208
				while( size && tr )
2209
				while( size && tr )
2209
				{
2210
				{
Lines 2246-2268 Link Here
2246
		{
2247
		{
2247
			if( first_name )
2248
			if( first_name )
2248
			{
2249
			{
2249
				fp->write_byte( strlen( first_name ) + 1 );
2250
				fp->write_uint8( strlen( first_name ) + 1 );
2250
				fp->write( first_name, strlen( first_name ) + 1 );
2251
				fp->write( first_name, strlen( first_name ) + 1 );
2251
			}
2252
			}
2252
			else
2253
			else
2253
			{
2254
			{
2254
				fp->write_byte( 1 );
2255
				fp->write_uint8( 1 );
2255
				fp->write_byte( 0 );
2256
				fp->write_uint8( 0 );
2256
			}
2257
			}
2257
2258
2258
			fp->write_long( fg_width );
2259
			fp->write_uint32( fg_width );
2259
			fp->write_long( fg_height );
2260
			fp->write_uint32( fg_height );
2260
2261
2261
			int t  = fg_width * fg_height;
2262
			int t  = fg_width * fg_height;
2262
			ushort *rm = map_fg;
2263
			uint16_t *rm = map_fg;
2263
			for (;t;t--,rm++)
2264
			for (;t;t--,rm++)
2264
			{
2265
			{
2265
				ushort x = *rm;
2266
				uint16_t x = *rm;
2266
				x = lstl(x);            // convert to intel endianess
2267
				x = lstl(x);            // convert to intel endianess
2267
				*rm = x;
2268
				*rm = x;
2268
			}
2269
			}
Lines 2272-2290 Link Here
2272
			rm = map_fg;
2273
			rm = map_fg;
2273
			for (;t;t--,rm++)
2274
			for (;t;t--,rm++)
2274
			{
2275
			{
2275
				ushort x = *rm;
2276
				uint16_t x = *rm;
2276
				x = lstl( x );            // convert to intel endianess
2277
				x = lstl( x );            // convert to intel endianess
2277
				*rm = x;
2278
				*rm = x;
2278
			}
2279
			}
2279
2280
2280
			fp->write_long( bg_width );
2281
			fp->write_uint32( bg_width );
2281
			fp->write_long( bg_height );
2282
			fp->write_uint32( bg_height );
2282
			t = bg_width * bg_height;
2283
			t = bg_width * bg_height;
2283
			rm = map_bg;
2284
			rm = map_bg;
2284
2285
2285
			for (;t;t--,rm++)
2286
			for (;t;t--,rm++)
2286
			{
2287
			{
2287
				ushort x=*rm;
2288
				uint16_t x=*rm;
2288
				x = lstl( x );		// convert to intel endianess
2289
				x = lstl( x );		// convert to intel endianess
2289
				*rm = x;
2290
				*rm = x;
2290
			}
2291
			}
Lines 2295-2301 Link Here
2295
2296
2296
			for (;t;t--,rm++)
2297
			for (;t;t--,rm++)
2297
			{
2298
			{
2298
				ushort x = *rm;
2299
				uint16_t x = *rm;
2299
				x = lstl( x );		// convert to intel endianess
2300
				x = lstl( x );		// convert to intel endianess
2300
				*rm = x;
2301
				*rm = x;
2301
			}
2302
			}
Lines 2366-2378 Link Here
2366
  fg_height=height;
2367
  fg_height=height;
2367
  calc_bgsize(fg_width,fg_height,bg_width,bg_height);
2368
  calc_bgsize(fg_width,fg_height,bg_width,bg_height);
2368
  
2369
  
2369
  map_bg=(unsigned short *)jmalloc(sizeof(short)*bg_width*bg_height,"map bg");
2370
  map_bg=(uint16_t *)jmalloc(sizeof(int16_t)*bg_width*bg_height,"map bg");
2370
  map_fg=(unsigned short *)jmalloc(sizeof(short)*fg_width*fg_height,"map fg");
2371
  map_fg=(uint16_t *)jmalloc(sizeof(int16_t)*fg_width*fg_height,"map fg");
2371
2372
2372
2373
2373
2374
2374
  memset(map_bg,0,sizeof(short)*bg_width*bg_height);
2375
  memset(map_bg,0,sizeof(int16_t)*bg_width*bg_height);
2375
  memset(map_fg,0,sizeof(short)*fg_width*fg_height);
2376
  memset(map_fg,0,sizeof(int16_t)*fg_width*fg_height);
2376
2377
2377
  int i;  
2378
  int i;  
2378
  for (i=0;i<fg_width;i++)
2379
  for (i=0;i<fg_width;i++)
Lines 2575-2583 Link Here
2575
  return me;
2576
  return me;
2576
}
2577
}
2577
2578
2578
game_object *level::find_object(long x, long y)
2579
game_object *level::find_object(int32_t x, int32_t y)
2579
{
2580
{
2580
  long x1,y1,x2,y2;  
2581
  int32_t x1,y1,x2,y2;  
2581
  game_object *o=first;
2582
  game_object *o=first;
2582
  for (;o;o=o->next)
2583
  for (;o;o=o->next)
2583
  {
2584
  {
Lines 2588-2610 Link Here
2588
  return NULL; 
2589
  return NULL; 
2589
}
2590
}
2590
2591
2591
long last_tile_hit_x,last_tile_hit_y;
2592
int32_t last_tile_hit_x,last_tile_hit_y;
2592
2593
2593
#define remapx(x) (x==0 ? -1 : x==tl-1 ? tl+1 : x)
2594
#define remapx(x) (x==0 ? -1 : x==tl-1 ? tl+1 : x)
2594
#define remapy(y) (y==0 ? -1 : y==th-1 ? th+1 : y)
2595
#define remapy(y) (y==0 ? -1 : y==th-1 ? th+1 : y)
2595
2596
2596
void level::foreground_intersect(long x1, long y1, long &x2, long &y2)
2597
void level::foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
2597
{
2598
{
2598
/*  if (x1==x2)
2599
/*  if (x1==x2)
2599
  { vforeground_intersect(x1,y1,y2);
2600
  { vforeground_intersect(x1,y1,y2);
2600
    return ;
2601
    return ;
2601
  }  */
2602
  }  */
2602
2603
2603
  long tl=the_game->ftile_width(),th=the_game->ftile_height(),
2604
  int32_t tl=the_game->ftile_width(),th=the_game->ftile_height(),
2604
    j,
2605
    j,
2605
    xp1,yp1,xp2,yp2,    // starting and ending points of block line segment 
2606
    xp1,yp1,xp2,yp2,    // starting and ending points of block line segment 
2606
    swap;               // temp var
2607
    swap;               // temp var
2607
  long blockx1,blocky1,blockx2,blocky2,block,bx,by;
2608
  int32_t blockx1,blocky1,blockx2,blocky2,block,bx,by;
2608
  point_list *block_list;
2609
  point_list *block_list;
2609
  unsigned char *bdat;
2610
  unsigned char *bdat;
2610
2611
Lines 2641-2647 Link Here
2641
        unsigned char total=block_list->tot;
2642
        unsigned char total=block_list->tot;
2642
        bdat=block_list->data;
2643
        bdat=block_list->data;
2643
        unsigned char *ins=f->points->inside;
2644
        unsigned char *ins=f->points->inside;
2644
	long xo=bx*tl,yo=by*th;
2645
	int32_t xo=bx*tl,yo=by*th;
2645
        for (j=0;j<total-1;j++,ins++)
2646
        for (j=0;j<total-1;j++,ins++)
2646
        {
2647
        {
2647
          // find the starting and ending points for this segment
2648
          // find the starting and ending points for this segment
Lines 2655-2661 Link Here
2655
	  yp2=yo+remapy(bdat[1]);
2656
	  yp2=yo+remapy(bdat[1]);
2656
2657
2657
2658
2658
	  long ox2=x2,oy2=y2;
2659
	  int32_t ox2=x2,oy2=y2;
2659
          if (*ins)	  
2660
          if (*ins)	  
2660
            setback_intersect(x1,y1,x2,y2,xp1,yp1,xp2,yp2,1); 
2661
            setback_intersect(x1,y1,x2,y2,xp1,yp1,xp2,yp2,1); 
2661
          else
2662
          else
Lines 2673-2684 Link Here
2673
}
2674
}
2674
2675
2675
2676
2676
void level::vforeground_intersect(long x1, long y1, long &y2)
2677
void level::vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2)
2677
{
2678
{
2678
  long tl=f_wid,th=f_hi,
2679
  int32_t tl=f_wid,th=f_hi,
2679
    j,
2680
    j,
2680
    xp1,yp1,xp2,yp2;    // starting and ending points of block line segment temp var
2681
    xp1,yp1,xp2,yp2;    // starting and ending points of block line segment temp var
2681
  long blocky1,blocky2,block,bx,by,checkx;
2682
  int32_t blocky1,blocky2,block,bx,by,checkx;
2682
  point_list *block_list;
2683
  point_list *block_list;
2683
  unsigned char *bdat;
2684
  unsigned char *bdat;
2684
2685
Lines 2716-2722 Link Here
2716
    bdat=block_list->data;
2717
    bdat=block_list->data;
2717
    unsigned char *ins=f->points->inside;
2718
    unsigned char *ins=f->points->inside;
2718
2719
2719
//    long xo=bx*tl,yo=by*th;
2720
//    int32_t xo=bx*tl,yo=by*th;
2720
    for (j=0;j<total-1;j++,ins++)
2721
    for (j=0;j<total-1;j++,ins++)
2721
    {
2722
    {
2722
      // find the starting and ending points for this segment
2723
      // find the starting and ending points for this segment
Lines 2730-2736 Link Here
2730
      yp2=remapy(bdat[1]);
2731
      yp2=remapy(bdat[1]);
2731
2732
2732
2733
2733
      long oy2=y2;
2734
      int32_t oy2=y2;
2734
      if (*ins)	  
2735
      if (*ins)	  
2735
        setback_intersect(checkx,y1,checkx,y2,xp1,yp1,xp2,yp2,1); 
2736
        setback_intersect(checkx,y1,checkx,y2,xp1,yp1,xp2,yp2,1); 
2736
      else
2737
      else
Lines 2747-2753 Link Here
2747
2748
2748
2749
2749
2750
2750
void level::send_signal(long signal)
2751
void level::send_signal(int32_t signal)
2751
{
2752
{
2752
  if (signal)   // signal 0 is never sent!
2753
  if (signal)   // signal 0 is never sent!
2753
  {
2754
  {
Lines 2760-2766 Link Here
2760
2761
2761
int level::crush(game_object *by_who, int xamount, int yamount)
2762
int level::crush(game_object *by_who, int xamount, int yamount)
2762
{
2763
{
2763
  long xv,yv,crushed=0;  
2764
  int32_t xv,yv,crushed=0;  
2764
  game_object *o=first_active;
2765
  game_object *o=first_active;
2765
  for (;o;o=o->next_active)
2766
  for (;o;o=o->next_active)
2766
  {
2767
  {
Lines 2797-2810 Link Here
2797
int level::platform_push(game_object *by_who, int xamount, int yamount)
2798
int level::platform_push(game_object *by_who, int xamount, int yamount)
2798
{
2799
{
2799
  int failed=0;
2800
  int failed=0;
2800
  long xv,yv;
2801
  int32_t xv,yv;
2801
  game_object *o=first_active;
2802
  game_object *o=first_active;
2802
  for (;o;o=o->next_active)  
2803
  for (;o;o=o->next_active)  
2803
  {
2804
  {
2804
    if (o->is_playable() && o->state!=dieing && o->state!=dead)  
2805
    if (o->is_playable() && o->state!=dieing && o->state!=dead)  
2805
    {      
2806
    {      
2806
      // check to see if the platform is going up and will run into us.      
2807
      // check to see if the platform is going up and will run into us.      
2807
      long tvx,tvy;
2808
      int32_t tvx,tvy;
2808
      if (yamount<0)
2809
      if (yamount<0)
2809
      {
2810
      {
2810
	tvx=-xamount;
2811
	tvx=-xamount;
Lines 2847-2853 Link Here
2847
2848
2848
int level::push_characters(game_object *by_who, int xamount, int yamount)
2849
int level::push_characters(game_object *by_who, int xamount, int yamount)
2849
{
2850
{
2850
  long xv,yv;
2851
  int32_t xv,yv;
2851
  int failed=0;
2852
  int failed=0;
2852
  game_object *o=first_active;
2853
  game_object *o=first_active;
2853
  for (;o;o=o->next_active)  
2854
  for (;o;o=o->next_active)  
Lines 2856-2862 Link Here
2856
    {      
2857
    {      
2857
      xv=-xamount;    
2858
      xv=-xamount;    
2858
      yv=-yamount;
2859
      yv=-yamount;
2859
      long tvx,tvy;
2860
      int32_t tvx,tvy;
2860
      if (xv>0) tvx=xv+1; else if (xv<0) tvx=xv-1; else tvx=0;
2861
      if (xv>0) tvx=xv+1; else if (xv<0) tvx=xv-1; else tvx=0;
2861
      if (yv>0) tvy=yv+1; else if (yv<0) tvx=yv-1; else tvy=0;
2862
      if (yv>0) tvy=yv+1; else if (yv<0) tvx=yv-1; else tvy=0;
2862
      if (o->try_move(o->x+xamount,o->y+yamount,tvx,tvy,3)==by_who)
2863
      if (o->try_move(o->x+xamount,o->y+yamount,tvx,tvy,3)==by_who)
Lines 2876-2882 Link Here
2876
2877
2877
game_object *level::find_xrange(int x, int y, int type, int xd)
2878
game_object *level::find_xrange(int x, int y, int type, int xd)
2878
{
2879
{
2879
  long find_ydist=100000;
2880
  int32_t find_ydist=100000;
2880
  game_object *find=NULL;
2881
  game_object *find=NULL;
2881
  game_object *o=first_active;
2882
  game_object *o=first_active;
2882
  for (;o;o=o->next_active)  
2883
  for (;o;o=o->next_active)  
Lines 2899-2905 Link Here
2899
2900
2900
game_object *level::find_xclosest(int x, int y, int type, game_object *who)
2901
game_object *level::find_xclosest(int x, int y, int type, game_object *who)
2901
{
2902
{
2902
  long find_ydist=100000,find_xdist=0xffffff;
2903
  int32_t find_ydist=100000,find_xdist=0xffffff;
2903
  game_object *find=NULL;
2904
  game_object *find=NULL;
2904
  game_object *o=first_active;
2905
  game_object *o=first_active;
2905
  for (;o;o=o->next_active)  
2906
  for (;o;o=o->next_active)  
Lines 2929-2935 Link Here
2929
2930
2930
game_object *level::find_closest(int x, int y, int type, game_object *who)
2931
game_object *level::find_closest(int x, int y, int type, game_object *who)
2931
{
2932
{
2932
  long find_dist=100000;
2933
  int32_t find_dist=100000;
2933
  game_object *find=NULL;
2934
  game_object *find=NULL;
2934
  game_object *o=first_active;
2935
  game_object *o=first_active;
2935
  for (;o;o=o->next_active)  
2936
  for (;o;o=o->next_active)  
Lines 2984-2990 Link Here
2984
  return l;
2985
  return l;
2985
}
2986
}
2986
2987
2987
void level::hurt_radius(long x, long y,long r, long m, game_object *from, game_object *exclude, 
2988
void level::hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude, 
2988
			int max_push)
2989
			int max_push)
2989
{
2990
{
2990
  if (r<1) return ;   // avoid dev vy zero
2991
  if (r<1) return ;   // avoid dev vy zero
Lines 2993-3000 Link Here
2993
  {
2994
  {
2994
    if (o!=exclude && o->hurtable())
2995
    if (o!=exclude && o->hurtable())
2995
    {
2996
    {
2996
      long y1=o->y,y2=o->y-o->picture()->height();
2997
      int32_t y1=o->y,y2=o->y-o->picture()->height();
2997
      long cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);
2998
      int32_t cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);
2998
      if (cx<cy1)
2999
      if (cx<cy1)
2999
        d1=cx+cy1-(cx>>1);
3000
        d1=cx+cy1-(cx>>1);
3000
      else d1=cx+cy1-(cy1>>1);
3001
      else d1=cx+cy1-(cy1>>1);
Lines 3055-3061 Link Here
3055
    { 
3056
    { 
3056
      if (v!=exclude)
3057
      if (v!=exclude)
3057
      {
3058
      {
3058
	long cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;
3059
	int32_t cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;
3059
	if (cx<cy)
3060
	if (cx<cy)
3060
          d=cx+cy-(cx>>1);
3061
          d=cx+cy-(cx>>1);
3061
	else d=cx+cy-(cy>>1);
3062
	else d=cx+cy-(cy>>1);
Lines 3151-3165 Link Here
3151
}
3152
}
3152
3153
3153
3154
3154
game_object *level::find_object_in_area(long x, long y, long x1, long y1, long x2, long y2,
3155
game_object *level::find_object_in_area(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
3155
				     Cell *list, game_object *exclude)
3156
				     Cell *list, game_object *exclude)
3156
{
3157
{
3157
  game_object *closest=NULL;
3158
  game_object *closest=NULL;
3158
  long closest_distance=0xfffffff,distance,xo,yo;
3159
  int32_t closest_distance=0xfffffff,distance,xo,yo;
3159
  game_object *o=first_active;
3160
  game_object *o=first_active;
3160
  for (;o;o=o->next_active)
3161
  for (;o;o=o->next_active)
3161
  {
3162
  {
3162
    long xp1,yp1,xp2,yp2;
3163
    int32_t xp1,yp1,xp2,yp2;
3163
    o->picture_space(xp1,yp1,xp2,yp2);
3164
    o->picture_space(xp1,yp1,xp2,yp2);
3164
3165
3165
3166
Lines 3187-3201 Link Here
3187
3188
3188
3189
3189
3190
3190
game_object *level::find_object_in_angle(long x, long y, long start_angle, long end_angle,
3191
game_object *level::find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle,
3191
				    void *list, game_object *exclude)
3192
				    void *list, game_object *exclude)
3192
{
3193
{
3193
  game_object *closest=NULL;
3194
  game_object *closest=NULL;
3194
  long closest_distance=0xfffffff,distance,xo,yo;
3195
  int32_t closest_distance=0xfffffff,distance,xo,yo;
3195
  game_object *o=first_active;
3196
  game_object *o=first_active;
3196
  for (;o;o=o->next_active)
3197
  for (;o;o=o->next_active)
3197
  {
3198
  {
3198
    long angle=lisp_atan2(o->y-y,o->x-x);
3199
    int32_t angle=lisp_atan2(o->y-y,o->x-x);
3199
    if (((start_angle<=end_angle && (angle>=start_angle && angle<=end_angle))
3200
    if (((start_angle<=end_angle && (angle>=start_angle && angle<=end_angle))
3200
	|| (start_angle>end_angle && (angle>=start_angle || angle<=end_angle)))
3201
	|| (start_angle>end_angle && (angle>=start_angle || angle<=end_angle)))
3201
	&& o!=exclude)
3202
	&& o!=exclude)
Lines 3249-3263 Link Here
3249
    game_object *o=first;
3250
    game_object *o=first;
3250
    for (;o;o=o->next)
3251
    for (;o;o=o->next)
3251
    {
3252
    {
3252
      fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype],o->x,o->y,
3253
      fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype],(long)o->x,(long)o->y,
3253
	      o->xvel(),o->yvel(),o->current_frame);
3254
	      (long)o->xvel(),(long)o->yvel(),o->current_frame);
3254
    }
3255
    }
3255
    fclose(fp);
3256
    fclose(fp);
3256
  }
3257
  }
3257
}
3258
}
3258
3259
3259
3260
3260
area_controller::area_controller(long X, long Y, long W, long H, area_controller *Next)
3261
area_controller::area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next)
3261
{ 
3262
{ 
3262
  x=X; y=Y; w=W; h=H; 
3263
  x=X; y=Y; w=W; h=H; 
3263
  next=Next; active=0; 
3264
  next=Next; active=0; 
(-)abuse-sdl-0.7.0.orig/src/game.cpp (-65 / +67 lines)
Lines 57-64 Link Here
57
int dev,shift_down=SHIFT_DOWN_DEFAULT,shift_right=SHIFT_RIGHT_DEFAULT;
57
int dev,shift_down=SHIFT_DOWN_DEFAULT,shift_right=SHIFT_RIGHT_DEFAULT;
58
double sum_diffs=1,total_diffs=12;
58
double sum_diffs=1,total_diffs=12;
59
int total_active=0;
59
int total_active=0;
60
long map_xoff=0,map_yoff=0;
60
int32_t map_xoff=0,map_yoff=0;
61
long current_vxadd,current_vyadd;
61
int32_t current_vxadd,current_vyadd;
62
int frame_panic=0,massive_frame_panic=0;
62
int frame_panic=0,massive_frame_panic=0;
63
int demo_start=0,idle_ticks=0;
63
int demo_start=0,idle_ticks=0;
64
int req_end=0;
64
int req_end=0;
Lines 70-76 Link Here
70
char req_name[100];
70
char req_name[100];
71
71
72
int registered=0;
72
int registered=0;
73
extern uchar chatting_enabled;
73
extern uint8_t chatting_enabled;
74
74
75
extern int confirm_quit();
75
extern int confirm_quit();
76
76
Lines 135-141 Link Here
135
  }
135
  }
136
}
136
}
137
137
138
void game::play_sound(int id, int vol, long x, long y)
138
void game::play_sound(int id, int vol, int32_t x, int32_t y)
139
{
139
{
140
	if( sound_avail & SFX_INITIALIZED )
140
	if( sound_avail & SFX_INITIALIZED )
141
	{
141
	{
Lines 144-156 Link Here
144
		if( !player_list )
144
		if( !player_list )
145
			return;
145
			return;
146
146
147
		ulong mdist = 0xffffffff;
147
		uint32_t mdist = 0xffffffff;
148
		view *cd = NULL;
148
		view *cd = NULL;
149
		for( view *f = player_list; f ; f = f->next )
149
		for( view *f = player_list; f ; f = f->next )
150
		{
150
		{
151
			if( f->local_player() )
151
			if( f->local_player() )
152
			{
152
			{
153
				long cx = abs(f->x_center()-x),cy = abs(f->y_center()-y), d;
153
				int32_t cx = abs(f->x_center()-x),cy = abs(f->y_center()-y), d;
154
				if( cx < cy )
154
				if( cx < cy )
155
					d = cx + cy - ( cx >> 1 );
155
					d = cx + cy - ( cx >> 1 );
156
				else
156
				else
Lines 276-282 Link Here
276
  else return 0;
276
  else return 0;
277
}
277
}
278
278
279
void game::ftile_on(int screenx, int screeny, long &x, long &y)
279
void game::ftile_on(int screenx, int screeny, int32_t &x, int32_t &y)
280
{
280
{
281
  mouse_to_game(screenx,screeny,x,y);
281
  mouse_to_game(screenx,screeny,x,y);
282
  x/=ftile_width();
282
  x/=ftile_width();
Lines 284-291 Link Here
284
/*  view *f=view_in(screenx,screeny);
284
/*  view *f=view_in(screenx,screeny);
285
  if (f)
285
  if (f)
286
  {
286
  {
287
    x=((long)(screenx)-(long)f->cx1+f->xoff())/(long)f_wid;
287
    x=((int32_t)(screenx)-(int32_t)f->cx1+f->xoff())/(int32_t)f_wid;
288
    y=((long)(screeny)-(long)f->cy1+f->yoff())/(long)f_hi;
288
    y=((int32_t)(screeny)-(int32_t)f->cy1+f->yoff())/(int32_t)f_hi;
289
  }
289
  }
290
  else
290
  else
291
  {
291
  {
Lines 294-306 Link Here
294
  }*/
294
  }*/
295
}
295
}
296
296
297
void game::btile_on(int screenx, int screeny, long &x, long &y)
297
void game::btile_on(int screenx, int screeny, int32_t &x, int32_t &y)
298
{
298
{
299
  view *f=view_in(screenx,screeny);
299
  view *f=view_in(screenx,screeny);
300
  if (f)
300
  if (f)
301
  {
301
  {
302
    x=((long)(screenx)-(long)f->cx1+f->xoff()*bg_xmul/bg_xdiv)/(long)b_wid; 
302
    x=((int32_t)(screenx)-(int32_t)f->cx1+f->xoff()*bg_xmul/bg_xdiv)/(int32_t)b_wid; 
303
    y=((long)(screeny)-(long)f->cy1+f->yoff()*bg_ymul/bg_ydiv)/(long)b_hi;
303
    y=((int32_t)(screeny)-(int32_t)f->cy1+f->yoff()*bg_ymul/bg_ydiv)/(int32_t)b_hi;
304
  }
304
  }
305
  else
305
  else
306
  {
306
  {
Lines 310-316 Link Here
310
}
310
}
311
311
312
312
313
void game::mouse_to_game(long x, long y, long &gamex, long &gamey, view *f)
313
void game::mouse_to_game(int32_t x, int32_t y, int32_t &gamex, int32_t &gamey, view *f)
314
{
314
{
315
  if (!f)
315
  if (!f)
316
  {
316
  {
Lines 323-345 Link Here
323
323
324
      if (dev&MAP_MODE)
324
      if (dev&MAP_MODE)
325
      {
325
      {
326
	gamex=((x-(long)f->cx1)*ftile_width()/AUTOTILE_WIDTH+map_xoff*ftile_width());
326
	gamex=((x-(int32_t)f->cx1)*ftile_width()/AUTOTILE_WIDTH+map_xoff*ftile_width());
327
	gamey=((y-(long)f->cy1)*ftile_height()/AUTOTILE_HEIGHT+map_yoff*ftile_height());
327
	gamey=((y-(int32_t)f->cy1)*ftile_height()/AUTOTILE_HEIGHT+map_yoff*ftile_height());
328
      } else
328
      } else
329
      {
329
      {
330
	gamex=(x-(long)f->cx1+f->xoff());
330
	gamex=(x-(int32_t)f->cx1+f->xoff());
331
	gamey=(y-(long)f->cy1+f->yoff());
331
	gamey=(y-(int32_t)f->cy1+f->yoff());
332
      }
332
      }
333
333
334
  }
334
  }
335
335
336
}
336
}
337
337
338
void game::game_to_mouse(long gamex, long gamey, view *which, long &x, long &y)
338
void game::game_to_mouse(int32_t gamex, int32_t gamey, view *which, int32_t &x, int32_t &y)
339
{
339
{
340
  if (dev&MAP_MODE)
340
  if (dev&MAP_MODE)
341
  {
341
  {
342
    long x1,y1;
342
    int32_t x1,y1;
343
    if (dev&EDIT_MODE)
343
    if (dev&EDIT_MODE)
344
    {
344
    {
345
      x1=map_xoff;
345
      x1=map_xoff;
Lines 544-549 Link Here
544
  {			      
544
  {			      
545
    spec_directory sd(fp);  
545
    spec_directory sd(fp);  
546
546
547
#if 0
547
    spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
548
    spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
548
    if (!e)
549
    if (!e)
549
    { 
550
    { 
Lines 552-557 Link Here
552
      the_game->need_refresh();
553
      the_game->need_refresh();
553
    }
554
    }
554
    else 
555
    else 
556
#endif
555
      current_level=new level(&sd,fp,name);
557
      current_level=new level(&sd,fp,name);
556
    delete fp;
558
    delete fp;
557
  }
559
  }
Lines 683-693 Link Here
683
  }
685
  }
684
}
686
}
685
687
686
void remap_area(image *screen, int x1, int y1, int x2, int y2, uchar *remap)
688
void remap_area(image *screen, int x1, int y1, int x2, int y2, uint8_t *remap)
687
{
689
{
688
  uchar *sl=(uchar *)screen->scan_line(y1)+x1;
690
  uint8_t *sl=(uint8_t *)screen->scan_line(y1)+x1;
689
  int x,y,a=screen->width()-(x2-x1+1);
691
  int x,y,a=screen->width()-(x2-x1+1);
690
  uchar c;
692
  uint8_t c;
691
  for (y=y1;y<=y2;y++)
693
  for (y=y1;y<=y2;y++)
692
  {
694
  {
693
    for (x=x1;x<=x2;x++)
695
    for (x=x1;x<=x2;x++)
Lines 754-760 Link Here
754
    return ;
756
    return ;
755
  }
757
  }
756
758
757
  long old_cx1=0,old_cy1=0,old_cx2=0,old_cy2=0;   // if we do a small render, we need to restore these
759
  int32_t old_cx1=0,old_cy1=0,old_cx2=0,old_cy2=0;   // if we do a small render, we need to restore these
758
  image *old_screen=NULL;
760
  image *old_screen=NULL;
759
  if (small_render && (dev&DRAW_LIGHTS))  // cannot do this if we skip lighting
761
  if (small_render && (dev&DRAW_LIGHTS))  // cannot do this if we skip lighting
760
  {
762
  {
Lines 775-784 Link Here
775
777
776
778
777
779
778
//  long max_xoff=(current_level->foreground_width()-1)*ftile_width()-(v->cx2-v->cx1+1);
780
//  int32_t max_xoff=(current_level->foreground_width()-1)*ftile_width()-(v->cx2-v->cx1+1);
779
//  long max_yoff=(current_level->foreground_height()-1)*ftile_height()-(v->cy2-v->cy1+1); 
781
//  int32_t max_yoff=(current_level->foreground_height()-1)*ftile_height()-(v->cy2-v->cy1+1); 
780
782
781
  long xoff,yoff;
783
  int32_t xoff,yoff;
782
  if (interpolate)
784
  if (interpolate)
783
  {
785
  {
784
    xoff=v->interpolated_xoff();
786
    xoff=v->interpolated_xoff();
Lines 800-807 Link Here
800
  nxoff=xoff*bg_xmul/bg_xdiv;
802
  nxoff=xoff*bg_xmul/bg_xdiv;
801
  nyoff=yoff*bg_ymul/bg_ydiv;
803
  nyoff=yoff*bg_ymul/bg_ydiv;
802
804
803
//  long max_bg_xoff=(current_level->background_width())*btile_width()-(v->cx2-v->cx1+1);
805
//  int32_t max_bg_xoff=(current_level->background_width())*btile_width()-(v->cx2-v->cx1+1);
804
//  long max_bg_yoff=(current_level->background_height())*btile_height()-(v->cy2-v->cy1+1);
806
//  int32_t max_bg_yoff=(current_level->background_height())*btile_height()-(v->cy2-v->cy1+1);
805
//  if (nxoff>max_bg_xoff) nxoff=max_xoff;
807
//  if (nxoff>max_bg_xoff) nxoff=max_xoff;
806
//  if (nyoff>max_bg_yoff) nyoff=max_yoff;  
808
//  if (nyoff>max_bg_yoff) nyoff=max_yoff;  
807
  
809
  
Lines 823-829 Link Here
823
    yinc=btile_height();  
825
    yinc=btile_height();  
824
    
826
    
825
    int bh=current_level->background_height(),bw=current_level->background_width();
827
    int bh=current_level->background_height(),bw=current_level->background_width();
826
    ushort *bl;
828
    uint16_t *bl;
827
    for (draw_y=yo,y=y1;y<=y2;y++,draw_y+=yinc)
829
    for (draw_y=yo,y=y1;y<=y2;y++,draw_y+=yinc)
828
    {
830
    {
829
      if (y>=bh)
831
      if (y>=bh)
Lines 850-856 Link Here
850
//  if (!(dev&EDIT_MODE))
852
//  if (!(dev&EDIT_MODE))
851
//    server_check();
853
//    server_check();
852
854
853
  uchar rescan=0;  
855
  uint8_t rescan=0;  
854
856
855
    int fw,fh;
857
    int fw,fh;
856
858
Lines 915-922 Link Here
915
      {
917
      {
916
	if (!(draw_y<ncy1 ||draw_y+yinc>=ncy2))
918
	if (!(draw_y<ncy1 ||draw_y+yinc>=ncy2))
917
	{
919
	{
918
	  ushort *cl=current_level->get_fgline(y)+x1;
920
	  uint16_t *cl=current_level->get_fgline(y)+x1;
919
	  uchar *sl1=screen->scan_line(draw_y)+xo;
921
	  uint8_t *sl1=screen->scan_line(draw_y)+xo;
920
	  for (x=x1,draw_x=xo;x<=x2;x++,cl++,sl1+=xinc,draw_x+=xinc)
922
	  for (x=x1,draw_x=xo;x<=x2;x++,cl++,sl1+=xinc,draw_x+=xinc)
921
	  {
923
	  {
922
	    if (!(draw_x<ncx1 || draw_x+xinc>=ncx2))
924
	    if (!(draw_x<ncx1 || draw_x+xinc>=ncx2))
Lines 926-933 Link Here
926
	        fort_num=fgvalue(*cl);
928
	        fort_num=fgvalue(*cl);
927
//	      else fort_num=0;
929
//	      else fort_num=0;
928
930
929
	      uchar *sl2=get_fg(fort_num)->micro_image->scan_line(0);
931
	      uint8_t *sl2=get_fg(fort_num)->micro_image->scan_line(0);
930
	      uchar *sl3=sl1;
932
	      uint8_t *sl3=sl1;
931
	      memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
933
	      memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
932
	      memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
934
	      memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
933
	      memcpy(sl3,sl2,AUTOTILE_WIDTH);
935
	      memcpy(sl3,sl2,AUTOTILE_WIDTH);
Lines 946-956 Link Here
946
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
948
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
947
      {
949
      {
948
	
950
	
949
	ushort *cl;
951
	uint16_t *cl;
950
	if (y<fg_h)
952
	if (y<fg_h)
951
	  cl=current_level->get_fgline(y)+x1;
953
	  cl=current_level->get_fgline(y)+x1;
952
	else cl=NULL;
954
	else cl=NULL;
953
	uchar *sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo;
955
	uint8_t *sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo;
954
956
955
	for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++,sl1+=xinc)
957
	for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++,sl1+=xinc)
956
	{
958
	{
Lines 983-989 Link Here
983
//  if (!(dev&EDIT_MODE))
985
//  if (!(dev&EDIT_MODE))
984
//    server_check();
986
//    server_check();
985
987
986
  long ro=rand_on;
988
  int32_t ro=rand_on;
987
  if (dev & DRAW_PEOPLE_LAYER)
989
  if (dev & DRAW_PEOPLE_LAYER)
988
  {
990
  {
989
    if (interpolate)
991
    if (interpolate)
Lines 1004-1010 Link Here
1004
    {
1006
    {
1005
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
1007
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
1006
      {
1008
      {
1007
	ushort *cl=current_level->get_fgline(y)+x1;
1009
	uint16_t *cl=current_level->get_fgline(y)+x1;
1008
	for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++)
1010
	for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++)
1009
	{
1011
	{
1010
	  if (above_tile(*cl))
1012
	  if (above_tile(*cl))
Lines 1038-1044 Link Here
1038
1040
1039
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
1041
      for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
1040
      {
1042
      {
1041
	ushort *cl;
1043
	uint16_t *cl;
1042
	if (y<fg_h)
1044
	if (y<fg_h)
1043
	  cl=current_level->get_fgline(y)+x1;
1045
	  cl=current_level->get_fgline(y)+x1;
1044
	else cl=NULL;
1046
	else cl=NULL;
Lines 1050-1056 Link Here
1050
	    if (fort_num!=BLACK)
1052
	    if (fort_num!=BLACK)
1051
	    {
1053
	    {
1052
	      point_list *p=get_fg(fort_num)->points;
1054
	      point_list *p=get_fg(fort_num)->points;
1053
	      uchar *d=p->data;	
1055
	      uint8_t *d=p->data;	
1054
	      if (p->tot)
1056
	      if (p->tot)
1055
	      {
1057
	      {
1056
		for (int i=1;i<p->tot;i++)
1058
		for (int i=1;i<p->tot;i++)
Lines 1199-1206 Link Here
1199
1201
1200
  for (i=0;i<steps;i++)
1202
  for (i=0;i<steps;i++)
1201
  {
1203
  {
1202
    uchar *sl1=(uchar *)pal->addr();    
1204
    uint8_t *sl1=(uint8_t *)pal->addr();    
1203
    uchar *sl2=(uchar *)old_pal->addr();    
1205
    uint8_t *sl2=(uint8_t *)old_pal->addr();    
1204
    int j;
1206
    int j;
1205
    int v=(i+1)*256/steps;
1207
    int v=(i+1)*256/steps;
1206
    for (j=0;j<256;j++)
1208
    for (j=0;j<256;j++)
Lines 1223-1230 Link Here
1223
  int i;
1225
  int i;
1224
  for (i=0;i<steps;i++)
1226
  for (i=0;i<steps;i++)
1225
  {
1227
  {
1226
    uchar *sl1=(uchar *)pal->addr();    
1228
    uint8_t *sl1=(uint8_t *)pal->addr();    
1227
    uchar *sl2=(uchar *)old_pal->addr();    
1229
    uint8_t *sl2=(uint8_t *)old_pal->addr();    
1228
    int j;
1230
    int j;
1229
    int v=(steps-i)*256/steps;
1231
    int v=(steps-i)*256/steps;
1230
    for (j=0;j<256;j++)
1232
    for (j=0;j<256;j++)
Lines 1245-1251 Link Here
1245
  pal->load();
1247
  pal->load();
1246
}
1248
}
1247
1249
1248
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color);
1250
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
1249
1251
1250
void do_title()
1252
void do_title()
1251
{
1253
{
Lines 1308-1314 Link Here
1308
			smoke[0]->put_image( screen, dx + 24, dy + 5 );
1310
			smoke[0]->put_image( screen, dx + 24, dy + 5 );
1309
1311
1310
			fade_in( NULL, 16 );
1312
			fade_in( NULL, 16 );
1311
			uchar cmap[32];
1313
			uint8_t cmap[32];
1312
			for( i = 0; i < 32; i++ )
1314
			for( i = 0; i < 32; i++ )
1313
			cmap[i] = pal->find_closest( i * 256 / 32, i * 256 / 32, i * 256 / 32 );
1315
			cmap[i] = pal->find_closest( i * 256 / 32, i * 256 / 32, i * 256 / 32 );
1314
1316
Lines 1419-1426 Link Here
1419
1421
1420
//	ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof
1422
//	ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof
1421
	char *fastpath;
1423
	char *fastpath;
1422
	fastpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 13, "fastpath" );
1424
	fastpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12 + 1, "fastpath" );
1423
	sprintf( fastpath, "%sfastload.dat\0", get_save_filename_prefix() );
1425
	sprintf( fastpath, "%sfastload.dat", get_save_filename_prefix() );
1424
	fast_load_start_recording( fastpath );
1426
	fast_load_start_recording( fastpath );
1425
	load_data(argc,argv);  
1427
	load_data(argc,argv);  
1426
	fast_load_stop_recording();
1428
	fast_load_stop_recording();
Lines 1664-1670 Link Here
1664
		if (avg_fps>15 && ((dev&EDIT_MODE)==0 || need_delay))
1666
		if (avg_fps>15 && ((dev&EDIT_MODE)==0 || need_delay))
1665
		{
1667
		{
1666
			frame_panic = 0;
1668
			frame_panic = 0;
1667
			long stime=(long)((1/15.0-1.0/possible_fps)*1000.0); 
1669
			int32_t stime=(int32_t)((1/15.0-1.0/possible_fps)*1000.0); 
1668
			if (stime>0 && !no_delay)
1670
			if (stime>0 && !no_delay)
1669
			{
1671
			{
1670
				milli_wait(stime);
1672
				milli_wait(stime);
Lines 1730-1746 Link Here
1730
					if(ev.key < 256 )
1732
					if(ev.key < 256 )
1731
					{
1733
					{
1732
						if( chat && chat->chat_event( ev ) )
1734
						if( chat && chat->chat_event( ev ) )
1733
							base->packet.write_byte( SCMD_CHAT_KEYPRESS );
1735
							base->packet.write_uint8( SCMD_CHAT_KEYPRESS );
1734
						else
1736
						else
1735
							base->packet.write_byte( SCMD_KEYPRESS );
1737
							base->packet.write_uint8( SCMD_KEYPRESS );
1736
					}
1738
					}
1737
					else
1739
					else
1738
						base->packet.write_byte( SCMD_EXT_KEYPRESS );
1740
						base->packet.write_uint8( SCMD_EXT_KEYPRESS );
1739
					base->packet.write_byte( client_number() );
1741
					base->packet.write_uint8( client_number() );
1740
					if( ev.key > 256 )
1742
					if( ev.key > 256 )
1741
						base->packet.write_byte( ev.key - 256 );
1743
						base->packet.write_uint8( ev.key - 256 );
1742
					else
1744
					else
1743
						base->packet.write_byte( ev.key );
1745
						base->packet.write_uint8( ev.key );
1744
				}
1746
				}
1745
			}
1747
			}
1746
			else if(ev.type == EV_KEYRELEASE )
1748
			else if(ev.type == EV_KEYRELEASE )
Lines 1749-1762 Link Here
1749
				if( playing_state( state ) )
1751
				if( playing_state( state ) )
1750
				{
1752
				{
1751
					if( ev.key < 256 )
1753
					if( ev.key < 256 )
1752
						base->packet.write_byte( SCMD_KEYRELEASE );
1754
						base->packet.write_uint8( SCMD_KEYRELEASE );
1753
					else
1755
					else
1754
						base->packet.write_byte( SCMD_EXT_KEYRELEASE );
1756
						base->packet.write_uint8( SCMD_EXT_KEYRELEASE );
1755
					base->packet.write_byte( client_number() );
1757
					base->packet.write_uint8( client_number() );
1756
					if( ev.key > 255 )
1758
					if( ev.key > 255 )
1757
						base->packet.write_byte( ev.key - 256 );
1759
						base->packet.write_uint8( ev.key - 256 );
1758
					else
1760
					else
1759
						base->packet.write_byte( ev.key );
1761
						base->packet.write_uint8( ev.key );
1760
				}
1762
				}
1761
			}
1763
			}
1762
1764
Lines 2029-2039 Link Here
2029
	  p->get_input();
2031
	  p->get_input();
2030
2032
2031
2033
2032
      base->packet.write_byte(SCMD_SYNC);
2034
      base->packet.write_uint8(SCMD_SYNC);
2033
      base->packet.write_short(make_sync());
2035
      base->packet.write_uint16(make_sync());
2034
2036
2035
      if (base->join_list)
2037
      if (base->join_list)
2036
      base->packet.write_byte(SCMD_RELOAD);
2038
      base->packet.write_uint8(SCMD_RELOAD);
2037
2039
2038
      //      printf("save tick %d, pk size=%d, rand_on=%d, sync=%d\n",current_level->tick_counter(),
2040
      //      printf("save tick %d, pk size=%d, rand_on=%d, sync=%d\n",current_level->tick_counter(),
2039
      //	     base->packet.packet_size(),rand_on,make_sync());
2041
      //	     base->packet.packet_size(),rand_on,make_sync());
Lines 2046-2052 Link Here
2046
{
2048
{
2047
  if (!(dev&EDIT_MODE) && current_level)
2049
  if (!(dev&EDIT_MODE) && current_level)
2048
  {
2050
  {
2049
    uchar buf[PACKET_MAX_SIZE+1];
2051
    uint8_t buf[PACKET_MAX_SIZE+1];
2050
    int size;
2052
    int size;
2051
2053
2052
    if (demo_man.state==demo_manager::PLAYING)
2054
    if (demo_man.state==demo_manager::PLAYING)
Lines 2572-2578 Link Here
2572
2574
2573
	fprintf(stderr,"Mac Options: ");
2575
	fprintf(stderr,"Mac Options: ");
2574
	xres = 320; yres = 200;
2576
	xres = 320; yres = 200;
2575
	GetKeys((unsigned long*)&km);
2577
	GetKeys((uint32_t*)&km);
2576
	if ((km[ 0x3a >>3] >> (0x3a & 7)) &1 != 0)
2578
	if ((km[ 0x3a >>3] >> (0x3a & 7)) &1 != 0)
2577
	{
2579
	{
2578
		dev|=EDIT_MODE;    
2580
		dev|=EDIT_MODE;    
(-)abuse-sdl-0.7.0.orig/src/loadgame.cpp (-2 / +3 lines)
Lines 191-198 Link Here
191
	if (total_saved>MAX_SAVE_GAMES)
191
	if (total_saved>MAX_SAVE_GAMES)
192
		total_saved=MAX_SAVE_GAMES;
192
		total_saved=MAX_SAVE_GAMES;
193
193
194
	int i,ih=cash.img(save_buts[0])->height();
194
	int i;
195
/*  ico_button *buts[MAX_SAVE_GAMES];
195
/*  int ih=cash.img(save_buts[0])->height();
196
  ico_button *buts[MAX_SAVE_GAMES];
196
  int y=WINDOW_FRAME_TOP;
197
  int y=WINDOW_FRAME_TOP;
197
198
198
199
(-)abuse-sdl-0.7.0.orig/src/specache.cpp (-2 / +2 lines)
Lines 4-10 Link Here
4
4
5
void spec_directory_cache::load(bFILE *fp)
5
void spec_directory_cache::load(bFILE *fp)
6
{
6
{
7
  short tfn=fp->read_short();
7
  short tfn=fp->read_uint16();
8
  int i;
8
  int i;
9
  unsigned char len;
9
  unsigned char len;
10
  char fn[256];
10
  char fn[256];
Lines 23-29 Link Here
23
  filename_node *f=fn_list;
23
  filename_node *f=fn_list;
24
  for (;f;f=f->next)
24
  for (;f;f=f->next)
25
    total++;
25
    total++;
26
  fp->write_short(total);
26
  fp->write_uint16(total);
27
  for (f=fn_list;f;f=f->next)
27
  for (f=fn_list;f;f=f->next)
28
  {
28
  {
29
    unsigned char len=strlen(f->filename())+1;
29
    unsigned char len=strlen(f->filename())+1;
(-)abuse-sdl-0.7.0.orig/src/lisp_gc.cpp (-9 / +11 lines)
Lines 74-84 Link Here
74
  return a;
74
  return a;
75
}
75
}
76
76
77
static uchar *cstart,*cend,*collected_start,*collected_end;
77
static uint8_t *cstart,*cend,*collected_start,*collected_end;
78
78
79
inline void *collect_cons_cell(void *x)
79
inline void *collect_cons_cell(void *x)
80
{
80
{
81
  cons_cell *last=NULL,*first;
81
  cons_cell *last=NULL,*first=NULL;
82
  if (!x) return x;
82
  if (!x) return x;
83
  for (;x && item_type(x)==L_CONS_CELL;)
83
  for (;x && item_type(x)==L_CONS_CELL;)
84
  {
84
  {
Lines 106-112 Link Here
106
{
106
{
107
  void *ret=x;
107
  void *ret=x;
108
108
109
  if (((uchar *)x)>=cstart && ((uchar *)x)<cend)
109
  if (((uint8_t *)x)>=cstart && ((uint8_t *)x)<cend)
110
  {
110
  {
111
    switch (item_type(x))
111
    switch (item_type(x))
112
    {
112
    {
Lines 187-193 Link Here
187
    }
187
    }
188
    ((lisp_collected_object *)x)->type=L_COLLECTED_OBJECT;
188
    ((lisp_collected_object *)x)->type=L_COLLECTED_OBJECT;
189
    ((lisp_collected_object *)x)->new_reference=ret;
189
    ((lisp_collected_object *)x)->new_reference=ret;
190
  } else if ((uchar *)x<collected_start || (uchar *)x>=collected_end)  
190
  } else if ((uint8_t *)x<collected_start || (uint8_t *)x>=collected_end)  
191
  {
191
  {
192
    if (item_type(x)==L_CONS_CELL) // still need to remap cons_cells outside of space
192
    if (item_type(x)==L_CONS_CELL) // still need to remap cons_cells outside of space
193
    {
193
    {
Lines 240-256 Link Here
240
240
241
void collect_space(int which_space) // should be tmp or permenant
241
void collect_space(int which_space) // should be tmp or permenant
242
{
242
{
243
  return; /* XXX */
244
243
  int old_space=current_space;
245
  int old_space=current_space;
244
  cstart=(uchar *)space[which_space];
246
  cstart=(uint8_t *)space[which_space];
245
  cend=(uchar *)free_space[which_space];
247
  cend=(uint8_t *)free_space[which_space];
246
248
247
  space_size[GC_SPACE]=space_size[which_space];
249
  space_size[GC_SPACE]=space_size[which_space];
248
  void *new_space=jmalloc(space_size[GC_SPACE],"collect lisp space");
250
  void *new_space=jmalloc(space_size[GC_SPACE],"collect lisp space");
249
  current_space=GC_SPACE;
251
  current_space=GC_SPACE;
250
  free_space[GC_SPACE]=space[GC_SPACE]=(char *)new_space;
252
  free_space[GC_SPACE]=space[GC_SPACE]=(char *)new_space;
251
253
252
  collected_start=(uchar *)new_space;
254
  collected_start=(uint8_t *)new_space;
253
  collected_end=(((uchar *)new_space)+space_size[GC_SPACE]);
255
  collected_end=(((uint8_t *)new_space)+space_size[GC_SPACE]);
254
256
255
  collect_symbols(lsym_root);
257
  collect_symbols(lsym_root);
256
  collect_stacks();
258
  collect_stacks();
Lines 260-266 Link Here
260
262
261
  space[which_space]=(char *)new_space;
263
  space[which_space]=(char *)new_space;
262
  free_space[which_space]=((char *)new_space)+
264
  free_space[which_space]=((char *)new_space)+
263
         (((uchar *)free_space[GC_SPACE])-((uchar *)space[GC_SPACE]));
265
         (((uint8_t *)free_space[GC_SPACE])-((uint8_t *)space[GC_SPACE]));
264
  current_space=old_space;
266
  current_space=old_space;
265
}
267
}
266
268
(-)abuse-sdl-0.7.0.orig/src/extend.cpp (-12 / +12 lines)
Lines 3-31 Link Here
3
3
4
4
5
  Simple object             (power ups, non-moving objects)
5
  Simple object             (power ups, non-moving objects)
6
    long x,y;
6
    int32_t x,y;
7
    schar direction;
7
    int8_t direction;
8
    ushort otype,state
8
    uint16_t otype,state
9
    ushort current_frame;
9
    uint16_t current_frame;
10
    extension *
10
    extension *
11
11
12
12
13
  Moving object             (simple lisp controlled characters)
13
  Moving object             (simple lisp controlled characters)
14
     uchar flags;
14
     uint8_t flags;
15
     long xvel,yvel,xacel,yacel;
15
     int32_t xvel,yvel,xacel,yacel;
16
     uchar fx,fy,fxvel,fyvel,fxacel,fyacel,aitype;
16
     uint8_t fx,fy,fxvel,fyvel,fxacel,fyacel,aitype;
17
     ushort aistate,aistate_time;
17
     uint16_t aistate,aistate_time;
18
     unsigned short hp,mp,
18
     uint16_t hp,mp,
19
     extension *
19
     extension *
20
20
21
21
22
  Complex objects          (can controll lights, other characters, and have a neural net ai)
22
  Complex objects          (can controll lights, other characters, and have a neural net ai)
23
    uchar tobjs,tlights;
23
    uint8_t tobjs,tlights;
24
    object_list *                       
24
    object_list *                       
25
    light_list *
25
    light_list *
26
    nnet_info *
26
    nnet_info *
27
    schar fade_dir, frame_dir;        
27
    int8_t fade_dir, frame_dir;        
28
    unsigned char fade_count,fade_max;
28
    uint8_t fade_count,fade_max;
29
    morph_char *morph_status;
29
    morph_char *morph_status;
30
30
31
31
(-)abuse-sdl-0.7.0.orig/src/old_earth_menu.cpp (-23 / +23 lines)
Lines 34-46 Link Here
34
34
35
  for (y=y1;y<=y2;y++)
35
  for (y=y1;y<=y2;y++)
36
  {
36
  {
37
    unsigned char *sl=screen->scan_line(y)+x1;
37
    uint8_t *sl=screen->scan_line(y)+x1;
38
    for (x=x1;x<=x2;x++,sl++)
38
    for (x=x1;x<=x2;x++,sl++)
39
    {
39
    {
40
      unsigned char *paddr=(unsigned char *)pal->addr()+(*sl)*3;
40
      uint8_t *paddr=(uint8_t *)pal->addr()+(*sl)*3;
41
      unsigned char r=((*(paddr++))-r_to)*percent/256+r_to;
41
      uint8_t r=((*(paddr++))-r_to)*percent/256+r_to;
42
      unsigned char g=((*(paddr++))-g_to)*percent/256+g_to;
42
      uint8_t g=((*(paddr++))-g_to)*percent/256+g_to;
43
      unsigned char b=((*(paddr++))-b_to)*percent/256+b_to;
43
      uint8_t b=((*(paddr++))-b_to)*percent/256+b_to;
44
      *sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
44
      *sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
45
    }
45
    }
46
  }
46
  }
Lines 60-72 Link Here
60
60
61
  for (y=y1;y<=y2;y++)
61
  for (y=y1;y<=y2;y++)
62
  {
62
  {
63
    unsigned char *sl=screen->scan_line(y)+x1;
63
    uint8_t *sl=screen->scan_line(y)+x1;
64
    for (x=x1;x<=x2;x++,sl++)
64
    for (x=x1;x<=x2;x++,sl++)
65
    {
65
    {
66
      unsigned char *paddr=(unsigned char *)pal->addr()+(*sl)*3;
66
      uint8_t *paddr=(uint8_t *)pal->addr()+(*sl)*3;
67
      unsigned char r=(*(paddr++))*amount/256;
67
      uint8_t r=(*(paddr++))*amount/256;
68
      unsigned char g=(*(paddr++))*amount/256;
68
      uint8_t g=(*(paddr++))*amount/256;
69
      unsigned char b=(*(paddr++))*amount/256;
69
      uint8_t b=(*(paddr++))*amount/256;
70
      *sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
70
      *sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
71
    }
71
    }
72
  }
72
  }
Lines 250-256 Link Here
250
struct mask_line
250
struct mask_line
251
{
251
{
252
  int x,size;
252
  int x,size;
253
  ushort *remap;
253
  uint16_t *remap;
254
} ;
254
} ;
255
255
256
256
Lines 260-274 Link Here
260
{  
260
{  
261
  int x1=10000,x2=0;
261
  int x1=10000,x2=0;
262
  int iw=im->width();  
262
  int iw=im->width();  
263
  ushort r,co,off,cc;
263
  uint16_t r,co,off,cc;
264
  int y=0;
264
  int y=0;
265
  for (;y<mask_height;y++)
265
  for (;y<mask_height;y++)
266
  {
266
  {
267
    mask_line *n=p+y;
267
    mask_line *n=p+y;
268
    uchar *sl=screen->scan_line(y+sy)+sx+n->x;
268
    uint8_t *sl=screen->scan_line(y+sy)+sx+n->x;
269
    uchar *sl2=im->scan_line(y);
269
    uint8_t *sl2=im->scan_line(y);
270
//    uchar *sl3=clouds->scan_line(y);
270
//    uint8_t *sl3=clouds->scan_line(y);
271
    ushort *rem=n->remap;
271
    uint16_t *rem=n->remap;
272
    if (sx+n->x<x1) x1=sx+n->x;    
272
    if (sx+n->x<x1) x1=sx+n->x;    
273
    int x=0;
273
    int x=0;
274
    for (;x<n->size;x++,sl++,rem++)   
274
    for (;x<n->size;x++,sl++,rem++)   
Lines 300-306 Link Here
300
  for (int y=0;y<mask->height();y++)
300
  for (int y=0;y<mask->height();y++)
301
  {
301
  {
302
    // find the start of the run..
302
    // find the start of the run..
303
    uchar *sl=mask->scan_line(y);    
303
    uint8_t *sl=mask->scan_line(y);    
304
    int x=0;
304
    int x=0;
305
    while (*sl==0) { sl++; x++; }
305
    while (*sl==0) { sl++; x++; }
306
    p[y].x=x;
306
    p[y].x=x;
Lines 312-319 Link Here
312
    p[y].size=size;
312
    p[y].size=size;
313
313
314
    // now calculate remap for line
314
    // now calculate remap for line
315
    p[y].remap=(ushort *)jmalloc(size*2,"mask remap");
315
    p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap");
316
    ushort *rem=p[y].remap;
316
    uint16_t *rem=p[y].remap;
317
    for (x=0;x<size;x++,rem++)
317
    for (x=0;x<size;x++,rem++)
318
    {
318
    {
319
      if (x<=size/2)
319
      if (x<=size/2)
Lines 507-513 Link Here
507
  char name[20];
507
  char name[20];
508
  ico_button *buts[MENU_TICONS];
508
  ico_button *buts[MENU_TICONS];
509
509
510
  long maxx=0,maxy=0;
510
  int32_t maxx=0,maxy=0;
511
  int i=0;
511
  int i=0;
512
  for (;i<MENU_TICONS;i++)
512
  for (;i<MENU_TICONS;i++)
513
  {
513
  {
Lines 518-525 Link Here
518
    sprintf(name,"icon%04d.pcx",i*3+2);
518
    sprintf(name,"icon%04d.pcx",i*3+2);
519
    menu_icons[i*3+2]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
519
    menu_icons[i*3+2]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
520
520
521
    long x=WINDOW_FRAME_LEFT+(i%9)*cash.img(menu_icons[0])->width();
521
    int32_t x=WINDOW_FRAME_LEFT+(i%9)*cash.img(menu_icons[0])->width();
522
    long y=WINDOW_FRAME_TOP+(i/9)*cash.img(menu_icons[0])->height();
522
    int32_t y=WINDOW_FRAME_TOP+(i/9)*cash.img(menu_icons[0])->height();
523
    if (x>maxx) maxx=x;
523
    if (x>maxx) maxx=x;
524
    if (y>maxy) maxy=y;
524
    if (y>maxy) maxy=y;
525
    buts[i]=new ico_button(x,y,menu_icons_ids[i],
525
    buts[i]=new ico_button(x,y,menu_icons_ids[i],
Lines 586-592 Link Here
586
  int eoff=0,coff=0;
586
  int eoff=0,coff=0;
587
  event ev;
587
  event ev;
588
//  main_pm->draw(screen,eh,1);
588
//  main_pm->draw(screen,eh,1);
589
  long x=84,y=60;
589
  int32_t x=84,y=60;
590
  Cell *v=find_symbol("earth_x");
590
  Cell *v=find_symbol("earth_x");
591
  if (v && DEFINEDP(v)) x=lnumber_value(symbol_value(v));
591
  if (v && DEFINEDP(v)) x=lnumber_value(symbol_value(v));
592
592
(-)abuse-sdl-0.7.0.orig/src/profile.cpp (-1 / +1 lines)
Lines 11-17 Link Here
11
11
12
struct prof_info
12
struct prof_info
13
{
13
{
14
  ushort otype;
14
  uint16_t otype;
15
  float total_time;
15
  float total_time;
16
};
16
};
17
17
(-)abuse-sdl-0.7.0.orig/src/go.cpp (-13 / +13 lines)
Lines 59-65 Link Here
59
elcontrol::elcontrol(FILE *fp, unsigned char *state_remap)
59
elcontrol::elcontrol(FILE *fp, unsigned char *state_remap)
60
{
60
{
61
  load(fp,state_remap);
61
  load(fp,state_remap);
62
  allow_dir=read_short(fp);
62
  allow_dir=read_uint16(fp);
63
}
63
}
64
64
65
65
Lines 117-131 Link Here
117
elevator::elevator(FILE *fp, unsigned char *state_remap)
117
elevator::elevator(FILE *fp, unsigned char *state_remap)
118
{
118
{
119
  load(fp,state_remap);  
119
  load(fp,state_remap);  
120
  dir=read_short(fp);  
120
  dir=read_uint16(fp);  
121
  speed=read_short(fp);  
121
  speed=read_uint16(fp);  
122
}
122
}
123
123
124
void elevator::save(FILE *fp) 
124
void elevator::save(FILE *fp) 
125
{ 
125
{ 
126
  game_object::save(fp); 
126
  game_object::save(fp); 
127
  write_short(fp,dir);    
127
  write_uint16(fp,dir);    
128
  write_short(fp,speed);    
128
  write_uint16(fp,speed);    
129
}
129
}
130
130
131
131
Lines 267-289 Link Here
267
267
268
void sensor::save(FILE *fp) 
268
void sensor::save(FILE *fp) 
269
{ game_object::save(fp); 
269
{ game_object::save(fp); 
270
  write_short(fp,xrange);
270
  write_uint16(fp,xrange);
271
  write_short(fp,yrange);
271
  write_uint16(fp,yrange);
272
  write_short(fp,signal);  
272
  write_uint16(fp,signal);  
273
273
274
  write_byte(fp,strlen(aname())+1);
274
  write_uint8(fp,strlen(aname())+1);
275
  fwrite(aname(),strlen(aname())+1,1,fp);  
275
  fwrite(aname(),strlen(aname())+1,1,fp);  
276
}
276
}
277
277
278
sensor::sensor(FILE *fp, unsigned char *state_remap)
278
sensor::sensor(FILE *fp, unsigned char *state_remap)
279
{
279
{
280
  load(fp,state_remap);
280
  load(fp,state_remap);
281
  xrange=read_short(fp);
281
  xrange=read_uint16(fp);
282
  yrange=read_short(fp);
282
  yrange=read_uint16(fp);
283
  signal=read_short(fp);  
283
  signal=read_uint16(fp);  
284
284
285
  char name[200];
285
  char name[200];
286
  fread(name,read_byte(fp),1,fp);
286
  fread(name,read_uint8(fp),1,fp);
287
  get_activate(name);
287
  get_activate(name);
288
}
288
}
289
289
(-)abuse-sdl-0.7.0.orig/src/netcfg.cpp (-2 / +5 lines)
Lines 58-63 Link Here
58
    case RESTART_CLIENT :
58
    case RESTART_CLIENT :
59
    case RESTART_SINGLE :
59
    case RESTART_SINGLE :
60
      return 1;
60
      return 1;
61
    default:
62
      break;
61
  }
63
  }
62
  return 0;
64
  return 0;
63
}
65
}
Lines 69-74 Link Here
69
    case RESTART_SERVER : { state=SERVER; } break;
71
    case RESTART_SERVER : { state=SERVER; } break;
70
    case RESTART_CLIENT : { state=CLIENT; } break;
72
    case RESTART_CLIENT : { state=CLIENT; } break;
71
    case RESTART_SINGLE : { state=SINGLE_PLAYER; } break;
73
    case RESTART_SINGLE : { state=SINGLE_PLAYER; } break;
74
    default: break;
72
  }
75
  }
73
76
74
77
Lines 249-257 Link Here
249
  ns->put_image(screen,x,y);
252
  ns->put_image(screen,x,y);
250
  JCFont *fnt=eh->font();
253
  JCFont *fnt=eh->font();
251
254
252
  uchar *remap=white_light+30*256;
255
  uint8_t *remap=white_light+30*256;
253
256
254
  uchar *sl=screen->scan_line(0);
257
  uint8_t *sl=screen->scan_line(0);
255
  int xx=screen->width()*screen->height();
258
  int xx=screen->width()*screen->height();
256
  for (;xx;xx--,sl++) *sl=remap[*sl];
259
  for (;xx;xx--,sl++) *sl=remap[*sl];
257
260
(-)abuse-sdl-0.7.0.orig/src/light.cpp (-136 / +139 lines)
Lines 12-25 Link Here
12
#include "dev.hpp"
12
#include "dev.hpp"
13
13
14
light_source *first_light_source=NULL;
14
light_source *first_light_source=NULL;
15
unsigned char *white_light,*white_light_initial,*green_light,*trans_table;
15
uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
16
short ambient_ramp=0;
16
short ambient_ramp=0;
17
short shutdown_lighting_value,shutdown_lighting=0;
17
short shutdown_lighting_value,shutdown_lighting=0;
18
extern char disable_autolight;   // defined in dev.hpp
18
extern char disable_autolight;   // defined in dev.hpp
19
19
20
int light_detail=MEDIUM_DETAIL;
20
int light_detail=MEDIUM_DETAIL;
21
21
22
long light_to_number(light_source *l)
22
int32_t light_to_number(light_source *l)
23
{
23
{
24
  
24
  
25
  if (!l) return 0;
25
  if (!l) return 0;
Lines 30-36 Link Here
30
}
30
}
31
31
32
32
33
light_source *number_to_light(long x)
33
light_source *number_to_light(int32_t x)
34
{
34
{
35
  if (x==0) return NULL;
35
  if (x==0) return NULL;
36
  x--;
36
  x--;
Lines 134-141 Link Here
134
  mul_div=(1<<16)/(outer_radius-inner_radius)*64;
134
  mul_div=(1<<16)/(outer_radius-inner_radius)*64;
135
}
135
}
136
136
137
light_source::light_source(char Type, long X, long Y, long Inner_radius, 
137
light_source::light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, 
138
			   long Outer_radius, long Xshift,  long Yshift, light_source *Next)
138
			   int32_t Outer_radius, int32_t Xshift,  int32_t Yshift, light_source *Next)
139
{ 
139
{ 
140
  type=Type; 
140
  type=Type; 
141
  x=X; y=Y; 
141
  x=X; y=Y; 
Lines 157-164 Link Here
157
  return t;
157
  return t;
158
}
158
}
159
159
160
light_source *add_light_source(char type, long x, long y, 
160
light_source *add_light_source(char type, int32_t x, int32_t y, 
161
			       long inner, long outer, long xshift, long yshift)
161
			       int32_t inner, int32_t outer, int32_t xshift, int32_t yshift)
162
{
162
{
163
  first_light_source=new light_source(type,x,y,inner,outer,xshift,yshift,first_light_source);
163
  first_light_source=new light_source(type,x,y,inner,outer,xshift,yshift,first_light_source);
164
  return first_light_source;
164
  return first_light_source;
Lines 166-175 Link Here
166
166
167
167
168
#define TTINTS 9
168
#define TTINTS 9
169
uchar *tints[TTINTS];
169
uint8_t *tints[TTINTS];
170
uchar bright_tint[256];
170
uint8_t bright_tint[256];
171
171
172
void calc_tint(uchar *tint, int rs, int gs, int bs, int ra, int ga, int ba, palette *pal)
172
void calc_tint(uint8_t *tint, int rs, int gs, int bs, int ra, int ga, int ba, palette *pal)
173
{
173
{
174
  palette npal;
174
  palette npal;
175
  memset(npal.addr(),0,256);
175
  memset(npal.addr(),0,256);
Lines 191-209 Link Here
191
191
192
void calc_light_table(palette *pal)
192
void calc_light_table(palette *pal)
193
{
193
{
194
	white_light_initial=(unsigned char *)jmalloc(256*64,"light table");
194
	white_light_initial=(uint8_t *)jmalloc(256*64,"light table");
195
	white_light=white_light_initial;
195
	white_light=white_light_initial;
196
196
197
//	green_light=(unsigned char *)jmalloc(256*64,"green light");
197
//	green_light=(uint8_t *)jmalloc(256*64,"green light");
198
	int i = 0;
198
	int i = 0;
199
	for( ; i < TTINTS; i++ )
199
	for( ; i < TTINTS; i++ )
200
	{
200
	{
201
		tints[i] = (uchar *)jmalloc( 256, "color tint" );
201
		tints[i] = (uint8_t *)jmalloc( 256, "color tint" );
202
	}
202
	}
203
203
204
	char *lightpath;
204
	char *lightpath;
205
	lightpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "lightpath" );
205
	lightpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "lightpath" );
206
	sprintf( lightpath, "%slight.tbl\0", get_save_filename_prefix() );
206
	sprintf( lightpath, "%slight.tbl", get_save_filename_prefix() );
207
207
208
	bFILE *fp=open_file( lightpath, "rb" );
208
	bFILE *fp=open_file( lightpath, "rb" );
209
	int recalc = 0;
209
	int recalc = 0;
Lines 214-220 Link Here
214
	}
214
	}
215
	else
215
	else
216
	{
216
	{
217
		if (fp->read_short()!=calc_crc((unsigned char *)pal->addr(),768))
217
		if (fp->read_uint16()!=calc_crc((uint8_t *)pal->addr(),768))
218
			recalc=1;
218
			recalc=1;
219
		else
219
		else
220
		{
220
		{
Lines 223-229 Link Here
223
			for (i=0;i<TTINTS;i++)
223
			for (i=0;i<TTINTS;i++)
224
				fp->read(tints[i],256);
224
				fp->read(tints[i],256);
225
			fp->read(bright_tint,256);
225
			fp->read(bright_tint,256);
226
//			trans_table=(uchar *)jmalloc(256*256,"transparency table");
226
//			trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
227
//			fp.read(trans_table,256*256);
227
//			fp.read(trans_table,256*256);
228
		}
228
		}
229
		delete fp;
229
		delete fp;
Lines 236-242 Link Here
236
		int color=0;
236
		int color=0;
237
		for (;color<256;color++)
237
		for (;color<256;color++)
238
		{
238
		{
239
			unsigned char r,g,b;
239
			uint8_t r,g,b;
240
			pal->get(color,r,g,b);
240
			pal->get(color,r,g,b);
241
			stat_man->update(color*100/256);
241
			stat_man->update(color*100/256);
242
			for (int intensity=63;intensity>=0;intensity--)
242
			for (int intensity=63;intensity>=0;intensity--)
Lines 254-260 Link Here
254
    for (color=0;color<256;color++)
254
    for (color=0;color<256;color++)
255
    {
255
    {
256
      stat_man->update(color*100/256);
256
      stat_man->update(color*100/256);
257
      unsigned char r,g,b;
257
      uint8_t r,g,b;
258
      pal->get(color,b,r,g);
258
      pal->get(color,b,r,g);
259
      r=r*3/5; b=b*3/5; g+=7; if (g>255) g=255;
259
      r=r*3/5; b=b*3/5; g+=7; if (g>255) g=255;
260
260
Lines 273-279 Link Here
273
    stat_man->pop(); */
273
    stat_man->pop(); */
274
274
275
    stat_man->push("tints",NULL);
275
    stat_man->push("tints",NULL);
276
    uchar t[TTINTS*6]={0,0,0,0,0,0, // normal
276
    uint8_t t[TTINTS*6]={0,0,0,0,0,0, // normal
277
                   0,0,0,1,0,0,     // red
277
                   0,0,0,1,0,0,     // red
278
		   0,0,0,1,1,0,     // yellow
278
		   0,0,0,1,1,0,     // yellow
279
		   0,0,0,1,0,1,     // purple
279
		   0,0,0,1,0,1,     // purple
Lines 289-296 Link Here
289
289
290
		   0,0,0,0,0,0   // reverse green  (night vision effect)
290
		   0,0,0,0,0,0   // reverse green  (night vision effect)
291
		 } ;
291
		 } ;
292
    uchar *ti=t+6;
292
    uint8_t *ti=t+6;
293
    uchar *c;
293
    uint8_t *c;
294
    for (i=0,c=tints[0];i<256;i++,c++) *c=i;  // make the normal tint (maps everthing to itself)
294
    for (i=0,c=tints[0];i<256;i++,c++) *c=i;  // make the normal tint (maps everthing to itself)
295
    for (i=0,c=tints[TTINTS-1];i<256;i++,c++)  // reverse green
295
    for (i=0,c=tints[TTINTS-1];i<256;i++,c++)  // reverse green
296
    {
296
    {
Lines 316-327 Link Here
316
    }
316
    }
317
    stat_man->pop();
317
    stat_man->pop();
318
/*    fprintf(stderr,"calculating transparency tables (256 total)\n");
318
/*    fprintf(stderr,"calculating transparency tables (256 total)\n");
319
    trans_table=(uchar *)jmalloc(256*256,"transparency table");
319
    trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
320
320
321
    uchar *tp=trans_table;
321
    uint8_t *tp=trans_table;
322
    for (i=0;i<256;i++)
322
    for (i=0;i<256;i++)
323
    {      
323
    {      
324
      uchar r1,g1,b1,r2,g2,b2;
324
      uint8_t r1,g1,b1,r2,g2,b2;
325
      pal->get(i,r1,g1,b1);
325
      pal->get(i,r1,g1,b1);
326
      if ((i%16)==0)
326
      if ((i%16)==0)
327
        fprintf(stderr,"%d ",i);
327
        fprintf(stderr,"%d ",i);
Lines 343-349 Link Here
343
			dprintf( "Unable to open file light.tbl for writing\n" );
343
			dprintf( "Unable to open file light.tbl for writing\n" );
344
		else
344
		else
345
		{
345
		{
346
			f->write_short(calc_crc((unsigned char *)pal->addr(),768));
346
			f->write_uint16(calc_crc((uint8_t *)pal->addr(),768));
347
			f->write(white_light,256*64);
347
			f->write(white_light,256*64);
348
//      f->write(green_light,256*64);
348
//      f->write(green_light,256*64);
349
			for (int i=0;i<TTINTS;i++)
349
			for (int i=0;i<TTINTS;i++)
Lines 391-397 Link Here
391
  }
391
  }
392
}
392
}
393
393
394
void add_light(light_patch *&first, long x1, long y1, long x2, long y2, 
394
void add_light(light_patch *&first, int32_t x1, int32_t y1, int32_t x2, int32_t y2, 
395
			    light_source *who)
395
			    light_source *who)
396
{  
396
{  
397
  light_patch *next;
397
  light_patch *next;
Lines 522-528 Link Here
522
}
522
}
523
523
524
/* shit
524
/* shit
525
int calc_light_value(light_patch *which, long x, long y)
525
int calc_light_value(light_patch *which, int32_t x, int32_t y)
526
{
526
{
527
  int lv=0;
527
  int lv=0;
528
  int t=which->total;
528
  int t=which->total;
Lines 536-544 Link Here
536
    }
536
    }
537
    else
537
    else
538
    {
538
    {
539
      long dx=abs(fn->x-x)<<fn->xshift;
539
      int32_t dx=abs(fn->x-x)<<fn->xshift;
540
      long dy=abs(fn->y-y)<<fn->yshift;
540
      int32_t dy=abs(fn->y-y)<<fn->yshift;
541
      long  r2;
541
      int32_t  r2;
542
      if (dx<dy)
542
      if (dx<dy)
543
        r2=dx+dy-(dx>>1);
543
        r2=dx+dy-(dx>>1);
544
      else r2=dx+dy-(dy>>1);
544
      else r2=dx+dy-(dy>>1);
Lines 563-575 Link Here
563
  
563
  
564
}
564
}
565
565
566
light_patch *make_patch_list(int width, int height, long screenx, long screeny)
566
light_patch *make_patch_list(int width, int height, int32_t screenx, int32_t screeny)
567
{
567
{
568
  light_patch *first=new light_patch(0,0,width-1,height-1,NULL);
568
  light_patch *first=new light_patch(0,0,width-1,height-1,NULL);
569
569
570
  for (light_source *f=first_light_source;f;f=f->next)   // determine which lights will have effect
570
  for (light_source *f=first_light_source;f;f=f->next)   // determine which lights will have effect
571
  {
571
  {
572
    long x1=f->x1-screenx,y1=f->y1-screeny,
572
    int32_t x1=f->x1-screenx,y1=f->y1-screeny,
573
        x2=f->x2-screenx,y2=f->y2-screeny;
573
        x2=f->x2-screenx,y2=f->y2-screeny;
574
    if (x1<0) x1=0;
574
    if (x1<0) x1=0;
575
    if (y1<0) y1=0;
575
    if (y1<0) y1=0;
Lines 598-653 Link Here
598
/*
598
/*
599
#ifdef __WATCOMC__
599
#ifdef __WATCOMC__
600
extern "C" {
600
extern "C" {
601
extern long MAP_PUT(long pad, long screen_addr, long remap, long w);
601
extern int32_t MAP_PUT(int32_t pad, int32_t screen_addr, int32_t remap, int32_t w);
602
} ;
602
} ;
603
#else*/
603
#else*/
604
604
605
inline void MAP_PUT(long screen_addr, long remap, long w)
605
inline void MAP_PUT(uint8_t * screen_addr, uint8_t * remap, int w)
606
{ 
606
{ 
607
  register int cx=w;
607
  register int cx=w;
608
  register int di=screen_addr;
608
  register uint8_t * di=screen_addr;
609
  register int si=remap;
609
  register uint8_t * si=remap;
610
  while (cx--) 
610
  while (cx--) 
611
    *((uchar *)(di++))=*((uchar *)si+*((uchar *)di)); 
611
  {
612
    uint8_t x=*((uint8_t *)si+*((uint8_t *)di));
613
    *((uint8_t *)(di++))=x;
614
  }
612
}
615
}
613
616
614
inline void MAP_2PUT(long in_addr, long out_addr, long remap, long w)
617
inline void MAP_2PUT(uint8_t * in_addr, uint8_t * out_addr, uint8_t * remap, int w)
615
{ 
618
{ 
616
  while (w--) 
619
  while (w--) 
617
  {
620
  {
618
    uchar x=*(((uchar *)remap)+(*(uchar *)(in_addr++)));
621
    uint8_t x=*(((uint8_t *)remap)+(*(uint8_t *)(in_addr++)));
619
    *((uchar *)(out_addr++))=x;
622
    *((uint8_t *)(out_addr++))=x;
620
    *((uchar *)(out_addr++))=x;
623
    *((uint8_t *)(out_addr++))=x;
621
  }
624
  }
622
}
625
}
623
626
624
/*
627
/*
625
#endif
628
#endif
626
629
627
inline void PUT8(long *addr, uchar *remap)
630
inline void PUT8(int32_t *addr, uint8_t *remap)
628
{
631
{
629
  register ulong in_pixels;
632
  register uint32_t in_pixels;
630
  register ulong pixel;
633
  register uint32_t pixel;
631
  register ulong out_pixels;
634
  register uint32_t out_pixels;
632
  in_pixels=*addr;
635
  in_pixels=*addr;
633
  pixel=in_pixels;
636
  pixel=in_pixels;
634
  out_pixels=remap[(uchar)pixel];
637
  out_pixels=remap[(uint8_t)pixel];
635
  
638
  
636
  pixel=in_pixels;
639
  pixel=in_pixels;
637
  pixel>>=8;
640
  pixel>>=8;
638
  pixel=remap[(uchar)pixel];
641
  pixel=remap[(uint8_t)pixel];
639
  pixel<<=8;
642
  pixel<<=8;
640
  out_pixels|=pixel;
643
  out_pixels|=pixel;
641
644
642
  pixel=in_pixels;
645
  pixel=in_pixels;
643
  pixel>>=16;
646
  pixel>>=16;
644
  pixel=remap[(uchar)pixel];
647
  pixel=remap[(uint8_t)pixel];
645
  pixel<<=16;
648
  pixel<<=16;
646
  out_pixels|=pixel;
649
  out_pixels|=pixel;
647
650
648
  pixel=in_pixels;
651
  pixel=in_pixels;
649
  pixel>>=24;
652
  pixel>>=24;
650
  pixel=remap[(uchar)pixel];
653
  pixel=remap[(uint8_t)pixel];
651
  pixel<<=24;
654
  pixel<<=24;
652
  out_pixels|=pixel;
655
  out_pixels|=pixel;
653
656
Lines 662-690 Link Here
662
  
665
  
663
  pixel=in_pixels;
666
  pixel=in_pixels;
664
  pixel>>=8;
667
  pixel>>=8;
665
  pixel=remap[(uchar)pixel];
668
  pixel=remap[(uint8_t)pixel];
666
  pixel<<=8;
669
  pixel<<=8;
667
  out_pixels|=pixel;
670
  out_pixels|=pixel;
668
671
669
  pixel=in_pixels;
672
  pixel=in_pixels;
670
  pixel>>=16;
673
  pixel>>=16;
671
  pixel=remap[(uchar)pixel];
674
  pixel=remap[(uint8_t)pixel];
672
  pixel<<=16;
675
  pixel<<=16;
673
  out_pixels|=pixel;
676
  out_pixels|=pixel;
674
677
675
  pixel=in_pixels;
678
  pixel=in_pixels;
676
  pixel>>=24;
679
  pixel>>=24;
677
  pixel=remap[(uchar)pixel];
680
  pixel=remap[(uint8_t)pixel];
678
  pixel<<=24;
681
  pixel<<=24;
679
  out_pixels|=pixel;  
682
  out_pixels|=pixel;  
680
  addr[1]=out_pixels;        // send out bus
683
  addr[1]=out_pixels;        // send out bus
681
  
684
  
682
}
685
}
683
686
684
inline long MAP_PUT2(long dest_addr, long screen_addr, long remap, long w)
687
inline int32_t MAP_PUT2(int32_t dest_addr, int32_t screen_addr, int32_t remap, int32_t w)
685
{ while (w--) 
688
{ while (w--) 
686
  { 
689
  { 
687
    *((uchar *)(dest_addr))=*((uchar *)remap+*((uchar *)screen_addr)); 
690
    *((uint8_t *)(dest_addr))=*((uint8_t *)remap+*((uint8_t *)screen_addr)); 
688
    screen_addr++; 
691
    screen_addr++; 
689
    dest_addr++;
692
    dest_addr++;
690
  } 
693
  } 
Lines 693-703 Link Here
693
696
694
*/
697
*/
695
698
696
ushort min_light_level;
699
uint16_t min_light_level;
697
// calculate the light value for this block.  sum up all contritors
700
// calculate the light value for this block.  sum up all contritors
698
inline int calc_light_value(light_patch *lp,   // light patch to look at
701
inline int calc_light_value(light_patch *lp,   // light patch to look at
699
			    long sx,           // screen x & y
702
			    int32_t sx,           // screen x & y
700
			    long sy)
703
			    int32_t sy)
701
{
704
{
702
  int lv=min_light_level,r2,light_count;
705
  int lv=min_light_level,r2,light_count;
703
  register int dx,dy;           // x and y distances
706
  register int dx,dy;           // x and y distances
Lines 707-716 Link Here
707
  for (light_count=lp->total;light_count>0;light_count--)
710
  for (light_count=lp->total;light_count>0;light_count--)
708
  {
711
  {
709
    light_source *fn=*lon_p;
712
    light_source *fn=*lon_p;
710
    register long *dt=&(*lon_p)->type; 
713
    register int32_t *dt=&(*lon_p)->type; 
711
                                     // note we are accessing structure members by bypassing the compiler
714
                                     // note we are accessing structure members by bypassing the compiler
712
                                     // for speed, this may not work on all compilers, but don't
715
                                     // for speed, this may not work on all compilers, but don't
713
                                     // see why it shouldn't..  all members are long
716
                                     // see why it shouldn't..  all members are int32_t
714
    
717
    
715
    if (*dt==9)                      // (dt==type),  if light is a Solid rectangle, return it value
718
    if (*dt==9)                      // (dt==type),  if light is a Solid rectangle, return it value
716
      return fn->inner_radius;
719
      return fn->inner_radius;
Lines 745-760 Link Here
745
748
746
/*#ifdef __WATCOMC__
749
/*#ifdef __WATCOMC__
747
750
748
extern "C" void remap_line_asm(uchar *screen_line,uchar *light_lookup,uchar *remap_line,int count);
751
extern "C" void remap_line_asm(uint8_t *screen_line,uint8_t *light_lookup,uint8_t *remap_line,int count);
749
752
750
#else */
753
#else */
751
754
752
void remap_line_asm2(uchar *addr,uchar *light_lookup,uchar *remap_line,int count)
755
void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
753
//inline void remap_line_asm2(uchar *addr,uchar *light_lookup,uchar *remap_line,int count)
756
//inline void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
754
{
757
{
755
  while (count--)
758
  while (count--)
756
  {
759
  {
757
    uchar *off=light_lookup+(((long)*remap_line)<<8); 
760
    uint8_t *off=light_lookup+(((int32_t)*remap_line)<<8); 
758
    remap_line++;
761
    remap_line++;
759
762
760
    *addr=off[*addr]; 
763
    *addr=off[*addr]; 
Lines 773-785 Link Here
773
//#endif
776
//#endif
774
777
775
778
776
inline void put_8line(uchar *in_line, uchar *out_line, uchar *remap, uchar *light_lookup, int count)
779
inline void put_8line(uint8_t *in_line, uint8_t *out_line, uint8_t *remap, uint8_t *light_lookup, int count)
777
{
780
{
778
  uchar v;
781
  uint8_t v;
779
  int x;
782
  int x;
780
  for (x=0;x<count;x++)                        
783
  for (x=0;x<count;x++)                        
781
  {                                            
784
  {                                            
782
    uchar *off=light_lookup+(((long)*remap)<<8);
785
    uint8_t *off=light_lookup+(((int32_t)*remap)<<8);
783
786
784
    v=off[*(in_line++)];
787
    v=off[*(in_line++)];
785
    *(out_line++)=v;
788
    *(out_line++)=v;
Lines 818-824 Link Here
818
}
821
}
819
822
820
823
821
void light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient)
824
void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient)
822
{
825
{
823
  int lx_run=0,ly_run;                     // light block x & y run size in pixels ==  (1<<lx_run)
826
  int lx_run=0,ly_run;                     // light block x & y run size in pixels ==  (1<<lx_run)
824
827
Lines 858-876 Link Here
858
861
859
  int suffix=(cx2-cx1-prefix+1)&7;
862
  int suffix=(cx2-cx1-prefix+1)&7;
860
863
861
  long remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
864
  int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
862
865
863
  uchar *remap_line=(uchar *)jmalloc(remap_size,"light remap line");
866
  uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
864
867
865
  light_patch *f=first;
868
  light_patch *f=first;
866
  uchar *screen_line=screen->scan_line(cy1)+cx1;
869
  uint8_t *screen_line=screen->scan_line(cy1)+cx1;
867
870
868
  for (int y=cy1;y<=cy2;)
871
  for (int y=cy1;y<=cy2;)
869
  {
872
  {
870
    int x,count;
873
    int x,count;
871
//    while (f->next && f->y2<y) 
874
//    while (f->next && f->y2<y) 
872
//      f=f->next;
875
//      f=f->next;
873
    uchar *rem=remap_line;
876
    uint8_t *rem=remap_line;
874
877
875
    int todoy=4-((screeny+y)&3);
878
    int todoy=4-((screeny+y)&3);
876
    if (y+todoy>cy2)
879
    if (y+todoy>cy2)
Lines 884-904 Link Here
884
      light_patch *lp=f;
887
      light_patch *lp=f;
885
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
888
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
886
			      lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
889
			      lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
887
      long caddr=(long)screen_line+cx2-cx1+1-suffix;
890
      uint8_t * caddr=(uint8_t *)screen_line+cx2-cx1+1-suffix;
888
      uchar *r=light_lookup+(((long)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
891
      uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
889
      switch (todoy)
892
      switch (todoy)
890
      {
893
      {
891
	case 4 :
894
	case 4 :
892
	{ 
895
	{ 
893
	  MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;
896
	  MAP_PUT(caddr,r,suffix); caddr+=scr_w;
894
	}
897
	}
895
	case 3 :
898
	case 3 :
896
	{ MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;}
899
	{ MAP_PUT(caddr,r,suffix); caddr+=scr_w;}
897
	case 2 :
900
	case 2 :
898
	{ MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;}
901
	{ MAP_PUT(caddr,r,suffix); caddr+=scr_w;}
899
	case 1 :
902
	case 1 :
900
	{ 
903
	{ 
901
	  MAP_PUT(caddr,(long)r,suffix);
904
	  MAP_PUT(caddr,r,suffix);
902
	}
905
	}
903
      }
906
      }
904
    }
907
    }
Lines 909-929 Link Here
909
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
912
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
910
			      lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
913
			      lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
911
914
912
      uchar *r=light_lookup+(((long)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
915
      uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
913
      long caddr=(long)screen_line;
916
      uint8_t * caddr=(uint8_t *)screen_line;
914
      switch (todoy)
917
      switch (todoy)
915
      {
918
      {
916
	case 4 :
919
	case 4 :
917
	{ 
920
	{ 
918
	  MAP_PUT(caddr,(long)r,prefix); 
921
	  MAP_PUT(caddr,r,prefix); 
919
	  caddr+=scr_w; 
922
	  caddr+=scr_w; 
920
	}
923
	}
921
	case 3 :
924
	case 3 :
922
	{ MAP_PUT(caddr,(long)r,prefix); caddr+=scr_w; }
925
	{ MAP_PUT(caddr,r,prefix); caddr+=scr_w; }
923
	case 2 :
926
	case 2 :
924
	{ MAP_PUT(caddr,(long)r,prefix); caddr+=scr_w; }
927
	{ MAP_PUT(caddr,r,prefix); caddr+=scr_w; }
925
	case 1 :
928
	case 1 :
926
	{ MAP_PUT(caddr,(long)r,prefix); }
929
	{ MAP_PUT(caddr,r,prefix); }
927
      }
930
      }
928
      screen_line+=prefix;
931
      screen_line+=prefix;
929
    }
932
    }
Lines 968-975 Link Here
968
}
971
}
969
972
970
973
971
void double_light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient,
974
void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
972
			 image *out, long out_x, long out_y)
975
			 image *out, int32_t out_x, int32_t out_y)
973
{
976
{
974
  if (sc->width()*2+out_x>out->width() ||
977
  if (sc->width()*2+out_x>out->width() ||
975
      sc->height()*2+out_y>out->height()) 
978
      sc->height()*2+out_y>out->height()) 
Lines 1000-1010 Link Here
1000
1003
1001
  if (ambient==63)      // lights off, just double the pixels
1004
  if (ambient==63)      // lights off, just double the pixels
1002
  {
1005
  {
1003
    uchar *src=sc->scan_line(0);
1006
    uint8_t *src=sc->scan_line(0);
1004
    uchar *dst=out->scan_line(out_y+cy1*2)+cx1*2+out_x;
1007
    uint8_t *dst=out->scan_line(out_y+cy1*2)+cx1*2+out_x;
1005
    int d_skip=out->width()-sc->width()*2;
1008
    int d_skip=out->width()-sc->width()*2;
1006
    int x,y;
1009
    int x,y;
1007
    ushort v;
1010
    uint16_t v;
1008
    for (y=sc->height();y;y--)
1011
    for (y=sc->height();y;y--)
1009
    {
1012
    {
1010
      for (x=sc->width();x;x--)
1013
      for (x=sc->width();x;x--)
Lines 1034-1046 Link Here
1034
1037
1035
  int suffix=(cx2-cx1-prefix+1)&7;
1038
  int suffix=(cx2-cx1-prefix+1)&7;
1036
1039
1037
  long remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
1040
  int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
1038
1041
1039
  uchar *remap_line=(uchar *)jmalloc(remap_size,"light remap line");
1042
  uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
1040
1043
1041
  light_patch *f=first;
1044
  light_patch *f=first;
1042
  uchar *in_line=sc->scan_line(cy1)+cx1;
1045
  uint8_t *in_line=sc->scan_line(cy1)+cx1;
1043
  uchar *out_line=out->scan_line(cy1*2+out_y)+cx1*2+out_x;
1046
  uint8_t *out_line=out->scan_line(cy1*2+out_y)+cx1*2+out_x;
1044
1047
1045
1048
1046
  for (int y=cy1;y<=cy2;)
1049
  for (int y=cy1;y<=cy2;)
Lines 1048-1054 Link Here
1048
    int x,count;
1051
    int x,count;
1049
//    while (f->next && f->y2<y) 
1052
//    while (f->next && f->y2<y) 
1050
//      f=f->next;
1053
//      f=f->next;
1051
    uchar *rem=remap_line;
1054
    uint8_t *rem=remap_line;
1052
1055
1053
    int todoy=4-((screeny+y)&3);
1056
    int todoy=4-((screeny+y)&3);
1054
    if (y+todoy>cy2)
1057
    if (y+todoy>cy2)
Lines 1062-1092 Link Here
1062
      light_patch *lp=f;
1065
      light_patch *lp=f;
1063
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
1066
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
1064
			      lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
1067
			      lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
1065
      long caddr=(long)in_line+cx2-cx1+1-suffix;
1068
      uint8_t * caddr=(uint8_t *)in_line+cx2-cx1+1-suffix;
1066
      long daddr=(long)out_line+(cx2-cx1+1-suffix)*2;
1069
      uint8_t * daddr=(uint8_t *)out_line+(cx2-cx1+1-suffix)*2;
1067
1070
1068
      uchar *r=light_lookup+(((long)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
1071
      uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
1069
      switch (todoy)
1072
      switch (todoy)
1070
      {
1073
      {
1071
	case 4 : 
1074
	case 4 : 
1072
	{ 
1075
	{ 
1073
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
1076
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
1074
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
1077
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
1075
	}
1078
	}
1076
	case 3 :
1079
	case 3 :
1077
	{ 
1080
	{ 
1078
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
1081
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
1079
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
1082
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
1080
	}
1083
	}
1081
	case 2 :
1084
	case 2 :
1082
	{ 
1085
	{ 
1083
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
1086
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
1084
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
1087
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
1085
	}
1088
	}
1086
	case 1 :
1089
	case 1 :
1087
	{ 
1090
	{ 
1088
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
1091
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
1089
	  MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
1092
	  MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
1090
	} break;
1093
	} break;
1091
      }
1094
      }
1092
    }
1095
    }
Lines 1097-1126 Link Here
1097
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
1100
      for (;(lp->y1>y-cy1 || lp->y2<y-cy1 || 
1098
			      lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
1101
			      lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
1099
1102
1100
      uchar *r=light_lookup+(((long)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
1103
      uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
1101
      long caddr=(long)in_line;
1104
      uint8_t * caddr=(uint8_t *)in_line;
1102
      long daddr=(long)out_line;
1105
      uint8_t * daddr=(uint8_t *)out_line;
1103
      switch (todoy)
1106
      switch (todoy)
1104
      {
1107
      {
1105
	case 4 :
1108
	case 4 :
1106
	{ 
1109
	{ 
1107
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
1110
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
1108
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
1111
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
1109
	}
1112
	}
1110
	case 3 :
1113
	case 3 :
1111
	{ 
1114
	{ 
1112
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
1115
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
1113
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
1116
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
1114
	}
1117
	}
1115
	case 2 :
1118
	case 2 :
1116
	{ 
1119
	{ 
1117
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
1120
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
1118
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
1121
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
1119
	}
1122
	}
1120
	case 1 :
1123
	case 1 :
1121
	{ 
1124
	{ 
1122
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
1125
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
1123
	  MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
1126
	  MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
1124
	} break;
1127
	} break;
1125
      }
1128
      }
1126
      in_line+=prefix;
1129
      in_line+=prefix;
Lines 1183-1189 Link Here
1183
1186
1184
void add_light_spec(spec_directory *sd, char *level_name)
1187
void add_light_spec(spec_directory *sd, char *level_name)
1185
{
1188
{
1186
  long size=4+4;  // number of lights and minimum light levels
1189
  int32_t size=4+4;  // number of lights and minimum light levels
1187
  for (light_source *f=first_light_source;f;f=f->next)
1190
  for (light_source *f=first_light_source;f;f=f->next)
1188
    size+=6*4+1;
1191
    size+=6*4+1;
1189
  sd->add_by_hand(new spec_entry(SPEC_LIGHT_LIST,"lights",NULL,size,0));  
1192
  sd->add_by_hand(new spec_entry(SPEC_LIGHT_LIST,"lights",NULL,size,0));  
Lines 1194-1210 Link Here
1194
  int t=0;
1197
  int t=0;
1195
  light_source *f=first_light_source;
1198
  light_source *f=first_light_source;
1196
  for (;f;f=f->next) t++;
1199
  for (;f;f=f->next) t++;
1197
  fp->write_long(t);
1200
  fp->write_uint32(t);
1198
  fp->write_long(min_light_level);
1201
  fp->write_uint32(min_light_level);
1199
  for (f=first_light_source;f;f=f->next)
1202
  for (f=first_light_source;f;f=f->next)
1200
  {
1203
  {
1201
    fp->write_long(f->x);
1204
    fp->write_uint32(f->x);
1202
    fp->write_long(f->y);
1205
    fp->write_uint32(f->y);
1203
    fp->write_long(f->xshift);
1206
    fp->write_uint32(f->xshift);
1204
    fp->write_long(f->yshift);
1207
    fp->write_uint32(f->yshift);
1205
    fp->write_long(f->inner_radius);
1208
    fp->write_uint32(f->inner_radius);
1206
    fp->write_long(f->outer_radius);
1209
    fp->write_uint32(f->outer_radius);
1207
    fp->write_byte(f->type);
1210
    fp->write_uint8(f->type);
1208
  }
1211
  }
1209
}
1212
}
1210
1213
Lines 1216-1234 Link Here
1216
  if (se)
1219
  if (se)
1217
  {
1220
  {
1218
    fp->seek(se->offset,SEEK_SET);
1221
    fp->seek(se->offset,SEEK_SET);
1219
    long t=fp->read_long();
1222
    int32_t t=fp->read_uint32();
1220
    min_light_level=fp->read_long();
1223
    min_light_level=fp->read_uint32();
1221
    light_source *last;
1224
    light_source *last=NULL;
1222
    while (t)
1225
    while (t)
1223
    {
1226
    {
1224
      t--;
1227
      t--;
1225
      long x=fp->read_long();
1228
      int32_t x=fp->read_uint32();
1226
      long y=fp->read_long();
1229
      int32_t y=fp->read_uint32();
1227
      long xshift=fp->read_long();
1230
      int32_t xshift=fp->read_uint32();
1228
      long yshift=fp->read_long();
1231
      int32_t yshift=fp->read_uint32();
1229
      long ir=fp->read_long();
1232
      int32_t ir=fp->read_uint32();
1230
      long ora=fp->read_long();
1233
      int32_t ora=fp->read_uint32();
1231
      long ty=fp->read_byte();
1234
      int32_t ty=fp->read_uint8();
1232
1235
1233
      light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
1236
      light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
1234
      
1237
      
(-)abuse-sdl-0.7.0.orig/src/crc.cpp (-5 / +5 lines)
Lines 1-8 Link Here
1
#include "crc.hpp"
1
#include "crc.hpp"
2
2
3
unsigned short calc_crc(unsigned char *buf, long len)
3
uint16_t calc_crc(uint8_t *buf, int len)
4
{
4
{
5
  unsigned char c1=0,c2=0;
5
  uint8_t c1=0,c2=0;
6
  while (len)
6
  while (len)
7
  {
7
  {
8
    len--;
8
    len--;
Lines 15-26 Link Here
15
15
16
16
17
 
17
 
18
ulong crc_file(bFILE *fp)
18
uint32_t crc_file(bFILE *fp)
19
{
19
{
20
  uchar crc1=0,crc2=0,crc3=0,crc4=0;
20
  uint8_t crc1=0,crc2=0,crc3=0,crc4=0;
21
21
22
  int size=0x1000;
22
  int size=0x1000;
23
  uchar *buffer=(uchar *)jmalloc(size,"crc_buffer"),*c;
23
  uint8_t *buffer=(uint8_t *)jmalloc(size,"crc_buffer"),*c;
24
  long l=fp->file_size();
24
  long l=fp->file_size();
25
  long cur_pos=fp->tell();
25
  long cur_pos=fp->tell();
26
  fp->seek(0,0);
26
  fp->seek(0,0);
(-)abuse-sdl-0.7.0.orig/src/intsect.cpp (-14 / +14 lines)
Lines 1-8 Link Here
1
#include "macs.hpp"
1
#include "macs.hpp"
2
#include <stdlib.h>
2
#include <stdlib.h>
3
3
4
void pushback(long x1,long y1,long &x2,long &y2,
4
void pushback(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
5
		     long xp1, long yp1, long xp2, long yp2, int xdir, int ydir, int inside)
5
		     int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2, int xdir, int ydir, int inside)
6
{
6
{
7
7
8
   // determine if the lines are intersecting before we set back
8
   // determine if the lines are intersecting before we set back
Lines 14-23 Link Here
14
}
14
}
15
15
16
16
17
/* int setback_intersect(long x1,long y1,long &x2,long &y2,
17
/* int setback_intersect(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
18
		     long xp1, long yp1, long xp2, long yp2)
18
		     int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2)
19
{
19
{
20
  long mx1,my1,b1,mx2,my2,b2,side1,side2,tx2,ty2;
20
  int32_t mx1,my1,b1,mx2,my2,b2,side1,side2,tx2,ty2;
21
  my1=(y2-y1);
21
  my1=(y2-y1);
22
  if (!my1)                  // is the first line strait across?
22
  if (!my1)                  // is the first line strait across?
23
  {
23
  {
Lines 109-122 Link Here
109
        {
109
        {
110
          if (abs(mx1)>abs(my1))
110
          if (abs(mx1)>abs(my1))
111
          {
111
          {
112
            long ae_bd=my1*mx2-mx1*my2;
112
            int32_t ae_bd=my1*mx2-mx1*my2;
113
            CONDITION(ae_bd,"line intersect fuck up");
113
            CONDITION(ae_bd,"line intersect fuck up");
114
            tx2=(mx1*mx2*(b2-b1))/ae_bd+xadd;
114
            tx2=(mx1*mx2*(b2-b1))/ae_bd+xadd;
115
            ty2=my1*tx2/mx1+b1;
115
            ty2=my1*tx2/mx1+b1;
116
          }
116
          }
117
          else
117
          else
118
          {
118
          {
119
            long db_ea=(my2*mx1-mx2*my1);
119
            int32_t db_ea=(my2*mx1-mx2*my1);
120
            CONDITION(db_ea,"line intersect fuck up");
120
            CONDITION(db_ea,"line intersect fuck up");
121
            ty2=(mx1*b1*my2-my1*mx2*b2)/db_ea+yadd;
121
            ty2=(mx1*b1*my2-my1*mx2*b2)/db_ea+yadd;
122
            tx2=mx1*(ty2-b1)/my1;
122
            tx2=mx1*(ty2-b1)/my1;
Lines 136-150 Link Here
136
} */
136
} */
137
137
138
138
139
int setback_intersect(long x1,long y1,long &x2,long &y2,
139
int setback_intersect(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
140
		      long xp1, long yp1, long xp2, long yp2, 
140
		      int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2, 
141
                     long inside)  // which side is inside the polygon? (0 always setback)
141
                     int32_t inside)  // which side is inside the polygon? (0 always setback)
142
{
142
{
143
  // the line equations will be put in the form
143
  // the line equations will be put in the form
144
  // x(y2-y1)+y(x1-x2)-x1*y2+x2*y1=0
144
  // x(y2-y1)+y(x1-x2)-x1*y2+x2*y1=0
145
  //     A        B        C  
145
  //     A        B        C  
146
146
147
  long a1,b1,c1,a2,b2,c2,r1,r2;              
147
  int32_t a1,b1,c1,a2,b2,c2,r1,r2;              
148
148
149
  a1=y2-y1;        
149
  a1=y2-y1;        
150
  b1=x1-x2;        
150
  b1=x1-x2;        
Lines 156-163 Link Here
156
    r1=xp1; xp1=xp2; xp2=r1;
156
    r1=xp1; xp1=xp2; xp2=r1;
157
  } 
157
  } 
158
158
159
  long xdiff,ydiff;
159
  int32_t xdiff,ydiff;
160
/*  long xdiff=abs(xp1-xp2),ydiff=yp1-yp2;  
160
/*  int32_t xdiff=abs(xp1-xp2),ydiff=yp1-yp2;  
161
  if (xdiff>=ydiff)                              // increment the endpoints 
161
  if (xdiff>=ydiff)                              // increment the endpoints 
162
    if (xp2<xp1) { xp2--; xp1++; }  				 
162
    if (xp2<xp1) { xp2--; xp1++; }  				 
163
    else { xp2++; xp1--; } 
163
    else { xp2++; xp1--; } 
Lines 186-192 Link Here
186
           (xp1>=xp2 && ((r2^inside)<0)) ||
186
           (xp1>=xp2 && ((r2^inside)<0)) ||
187
	   inside==0 || r2==0) 
187
	   inside==0 || r2==0) 
188
      { 
188
      { 
189
	long ae=a1*b2,bd=b1*a2;	
189
	int32_t ae=a1*b2,bd=b1*a2;	
190
	if (ae!=bd)         // co-linear returns 0
190
	if (ae!=bd)         // co-linear returns 0
191
	{
191
	{
192
	  x2=(b1*c2-b2*c1)/(ae-bd);
192
	  x2=(b1*c2-b2*c1)/(ae-bd);
(-)abuse-sdl-0.7.0.orig/src/unixnfc.cpp (-31 / +30 lines)
Lines 27-37 Link Here
27
#define DIN_NAME "/tmp/.abuse_ndrv_out"   // opposite of driver's in/out
27
#define DIN_NAME "/tmp/.abuse_ndrv_out"   // opposite of driver's in/out
28
#define DOUT_NAME "/tmp/.abuse_ndrv_in"
28
#define DOUT_NAME "/tmp/.abuse_ndrv_in"
29
29
30
#define uchar unsigned char
30
#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((uint8_t *)(ptr)-(uint8_t *)base)))
31
#define ushort unsigned short
31
#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((intptr_t)(ptr)+(intptr_t)(base))))
32
33
#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((char *)(ptr)-(char *)base)))
34
#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((long)(ptr)+(long)(base))))
35
32
36
#ifdef __sgi
33
#ifdef __sgi
37
#define next_process() sginap(0)
34
#define next_process() sginap(0)
Lines 191-201 Link Here
191
    if (write(net_out_fd,filename,cm[1])!=cm[1])  { kill_net(); return -1; }
188
    if (write(net_out_fd,filename,cm[1])!=cm[1])  { kill_net(); return -1; }
192
    if (write(net_out_fd,mode,cm[2])!=cm[2])  { kill_net(); return -1; }
189
    if (write(net_out_fd,mode,cm[2])!=cm[2])  { kill_net(); return -1; }
193
190
194
    uchar file_type;
191
    uint8_t file_type;
195
    if (read(net_in_fd,&file_type,1)!=1)  { kill_net(); return -1; }    
192
    if (read(net_in_fd,&file_type,1)!=1)  { kill_net(); return -1; }    
196
    if (file_type==NF_OPEN_LOCAL_FILE) 
193
    if (file_type==NF_OPEN_LOCAL_FILE) 
197
    {
194
    {
198
      uchar name_size;
195
      uint8_t name_size;
199
      if (read(net_in_fd,&name_size,1)!=1)  { kill_net(); return -1; }          
196
      if (read(net_in_fd,&name_size,1)!=1)  { kill_net(); return -1; }          
200
      int size=read(net_in_fd,filename,name_size);
197
      int size=read(net_in_fd,filename,name_size);
201
      if (size!=name_size)  { kill_net(); return -1; }    
198
      if (size!=name_size)  { kill_net(); return -1; }    
Lines 210-216 Link Here
210
  } else return -2;          // return open local
207
  } else return -2;          // return open local
211
}
208
}
212
209
213
long NF_close(int fd)
210
int32_t NF_close(int fd)
214
{
211
{
215
  if (net_installed)
212
  if (net_installed)
216
  {
213
  {
Lines 224-230 Link Here
224
}
221
}
225
222
226
223
227
long NF_read(int fd, void *buf, long size)
224
int32_t NF_read(int fd, void *buf, int32_t size)
228
{
225
{
229
  if (net_installed && size)
226
  if (net_installed && size)
230
  {
227
  {
Lines 234-241 Link Here
234
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
231
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
235
    if (write(net_out_fd,&size,sizeof(size))!=sizeof(size)) { kill_net(); return 0; }
232
    if (write(net_out_fd,&size,sizeof(size))!=sizeof(size)) { kill_net(); return 0; }
236
233
237
    long total_read=0;
234
    int32_t total_read=0;
238
    ushort t=0xffff;
235
    uint16_t t=0xffff;
239
    while (size && t>=READ_PACKET_SIZE-2)
236
    while (size && t>=READ_PACKET_SIZE-2)
240
    {
237
    {
241
      if (read(net_in_fd,&t,sizeof(t))!=sizeof(t))  { kill_net(); return 0; }      
238
      if (read(net_in_fd,&t,sizeof(t))!=sizeof(t))  { kill_net(); return 0; }      
Lines 252-284 Link Here
252
}
249
}
253
250
254
251
255
long NF_filelength(int fd)
252
int32_t NF_filelength(int fd)
256
{
253
{
257
  if (net_installed)
254
  if (net_installed)
258
  {
255
  {
259
    char cm=NFCMD_SIZE;
256
    char cm=NFCMD_SIZE;
260
    if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
257
    if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
261
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
258
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
262
    long size;
259
    int32_t size;
263
    if (read(net_in_fd,&size,sizeof(size))!=sizeof(size))  { kill_net(); return 0; }
260
    if (read(net_in_fd,&size,sizeof(size))!=sizeof(size))  { kill_net(); return 0; }
264
    return size;
261
    return size;
265
  } else return 0;  
262
  } else return 0;  
266
}
263
}
267
264
268
long NF_tell(int fd)
265
int32_t NF_tell(int fd)
269
{
266
{
270
  if (net_installed)
267
  if (net_installed)
271
  {
268
  {
272
    char cm=NFCMD_TELL;
269
    char cm=NFCMD_TELL;
273
    if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
270
    if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
274
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
271
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
275
    long offset;
272
    int32_t offset;
276
    if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset))  { kill_net(); return 0; }
273
    if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset))  { kill_net(); return 0; }
277
    return offset;
274
    return offset;
278
  } else return 0;  
275
  } else return 0;  
279
}
276
}
280
277
281
long NF_seek(int fd, long offset)
278
int32_t NF_seek(int fd, int32_t offset)
282
{
279
{
283
  if (net_installed)
280
  if (net_installed)
284
  {
281
  {
Lines 287-293 Link Here
287
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
284
    if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
288
    if (write(net_out_fd,&offset,sizeof(offset))!=sizeof(offset)) { kill_net(); return 0; }
285
    if (write(net_out_fd,&offset,sizeof(offset))!=sizeof(offset)) { kill_net(); return 0; }
289
286
290
    long offset;
287
    int32_t offset;
291
    if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset))  { kill_net(); return 0; }
288
    if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset))  { kill_net(); return 0; }
292
    return offset;
289
    return offset;
293
  } else return 0;  
290
  } else return 0;  
Lines 321-327 Link Here
321
	  base->calc_crcs=0;
318
	  base->calc_crcs=0;
322
	  base->mem_lock=0;
319
	  base->mem_lock=0;
323
320
324
	  uchar cmd=NFCMD_CRCS_CALCED;
321
	  uint8_t cmd=NFCMD_CRCS_CALCED;
325
	  if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
322
	  if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
326
	} else base->mem_lock=0;
323
	} else base->mem_lock=0;
327
      }
324
      }
Lines 331-337 Link Here
331
	{
328
	{
332
	  base->get_lsf=0;
329
	  base->get_lsf=0;
333
	  base->mem_lock=0;
330
	  base->mem_lock=0;
334
	  uchar c[2]={NFCMD_PROCESS_LSF,strlen(lsf)+1};
331
	  uint8_t c[2]={NFCMD_PROCESS_LSF,strlen(lsf)+1};
335
	  if (write(net_out_fd,&c,2)!=2) { kill_net(); return ; }
332
	  if (write(net_out_fd,&c,2)!=2) { kill_net(); return ; }
336
	  if (write(net_out_fd,lsf,c[1])!=c[1]) { kill_net(); return ; }
333
	  if (write(net_out_fd,lsf,c[1])!=c[1]) { kill_net(); return ; }
337
	} else base->mem_lock=0;
334
	} else base->mem_lock=0;
Lines 345-354 Link Here
345
{
342
{
346
  if (net_installed)
343
  if (net_installed)
347
  {
344
  {
348
    uchar cm[2]={NFCMD_REQUEST_LSF,strlen(name)+1};
345
    uint8_t cm[2]={NFCMD_REQUEST_LSF,strlen(name)+1};
349
    if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
346
    if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
350
    if (write(net_out_fd,name,cm[1])!=cm[1]) { kill_net(); return 0; }
347
    if (write(net_out_fd,name,cm[1])!=cm[1]) { kill_net(); return 0; }
351
    uchar size;
348
    uint8_t size;
352
    if (read(net_in_fd,&size,1)!=1) { kill_net(); return 0; }
349
    if (read(net_in_fd,&size,1)!=1) { kill_net(); return 0; }
353
    if (size==0) return 0;
350
    if (size==0) return 0;
354
    if (read(net_in_fd,filename,size)!=size) { kill_net(); return 0; }
351
    if (read(net_in_fd,filename,size)!=size) { kill_net(); return 0; }
Lines 361-370 Link Here
361
  if (net_installed)
358
  if (net_installed)
362
  {
359
  {
363
    if (!net_server) return 0;
360
    if (!net_server) return 0;
364
    uchar cm[2]={NFCMD_REQUEST_ENTRY,strlen(net_server)+1};
361
    uint8_t cm[2]={NFCMD_REQUEST_ENTRY,strlen(net_server)+1};
365
    if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
362
    if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
366
    if (write(net_out_fd,net_server,cm[1])!=cm[1]) { kill_net(); return 0; }
363
    if (write(net_out_fd,net_server,cm[1])!=cm[1]) { kill_net(); return 0; }
367
    ushort cnum;  // client number
364
    uint16_t cnum;  // client number
368
    if (read(net_in_fd,&cnum,2)!=2) { kill_net(); return 0; } 
365
    if (read(net_in_fd,&cnum,2)!=2) { kill_net(); return 0; } 
369
    if (cnum==0) return 0;
366
    if (cnum==0) return 0;
370
    local_client_number=cnum;
367
    local_client_number=cnum;
Lines 377-383 Link Here
377
{
374
{
378
  if (net_installed)
375
  if (net_installed)
379
  {
376
  {
380
    uchar cmd=NFCMD_RELOAD_START;
377
    uint8_t cmd=NFCMD_RELOAD_START;
381
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
378
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
382
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; } 
379
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; } 
383
    return cmd;
380
    return cmd;
Lines 389-395 Link Here
389
{
386
{
390
  if (net_installed)
387
  if (net_installed)
391
  {
388
  {
392
    uchar cmd=NFCMD_RELOAD_END;
389
    uint8_t cmd=NFCMD_RELOAD_END;
393
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
390
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
394
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; } 
391
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; } 
395
    return cmd;
392
    return cmd;
Lines 415-420 Link Here
415
412
416
      spec_directory sd(fp);  
413
      spec_directory sd(fp);  
417
414
415
#if 0
418
      spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
416
      spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
419
      if (!e)
417
      if (!e)
420
      { 
418
      { 
Lines 423-428 Link Here
423
	the_game->need_refresh();
421
	the_game->need_refresh();
424
      }
422
      }
425
      else 
423
      else 
424
#endif
426
        current_level=new level(&sd,fp,NET_STARTFILE);
425
        current_level=new level(&sd,fp,NET_STARTFILE);
427
426
428
      delete fp;     
427
      delete fp;     
Lines 502-510 Link Here
502
  if (net_installed)
501
  if (net_installed)
503
  {
502
  {
504
    if (base->join_list)
503
    if (base->join_list)
505
      base->packet.write_byte(SCMD_RELOAD);
504
      base->packet.write_uint8(SCMD_RELOAD);
506
505
507
    uchar cmd=NFCMD_SEND_INPUT;
506
    uint8_t cmd=NFCMD_SEND_INPUT;
508
507
509
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
508
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
510
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }    
509
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }    
Lines 516-522 Link Here
516
{
515
{
517
  if (net_installed)
516
  if (net_installed)
518
  {
517
  {
519
    uchar cmd=NFCMD_KILL_SLACKERS;
518
    uint8_t cmd=NFCMD_KILL_SLACKERS;
520
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
519
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
521
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }        
520
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }        
522
  }
521
  }
Lines 547-553 Link Here
547
      if ((((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000)>20)
546
      if ((((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000)>20)
548
      {
547
      {
549
//	fprintf(stderr,"receive timeout %d\n",(((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000));
548
//	fprintf(stderr,"receive timeout %d\n",(((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000));
550
	uchar cmd=NFCMD_INPUT_MISSING;
549
	uint8_t cmd=NFCMD_INPUT_MISSING;
551
	if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return  0; }    
550
	if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return  0; }    
552
	if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }     // block, so net driver can request input
551
	if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }     // block, so net driver can request input
553
	gettimeofday(&start,NULL);
552
	gettimeofday(&start,NULL);
Lines 621-627 Link Here
621
    { close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
620
    { close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
622
    else
621
    else
623
    {
622
    {
624
      uchar cmd=NFCMD_BLOCK;
623
      uint8_t cmd=NFCMD_BLOCK;
625
      if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
624
      if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }    
626
      if (base->input_state==INPUT_NET_DEAD)
625
      if (base->input_state==INPUT_NET_DEAD)
627
      { close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
626
      { close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
Lines 641-647 Link Here
641
{
640
{
642
  if (net_installed)
641
  if (net_installed)
643
  {
642
  {
644
    uchar cmd=NFCMD_BECOME_SERVER;
643
    uint8_t cmd=NFCMD_BECOME_SERVER;
645
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
644
    if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; } 
646
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }     
645
    if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }     
647
    
646
    
(-)abuse-sdl-0.7.0.orig/src/clisp.cpp (-111 / +111 lines)
Lines 19-26 Link Here
19
#include "jdir.hpp"
19
#include "jdir.hpp"
20
#include "netcfg.hpp"
20
#include "netcfg.hpp"
21
21
22
extern uchar major_version;
22
extern uint8_t major_version;
23
extern uchar minor_version;
23
extern uint8_t minor_version;
24
extern int has_joystick;
24
extern int has_joystick;
25
25
26
// the following are references to lisp symbols
26
// the following are references to lisp symbols
Lines 59-65 Link Here
59
	    *l_statbar_health_bg_color,
59
	    *l_statbar_health_bg_color,
60
60
61
	    *l_statbar_logo_x,*l_statbar_logo_y;
61
	    *l_statbar_logo_x,*l_statbar_logo_y;
62
uchar chatting_enabled=0; 
62
uint8_t chatting_enabled=0; 
63
63
64
extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s);
64
extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s);
65
extern void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s);
65
extern void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s);
Lines 778-787 Link Here
778
    } break;
778
    } break;
779
    case 24 :
779
    case 24 :
780
    {
780
    {
781
      long x1=lnumber_value(eval(CAR(args)));  args=CDR(args);
781
      int32_t x1=lnumber_value(eval(CAR(args)));  args=CDR(args);
782
      long y1=lnumber_value(eval(CAR(args)));  args=CDR(args);
782
      int32_t y1=lnumber_value(eval(CAR(args)));  args=CDR(args);
783
      long x2=lnumber_value(eval(CAR(args)));  args=CDR(args);
783
      int32_t x2=lnumber_value(eval(CAR(args)));  args=CDR(args);
784
      long y2=lnumber_value(eval(CAR(args)));
784
      int32_t y2=lnumber_value(eval(CAR(args)));
785
      current_level->foreground_intersect(x1,y1,x2,y2);
785
      current_level->foreground_intersect(x1,y1,x2,y2);
786
      void *ret=NULL;
786
      void *ret=NULL;
787
      push_onto_list(new_lisp_number(y2),ret);
787
      push_onto_list(new_lisp_number(y2),ret);
Lines 815-821 Link Here
815
    case 36 :
815
    case 36 :
816
    {
816
    {
817
      
817
      
818
      long xm,ym,but;
818
      int32_t xm,ym,but;
819
      xm=lnumber_value(CAR(args)); args=CDR(args);
819
      xm=lnumber_value(CAR(args)); args=CDR(args);
820
      ym=lnumber_value(CAR(args)); args=CDR(args);
820
      ym=lnumber_value(CAR(args)); args=CDR(args);
821
      but=lnumber_value(CAR(args));
821
      but=lnumber_value(CAR(args));
Lines 891-900 Link Here
891
    } break;
891
    } break;
892
    case 49 :
892
    case 49 :
893
    {
893
    {
894
      long x=lnumber_value(eval(CAR(args))); args=CDR(args);
894
      int32_t x=lnumber_value(eval(CAR(args))); args=CDR(args);
895
      long y=lnumber_value(eval(CAR(args))); args=CDR(args);
895
      int32_t y=lnumber_value(eval(CAR(args))); args=CDR(args);
896
896
897
      long rx,ry;
897
      int32_t rx,ry;
898
      the_game->mouse_to_game(x,y,rx,ry);
898
      the_game->mouse_to_game(x,y,rx,ry);
899
      void *ret=NULL;
899
      void *ret=NULL;
900
      {
900
      {
Lines 906-915 Link Here
906
    } break;
906
    } break;
907
    case 50 :
907
    case 50 :
908
    {
908
    {
909
      long x=lnumber_value(eval(CAR(args))); args=CDR(args);
909
      int32_t x=lnumber_value(eval(CAR(args))); args=CDR(args);
910
      long y=lnumber_value(eval(CAR(args))); args=CDR(args);
910
      int32_t y=lnumber_value(eval(CAR(args))); args=CDR(args);
911
911
912
      long rx,ry;
912
      int32_t rx,ry;
913
      the_game->game_to_mouse(x,y,current_view,rx,ry);
913
      the_game->game_to_mouse(x,y,current_view,rx,ry);
914
      void *ret=NULL;
914
      void *ret=NULL;
915
      {
915
      {
Lines 1002-1008 Link Here
1002
    {
1002
    {
1003
    	long x;
1003
    	long x;
1004
    	sscanf(lstring_value(eval(CAR(args))),"%lx",&x);
1004
    	sscanf(lstring_value(eval(CAR(args))),"%lx",&x);
1005
    	return new_lisp_pointer((void *)x);
1005
    	return new_lisp_pointer((void *)(intptr_t)x);
1006
    } break;
1006
    } break;
1007
    case 64 :
1007
    case 64 :
1008
    {
1008
    {
Lines 1137-1143 Link Here
1137
    case 21 : return current_object->fade_dir(); break;
1137
    case 21 : return current_object->fade_dir(); break;
1138
    case 22 :
1138
    case 22 :
1139
    {
1139
    {
1140
      long x1,y1,x2,y2,xp1,yp1,xp2,yp2;
1140
      int32_t x1,y1,x2,y2,xp1,yp1,xp2,yp2;
1141
      current_level->attacker(current_object)->picture_space(x1,y1,x2,y2);
1141
      current_level->attacker(current_object)->picture_space(x1,y1,x2,y2);
1142
      current_object->picture_space(xp1,yp1,xp2,yp2);
1142
      current_object->picture_space(xp1,yp1,xp2,yp2);
1143
      if (xp1>x2 || xp2<x1 || yp1>y2 || yp2<y1) return 0;
1143
      if (xp1>x2 || xp2<x1 || yp1>y2 || yp2<y1) return 0;
Lines 1155-1167 Link Here
1155
    case 30 : return current_object->x; break;
1155
    case 30 : return current_object->x; break;
1156
    case 31 : return current_object->y; break;
1156
    case 31 : return current_object->y; break;
1157
    case 32 : 
1157
    case 32 : 
1158
    { long v=lnumber_value(CAR(args));
1158
    { int32_t v=lnumber_value(CAR(args));
1159
      current_object->x=v;
1159
      current_object->x=v;
1160
//      current_object->last_x=v;
1160
//      current_object->last_x=v;
1161
      return 1; 
1161
      return 1; 
1162
    } break;
1162
    } break;
1163
    case 33 : 
1163
    case 33 : 
1164
    { long v=lnumber_value(CAR(args));
1164
    { int32_t v=lnumber_value(CAR(args));
1165
      current_object->y=v;
1165
      current_object->y=v;
1166
//      current_object->last_y=v;
1166
//      current_object->last_y=v;
1167
      return 1; 
1167
      return 1; 
Lines 1173-1179 Link Here
1173
1173
1174
    case 37 : 
1174
    case 37 : 
1175
    {
1175
    {
1176
      long s=lnumber_value(CAR(args));
1176
      int32_t s=lnumber_value(CAR(args));
1177
      current_object->set_state((character_state)s); 
1177
      current_object->set_state((character_state)s); 
1178
      return (s==current_object->state);
1178
      return (s==current_object->state);
1179
    } break;
1179
    } break;
Lines 1279-1289 Link Here
1279
    case 91 : current_object->add_object((game_object *)lpointer_value(CAR(args))); return 1; break;
1279
    case 91 : current_object->add_object((game_object *)lpointer_value(CAR(args))); return 1; break;
1280
    case 92 : 
1280
    case 92 : 
1281
    {
1281
    {
1282
      long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
1282
      int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
1283
      long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
1283
      int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
1284
      long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
1284
      int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
1285
      long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
1285
      int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
1286
      long c=lnumber_value(CAR(args));
1286
      int32_t c=lnumber_value(CAR(args));
1287
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
1287
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
1288
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
1288
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
1289
      screen->line(cx1,cy1,cx2,cy2,c);
1289
      screen->line(cx1,cy1,cx2,cy2,c);
Lines 1301-1307 Link Here
1301
1301
1302
    case 104 :  
1302
    case 104 :  
1303
    { light_source *l=(light_source *)lpointer_value(CAR(args));
1303
    { light_source *l=(light_source *)lpointer_value(CAR(args));
1304
      long x=lnumber_value(CAR(CDR(args)));
1304
      int32_t x=lnumber_value(CAR(CDR(args)));
1305
      if (x>=1)
1305
      if (x>=1)
1306
        l->inner_radius=x;
1306
        l->inner_radius=x;
1307
      l->calc_range();
1307
      l->calc_range();
Lines 1309-1315 Link Here
1309
    } break;
1309
    } break;
1310
    case 105 :  
1310
    case 105 :  
1311
    { light_source *l=(light_source *)lpointer_value(CAR(args));
1311
    { light_source *l=(light_source *)lpointer_value(CAR(args));
1312
      long x=lnumber_value(CAR(CDR(args)));
1312
      int32_t x=lnumber_value(CAR(CDR(args)));
1313
      if (x>l->inner_radius)
1313
      if (x>l->inner_radius)
1314
        l->outer_radius=x;
1314
        l->outer_radius=x;
1315
      l->calc_range();
1315
      l->calc_range();
Lines 1396-1409 Link Here
1396
	int vol=lnumber_value(lcar(a)); a=CDR(a);
1396
	int vol=lnumber_value(lcar(a)); a=CDR(a);
1397
	if (a)
1397
	if (a)
1398
	{
1398
	{
1399
	  long x=lnumber_value(lcar(a)); a=CDR(a);
1399
	  int32_t x=lnumber_value(lcar(a)); a=CDR(a);
1400
	  if (!a)
1400
	  if (!a)
1401
	  {
1401
	  {
1402
	    lprint(args);
1402
	    lprint(args);
1403
	    lbreak("expecting y after x in play_sound\n");
1403
	    lbreak("expecting y after x in play_sound\n");
1404
	    exit(1);
1404
	    exit(1);
1405
	  }
1405
	  }
1406
	  long y=lnumber_value(lcar(a));
1406
	  int32_t y=lnumber_value(lcar(a));
1407
	  the_game->play_sound(id,vol,x,y);
1407
	  the_game->play_sound(id,vol,x,y);
1408
	} else cash.sfx(id)->play(vol);        
1408
	} else cash.sfx(id)->play(vol);        
1409
      }
1409
      }
Lines 1413-1426 Link Here
1413
    case 137 : return defun_pseq(args); break;
1413
    case 137 : return defun_pseq(args); break;
1414
    case 138 :
1414
    case 138 :
1415
    { int id=lnumber_value(CAR(args)); args=CDR(args);
1415
    { int id=lnumber_value(CAR(args)); args=CDR(args);
1416
      long x=lnumber_value(CAR(args)); args=CDR(args);
1416
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1417
      long y=lnumber_value(CAR(args)); args=CDR(args);
1417
      int32_t y=lnumber_value(CAR(args)); args=CDR(args);
1418
      long dir=lnumber_value(CAR(args));
1418
      int32_t dir=lnumber_value(CAR(args));
1419
      add_panim(id,x,y,dir);
1419
      add_panim(id,x,y,dir);
1420
    } break;
1420
    } break;
1421
    case 142 :
1421
    case 142 :
1422
    {
1422
    {
1423
      long x=lnumber_value(CAR(args)); args=CDR(args);
1423
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1424
      if (x<0 || x>=total_weapons)
1424
      if (x<0 || x>=total_weapons)
1425
      { 
1425
      { 
1426
	lbreak("weapon out of range (%d)\n",x);
1426
	lbreak("weapon out of range (%d)\n",x);
Lines 1430-1441 Link Here
1430
    } break;
1430
    } break;
1431
    case 143 :
1431
    case 143 :
1432
    {
1432
    {
1433
      long x=lnumber_value(CAR(args)); args=CDR(args);
1433
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1434
      long y=lnumber_value(CAR(args)); args=CDR(args);
1434
      int32_t y=lnumber_value(CAR(args)); args=CDR(args);
1435
      long r=lnumber_value(CAR(args)); args=CDR(args);
1435
      int32_t r=lnumber_value(CAR(args)); args=CDR(args);
1436
      long m=lnumber_value(CAR(args)); args=CDR(args);
1436
      int32_t m=lnumber_value(CAR(args)); args=CDR(args);
1437
      game_object *o=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
1437
      game_object *o=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
1438
      long mp=lnumber_value(CAR(args));
1438
      int32_t mp=lnumber_value(CAR(args));
1439
      current_level->hurt_radius(x,y,r,m,current_object,o,mp);
1439
      current_level->hurt_radius(x,y,r,m,current_object,o,mp);
1440
    } break;
1440
    } break;
1441
1441
Lines 1445-1452 Link Here
1445
      if (!v) dprintf("Can't add weapons for non-players\n");
1445
      if (!v) dprintf("Can't add weapons for non-players\n");
1446
      else
1446
      else
1447
      {
1447
      {
1448
	long x=lnumber_value(CAR(args)); args=CDR(args);
1448
	int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1449
	long y=lnumber_value(CAR(args)); args=CDR(args);
1449
	int32_t y=lnumber_value(CAR(args)); args=CDR(args);
1450
	if (x<0 || x>=total_weapons)
1450
	if (x<0 || x>=total_weapons)
1451
	{ lbreak("weapon out of range (%d)\n",x); exit(0); }
1451
	{ lbreak("weapon out of range (%d)\n",x); exit(0); }
1452
	v->add_ammo(x,y);
1452
	v->add_ammo(x,y);
Lines 1502-1519 Link Here
1502
    case 153 :
1502
    case 153 :
1503
    {
1503
    {
1504
      game_object *o=(game_object *)lpointer_value(CAR(args));
1504
      game_object *o=(game_object *)lpointer_value(CAR(args));
1505
      long x=o->x-current_object->x,
1505
      int32_t x=o->x-current_object->x,
1506
        y=-(o->y-o->picture()->height()/2-(current_object->y-(current_object->picture()->height()/2)));
1506
        y=-(o->y-o->picture()->height()/2-(current_object->y-(current_object->picture()->height()/2)));
1507
      return lisp_atan2(y,x);
1507
      return lisp_atan2(y,x);
1508
    } break;
1508
    } break;
1509
    case 154 :
1509
    case 154 :
1510
    {
1510
    {
1511
      long ang=lnumber_value(CAR(args)); args=CDR(args);
1511
      int32_t ang=lnumber_value(CAR(args)); args=CDR(args);
1512
      long mag=lfixed_point_value(CAR(args));
1512
      int32_t mag=lfixed_point_value(CAR(args));
1513
      long xvel=(lisp_cos(ang)>>8)*(mag>>8);
1513
      int32_t xvel=(lisp_cos(ang)>>8)*(mag>>8);
1514
      current_object->set_xvel(xvel>>16);
1514
      current_object->set_xvel(xvel>>16);
1515
      current_object->set_fxvel((xvel&0xffff)>>8);
1515
      current_object->set_fxvel((xvel&0xffff)>>8);
1516
      long yvel=-(lisp_sin(ang)>>8)*(mag>>8);
1516
      int32_t yvel=-(lisp_sin(ang)>>8)*(mag>>8);
1517
      current_object->set_yvel(yvel>>16);
1517
      current_object->set_yvel(yvel>>16);
1518
      current_object->set_fyvel((yvel&0xffff)>>8);      
1518
      current_object->set_fyvel((yvel&0xffff)>>8);      
1519
    } break;
1519
    } break;
Lines 1521-1534 Link Here
1521
    {
1521
    {
1522
      int tframes=current_object->total_frames(),f;
1522
      int tframes=current_object->total_frames(),f;
1523
1523
1524
      long ang1=lnumber_value(CAR(args)); args=CDR(args);      
1524
      int32_t ang1=lnumber_value(CAR(args)); args=CDR(args);      
1525
      if (ang1<0) ang1=(ang1%360)+360; 
1525
      if (ang1<0) ang1=(ang1%360)+360; 
1526
      else if (ang1>=360) ang1=ang1%360;
1526
      else if (ang1>=360) ang1=ang1%360;
1527
      long ang2=lnumber_value(CAR(args)); args=CDR(args);      
1527
      int32_t ang2=lnumber_value(CAR(args)); args=CDR(args);      
1528
      if (ang2<0) ang2=(ang2%360)+360; 
1528
      if (ang2<0) ang2=(ang2%360)+360; 
1529
      else if (ang2>=360) ang2=ang2%360;
1529
      else if (ang2>=360) ang2=ang2%360;
1530
1530
1531
      long ang=(lnumber_value(CAR(args))+90/tframes)%360;
1531
      int32_t ang=(lnumber_value(CAR(args))+90/tframes)%360;
1532
      if (ang1>ang2)
1532
      if (ang1>ang2)
1533
      {
1533
      {
1534
        if (ang<ang1 && ang>ang2) 	
1534
        if (ang<ang1 && ang>ang2) 	
Lines 1556-1567 Link Here
1556
    case 168 : if (current_object->morph_status()) return 1; else return 0; break;
1556
    case 168 : if (current_object->morph_status()) return 1; else return 0; break;
1557
    case 169 :
1557
    case 169 :
1558
    {
1558
    {
1559
      long am=lnumber_value(CAR(args)); args=CDR(args);
1559
      int32_t am=lnumber_value(CAR(args)); args=CDR(args);
1560
      game_object *from=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
1560
      game_object *from=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
1561
      long hitx=lnumber_value(CAR(args)); args=CDR(args);      
1561
      int32_t hitx=lnumber_value(CAR(args)); args=CDR(args);      
1562
      long hity=lnumber_value(CAR(args)); args=CDR(args);      
1562
      int32_t hity=lnumber_value(CAR(args)); args=CDR(args);      
1563
      long px=lnumber_value(CAR(args)); args=CDR(args);      
1563
      int32_t px=lnumber_value(CAR(args)); args=CDR(args);      
1564
      long py=lnumber_value(CAR(args)); args=CDR(args);
1564
      int32_t py=lnumber_value(CAR(args)); args=CDR(args);
1565
      current_object->damage_fun(am,from,hitx,hity,px,py);
1565
      current_object->damage_fun(am,from,hitx,hity,px,py);
1566
    } break;
1566
    } break;
1567
    case 170 : return current_object->gravity(); break;
1567
    case 170 : return current_object->gravity(); break;
Lines 1628-1634 Link Here
1628
    case 179 : 
1628
    case 179 : 
1629
    {
1629
    {
1630
      view *v=lget_view(CAR(args),"set_ambient_light");       args=CDR(args);
1630
      view *v=lget_view(CAR(args),"set_ambient_light");       args=CDR(args);
1631
      long x=lnumber_value(CAR(args));
1631
      int32_t x=lnumber_value(CAR(args));
1632
      if (x>=0 && x<64) v->ambient=x;
1632
      if (x>=0 && x<64) v->ambient=x;
1633
    } break;
1633
    } break;
1634
    case 180 : return lget_view(CAR(args),"ambient_light")->ambient; break;
1634
    case 180 : return lget_view(CAR(args),"ambient_light")->ambient; break;
Lines 1656-1664 Link Here
1656
    } break;
1656
    } break;
1657
    case 192 : 
1657
    case 192 : 
1658
    {     
1658
    {     
1659
      long x=lnumber_value(CAR(args)); args=CDR(args);
1659
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1660
      long y=lnumber_value(CAR(args)); args=CDR(args);
1660
      int32_t y=lnumber_value(CAR(args)); args=CDR(args);
1661
      long type=lnumber_value(CAR(args));
1661
      int32_t type=lnumber_value(CAR(args));
1662
      if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
1662
      if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
1663
        lbreak("%d %d is out of range of fg map",x,y);
1663
        lbreak("%d %d is out of range of fg map",x,y);
1664
      else	
1664
      else	
Lines 1666-1682 Link Here
1666
    } break;
1666
    } break;
1667
    case 193 :
1667
    case 193 :
1668
    { 
1668
    { 
1669
      long x=lnumber_value(CAR(args)); args=CDR(args);
1669
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1670
      long y=lnumber_value(CAR(args));
1670
      int32_t y=lnumber_value(CAR(args));
1671
      if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
1671
      if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
1672
        lbreak("%d %d is out of range of fg map",x,y);
1672
        lbreak("%d %d is out of range of fg map",x,y);
1673
      else return current_level->get_fg(x,y);
1673
      else return current_level->get_fg(x,y);
1674
    } break;
1674
    } break;
1675
    case 194 : 
1675
    case 194 : 
1676
    {     
1676
    {     
1677
      long x=lnumber_value(CAR(args)); args=CDR(args);
1677
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1678
      long y=lnumber_value(CAR(args)); args=CDR(args);
1678
      int32_t y=lnumber_value(CAR(args)); args=CDR(args);
1679
      long type=lnumber_value(CAR(args));
1679
      int32_t type=lnumber_value(CAR(args));
1680
      if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
1680
      if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
1681
        lbreak("%d %d is out of range of fg map",x,y);
1681
        lbreak("%d %d is out of range of fg map",x,y);
1682
      else	
1682
      else	
Lines 1684-1691 Link Here
1684
    } break;
1684
    } break;
1685
    case 195 :
1685
    case 195 :
1686
    { 
1686
    { 
1687
      long x=lnumber_value(CAR(args)); args=CDR(args);
1687
      int32_t x=lnumber_value(CAR(args)); args=CDR(args);
1688
      long y=lnumber_value(CAR(args));
1688
      int32_t y=lnumber_value(CAR(args));
1689
      if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
1689
      if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
1690
        lbreak("%d %d is out of range of fg map",x,y);
1690
        lbreak("%d %d is out of range of fg map",x,y);
1691
      else return current_level->get_bg(x,y);
1691
      else return current_level->get_bg(x,y);
Lines 1740-1752 Link Here
1740
    } break;
1740
    } break;
1741
    case 200 :
1741
    case 200 :
1742
    {
1742
    {
1743
      long xv=lnumber_value(CAR(args));  args=CDR(args);
1743
      int32_t xv=lnumber_value(CAR(args));  args=CDR(args);
1744
      long yv=lnumber_value(CAR(args));  args=CDR(args);
1744
      int32_t yv=lnumber_value(CAR(args));  args=CDR(args);
1745
      int top=2;
1745
      int top=2;
1746
      if (args)
1746
      if (args)
1747
        if (!CAR(args)) top=0;
1747
        if (!CAR(args)) top=0;
1748
        
1748
        
1749
      long oxv=xv,oyv=yv;
1749
      int32_t oxv=xv,oyv=yv;
1750
      current_object->try_move(current_object->x,current_object->y,xv,yv,1|top);
1750
      current_object->try_move(current_object->x,current_object->y,xv,yv,1|top);
1751
      current_object->x+=xv;
1751
      current_object->x+=xv;
1752
      current_object->y+=yv;
1752
      current_object->y+=yv;
Lines 1754-1770 Link Here
1754
    } break;
1754
    } break;
1755
    case 201 :
1755
    case 201 :
1756
    {
1756
    {
1757
      long x=lnumber_value(CAR(args));
1757
      int32_t x=lnumber_value(CAR(args));
1758
      return figures[current_object->otype]->get_sequence((character_state)x)->length();
1758
      return figures[current_object->otype]->get_sequence((character_state)x)->length();
1759
    } break;
1759
    } break;
1760
    case 202 :
1760
    case 202 :
1761
    { 
1761
    { 
1762
      long x1=lnumber_value(CAR(args)); args=CDR(args);
1762
      int32_t x1=lnumber_value(CAR(args)); args=CDR(args);
1763
      long y1=lnumber_value(CAR(args)); args=CDR(args);
1763
      int32_t y1=lnumber_value(CAR(args)); args=CDR(args);
1764
      long x2=lnumber_value(CAR(args)); args=CDR(args);
1764
      int32_t x2=lnumber_value(CAR(args)); args=CDR(args);
1765
      long y2=lnumber_value(CAR(args)); args=CDR(args);
1765
      int32_t y2=lnumber_value(CAR(args)); args=CDR(args);
1766
      void *block_all=CAR(args);
1766
      void *block_all=CAR(args);
1767
      long nx2=x2,ny2=y2;
1767
      int32_t nx2=x2,ny2=y2;
1768
      current_level->foreground_intersect(x1,y1,x2,y2);
1768
      current_level->foreground_intersect(x1,y1,x2,y2);
1769
      if (x2!=nx2 || y2!=ny2) return 0;
1769
      if (x2!=nx2 || y2!=ny2) return 0;
1770
      
1770
      
Lines 1795-1801 Link Here
1795
    } break;
1795
    } break;
1796
    case 206 :
1796
    case 206 :
1797
    {
1797
    {
1798
      long x=lnumber_value(CAR(args));
1798
      int32_t x=lnumber_value(CAR(args));
1799
      if (x<current_object->total_frames())
1799
      if (x<current_object->total_frames())
1800
        current_object->current_frame=x;
1800
        current_object->current_frame=x;
1801
      else      
1801
      else      
Lines 1833-1841 Link Here
1833
    } break;
1833
    } break;
1834
    case 216 :
1834
    case 216 :
1835
    {
1835
    {
1836
      long x1=lnumber_value(CAR(args)); args=lcdr(args);
1836
      int32_t x1=lnumber_value(CAR(args)); args=lcdr(args);
1837
      long y1=lnumber_value(CAR(args)); args=lcdr(args);
1837
      int32_t y1=lnumber_value(CAR(args)); args=lcdr(args);
1838
      long id=lnumber_value(CAR(args));
1838
      int32_t id=lnumber_value(CAR(args));
1839
      cash.img(id)->put_image(screen,x1,y1,1);
1839
      cash.img(id)->put_image(screen,x1,y1,1);
1840
    } break;
1840
    } break;
1841
    case 217 :
1841
    case 217 :
Lines 1908-1923 Link Here
1908
    case 228 :
1908
    case 228 :
1909
    {
1909
    {
1910
      palette *p=pal->copy();
1910
      palette *p=pal->copy();
1911
      uchar *addr=(uchar *)p->addr();
1911
      uint8_t *addr=(uint8_t *)p->addr();
1912
      int r,g,b;
1912
      int r,g,b;
1913
      int ra=lnumber_value(CAR(args)); args=CDR(args);
1913
      int ra=lnumber_value(CAR(args)); args=CDR(args);
1914
      int ga=lnumber_value(CAR(args)); args=CDR(args);
1914
      int ga=lnumber_value(CAR(args)); args=CDR(args);
1915
      int ba=lnumber_value(CAR(args));
1915
      int ba=lnumber_value(CAR(args));
1916
      for (int i=0;i<256;i++)
1916
      for (int i=0;i<256;i++)
1917
      {
1917
      {
1918
	r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uchar)r; addr++;
1918
	r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uint8_t)r; addr++;
1919
	g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uchar)g; addr++;
1919
	g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uint8_t)g; addr++;
1920
	b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uchar)b; addr++;
1920
	b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uint8_t)b; addr++;
1921
      }
1921
      }
1922
      p->load();
1922
      p->load();
1923
      delete p;
1923
      delete p;
Lines 1934-1940 Link Here
1934
      if (!v) lbreak("object has no view : local_player");
1934
      if (!v) lbreak("object has no view : local_player");
1935
      else 
1935
      else 
1936
      {
1936
      {
1937
	long x=lnumber_value(CAR(args));
1937
	int32_t x=lnumber_value(CAR(args));
1938
	if (x<0 || x>=total_weapons)
1938
	if (x<0 || x>=total_weapons)
1939
	{ lbreak("weapon out of range (%d)\n",x); exit(0); }
1939
	{ lbreak("weapon out of range (%d)\n",x); exit(0); }
1940
	v->current_weapon=x;	
1940
	v->current_weapon=x;	
Lines 1956-1967 Link Here
1956
1956
1957
    case 234 :
1957
    case 234 :
1958
    {
1958
    {
1959
      long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
1959
      int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
1960
      long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
1960
      int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
1961
      long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
1961
      int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
1962
      long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
1962
      int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
1963
      long c=lnumber_value(CAR(args)); args=lcdr(args);
1963
      int32_t c=lnumber_value(CAR(args)); args=lcdr(args);
1964
      long s=lnumber_value(CAR(args));
1964
      int32_t s=lnumber_value(CAR(args));
1965
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
1965
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
1966
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
1966
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
1967
      scatter_line(cx1,cy1,cx2,cy2,c,s);
1967
      scatter_line(cx1,cy1,cx2,cy2,c,s);
Lines 2008-2020 Link Here
2008
    } break;
2008
    } break;
2009
    case 244 :
2009
    case 244 :
2010
    {
2010
    {
2011
      long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
2011
      int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
2012
      long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
2012
      int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
2013
      long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
2013
      int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
2014
      long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
2014
      int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
2015
      long c1=lnumber_value(CAR(args)); args=lcdr(args);
2015
      int32_t c1=lnumber_value(CAR(args)); args=lcdr(args);
2016
      long c2=lnumber_value(CAR(args)); args=lcdr(args);
2016
      int32_t c2=lnumber_value(CAR(args)); args=lcdr(args);
2017
      long s=lnumber_value(CAR(args));
2017
      int32_t s=lnumber_value(CAR(args));
2018
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
2018
      the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
2019
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
2019
      the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
2020
      ascatter_line(cx1,cy1,cx2,cy2,c1,c2,s);
2020
      ascatter_line(cx1,cy1,cx2,cy2,c1,c2,s);
Lines 2031-2041 Link Here
2031
    } break;
2031
    } break;
2032
    case 247 :
2032
    case 247 :
2033
    {
2033
    {
2034
      long cx1=lnumber_value(CAR(args)); args=lcdr(args);
2034
      int32_t cx1=lnumber_value(CAR(args)); args=lcdr(args);
2035
      long cy1=lnumber_value(CAR(args)); args=lcdr(args);
2035
      int32_t cy1=lnumber_value(CAR(args)); args=lcdr(args);
2036
      long cx2=lnumber_value(CAR(args)); args=lcdr(args);
2036
      int32_t cx2=lnumber_value(CAR(args)); args=lcdr(args);
2037
      long cy2=lnumber_value(CAR(args)); args=lcdr(args);
2037
      int32_t cy2=lnumber_value(CAR(args)); args=lcdr(args);
2038
      long c1=lnumber_value(CAR(args)); args=lcdr(args);      
2038
      int32_t c1=lnumber_value(CAR(args)); args=lcdr(args);      
2039
      screen->bar(cx1,cy1,cx2,cy2,c1);
2039
      screen->bar(cx1,cy1,cx2,cy2,c1);
2040
    } break;
2040
    } break;
2041
    case 248 :
2041
    case 248 :
Lines 2186-2193 Link Here
2186
    case 277 :
2186
    case 277 :
2187
    {
2187
    {
2188
      JCFont *fnt=(JCFont *)lpointer_value(CAR(args)); args=CDR(args);
2188
      JCFont *fnt=(JCFont *)lpointer_value(CAR(args)); args=CDR(args);
2189
      long x=lnumber_value(CAR(args));       args=CDR(args);
2189
      int32_t x=lnumber_value(CAR(args));       args=CDR(args);
2190
      long y=lnumber_value(CAR(args));       args=CDR(args);
2190
      int32_t y=lnumber_value(CAR(args));       args=CDR(args);
2191
      char *st=lstring_value(CAR(args));     args=CDR(args);
2191
      char *st=lstring_value(CAR(args));     args=CDR(args);
2192
      int color=-1;
2192
      int color=-1;
2193
      if (args)
2193
      if (args)
Lines 2205-2224 Link Here
2205
    } break;
2205
    } break;
2206
    case 282 :
2206
    case 282 :
2207
    {
2207
    {
2208
      long x1=lnumber_value(CAR(args));   args=CDR(args);
2208
      int32_t x1=lnumber_value(CAR(args));   args=CDR(args);
2209
      long y1=lnumber_value(CAR(args));   args=CDR(args);
2209
      int32_t y1=lnumber_value(CAR(args));   args=CDR(args);
2210
      long x2=lnumber_value(CAR(args));   args=CDR(args);
2210
      int32_t x2=lnumber_value(CAR(args));   args=CDR(args);
2211
      long y2=lnumber_value(CAR(args));   args=CDR(args);
2211
      int32_t y2=lnumber_value(CAR(args));   args=CDR(args);
2212
      long c=lnumber_value(CAR(args));
2212
      int32_t c=lnumber_value(CAR(args));
2213
      screen->bar(x1,y1,x2,y2,c);
2213
      screen->bar(x1,y1,x2,y2,c);
2214
    } break;
2214
    } break;
2215
    case 283 :
2215
    case 283 :
2216
    {
2216
    {
2217
      long x1=lnumber_value(CAR(args));   args=CDR(args);
2217
      int32_t x1=lnumber_value(CAR(args));   args=CDR(args);
2218
      long y1=lnumber_value(CAR(args));   args=CDR(args);
2218
      int32_t y1=lnumber_value(CAR(args));   args=CDR(args);
2219
      long x2=lnumber_value(CAR(args));   args=CDR(args);
2219
      int32_t x2=lnumber_value(CAR(args));   args=CDR(args);
2220
      long y2=lnumber_value(CAR(args));   args=CDR(args);
2220
      int32_t y2=lnumber_value(CAR(args));   args=CDR(args);
2221
      long c=lnumber_value(CAR(args));
2221
      int32_t c=lnumber_value(CAR(args));
2222
      screen->rectangle(x1,y1,x2,y2,c);
2222
      screen->rectangle(x1,y1,x2,y2,c);
2223
    } break;
2223
    } break;
2224
    case 284 :
2224
    case 284 :
(-)abuse-sdl-0.7.0.orig/src/collide.cpp (-7 / +7 lines)
Lines 4-20 Link Here
4
class collide_patch
4
class collide_patch
5
{
5
{
6
  public :
6
  public :
7
  long total,x1,y1,x2,y2;
7
  int32_t total,x1,y1,x2,y2;
8
  game_object **touch;  
8
  game_object **touch;  
9
  collide_patch *next;
9
  collide_patch *next;
10
  collide_patch(long X1, long Y1, long X2, long Y2, collide_patch *Next)
10
  collide_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, collide_patch *Next)
11
  { 
11
  { 
12
    x1=X1; y1=Y1; x2=X2; y2=Y2;
12
    x1=X1; y1=Y1; x2=X2; y2=Y2;
13
    next=Next;
13
    next=Next;
14
    total=0;
14
    total=0;
15
    touch=NULL;
15
    touch=NULL;
16
  }
16
  }
17
  void add_collide(long X1, long Y1, long X2, long Y2, game_object *who);
17
  void add_collide(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, game_object *who);
18
  collide_patch *copy(collide_patch *Next);
18
  collide_patch *copy(collide_patch *Next);
19
  ~collide_patch() { if (total) jfree(touch); }
19
  ~collide_patch() { if (total) jfree(touch); }
20
} ;
20
} ;
Lines 35-41 Link Here
35
}
35
}
36
36
37
37
38
void add_collide(collide_patch *&first, long x1, long y1, long x2, long y2, 
38
void add_collide(collide_patch *&first, int32_t x1, int32_t y1, int32_t x2, int32_t y2, 
39
			    game_object *who)
39
			    game_object *who)
40
{
40
{
41
  collide_patch *next;
41
  collide_patch *next;
Lines 147-153 Link Here
147
void level::check_collisions()
147
void level::check_collisions()
148
{
148
{
149
  game_object *target,*rec,*subject;
149
  game_object *target,*rec,*subject;
150
  long sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,t_centerx;
150
  int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx=0,hity=0,t_centerx;
151
151
152
  for (int l=0;l<attack_total;l++)
152
  for (int l=0;l<attack_total;l++)
153
  {
153
  {
Lines 183-189 Link Here
183
	  {
183
	  {
184
	    for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !rec;j--)
184
	    for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !rec;j--)
185
	    {
185
	    {
186
	      long x1,y1,x2,y2,          // define the two line segments to check
186
	      int32_t x1,y1,x2,y2,          // define the two line segments to check
187
	      xp1,yp1,xp2,yp2;
187
	      xp1,yp1,xp2,yp2;
188
188
189
	      xp1=target->x+target->tx(*t_dat);  t_dat++;	      
189
	      xp1=target->x+target->tx(*t_dat);  t_dat++;	      
Lines 199-205 Link Here
199
199
200
	      // ok, now we know which line segemnts to check for intersection
200
	      // ok, now we know which line segemnts to check for intersection
201
	      // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
201
	      // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
202
	      int _x2=x2,_y2=y2;	      
202
	      int32_t _x2=x2,_y2=y2;	      
203
	      setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0);
203
	      setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0);
204
204
205
205
(-)abuse-sdl-0.7.0.orig/src/morpher.cpp (-1 / +1 lines)
Lines 7-13 Link Here
7
{
7
{
8
  if (fleft)
8
  if (fleft)
9
  {
9
  {
10
    long rx,ry;
10
    int32_t rx,ry;
11
    the_game->game_to_mouse(who->x-(cx>>16),who->y-(cy>>16),v,rx,ry);
11
    the_game->game_to_mouse(who->x-(cx>>16),who->y-(cy>>16),v,rx,ry);
12
    mor->show(screen,rx,ry,color_table,pal,1000);
12
    mor->show(screen,rx,ry,color_table,pal,1000);
13
    cx+=dcx;
13
    cx+=dcx;
(-)abuse-sdl-0.7.0.orig/src/gamma.cpp (-2 / +2 lines)
Lines 179-185 Link Here
179
			FILE *fp;
179
			FILE *fp;
180
180
181
			gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 10, "gammapath" );
181
			gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 10, "gammapath" );
182
			sprintf( gammapath, "%sgamma.lsp\0", get_save_filename_prefix() );
182
			sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
183
			fp = open_FILE( gammapath, "wb" );
183
			fp = open_FILE( gammapath, "wb" );
184
			if( fp )
184
			if( fp )
185
			{
185
			{
Lines 219-225 Link Here
219
	pal = new palette;
219
	pal = new palette;
220
	for( int i = 0; i < 256; i++ )
220
	for( int i = 0; i < 256; i++ )
221
	{
221
	{
222
		uchar oldr, oldg, oldb;
222
		uint8_t oldr, oldg, oldb;
223
		old_pal->get( i, oldr, oldg, oldb );
223
		old_pal->get( i, oldr, oldg, oldb );
224
		pal->set( i, (int)( pow( oldr / 255.0, gamma ) * 255 ),
224
		pal->set( i, (int)( pow( oldr / 255.0, gamma ) * 255 ),
225
			(int)( pow( oldg / 255.0, gamma ) * 255 ),
225
			(int)( pow( oldg / 255.0, gamma ) * 255 ),
(-)abuse-sdl-0.7.0.orig/src/ant.cpp (-8 / +8 lines)
Lines 16-24 Link Here
16
16
17
void *ant_ai();
17
void *ant_ai();
18
18
19
int can_see(game_object *o, long x1, long y1, long x2, long y2)
19
int can_see(game_object *o, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
20
{
20
{
21
  long nx2=x2,ny2=y2;
21
  int32_t nx2=x2,ny2=y2;
22
  current_level->foreground_intersect(x1,y1,x2,y2);
22
  current_level->foreground_intersect(x1,y1,x2,y2);
23
  if (x2!=nx2 || y2!=ny2) return 0;
23
  if (x2!=nx2 || y2!=ny2) return 0;
24
24
Lines 94-101 Link Here
94
94
95
static void fire_at_player(game_object *o, game_object *b)
95
static void fire_at_player(game_object *o, game_object *b)
96
{
96
{
97
  long firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
97
  int32_t firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
98
       playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
98
          playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
99
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
99
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
100
  {
100
  {
101
    int angle=lisp_atan2(firey-playery,playerx-firex);
101
    int angle=lisp_atan2(firey-playery,playerx-firex);
Lines 223-229 Link Here
223
    {
223
    {
224
      if (!o->next_picture())
224
      if (!o->next_picture())
225
      {
225
      {
226
	long xv=0,yv=2;
226
	int32_t xv=0,yv=2;
227
	o->try_move(o->x,o->y,xv,yv,1);
227
	o->try_move(o->x,o->y,xv,yv,1);
228
	if (yv!=0)
228
	if (yv!=0)
229
	{
229
	{
Lines 263-270 Link Here
263
	    o->set_aistate(ANT_JUMP);
263
	    o->set_aistate(ANT_JUMP);
264
	  else 
264
	  else 
265
	  {
265
	  {
266
	    long xm=o->direction>0 ? get_ability(o->otype,run_top_speed) : -get_ability(o->otype,run_top_speed);
266
	    int32_t xm=o->direction>0 ? get_ability(o->otype,run_top_speed) : -get_ability(o->otype,run_top_speed);
267
	    long ym=0,new_xm=xm;
267
	    int32_t ym=0,new_xm=xm;
268
	    if (o->state!=running) o->set_state(running);
268
	    if (o->state!=running) o->set_state(running);
269
269
270
	    o->try_move(o->x,o->y,new_xm,ym,3);
270
	    o->try_move(o->x,o->y,new_xm,ym,3);
Lines 348-354 Link Here
348
      o->set_state((character_state)S_jump_up);
348
      o->set_state((character_state)S_jump_up);
349
//      o->set_yvel(o->yvel()+1);
349
//      o->set_yvel(o->yvel()+1);
350
      o->set_xacel(0);
350
      o->set_xacel(0);
351
      long xv=0,yv=o->yvel();
351
      int32_t xv=0,yv=o->yvel();
352
      o->y-=31;
352
      o->y-=31;
353
      o->try_move(o->x,o->y,xv,yv,1);
353
      o->try_move(o->x,o->y,xv,yv,1);
354
      o->y+=31+yv;
354
      o->y+=31+yv;
(-)abuse-sdl-0.7.0.orig/src/compiled.cpp (-5 / +5 lines)
Lines 5-14 Link Here
5
5
6
extern int total_objects;
6
extern int total_objects;
7
7
8
uchar *bad_guy_array=NULL;    // list flaging each character saying they are a bad bug or not
8
uint8_t *bad_guy_array=NULL;  // list flaging each character saying they are a bad bug or not
9
                              // mainly used by the rocket to find targets
9
                              // mainly used by the rocket to find targets
10
10
11
long S_fall_start,S_falling,S_landing,S_pounce_wait,
11
int32_t S_fall_start,S_falling,S_landing,S_pounce_wait,
12
     S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
12
     S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
13
     S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
13
     S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
14
     S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
14
     S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
Lines 27-33 Link Here
27
27
28
int compile_error=0;
28
int compile_error=0;
29
29
30
long c_state(char *name)
30
int32_t c_state(char *name)
31
{
31
{
32
  void *sym=find_symbol(name);
32
  void *sym=find_symbol(name);
33
  if (sym)
33
  if (sym)
Lines 113-123 Link Here
113
  if (b && DEFINEDP(symbol_value(b)))
113
  if (b && DEFINEDP(symbol_value(b)))
114
  {
114
  {
115
    b=symbol_value(b);
115
    b=symbol_value(b);
116
    bad_guy_array=(uchar *)jmalloc(total_objects,"bad_guy_array");
116
    bad_guy_array=(uint8_t *)jmalloc(total_objects,"bad_guy_array");
117
    memset(bad_guy_array,0,total_objects);
117
    memset(bad_guy_array,0,total_objects);
118
    while (b)
118
    while (b)
119
    {
119
    {
120
      long x=lnumber_value(CAR(b));
120
      int32_t x=lnumber_value(CAR(b));
121
      if (x>=0 && x<total_objects)
121
      if (x>=0 && x<total_objects)
122
        bad_guy_array[x]=1;
122
        bad_guy_array[x]=1;
123
      else { lbreak("objetc number out of range %d\n",x); }
123
      else { lbreak("objetc number out of range %d\n",x); }
(-)abuse-sdl-0.7.0.orig/src/endgame.cpp (-25 / +25 lines)
Lines 20-31 Link Here
20
struct mask_line
20
struct mask_line
21
{
21
{
22
  int x,size;
22
  int x,size;
23
  ushort *remap;
23
  uint16_t *remap;
24
  uchar *light;
24
  uint8_t *light;
25
} ;
25
} ;
26
26
27
27
28
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color);
28
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
29
29
30
mask_line *make_mask_lines(image *mask, int map_width)
30
mask_line *make_mask_lines(image *mask, int map_width)
31
{
31
{
Lines 33-39 Link Here
33
  for (int y=0;y<mask->height();y++)
33
  for (int y=0;y<mask->height();y++)
34
  {
34
  {
35
    // find the start of the run..
35
    // find the start of the run..
36
    uchar *sl=mask->scan_line(y);    
36
    uint8_t *sl=mask->scan_line(y);    
37
    int x=0;
37
    int x=0;
38
    while (*sl==0) { sl++; x++; }
38
    while (*sl==0) { sl++; x++; }
39
    p[y].x=x;
39
    p[y].x=x;
Lines 41-55 Link Here
41
   
41
   
42
    // find the length of the run
42
    // find the length of the run
43
    int size=0; 
43
    int size=0; 
44
    uchar *sl_start=sl;
44
    uint8_t *sl_start=sl;
45
    while (*sl!=0 && x<mask->width()) { sl++; x++; size++; }
45
    while (*sl!=0 && x<mask->width()) { sl++; x++; size++; }
46
    p[y].size=size;
46
    p[y].size=size;
47
47
48
    // now calculate remap for line
48
    // now calculate remap for line
49
    p[y].remap=(ushort *)jmalloc(size*2,"mask remap");
49
    p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap");
50
    p[y].light=(uchar *)jmalloc(size,"mask light");
50
    p[y].light=(uint8_t *)jmalloc(size,"mask light");
51
    ushort *rem=p[y].remap;
51
    uint16_t *rem=p[y].remap;
52
    uchar *lrem=p[y].light;
52
    uint8_t *lrem=p[y].light;
53
    for (x=0;x<size;x++,rem++)
53
    for (x=0;x<size;x++,rem++)
54
    {
54
    {
55
      *(lrem++)=*(sl_start++);
55
      *(lrem++)=*(sl_start++);
Lines 68-90 Link Here
68
}
68
}
69
69
70
70
71
void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, long *paddr, mask_line *p, int mask_height, 
71
void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height, 
72
	      int xoff, int coff)
72
	      int xoff, int coff)
73
{  
73
{  
74
  int x1=10000,x2=0;
74
  int x1=10000,x2=0;
75
  int iw=im1->width();  
75
  int iw=im1->width();  
76
  ushort r,off;
76
  uint16_t r,off;
77
  int y=0;
77
  int y=0;
78
  uchar *l;
78
  uint8_t *l;
79
79
80
  for (;y<mask_height;y++)
80
  for (;y<mask_height;y++)
81
  {
81
  {
82
    mask_line *n=p+y;
82
    mask_line *n=p+y;
83
    uchar *sl=screen->scan_line(y+sy)+sx+n->x;
83
    uint8_t *sl=screen->scan_line(y+sy)+sx+n->x;
84
    uchar *sl2=im1->scan_line(y);
84
    uint8_t *sl2=im1->scan_line(y);
85
    uchar *sl3=im2->scan_line(y);
85
    uint8_t *sl3=im2->scan_line(y);
86
    l=n->light;
86
    l=n->light;
87
    ushort *rem=n->remap;
87
    uint16_t *rem=n->remap;
88
    if (sx+n->x<x1) x1=sx+n->x;    
88
    if (sx+n->x<x1) x1=sx+n->x;    
89
    int x=0;
89
    int x=0;
90
    for (;x<n->size;x++,sl++,rem++,l++)   
90
    for (;x<n->size;x++,sl++,rem++,l++)   
Lines 94-101 Link Here
94
      off=(r+xoff);
94
      off=(r+xoff);
95
      if (off>=iw) off-=iw;
95
      if (off>=iw) off-=iw;
96
96
97
      long p1=*(paddr+sl2[off]);
97
      int32_t p1=*(paddr+sl2[off]);
98
      long p2=*(paddr+sl3[off]);
98
      int32_t p2=*(paddr+sl3[off]);
99
99
100
      int r1=p1>>16,g1=(p1>>8)&0xff,b1=p1&0xff;
100
      int r1=p1>>16,g1=(p1>>8)&0xff,b1=p1&0xff;
101
      int r2=p2>>16,g2=(p2>>8)&0xff,b2=p2&0xff;
101
      int r2=p2>>16,g2=(p2>>8)&0xff,b2=p2&0xff;
Lines 103-109 Link Here
103
          g3=g1+(g2-g1)*fade256/256,
103
          g3=g1+(g2-g1)*fade256/256,
104
          b3=b1+(b2-b1)*fade256/256;
104
          b3=b1+(b2-b1)*fade256/256;
105
105
106
      uchar c=color_table->lookup_color(r3>>3,g3>>3,b3>>3);
106
      uint8_t c=color_table->lookup_color(r3>>3,g3>>3,b3>>3);
107
				
107
				
108
      *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c); 
108
      *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c); 
109
      
109
      
Lines 122-128 Link Here
122
122
123
class ex_char { 
123
class ex_char { 
124
  public :
124
  public :
125
  uchar frame,char_num;
125
  uint8_t frame,char_num;
126
  int x,y;
126
  int x,y;
127
  ex_char *next; 
127
  ex_char *next; 
128
  ex_char (int X, int Y, int Frame, int Char_num, ex_char *Next) { x=X; y=Y; frame=Frame; char_num=Char_num; next=Next; }
128
  ex_char (int X, int Y, int Frame, int Char_num, ex_char *Next) { x=X; y=Y; frame=Frame; char_num=Char_num; next=Next; }
Lines 174-180 Link Here
174
	    pal->find_closest(200,200,200),
174
	    pal->find_closest(200,200,200),
175
	    pal->find_closest(100,100,100),
175
	    pal->find_closest(100,100,100),
176
	    pal->find_closest(64,64,64)};
176
	    pal->find_closest(64,64,64)};
177
  ushort sinfo[800*3],*si;
177
  uint16_t sinfo[800*3],*si;
178
178
179
  for (si=sinfo,i=0;i<800;i++)
179
  for (si=sinfo,i=0;i<800;i++)
180
  {
180
  {
Lines 183-189 Link Here
183
    *(si++)=c[jrand()%4];     
183
    *(si++)=c[jrand()%4];     
184
    screen->putpixel(si[-3],si[-2],si[-1]);
184
    screen->putpixel(si[-3],si[-2],si[-1]);
185
  }
185
  }
186
  long paddr[256];
186
  int32_t paddr[256];
187
  if (old_pal)
187
  if (old_pal)
188
  {
188
  {
189
    for (i=0;i<256;i++) 
189
    for (i=0;i<256;i++) 
Lines 353-359 Link Here
353
  } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
353
  } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
354
354
355
355
356
  uchar cmap[32];
356
  uint8_t cmap[32];
357
  for (i=0;i<32;i++)
357
  for (i=0;i<32;i++)
358
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
358
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
359
359
Lines 427-433 Link Here
427
			   lstring_value(to_be));
427
			   lstring_value(to_be));
428
  fade_in(NULL,32);
428
  fade_in(NULL,32);
429
429
430
  uchar cmap[32];
430
  uint8_t cmap[32];
431
  int i;
431
  int i;
432
  for (i=0;i<32;i++)
432
  for (i=0;i<32;i++)
433
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
433
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
Lines 479-485 Link Here
479
479
480
  fade_in(im,32);
480
  fade_in(im,32);
481
481
482
  uchar cmap[32];
482
  uint8_t cmap[32];
483
  int i;
483
  int i;
484
  for (i=0;i<32;i++)
484
  for (i=0;i<32;i++)
485
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
485
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
(-)abuse-sdl-0.7.0.orig/src/nfclient.cpp (-3 / +3 lines)
Lines 73-83 Link Here
73
    }
73
    }
74
74
75
    int remote_file_num=net_crcs->get_filenumber(local_filename);
75
    int remote_file_num=net_crcs->get_filenumber(local_filename);
76
    ulong remote_crc=net_crcs->get_crc(remote_file_num,fail2);
76
    uint32_t remote_crc=net_crcs->get_crc(remote_file_num,fail2);
77
    if (!fail2)
77
    if (!fail2)
78
    {   
78
    {   
79
      int local_file_num=crc_man.get_filenumber(local_filename);
79
      int local_file_num=crc_man.get_filenumber(local_filename);
80
      ulong local_crc=crc_man.get_crc(local_file_num,fail1);
80
      uint32_t local_crc=crc_man.get_crc(local_file_num,fail1);
81
      if (fail1)
81
      if (fail1)
82
      {
82
      {
83
	bFILE *fp=new jFILE(local_filename,"rb");      
83
	bFILE *fp=new jFILE(local_filename,"rb");      
Lines 134-140 Link Here
134
  else if (nfs_fd>=0)
134
  else if (nfs_fd>=0)
135
  {
135
  {
136
    long a=NF_read(nfs_fd,buf,count);
136
    long a=NF_read(nfs_fd,buf,count);
137
    if (a>count)
137
    if (a>(long)count)
138
    { 
138
    { 
139
      fprintf(stderr,"ooch read too much\n");
139
      fprintf(stderr,"ooch read too much\n");
140
    }
140
    }
(-)abuse-sdl-0.7.0.orig/src/transp.cpp (-8 / +8 lines)
Lines 1-7 Link Here
1
#include "transp.hpp"
1
#include "transp.hpp"
2
2
3
3
4
void transp_put(image *im, image *screen, uchar *table, int x, int y)
4
void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
5
{
5
{
6
  short cx1,cy1,cx2,cy2;
6
  short cx1,cy1,cx2,cy2;
7
  screen->get_clip(cx1,cy1,cx2,cy2);
7
  screen->get_clip(cx1,cy1,cx2,cy2);
Lines 31-43 Link Here
31
  int ye=ys+yl;
31
  int ye=ys+yl;
32
  int xe=xs+xl;
32
  int xe=xs+xl;
33
33
34
  uchar *isl=im->scan_line(ys)+xs;
34
  uint8_t *isl=im->scan_line(ys)+xs;
35
  uchar *ssl=screen->scan_line(y)+x;
35
  uint8_t *ssl=screen->scan_line(y)+x;
36
  int iw=im->width(),sw=screen->width();
36
  int iw=im->width(),sw=screen->width();
37
37
38
  for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
38
  for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
39
  {
39
  {
40
    uchar *s=ssl,*i=isl;
40
    uint8_t *s=ssl,*i=isl;
41
    for (int ix=xs;ix<xe;ix++,s++,i++)
41
    for (int ix=xs;ix<xe;ix++,s++,i++)
42
    {
42
    {
43
      if (*i)
43
      if (*i)
Lines 49-55 Link Here
49
49
50
50
51
/*
51
/*
52
void transp_put(image *im, image *screen, uchar *table, int x, int y)
52
void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
53
{
53
{
54
  short cx1,cy1,cx2,cy2;
54
  short cx1,cy1,cx2,cy2;
55
  screen->get_clip(cx1,cy1,cx2,cy2);
55
  screen->get_clip(cx1,cy1,cx2,cy2);
Lines 79-91 Link Here
79
  int ye=ys+yl;
79
  int ye=ys+yl;
80
  int xe=xs+xl;
80
  int xe=xs+xl;
81
81
82
  uchar *isl=im->scan_line(ys)+xs;
82
  uint8_t *isl=im->scan_line(ys)+xs;
83
  uchar *ssl=screen->scan_line(y)+x;
83
  uint8_t *ssl=screen->scan_line(y)+x;
84
  int iw=im->width(),sw=screen->width();
84
  int iw=im->width(),sw=screen->width();
85
85
86
  for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
86
  for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
87
  {
87
  {
88
    uchar *s=ssl,*i=isl;
88
    uint8_t *s=ssl,*i=isl;
89
    for (int ix=xs;ix<xe;ix++,s++,i++)
89
    for (int ix=xs;ix<xe;ix++,s++,i++)
90
      *s=table[((*i)<<8)|(*s)];
90
      *s=table[((*i)<<8)|(*s)];
91
  }        
91
  }        
(-)abuse-sdl-0.7.0.orig/src/lisp.cpp (-57 / +79 lines)
Lines 214-220 Link Here
214
  return ret;
214
  return ret;
215
}
215
}
216
216
217
lisp_1d_array *new_lisp_1d_array(ushort size, void *rest)
217
lisp_1d_array *new_lisp_1d_array(int size, void *rest)
218
{
218
{
219
  p_ref r11(rest);
219
  p_ref r11(rest);
220
  long s=sizeof(lisp_1d_array)+size*sizeof(void *);
220
  long s=sizeof(lisp_1d_array)+size*sizeof(void *);
Lines 263-269 Link Here
263
  return ((lisp_1d_array *)p);
263
  return ((lisp_1d_array *)p);
264
}
264
}
265
265
266
lisp_fixed_point *new_lisp_fixed_point(long x)
266
lisp_fixed_point *new_lisp_fixed_point(int32_t x)
267
{
267
{
268
  lisp_fixed_point *p=(lisp_fixed_point *)lmalloc(sizeof(lisp_fixed_point),current_space);
268
  lisp_fixed_point *p=(lisp_fixed_point *)lmalloc(sizeof(lisp_fixed_point),current_space);
269
  p->type=L_FIXED_POINT;
269
  p->type=L_FIXED_POINT;
Lines 272-278 Link Here
272
}
272
}
273
273
274
274
275
lisp_object_var *new_lisp_object_var(short number)
275
lisp_object_var *new_lisp_object_var(int16_t number)
276
{
276
{
277
  lisp_object_var *p=(lisp_object_var *)lmalloc(sizeof(lisp_object_var),current_space);
277
  lisp_object_var *p=(lisp_object_var *)lmalloc(sizeof(lisp_object_var),current_space);
278
  p->type=L_OBJECT_VAR;
278
  p->type=L_OBJECT_VAR;
Lines 290-296 Link Here
290
  return p;
290
  return p;
291
}
291
}
292
292
293
struct lisp_character *new_lisp_character(unsigned short ch)
293
struct lisp_character *new_lisp_character(uint16_t ch)
294
{
294
{
295
  lisp_character *c=(lisp_character *)lmalloc(sizeof(lisp_character),current_space);
295
  lisp_character *c=(lisp_character *)lmalloc(sizeof(lisp_character),current_space);
296
  c->type=L_CHARACTER;
296
  c->type=L_CHARACTER;
Lines 300-306 Link Here
300
300
301
struct lisp_string *new_lisp_string(char *string)
301
struct lisp_string *new_lisp_string(char *string)
302
{
302
{
303
  long size=sizeof(lisp_string)+strlen(string)+1;
303
  int size=sizeof(lisp_string)+strlen(string)+1;
304
  if (size<8) size=8;
304
  if (size<8) size=8;
305
305
306
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
306
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
Lines 312-318 Link Here
312
312
313
struct lisp_string *new_lisp_string(char *string, int length)
313
struct lisp_string *new_lisp_string(char *string, int length)
314
{
314
{
315
  long size=sizeof(lisp_string)+length+1;
315
  int size=sizeof(lisp_string)+length+1;
316
  if (size<8) size=8;
316
  if (size<8) size=8;
317
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
317
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
318
  s->type=L_STRING;
318
  s->type=L_STRING;
Lines 322-330 Link Here
322
  return s;
322
  return s;
323
}
323
}
324
324
325
struct lisp_string *new_lisp_string(long length)
325
struct lisp_string *new_lisp_string(int length)
326
{
326
{
327
  long size=sizeof(lisp_string)+length;
327
  int size=sizeof(lisp_string)+length;
328
  if (size<8) size=8;
328
  if (size<8) size=8;
329
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
329
  lisp_string *s=(lisp_string *)lmalloc(size,current_space);
330
  s->type=L_STRING;
330
  s->type=L_STRING;
Lines 344-350 Link Here
344
  return lu;
344
  return lu;
345
}
345
}
346
#else
346
#else
347
lisp_user_function *new_lisp_user_function(long arg_list, long block_list)
347
lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list)
348
{
348
{
349
  int sp=current_space;
349
  int sp=current_space;
350
  if (current_space!=GC_SPACE)
350
  if (current_space!=GC_SPACE)
Lines 500-506 Link Here
500
  return ((lisp_pointer *)lpointer)->addr;  
500
  return ((lisp_pointer *)lpointer)->addr;  
501
}
501
}
502
502
503
long lnumber_value(void *lnumber)
503
int32_t lnumber_value(void *lnumber)
504
{
504
{
505
  switch (item_type(lnumber))
505
  switch (item_type(lnumber))
506
  {
506
  {
Lines 509-515 Link Here
509
    case L_FIXED_POINT :
509
    case L_FIXED_POINT :
510
      return (((lisp_fixed_point *)lnumber)->x)>>16;
510
      return (((lisp_fixed_point *)lnumber)->x)>>16;
511
    case L_STRING :
511
    case L_STRING :
512
      return (uchar)*lstring_value(lnumber);
512
      return (uint8_t)*lstring_value(lnumber);
513
    case L_CHARACTER :
513
    case L_CHARACTER :
514
      return lcharacter_value(lnumber);
514
      return lcharacter_value(lnumber);
515
    default :
515
    default :
Lines 561-567 Link Here
561
  else return NULL;
561
  else return NULL;
562
}
562
}
563
563
564
unsigned short lcharacter_value(void *c)
564
uint16_t lcharacter_value(void *c)
565
{
565
{
566
#ifdef TYPE_CHECKING
566
#ifdef TYPE_CHECKING
567
  if (item_type(c)!=L_CHARACTER)
567
  if (item_type(c)!=L_CHARACTER)
Lines 933-939 Link Here
933
  }
933
  }
934
  if (l1!=0)
934
  if (l1!=0)
935
  {
935
  {
936
    void *first=NULL,*last=NULL,*cur=NULL;
936
    void *first=NULL,*last=NULL,*cur=NULL,*tmp;
937
    p_ref r1(first),r2(last),r3(cur);
937
    p_ref r1(first),r2(last),r3(cur);
938
    while (list1)
938
    while (list1)
939
    {
939
    {
Lines 944-951 Link Here
944
      last=cur;
944
      last=cur;
945
	      
945
	      
946
      cons_cell *cell=new_cons_cell();	      
946
      cons_cell *cell=new_cons_cell();	      
947
      ((cons_cell *)cell)->car=lcar(list1);
947
      tmp=lcar(list1);
948
      ((cons_cell *)cell)->cdr=lcar(list2);
948
      ((cons_cell *)cell)->car=tmp;
949
      tmp=lcar(list2);
950
      ((cons_cell *)cell)->cdr=tmp;
949
      ((cons_cell *)cur)->car=cell;
951
      ((cons_cell *)cur)->car=cell;
950
952
951
      list1=((cons_cell *)list1)->cdr;
953
      list1=((cons_cell *)list1)->cdr;
Lines 1002-1008 Link Here
1002
  return s;
1004
  return s;
1003
}
1005
}
1004
1006
1005
lisp_symbol *add_c_object(void *symbol, short number)
1007
lisp_symbol *add_c_object(void *symbol, int16_t number)
1006
{
1008
{
1007
  need_perm_space("add_c_object");
1009
  need_perm_space("add_c_object");
1008
  lisp_symbol *s=(lisp_symbol *)symbol;
1010
  lisp_symbol *s=(lisp_symbol *)symbol;
Lines 1152-1186 Link Here
1152
    return true_symbol;
1154
    return true_symbol;
1153
  else if (n[0]=='\'')                    // short hand for quote function
1155
  else if (n[0]=='\'')                    // short hand for quote function
1154
  {
1156
  {
1155
    void *cs=new_cons_cell(),*c2=NULL;
1157
    void *cs=new_cons_cell(),*c2=NULL,*tmp;
1156
    p_ref r1(cs),r2(c2);
1158
    p_ref r1(cs),r2(c2);
1157
1159
1158
    ((cons_cell *)cs)->car=quote_symbol;
1160
    ((cons_cell *)cs)->car=quote_symbol;
1159
    c2=new_cons_cell();
1161
    c2=new_cons_cell();
1160
    ((cons_cell *)c2)->car=compile(s);
1162
    tmp=compile(s);
1163
    ((cons_cell *)c2)->car=tmp;
1161
    ((cons_cell *)c2)->cdr=NULL;
1164
    ((cons_cell *)c2)->cdr=NULL;
1162
    ((cons_cell *)cs)->cdr=c2;
1165
    ((cons_cell *)cs)->cdr=c2;
1163
    ret=cs;
1166
    ret=cs;
1164
  }
1167
  }
1165
  else if (n[0]=='`')                    // short hand for backquote function
1168
  else if (n[0]=='`')                    // short hand for backquote function
1166
  {
1169
  {
1167
    void *cs=new_cons_cell(),*c2=NULL;
1170
    void *cs=new_cons_cell(),*c2=NULL,*tmp;
1168
    p_ref r1(cs),r2(c2);
1171
    p_ref r1(cs),r2(c2);
1169
1172
1170
    ((cons_cell *)cs)->car=backquote_symbol;
1173
    ((cons_cell *)cs)->car=backquote_symbol;
1171
    c2=new_cons_cell();
1174
    c2=new_cons_cell();
1172
    ((cons_cell *)c2)->car=compile(s);
1175
    tmp=compile(s);
1176
    ((cons_cell *)c2)->car=tmp;
1173
    ((cons_cell *)c2)->cdr=NULL;
1177
    ((cons_cell *)c2)->cdr=NULL;
1174
    ((cons_cell *)cs)->cdr=c2;
1178
    ((cons_cell *)cs)->cdr=c2;
1175
    ret=cs;
1179
    ret=cs;
1176
  }  else if (n[0]==',')              // short hand for comma function
1180
  }  else if (n[0]==',')              // short hand for comma function
1177
  {
1181
  {
1178
    void *cs=new_cons_cell(),*c2=NULL;
1182
    void *cs=new_cons_cell(),*c2=NULL,*tmp;
1179
    p_ref r1(cs),r2(c2);
1183
    p_ref r1(cs),r2(c2);
1180
1184
1181
    ((cons_cell *)cs)->car=comma_symbol;
1185
    ((cons_cell *)cs)->car=comma_symbol;
1182
    c2=new_cons_cell();
1186
    c2=new_cons_cell();
1183
    ((cons_cell *)c2)->car=compile(s);
1187
    tmp=compile(s);
1188
    ((cons_cell *)c2)->car=tmp;
1184
    ((cons_cell *)c2)->cdr=NULL;
1189
    ((cons_cell *)c2)->cdr=NULL;
1185
    ((cons_cell *)cs)->cdr=c2;
1190
    ((cons_cell *)cs)->cdr=c2;
1186
    ret=cs;
1191
    ret=cs;
Lines 1208-1225 Link Here
1208
				    lerror(s,"token '.' not allowed here\n");	      
1213
				    lerror(s,"token '.' not allowed here\n");	      
1209
				  else 
1214
				  else 
1210
				  {
1215
				  {
1216
				    void *tmp;
1211
				    read_ltoken(s,n);              // skip the '.'
1217
				    read_ltoken(s,n);              // skip the '.'
1212
				    ((cons_cell *)last)->cdr=compile(s);          // link the last cdr to 
1218
				    tmp=compile(s);
1219
				    ((cons_cell *)last)->cdr=tmp;          // link the last cdr to 
1213
				    last=NULL;
1220
				    last=NULL;
1214
				  }
1221
				  }
1215
				} else if (!last && first)
1222
				} else if (!last && first)
1216
				  lerror(s,"illegal end of dotted list\n");
1223
				  lerror(s,"illegal end of dotted list\n");
1217
				else
1224
				else
1218
				{		 
1225
				{		 
1226
				  void *tmp;
1219
				  cur=new_cons_cell();
1227
				  cur=new_cons_cell();
1220
				  p_ref r1(cur);
1228
				  p_ref r1(cur);
1221
				  if (!first) first=cur;
1229
				  if (!first) first=cur;
1222
				  ((cons_cell *)cur)->car=compile(s);	
1230
				  tmp=compile(s);	
1231
				  ((cons_cell *)cur)->car=tmp;
1223
				  if (last)
1232
				  if (last)
1224
				    ((cons_cell *)last)->cdr=cur;
1233
				    ((cons_cell *)last)->cdr=cur;
1225
				  last=cur;
1234
				  last=cur;
Lines 1267-1277 Link Here
1267
    }
1276
    }
1268
    else if (n[1]==0)                           // short hand for function
1277
    else if (n[1]==0)                           // short hand for function
1269
    {
1278
    {
1270
      void *cs=new_cons_cell(),*c2=NULL;
1279
      void *cs=new_cons_cell(),*c2=NULL,*tmp;
1271
      p_ref r4(cs),r5(c2);
1280
      p_ref r4(cs),r5(c2);
1272
      ((cons_cell *)cs)->car=make_find_symbol("function");
1281
      tmp=make_find_symbol("function");
1282
      ((cons_cell *)cs)->car=tmp;
1273
      c2=new_cons_cell();
1283
      c2=new_cons_cell();
1274
      ((cons_cell *)c2)->car=compile(s);
1284
      tmp=compile(s);
1285
      ((cons_cell *)c2)->car=tmp;
1275
      ((cons_cell *)cs)->cdr=c2;
1286
      ((cons_cell *)cs)->cdr=c2;
1276
      ret=cs;
1287
      ret=cs;
1277
    }
1288
    }
Lines 1280-1286 Link Here
1280
      lbreak("Unknown #\\ notation : %s\n",n);
1291
      lbreak("Unknown #\\ notation : %s\n",n);
1281
      exit(0);
1292
      exit(0);
1282
    }
1293
    }
1283
  } else return make_find_symbol(n);
1294
  } else {
1295
    ret = make_find_symbol(n);
1296
  } 
1284
  return ret;
1297
  return ret;
1285
}
1298
}
1286
1299
Lines 1295-1310 Link Here
1295
      {
1308
      {
1296
	s++;
1309
	s++;
1297
	if (*s=='n')
1310
	if (*s=='n')
1298
	  current_print_file->write_byte('\n');
1311
	  current_print_file->write_uint8('\n');
1299
	else if (*s=='r')
1312
	else if (*s=='r')
1300
	  current_print_file->write_byte('\r');
1313
	  current_print_file->write_uint8('\r');
1301
	else if (*s=='t')
1314
	else if (*s=='t')
1302
	  current_print_file->write_byte('\t');
1315
	  current_print_file->write_uint8('\t');
1303
	else if (*s=='\\')
1316
	else if (*s=='\\')
1304
	  current_print_file->write_byte('\\');
1317
	  current_print_file->write_uint8('\\');
1305
      }
1318
      }
1306
      else*/
1319
      else*/
1307
        current_print_file->write_byte(*s);
1320
        current_print_file->write_uint8(*s);
1308
    }
1321
    }
1309
  }
1322
  }
1310
  else
1323
  else
Lines 1392-1402 Link Here
1392
      {
1405
      {
1393
				if (current_print_file)
1406
				if (current_print_file)
1394
				{
1407
				{
1395
				  uchar ch=((lisp_character *)i)->ch;
1408
				  uint8_t ch=((lisp_character *)i)->ch;
1396
				  current_print_file->write(&ch,1);
1409
				  current_print_file->write(&ch,1);
1397
				} else
1410
				} else
1398
				{
1411
				{
1399
				  unsigned short ch=((lisp_character *)i)->ch;
1412
				  uint16_t ch=((lisp_character *)i)->ch;
1400
				  dprintf("#\\");
1413
				  dprintf("#\\");
1401
				  switch (ch)
1414
				  switch (ch)
1402
				  {
1415
				  {
Lines 1528-1540 Link Here
1528
    } break;
1541
    } break;
1529
    case L_C_FUNCTION :
1542
    case L_C_FUNCTION :
1530
    {
1543
    {
1531
      void *first=NULL,*cur=NULL;
1544
      void *first=NULL,*cur=NULL,*tmp;
1532
      p_ref r1(first),r2(cur);
1545
      p_ref r1(first),r2(cur);
1533
      while (arg_list)
1546
      while (arg_list)
1534
      {
1547
      {
1535
				if (first)
1548
				if (first) {
1536
				  cur=((cons_cell *)cur)->cdr=new_cons_cell();
1549
				  tmp=new_cons_cell();
1537
				else
1550
				  ((cons_cell *)cur)->cdr=tmp;
1551
				  cur=tmp;
1552
				} else
1538
				  cur=first=new_cons_cell();
1553
				  cur=first=new_cons_cell();
1539
			
1554
			
1540
				void *val=eval(CAR(arg_list));
1555
				void *val=eval(CAR(arg_list));
Lines 1545-1557 Link Here
1545
    } break;
1560
    } break;
1546
    case L_C_BOOL :
1561
    case L_C_BOOL :
1547
    {
1562
    {
1548
      void *first=NULL,*cur=NULL;
1563
      void *first=NULL,*cur=NULL,*tmp;
1549
      p_ref r1(first),r2(cur);
1564
      p_ref r1(first),r2(cur);
1550
      while (arg_list)
1565
      while (arg_list)
1551
      {
1566
      {
1552
				if (first)
1567
				if (first) {
1553
				  cur=((cons_cell *)cur)->cdr=new_cons_cell();
1568
				  tmp=new_cons_cell();
1554
				else
1569
				  ((cons_cell *)cur)->cdr=tmp;
1570
				  cur=tmp;
1571
				} else
1555
				  cur=first=new_cons_cell();
1572
				  cur=first=new_cons_cell();
1556
			
1573
			
1557
				void *val=eval(CAR(arg_list));
1574
				void *val=eval(CAR(arg_list));
Lines 1564-1570 Link Here
1564
      else ret=NULL;
1581
      else ret=NULL;
1565
    } break;
1582
    } break;
1566
    default :
1583
    default :
1567
      fprintf(stderr,"not a fun, sholdn't happed\n");
1584
      fprintf(stderr,"not a fun, shouldn't happen\n");
1568
  }
1585
  }
1569
1586
1570
#ifdef L_PROFILE
1587
#ifdef L_PROFILE
Lines 1783-1789 Link Here
1783
    return eval(CAR(CDR(args)));
1800
    return eval(CAR(CDR(args)));
1784
  else
1801
  else
1785
  {
1802
  {
1786
    void *first=NULL,*last=NULL,*cur=NULL;
1803
    void *first=NULL,*last=NULL,*cur=NULL,*tmp;
1787
    p_ref ref1(first),ref2(last),ref3(cur),ref4(args);
1804
    p_ref ref1(first),ref2(last),ref3(cur),ref4(args);
1788
    while (args)
1805
    while (args)
1789
    {
1806
    {
Lines 1791-1797 Link Here
1791
      {
1808
      {
1792
	if (CAR(args)==comma_symbol)               // dot list with a comma?
1809
	if (CAR(args)==comma_symbol)               // dot list with a comma?
1793
	{
1810
	{
1794
	  ((cons_cell *)last)->cdr=eval(CAR(CDR(args)));
1811
	  tmp=eval(CAR(CDR(args)));
1812
	  ((cons_cell *)last)->cdr=tmp;
1795
	  args=NULL;
1813
	  args=NULL;
1796
	}
1814
	}
1797
	else
1815
	else
Lines 1802-1813 Link Here
1802
	  else 
1820
	  else 
1803
            first=cur;
1821
            first=cur;
1804
	  last=cur;
1822
	  last=cur;
1805
          ((cons_cell *)cur)->car=backquote_eval(CAR(args));
1823
          tmp=backquote_eval(CAR(args));
1824
          ((cons_cell *)cur)->car=tmp;
1806
 	  args=CDR(args);
1825
 	  args=CDR(args);
1807
	}
1826
	}
1808
      } else
1827
      } else
1809
      {
1828
      {
1810
	((cons_cell *)last)->cdr=backquote_eval(args);
1829
	tmp=backquote_eval(args);
1830
	((cons_cell *)last)->cdr=tmp;
1811
	args=NULL;
1831
	args=NULL;
1812
      }
1832
      }
1813
1833
Lines 2107-2113 Link Here
2107
2127
2108
      while (var_list)
2128
      while (var_list)
2109
      {
2129
      {
2110
	void *var_name=CAR(CAR(var_list));
2130
	void *var_name=CAR(CAR(var_list)),*tmp;
2111
#ifdef TYPE_CHECKING
2131
#ifdef TYPE_CHECKING
2112
	if (item_type(var_name)!=L_SYMBOL)
2132
	if (item_type(var_name)!=L_SYMBOL)
2113
	{
2133
	{
Lines 2118-2124 Link Here
2118
#endif
2138
#endif
2119
2139
2120
	l_user_stack.push(((lisp_symbol *)var_name)->value);
2140
	l_user_stack.push(((lisp_symbol *)var_name)->value);
2121
	((lisp_symbol *)var_name)->value=eval(CAR(CDR(CAR(var_list))));	
2141
	tmp=eval(CAR(CDR(CAR(var_list))));	
2142
	((lisp_symbol *)var_name)->value=tmp;
2122
	var_list=CDR(var_list);
2143
	var_list=CDR(var_list);
2123
      }
2144
      }
2124
2145
Lines 2162-2169 Link Here
2162
      void *block_list=CDR(CDR(arg_list));
2183
      void *block_list=CDR(CDR(arg_list));
2163
2184
2164
#ifndef NO_LIBS
2185
#ifndef NO_LIBS
2165
      long a=cash.reg_lisp_block(lcar(lcdr(arg_list)));
2186
      intptr_t a=cash.reg_lisp_block(lcar(lcdr(arg_list)));
2166
      long b=cash.reg_lisp_block(block_list);
2187
      intptr_t b=cash.reg_lisp_block(block_list);
2167
      lisp_user_function *ufun=new_lisp_user_function(a,b);
2188
      lisp_user_function *ufun=new_lisp_user_function(a,b);
2168
#else
2189
#else
2169
      lisp_user_function *ufun=new_lisp_user_function(lcar(lcdr(arg_list)),block_list);
2190
      lisp_user_function *ufun=new_lisp_user_function(lcar(lcdr(arg_list)),block_list);
Lines 2378-2385 Link Here
2378
				if( strcmp( st, "gamma.lsp" ) == 0 )
2399
				if( strcmp( st, "gamma.lsp" ) == 0 )
2379
				{
2400
				{
2380
					char *gammapath;
2401
					char *gammapath;
2381
					gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 10, "gammapath" );
2402
					gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "gammapath" );
2382
					sprintf( gammapath, "%sgamma.lsp\0", get_save_filename_prefix() );
2403
					sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
2383
					fp = new jFILE( gammapath, "rb" );
2404
					fp = new jFILE( gammapath, "rb" );
2384
					jfree( gammapath );
2405
					jfree( gammapath );
2385
				}
2406
				}
Lines 2788-2795 Link Here
2788
      else return NULL; } break;
2809
      else return NULL; } break;
2789
    case 85 :  // num2str
2810
    case 85 :  // num2str
2790
    {
2811
    {
2791
      char str[10];
2812
      char str[20];
2792
      sprintf(str,"%ld",lnumber_value(eval(CAR(arg_list))));
2813
      sprintf(str,"%ld",(long int)lnumber_value(eval(CAR(arg_list))));
2793
      ret=new_lisp_string(str);
2814
      ret=new_lisp_string(str);
2794
    } break;
2815
    } break;
2795
    case 86 : // nconc
2816
    case 86 : // nconc
Lines 2941-2947 Link Here
2941
  p_ref r19(arg_list);
2962
  p_ref r19(arg_list);
2942
  for (;f_arg;f_arg=CDR(f_arg))
2963
  for (;f_arg;f_arg=CDR(f_arg))
2943
  {
2964
  {
2944
    l_user_stack.push(((lisp_symbol *)CAR(f_arg))->value);
2965
    lisp_symbol *s = (lisp_symbol *)CAR(f_arg);
2966
    l_user_stack.push(s->value);
2945
  }
2967
  }
2946
2968
2947
  // open block so that local vars aren't saved on the stack
2969
  // open block so that local vars aren't saved on the stack
(-)abuse-sdl-0.7.0.orig/src/view.cpp (-59 / +59 lines)
Lines 36-42 Link Here
36
}
36
}
37
37
38
38
39
extern uchar bright_tint[256];
39
extern uint8_t bright_tint[256];
40
40
41
void view::add_ammo(int weapon_type, int total)
41
void view::add_ammo(int weapon_type, int total)
42
{  
42
{  
Lines 95-101 Link Here
95
}
95
}
96
96
97
97
98
long view::xoff()
98
int32_t view::xoff()
99
{
99
{
100
  if (focus)
100
  if (focus)
101
  {
101
  {
Lines 105-111 Link Here
105
  } else return pan_x;
105
  } else return pan_x;
106
}
106
}
107
107
108
long view::interpolated_xoff()
108
int32_t view::interpolated_xoff()
109
{
109
{
110
  if (focus)
110
  if (focus)
111
  {
111
  {
Lines 116-122 Link Here
116
}
116
}
117
117
118
118
119
long view::yoff()
119
int32_t view::yoff()
120
{
120
{
121
  if (focus)
121
  if (focus)
122
  {
122
  {
Lines 127-133 Link Here
127
}
127
}
128
128
129
129
130
long view::interpolated_yoff()
130
int32_t view::interpolated_yoff()
131
{
131
{
132
  if (focus)
132
  if (focus)
133
  {
133
  {
Lines 248-257 Link Here
248
248
249
  if (total_weapons)
249
  if (total_weapons)
250
  {
250
  {
251
    weapons=(long *)jmalloc(total_weapons*sizeof(long),"weapon array");
251
    weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"weapon array");
252
    last_weapons=(long *)jmalloc(total_weapons*sizeof(long),"last weapon array");
252
    last_weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"last weapon array");
253
    memset(weapons,0xff,total_weapons*sizeof(long));   // set all to -1
253
    memset(weapons,0xff,total_weapons*sizeof(int32_t));   // set all to -1
254
    memset(last_weapons,0xff,total_weapons*sizeof(long));   // set all to -1  
254
    memset(last_weapons,0xff,total_weapons*sizeof(int32_t));   // set all to -1  
255
  }
255
  }
256
256
257
  if (total_weapons)
257
  if (total_weapons)
Lines 261-267 Link Here
261
  sbar.need_refresh();
261
  sbar.need_refresh();
262
}
262
}
263
263
264
long view::x_center() 
264
int32_t view::x_center() 
265
{
265
{
266
  if (!focus)
266
  if (!focus)
267
    return (cx1+cx2)/2;
267
    return (cx1+cx2)/2;
Lines 269-275 Link Here
269
    return focus->x; 
269
    return focus->x; 
270
}   
270
}   
271
271
272
long view::y_center() 
272
int32_t view::y_center() 
273
{ 
273
{ 
274
  if (!focus)
274
  if (!focus)
275
    return (cy1+cy2)/2;
275
    return (cy1+cy2)/2;
Lines 294-302 Link Here
294
294
295
295
296
296
297
ushort make_sync()
297
uint16_t make_sync()
298
{
298
{
299
  ushort x=0;
299
  uint16_t x=0;
300
  if (!current_level) return 0;
300
  if (!current_level) return 0;
301
  if (current_level)
301
  if (current_level)
302
  {
302
  {
Lines 320-326 Link Here
320
void view::get_input()
320
void view::get_input()
321
{
321
{
322
	int sug_x,sug_y,sug_b1,sug_b2,sug_b3,sug_b4;
322
	int sug_x,sug_y,sug_b1,sug_b2,sug_b3,sug_b4;
323
	long sug_px,sug_py;
323
	int32_t sug_px,sug_py;
324
324
325
// NOTE:(AK) I have commented this out so we don't use the lisp
325
// NOTE:(AK) I have commented this out so we don't use the lisp
326
//		file "input.lsp" to get our key mappings.
326
//		file "input.lsp" to get our key mappings.
Lines 351-359 Link Here
351
			sug_b4 = 1;
351
			sug_b4 = 1;
352
		else sug_b4 = 0;
352
		else sug_b4 = 0;
353
353
354
		long bx = lnumber_value( CAR( ret ) );
354
		int32_t bx = lnumber_value( CAR( ret ) );
355
		ret = CDR( ret );
355
		ret = CDR( ret );
356
		long by = lnumber_value( CAR( ret ) );
356
		int32_t by = lnumber_value( CAR( ret ) );
357
		ret = CDR( ret );
357
		ret = CDR( ret );
358
		the_game->mouse_to_game( bx, by, sug_px, sug_py, this );
358
		the_game->mouse_to_game( bx, by, sug_px, sug_py, this );
359
359
Lines 375-404 Link Here
375
375
376
	if( view_changed() )
376
	if( view_changed() )
377
	{
377
	{
378
		base->packet.write_byte( SCMD_VIEW_RESIZE );
378
		base->packet.write_uint8( SCMD_VIEW_RESIZE );
379
		base->packet.write_byte( player_number );
379
		base->packet.write_uint8( player_number );
380
		base->packet.write_long( suggest.cx1 );
380
		base->packet.write_uint32( suggest.cx1 );
381
		base->packet.write_long( suggest.cy1 );
381
		base->packet.write_uint32( suggest.cy1 );
382
		base->packet.write_long( suggest.cx2 );
382
		base->packet.write_uint32( suggest.cx2 );
383
		base->packet.write_long( suggest.cy2 );
383
		base->packet.write_uint32( suggest.cy2 );
384
384
385
		base->packet.write_long( suggest.pan_x );
385
		base->packet.write_uint32( suggest.pan_x );
386
		base->packet.write_long( suggest.pan_y );
386
		base->packet.write_uint32( suggest.pan_y );
387
		base->packet.write_long( suggest.shift_down );
387
		base->packet.write_uint32( suggest.shift_down );
388
		base->packet.write_long( suggest.shift_right );
388
		base->packet.write_uint32( suggest.shift_right );
389
	}
389
	}
390
390
391
	if( weapon_changed() )
391
	if( weapon_changed() )
392
	{
392
	{
393
		base->packet.write_byte( SCMD_WEAPON_CHANGE );
393
		base->packet.write_uint8( SCMD_WEAPON_CHANGE );
394
		base->packet.write_byte( player_number );
394
		base->packet.write_uint8( player_number );
395
		base->packet.write_long( suggest.new_weapon );
395
		base->packet.write_uint32( suggest.new_weapon );
396
	}
396
	}
397
397
398
	base->packet.write_byte( SCMD_SET_INPUT );
398
	base->packet.write_uint8( SCMD_SET_INPUT );
399
	base->packet.write_byte( player_number );
399
	base->packet.write_uint8( player_number );
400
400
401
	uchar mflags = 0;
401
	uint8_t mflags = 0;
402
	if( sug_x > 0 )
402
	if( sug_x > 0 )
403
		mflags |= 1;
403
		mflags |= 1;
404
	else if ( sug_x < 0 )
404
	else if ( sug_x < 0 )
Lines 418-426 Link Here
418
	if( sug_b4 )
418
	if( sug_b4 )
419
		mflags |= 128;
419
		mflags |= 128;
420
420
421
	base->packet.write_byte( mflags );
421
	base->packet.write_uint8( mflags );
422
	base->packet.write_short((ushort)((short)sug_px));
422
	base->packet.write_uint16((uint16_t)((int16_t)sug_px));
423
	base->packet.write_short((ushort)((short)sug_py));
423
	base->packet.write_uint16((uint16_t)((int16_t)sug_py));
424
}
424
}
425
425
426
426
Lines 469-475 Link Here
469
  }
469
  }
470
}
470
}
471
471
472
int view::process_input(char cmd, uchar *&pk)   // return 0 if something went wrong
472
int view::process_input(char cmd, uint8_t *&pk)   // return 0 if something went wrong
473
{
473
{
474
  switch (cmd)
474
  switch (cmd)
475
  {
475
  {
Lines 479-485 Link Here
479
    } break;
479
    } break;
480
    case SCMD_VIEW_RESIZE :
480
    case SCMD_VIEW_RESIZE :
481
    { 
481
    { 
482
      long x[8];
482
      int32_t x[8];
483
      memcpy(x,pk,8*4);  pk+=8*4;
483
      memcpy(x,pk,8*4);  pk+=8*4;
484
      cx1=lltl(x[0]);
484
      cx1=lltl(x[0]);
485
      cy1=lltl(x[1]);
485
      cy1=lltl(x[1]);
Lines 502-508 Link Here
502
    }
502
    }
503
    case SCMD_WEAPON_CHANGE :
503
    case SCMD_WEAPON_CHANGE :
504
    {
504
    {
505
      long x;
505
      int32_t x;
506
      memcpy(&x,pk,4);  pk+=4;
506
      memcpy(&x,pk,4);  pk+=4;
507
      current_weapon=lltl(x);
507
      current_weapon=lltl(x);
508
508
Lines 514-520 Link Here
514
514
515
    case SCMD_SET_INPUT :
515
    case SCMD_SET_INPUT :
516
    {
516
    {
517
      uchar x=*(pk++);
517
      uint8_t x=*(pk++);
518
518
519
      if (x&1) x_suggestion=1;
519
      if (x&1) x_suggestion=1;
520
      else if (x&2) x_suggestion=-1;
520
      else if (x&2) x_suggestion=-1;
Lines 529-539 Link Here
529
      if (x&64) b3_suggestion=1; else b3_suggestion=0;
529
      if (x&64) b3_suggestion=1; else b3_suggestion=0;
530
      if (x&128) b4_suggestion=1; else b4_suggestion=0;
530
      if (x&128) b4_suggestion=1; else b4_suggestion=0;
531
531
532
      ushort p[2];
532
      uint16_t p[2];
533
      memcpy(p,pk,2*2);  pk+=2*2;
533
      memcpy(p,pk,2*2);  pk+=2*2;
534
      
534
      
535
      pointer_x=(short)(lstl(p[0]));
535
      pointer_x=(int16_t)(lstl(p[0]));
536
      pointer_y=(short)(lstl(p[1]));
536
      pointer_y=(int16_t)(lstl(p[1]));
537
	
537
	
538
      return 1;
538
      return 1;
539
    } break;
539
    } break;
Lines 817-823 Link Here
817
}
817
}
818
818
819
819
820
void view::resize_view(long Cx1, long Cy1, long Cx2, long Cy2)
820
void view::resize_view(int32_t Cx1, int32_t Cy1, int32_t Cx2, int32_t Cy2)
821
{
821
{
822
  if (cx1!=Cx1 || cx2!=Cx2 || cy1!=Cy1 || cy2!=Cy2)
822
  if (cx1!=Cx1 || cx2!=Cx2 || cy1!=Cy1 || cy2!=Cy2)
823
  {
823
  {
Lines 857-864 Link Here
857
      dprintf("reset position to %d %d\n",start->x,start->y);
857
      dprintf("reset position to %d %d\n",start->x,start->y);
858
    } 
858
    } 
859
    focus->set_state(stopped);
859
    focus->set_state(stopped);
860
    memset(weapons,0xff,total_weapons*sizeof(long));   
860
    memset(weapons,0xff,total_weapons*sizeof(int32_t));   
861
    memset(last_weapons,0xff,total_weapons*sizeof(long));   
861
    memset(last_weapons,0xff,total_weapons*sizeof(int32_t));   
862
862
863
    shift_down=SHIFT_DOWN_DEFAULT;
863
    shift_down=SHIFT_DOWN_DEFAULT;
864
    shift_right=SHIFT_RIGHT_DEFAULT;
864
    shift_right=SHIFT_RIGHT_DEFAULT;
Lines 979-985 Link Here
979
char *get_view_var_name(int num)
979
char *get_view_var_name(int num)
980
{ return vv_names[num]; }
980
{ return vv_names[num]; }
981
981
982
long view::get_view_var_value(int num)
982
int32_t view::get_view_var_value(int num)
983
{
983
{
984
  switch (num)
984
  switch (num)
985
  {
985
  {
Lines 1034-1040 Link Here
1034
1034
1035
1035
1036
1036
1037
long view::set_view_var_value(int num, long x)
1037
int32_t view::set_view_var_value(int num, int32_t x)
1038
{
1038
{
1039
  switch (num)
1039
  switch (num)
1040
  {
1040
  {
Lines 1144-1157 Link Here
1144
}
1144
}
1145
1145
1146
1146
1147
void process_packet_commands(uchar *pk, int size)
1147
void process_packet_commands(uint8_t *pk, int size)
1148
{
1148
{
1149
  long sync_short=-1;
1149
  int32_t sync_uint16=-1;
1150
1150
1151
  if (!size) return ;
1151
  if (!size) return ;
1152
  pk[size]=SCMD_END_OF_PACKET;
1152
  pk[size]=SCMD_END_OF_PACKET;
1153
1153
1154
  uchar cmd;
1154
  uint8_t cmd;
1155
  int already_reloaded=0;
1155
  int already_reloaded=0;
1156
1156
1157
1157
Lines 1169-1175 Link Here
1169
      case SCMD_EXT_KEYRELEASE :
1169
      case SCMD_EXT_KEYRELEASE :
1170
      case SCMD_CHAT_KEYPRESS :
1170
      case SCMD_CHAT_KEYPRESS :
1171
      {
1171
      {
1172
	uchar player_num=*(pk++);
1172
	uint8_t player_num=*(pk++);
1173
1173
1174
	view *v=player_list;
1174
	view *v=player_list;
1175
	for (;v && v->player_number!=player_num;v=v->next);
1175
	for (;v && v->player_number!=player_num;v=v->next);
Lines 1195-1211 Link Here
1195
1195
1196
      case SCMD_SYNC :
1196
      case SCMD_SYNC :
1197
      {
1197
      {
1198
	ushort x;
1198
	uint16_t x;
1199
	memcpy(&x,pk,2);  pk+=2;
1199
	memcpy(&x,pk,2);  pk+=2;
1200
	x=lstl(x);
1200
	x=lstl(x);
1201
	if (demo_man.current_state()==demo_manager::PLAYING)
1201
	if (demo_man.current_state()==demo_manager::PLAYING)
1202
	sync_short=make_sync();
1202
	sync_uint16=make_sync();
1203
1203
1204
	if (sync_short==-1)
1204
	if (sync_uint16==-1)
1205
	sync_short=x;
1205
	sync_uint16=x;
1206
	else if (x!=sync_short && !already_reloaded)
1206
	else if (x!=sync_uint16 && !already_reloaded)
1207
	{
1207
	{
1208
	  dprintf("out of sync %d (packet=%d, calced=%d)\n",current_level->tick_counter(),x,sync_short);
1208
	  dprintf("out of sync %d (packet=%d, calced=%d)\n",current_level->tick_counter(),x,sync_uint16);
1209
	  if (demo_man.current_state()==demo_manager::NORMAL)
1209
	  if (demo_man.current_state()==demo_manager::NORMAL)
1210
	    net_reload();
1210
	    net_reload();
1211
	  already_reloaded=1;
1211
	  already_reloaded=1;
Lines 1213-1219 Link Here
1213
      } break;
1213
      } break;
1214
      case SCMD_DELETE_CLIENT :
1214
      case SCMD_DELETE_CLIENT :
1215
      {
1215
      {
1216
	uchar player_num=*(pk++);
1216
	uint8_t player_num=*(pk++);
1217
	view *v=player_list,*last=NULL;
1217
	view *v=player_list,*last=NULL;
1218
	for (;v && v->player_number!=player_num;v=v->next)
1218
	for (;v && v->player_number!=player_num;v=v->next)
1219
	last=v;
1219
	last=v;
(-)abuse-sdl-0.7.0.orig/src/old.nfclient.cpp (-32 / +32 lines)
Lines 18-24 Link Here
18
  virtual int unbuffered_read(void *buf, size_t count);       // returns number of bytes read
18
  virtual int unbuffered_read(void *buf, size_t count);       // returns number of bytes read
19
  int new_read(void *buf, size_t count);       // returns number of bytes read
19
  int new_read(void *buf, size_t count);       // returns number of bytes read
20
  virtual int unbuffered_write(void *buf, size_t count);      // returns number of bytes written
20
  virtual int unbuffered_write(void *buf, size_t count);      // returns number of bytes written
21
  virtual int unbuffered_seek(long offset, int whence);  // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
21
  virtual int unbuffered_seek(int32_t offset, int whence);  // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
22
  virtual int unbuffered_tell();
22
  virtual int unbuffered_tell();
23
  virtual int file_size();
23
  virtual int file_size();
24
  virtual ~nfs_file();
24
  virtual ~nfs_file();
Lines 79-99 Link Here
79
      {
79
      {
80
	delete local_test;
80
	delete local_test;
81
	local_test=NULL;
81
	local_test=NULL;
82
	pk.write_byte(NFS_OPEN);
82
	pk.write_uint8(NFS_OPEN);
83
      }
83
      }
84
      else
84
      else
85
      {
85
      {
86
	pk.write_byte(NFS_CRC_OPEN);
86
	pk.write_uint8(NFS_CRC_OPEN);
87
	int fail;
87
	int fail;
88
	ulong crc=crc_man.get_crc(crc_man.get_filenumber(filename),fail); // skip crc calc if we can
88
	uint32_t crc=crc_man.get_crc(crc_man.get_filenumber(filename),fail); // skip crc calc if we can
89
	if (fail) crc=crc_file(local_test);
89
	if (fail) crc=crc_file(local_test);
90
	pk.write_long(crc);
90
	pk.write_uint32(crc);
91
      }
91
      }
92
92
93
      pk.write_byte(strlen(filename)+1);
93
      pk.write_uint8(strlen(filename)+1);
94
      pk.write((uchar *)filename,strlen(filename)+1);
94
      pk.write((uint8_t *)filename,strlen(filename)+1);
95
      pk.write_byte(strlen(mode)+1);
95
      pk.write_uint8(strlen(mode)+1);
96
      pk.write((uchar *)mode,strlen(mode)+1);
96
      pk.write((uint8_t *)mode,strlen(mode)+1);
97
      dprintf("try open %s,%s\n",filename,mode);
97
      dprintf("try open %s,%s\n",filename,mode);
98
      offset=0;
98
      offset=0;
99
      if (!nfs_server->send(pk))
99
      if (!nfs_server->send(pk))
Lines 103-110 Link Here
103
	if (!nfs_server->get(pk)) nfs_disconnect();
103
	if (!nfs_server->get(pk)) nfs_disconnect();
104
	else
104
	else
105
	{
105
	{
106
	  long fd;
106
	  int32_t fd;
107
	  if (pk.read((uchar *)&fd,4)!=4)
107
	  if (pk.read((uint8_t *)&fd,4)!=4)
108
	    nfs_disconnect();
108
	    nfs_disconnect();
109
	  else
109
	  else
110
	  {
110
	  {
Lines 150-158 Link Here
150
  else
150
  else
151
  { 
151
  { 
152
    packet pk;
152
    packet pk;
153
    pk.write_byte(NFS_READ);
153
    pk.write_uint8(NFS_READ);
154
    pk.write_long(nfs_fd);
154
    pk.write_uint32(nfs_fd);
155
    pk.write_long(count);
155
    pk.write_uint32(count);
156
    dprintf("try read %d,%d\n",nfs_fd,count);
156
    dprintf("try read %d,%d\n",nfs_fd,count);
157
    if (!nfs_server->send(pk))
157
    if (!nfs_server->send(pk))
158
    {
158
    {
Lines 164-176 Link Here
164
164
165
      int fail=0;
165
      int fail=0;
166
      int rtotal=0;
166
      int rtotal=0;
167
      ushort size=1;
167
      uint16_t size=1;
168
      while (count>0 && !fail && size)
168
      while (count>0 && !fail && size)
169
      {
169
      {
170
	if (!nfs_server->get(pk)) fail=1;
170
	if (!nfs_server->get(pk)) fail=1;
171
	else
171
	else
172
	{	  
172
	{	  
173
	  if (pk.read((uchar *)&size,2)!=2) fail=1;
173
	  if (pk.read((uint8_t *)&size,2)!=2) fail=1;
174
	  else
174
	  else
175
	  {
175
	  {
176
	    size=lstl(size);
176
	    size=lstl(size);
Lines 179-185 Link Here
179
	    {
179
	    {
180
	      int need_size=size>count ? count : size;
180
	      int need_size=size>count ? count : size;
181
181
182
	      if (pk.read((uchar *)buf,need_size)!=need_size) fail=1;
182
	      if (pk.read((uint8_t *)buf,need_size)!=need_size) fail=1;
183
	      else
183
	      else
184
	      {
184
	      {
185
		count-=need_size;	    
185
		count-=need_size;	    
Lines 218-235 Link Here
218
}
218
}
219
219
220
220
221
int nfs_file::unbuffered_seek(long off, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
221
int nfs_file::unbuffered_seek(int32_t off, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
222
{
222
{
223
  if (local)
223
  if (local)
224
    return local->seek(off,whence);
224
    return local->seek(off,whence);
225
  else
225
  else
226
  { 
226
  { 
227
    packet pk;
227
    packet pk;
228
    pk.write_byte(NFS_SEEK);
228
    pk.write_uint8(NFS_SEEK);
229
    pk.write_long(nfs_fd);
229
    pk.write_uint32(nfs_fd);
230
230
231
    pk.write_long(off);
231
    pk.write_uint32(off);
232
    pk.write_long(whence);
232
    pk.write_uint32(whence);
233
    dprintf("seek %d %d %d\n",nfs_fd,off,whence);
233
    dprintf("seek %d %d %d\n",nfs_fd,off,whence);
234
    if (!nfs_server->send(pk))
234
    if (!nfs_server->send(pk))
235
    {
235
    {
Lines 248-255 Link Here
248
  else if (nfs_server)
248
  else if (nfs_server)
249
  { 
249
  { 
250
    packet pk;
250
    packet pk;
251
    pk.write_byte(NFS_TELL);
251
    pk.write_uint8(NFS_TELL);
252
    pk.write_long(nfs_fd);
252
    pk.write_uint32(nfs_fd);
253
    if (!nfs_server->send(pk))
253
    if (!nfs_server->send(pk))
254
    {
254
    {
255
      nfs_disconnect();    
255
      nfs_disconnect();    
Lines 262-269 Link Here
262
	return 0;
262
	return 0;
263
      } else
263
      } else
264
      {
264
      {
265
	long off;
265
	int32_t off;
266
	if (pk.read((uchar *)&off,4)!=4) 
266
	if (pk.read((uint8_t *)&off,4)!=4) 
267
	{
267
	{
268
	  dprintf("Disconnected on tell()\n");
268
	  dprintf("Disconnected on tell()\n");
269
	  nfs_disconnect();
269
	  nfs_disconnect();
Lines 283-290 Link Here
283
  else if (nfs_server)
283
  else if (nfs_server)
284
  { 
284
  { 
285
    packet pk;
285
    packet pk;
286
    pk.write_byte(NFS_FILESIZE);
286
    pk.write_uint8(NFS_FILESIZE);
287
    pk.write_long(nfs_fd);
287
    pk.write_uint32(nfs_fd);
288
    if (!nfs_server->send(pk))
288
    if (!nfs_server->send(pk))
289
    {
289
    {
290
      nfs_disconnect();    
290
      nfs_disconnect();    
Lines 297-304 Link Here
297
	return 0;
297
	return 0;
298
      } else
298
      } else
299
      {
299
      {
300
	long size;
300
	int32_t size;
301
	if (pk.read((uchar *)&size,4)!=4) 
301
	if (pk.read((uint8_t *)&size,4)!=4) 
302
	{
302
	{
303
	  dprintf("disconnected on filesize\n");
303
	  dprintf("disconnected on filesize\n");
304
	  nfs_disconnect();
304
	  nfs_disconnect();
Lines 317-324 Link Here
317
  else if (nfs_server && !open_failure())
317
  else if (nfs_server && !open_failure())
318
  {    
318
  {    
319
    packet pk;
319
    packet pk;
320
    pk.write_byte(NFS_CLOSE);
320
    pk.write_uint8(NFS_CLOSE);
321
    pk.write_long(nfs_fd);
321
    pk.write_uint32(nfs_fd);
322
    dprintf("close %d\n",nfs_fd);
322
    dprintf("close %d\n",nfs_fd);
323
    if (!nfs_server->send(pk))
323
    if (!nfs_server->send(pk))
324
    {
324
    {
(-)abuse-sdl-0.7.0.orig/src/director.cpp (-1 / +1 lines)
Lines 24-30 Link Here
24
24
25
25
26
26
27
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color)
27
int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color)
28
{
28
{
29
  short cx1,cy1,cx2,cy2,word_size,word_len;
29
  short cx1,cy1,cx2,cy2,word_size,word_len;
30
  screen->get_clip(cx1,cy1,cx2,cy2);
30
  screen->get_clip(cx1,cy1,cx2,cy2);
(-)abuse-sdl-0.7.0.orig/src/dev.cpp (-38 / +40 lines)
Lines 275-281 Link Here
275
}
275
}
276
276
277
277
278
long dev_controll::snap_x(long x)
278
int32_t dev_controll::snap_x(int32_t x)
279
{
279
{
280
  if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
280
  if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
281
    return x-(x%the_game->ftile_width());
281
    return x-(x%the_game->ftile_width());
Lines 284-290 Link Here
284
  else return x;  
284
  else return x;  
285
}
285
}
286
286
287
long dev_controll::snap_y(long y)
287
int32_t dev_controll::snap_y(int32_t y)
288
{
288
{
289
  if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
289
  if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
290
    return y-(y%the_game->ftile_height())-1;
290
    return y-(y%the_game->ftile_height())-1;
Lines 340-346 Link Here
340
void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height)
340
void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height)
341
{
341
{
342
  unsigned char *sl1,*sl2;
342
  unsigned char *sl1,*sl2;
343
  long xstep=(im->width()<<16)/new_width,
343
  int32_t xstep=(im->width()<<16)/new_width,
344
       ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
344
       ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
345
  screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
345
  screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
346
346
Lines 379-385 Link Here
379
void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height)
379
void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height)
380
{
380
{
381
  unsigned char *sl1,*sl2;
381
  unsigned char *sl1,*sl2;
382
  long xstep=(im->width()<<16)/new_width,
382
  int32_t xstep=(im->width()<<16)/new_width,
383
       ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
383
       ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
384
  screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
384
  screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
385
385
Lines 404-410 Link Here
404
  if (y+new_height>cy2)
404
  if (y+new_height>cy2)
405
    new_height-=y+new_height-cy2;
405
    new_height-=y+new_height-cy2;
406
  
406
  
407
  uchar d;
407
  uint8_t d;
408
  for (iy=iy_start;new_height>0;new_height--,y++,iy+=ystep)
408
  for (iy=iy_start;new_height>0;new_height--,y++,iy+=ystep)
409
  {
409
  {
410
    sl1=im->scan_line(iy>>16);
410
    sl1=im->scan_line(iy>>16);
Lines 437-446 Link Here
437
437
438
void dev_controll::dev_draw(view *v)
438
void dev_controll::dev_draw(view *v)
439
{
439
{
440
  long x1,y1,x2,y2;
440
  int32_t x1,y1,x2,y2;
441
  if (dev&EDIT_MODE)
441
  if (dev&EDIT_MODE)
442
  {
442
  {
443
    long vx=v->xoff(),vy=v->yoff();
443
    int32_t vx=v->xoff(),vy=v->yoff();
444
  
444
  
445
    if (dev&DRAW_LINKS)
445
    if (dev&DRAW_LINKS)
446
    {
446
    {
Lines 458-464 Link Here
458
458
459
    if (link_object)
459
    if (link_object)
460
    {
460
    {
461
      long rx1,ry1;
461
      int32_t rx1,ry1;
462
      the_game->game_to_mouse(link_object->x,link_object->y,v,rx1,ry1);      
462
      the_game->game_to_mouse(link_object->x,link_object->y,v,rx1,ry1);      
463
      screen->line(rx1,ry1,dlastx,dlasty,yellow);            
463
      screen->line(rx1,ry1,dlastx,dlasty,yellow);            
464
    }
464
    }
Lines 467-473 Link Here
467
    {
467
    {
468
      image *i=cash.img(light_buttons[0]);
468
      image *i=cash.img(light_buttons[0]);
469
      int l=i->width()/2,h=i->height()/2;
469
      int l=i->width()/2,h=i->height()/2;
470
      long rx1,ry1;
470
      int32_t rx1,ry1;
471
      the_game->game_to_mouse(selected_light->x,selected_light->y,v,rx1,ry1);      
471
      the_game->game_to_mouse(selected_light->x,selected_light->y,v,rx1,ry1);      
472
      screen->rectangle(rx1-l,ry1-h,rx1+l,ry1+h,eh->bright_color());
472
      screen->rectangle(rx1-l,ry1-h,rx1+l,ry1+h,eh->bright_color());
473
    }
473
    }
Lines 509-515 Link Here
509
    if (selected_object)
509
    if (selected_object)
510
    {    
510
    {    
511
      selected_object->picture_space(x1,y1,x2,y2);    
511
      selected_object->picture_space(x1,y1,x2,y2);    
512
      long rx1,ry1,rx2,ry2;
512
      int32_t rx1,ry1,rx2,ry2;
513
      the_game->game_to_mouse(x1,y1,v,rx1,ry1);
513
      the_game->game_to_mouse(x1,y1,v,rx1,ry1);
514
      the_game->game_to_mouse(x2,y2,v,rx2,ry2);
514
      the_game->game_to_mouse(x2,y2,v,rx2,ry2);
515
      screen->rectangle(rx1,ry1,rx2,ry2,eh->bright_color());
515
      screen->rectangle(rx1,ry1,rx2,ry2,eh->bright_color());
Lines 529-535 Link Here
529
  update_memprof();
529
  update_memprof();
530
}
530
}
531
531
532
light_source *find_light(long x, long y)
532
light_source *find_light(int32_t x, int32_t y)
533
{
533
{
534
  image *i=cash.img(light_buttons[0]);
534
  image *i=cash.img(light_buttons[0]);
535
  int l=i->width()/2,h=i->height()/2;
535
  int l=i->width()/2,h=i->height()/2;
Lines 567-573 Link Here
567
    jfree(st);
567
    jfree(st);
568
    jfree(ch);
568
    jfree(ch);
569
    char buf[100];
569
    char buf[100];
570
    sprintf(buf,"%8ld %8ld",j_allocated(),j_available());
570
    sprintf(buf,"%8ld %8ld",(long int)j_allocated(),(long int)j_available());
571
    eh->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-eh->font()->height(),buf);
571
    eh->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-eh->font()->height(),buf);
572
572
573
  }
573
  }
Lines 1030-1040 Link Here
1030
    if (current_level && player_list && player_list->focus)
1030
    if (current_level && player_list && player_list->focus)
1031
    {
1031
    {
1032
      edit_object=selected_object=NULL;
1032
      edit_object=selected_object=NULL;
1033
      long cx=player_list->focus->x,cy=player_list->focus->y;
1033
      int32_t cx=player_list->focus->x,cy=player_list->focus->y;
1034
1034
1035
      // save the old weapon array
1035
      // save the old weapon array
1036
      long *w=(long *)jmalloc(total_weapons*sizeof(long),"tmp weapon array");
1036
      int32_t *w=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"tmp weapon array");
1037
      memcpy(w,player_list->weapons,total_weapons*sizeof(long));
1037
      memcpy(w,player_list->weapons,total_weapons*sizeof(int32_t));
1038
      
1038
      
1039
      char tmp[100];
1039
      char tmp[100];
1040
      strcpy(tmp,current_level->name());
1040
      strcpy(tmp,current_level->name());
Lines 1047-1053 Link Here
1047
      player_list->focus->x=cx;
1047
      player_list->focus->x=cx;
1048
      player_list->focus->y=cy;
1048
      player_list->focus->y=cy;
1049
1049
1050
      memcpy(player_list->weapons,w,total_weapons*sizeof(long));     
1050
      memcpy(player_list->weapons,w,total_weapons*sizeof(int32_t));     
1051
      jfree(w);
1051
      jfree(w);
1052
1052
1053
      the_game->need_refresh();
1053
      the_game->need_refresh();
Lines 1056-1062 Link Here
1056
1056
1057
  if (!strcmp(fword,"unchop"))
1057
  if (!strcmp(fword,"unchop"))
1058
  {
1058
  {
1059
    long rx,ry;
1059
    int32_t rx,ry;
1060
    the_game->btile_on(dlastx,dlasty,rx,ry);
1060
    the_game->btile_on(dlastx,dlasty,rx,ry);
1061
    if (rx>=0 && ry>=0)
1061
    if (rx>=0 && ry>=0)
1062
    {
1062
    {
Lines 1178-1184 Link Here
1178
1178
1179
    if (t>=0)                                 // did we find it?
1179
    if (t>=0)                                 // did we find it?
1180
    {
1180
    {
1181
      long rx,ry;
1181
      int32_t rx,ry;
1182
      the_game->mouse_to_game(dlastx,dlasty,rx,ry);
1182
      the_game->mouse_to_game(dlastx,dlasty,rx,ry);
1183
      edit_object=create(t,rx,ry);
1183
      edit_object=create(t,rx,ry);
1184
      current_level->add_object(edit_object);
1184
      current_level->add_object(edit_object);
Lines 1215-1221 Link Here
1215
  
1215
  
1216
  if (!strcmp(fword,"clear_auto"))
1216
  if (!strcmp(fword,"clear_auto"))
1217
  {
1217
  {
1218
    long i,j;
1218
    int32_t i,j;
1219
    for (i=0;i<current_level->foreground_width();i++)
1219
    for (i=0;i<current_level->foreground_width();i++)
1220
      for (j=0;j<current_level->foreground_height();j++)
1220
      for (j=0;j<current_level->foreground_height();j++)
1221
        current_level->clear_fg(i,j);
1221
        current_level->clear_fg(i,j);
Lines 1223-1229 Link Here
1223
1223
1224
  if (!strcmp(fword,"fg_select"))
1224
  if (!strcmp(fword,"fg_select"))
1225
  {
1225
  {
1226
    long x,y;
1226
    int32_t x,y;
1227
    the_game->ftile_on(dlastx,dlasty,x,y);
1227
    the_game->ftile_on(dlastx,dlasty,x,y);
1228
    if (x>=0 && y>=0 && x<current_level->foreground_width() &&
1228
    if (x>=0 && y>=0 && x<current_level->foreground_width() &&
1229
	y<current_level->foreground_height())
1229
	y<current_level->foreground_height())
Lines 1237-1243 Link Here
1237
1237
1238
  if (!strcmp(fword,"toggle_fg_raise"))
1238
  if (!strcmp(fword,"toggle_fg_raise"))
1239
  {
1239
  {
1240
    long x,y;
1240
    int32_t x,y;
1241
    the_game->ftile_on(dlastx,dlasty,x,y);
1241
    the_game->ftile_on(dlastx,dlasty,x,y);
1242
    if (x>=0 && y>=0 && x<current_level->foreground_width() &&
1242
    if (x>=0 && y>=0 && x<current_level->foreground_width() &&
1243
	y<current_level->foreground_height())    
1243
	y<current_level->foreground_height())    
Lines 1486-1492 Link Here
1486
  if (aiw)
1486
  if (aiw)
1487
  {    
1487
  {    
1488
    game_object *o=ai_object;
1488
    game_object *o=ai_object;
1489
    long x;
1489
    int32_t x;
1490
    if (o)
1490
    if (o)
1491
    {
1491
    {
1492
      if (figures[o->otype]->total_fields)
1492
      if (figures[o->otype]->total_fields)
Lines 1536-1542 Link Here
1536
1536
1537
  if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
1537
  if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
1538
  {
1538
  {
1539
    long gx,gy;
1539
    int32_t gx,gy;
1540
    the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1540
    the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1541
    if (!current_level) return ;
1541
    if (!current_level) return ;
1542
    current_area=current_level->area_list=new area_controller(gx,gy,
1542
    current_area=current_level->area_list=new area_controller(gx,gy,
Lines 1576-1586 Link Here
1576
  if (!current_level) return;
1576
  if (!current_level) return;
1577
  if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
1577
  if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
1578
  {
1578
  {
1579
    long mx=last_demo_mx,my=last_demo_my;
1579
    int32_t mx=last_demo_mx,my=last_demo_my;
1580
    view *v=the_game->view_in(mx,my);
1580
    view *v=the_game->view_in(mx,my);
1581
    for (area_controller *a=current_level->area_list;a;a=a->next)
1581
    for (area_controller *a=current_level->area_list;a;a=a->next)
1582
    {
1582
    {
1583
      long x1,y1,x2,y2;
1583
      int32_t x1,y1,x2,y2;
1584
      the_game->game_to_mouse(a->x,a->y,v,x1,y1);
1584
      the_game->game_to_mouse(a->x,a->y,v,x1,y1);
1585
      the_game->game_to_mouse(a->x+a->w,a->y+a->h,v,x2,y2);
1585
      the_game->game_to_mouse(a->x+a->w,a->y+a->h,v,x2,y2);
1586
      if (abs(x1-mx)<2 && abs(y1-my)<2)
1586
      if (abs(x1-mx)<2 && abs(y1-my)<2)
Lines 1645-1651 Link Here
1645
1645
1646
void dev_controll::handle_event(event &ev)
1646
void dev_controll::handle_event(event &ev)
1647
{
1647
{
1648
  long x,y;
1648
  int32_t x,y;
1649
  if (link_object && (dlastx!=last_link_x || dlasty!=last_link_y))
1649
  if (link_object && (dlastx!=last_link_x || dlasty!=last_link_y))
1650
  {
1650
  {
1651
    last_link_x=dlastx;
1651
    last_link_x=dlastx;
Lines 1723-1729 Link Here
1723
	}
1723
	}
1724
	if (ev.window==NULL && ev.type==EV_KEY && ev.key=='d')
1724
	if (ev.window==NULL && ev.type==EV_KEY && ev.key=='d')
1725
	{
1725
	{
1726
	  long xv=0,yv=100;
1726
	  int32_t xv=0,yv=100;
1727
	  edit_object->try_move(edit_object->x,edit_object->y,xv,yv,1);
1727
	  edit_object->try_move(edit_object->x,edit_object->y,xv,yv,1);
1728
	  edit_object->y+=yv;
1728
	  edit_object->y+=yv;
1729
	  state=DEV_SELECT;
1729
	  state=DEV_SELECT;
Lines 1821-1827 Link Here
1821
    {
1821
    {
1822
      if (current_area)
1822
      if (current_area)
1823
      {
1823
      {
1824
	long gx,gy;
1824
	int32_t gx,gy;
1825
	the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1825
	the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1826
	if (gx>current_area->x && gy>current_area->y)
1826
	if (gx>current_area->x && gy>current_area->y)
1827
	{       
1827
	{       
Lines 1844-1850 Link Here
1844
    {
1844
    {
1845
      if (current_area)
1845
      if (current_area)
1846
      {
1846
      {
1847
	long gx,gy;
1847
	int32_t gx,gy;
1848
	the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1848
	the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
1849
	if (gx<current_area->x+current_area->w && gy<current_area->y+current_area->h)
1849
	if (gx<current_area->x+current_area->w && gy<current_area->y+current_area->h)
1850
	{       
1850
	{       
Lines 1871-1877 Link Here
1871
	selected_object=NULL;
1871
	selected_object=NULL;
1872
	if (ev.window==NULL)
1872
	if (ev.window==NULL)
1873
	{	
1873
	{	
1874
	  long rx,ry;
1874
	  int32_t rx,ry;
1875
	  the_game->mouse_to_game(last_demo_mx,last_demo_my,rx,ry);
1875
	  the_game->mouse_to_game(last_demo_mx,last_demo_my,rx,ry);
1876
1876
1877
	  if (!(dev & MAP_MODE))
1877
	  if (!(dev & MAP_MODE))
Lines 1891-1897 Link Here
1891
	  {
1891
	  {
1892
	    if (ev.mouse_button==1 && !selected_object && !selected_light)
1892
	    if (ev.mouse_button==1 && !selected_object && !selected_light)
1893
	    {
1893
	    {
1894
	      long xs,ys;
1894
	      int32_t xs,ys;
1895
	      the_game->ftile_on(last_demo_mx,last_demo_my,xs,ys);
1895
	      the_game->ftile_on(last_demo_mx,last_demo_my,xs,ys);
1896
	      if (xs>=0 && ys>=0 && xs<current_level->foreground_width() && 
1896
	      if (xs>=0 && ys>=0 && xs<current_level->foreground_width() && 
1897
		  ys<current_level->foreground_height())	      
1897
		  ys<current_level->foreground_height())	      
Lines 1899-1905 Link Here
1899
	      the_game->need_refresh();
1899
	      the_game->need_refresh();
1900
	    } else if (ev.mouse_button==1 && !selected_object && !selected_light)
1900
	    } else if (ev.mouse_button==1 && !selected_object && !selected_light)
1901
	    {
1901
	    {
1902
	      long xs,ys;
1902
	      int32_t xs,ys;
1903
	      the_game->btile_on(last_demo_mx,last_demo_my,xs,ys);
1903
	      the_game->btile_on(last_demo_mx,last_demo_my,xs,ys);
1904
	      if (xs>=0 && ys>=0 && xs<current_level->background_width() && 
1904
	      if (xs>=0 && ys>=0 && xs<current_level->background_width() && 
1905
		  ys<current_level->background_height())
1905
		  ys<current_level->background_height())
Lines 2002-2007 Link Here
2002
	}
2002
	}
2003
      }
2003
      }
2004
    }
2004
    }
2005
    default:
2006
      break;
2005
  }
2007
  }
2006
2008
2007
  switch (ev.type)
2009
  switch (ev.type)
Lines 2515-2521 Link Here
2515
	case DEV_LIGHT8 :
2517
	case DEV_LIGHT8 :
2516
	case DEV_LIGHT9 :
2518
	case DEV_LIGHT9 :
2517
	{
2519
	{
2518
	  long lx,ly;
2520
	  int32_t lx,ly;
2519
	  the_game->mouse_to_game(last_demo_mx,last_demo_my,lx,ly);
2521
	  the_game->mouse_to_game(last_demo_mx,last_demo_my,lx,ly);
2520
	  lx=snap_x(lx);
2522
	  lx=snap_x(lx);
2521
	  ly=snap_y(ly);
2523
	  ly=snap_y(ly);
Lines 2852-2858 Link Here
2852
	  case 'R' : do_command("reload",ev); break;
2854
	  case 'R' : do_command("reload",ev); break;
2853
	  case 'w' : 
2855
	  case 'w' : 
2854
	  {       
2856
	  {       
2855
	    long rx,ry;
2857
	    int32_t rx,ry;
2856
	    the_game->mouse_to_game(dlastx,dlasty,rx,ry);
2858
	    the_game->mouse_to_game(dlastx,dlasty,rx,ry);
2857
	    char msg[100]; sprintf(msg,symbol_str("mouse_at"),rx,ry);
2859
	    char msg[100]; sprintf(msg,symbol_str("mouse_at"),rx,ry);
2858
	    the_game->show_help(msg);
2860
	    the_game->show_help(msg);
Lines 2874-2880 Link Here
2874
	  {
2876
	  {
2875
	    if (current_level && player_list && player_list->focus)
2877
	    if (current_level && player_list && player_list->focus)
2876
	    {
2878
	    {
2877
	      long rx,ry;
2879
	      int32_t rx,ry;
2878
	      the_game->mouse_to_game(dlastx,dlasty,rx,ry);
2880
	      the_game->mouse_to_game(dlastx,dlasty,rx,ry);
2879
	      player_list->focus->x=rx;
2881
	      player_list->focus->x=rx;
2880
	      player_list->focus->y=ry;
2882
	      player_list->focus->y=ry;
Lines 3147-3153 Link Here
3147
	  case JK_ESC : close_window();	 break;
3149
	  case JK_ESC : close_window();	 break;
3148
	  case ' ' : 
3150
	  case ' ' : 
3149
	  {
3151
	  {
3150
	    long xs,ys,xx,yy;
3152
	    int32_t xs,ys,xx,yy;
3151
	    the_game->ftile_on(me->x,me->y,xs,ys);
3153
	    the_game->ftile_on(me->x,me->y,xs,ys);
3152
3154
3153
	    for (xx=xs;xx<xs+w;xx++)
3155
	    for (xx=xs;xx<xs+w;xx++)
Lines 3162-3168 Link Here
3162
	  } break;
3164
	  } break;
3163
	  case 't' :
3165
	  case 't' :
3164
	  {
3166
	  {
3165
	    long xs,ys;
3167
	    int32_t xs,ys;
3166
	    the_game->ftile_on(me->x,me->y,xs,ys);
3168
	    the_game->ftile_on(me->x,me->y,xs,ys);
3167
	    dev_cont->fg_fill(-1,xs,ys,this);
3169
	    dev_cont->fg_fill(-1,xs,ys,this);
3168
	  } break;
3170
	  } break;
Lines 3208-3214 Link Here
3208
    y=me->y;
3210
    y=me->y;
3209
  }
3211
  }
3210
3212
3211
  fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,w,h,x,y,scale);
3213
  fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,(long)w,(long)h,(long)x,(long)y,(long)scale);
3212
  int i;
3214
  int i;
3213
  for (i=0;i<w*h;i++)
3215
  for (i=0;i<w*h;i++)
3214
    fprintf(fp,"%d ",pat[i]&0x7fff);
3216
    fprintf(fp,"%d ",pat[i]&0x7fff);
(-)abuse-sdl-0.7.0.orig/src/newlight.cpp (-29 / +29 lines)
Lines 182-188 Link Here
182
  if (fp.open_failure()) recalc=1;
182
  if (fp.open_failure()) recalc=1;
183
  else
183
  else
184
  {
184
  {
185
    if (fp.read_short()!=calc_crc((unsigned char *)pal->addr(),768))
185
    if (fp.read_uint16()!=calc_crc((unsigned char *)pal->addr(),768))
186
      recalc=1;
186
      recalc=1;
187
    else
187
    else
188
    {
188
    {
Lines 272-278 Link Here
272
   
272
   
273
273
274
    jFILE f("light.tbl","wb");
274
    jFILE f("light.tbl","wb");
275
    f.write_short(calc_crc((unsigned char *)pal->addr(),768));
275
    f.write_uint16(calc_crc((unsigned char *)pal->addr(),768));
276
    f.write(white_light,256*64);
276
    f.write(white_light,256*64);
277
    f.write(green_light,256*64);
277
    f.write(green_light,256*64);
278
    for (int i=0;i<TTINTS;i++)
278
    for (int i=0;i<TTINTS;i++)
Lines 779-795 Link Here
779
{
779
{
780
  int t=0;
780
  int t=0;
781
  for (light_source *f=first_light_source;f;f=f->next) t++;
781
  for (light_source *f=first_light_source;f;f=f->next) t++;
782
  fp->write_long(t);
782
  fp->write_uint32(t);
783
  fp->write_long(min_light_level);
783
  fp->write_uint32(min_light_level);
784
  for (f=first_light_source;f;f=f->next)
784
  for (f=first_light_source;f;f=f->next)
785
  {
785
  {
786
    fp->write_long(f->x);
786
    fp->write_uint32(f->x);
787
    fp->write_long(f->y);
787
    fp->write_uint32(f->y);
788
    fp->write_long(f->xshift);
788
    fp->write_uint32(f->xshift);
789
    fp->write_long(f->yshift);
789
    fp->write_uint32(f->yshift);
790
    fp->write_long(f->inner_radius);
790
    fp->write_uint32(f->inner_radius);
791
    fp->write_long(f->outer_radius);
791
    fp->write_uint32(f->outer_radius);
792
    fp->write_byte(f->type);
792
    fp->write_uint8(f->type);
793
  }
793
  }
794
}
794
}
795
795
Lines 799-817 Link Here
799
  packet pk;
799
  packet pk;
800
  int t=0;
800
  int t=0;
801
  for (light_source *f=first_light_source;f;f=f->next) t++;
801
  for (light_source *f=first_light_source;f;f=f->next) t++;
802
  pk.write_long(t);
802
  pk.write_uint32(t);
803
  pk.write_short(min_light_level);
803
  pk.write_uint16(min_light_level);
804
  if (!os->send(pk)) return 0;
804
  if (!os->send(pk)) return 0;
805
  for (f=first_light_source;f;f=f->next)
805
  for (f=first_light_source;f;f=f->next)
806
  {
806
  {
807
    pk.reset();
807
    pk.reset();
808
    pk.write_long(f->x);
808
    pk.write_uint32(f->x);
809
    pk.write_long(f->y);
809
    pk.write_uint32(f->y);
810
    pk.write_long(f->xshift);
810
    pk.write_uint32(f->xshift);
811
    pk.write_long(f->yshift);
811
    pk.write_uint32(f->yshift);
812
    pk.write_long(f->inner_radius);
812
    pk.write_uint32(f->inner_radius);
813
    pk.write_long(f->outer_radius);
813
    pk.write_uint32(f->outer_radius);
814
    pk.write_long(f->type);
814
    pk.write_uint32(f->type);
815
    if (!os->send(pk)) return 0;   
815
    if (!os->send(pk)) return 0;   
816
  }
816
  }
817
  return 1;
817
  return 1;
Lines 825-843 Link Here
825
  if (se)
825
  if (se)
826
  {
826
  {
827
    fp->seek(se->offset,SEEK_SET);
827
    fp->seek(se->offset,SEEK_SET);
828
    long t=fp->read_long();
828
    long t=fp->read_uint32();
829
    min_light_level=fp->read_long();
829
    min_light_level=fp->read_uint32();
830
    light_source *last;
830
    light_source *last;
831
    while (t)
831
    while (t)
832
    {
832
    {
833
      t--;
833
      t--;
834
      long x=fp->read_long();
834
      long x=fp->read_uint32();
835
      long y=fp->read_long();
835
      long y=fp->read_uint32();
836
      long xshift=fp->read_long();
836
      long xshift=fp->read_uint32();
837
      long yshift=fp->read_long();
837
      long yshift=fp->read_uint32();
838
      long ir=fp->read_long();
838
      long ir=fp->read_uint32();
839
      long ora=fp->read_long();
839
      long ora=fp->read_uint32();
840
      long ty=fp->read_byte();
840
      long ty=fp->read_uint8();
841
841
842
      light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
842
      light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
843
      
843
      
(-)abuse-sdl-0.7.0.orig/src/cop.cpp (-21 / +23 lines)
Lines 142-149 Link Here
142
	signed char *fire_off=o->otype==S_DFRIS_TOP ? large_fire_off :
142
	signed char *fire_off=o->otype==S_DFRIS_TOP ? large_fire_off :
143
	                                (o->otype==S_ROCKET_TOP ? large_fire_off :
143
	                                (o->otype==S_ROCKET_TOP ? large_fire_off :
144
					 (o->otype==S_BFG_TOP ? large_fire_off : small_fire_off));
144
					 (o->otype==S_BFG_TOP ? large_fire_off : small_fire_off));
145
	signed char *f=fire_off,*fb;
145
	signed char *f=fire_off,*fb=NULL;
146
	int best_diff=200,best_num;
146
	int best_diff=200,best_num=0;
147
	int iy=f[1],ix=f[6*2];
147
	int iy=f[1],ix=f[6*2];
148
	
148
	
149
	int best_angle=lisp_atan2(q->y-iy-v->pointer_y,v->pointer_x-q->x-ix);
149
	int best_angle=lisp_atan2(q->y-iy-v->pointer_y,v->pointer_x-q->x-ix);
Lines 203-209 Link Here
203
 
203
 
204
  // fire try to move up to gun level
204
  // fire try to move up to gun level
205
205
206
  long x2=o->x,y2=firey;
206
  int32_t x2=o->x,y2=firey;
207
//  current_level->foreground_intersect(other->x,other->y,x2,y2);      // find first location we can actuall "see"
207
//  current_level->foreground_intersect(other->x,other->y,x2,y2);      // find first location we can actuall "see"
208
//  current_level->all_boundary_setback(o,other->x,other->y,x2,y2);       // to make we don't fire through walls
208
//  current_level->all_boundary_setback(o,other->x,other->y,x2,y2);       // to make we don't fire through walls
209
  other->y=y2;
209
  other->y=y2;
Lines 246-252 Link Here
246
  {
246
  {
247
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
247
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
248
    {
248
    {
249
      long value=lnumber_value(eval(CAR(args)));
249
      int32_t value=lnumber_value(eval(CAR(args)));
250
      if (value)                                   // do we have ammo ?
250
      if (value)                                   // do we have ammo ?
251
      {
251
      {
252
	o->lvars[fire_delay1]=3;
252
	o->lvars[fire_delay1]=3;
Lines 288-294 Link Here
288
  {
288
  {
289
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
289
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
290
    {
290
    {
291
      long value=lnumber_value(eval(CAR(args)));
291
      int32_t value=lnumber_value(eval(CAR(args)));
292
      if (value)                                   // do we have ammo ?
292
      if (value)                                   // do we have ammo ?
293
      {
293
      {
294
	o->lvars[fire_delay1]=6;
294
	o->lvars[fire_delay1]=6;
Lines 315-321 Link Here
315
  {
315
  {
316
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
316
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
317
    {
317
    {
318
      long value=lnumber_value(eval(CAR(args)));
318
      int32_t value=lnumber_value(eval(CAR(args)));
319
      if (value)                                   // do we have ammo ?
319
      if (value)                                   // do we have ammo ?
320
      {
320
      {
321
	o->lvars[fire_delay1]=2;
321
	o->lvars[fire_delay1]=2;
Lines 339-345 Link Here
339
  {
339
  {
340
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
340
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
341
    {
341
    {
342
      long value=lnumber_value(eval(CAR(args)));
342
      int32_t value=lnumber_value(eval(CAR(args)));
343
      if (value)                                   // do we have ammo ?
343
      if (value)                                   // do we have ammo ?
344
      {
344
      {
345
	o->lvars[fire_delay1]=1;
345
	o->lvars[fire_delay1]=1;
Lines 366-372 Link Here
366
  {
366
  {
367
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
367
    if (!o->lvars[fire_delay1])                   // make sur we are not waiting of previous fire
368
    {
368
    {
369
      long value=lnumber_value(eval(CAR(args)));
369
      int32_t value=lnumber_value(eval(CAR(args)));
370
      if (value)                                   // do we have ammo ?
370
      if (value)                                   // do we have ammo ?
371
      {
371
      {
372
	o->lvars[fire_delay1]=6;
372
	o->lvars[fire_delay1]=6;
Lines 465-471 Link Here
465
      o->lvars[used_special_power]=1;
465
      o->lvars[used_special_power]=1;
466
      o->lvars[last1_x]=o->x;
466
      o->lvars[last1_x]=o->x;
467
      o->lvars[last1_y]=o->y;
467
      o->lvars[last1_y]=o->y;
468
      long oyvel=o->yvel();
468
      int32_t oyvel=o->yvel();
469
      int in=o->lvars[in_climbing_area];
469
      int in=o->lvars[in_climbing_area];
470
470
471
      player_move(o,xm,ym,but);
471
      player_move(o,xm,ym,but);
Lines 531-537 Link Here
531
531
532
/*	if (o->lvars[special_power]==FAST_POWER)
532
/*	if (o->lvars[special_power]==FAST_POWER)
533
	{
533
	{
534
	  long xv=0,yv=4;
534
	  int32_t xv=0,yv=4;
535
	  o->try_move(o->x,o->y,xv,yv,1);
535
	  o->try_move(o->x,o->y,xv,yv,1);
536
	  if (yv==4)
536
	  if (yv==4)
537
	    o->y+=3;
537
	    o->y+=3;
Lines 556-562 Link Here
556
      }
556
      }
557
      if (xm)                     // trying to get off the ladder, check to see if that's ok
557
      if (xm)                     // trying to get off the ladder, check to see if that's ok
558
      {
558
      {
559
	long x2=0,y2=-20;
559
	int32_t x2=0,y2=-20;
560
	o->try_move(o->x,o->y,x2,y2,3);
560
	o->try_move(o->x,o->y,x2,y2,3);
561
	if (y2==-20)
561
	if (y2==-20)
562
	{
562
	{
Lines 796-809 Link Here
796
    o->lvars[b_ramp]=b;
796
    o->lvars[b_ramp]=b;
797
797
798
    palette *p=pal->copy();
798
    palette *p=pal->copy();
799
    uchar *addr=(uchar *)p->addr();
799
    uint8_t *addr=(uint8_t *)p->addr();
800
    int ra,ga,ba;
800
    int ra,ga,ba;
801
    
801
    
802
    for (int i=0;i<256;i++)
802
    for (int i=0;i<256;i++)
803
    {
803
    {
804
      ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uchar)ra; addr++;
804
      ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uint8_t)ra; addr++;
805
      ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(uchar)ga; addr++;
805
      ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(uint8_t)ga; addr++;
806
      ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(uchar)ba; addr++;
806
      ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(uint8_t)ba; addr++;
807
    }
807
    }
808
    p->load();
808
    p->load();
809
    delete p;
809
    delete p;
Lines 835-840 Link Here
835
	  case run_jump : o->state=(character_state)S_fast_run_jump; break;
835
	  case run_jump : o->state=(character_state)S_fast_run_jump; break;
836
	  case run_jump_fall : o->state=(character_state)S_fast_run_jump_fall; break;
836
	  case run_jump_fall : o->state=(character_state)S_fast_run_jump_fall; break;
837
	  case end_run_jump : o->state=(character_state)S_fast_end_run_jump; break;
837
	  case end_run_jump : o->state=(character_state)S_fast_end_run_jump; break;
838
	  default: break;
838
	}
839
	}
839
840
840
	player_draw(just_fired,o->controller()->player_number);
841
	player_draw(just_fired,o->controller()->player_number);
Lines 854-859 Link Here
854
	  case run_jump : o->state=(character_state)S_fly_run_jump; break;
855
	  case run_jump : o->state=(character_state)S_fly_run_jump; break;
855
	  case run_jump_fall : o->state=(character_state)S_fly_run_jump_fall; break;
856
	  case run_jump_fall : o->state=(character_state)S_fly_run_jump_fall; break;
856
	  case end_run_jump : o->state=(character_state)S_fly_end_run_jump; break;
857
	  case end_run_jump : o->state=(character_state)S_fly_end_run_jump; break;
858
	  default: break;
857
	}
859
	}
858
860
859
	player_draw(just_fired,o->controller()->player_number);
861
	player_draw(just_fired,o->controller()->player_number);
Lines 895-907 Link Here
895
  o->lvars[sgb_lasty]=o->y;
897
  o->lvars[sgb_lasty]=o->y;
896
  o->lvars[sgb_speed]=o->lvars[sgb_speed]*6/5;
898
  o->lvars[sgb_speed]=o->lvars[sgb_speed]*6/5;
897
  
899
  
898
  long ang=o->lvars[sgb_angle];
900
  int32_t ang=o->lvars[sgb_angle];
899
  long mag=o->lvars[sgb_speed];
901
  int32_t mag=o->lvars[sgb_speed];
900
902
901
  long xvel=(lisp_cos(ang))*(mag);
903
  int32_t xvel=(lisp_cos(ang))*(mag);
902
  current_object->set_xvel(xvel>>16);
904
  current_object->set_xvel(xvel>>16);
903
  current_object->set_fxvel((xvel&0xffff)>>8);
905
  current_object->set_fxvel((xvel&0xffff)>>8);
904
  long yvel=-(lisp_sin(ang))*(mag);
906
  int32_t yvel=-(lisp_sin(ang))*(mag);
905
  current_object->set_yvel(yvel>>16);
907
  current_object->set_yvel(yvel>>16);
906
  current_object->set_fyvel((yvel&0xffff)>>8);      
908
  current_object->set_fyvel((yvel&0xffff)>>8);      
907
909
Lines 1016-1022 Link Here
1016
    for (i=0;i<tp;i++)
1018
    for (i=0;i<tp;i++)
1017
    {
1019
    {
1018
      int color=lnumber_value(lget_array_element(symbol_value(l_player_text_color),sorted_players[i]->player_number));  
1020
      int color=lnumber_value(lget_array_element(symbol_value(l_player_text_color),sorted_players[i]->player_number));  
1019
      sprintf(msg,"%3ld %s",sorted_players[i]->kills,sorted_players[i]->name);
1021
      sprintf(msg,"%3ld %s",(long)sorted_players[i]->kills,sorted_players[i]->name);
1020
      if (sorted_players[i]==local)
1022
      if (sorted_players[i]==local)
1021
        strcat(msg," <<");
1023
        strcat(msg," <<");
1022
1024
Lines 1063-1069 Link Here
1063
    char msg[100];
1065
    char msg[100];
1064
1066
1065
1067
1066
    sprintf(msg,"%-17s %3ld  %3ld",max_name,v->kills,v->tkills+v->kills);
1068
    sprintf(msg,"%-17s %3ld  %3ld",max_name,(long)v->kills,(long)(v->tkills+v->kills));
1067
    fnt->put_string(screen,x,y,msg,color);
1069
    fnt->put_string(screen,x,y,msg,color);
1068
1070
1069
    y+=fnt->height();
1071
    y+=fnt->height();
(-)abuse-sdl-0.7.0.orig/src/old.nfserver.cpp (-35 / +35 lines)
Lines 83-89 Link Here
83
83
84
int nfs_server::process_packet(packet &pk, nfs_server_client_node *c)
84
int nfs_server::process_packet(packet &pk, nfs_server_client_node *c)
85
{
85
{
86
  uchar cmd;
86
  uint8_t cmd;
87
  if (pk.read(&cmd,1)!=1) 
87
  if (pk.read(&cmd,1)!=1) 
88
  {
88
  {
89
    dprintf("Could not read command from nfs packet\n");
89
    dprintf("Could not read command from nfs packet\n");
Lines 96-120 Link Here
96
    { return 0; } break;
96
    { return 0; } break;
97
    case NFS_CRC_OPEN :
97
    case NFS_CRC_OPEN :
98
    {
98
    {
99
      uchar fn_len;
99
      uint8_t fn_len;
100
      char fn[255],newfn[255],perm[255];
100
      char fn[255],newfn[255],perm[255];
101
      ulong crc;
101
      uint32_t crc;
102
      if (pk.read((uchar *)&crc,4)!=4) return 0; crc=lltl(crc);
102
      if (pk.read((uint8_t *)&crc,4)!=4) return 0; crc=lltl(crc);
103
      if (pk.read(&fn_len,1)!=1) return 0;
103
      if (pk.read(&fn_len,1)!=1) return 0;
104
      if (pk.read((uchar *)fn,fn_len)!=fn_len) return 0;      
104
      if (pk.read((uint8_t *)fn,fn_len)!=fn_len) return 0;      
105
      if (pk.read((uchar *)&fn_len,1)!=1) return 0;
105
      if (pk.read((uint8_t *)&fn_len,1)!=1) return 0;
106
      if (pk.read((uchar *)perm,fn_len)!=fn_len) return 0;      // read permission string
106
      if (pk.read((uint8_t *)perm,fn_len)!=fn_len) return 0;      // read permission string
107
      dprintf("nfs open %s,%s\n",fn,perm);
107
      dprintf("nfs open %s,%s\n",fn,perm);
108
      packet opk;
108
      packet opk;
109
      int fail;
109
      int fail;
110
      ulong my_crc=crc_man.get_crc(crc_man.get_filenumber(fn),fail);
110
      uint32_t my_crc=crc_man.get_crc(crc_man.get_filenumber(fn),fail);
111
      if (fail)
111
      if (fail)
112
      {
112
      {
113
	jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
113
	jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
114
	if (fp->open_failure())
114
	if (fp->open_failure())
115
	{
115
	{
116
	  delete fp;
116
	  delete fp;
117
	  opk.write_long((long)-1);
117
	  opk.write_uint32((int32_t)-1);
118
	  if (!c->nd->send(opk)) return 0;
118
	  if (!c->nd->send(opk)) return 0;
119
	  return 1;
119
	  return 1;
120
	} else      
120
	} else      
Lines 127-133 Link Here
127
127
128
      if (my_crc==crc)
128
      if (my_crc==crc)
129
      {
129
      {
130
	opk.write_long((long)-2);
130
	opk.write_uint32((int32_t)-2);
131
	if (!c->nd->send(opk)) return 0;
131
	if (!c->nd->send(opk)) return 0;
132
	return 1;
132
	return 1;
133
      }
133
      }
Lines 136-171 Link Here
136
      if (fp->open_failure())
136
      if (fp->open_failure())
137
      {
137
      {
138
	delete fp;
138
	delete fp;
139
	opk.write_long((long)-1);
139
	opk.write_uint32((int32_t)-1);
140
      } else      
140
      } else      
141
	opk.write_long(c->add_file(fp));      
141
	opk.write_uint32(c->add_file(fp));      
142
      if (!c->nd->send(opk)) return 0;
142
      if (!c->nd->send(opk)) return 0;
143
      return 1;
143
      return 1;
144
    } break;
144
    } break;
145
    case NFS_OPEN :
145
    case NFS_OPEN :
146
    { 
146
    { 
147
      uchar fn_len;
147
      uint8_t fn_len;
148
      char fn[255],newfn[255],perm[255];
148
      char fn[255],newfn[255],perm[255];
149
      if (pk.read(&fn_len,1)!=1) return 0;
149
      if (pk.read(&fn_len,1)!=1) return 0;
150
      if (pk.read((uchar *)fn,fn_len)!=fn_len) return 0;      
150
      if (pk.read((uint8_t *)fn,fn_len)!=fn_len) return 0;      
151
      if (pk.read((uchar *)&fn_len,1)!=1) return 0;
151
      if (pk.read((uint8_t *)&fn_len,1)!=1) return 0;
152
      if (pk.read((uchar *)perm,fn_len)!=fn_len) return 0;      // read permission string
152
      if (pk.read((uint8_t *)perm,fn_len)!=fn_len) return 0;      // read permission string
153
      dprintf("nfs open %s,%s\n",fn,perm);
153
      dprintf("nfs open %s,%s\n",fn,perm);
154
      packet opk;
154
      packet opk;
155
      jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
155
      jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
156
      if (fp->open_failure())
156
      if (fp->open_failure())
157
      {
157
      {
158
	delete fp;
158
	delete fp;
159
	opk.write_long((long)-1);
159
	opk.write_uint32((int32_t)-1);
160
      } else      
160
      } else      
161
	opk.write_long(c->add_file(fp));      
161
	opk.write_uint32(c->add_file(fp));      
162
      if (!c->nd->send(opk)) return 0;
162
      if (!c->nd->send(opk)) return 0;
163
      return 1;
163
      return 1;
164
    } break;
164
    } break;
165
    case NFS_CLOSE :
165
    case NFS_CLOSE :
166
    {
166
    {
167
      long fd;
167
      int32_t fd;
168
      if (pk.read((uchar *)&fd,4)!=4) return 0;  fd=lltl(fd);
168
      if (pk.read((uint8_t *)&fd,4)!=4) return 0;  fd=lltl(fd);
169
      dprintf("nfs close %d\n",fd);
169
      dprintf("nfs close %d\n",fd);
170
      if (!c->delete_file(fd)) 
170
      if (!c->delete_file(fd)) 
171
      {
171
      {
Lines 176-187 Link Here
176
    } break;
176
    } break;
177
    case NFS_READ :
177
    case NFS_READ :
178
    {
178
    {
179
      long fd,size;
179
      int32_t fd,size;
180
      if (pk.read((uchar *)&fd,4)!=4) return 0;    fd=lltl(fd);
180
      if (pk.read((uint8_t *)&fd,4)!=4) return 0;    fd=lltl(fd);
181
      if (pk.read((uchar *)&size,4)!=4) return 0;  size=lltl(size);
181
      if (pk.read((uint8_t *)&size,4)!=4) return 0;  size=lltl(size);
182
      dprintf("nfs read %d,%d\n",fd,size);
182
      dprintf("nfs read %d,%d\n",fd,size);
183
      bFILE *fp=c->get_file(fd);
183
      bFILE *fp=c->get_file(fd);
184
      uchar buf[NFSFILE_BUFFER_SIZE];
184
      uint8_t buf[NFSFILE_BUFFER_SIZE];
185
      packet opk;
185
      packet opk;
186
      if (!fp) return 0;
186
      if (!fp) return 0;
187
      int total;
187
      int total;
Lines 190-196 Link Here
190
	opk.reset();
190
	opk.reset();
191
	int to_read=NFSFILE_BUFFER_SIZE < size ? NFSFILE_BUFFER_SIZE : size;
191
	int to_read=NFSFILE_BUFFER_SIZE < size ? NFSFILE_BUFFER_SIZE : size;
192
	total=fp->read(buf,to_read);
192
	total=fp->read(buf,to_read);
193
	opk.write_short(total);
193
	opk.write_uint16(total);
194
	opk.write(buf,total);
194
	opk.write(buf,total);
195
	printf("sending %d bytes\n",total);
195
	printf("sending %d bytes\n",total);
196
	if (!c->nd->send(opk)) 
196
	if (!c->nd->send(opk)) 
Lines 210-219 Link Here
210
    } break;
210
    } break;
211
    case NFS_SEEK :
211
    case NFS_SEEK :
212
    {
212
    {
213
      long fd,off,type;
213
      int32_t fd,off,type;
214
      if (pk.read((uchar *)&fd,4)!=4) return 0;   fd=lltl(fd);
214
      if (pk.read((uint8_t *)&fd,4)!=4) return 0;   fd=lltl(fd);
215
      if (pk.read((uchar *)&off,4)!=4) return 0;  off=lltl(off);    
215
      if (pk.read((uint8_t *)&off,4)!=4) return 0;  off=lltl(off);    
216
      if (pk.read((uchar *)&type,4)!=4) return 0; type=lltl(type);
216
      if (pk.read((uint8_t *)&type,4)!=4) return 0; type=lltl(type);
217
      dprintf("seek %d %d %d\n",fd,off,type);
217
      dprintf("seek %d %d %d\n",fd,off,type);
218
      bFILE *fp=c->get_file(fd);
218
      bFILE *fp=c->get_file(fd);
219
      if (!fp) { dprintf("bad fd for seek\n"); return 0; }
219
      if (!fp) { dprintf("bad fd for seek\n"); return 0; }
Lines 222-244 Link Here
222
    } break;
222
    } break;
223
    case NFS_FILESIZE :
223
    case NFS_FILESIZE :
224
    {
224
    {
225
      long fd,off,type;
225
      int32_t fd,off,type;
226
      if (pk.read((uchar *)&fd,4)!=4) return 0;   fd=lltl(fd);
226
      if (pk.read((uint8_t *)&fd,4)!=4) return 0;   fd=lltl(fd);
227
      bFILE *fp=c->get_file(fd);
227
      bFILE *fp=c->get_file(fd);
228
      if (!fp) return 0;      
228
      if (!fp) return 0;      
229
      packet opk;
229
      packet opk;
230
      opk.write_long(fp->file_size());
230
      opk.write_uint32(fp->file_size());
231
      if (!c->nd->send(opk)) return 0;
231
      if (!c->nd->send(opk)) return 0;
232
      return 1;
232
      return 1;
233
    } break;
233
    } break;
234
    case NFS_TELL :
234
    case NFS_TELL :
235
    {
235
    {
236
      long fd,off,type;
236
      int32_t fd,off,type;
237
      if (pk.read((uchar *)&fd,4)!=4) return 0;   fd=lltl(fd);
237
      if (pk.read((uint8_t *)&fd,4)!=4) return 0;   fd=lltl(fd);
238
      bFILE *fp=c->get_file(fd);
238
      bFILE *fp=c->get_file(fd);
239
      if (!fp) return 0;      
239
      if (!fp) return 0;      
240
      packet opk;
240
      packet opk;
241
      opk.write_long(fp->tell());
241
      opk.write_uint32(fp->tell());
242
      if (!c->nd->send(opk)) return 0;
242
      if (!c->nd->send(opk)) return 0;
243
      return 1;
243
      return 1;
244
    } break;
244
    } break;
(-)abuse-sdl-0.7.0.orig/src/version.cpp (-3 / +3 lines)
Lines 3-10 Link Here
3
#include "macs.hpp"
3
#include "macs.hpp"
4
#include <string.h>
4
#include <string.h>
5
5
6
uchar major_version=2;
6
uint8_t major_version=2;
7
uchar minor_version=00;
7
uint8_t minor_version=00;
8
8
9
extern int get_option(char *name);
9
extern int get_option(char *name);
10
10
Lines 28-34 Link Here
28
  dprintf(msg2);
28
  dprintf(msg2);
29
29
30
  for (i=0;i<80;i++)
30
  for (i=0;i<80;i++)
31
    *((unsigned char *)(0xb8000+i*2+1))=0x17;
31
    *((uint8_t *)(0xb8000+i*2+1))=0x17;
32
}
32
}
33
#else
33
#else
34
static void setup()
34
static void setup()
(-)abuse-sdl-0.7.0.orig/src/server2.cpp (-5 / +5 lines)
Lines 129-139 Link Here
129
/*  client_descriptor *last=NULL;
129
/*  client_descriptor *last=NULL;
130
  if (sync_check)
130
  if (sync_check)
131
  {
131
  {
132
    next_out.write_byte(SCMD_SYNC);
132
    next_out.write_uint8(SCMD_SYNC);
133
    next_out.write_long(make_sync_long());
133
    next_out.write_uint32(make_sync_uint32());
134
  }
134
  }
135
    
135
    
136
  next_out.write_byte(SCMD_END_OF_PACKET);        // so clients knows when to stop reading
136
  next_out.write_uint8(SCMD_END_OF_PACKET);        // so clients knows when to stop reading
137
137
138
  for (client_descriptor *p=client_list;p;)
138
  for (client_descriptor *p=client_list;p;)
139
  {
139
  {
Lines 210-223 Link Here
210
  {
210
  {
211
    packet pk;
211
    packet pk;
212
    current_level->save("netstart.spe",1);
212
    current_level->save("netstart.spe",1);
213
    printf("%d sync for save\n",make_sync_long());
213
    printf("%d sync for save\n",make_sync_uint32());
214
214
215
    client_descriptor *last=NULL;
215
    client_descriptor *last=NULL;
216
    for (p=client_list;p;p=p->next)
216
    for (p=client_list;p;p=p->next)
217
    {
217
    {
218
      if (p->player)
218
      if (p->player)
219
      {
219
      {
220
	pk.write_byte(SCMD_JOIN_START);
220
	pk.write_uint8(SCMD_JOIN_START);
221
	int error=!p->connection->send(pk);
221
	int error=!p->connection->send(pk);
222
	if (!error)
222
	if (!error)
223
	{
223
	{
(-)abuse-sdl-0.7.0.orig/src/particle.cpp (-8 / +8 lines)
Lines 104-123 Link Here
104
104
105
part_frame::part_frame(bFILE *fp)
105
part_frame::part_frame(bFILE *fp)
106
{
106
{
107
  t=fp->read_long();
107
  t=fp->read_uint32();
108
  data=(part *)jmalloc(sizeof(part)*t,"particle frame");
108
  data=(part *)jmalloc(sizeof(part)*t,"particle frame");
109
  x1=y1=100000; x2=y2=-100000;
109
  x1=y1=100000; x2=y2=-100000;
110
  for (int i=0;i<t;i++)
110
  for (int i=0;i<t;i++)
111
  {
111
  {
112
    short x=fp->read_short();
112
    int16_t x=fp->read_uint16();
113
    short y=fp->read_short();
113
    int16_t y=fp->read_uint16();
114
    if (x<x1) x1=x;
114
    if (x<x1) x1=x;
115
    if (y<y1) y1=y;
115
    if (y<y1) y1=y;
116
    if (x>x2) x2=x;
116
    if (x>x2) x2=x;
117
    if (y>y2) y2=x;
117
    if (y>y2) y2=x;
118
    data[i].x=x;
118
    data[i].x=x;
119
    data[i].y=y;   
119
    data[i].y=y;   
120
    data[i].color=fp->read_byte(); 
120
    data[i].color=fp->read_uint8(); 
121
  }
121
  }
122
}
122
}
123
123
Lines 155-161 Link Here
155
155
156
void part_frame::draw(image *screen, int x, int y, int dir)
156
void part_frame::draw(image *screen, int x, int y, int dir)
157
{
157
{
158
  short cx1,cy1,cx2,cy2;
158
  int16_t cx1,cy1,cx2,cy2;
159
  screen->get_clip(cx1,cy1,cx2,cy2);
159
  screen->get_clip(cx1,cy1,cx2,cy2);
160
  if (x+x1>cx2 || x+x2<cx1 || y+y1>cy2 || y+y2<cy1) return ;
160
  if (x+x1>cx2 || x+x2<cx1 || y+y1>cy2 || y+y2<cy1) return ;
161
161
Lines 195-201 Link Here
195
195
196
void scatter_line(int x1, int y1, int x2, int y2, int c, int s)
196
void scatter_line(int x1, int y1, int x2, int y2, int c, int s)
197
{
197
{
198
	short cx1, cy1, cx2, cy2;
198
	int16_t cx1, cy1, cx2, cy2;
199
	screen->get_clip( cx1, cy1, cx2, cy2 );
199
	screen->get_clip( cx1, cy1, cx2, cy2 );
200
200
201
	int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
201
	int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
Lines 222-228 Link Here
222
222
223
void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s)
223
void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s)
224
{
224
{
225
	short cx1, cy1, cx2, cy2;
225
	int16_t cx1, cy1, cx2, cy2;
226
	screen->get_clip( cx1, cy1, cx2, cy2 );
226
	screen->get_clip( cx1, cy1, cx2, cy2 );
227
227
228
	int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
228
	int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
Lines 233-239 Link Here
233
	s = ( 15 - s );
233
	s = ( 15 - s );
234
234
235
	int w = screen->width();
235
	int w = screen->width();
236
	uchar *addr;
236
	uint8_t *addr;
237
237
238
	while( t-- )
238
	while( t-- )
239
	{
239
	{
(-)abuse-sdl-0.7.0.orig/src/innet.cpp (-9 / +11 lines)
Lines 209-215 Link Here
209
    net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
209
    net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
210
210
211
    if (!sock) { printf("set_file_server::connect failed\n"); return 0; }
211
    if (!sock) { printf("set_file_server::connect failed\n"); return 0; }
212
    uchar cmd=CLIENT_CRC_WAITER;
212
    uint8_t cmd=CLIENT_CRC_WAITER;
213
    if ( (sock->write(&cmd,1)!=1 && printf("set_file_server::writefailed\n")) ||
213
    if ( (sock->write(&cmd,1)!=1 && printf("set_file_server::writefailed\n")) ||
214
	 (sock->read(&cmd,1)!=1  && printf("set_file_server::read failed\n")))        // wait for confirmation that crc's are written
214
	 (sock->read(&cmd,1)!=1  && printf("set_file_server::read failed\n")))        // wait for confirmation that crc's are written
215
    { delete sock; return 0; }
215
    { delete sock; return 0; }
Lines 290-296 Link Here
290
				net_socket *new_sock=comm_sock->accept(addr);	
290
				net_socket *new_sock=comm_sock->accept(addr);	
291
				if (new_sock)
291
				if (new_sock)
292
				{
292
				{
293
				  uchar client_type;
293
				  uint8_t client_type;
294
				  if (new_sock->read(&client_type,1)!=1)
294
				  if (new_sock->read(&client_type,1)!=1)
295
				  {
295
				  {
296
				    delete addr;	
296
				    delete addr;	
Lines 315-321 Link Here
315
				      } break;
315
				      } break;
316
				      case CLIENT_LSF_WAITER :          // wants to know which .lsp file to start with
316
				      case CLIENT_LSF_WAITER :          // wants to know which .lsp file to start with
317
				      {
317
				      {
318
								uchar len=strlen(lsf);
318
								uint8_t len=strlen(lsf);
319
								new_sock->write(&len,1);
319
								new_sock->write(&len,1);
320
								new_sock->write(lsf,len);
320
								new_sock->write(lsf,len);
321
								delete new_sock;
321
								delete new_sock;
Lines 351-358 Link Here
351
    net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
351
    net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
352
    if (!sock) return 0;
352
    if (!sock) return 0;
353
353
354
    uchar ctype=CLIENT_LSF_WAITER;
354
    uint8_t ctype=CLIENT_LSF_WAITER;
355
    uchar len;
355
    uint8_t len;
356
356
357
    if (sock->write(&ctype,1)!=1 ||
357
    if (sock->write(&ctype,1)!=1 ||
358
				sock->read(&len,1)!=1 || len==0 ||
358
				sock->read(&len,1)!=1 || len==0 ||
Lines 390-399 Link Here
390
      return 0;
390
      return 0;
391
    }
391
    }
392
392
393
    uchar ctype=CLIENT_ABUSE;
393
    uint8_t ctype=CLIENT_ABUSE;
394
    ushort port=lstl(main_net_cfg->port+1),cnum;
394
    uint16_t port=lstl(main_net_cfg->port+1),cnum;
395
395
396
    uchar reg;
396
    uint8_t reg;
397
    if (sock->write(&ctype,1)!=1 ||   // send server out game port
397
    if (sock->write(&ctype,1)!=1 ||   // send server out game port
398
				sock->read(&reg,1)!=1)        // is remote engine registered?
398
				sock->read(&reg,1)!=1)        // is remote engine registered?
399
    { delete sock; return 0; }
399
    { delete sock; return 0; }
Lines 426-432 Link Here
426
    if (get_login())
426
    if (get_login())
427
      strcpy(uname,get_login());
427
      strcpy(uname,get_login());
428
    else strcpy(uname,"unknown");
428
    else strcpy(uname,"unknown");
429
    uchar len=strlen(uname)+1;
429
    uint8_t len=strlen(uname)+1;
430
    short nkills;
430
    short nkills;
431
431
432
    if (sock->write(&len,1)!=1 ||
432
    if (sock->write(&len,1)!=1 ||
Lines 489-494 Link Here
489
489
490
      spec_directory sd(fp);  
490
      spec_directory sd(fp);  
491
491
492
#if 0
492
      spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
493
      spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved"); 
493
      if (!e)
494
      if (!e)
494
      { 
495
      { 
Lines 497-502 Link Here
497
				the_game->need_refresh();
498
				the_game->need_refresh();
498
      }
499
      }
499
      else 
500
      else 
501
#endif
500
        current_level=new level(&sd,fp,NET_STARTFILE);
502
        current_level=new level(&sd,fp,NET_STARTFILE);
501
503
502
      delete fp;     
504
      delete fp;     
(-)abuse-sdl-0.7.0.orig/src/lcache.cpp (-15 / +15 lines)
Lines 47-71 Link Here
47
void write_level(bFILE *fp, Cell *level)
47
void write_level(bFILE *fp, Cell *level)
48
{
48
{
49
  int type=item_type(level);
49
  int type=item_type(level);
50
  fp->write_byte(type);
50
  fp->write_uint8(type);
51
51
52
52
53
  switch (type)
53
  switch (type)
54
  {
54
  {
55
    case L_NUMBER :
55
    case L_NUMBER :
56
    { fp->write_long(lnumber_value(level)); } break;
56
    { fp->write_uint32(lnumber_value(level)); } break;
57
    case L_CHARACTER :
57
    case L_CHARACTER :
58
    { fp->write_short(lcharacter_value(level)); } break;
58
    { fp->write_uint16(lcharacter_value(level)); } break;
59
    case L_STRING :
59
    case L_STRING :
60
    { long l=strlen(lstring_value(level))+1;
60
    { long l=strlen(lstring_value(level))+1;
61
      fp->write_long(l);
61
      fp->write_uint32(l);
62
      fp->write(lstring_value(level),l); 
62
      fp->write(lstring_value(level),l); 
63
    } break;
63
    } break;
64
    case L_SYMBOL :
64
    case L_SYMBOL :
65
    { fp->write_long((long)level); } break;
65
    { fp->write_uint32((long)level); } break;
66
    case L_CONS_CELL :
66
    case L_CONS_CELL :
67
    {
67
    {
68
      if (!level) fp->write_long(0);
68
      if (!level) fp->write_uint32(0);
69
      else
69
      else
70
      {
70
      {
71
	long t=0;
71
	long t=0;
Lines 73-82 Link Here
73
	for (;b && item_type(b)==L_CONS_CELL;b=CDR(b)) t++;
73
	for (;b && item_type(b)==L_CONS_CELL;b=CDR(b)) t++;
74
	if (b) 
74
	if (b) 
75
	{
75
	{
76
	  fp->write_long(-t);      // negative number means dotted list
76
	  fp->write_uint32(-t);      // negative number means dotted list
77
	  write_level(fp,b);       // save end of dotted list     
77
	  write_level(fp,b);       // save end of dotted list     
78
	}
78
	}
79
	else fp->write_long(t);
79
	else fp->write_uint32(t);
80
80
81
	for (b=level;b && item_type(b)==L_CONS_CELL;b=CDR(b))    
81
	for (b=level;b && item_type(b)==L_CONS_CELL;b=CDR(b))    
82
	  write_level(fp,CAR(b));
82
	  write_level(fp,CAR(b));
Lines 87-115 Link Here
87
87
88
Cell *load_block(bFILE *fp)
88
Cell *load_block(bFILE *fp)
89
{
89
{
90
  int type=fp->read_byte();
90
  int type=fp->read_uint8();
91
  switch (type)
91
  switch (type)
92
  {   
92
  {   
93
    case L_NUMBER :
93
    case L_NUMBER :
94
    { return new_lisp_number(fp->read_long()); } break;
94
    { return new_lisp_number(fp->read_uint32()); } break;
95
    case L_CHARACTER :
95
    case L_CHARACTER :
96
    { return new_lisp_character(fp->read_short()); } break;
96
    { return new_lisp_character(fp->read_uint16()); } break;
97
    case L_STRING :
97
    case L_STRING :
98
    { long l=fp->read_long();
98
    { long l=fp->read_uint32();
99
      lisp_string *s=new_lisp_string(l);
99
      lisp_string *s=new_lisp_string(l);
100
      fp->read(lstring_value(s),l);
100
      fp->read(lstring_value(s),l);
101
      return s;
101
      return s;
102
    } break;
102
    } break;
103
    case L_SYMBOL :
103
    case L_SYMBOL :
104
    { return (void *)fp->read_long(); } break;
104
    { return (void *)fp->read_uint32(); } break;
105
    case L_CONS_CELL :
105
    case L_CONS_CELL :
106
    {
106
    {
107
      long t=fp->read_long();
107
      long t=fp->read_uint32();
108
      if (!t) return NULL;
108
      if (!t) return NULL;
109
      else
109
      else
110
      {
110
      {
111
	long x=abs(t);
111
	long x=abs(t);
112
	cons_cell *last,*first=NULL;
112
	cons_cell *last=NULL,*first=NULL;
113
	while (x)
113
	while (x)
114
	{
114
	{
115
	  cons_cell *c=new_cons_cell();
115
	  cons_cell *c=new_cons_cell();
(-)abuse-sdl-0.7.0.orig/src/items.cpp (-13 / +13 lines)
Lines 17-26 Link Here
17
      exit(0);      
17
      exit(0);      
18
    }
18
    }
19
19
20
    inside=(unsigned char *)jmalloc(tot,"Boundary point list");  
20
    inside=(uint8_t *)jmalloc(tot,"Boundary point list");  
21
  }
21
  }
22
22
23
  unsigned char *point_on;
23
  uint8_t *point_on;
24
  
24
  
25
  for (i=0,point_on=data;i<tot-1;i++)
25
  for (i=0,point_on=data;i<tot-1;i++)
26
  {
26
  {
Lines 33-39 Link Here
33
    checky=(y1+y2)/2;
33
    checky=(y1+y2)/2;
34
34
35
    int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;    
35
    int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;    
36
    unsigned char *point2,segs_left=0,segs_right=0,segs_down=0;    
36
    uint8_t *point2,segs_left=0,segs_right=0,segs_down=0;    
37
    int skip_next=0;    
37
    int skip_next=0;    
38
    int check_left=0,check_right=0,check_down=0;
38
    int check_left=0,check_right=0,check_down=0;
39
39
Lines 100-109 Link Here
100
boundary::boundary(boundary *p) : point_list(p->tot,p->data)
100
boundary::boundary(boundary *p) : point_list(p->tot,p->data)
101
{
101
{
102
  int x1,y1,x2,y2,checkx,checky,i;  
102
  int x1,y1,x2,y2,checkx,checky,i;  
103
  unsigned char *point_on;  
103
  uint8_t *point_on;  
104
  if (tot)
104
  if (tot)
105
  {
105
  {
106
    inside=(unsigned char *)jmalloc(tot,"Boundary point list");  
106
    inside=(uint8_t *)jmalloc(tot,"Boundary point list");  
107
  } else inside=NULL;
107
  } else inside=NULL;
108
  for (i=0,point_on=data;i<tot-1;i++)
108
  for (i=0,point_on=data;i<tot-1;i++)
109
  {
109
  {
Lines 116-122 Link Here
116
    checky=(y1+y2)/2;
116
    checky=(y1+y2)/2;
117
117
118
    int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;    
118
    int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;    
119
    unsigned char *point2,segs_left=0,segs_right=0,segs_down=0;    
119
    uint8_t *point2,segs_left=0,segs_right=0,segs_down=0;    
120
    int skip_next=0;    
120
    int skip_next=0;    
121
    int check_left=0,check_right=0,check_down=0;
121
    int check_left=0,check_right=0,check_down=0;
122
122
Lines 185-208 Link Here
185
backtile::backtile(bFILE *fp)
185
backtile::backtile(bFILE *fp)
186
{
186
{
187
  im=load_image(fp);
187
  im=load_image(fp);
188
  next=fp->read_short();
188
  next=fp->read_uint16();
189
}
189
}
190
190
191
backtile::backtile(spec_entry *e, bFILE *fp)
191
backtile::backtile(spec_entry *e, bFILE *fp)
192
{
192
{
193
  im=load_image(e,fp);
193
  im=load_image(e,fp);
194
  next=fp->read_short();
194
  next=fp->read_uint16();
195
}
195
}
196
196
197
foretile::foretile(bFILE *fp)
197
foretile::foretile(bFILE *fp)
198
{
198
{
199
  unsigned char *sl; 
199
  uint8_t *sl; 
200
  image *img=load_image(fp);
200
  image *img=load_image(fp);
201
201
202
202
203
  // create the micro image of the fore tile by aveginging the color values in 2 x 2 space
203
  // create the micro image of the fore tile by aveginging the color values in 2 x 2 space
204
  // and storeing teh closest match
204
  // and storeing teh closest match
205
//  unsigned char *buffer=(unsigned char *)&micro_image;
205
//  uint8_t *buffer=(uint8_t *)&micro_image;
206
  int x,y,w=img->width(),h=img->height(),l;
206
  int x,y,w=img->width(),h=img->height(),l;
207
  int r[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
207
  int r[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
208
      g[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
208
      g[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
Lines 249-255 Link Here
249
  im=new trans_image(img,"foretile");
249
  im=new trans_image(img,"foretile");
250
  delete img; 
250
  delete img; 
251
251
252
  next=fp->read_short();
252
  next=fp->read_uint16();
253
  fp->read(&damage,1);
253
  fp->read(&damage,1);
254
254
255
255
Lines 284-290 Link Here
284
  {
284
  {
285
    point_list p(fp); 
285
    point_list p(fp); 
286
    advance=0;
286
    advance=0;
287
  } else advance=fp->read_byte();
287
  } else advance=fp->read_uint8();
288
  
288
  
289
  f_damage=new boundary(fp,"fig bound"); 
289
  f_damage=new boundary(fp,"fig bound"); 
290
  b_damage=new boundary(f_damage);
290
  b_damage=new boundary(f_damage);
Lines 295-301 Link Here
295
char_tint::char_tint(bFILE *fp)  // se should be a palette entry
295
char_tint::char_tint(bFILE *fp)  // se should be a palette entry
296
{
296
{
297
  palette *p=new palette(fp);
297
  palette *p=new palette(fp);
298
  uchar *t=data,*p_addr=(uchar *)p->addr();
298
  uint8_t *t=data,*p_addr=(uint8_t *)p->addr();
299
  for (int i=0;i<256;i++,t++,p_addr+=3)  
299
  for (int i=0;i<256;i++,t++,p_addr+=3)  
300
    *t=pal->find_closest(*p_addr,p_addr[1],p_addr[2]);
300
    *t=pal->find_closest(*p_addr,p_addr[1],p_addr[2]);
301
   
301
   
(-)abuse-sdl-0.7.0.orig/src/demo.cpp (-13 / +17 lines)
Lines 61-77 Link Here
61
61
62
  the_game->load_level(name);
62
  the_game->load_level(name);
63
  record_file->write((void *)"DEMO,VERSION:2",14);
63
  record_file->write((void *)"DEMO,VERSION:2",14);
64
  record_file->write_byte(strlen(name)+1);
64
  record_file->write_uint8(strlen(name)+1);
65
  record_file->write(name,strlen(name)+1);
65
  record_file->write(name,strlen(name)+1);
66
  
66
  
67
  
67
  
68
  if (DEFINEDP(symbol_value(l_difficulty)))
68
  if (DEFINEDP(symbol_value(l_difficulty)))
69
  {
69
  {
70
    if (symbol_value(l_difficulty)==l_easy) record_file->write_byte(0);
70
    if (symbol_value(l_difficulty)==l_easy) record_file->write_uint8(0);
71
    else if (symbol_value(l_difficulty)==l_medium) record_file->write_byte(1);
71
    else if (symbol_value(l_difficulty)==l_medium) record_file->write_uint8(1);
72
    else if (symbol_value(l_difficulty)==l_hard) record_file->write_byte(2);
72
    else if (symbol_value(l_difficulty)==l_hard) record_file->write_uint8(2);
73
    else record_file->write_byte(3);
73
    else record_file->write_uint8(3);
74
  } else record_file->write_byte(3);
74
  } else record_file->write_uint8(3);
75
  
75
  
76
76
77
  state=RECORDING;
77
  state=RECORDING;
Lines 93-112 Link Here
93
        if (p->local_player())
93
        if (p->local_player())
94
          p->get_input();
94
          p->get_input();
95
95
96
      base->packet.write_byte(SCMD_SYNC);
96
      base->packet.write_uint8(SCMD_SYNC);
97
      base->packet.write_short(make_sync());
97
      base->packet.write_uint16(make_sync());
98
      demo_man.save_packet(base->packet.packet_data(),base->packet.packet_size());
98
      demo_man.save_packet(base->packet.packet_data(),base->packet.packet_size());
99
      process_packet_commands(base->packet.packet_data(),base->packet.packet_size());
99
      process_packet_commands(base->packet.packet_data(),base->packet.packet_size());
100
100
101
    } break;
101
    } break;
102
    case PLAYING :
102
    case PLAYING :
103
    {
103
    {
104
      uchar buf[1500];
104
      uint8_t buf[1500];
105
      int size;
105
      int size;
106
      if (get_packet(buf,size))              // get starting inputs
106
      if (get_packet(buf,size))              // get starting inputs
107
      {
107
      {
108
        process_packet_commands(buf,size);      
108
        process_packet_commands(buf,size);      
109
	long mx,my;
109
	int32_t mx,my;
110
	the_game->game_to_mouse(player_list->pointer_x,player_list->pointer_y,player_list,mx,my);
110
	the_game->game_to_mouse(player_list->pointer_x,player_list->pointer_y,player_list,mx,my);
111
	eh->set_mouse_position(small_render ? mx*2 : mx, small_render ? my*2 : my);
111
	eh->set_mouse_position(small_render ? mx*2 : mx, small_render ? my*2 : my);
112
      }
112
      }
Lines 116-121 Link Here
116
	return ;
116
	return ;
117
      }
117
      }
118
    } break;
118
    } break;
119
    default :
120
      break;
119
  }
121
  }
120
}
122
}
121
123
Lines 135-141 Link Here
135
137
136
int demo_manager::start_playing(char *filename)
138
int demo_manager::start_playing(char *filename)
137
{
139
{
138
  uchar sig[15];
140
  uint8_t sig[15];
139
  record_file=open_file(filename,"rb");
141
  record_file=open_file(filename,"rb");
140
  if (record_file->open_failure()) { delete record_file; return 0; }  
142
  if (record_file->open_failure()) { delete record_file; return 0; }  
141
  char name[100],nsize,diff;
143
  char name[100],nsize,diff;
Lines 208-213 Link Here
208
210
209
211
210
    } break;
212
    } break;
213
    default :
214
      break;
211
  }
215
  }
212
216
213
  switch (new_state)
217
  switch (new_state)
Lines 227-233 Link Here
227
{
231
{
228
  if (state==RECORDING)
232
  if (state==RECORDING)
229
  {
233
  {
230
    ushort ps=lstl(packet_size);
234
    uint16_t ps=lstl(packet_size);
231
    if (record_file->write(&ps,2)!=2 ||
235
    if (record_file->write(&ps,2)!=2 ||
232
	record_file->write(packet,packet_size)!=packet_size)
236
	record_file->write(packet,packet_size)!=packet_size)
233
    {
237
    {
Lines 242-248 Link Here
242
{
246
{
243
  if (state==PLAYING)
247
  if (state==PLAYING)
244
  {
248
  {
245
    ushort ps;
249
    uint16_t ps;
246
    if (record_file->read(&ps,2)!=2)
250
    if (record_file->read(&ps,2)!=2)
247
    {
251
    {
248
      set_state(NORMAL);
252
      set_state(NORMAL);
(-)abuse-sdl-0.7.0.orig/src/loader2.cpp (-3 / +9 lines)
Lines 32-38 Link Here
32
int nforetiles,nbacktiles,f_wid,f_hi,b_wid,b_hi,total_songs=0,sfx_volume,music_volume,sound_avail=0;
32
int nforetiles,nbacktiles,f_wid,f_hi,b_wid,b_hi,total_songs=0,sfx_volume,music_volume,sound_avail=0;
33
song *current_song=NULL;
33
song *current_song=NULL;
34
34
35
ushort current_start_type,start_position_type,last_start_number;
35
uint16_t current_start_type,start_position_type,last_start_number;
36
int light_buttons[13];
36
int light_buttons[13];
37
int joy_picts[2*9];
37
int joy_picts[2*9];
38
palette *pal;
38
palette *pal;
Lines 283-291 Link Here
283
283
284
	int should_save_sd_cache = 0;
284
	int should_save_sd_cache = 0;
285
285
286
# if 0
286
	char *cachepath;
287
	char *cachepath;
287
	cachepath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12, "cachepath" );
288
	cachepath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12 + 1, "cachepath" );
288
	sprintf( cachepath, "%ssd_cache.tmp\0", get_save_filename_prefix() );
289
	sprintf( cachepath, "%ssd_cache.tmp", get_save_filename_prefix() );
289
290
290
	bFILE *load = open_file( cachepath, "rb" );
291
	bFILE *load = open_file( cachepath, "rb" );
291
	if( !load->open_failure() )
292
	if( !load->open_failure() )
Lines 297-302 Link Here
297
		should_save_sd_cache = 1;
298
		should_save_sd_cache = 1;
298
	}
299
	}
299
	delete load;
300
	delete load;
301
#endif
300
302
301
  if (!net_start())              // don't let them specify a startup file we are connect elsewhere
303
  if (!net_start())              // don't let them specify a startup file we are connect elsewhere
302
  {
304
  {
Lines 443-448 Link Here
443
  b_wid=cash.backt(backtiles[0])->im->width();
445
  b_wid=cash.backt(backtiles[0])->im->width();
444
  b_hi=cash.backt(backtiles[0])->im->height();
446
  b_hi=cash.backt(backtiles[0])->im->height();
445
447
448
#if 0
446
	if( should_save_sd_cache )
449
	if( should_save_sd_cache )
447
	{
450
	{
448
		bFILE *save = open_file( cachepath, "wb" );
451
		bFILE *save = open_file( cachepath, "wb" );
Lines 452-461 Link Here
452
		}
455
		}
453
		delete save;
456
		delete save;
454
	}
457
	}
458
#endif
455
459
456
	sd_cache.clear();
460
	sd_cache.clear();
457
	past_startup = 1;
461
	past_startup = 1;
462
#if 0
458
	jfree( cachepath );
463
	jfree( cachepath );
464
#endif
459
}
465
}
460
466
461
467
(-)abuse-sdl-0.7.0.orig/src/objects.cpp (-91 / +91 lines)
Lines 45-87 Link Here
45
45
46
46
47
obj_desc object_descriptions[TOTAL_OBJECT_VARS]={
47
obj_desc object_descriptions[TOTAL_OBJECT_VARS]={
48
				{"fade_dir",      RC_C },
48
				{"fade_dir",      RC_8 },
49
				{"frame_dir",     RC_C },
49
				{"frame_dir",     RC_8 },
50
				{"direction",     RC_C },
50
				{"direction",     RC_8 },
51
				{"gravity_on",    RC_C },
51
				{"gravity_on",    RC_8 },
52
				{"fade_count",    RC_C },
52
				{"fade_count",    RC_8 },
53
53
54
				{"fade_max",      RC_C },
54
				{"fade_max",      RC_8 },
55
				{"active",        RC_C },
55
				{"active",        RC_8 },
56
				{"flags",         RC_C },
56
				{"flags",         RC_8 },
57
				{"aitype",        RC_C },
57
				{"aitype",        RC_8 },
58
				{"xvel",          RC_L },
58
				{"xvel",          RC_32 },
59
59
60
				{"fxvel",         RC_C },
60
				{"fxvel",         RC_8 },
61
				{"yvel",          RC_L },
61
				{"yvel",          RC_32 },
62
				{"fyvel",         RC_C },
62
				{"fyvel",         RC_8 },
63
				{"xacel",         RC_L },
63
				{"xacel",         RC_32 },
64
				{"fxacel",        RC_C },
64
				{"fxacel",        RC_8 },
65
65
66
				{"yacel",         RC_L },
66
				{"yacel",         RC_32 },
67
				{"fyacel",        RC_C },
67
				{"fyacel",        RC_8 },
68
				{"x",             RC_L },
68
				{"x",             RC_32 },
69
				{"fx",            RC_C },
69
				{"fx",            RC_8 },
70
				{"y",             RC_L },
70
				{"y",             RC_32 },
71
71
72
				{"fy",            RC_C },
72
				{"fy",            RC_8 },
73
				{"hp",            RC_S },
73
				{"hp",            RC_16 },
74
				{"mp",            RC_S },
74
				{"mp",            RC_16 },
75
				{"fmp",           RC_S },
75
				{"fmp",           RC_16 },
76
				{"cur_frame",     RC_S },
76
				{"cur_frame",     RC_16 },
77
77
78
				{"aistate",       RC_S },
78
				{"aistate",       RC_16 },
79
				{"aistate_time",  RC_S },
79
				{"aistate_time",  RC_16 },
80
				{"targetable",    RC_C }
80
				{"targetable",    RC_8 }
81
81
82
			      };
82
			      };
83
  
83
  
84
long game_object::get_var_by_name(char *name, int &error)
84
int32_t game_object::get_var_by_name(char *name, int &error)
85
{
85
{
86
  error=0;
86
  error=0;
87
  int i=0;
87
  int i=0;
Lines 111-117 Link Here
111
  return 0;
111
  return 0;
112
}
112
}
113
113
114
int game_object::set_var_by_name(char *name, long value)
114
int game_object::set_var_by_name(char *name, int32_t value)
115
{
115
{
116
  int i=0;
116
  int i=0;
117
  for (;i<TOTAL_OBJECT_VARS;i++)
117
  for (;i<TOTAL_OBJECT_VARS;i++)
Lines 143-149 Link Here
143
}
143
}
144
144
145
145
146
void simple_object::set_var(int xx, ulong v)
146
void simple_object::set_var(int xx, uint32_t v)
147
{
147
{
148
  switch (xx)
148
  switch (xx)
149
  {
149
  {
Lines 183-189 Link Here
183
  }
183
  }
184
}
184
}
185
185
186
long simple_object::get_var(int xx)
186
int32_t simple_object::get_var(int xx)
187
{
187
{
188
  switch (xx)
188
  switch (xx)
189
  {
189
  {
Lines 233-243 Link Here
233
{
233
{
234
  switch (type)
234
  switch (type)
235
  {
235
  {
236
    case RC_C : 
236
    case RC_8 : 
237
    { return 1; } break;
237
    { return 1; } break;
238
    case RC_S : 
238
    case RC_16 : 
239
    { return 2; } break;
239
    { return 2; } break;
240
    case RC_L : 
240
    case RC_32 : 
241
    { return 4; } break;
241
    { return 4; } break;
242
  }		
242
  }		
243
  CHECK(0);
243
  CHECK(0);
Lines 369-381 Link Here
369
369
370
void game_object::draw_above(view *v)
370
void game_object::draw_above(view *v)
371
{
371
{
372
  long x1,y1,x2,y2,sy1,sy2,sx,i;
372
  int32_t x1,y1,x2,y2,sy1,sy2,sx,i;
373
  picture_space(x1,y1,x2,y2);    
373
  picture_space(x1,y1,x2,y2);    
374
374
375
  the_game->game_to_mouse(x1,y1,v,sx,sy2);
375
  the_game->game_to_mouse(x1,y1,v,sx,sy2);
376
  if (sy2>=v->cy1)
376
  if (sy2>=v->cy1)
377
  {
377
  {
378
    long draw_to=y1-(sy2-v->cy1),tmp=x;
378
    int32_t draw_to=y1-(sy2-v->cy1),tmp=x;
379
    current_level->foreground_intersect(x,y1,tmp,draw_to);     
379
    current_level->foreground_intersect(x,y1,tmp,draw_to);     
380
    the_game->game_to_mouse(x1,draw_to,v,i,sy1);     // calculate sy1
380
    the_game->game_to_mouse(x1,draw_to,v,i,sy1);     // calculate sy1
381
381
Lines 403-409 Link Here
403
    current_object=this;
403
    current_object=this;
404
    void *m=mark_heap(TMP_SPACE);
404
    void *m=mark_heap(TMP_SPACE);
405
405
406
    time_marker *prof1;
406
    time_marker *prof1=NULL;
407
    if (profiling())
407
    if (profiling())
408
      prof1=new time_marker;
408
      prof1=new time_marker;
409
409
Lines 455-462 Link Here
455
}
455
}
456
456
457
   
457
   
458
void game_object::do_damage(int amount, game_object *from, long hitx, long hity, 
458
void game_object::do_damage(int amount, game_object *from, int32_t hitx, int32_t hity, 
459
			    long push_xvel, long push_yvel) 
459
			    int32_t push_xvel, int32_t push_yvel) 
460
{
460
{
461
461
462
  void *d=figures[otype]->get_fun(OFUN_DAMAGE);  
462
  void *d=figures[otype]->get_fun(OFUN_DAMAGE);  
Lines 502-508 Link Here
502
    ((cons_cell *)hy)->cdr=px;
502
    ((cons_cell *)hy)->cdr=px;
503
    ((cons_cell *)px)->cdr=py;
503
    ((cons_cell *)px)->cdr=py;
504
504
505
    time_marker *prof1;
505
    time_marker *prof1=NULL;
506
    if (profiling())
506
    if (profiling())
507
      prof1=new time_marker;
507
      prof1=new time_marker;
508
508
Lines 526-533 Link Here
526
#endif
526
#endif
527
}
527
}
528
528
529
void game_object::damage_fun(int amount, game_object *from, long hitx, long hity, 
529
void game_object::damage_fun(int amount, game_object *from, int32_t hitx, int32_t hity, 
530
			    long push_xvel, long push_yvel) 
530
			    int32_t push_xvel, int32_t push_yvel) 
531
{ 
531
{ 
532
  if (!hurtable() || !alive()) return ;
532
  if (!hurtable() || !alive()) return ;
533
533
Lines 568-574 Link Here
568
}
568
}
569
569
570
570
571
void game_object::picture_space(long &x1, long &y1,long &x2, long &y2)
571
void game_object::picture_space(int32_t &x1, int32_t &y1,int32_t &x2, int32_t &y2)
572
{
572
{
573
  int xc=x_center(),w=picture()->width(),h=picture()->height();  
573
  int xc=x_center(),w=picture()->width(),h=picture()->height();  
574
  if (direction>0)
574
  if (direction>0)
Lines 604-610 Link Here
604
}
604
}
605
605
606
606
607
long game_object::x_center()
607
int32_t game_object::x_center()
608
{
608
{
609
  return current_sequence()->x_center(current_frame);   
609
  return current_sequence()->x_center(current_frame);   
610
}
610
}
Lines 617-623 Link Here
617
    current_object=this;
617
    current_object=this;
618
618
619
    void *m=mark_heap(TMP_SPACE);
619
    void *m=mark_heap(TMP_SPACE);
620
    time_marker *prof1;
620
    time_marker *prof1=NULL;
621
    if (profiling())
621
    if (profiling())
622
      prof1=new time_marker;
622
      prof1=new time_marker;
623
623
Lines 644-650 Link Here
644
    current_object=this;
644
    current_object=this;
645
645
646
    void *m=mark_heap(TMP_SPACE);
646
    void *m=mark_heap(TMP_SPACE);
647
    time_marker *prof1;
647
    time_marker *prof1=NULL;
648
    if (profiling())
648
    if (profiling())
649
      prof1=new time_marker;
649
      prof1=new time_marker;
650
650
Lines 747-758 Link Here
747
  }
747
  }
748
}
748
}
749
749
750
game_object *game_object::try_move(long x, long y, long &xv, long &yv, int checks)
750
game_object *game_object::try_move(int32_t x, int32_t y, int32_t &xv, int32_t &yv, int checks)
751
{
751
{
752
  if (xv || yv)  // make sure they are suggesting movement
752
  if (xv || yv)  // make sure they are suggesting movement
753
  {    
753
  {    
754
    game_object *who1=NULL,*who2=NULL;      // who did we intersect?  
754
    game_object *who1=NULL,*who2=NULL;      // who did we intersect?  
755
    long x2,y2,h;  
755
    int32_t x2,y2,h;  
756
756
757
    if (checks&1)
757
    if (checks&1)
758
    {      
758
    {      
Lines 790-796 Link Here
790
790
791
void *game_object::float_tick()  // returns 1 if you hit something, 0 otherwise
791
void *game_object::float_tick()  // returns 1 if you hit something, 0 otherwise
792
{
792
{
793
  long ret=0;
793
  int32_t ret=0;
794
  if (hp()<=0)
794
  if (hp()<=0)
795
  {
795
  {
796
    if (state!=dead)
796
    if (state!=dead)
Lines 815-822 Link Here
815
    } 
815
    } 
816
  }
816
  }
817
817
818
  long fxv=sfxvel()+sfxacel(),fyv=sfyvel()+sfyacel();
818
  int32_t fxv=sfxvel()+sfxacel(),fyv=sfyvel()+sfyacel();
819
  long xv=xvel()+xacel()+(fxv>>8),yv=yvel()+yacel()+(fyv>>8);
819
  int32_t xv=xvel()+xacel()+(fxv>>8),yv=yvel()+yacel()+(fyv>>8);
820
820
821
  if (xv!=xvel() || yv!=yvel())   // only store vel's if changed so we don't increase object size
821
  if (xv!=xvel() || yv!=yvel())   // only store vel's if changed so we don't increase object size
822
  {
822
  {
Lines 833-845 Link Here
833
 
833
 
834
  if (fxv || fyv || xv || yv)   // don't even try if there is no velocity
834
  if (fxv || fyv || xv || yv)   // don't even try if there is no velocity
835
  {
835
  {
836
    long ffx=fx()+sfxvel(),ffy=fy()+sfyvel();
836
    int32_t ffx=fx()+sfxvel(),ffy=fy()+sfyvel();
837
    long nxv=xvel()+(ffx>>8);
837
    int32_t nxv=xvel()+(ffx>>8);
838
    long nyv=yvel()+(ffy>>8);
838
    int32_t nyv=yvel()+(ffy>>8);
839
    set_fx(ffx&0xff);
839
    set_fx(ffx&0xff);
840
    set_fy(ffy&0xff);
840
    set_fy(ffy&0xff);
841
    
841
    
842
    long old_nxv=nxv,old_nyv=nyv;
842
    int32_t old_nxv=nxv,old_nyv=nyv;
843
    game_object *hit_object=try_move(x,y,nxv,nyv,3);   // now find out what velocity is safe to use
843
    game_object *hit_object=try_move(x,y,nxv,nyv,3);   // now find out what velocity is safe to use
844
    
844
    
845
/*    if (get_cflag(CFLAG_STOPPABLE))
845
/*    if (get_cflag(CFLAG_STOPPABLE))
Lines 852-858 Link Here
852
    y+=nyv;
852
    y+=nyv;
853
    if (old_nxv!=nxv || old_nyv!=nyv)
853
    if (old_nxv!=nxv || old_nyv!=nyv)
854
    {
854
    {
855
      long lx=last_tile_hit_x,ly=last_tile_hit_y;
855
      int32_t lx=last_tile_hit_x,ly=last_tile_hit_y;
856
      stop();
856
      stop();
857
      if (old_nxv==0)
857
      if (old_nxv==0)
858
      {
858
      {
Lines 864-870 Link Here
864
	else if (old_nxv<0) ret|=BLOCKED_LEFT;
864
	else if (old_nxv<0) ret|=BLOCKED_LEFT;
865
      } else
865
      } else
866
      {
866
      {
867
	long tx=(old_nxv>0 ? 1 : -1),ty=0;
867
	int32_t tx=(old_nxv>0 ? 1 : -1),ty=0;
868
	try_move(x,y,tx,ty,3);
868
	try_move(x,y,tx,ty,3);
869
	if (!tx) 	
869
	if (!tx) 	
870
	  ret|=(old_nxv>0 ? BLOCKED_RIGHT : BLOCKED_LEFT);	
870
	  ret|=(old_nxv>0 ? BLOCKED_RIGHT : BLOCKED_LEFT);	
Lines 905-911 Link Here
905
{
905
{
906
  int blocked=0;
906
  int blocked=0;
907
907
908
  long xt=0,yt=2;
908
  int32_t xt=0,yt=2;
909
  try_move(x,y-2,xt,yt,1);    // make sure we are not falling through the floor
909
  try_move(x,y-2,xt,yt,1);    // make sure we are not falling through the floor
910
  y=y-2+yt;
910
  y=y-2+yt;
911
  
911
  
Lines 925-936 Link Here
925
  }
925
  }
926
  
926
  
927
  // first let's move the guy acording to his physics
927
  // first let's move the guy acording to his physics
928
  long xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
928
  int32_t xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
929
  if (xa || ya || fxa || fya)
929
  if (xa || ya || fxa || fya)
930
  {
930
  {
931
    int fxv=sfxvel(),fyv=sfyvel();
931
    int fxv=sfxvel(),fyv=sfyvel();
932
    fxv+=fxa;  fyv+=fya;    
932
    fxv+=fxa;  fyv+=fya;    
933
    long xv=xvel()+xa+(fxv>>8); 
933
    int32_t xv=xvel()+xa+(fxv>>8); 
934
    set_xvel(xvel()+xa+(fxv>>8));
934
    set_xvel(xvel()+xa+(fxv>>8));
935
    set_yvel(yvel()+ya+(fyv>>8));
935
    set_yvel(yvel()+ya+(fyv>>8));
936
    set_fxvel(fxv&0xff);
936
    set_fxvel(fxv&0xff);
Lines 938-951 Link Here
938
  }
938
  }
939
  
939
  
940
  // check to see if this advancement causes him to collide with objects
940
  // check to see if this advancement causes him to collide with objects
941
  long old_vy=yvel(),old_vx=xvel();  // save the correct veloicties
941
  int32_t old_vy=yvel(),old_vx=xvel();  // save the correct veloicties
942
942
943
  if (old_vx || old_vy)
943
  if (old_vx || old_vy)
944
  {
944
  {
945
    int up=0;
945
    int up=0;
946
    if (yvel()<=0)  // if we are going up or a strait across check up and down
946
    if (yvel()<=0)  // if we are going up or a strait across check up and down
947
    up=2;
947
    up=2;
948
    long xv=xvel(),yv=yvel();
948
    int32_t xv=xvel(),yv=yvel();
949
    game_object *h=try_move(x,y,xv,yv,1|up);       // now find out what velocity is safe to use
949
    game_object *h=try_move(x,y,xv,yv,1|up);       // now find out what velocity is safe to use
950
    set_xvel(xv);
950
    set_xvel(xv);
951
    set_yvel(yv);
951
    set_yvel(yv);
Lines 958-964 Link Here
958
    {          
958
    {          
959
      if (gravity())                         // was he going up or down?
959
      if (gravity())                         // was he going up or down?
960
      {	                       
960
      {	                       
961
	long fall_xv=0,old_fall_vy,fall_vy;
961
	int32_t fall_xv=0,old_fall_vy,fall_vy;
962
	old_fall_vy=fall_vy=old_vy-yvel();             // make sure he gets all of his yvel
962
	old_fall_vy=fall_vy=old_vy-yvel();             // make sure he gets all of his yvel
963
	try_move(x,y,fall_xv,fall_vy,1|up);
963
	try_move(x,y,fall_xv,fall_vy,1|up);
964
	if (old_vy>0 && fall_vy<old_fall_vy)       // he was trying to fall, but he hit the ground
964
	if (old_vy>0 && fall_vy<old_fall_vy)       // he was trying to fall, but he hit the ground
Lines 1000-1006 Link Here
1000
	{
1000
	{
1001
	  if (old_vy!=0)
1001
	  if (old_vy!=0)
1002
	  {
1002
	  {
1003
	    long testx=old_vx<0 ? -1 : 1,testy=0;    // see if we were stopped left/right
1003
	    int32_t testx=old_vx<0 ? -1 : 1,testy=0;    // see if we were stopped left/right
1004
                                                     // or just up down
1004
                                                     // or just up down
1005
	    try_move(x,y,testx,testy,1|up);
1005
	    try_move(x,y,testx,testy,1|up);
1006
	    if (testx==0)                           // blocked left/right, set flag
1006
	    if (testx==0)                           // blocked left/right, set flag
Lines 1031-1039 Link Here
1031
      }    
1031
      }    
1032
      else                  // see if we can make him 'climb' the hill
1032
      else                  // see if we can make him 'climb' the hill
1033
      {
1033
      {
1034
	long ox=x,oy=y;       // rember orginal position in case climb doesn't work
1034
	int32_t ox=x,oy=y;       // rember orginal position in case climb doesn't work
1035
1035
1036
	long climb_xvel=0,climb_yvel=-5;	    // try to move up one pixel to step over the 
1036
	int32_t climb_xvel=0,climb_yvel=-5;	    // try to move up one pixel to step over the 
1037
	try_move(x,y,climb_xvel,climb_yvel,3);  // jutting polygon line
1037
	try_move(x,y,climb_xvel,climb_yvel,3);  // jutting polygon line
1038
	y+=climb_yvel;
1038
	y+=climb_yvel;
1039
1039
Lines 1081-1087 Link Here
1081
     
1081
     
1082
  if (yacel()==0 && !gravity())       // he is not falling, make sure he can't
1082
  if (yacel()==0 && !gravity())       // he is not falling, make sure he can't
1083
  {
1083
  {
1084
    long nvx=0,nvy=yvel()+12;  // check three pixels below for ground
1084
    int32_t nvx=0,nvy=yvel()+12;  // check three pixels below for ground
1085
    try_move(x,y,nvx,nvy,1); 
1085
    try_move(x,y,nvx,nvy,1); 
1086
    if (nvy>11)                    // if he falls more than 2 pixels, then he falls
1086
    if (nvy>11)                    // if he falls more than 2 pixels, then he falls
1087
    {
1087
    {
Lines 1116-1124 Link Here
1116
  int ad=current_sequence()->get_advance(current_frame);
1116
  int ad=current_sequence()->get_advance(current_frame);
1117
  if (ad && current_level)
1117
  if (ad && current_level)
1118
  {
1118
  {
1119
    long xv;
1119
    int32_t xv;
1120
    if (direction>0) xv=ad; else xv=-ad;
1120
    if (direction>0) xv=ad; else xv=-ad;
1121
    long yv=0;
1121
    int32_t yv=0;
1122
    try_move(x,y,xv,yv,3);
1122
    try_move(x,y,xv,yv,3);
1123
    x+=xv;
1123
    x+=xv;
1124
  }   
1124
  }   
Lines 1138-1144 Link Here
1138
}
1138
}
1139
1139
1140
1140
1141
game_object *create(int type, long x, long y, int skip_constructor, int aitype)
1141
game_object *create(int type, int32_t x, int32_t y, int skip_constructor, int aitype)
1142
{
1142
{
1143
  game_object *g=new game_object(type,skip_constructor);
1143
  game_object *g=new game_object(type,skip_constructor);
1144
  g->x=x; g->y=y; g->last_x=x; g->last_y=y;
1144
  g->x=x; g->y=y; g->last_x=x; g->last_y=y;
Lines 1151-1157 Link Here
1151
1151
1152
    void *m=mark_heap(TMP_SPACE);
1152
    void *m=mark_heap(TMP_SPACE);
1153
1153
1154
    time_marker *prof1;
1154
    time_marker *prof1=NULL;
1155
    if (profiling())
1155
    if (profiling())
1156
      prof1=new time_marker;
1156
      prof1=new time_marker;
1157
1157
Lines 1218-1224 Link Here
1218
1218
1219
    void *m=mark_heap(TMP_SPACE);
1219
    void *m=mark_heap(TMP_SPACE);
1220
1220
1221
    time_marker *prof1;
1221
    time_marker *prof1=NULL;
1222
    if (profiling())
1222
    if (profiling())
1223
      prof1=new time_marker;
1223
      prof1=new time_marker;
1224
1224
Lines 1298-1304 Link Here
1298
  }         // not pressing left or right, so slow down or stop
1298
  }         // not pressing left or right, so slow down or stop
1299
  else if (!gravity() && state!=start_run_jump)
1299
  else if (!gravity() && state!=start_run_jump)
1300
  {    
1300
  {    
1301
    long stop_acel;
1301
    int32_t stop_acel;
1302
    if (xvel()<0)                                    // he was going left
1302
    if (xvel()<0)                                    // he was going left
1303
    {
1303
    {
1304
      stop_acel=get_ability(type(),stop_accel);    // find out how fast he can slow down
1304
      stop_acel=get_ability(type(),stop_accel);    // find out how fast he can slow down
Lines 1447-1467 Link Here
1447
{
1447
{
1448
1448
1449
  // first let's move the guy acording to his physics
1449
  // first let's move the guy acording to his physics
1450
  long xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
1450
  int32_t xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
1451
  if (xa || ya || fxa || fya)
1451
  if (xa || ya || fxa || fya)
1452
  {
1452
  {
1453
    int fxv=sfxvel(),fyv=sfyvel();
1453
    int fxv=sfxvel(),fyv=sfyvel();
1454
    fxv+=fxa;  fyv+=fya;    
1454
    fxv+=fxa;  fyv+=fya;    
1455
    long xv=xvel()+xa+(fxv>>8); 
1455
    int32_t xv=xvel()+xa+(fxv>>8); 
1456
    set_xvel(xvel()+xa+(fxv>>8));
1456
    set_xvel(xvel()+xa+(fxv>>8));
1457
    set_yvel(yvel()+ya+(fyv>>8));
1457
    set_yvel(yvel()+ya+(fyv>>8));
1458
    set_fxvel(fxv&0xff);
1458
    set_fxvel(fxv&0xff);
1459
    set_fyvel(fyv&0xff);
1459
    set_fyvel(fyv&0xff);
1460
  }
1460
  }
1461
  
1461
  
1462
  long ox2,oy2;
1462
  int32_t ox2,oy2;
1463
1463
1464
  long nx=x+xvel(),nfx=fx()+fxvel(),ny=y+yvel(),nfy=fy()+fyvel();
1464
  int32_t nx=x+xvel(),nfx=fx()+fxvel(),ny=y+yvel(),nfy=fy()+fyvel();
1465
  nx+=nfx>>8;
1465
  nx+=nfx>>8;
1466
  ny+=nfy>>8;
1466
  ny+=nfy>>8;
1467
 
1467
 
Lines 1505-1511 Link Here
1505
  return 0;
1505
  return 0;
1506
}
1506
}
1507
1507
1508
game_object *number_to_object_in_list(long x, object_node *list)
1508
game_object *number_to_object_in_list(int32_t x, object_node *list)
1509
{
1509
{
1510
  if (!x) return NULL; x--;
1510
  if (!x) return NULL; x--;
1511
  while (x && list) { list=list->next; x--; }
1511
  while (x && list) { list=list->next; x--; }
Lines 1525-1533 Link Here
1525
}
1525
}
1526
1526
1527
1527
1528
long object_list_length(object_node *list)
1528
int32_t object_list_length(object_node *list)
1529
{
1529
{
1530
  long x=0;
1530
  int32_t x=0;
1531
  while (list) { list=list->next; x++; }
1531
  while (list) { list=list->next; x++; }
1532
  return x;
1532
  return x;
1533
  
1533
  
Lines 1542-1548 Link Here
1542
    int t=figures[Type]->tv;
1542
    int t=figures[Type]->tv;
1543
    if (t)
1543
    if (t)
1544
    {
1544
    {
1545
      lvars=(long *)jmalloc(t*4,"object vars");
1545
      lvars=(int32_t *)jmalloc(t*4,"object vars");
1546
      memset(lvars,0,t*4);
1546
      memset(lvars,0,t*4);
1547
    }
1547
    }
1548
    else lvars=NULL;
1548
    else lvars=NULL;
Lines 1555-1561 Link Here
1555
1555
1556
int game_object::reduced_state()
1556
int game_object::reduced_state()
1557
{
1557
{
1558
  long x=0;
1558
  int32_t x=0;
1559
  for (int i=0;i<figures[otype]->ts;i++)
1559
  for (int i=0;i<figures[otype]->ts;i++)
1560
  {
1560
  {
1561
    if (i==state) return x;
1561
    if (i==state) return x;
Lines 1577-1583 Link Here
1577
      game_object *o=current_object;
1577
      game_object *o=current_object;
1578
      current_object=(game_object *)this;
1578
      current_object=(game_object *)this;
1579
1579
1580
      time_marker *prof1;
1580
      time_marker *prof1=NULL;
1581
      if (profiling())
1581
      if (profiling())
1582
        prof1=new time_marker;
1582
        prof1=new time_marker;
1583
1583
Lines 1606-1612 Link Here
1606
    int t=figures[new_type]->tv;
1606
    int t=figures[new_type]->tv;
1607
    if (t)
1607
    if (t)
1608
    {
1608
    {
1609
      lvars=(long *)jmalloc(t*4,"object vars");
1609
      lvars=(int32_t *)jmalloc(t*4,"object vars");
1610
      memset(lvars,0,t*4);
1610
      memset(lvars,0,t*4);
1611
    }
1611
    }
1612
    else lvars=NULL;
1612
    else lvars=NULL;
Lines 1620-1626 Link Here
1620
1620
1621
    void *m=mark_heap(TMP_SPACE);
1621
    void *m=mark_heap(TMP_SPACE);
1622
1622
1623
    time_marker *prof1;
1623
    time_marker *prof1=NULL;
1624
    if (profiling())
1624
    if (profiling())
1625
      prof1=new time_marker;
1625
      prof1=new time_marker;
1626
1626
(-)abuse-sdl-0.7.0.orig/src/include/lcache.hpp (-1 / +1 lines)
Lines 5-11 Link Here
5
#ifdef SCADALISP
5
#ifdef SCADALISP
6
#define can_cache_lisp() 0
6
#define can_cache_lisp() 0
7
#else
7
#else
8
#define can_cache_lisp() 1
8
#define can_cache_lisp() 0 /* XXX */
9
#endif
9
#endif
10
10
11
long block_size(Cell *level);              // return number of bytes to save this block of code
11
long block_size(Cell *level);              // return number of bytes to save this block of code
(-)abuse-sdl-0.7.0.orig/src/include/bus_type.hpp (-8 / +8 lines)
Lines 2-36 Link Here
2
#define BUS_TYPE_HPP
2
#define BUS_TYPE_HPP
3
3
4
#ifdef __sgi
4
#ifdef __sgi
5
#define WORD_ALLIGN 1
5
#define WORD_ALIGN 1
6
#endif
6
#endif
7
7
8
#ifdef sun
8
#ifdef sun
9
#define WORD_ALLIGN 1
9
#define WORD_ALIGN 1
10
#endif
10
#endif
11
11
12
#ifdef SUN3
12
#ifdef SUN3
13
#define WORD_ALLIGN 1
13
#define WORD_ALIGN 1
14
#endif
14
#endif
15
15
16
#ifdef SUN4
16
#ifdef SUN4
17
#define WORD_ALLIGN 1
17
#define WORD_ALIGN 1
18
#endif
18
#endif
19
19
20
#ifdef __sgi
20
#ifdef __sgi
21
#define WORD_ALLIGN 1
21
#define WORD_ALIGN 1
22
#endif
22
#endif
23
23
24
#ifdef _AIX
24
#ifdef _AIX
25
#define WORD_ALLIGN 1
25
#define WORD_ALIGN 1
26
#endif
26
#endif
27
27
28
#ifdef __sparc__
28
#ifdef __sparc__
29
#define WORD_ALLIGN 1
29
#define WORD_ALIGN 1
30
#endif
30
#endif
31
31
32
#ifdef __arm__
32
#ifdef __arm__
33
#define WORD_ALLIGN 1
33
#define WORD_ALIGN 1
34
#endif
34
#endif
35
35
36
#endif // BUS_TYPE_HPP
36
#endif // BUS_TYPE_HPP
(-)abuse-sdl-0.7.0.orig/src/lisp.cpp (-1 / +3 lines)
Lines 171-177 Link Here
171
171
172
void *lmalloc(int size, int which_space)
172
void *lmalloc(int size, int which_space)
173
{      
173
{      
174
#ifdef WORD_ALLIGN
174
  return malloc(size); /* XXX */
175
176
#ifdef WORD_ALIGN
175
  size=(size+3)&(~3);
177
  size=(size+3)&(~3);
176
#endif
178
#endif
177
179
(-)abuse-sdl-0.7.0.orig/src/lcache.cpp (-1 / +1 lines)
Lines 35-41 Link Here
35
    { ret=sizeof(lisp_pointer); }
35
    { ret=sizeof(lisp_pointer); }
36
    else ret=0;
36
    else ret=0;
37
  }
37
  }
38
#ifdef WORD_ALLIGN
38
#ifdef WORD_ALIGN
39
  return (ret+3)&(~3);
39
  return (ret+3)&(~3);
40
#else
40
#else
41
  return ret;
41
  return ret;
(-)abuse-sdl-0.7.0.orig/src/imlib/keys.cpp (-1 / +1 lines)
Lines 11-17 Link Here
11
11
12
void key_name(int key, char *buffer)
12
void key_name(int key, char *buffer)
13
{
13
{
14
	static char sing[2];
14
	//static char sing[2];
15
	if( key > 255 && key <= JK_MAX_KEY )
15
	if( key > 255 && key <= JK_MAX_KEY )
16
		strcpy(buffer,jk_key_names[key-256]);
16
		strcpy(buffer,jk_key_names[key-256]);
17
	else if( key == JK_BACKSPACE )
17
	else if( key == JK_BACKSPACE )
(-)abuse-sdl-0.7.0.orig/src/imlib/jwindow.cpp (-4 / +4 lines)
Lines 175-181 Link Here
175
	ev.window->next=NULL;
175
	ev.window->next=NULL;
176
	if (red)
176
	if (red)
177
	{
177
	{
178
	  jwindow *j=ev.window,*p;
178
	  jwindow *j=ev.window;
179
/*	  screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1);
179
/*	  screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1);
180
	  for (p=first;p!=j;p=p->next)
180
	  for (p=first;p!=j;p=p->next)
181
	    p->screen->add_dirty(j->x-p->x,j->y-p->y,j->x+j->l-1-p->x,j->y+j->h-1-p->y);*/
181
	    p->screen->add_dirty(j->x-p->x,j->y-p->y,j->x+j->l-1-p->x,j->y+j->h-1-p->y);*/
Lines 282-289 Link Here
282
{
282
{
283
  jwindow *p,*q;
283
  jwindow *p,*q;
284
284
285
  int mx,my,but;
285
  int mx=0,my=0;
286
  image *mouse_pic,*mouse_save;
286
  image *mouse_pic=NULL,*mouse_save=NULL;
287
  
287
  
288
  if (has_mouse())
288
  if (has_mouse())
289
  {    
289
  {    
Lines 426-432 Link Here
426
426
427
ifield *input_manager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
427
ifield *input_manager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
428
{ 
428
{ 
429
  for (ifield *i=first,*last;i;i=i->next)
429
  for (ifield *i=first,*last=NULL;i;i=i->next)
430
  {
430
  {
431
    if (i->id==id) 
431
    if (i->id==id) 
432
    {
432
    {

Return to bug 155617