14313 lines
439 KiB
Diff
14313 lines
439 KiB
Diff
Index: abuse-sdl-0.7.0/src/imlib/include/visobj.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/visobj.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/visobj.hpp 2006-06-21 15:02:31.000000000 +0200
|
|
@@ -10,6 +10,7 @@
|
|
virtual void draw(image *screen, int x, int y, window_manager *wm, filter *f) = 0;
|
|
virtual int width(window_manager *wm) = 0;
|
|
virtual int height(window_manager *wm) = 0;
|
|
+ virtual ~visual_object() {}
|
|
} ;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/status.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/status.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/status.hpp 2006-06-21 15:02:31.000000000 +0200
|
|
@@ -11,6 +11,7 @@
|
|
virtual void update(int percentage) = 0;
|
|
virtual void pop() = 0;
|
|
virtual void force_display() { ; }
|
|
+ virtual ~status_manager() {}
|
|
} ;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/jmalloc.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/jmalloc.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/jmalloc.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -7,14 +7,14 @@
|
|
#ifdef MANAGE_MEM
|
|
enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE};
|
|
extern int alloc_space;
|
|
-void *jmalloc(long size, char *what_for);
|
|
-void *jrealloc(void *ptr, long size, char *what_for);
|
|
+void *jmalloc(int32_t size, char *what_for);
|
|
+void *jrealloc(void *ptr, int32_t size, char *what_for);
|
|
void jfree(void *ptr);
|
|
void mem_report(char *filename);
|
|
-void jmalloc_init(long min_size);
|
|
+void jmalloc_init(int32_t min_size);
|
|
void jmalloc_uninit();
|
|
-long j_allocated();
|
|
-long j_available();
|
|
+int32_t j_allocated();
|
|
+int32_t j_available();
|
|
extern void free_up_memory();
|
|
#else
|
|
#define jmalloc(x,y) malloc(x)
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/palette.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/palette.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/palette.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -27,7 +27,7 @@
|
|
palette(bFILE *fp);
|
|
void set(int x, unsigned char red, unsigned char green, unsigned char blue);
|
|
void get(int x, unsigned char &red, unsigned char &green, unsigned char &blue);
|
|
- long getquad(int x);
|
|
+ uint32_t getquad(int x);
|
|
unsigned int red(int x) { return pal[x].red; }
|
|
unsigned int green(int x) { return pal[x].green; }
|
|
unsigned int blue(int x) { return pal[x].blue; }
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/timage.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/timage.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/timage.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -27,15 +27,15 @@
|
|
|
|
// if screen x & y offset already calculated save a mul
|
|
// and no clipping, but fast use this
|
|
- void put_image_offseted(image *screen, uchar *s_off);
|
|
+ void put_image_offseted(image *screen, uint8_t *s_off);
|
|
void put_image_filled(image *screen, int x, int y,
|
|
- uchar fill_color);
|
|
+ uint8_t fill_color);
|
|
void put_fade(image *screen, int x, int y,
|
|
int frame_on, int total_frames,
|
|
color_filter *f, palette *pal);
|
|
void put_fade_tint(image *screen, int x, int y,
|
|
int frame_on, int total_frames,
|
|
- uchar *tint,
|
|
+ uint8_t *tint,
|
|
color_filter *f, palette *pal);
|
|
void put_color(image *screen, int x, int y, int color);
|
|
unsigned char *clip_y(image *screen, int x1, int y1, int x2, int y2,
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/packet.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/packet.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/packet.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -4,24 +4,24 @@
|
|
class packet
|
|
{
|
|
public :
|
|
- uchar *buf;
|
|
- long buf_size,ro,wo,rend;
|
|
+ uint8_t *buf;
|
|
+ int32_t buf_size,ro,wo,rend;
|
|
int pre_size;
|
|
void make_bigger(int max);
|
|
|
|
int get_read_position() { return ro; }
|
|
void set_read_position(int x) { ro=x; }
|
|
- int read(uchar *buffer, int size);
|
|
- int write(uchar *buffer, int size);
|
|
+ int read(uint8_t *buffer, int size);
|
|
+ int write(uint8_t *buffer, int size);
|
|
int eop() { return ro>=rend; }
|
|
void reset();
|
|
packet(int prefix_size=2);
|
|
void get_string(char *st, int len);
|
|
- int advance(long offset);
|
|
+ int advance(int32_t offset);
|
|
|
|
- void write_long(ulong x); // writes can't fail...
|
|
- void write_short(ushort x);
|
|
- void write_byte(uchar x);
|
|
+ void write_uint32(uint32_t x); // writes can't fail...
|
|
+ void write_uint16(uint16_t x);
|
|
+ void write_uint8(uint8_t x);
|
|
void insert_into(packet &pk);
|
|
int size() { return rend-pre_size; }
|
|
~packet();
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/jwindow.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/jwindow.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/jwindow.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -68,9 +68,8 @@
|
|
|
|
struct jwindow_properties
|
|
{
|
|
- uchar moveable,
|
|
- hidden;
|
|
-
|
|
+ uint8_t moveable,
|
|
+ hidden;
|
|
} ;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/image.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/image.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/image.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -18,10 +18,10 @@
|
|
#define imWRITE_ERROR 7
|
|
#define imMAX_ERROR 7
|
|
|
|
-short current_error();
|
|
+int16_t current_error();
|
|
void clear_errors();
|
|
-void set_error(short x);
|
|
-short last_error();
|
|
+void set_error(int16_t x);
|
|
+int16_t last_error();
|
|
void make_block(size_t size);
|
|
void image_init();
|
|
void image_uninit();
|
|
@@ -29,9 +29,9 @@
|
|
|
|
typedef struct image_color_t
|
|
{
|
|
- unsigned short r;
|
|
- unsigned short g;
|
|
- unsigned short b;
|
|
+ uint16_t r;
|
|
+ uint16_t g;
|
|
+ uint16_t b;
|
|
} image_color;
|
|
|
|
class filter;
|
|
@@ -40,44 +40,44 @@
|
|
class dirty_rect : public linked_node
|
|
{
|
|
public :
|
|
- short dx1,dy1,dx2,dy2;
|
|
- dirty_rect(short x1, short y1, short x2, short y2)
|
|
+ int16_t dx1,dy1,dx2,dy2;
|
|
+ dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
{ dx1=x1; dy1=y1; dx2=x2; dy2=y2;
|
|
if (x2<x1 || y2<y1)
|
|
printf("add inccorect dirty\n");
|
|
}
|
|
- virtual short compare(void *n1, short field)
|
|
+ virtual int16_t compare(void *n1, int16_t field)
|
|
{ return ((dirty_rect *)n1)->dy1>dy1; }
|
|
} ;
|
|
|
|
class image_descriptor
|
|
{
|
|
- short l,h;
|
|
- short clipx1, clipy1, clipx2, clipy2;
|
|
+ int16_t l,h;
|
|
+ int16_t clipx1, clipy1, clipx2, clipy2;
|
|
public :
|
|
- unsigned char keep_dirt,
|
|
- static_mem; // if this flag is set then don't free memory on exit
|
|
+ uint8_t keep_dirt,
|
|
+ static_mem; // if this flag is set then don't free memory on exit
|
|
|
|
linked_list dirties;
|
|
void *extended_descriptor; // type depends on current system
|
|
|
|
- image_descriptor(short length, short height,
|
|
+ image_descriptor(int16_t length, int16_t height,
|
|
int keep_dirties=1, int static_memory=0);
|
|
- short bound_x1(short x1) { return x1<clipx1 ? clipx1 : x1; }
|
|
- short bound_y1(short y1) { return y1<clipy1 ? clipy1 : y1; }
|
|
- short bound_x2(short x2) { return x2>clipx2 ? clipx2 : x2; }
|
|
- short bound_y2(short y2) { return y2>clipy2 ? clipy2 : y2; }
|
|
- short x1_clip() { return clipx1; }
|
|
- short y1_clip() { return clipy1; }
|
|
- short x2_clip() { return clipx2; }
|
|
- short y2_clip() { return clipy2; }
|
|
- void dirty_area(short x1, short y1, short x2, short y2) { ;}
|
|
- void clean_area(short x1, short y1, short x2, short y2) { ; }
|
|
+ int16_t bound_x1(int16_t x1) { return x1<clipx1 ? clipx1 : x1; }
|
|
+ int16_t bound_y1(int16_t y1) { return y1<clipy1 ? clipy1 : y1; }
|
|
+ int16_t bound_x2(int16_t x2) { return x2>clipx2 ? clipx2 : x2; }
|
|
+ int16_t bound_y2(int16_t y2) { return y2>clipy2 ? clipy2 : y2; }
|
|
+ int16_t x1_clip() { return clipx1; }
|
|
+ int16_t y1_clip() { return clipy1; }
|
|
+ int16_t x2_clip() { return clipx2; }
|
|
+ int16_t y2_clip() { return clipy2; }
|
|
+ void dirty_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ;}
|
|
+ void clean_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ; }
|
|
void clear_dirties();
|
|
- short get_dirty_area(short &x1, short &y1, short &x2, short &y2) { return 0; }
|
|
- void get_clip(short &x1, short &y1, short &x2, short &y2)
|
|
+ int16_t get_dirty_area(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) { return 0; }
|
|
+ void get_clip(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
|
|
{ x1=clipx1; y1=clipy1; x2=clipx2; y2=clipy2; }
|
|
- void set_clip(short x1, short y1, short x2, short y2)
|
|
+ void set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
{ if (x2<x1) x2=x1;
|
|
if (y2<y1) y2=y1;
|
|
if (x1<0) clipx1=0; else clipx1=x1;
|
|
@@ -88,75 +88,75 @@
|
|
void reduce_dirties();
|
|
void add_dirty(int x1, int y1, int x2, int y2);
|
|
void delete_dirty(int x1, int y1, int x2, int y2);
|
|
- void resize(short length, short height)
|
|
+ void resize(int16_t length, int16_t height)
|
|
{ l=length; h=height; clipx1=0; clipy1=0; clipx2=l-1; clipy2=h-1; }
|
|
} ;
|
|
|
|
class image : public linked_node
|
|
{
|
|
- unsigned char *data;
|
|
- short w,h;
|
|
- void make_page(short width, short height, unsigned char *page_buffer);
|
|
+ uint8_t *data;
|
|
+ int16_t w,h;
|
|
+ void make_page(int16_t width, int16_t height, uint8_t *page_buffer);
|
|
void delete_page();
|
|
public :
|
|
image_descriptor *special;
|
|
image(spec_entry *e, bFILE *fp);
|
|
image(bFILE *fp);
|
|
- image(short width, short height, // required
|
|
- unsigned char *page_buffer=NULL,
|
|
- short create_descriptor=0); // 0=no, 1=yes, 2=yes & keep dirties
|
|
- unsigned char pixel (short x, short y);
|
|
- void putpixel (short x, short y, char color);
|
|
- unsigned char *scan_line (short y) { return data+y*w; }
|
|
- unsigned char *next_line (short lasty, unsigned char *last_scan)
|
|
+ image(int16_t width, int16_t height, // required
|
|
+ uint8_t *page_buffer=NULL,
|
|
+ int16_t create_descriptor=0); // 0=no, 1=yes, 2=yes & keep dirties
|
|
+ uint8_t pixel (int16_t x, int16_t y);
|
|
+ void putpixel (int16_t x, int16_t y, char color);
|
|
+ uint8_t *scan_line (int16_t y) { return data+y*w; }
|
|
+ uint8_t *next_line (int16_t lasty, uint8_t *last_scan)
|
|
{ return last_scan+w; }
|
|
- long total_pixels (unsigned char background=0);
|
|
- image *copy (); // makes a copy of an image
|
|
- void clear (short color=-1); // -1 is background color
|
|
- void to_24bit (palette &pal);
|
|
- short width () { return (short)w; }
|
|
- short height () { return (short)h; }
|
|
- void scroll (short x1, short y1, short x2, short y2, short xd, short yd);
|
|
- void fill_image (image *screen, short x1, short y1, short x2, short y2,
|
|
- short allign=1);
|
|
- void put_image (image *screen, short x, short y, char transparent=0);
|
|
- void put_part (image *screen, short x, short y, short x1, short y1,
|
|
- short x2, short y2, char transparent=0);
|
|
- void put_part_xrev (image *screen, short x, short y, short x1, short y1,
|
|
- short x2, short y2, char transparent=0);
|
|
- void put_part_masked (image *screen, image *mask, short x, short y,
|
|
- short maskx, short masky, short x1, short y1, short x2, short y2);
|
|
- image *copy_part_dithered (short x1, short y1, short x2, short y2);
|
|
- void bar (short x1, short y1, short x2, short y2, unsigned char color);
|
|
- void xor_bar (short x1, short y1, short x2, short y2, unsigned char color);
|
|
- void wiget_bar (short x1, short y1, short x2, short y2,
|
|
- unsigned char light, unsigned char med, unsigned char dark);
|
|
- void line (short x1, short y1, short x2, short y2, unsigned char color);
|
|
- void rectangle (short x1, short y1, short x2, short y2, unsigned char color);
|
|
- void burn_led (short x, short y, long num, short color, short scale=1);
|
|
- void set_clip (short x1, short y1, short x2, short y2);
|
|
- void get_clip (short &x1,short &y1,short &x2,short &y2);
|
|
- void in_clip (short x1, short y1, short x2, short y2);
|
|
+ int32_t total_pixels (uint8_t background=0);
|
|
+ image *copy (); // makes a copy of an image
|
|
+ void clear (int16_t color=-1); // -1 is background color
|
|
+ void to_24bit (palette &pal);
|
|
+ int16_t width () { return (int16_t)w; }
|
|
+ int16_t height () { return (int16_t)h; }
|
|
+ void scroll (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd);
|
|
+ void fill_image (image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
|
|
+ int16_t align=1);
|
|
+ void put_image (image *screen, int16_t x, int16_t y, char transparent=0);
|
|
+ void put_part (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1,
|
|
+ int16_t x2, int16_t y2, char transparent=0);
|
|
+ void put_part_xrev (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1,
|
|
+ int16_t x2, int16_t y2, char transparent=0);
|
|
+ void put_part_masked (image *screen, image *mask, int16_t x, int16_t y,
|
|
+ int16_t maskx, int16_t masky, int16_t x1, int16_t y1, int16_t x2, int16_t y2);
|
|
+ image *copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
|
|
+ void bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
|
|
+ void xor_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
|
|
+ void wiget_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2,
|
|
+ uint8_t light, uint8_t med, uint8_t dark);
|
|
+ void line (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
|
|
+ void rectangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color);
|
|
+ void burn_led (int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale=1);
|
|
+ void set_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
|
|
+ void get_clip (int16_t &x1,int16_t &y1,int16_t &x2,int16_t &y2);
|
|
+ void in_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2);
|
|
|
|
- void dirt_off () { if (special && special->keep_dirt) special->keep_dirt=0; }
|
|
- void dirt_on () { if (special) special->keep_dirt=1; }
|
|
+ void dirt_off () { if (special && special->keep_dirt) special->keep_dirt=0; }
|
|
+ void dirt_on () { if (special) special->keep_dirt=1; }
|
|
|
|
- void add_dirty (int x1, int y1, int x2, int y2)
|
|
+ void add_dirty (int x1, int y1, int x2, int y2)
|
|
{ if (special) special->add_dirty(x1,y1,x2,y2); }
|
|
- void delete_dirty (int x1, int y1, int x2, int y2)
|
|
+ void delete_dirty (int x1, int y1, int x2, int y2)
|
|
{ if (special) special->delete_dirty(x1,y1,x2,y2); }
|
|
- void clear_dirties () { if (special) special->clear_dirties(); }
|
|
- void dither (palette *pal); // use a b&w palette!
|
|
- void resize (short new_width, short new_height);
|
|
- void change_size (short new_width, short new_height, unsigned char *page=NULL);
|
|
- void flood_fill (short x, short y, unsigned char color);
|
|
- image *create_smooth (short smoothness=1); // 0 no smoothness
|
|
- void unpack_scanline (short line, char bitsperpixel=1);
|
|
- unsigned char brightest_color (palette *pal);
|
|
- void flip_x ();
|
|
- void flip_y ();
|
|
- void make_color (unsigned char color);
|
|
- unsigned char darkest_color (palette *pal, short noblack=0);
|
|
+ void clear_dirties () { if (special) special->clear_dirties(); }
|
|
+ void dither (palette *pal); // use a b&w palette!
|
|
+ void resize (int16_t new_width, int16_t new_height);
|
|
+ void change_size (int16_t new_width, int16_t new_height, uint8_t *page=NULL);
|
|
+ void flood_fill (int16_t x, int16_t y, uint8_t color);
|
|
+ image *create_smooth (int16_t smoothness=1); // 0 no smoothness
|
|
+ void unpack_scanline (int16_t line, char bitsperpixel=1);
|
|
+ uint8_t brightest_color (palette *pal);
|
|
+ void flip_x ();
|
|
+ void flip_y ();
|
|
+ void make_color (uint8_t color);
|
|
+ uint8_t darkest_color (palette *pal, int16_t noblack=0);
|
|
|
|
~image();
|
|
} ;
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/macs.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/macs.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/macs.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -23,12 +23,12 @@
|
|
#define max(x,y) (x>y ? x:y)
|
|
#endif
|
|
|
|
-#define uchar unsigned char
|
|
-#define schar signed char
|
|
+//#define uchar unsigned char
|
|
+//#define schar signed char
|
|
//#define ushort unsigned short
|
|
-typedef unsigned short int ushort;
|
|
-#define sshort signed short
|
|
+//typedef unsigned short int ushort;
|
|
+//#define sshort signed short
|
|
//#define ulong unsigned long
|
|
-typedef unsigned long int ulong;
|
|
+//typedef unsigned long int ulong;
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/system.h
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/system.h 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/system.h 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -25,36 +25,37 @@
|
|
#else
|
|
// so apps can find unlink
|
|
#include <unistd.h>
|
|
+ #include <stdint.h>
|
|
#endif
|
|
|
|
|
|
-#define short_swap(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
|
|
-#define long_swap(x) \
|
|
- ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
|
|
- ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
|
|
+#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
|
|
+#define uint32_swap(x) \
|
|
+ ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
|
|
+ ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
|
|
|
|
#if defined BIG_ENDIANS
|
|
-#define LONG int
|
|
-#define int_to_intel(x) short_swap(x)
|
|
-#define int_to_local(x) int_to_intel(x)
|
|
-#define big_long_to_local(x) (x)
|
|
-#define big_short_to_local(x) (x)
|
|
-#define long_to_intel(x) long_swap(x)
|
|
-#define long_to_local(x) long_to_intel(x)
|
|
+#define LONG int32_t
|
|
+#define uint16_to_intel(x) uint16_swap(x)
|
|
+#define uint16_to_local(x) uint16_to_intel(x)
|
|
+#define big_uint32_to_local(x) (x)
|
|
+#define big_uint16_to_local(x) (x)
|
|
+#define uint32_to_intel(x) uint32_swap(x)
|
|
+#define uint32_to_local(x) uint32_to_intel(x)
|
|
#else
|
|
-#define LONG long
|
|
-#define int_to_intel(x) (x)
|
|
-#define int_to_local(x) (x)
|
|
-#define long_to_local(x) (x)
|
|
-#define long_to_intel(x) (x)
|
|
-#define big_long_to_local(x) long_swap(x)
|
|
-#define big_short_to_local(x) short_swap(x)
|
|
+#define LONG int32_t
|
|
+#define uint16_to_intel(x) (x)
|
|
+#define uint16_to_local(x) (x)
|
|
+#define uint32_to_local(x) (x)
|
|
+#define uint32_to_intel(x) (x)
|
|
+#define big_uint32_to_local(x) uint32_swap(x)
|
|
+#define big_uint16_to_local(x) uint16_swap(x)
|
|
#endif
|
|
|
|
-#define bltl(x) big_long_to_local(x)
|
|
-#define bstl(x) big_short_to_local(x)
|
|
-#define lltl(x) long_to_intel(x)
|
|
-#define lstl(x) int_to_intel(x)
|
|
+#define bltl(x) big_uint32_to_local(x)
|
|
+#define bstl(x) big_uint16_to_local(x)
|
|
+#define lltl(x) uint32_to_intel(x)
|
|
+#define lstl(x) uint16_to_intel(x)
|
|
|
|
#endif
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/scroller.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/scroller.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/scroller.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -50,7 +50,7 @@
|
|
{
|
|
protected :
|
|
int r,c,m,last_sel,cur_sel;
|
|
- uchar *select;
|
|
+ uint8_t *select;
|
|
public :
|
|
spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next);
|
|
int vis() { if (vert) return r; else return c; }
|
|
Index: abuse-sdl-0.7.0/src/imlib/include/specs.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include/specs.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include/specs.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -6,6 +6,7 @@
|
|
#include "system.h"
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
+#include <stdint.h>
|
|
|
|
extern char *spec_types[];
|
|
|
|
@@ -95,13 +96,13 @@
|
|
|
|
|
|
// these read and writes, allways read/write Intel endian-ness
|
|
- unsigned short read_short();
|
|
- unsigned long read_long();
|
|
- unsigned char read_byte();
|
|
+ uint16_t read_uint16();
|
|
+ uint32_t read_uint32();
|
|
+ uint8_t read_uint8();
|
|
double read_double();
|
|
- void write_short(unsigned short x);
|
|
- void write_long(unsigned long x);
|
|
- void write_byte(unsigned char x);
|
|
+ void write_uint16(uint16_t x);
|
|
+ void write_uint32(uint32_t x);
|
|
+ void write_uint8(uint8_t x);
|
|
void write_double(double x);
|
|
void set_read_buffer_size(long size);
|
|
} ;
|
|
@@ -192,17 +193,17 @@
|
|
unsigned long data_size,
|
|
char *link_filename=NULL);*/
|
|
|
|
-unsigned short read_short(FILE *fp);
|
|
-unsigned long read_long(FILE *fp);
|
|
-unsigned short read_other_long(FILE *fp);
|
|
-unsigned long read_other_short(FILE *fp);
|
|
-unsigned char read_byte(FILE *fp);
|
|
-
|
|
-void write_short(FILE *fp, unsigned short x);
|
|
-void write_long(FILE *fp, unsigned long x);
|
|
-void write_other_short(FILE *fp, unsigned short x);
|
|
-void write_other_long(FILE *fp, unsigned long x);
|
|
-void write_byte(FILE *fp, unsigned char x);
|
|
+uint16_t read_uint16(FILE *fp);
|
|
+uint32_t read_uint32(FILE *fp);
|
|
+uint32_t read_other_uint32(FILE *fp);
|
|
+uint16_t read_other_uint16(FILE *fp);
|
|
+uint8_t read_uint8(FILE *fp);
|
|
+
|
|
+void write_uint16(FILE *fp, uint16_t x);
|
|
+void write_uint32(FILE *fp, uint32_t x);
|
|
+void write_other_uint16(FILE *fp, uint16_t x);
|
|
+void write_other_uint32(FILE *fp, uint32_t x);
|
|
+void write_uint8(FILE *fp, uint8_t x);
|
|
|
|
void set_spec_main_file(char *filename, int Search_order);
|
|
void set_file_opener(bFILE *(*open_fun)(char *, char *));
|
|
Index: abuse-sdl-0.7.0/src/imlib/targa.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/targa.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/targa.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -13,11 +13,11 @@
|
|
return 0;
|
|
}
|
|
|
|
- unsigned char id,color_map,im_type;
|
|
+ uint8_t id,color_map,im_type;
|
|
|
|
- id=fp->read_byte();
|
|
- color_map=fp->read_byte();
|
|
- im_type=fp->read_byte();
|
|
+ id=fp->read_uint8();
|
|
+ color_map=fp->read_uint8();
|
|
+ im_type=fp->read_uint8();
|
|
|
|
if (color_map!=0)
|
|
{
|
|
@@ -31,18 +31,18 @@
|
|
return 0;
|
|
}
|
|
|
|
- fp->read_short();
|
|
- fp->read_short();
|
|
- fp->read_byte();
|
|
-
|
|
- fp->read_short();
|
|
- fp->read_short();
|
|
+ fp->read_uint16();
|
|
+ fp->read_uint16();
|
|
+ fp->read_uint8();
|
|
+
|
|
+ fp->read_uint16();
|
|
+ fp->read_uint16();
|
|
|
|
|
|
- int w=fp->read_short();
|
|
- int h=fp->read_short();
|
|
- unsigned char bpp=fp->read_byte();
|
|
- unsigned char im_des=fp->read_byte();
|
|
+ int w=fp->read_uint16();
|
|
+ int h=fp->read_uint16();
|
|
+ uint8_t bpp=fp->read_uint8();
|
|
+ uint8_t im_des=fp->read_uint8();
|
|
|
|
if (bpp!=32)
|
|
{
|
|
@@ -53,8 +53,8 @@
|
|
image *im=new image(w,h);
|
|
|
|
int x,y;
|
|
- unsigned char ctrl;
|
|
- unsigned char bgra[4],*sl,c,lr,lg,lb,ll=0,lc;
|
|
+ uint8_t ctrl;
|
|
+ uint8_t bgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0;
|
|
|
|
|
|
|
|
@@ -67,7 +67,7 @@
|
|
|
|
for (x=0;x<w;)
|
|
{
|
|
- ctrl=fp->read_byte();
|
|
+ ctrl=fp->read_uint8();
|
|
if (ctrl&0x80)
|
|
{
|
|
fp->read(bgra,4);
|
|
Index: abuse-sdl-0.7.0/src/imlib/input.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/input.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/input.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -256,18 +256,18 @@
|
|
{
|
|
case JK_LEFT : if (cur) { draw_cur(wm->dark_color(),screen,wm); cur--;
|
|
draw_cur(wm->bright_color(),screen,wm); } break;
|
|
- case JK_RIGHT : if (cur<strlen(format)-1) { draw_cur(wm->dark_color(),screen,wm); cur++;
|
|
+ case JK_RIGHT : if (cur<(int)strlen(format)-1) { draw_cur(wm->dark_color(),screen,wm); cur++;
|
|
draw_cur(wm->bright_color(),screen,wm); } break;
|
|
case JK_END : if (cur!=last_spot())
|
|
{ draw_cur(wm->dark_color(),screen,wm); cur=last_spot();
|
|
- if (cur==strlen(format)-1) cur--;
|
|
+ if (cur==(int)strlen(format)-1) cur--;
|
|
draw_cur(wm->bright_color(),screen,wm); } break;
|
|
case JK_HOME : if (cur)
|
|
{ draw_cur(wm->dark_color(),screen,wm); cur=0;
|
|
draw_cur(wm->bright_color(),screen,wm); } break;
|
|
case JK_BACKSPACE : if (cur)
|
|
{ draw_cur(wm->dark_color(),screen,wm); cur--;
|
|
- for (xx=cur;xx<strlen(format)-1;xx++)
|
|
+ for (xx=cur;xx<(int)strlen(format)-1;xx++)
|
|
data[xx]=data[xx+1];
|
|
data[strlen(format)-1]=' ';
|
|
draw_text(screen,wm);
|
|
@@ -280,7 +280,7 @@
|
|
for (xx=strlen(format)-1;xx>cur && xx>0;xx--)
|
|
data[xx]=data[xx-1];
|
|
data[cur]=ev.key;
|
|
- if (cur<strlen(format)-1)
|
|
+ if (cur<(int)strlen(format)-1)
|
|
cur++;
|
|
data[strlen(format)]=0;
|
|
draw_text(screen,wm);
|
|
@@ -334,7 +334,7 @@
|
|
double Data, ifield *Next)
|
|
{
|
|
char num[20];
|
|
- sprintf(num,"%Lg",Data);
|
|
+ sprintf(num,"%g",Data);
|
|
int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num));
|
|
x=X; y=Y; id=ID;
|
|
prompt=strcpy((char *)jmalloc(strlen(Prompt)+1,"text_field::prompt"),Prompt);
|
|
Index: abuse-sdl-0.7.0/src/imlib/dprint.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/dprint.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/dprint.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -20,8 +20,7 @@
|
|
{
|
|
if (dprint_fun)
|
|
{
|
|
- char st[1000],a,*sp;
|
|
- int y;
|
|
+ char st[1000];
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
|
Index: abuse-sdl-0.7.0/src/imlib/gifread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/gifread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/gifread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -14,30 +14,30 @@
|
|
|
|
|
|
struct {
|
|
- unsigned short int Width;
|
|
- unsigned short int Height;
|
|
- unsigned char ColorMap[3][256];
|
|
- unsigned short int BitPixel;
|
|
- unsigned short int ColorResolution;
|
|
- unsigned short int Background;
|
|
- unsigned short int AspectRatio;
|
|
+ uint16_t Width;
|
|
+ uint16_t Height;
|
|
+ uint8_t ColorMap[3][256];
|
|
+ uint16_t BitPixel;
|
|
+ uint16_t ColorResolution;
|
|
+ uint16_t Background;
|
|
+ uint16_t AspectRatio;
|
|
} GifScreen;
|
|
|
|
struct {
|
|
- unsigned short int w,h;
|
|
- unsigned char color_info,background,reserved;
|
|
+ uint16_t w,h;
|
|
+ uint8_t color_info,background,reserved;
|
|
} gif_screen;
|
|
|
|
struct {
|
|
- unsigned short int xoff,yoff,w,h;
|
|
- unsigned char color_info;
|
|
+ uint16_t xoff,yoff,w,h;
|
|
+ uint8_t color_info;
|
|
} gif_image;
|
|
|
|
image *read_gif(char *fn, palette *&pal)
|
|
{
|
|
char buf[100],er;
|
|
- unsigned char sep;
|
|
- int ncolors;
|
|
+ uint8_t sep;
|
|
+ unsigned int ncolors;
|
|
FILE *fp;
|
|
image *im;
|
|
clear_errors();
|
|
@@ -52,13 +52,13 @@
|
|
buf[6]=0;
|
|
if (!strcmp("GIF87a",buf))
|
|
{
|
|
- fread((char *)&gif_screen.w,2,1,fp);
|
|
- gif_screen.w=int_to_local(gif_screen.w);
|
|
- fread((char *)&gif_screen.h,2,1,fp);
|
|
- gif_screen.h=int_to_local(gif_screen.h);
|
|
- fread((char *)&gif_screen.color_info,1,1,fp);
|
|
- fread((char *)&gif_screen.background,1,1,fp);
|
|
- if (fread((char *)&gif_screen.reserved,1,1,fp)==1)
|
|
+ fread((uint8_t *)&gif_screen.w,2,1,fp);
|
|
+ gif_screen.w=uint16_to_local(gif_screen.w);
|
|
+ fread((uint8_t *)&gif_screen.h,2,1,fp);
|
|
+ gif_screen.h=uint16_to_local(gif_screen.h);
|
|
+ fread((uint8_t *)&gif_screen.color_info,1,1,fp);
|
|
+ fread((uint8_t *)&gif_screen.background,1,1,fp);
|
|
+ if (fread((uint8_t *)&gif_screen.reserved,1,1,fp)==1)
|
|
{
|
|
if (gif_screen.color_info&128)
|
|
{
|
|
@@ -68,24 +68,24 @@
|
|
pal=new palette(256);
|
|
if (pal)
|
|
{
|
|
- if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
|
|
+ if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
|
|
} else er=imMEMORY_ERROR;
|
|
}
|
|
if (!er)
|
|
{ do
|
|
{
|
|
- if (fread((char *)&sep,1,1,fp)!=1)
|
|
+ if (fread((uint8_t *)&sep,1,1,fp)!=1)
|
|
er=imREAD_ERROR;
|
|
} while (!er && sep!=',');
|
|
- fread((char *)&gif_image.xoff,2,1,fp);
|
|
- gif_image.xoff=int_to_local(gif_image.xoff);
|
|
- fread((char *)&gif_image.yoff,2,1,fp);
|
|
- gif_image.yoff=int_to_local(gif_image.yoff);
|
|
- fread((char *)&gif_image.w,2,1,fp);
|
|
- gif_image.w=int_to_local(gif_image.w);
|
|
- fread((char *)&gif_image.h,2,1,fp);
|
|
- gif_image.h=int_to_local(gif_image.h);
|
|
- if (!er && (fread((char *)&gif_image.color_info,1,1,fp)==1))
|
|
+ fread((uint8_t *)&gif_image.xoff,2,1,fp);
|
|
+ gif_image.xoff=uint16_to_local(gif_image.xoff);
|
|
+ fread((uint8_t *)&gif_image.yoff,2,1,fp);
|
|
+ gif_image.yoff=uint16_to_local(gif_image.yoff);
|
|
+ fread((uint8_t *)&gif_image.w,2,1,fp);
|
|
+ gif_image.w=uint16_to_local(gif_image.w);
|
|
+ fread((uint8_t *)&gif_image.h,2,1,fp);
|
|
+ gif_image.h=uint16_to_local(gif_image.h);
|
|
+ if (!er && (fread((uint8_t *)&gif_image.color_info,1,1,fp)==1))
|
|
{
|
|
if (gif_image.color_info&128)
|
|
{
|
|
@@ -94,7 +94,7 @@
|
|
make_block(sizeof(palette));
|
|
pal = new palette(ncolors);
|
|
if (pal)
|
|
- { if (fread((char *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
|
|
+ { if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;
|
|
} else er=imMEMORY_ERROR;
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/jmalloc.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/jmalloc.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/jmalloc.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,23 +1,24 @@
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
+#include <stdint.h>
|
|
|
|
#include <specs.hpp>
|
|
//#include <new.h>
|
|
|
|
+#define MEM_CHECK
|
|
//#ifdef MEM_CHECK
|
|
//#define MEM_CLEAR
|
|
//#endif
|
|
|
|
#include "jmalloc.hpp"
|
|
-#define uchar unsigned char
|
|
#define JM_SMALL_SIZE 128 // above 128 bytes is considered to be a big block and no hashing is done
|
|
int alloc_space=ALLOC_SPACE_STATIC;
|
|
|
|
extern void free_up_memory();
|
|
|
|
#ifdef MEM_CHECK
|
|
-long break_mem_point=0; // can be set in debugger, break mem fun will be called when this address is allocated
|
|
+intptr_t break_mem_point=0; // can be set in debugger, break mem fun will be called when this address is allocated
|
|
void break_mem_fun()
|
|
{
|
|
printf("memory breakpoint\n");
|
|
@@ -26,7 +27,7 @@
|
|
|
|
struct memory_node
|
|
{
|
|
- long size;
|
|
+ int32_t size;
|
|
#ifdef MEM_CHECK
|
|
char *name; // name is allocated on regular heap
|
|
#endif // because it is used for debugging purposes
|
|
@@ -37,9 +38,9 @@
|
|
|
|
struct small_block
|
|
{
|
|
- unsigned long size; // size of blocks...
|
|
- unsigned long alloc_list; // bit field saying weither each block is allocated or not.
|
|
- small_block *next; // next small block of same size
|
|
+ uint32_t size; // size of blocks...
|
|
+ uint32_t alloc_list; // bit field saying weither each block is allocated or not.
|
|
+ small_block *next; // next small block of same size
|
|
#ifdef MEM_CHECK
|
|
char *name[32];
|
|
#endif
|
|
@@ -51,23 +52,23 @@
|
|
{
|
|
public :
|
|
|
|
- long block_size; // size of this memory_block
|
|
+ int32_t block_size; // size of this memory_block
|
|
small_block *sblocks[JM_SMALL_SIZE];
|
|
small_block *cblocks[JM_SMALL_SIZE];
|
|
void *addr;
|
|
|
|
memory_node *sfirst,*slast,
|
|
*cfirst;
|
|
- unsigned char block_type;
|
|
+ uint8_t block_type;
|
|
|
|
- void init(void *block, long Block_size, uchar type);
|
|
- void *static_alloc(long size, char *name);
|
|
- void *cache_alloc(long size, char *name);
|
|
+ void init(void *block, int32_t Block_size, uint8_t type);
|
|
+ void *static_alloc(int32_t size, char *name);
|
|
+ void *cache_alloc(int32_t size, char *name);
|
|
void static_free(void *ptr);
|
|
void cache_free(void *ptr);
|
|
- long available();
|
|
- long allocated();
|
|
- long pointer_size(void *ptr);
|
|
+ int32_t available();
|
|
+ int32_t allocated();
|
|
+ int32_t pointer_size(void *ptr);
|
|
void report(FILE *fp);
|
|
void inspect();
|
|
|
|
@@ -87,7 +88,7 @@
|
|
|
|
int block_manager::valid_static_ptr(void *ptr)
|
|
{
|
|
- void *next=(void *)(*(((long *)ptr)-1));
|
|
+ void *next=(void *)(*(((int32_t *)ptr)-1));
|
|
if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation
|
|
{
|
|
small_block *s=(small_block *)next;
|
|
@@ -108,7 +109,7 @@
|
|
|
|
int block_manager::valid_cache_ptr(void *ptr)
|
|
{
|
|
- void *next=(void *)(*(((long *)ptr)-1));
|
|
+ void *next=(void *)(*(((int32_t *)ptr)-1));
|
|
if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation
|
|
{
|
|
small_block *s=(small_block *)next;
|
|
@@ -143,21 +144,21 @@
|
|
small_block *s=bmanage[i].sblocks[size];
|
|
while (s)
|
|
{
|
|
- for (x=0;x<32;x++)
|
|
- if (s->alloc_list&(1<<x))
|
|
- static_list[size]++;
|
|
-
|
|
- s=s->next;
|
|
+ for (x=0;x<32;x++)
|
|
+ if (s->alloc_list&(1<<x))
|
|
+ static_list[size]++;
|
|
+
|
|
+ s=s->next;
|
|
}
|
|
|
|
s=bmanage[i].cblocks[size];
|
|
while (s)
|
|
{
|
|
- for (x=0;x<32;x++)
|
|
- if (s->alloc_list&(1<<x))
|
|
- cache_list[size]++;
|
|
-
|
|
- s=s->next;
|
|
+ for (x=0;x<32;x++)
|
|
+ if (s->alloc_list&(1<<x))
|
|
+ cache_list[size]++;
|
|
+
|
|
+ s=s->next;
|
|
}
|
|
}
|
|
}
|
|
@@ -168,7 +169,7 @@
|
|
memory_node *f=sfirst;
|
|
for (;f;f=f->next); // scan through static big list
|
|
|
|
- int i,bit;
|
|
+ int i,bit=1;
|
|
for (i=0;i<JM_SMALL_SIZE;i++)
|
|
{
|
|
for (small_block *s=sblocks[i];s;s=s->next)
|
|
@@ -176,17 +177,17 @@
|
|
char *addr=((char *)(s+1));
|
|
for (int j=0;j<32;j++)
|
|
{
|
|
- if (s->alloc_list&bit)
|
|
- {
|
|
- void *next=(void *)(*(((long *)addr)));
|
|
- if ((long)next!=(long)s)
|
|
- {
|
|
- fprintf(stderr,"inspect : bad pointer\n");
|
|
- return ;
|
|
- }
|
|
- }
|
|
- bit=bit<<1;
|
|
- addr+=s->size+4;
|
|
+ if (s->alloc_list&bit)
|
|
+ {
|
|
+ void *next=(void *)(*(((intptr_t *)addr)));
|
|
+ if ((intptr_t)next!=(intptr_t)s)
|
|
+ {
|
|
+ fprintf(stderr,"inspect : bad pointer\n");
|
|
+ return ;
|
|
+ }
|
|
+ }
|
|
+ bit=bit<<1;
|
|
+ addr+=s->size+4;
|
|
}
|
|
}
|
|
}
|
|
@@ -214,21 +215,21 @@
|
|
for (small_block *s=sblocks[i];s;s=s->next)
|
|
{
|
|
fprintf(fp,"*** Small Block size = %d ***\n",i);
|
|
- unsigned long x=0,bit=1;
|
|
+ uint32_t bit=1;
|
|
char *addr=((char *)(s+1));
|
|
for (int j=0;j<32;j++)
|
|
{
|
|
- fprintf(fp,"%p ",addr);
|
|
- if (s->alloc_list&bit)
|
|
- {
|
|
+ fprintf(fp,"%p ",addr);
|
|
+ if (s->alloc_list&bit)
|
|
+ {
|
|
#ifdef MEM_CHECK
|
|
- fprintf(fp,"%s\n",s->name[j]);
|
|
+ fprintf(fp,"%s\n",s->name[j]);
|
|
#else
|
|
- fprintf(fp,"allocated\n");
|
|
+ fprintf(fp,"allocated\n");
|
|
#endif
|
|
- } else fprintf(fp,"FREE\n");
|
|
- bit=bit<<1;
|
|
- addr+=s->size+4;
|
|
+ } else fprintf(fp,"FREE\n");
|
|
+ bit=bit<<1;
|
|
+ addr+=s->size+4;
|
|
}
|
|
}
|
|
}
|
|
@@ -251,7 +252,7 @@
|
|
for (small_block *s=cblocks[i];s;s=s->next)
|
|
{
|
|
fprintf(fp,"*** Small Block size = %d ***\n",i);
|
|
- unsigned long x=0,bit=1;
|
|
+ uint32_t bit=1;
|
|
char *addr=((char *)(s+1));
|
|
for (int j=0;j<32;j++)
|
|
{
|
|
@@ -271,17 +272,17 @@
|
|
}
|
|
}
|
|
|
|
-long block_manager::pointer_size(void *ptr)
|
|
+int32_t block_manager::pointer_size(void *ptr)
|
|
{
|
|
- void *next=(void *)(*(((long *)ptr)-1));
|
|
+ void *next=(void *)(*(((intptr_t *)ptr)-1));
|
|
if (next>ptr)
|
|
return ((memory_node *)(((char *)ptr)-sizeof(memory_node)))->size;
|
|
else return ((small_block *)next)->size;
|
|
}
|
|
|
|
-long block_manager::available()
|
|
+int32_t block_manager::available()
|
|
{
|
|
- long size=0;
|
|
+ int32_t size=0;
|
|
memory_node *f;
|
|
for (f=sfirst;f;f=f->next)
|
|
if (f->size<0) size-=f->size;
|
|
@@ -291,9 +292,9 @@
|
|
return size;
|
|
}
|
|
|
|
-long block_manager::allocated()
|
|
+int32_t block_manager::allocated()
|
|
{
|
|
- long size=0;
|
|
+ int32_t size=0;
|
|
memory_node *f;
|
|
for (f=sfirst;f;f=f->next)
|
|
if (f->size>0) size+=f->size;
|
|
@@ -303,7 +304,7 @@
|
|
return size;
|
|
}
|
|
|
|
-void block_manager::init(void *block, long Block_size, uchar type)
|
|
+void block_manager::init(void *block, int32_t Block_size, uint8_t type)
|
|
{
|
|
block_size=Block_size;
|
|
addr=block;
|
|
@@ -323,7 +324,7 @@
|
|
block_type=type;
|
|
}
|
|
|
|
-void *block_manager::static_alloc(long size, char *name)
|
|
+void *block_manager::static_alloc(int32_t size, char *name)
|
|
{
|
|
if (size<JM_SMALL_SIZE)
|
|
{
|
|
@@ -339,15 +340,15 @@
|
|
s->size=size;
|
|
#ifdef MEM_CHECK
|
|
s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
|
|
- if ((long)s==break_mem_point)
|
|
+ if ((intptr_t)s==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
- long *addr=(long *)(((char *)s)+sizeof(small_block));
|
|
- *addr=(long)s;
|
|
+ intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
|
|
+ *addr=(intptr_t)s;
|
|
return (void *)(addr+1); // return first block
|
|
} else
|
|
{
|
|
- int bit=1,i=0,offset=0;
|
|
+ int bit=1,i=0;
|
|
char *addr=((char *)s)+sizeof(small_block);
|
|
while (1) // we already know there is a bit free
|
|
{
|
|
@@ -357,10 +358,10 @@
|
|
#ifdef MEM_CHECK
|
|
s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
|
|
#endif
|
|
- *((long *)addr)=(long)s;
|
|
+ *((intptr_t *)addr)=(intptr_t)s;
|
|
|
|
#ifdef MEM_CHECK
|
|
- if ((long)addr==break_mem_point)
|
|
+ if ((intptr_t)addr==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
|
|
@@ -379,7 +380,7 @@
|
|
if (!s) return NULL;
|
|
s->size=-s->size;
|
|
|
|
- if (s->size-size>sizeof(memory_node)+4) // is there enough space to split the block?
|
|
+ if (s->size-size>(int)sizeof(memory_node)+4) // is there enough space to split the block?
|
|
{
|
|
memory_node *p=(memory_node *)((char *)s+sizeof(memory_node)+size);
|
|
if (s==slast)
|
|
@@ -395,7 +396,7 @@
|
|
#ifdef MEM_CHECK
|
|
s->name=strcpy((char *)malloc(strlen(name)+1),name);
|
|
|
|
- if ((long)s==break_mem_point)
|
|
+ if ((intptr_t)s==break_mem_point)
|
|
break_mem_fun();
|
|
|
|
#endif
|
|
@@ -403,7 +404,7 @@
|
|
}
|
|
|
|
|
|
-void *block_manager::cache_alloc(long size, char *name)
|
|
+void *block_manager::cache_alloc(int32_t size, char *name)
|
|
{
|
|
if (size<JM_SMALL_SIZE)
|
|
{
|
|
@@ -421,16 +422,16 @@
|
|
s->name[0]=strcpy((char *)malloc(strlen(name)+1),name);
|
|
|
|
#endif
|
|
- long *addr=(long *)(((char *)s)+sizeof(small_block));
|
|
- *addr=(long)s;
|
|
+ intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block));
|
|
+ *addr=(intptr_t)s;
|
|
#ifdef MEM_CHECK
|
|
- if ((long)s==break_mem_point)
|
|
+ if ((intptr_t)s==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
return (void *)(addr+1); // return first block
|
|
} else
|
|
{
|
|
- int bit=1,i=0,offset=0;
|
|
+ int bit=1,i=0;
|
|
char *addr=((char *)s)+sizeof(small_block);
|
|
while (1) // we already know there is a bit free
|
|
{
|
|
@@ -439,10 +440,10 @@
|
|
s->alloc_list|=bit;
|
|
#ifdef MEM_CHECK
|
|
s->name[i]=strcpy((char *)malloc(strlen(name)+1),name);
|
|
- if ((long)s==break_mem_point)
|
|
+ if ((intptr_t)s==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
- *((long *)addr)=(long)s;
|
|
+ *((intptr_t *)addr)=(intptr_t)s;
|
|
return (void *)(addr+4);
|
|
}
|
|
i++;
|
|
@@ -458,7 +459,7 @@
|
|
for (;s && -s->size<size;s=s->next) clast=s;
|
|
if (!s) // no current cache space for object, see if we can enlarge the cache space
|
|
{
|
|
- long size_avail=-slast->size;
|
|
+ int32_t size_avail=-slast->size;
|
|
size_avail-=sizeof(memory_node);
|
|
|
|
if (slast->size>0 || size_avail<size) // not enough space
|
|
@@ -472,7 +473,7 @@
|
|
nc->size=size;
|
|
#ifdef MEM_CHECK
|
|
nc->name=strcpy((char *)malloc(strlen(name)+1),name);
|
|
- if ((long)nc==break_mem_point)
|
|
+ if ((intptr_t)nc==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
if (!clast)
|
|
@@ -485,10 +486,10 @@
|
|
|
|
s->size=-s->size;
|
|
|
|
- if (s->size-size>sizeof(memory_node)+4) // is there enough space to split the block?
|
|
+ if (s->size-size>(int)sizeof(memory_node)+4) // is there enough space to split the block?
|
|
{
|
|
memory_node *p=s; // store this position
|
|
- long psize=s->size-size-sizeof(memory_node);
|
|
+ int32_t psize=s->size-size-sizeof(memory_node);
|
|
s=(memory_node *)(((char *)s)+psize+sizeof(memory_node));
|
|
p->size=-psize;
|
|
s->next=p;
|
|
@@ -498,7 +499,7 @@
|
|
}
|
|
#ifdef MEM_CHECK
|
|
s->name=strcpy((char *)malloc(strlen(name)+1),name);
|
|
- if ((long)s==break_mem_point)
|
|
+ if ((intptr_t)s==break_mem_point)
|
|
break_mem_fun();
|
|
#endif
|
|
return (void *)(((char *)s)+sizeof(memory_node));
|
|
@@ -512,7 +513,7 @@
|
|
void block_manager::cache_free(void *ptr)
|
|
{
|
|
// see if this was a small_block allocation
|
|
- void *next=(void *)(*(((long *)ptr)-1));
|
|
+ void *next=(void *)(*(((int32_t *)ptr)-1));
|
|
if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation
|
|
{
|
|
small_block *s=(small_block *)next;
|
|
@@ -595,7 +596,7 @@
|
|
void block_manager::static_free(void *ptr)
|
|
{
|
|
// see if this was a small_block allocation
|
|
- void *next=(void *)(*(((long *)ptr)-1));
|
|
+ void *next=(void *)(*(((int32_t *)ptr)-1));
|
|
if (next && next<ptr) // small allocation
|
|
{
|
|
small_block *s=(small_block *)next;
|
|
@@ -693,8 +694,11 @@
|
|
" - remove TSR's & drivers not needed by ABUSE\n"
|
|
" - add memory to your system\n";
|
|
|
|
-void jmalloc_init(long min_size)
|
|
+void jmalloc_init(int32_t min_size)
|
|
{
|
|
+ fprintf(stderr,"Disabling memory manager, using libc instead\n");
|
|
+ return;
|
|
+
|
|
if (bmanage_total)
|
|
fprintf(stderr,"warning : jmalloc_init called twice\n");
|
|
else
|
|
@@ -703,7 +707,7 @@
|
|
void *mem;
|
|
|
|
#ifdef __POWERPC__
|
|
- long size=jmalloc_max_size-0x10000;
|
|
+ int32_t size=jmalloc_max_size-0x10000;
|
|
for (mem=NULL;!mem && size>0x10000;)
|
|
{
|
|
mem=malloc(size+0x10000);
|
|
@@ -712,7 +716,7 @@
|
|
free(mem);
|
|
mem = malloc(size);
|
|
#else
|
|
- long size=jmalloc_max_size;
|
|
+ int32_t size=jmalloc_max_size;
|
|
for (mem=NULL;!mem && size>0x4000;)
|
|
{
|
|
mem=malloc(size);
|
|
@@ -721,9 +725,9 @@
|
|
#endif
|
|
if (mem)
|
|
{
|
|
- bmanage[bmanage_total].init(mem,size,HI_BLOCK);
|
|
- bmanage_total++;
|
|
- fprintf(stderr,"Added himem block (%d bytes)\n",size);
|
|
+ bmanage[bmanage_total].init(mem,size,HI_BLOCK);
|
|
+ bmanage_total++;
|
|
+ fprintf(stderr,"Added himem block (%d bytes)\n",size);
|
|
}
|
|
|
|
/* bmanage[bmanage_total].init(malloc(2039552),2039552,HI_BLOCK);
|
|
@@ -731,59 +735,55 @@
|
|
bmanage[bmanage_total].init(malloc(150224),150224,HI_BLOCK);
|
|
bmanage_total++; */
|
|
|
|
-
|
|
-
|
|
#ifdef __WATCOMC__
|
|
if (size!=jmalloc_max_size)
|
|
{
|
|
do
|
|
{
|
|
- size=low_memory_available();
|
|
- if (size>jmalloc_min_low_size+0x1000) // save 64K for misc low memory needs
|
|
- {
|
|
- bmanage[bmanage_total].init(alloc_low_memory(size-jmalloc_min_low_size-0x1000),size-jmalloc_min_low_size-0x1000,LOW_BLOCK);
|
|
- bmanage_total++;
|
|
- fprintf(stderr,"Added low memory block (%d bytes)\n",size);
|
|
- }
|
|
+ size=low_memory_available();
|
|
+ if (size>jmalloc_min_low_size+0x1000) // save 64K for misc low memory needs
|
|
+ {
|
|
+ bmanage[bmanage_total].init(alloc_low_memory(size-jmalloc_min_low_size-0x1000),size-jmalloc_min_low_size-0x1000,LOW_BLOCK);
|
|
+ bmanage_total++;
|
|
+ fprintf(stderr,"Added low memory block (%d bytes)\n",size);
|
|
+ }
|
|
} while (size>jmalloc_min_low_size+0x1000);
|
|
if (size<jmalloc_min_low_size)
|
|
{
|
|
- fprintf(stderr,not_enough_low_memory_message,size,jmalloc_min_low_size);
|
|
- exit(0);
|
|
+ fprintf(stderr,not_enough_low_memory_message,size,jmalloc_min_low_size);
|
|
+ exit(0);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
-
|
|
fprintf(stderr,"Memory available : %d\n",j_available());
|
|
if (j_available()<min_size)
|
|
{
|
|
fprintf(stderr,not_enough_total_memory_message);
|
|
exit(0);
|
|
}
|
|
-
|
|
}
|
|
}
|
|
|
|
|
|
-long j_available()
|
|
+int32_t j_available()
|
|
{
|
|
- long size=0;
|
|
+ int32_t size=0;
|
|
for (int i=0;i<bmanage_total;i++)
|
|
size+=bmanage[i].available();
|
|
return size;
|
|
}
|
|
|
|
-long j_allocated()
|
|
+int32_t j_allocated()
|
|
{
|
|
- long size=0;
|
|
+ int32_t size=0;
|
|
for (int i=0;i<bmanage_total;i++)
|
|
size+=bmanage[i].allocated();
|
|
return size;
|
|
}
|
|
|
|
|
|
-void *jmalloc(long size, char *name)
|
|
+void *jmalloc(int32_t size, char *name)
|
|
{
|
|
if (!bmanage_total)
|
|
return malloc(size);
|
|
@@ -795,9 +795,13 @@
|
|
{
|
|
void *a;
|
|
if (alloc_space==ALLOC_SPACE_STATIC)
|
|
+ {
|
|
a=bmanage[i].static_alloc(size,name);
|
|
+ }
|
|
else
|
|
+ {
|
|
a=bmanage[i].cache_alloc(size,name);
|
|
+ }
|
|
if (a) return a;
|
|
}
|
|
free_up_memory();
|
|
@@ -832,14 +836,14 @@
|
|
}
|
|
|
|
|
|
-void *jrealloc(void *ptr, long size, char *name)
|
|
+void *jrealloc(void *ptr, int32_t size, char *name)
|
|
{
|
|
if (!ptr) return jmalloc(size,name);
|
|
if (!bmanage_total) { return realloc(ptr,size); }
|
|
|
|
if (size==0) { jfree(ptr); return NULL; }
|
|
|
|
- long old_size=0;
|
|
+ int32_t old_size=0;
|
|
for (int i=0;i<bmanage_total;i++)
|
|
if (ptr>=(void *)bmanage[i].sfirst &&
|
|
ptr<=(void *)(((char *)bmanage[i].sfirst)+bmanage[i].block_size))
|
|
@@ -880,8 +884,8 @@
|
|
void mem_report(char *filename)
|
|
{
|
|
char *reportpath;
|
|
- reportpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + strlen( filename ), "reportpath" );
|
|
- sprintf( reportpath, "%s%s\0", get_save_filename_prefix(), filename );
|
|
+ reportpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + strlen( filename ) + 1, "reportpath" );
|
|
+ sprintf( reportpath, "%s%s", get_save_filename_prefix(), filename );
|
|
|
|
FILE *fp = fopen( reportpath, "wb" );
|
|
if( fp != NULL ) /* make sure we actually got a file */
|
|
@@ -906,9 +910,9 @@
|
|
}
|
|
|
|
|
|
-long small_ptr_size(void *ptr)
|
|
+int32_t small_ptr_size(void *ptr)
|
|
{
|
|
- return ((small_block *)(((long *)ptr)[-1]))->size;
|
|
+ return ((small_block *)(((int32_t *)ptr)[-1]))->size;
|
|
}
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/include.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/include.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/include.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -5,7 +5,8 @@
|
|
{
|
|
char tmp_name[200];
|
|
strcpy(tmp_name,name);
|
|
- int j,append=0,i;
|
|
+ unsigned int j;
|
|
+ int append=0,i;
|
|
for (j=0;j<strlen(name);j++)
|
|
if (toupper(tmp_name[j])<'A' || toupper(tmp_name[j])>'Z')
|
|
tmp_name[j]='_';
|
|
Index: abuse-sdl-0.7.0/src/imlib/scroller.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/scroller.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/scroller.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -3,7 +3,7 @@
|
|
#define HS_ICON_H 8
|
|
|
|
|
|
-unsigned char hs_left_arrow[10*8]={
|
|
+uint8_t hs_left_arrow[10*8]={
|
|
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
|
|
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
|
|
@@ -12,7 +12,7 @@
|
|
2, 0, 0, 0, 0};
|
|
|
|
|
|
-unsigned char hs_right_arrow[10*8]={
|
|
+uint8_t hs_right_arrow[10*8]={
|
|
0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
|
|
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
|
|
@@ -21,7 +21,7 @@
|
|
1, 1, 0, 0, 0};
|
|
|
|
|
|
-unsigned char vs_up_arrow[8*10]={
|
|
+uint8_t vs_up_arrow[8*10]={
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0,
|
|
0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2,
|
|
1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
|
|
@@ -30,7 +30,7 @@
|
|
0, 2, 2, 0, 0};
|
|
|
|
|
|
-unsigned char vs_down_arrow[8*10]={
|
|
+uint8_t vs_down_arrow[8*10]={
|
|
0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0,
|
|
0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 2,
|
|
0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1,
|
|
@@ -38,11 +38,11 @@
|
|
1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0};
|
|
|
|
-void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, unsigned char *buf)
|
|
+void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, uint8_t *buf)
|
|
{
|
|
short cx1,cy1,cx2,cy2;
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
- unsigned char remap[3];
|
|
+ uint8_t remap[3];
|
|
remap[0]=wm->medium_color();
|
|
remap[1]=wm->bright_color();
|
|
remap[2]=wm->dark_color();
|
|
@@ -51,7 +51,7 @@
|
|
{
|
|
if (y>=cy1 && y<=cy2)
|
|
{
|
|
- unsigned char *sl=screen->scan_line(y)+x;
|
|
+ uint8_t *sl=screen->scan_line(y)+x;
|
|
for (int xc=icw,xo=x;xc;xc--,xo++,sl++,buf++)
|
|
{
|
|
if (xo>=cx1 && xo<=cx2)
|
|
@@ -87,13 +87,13 @@
|
|
int scroller::bh() { if (vert) return 15; else return 13; }
|
|
int scroller::bw() { if (vert) return 12; else return 14; }
|
|
|
|
-unsigned char *scroller::b1()
|
|
+uint8_t *scroller::b1()
|
|
{
|
|
if (vert) return vs_up_arrow;
|
|
else return hs_left_arrow;
|
|
}
|
|
|
|
-unsigned char *scroller::b2()
|
|
+uint8_t *scroller::b2()
|
|
{
|
|
if (vert) return vs_down_arrow;
|
|
else return hs_right_arrow;
|
|
@@ -347,7 +347,7 @@
|
|
void scroller::scroll_event(int newx, image *screen, window_manager *wm)
|
|
{
|
|
screen->bar(x,y,x+l-1,y+h-1,wm->black());
|
|
- int xa,ya,xo,yo;
|
|
+ int xa,ya,xo=0,yo;
|
|
if (vert) { xa=0; ya=30; yo=x+5; yo=y+5; } else { xa=30; ya=0; xo=x+5; yo=y+5; }
|
|
for (int i=newx,c=0;c<30 && i<100;i++,c++)
|
|
{
|
|
@@ -390,7 +390,7 @@
|
|
qsort((void *)lis,num_entries,sizeof(pick_list_item),lis_sort);
|
|
|
|
for (i=0;i<t;i++)
|
|
- if (strlen(List[i])>wid)
|
|
+ if ((int)strlen(List[i])>wid)
|
|
wid=strlen(List[i]);
|
|
cur_sel=sx=start_yoffset;
|
|
}
|
|
@@ -425,11 +425,11 @@
|
|
{
|
|
int found=-1;
|
|
if (key_hist_total<20)
|
|
- key_hist[key_hist_total++]=ev.key;
|
|
+ key_hist[(int)(key_hist_total++)]=ev.key;
|
|
|
|
for (int i=0;i<t && found==-1;i++)
|
|
{
|
|
- if (strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0)
|
|
+ if ((int)strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0)
|
|
found=i;
|
|
}
|
|
if (found!=-1)
|
|
@@ -479,7 +479,7 @@
|
|
screen->set_clip(x,y,x+l-1,y+h-1);
|
|
int tw=(l+tex->width()-1)/tex->width();
|
|
int th=(h+tex->height()-1)/tex->height();
|
|
- int dy=y,dx;
|
|
+ int dy=y;
|
|
for (int j=0;j<th;j++,dy+=tex->height())
|
|
for (int i=0,dx=x;i<tw;i++,dx+=tex->width())
|
|
tex->put_image(screen,dx,dy);
|
|
@@ -552,7 +552,7 @@
|
|
sx=t-1;
|
|
if (m)
|
|
{
|
|
- select=(uchar *)jmalloc((t+7)/8,"selection bit array");
|
|
+ select=(uint8_t *)jmalloc((t+7)/8,"selection bit array");
|
|
memset(select,0,(t+7)/8);
|
|
} else cur_sel=0;
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/imlib/filter.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/filter.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/filter.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -171,7 +171,7 @@
|
|
color_filter::color_filter(spec_entry *e, bFILE *fp)
|
|
{
|
|
fp->seek(e->offset,0);
|
|
- fp->read_short();
|
|
+ fp->read_uint16();
|
|
int colors=32;
|
|
color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded");
|
|
fp->read(color_table,colors*colors*colors);
|
|
@@ -186,7 +186,7 @@
|
|
int color_filter::write(bFILE *fp)
|
|
{
|
|
int colors=32;
|
|
- fp->write_short(colors);
|
|
+ fp->write_uint16(colors);
|
|
return fp->write(color_table,colors*colors*colors)==colors*colors*colors;
|
|
}
|
|
|
|
@@ -219,8 +219,8 @@
|
|
|
|
screen->add_dirty(x,y,x+xl-1,y+yl-1);
|
|
|
|
- uchar *pg1=screen->scan_line(y),*source,*dest;
|
|
- uchar *pg2=im->scan_line(y1);
|
|
+ uint8_t *pg1=screen->scan_line(y),*source,*dest;
|
|
+ uint8_t *pg2=im->scan_line(y1);
|
|
int i;
|
|
for (int j=0;j<yl;j++)
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/imlib/pcxread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/pcxread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/pcxread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -17,17 +17,17 @@
|
|
if (!fread(&PCX_header.version,1,1,fp)) return 0;
|
|
if (!fread(&PCX_header.encoding,1,1,fp)) return 0;
|
|
if (!fread(&PCX_header.bits_per_pixel,1,1,fp)) return 0;
|
|
- PCX_header.xmin=read_short(fp);
|
|
- PCX_header.ymin=read_short(fp);
|
|
- PCX_header.xmax=read_short(fp);
|
|
- PCX_header.ymax=read_short(fp);
|
|
- PCX_header.hres=read_short(fp);
|
|
- PCX_header.vres=read_short(fp);
|
|
+ PCX_header.xmin=read_uint16(fp);
|
|
+ PCX_header.ymin=read_uint16(fp);
|
|
+ PCX_header.xmax=read_uint16(fp);
|
|
+ PCX_header.ymax=read_uint16(fp);
|
|
+ PCX_header.hres=read_uint16(fp);
|
|
+ PCX_header.vres=read_uint16(fp);
|
|
if (!fread(PCX_header.palette,1,48,fp)) return 0;
|
|
if (!fread(&PCX_header.reserved,1,1,fp)) return 0;
|
|
if (!fread(&PCX_header.color_planes,1,1,fp)) return 0;
|
|
- PCX_header.bytes_per_line=read_short(fp);
|
|
- PCX_header.palette_type=read_short(fp);
|
|
+ PCX_header.bytes_per_line=read_uint16(fp);
|
|
+ PCX_header.palette_type=read_uint16(fp);
|
|
if (!fread(PCX_header.filter,1,58,fp)) return 0;
|
|
return 1;
|
|
}
|
|
@@ -38,17 +38,17 @@
|
|
if (!fwrite(&PCX_header.version,1,1,fp)) return 0;
|
|
if (!fwrite(&PCX_header.encoding,1,1,fp)) return 0;
|
|
if (!fwrite(&PCX_header.bits_per_pixel,1,1,fp)) return 0;
|
|
- write_short(fp,PCX_header.xmin);
|
|
- write_short(fp,PCX_header.ymin);
|
|
- write_short(fp,PCX_header.xmax);
|
|
- write_short(fp,PCX_header.ymax);
|
|
- write_short(fp,PCX_header.hres);
|
|
- write_short(fp,PCX_header.vres);
|
|
+ write_uint16(fp,PCX_header.xmin);
|
|
+ write_uint16(fp,PCX_header.ymin);
|
|
+ write_uint16(fp,PCX_header.xmax);
|
|
+ write_uint16(fp,PCX_header.ymax);
|
|
+ write_uint16(fp,PCX_header.hres);
|
|
+ write_uint16(fp,PCX_header.vres);
|
|
if (!fwrite(PCX_header.palette,1,48,fp)) return 0;
|
|
if (!fwrite(&PCX_header.reserved,1,1,fp)) return 0;
|
|
if (!fwrite(&PCX_header.color_planes,1,1,fp)) return 0;
|
|
- write_short(fp,PCX_header.bytes_per_line);
|
|
- write_short(fp,PCX_header.palette_type);
|
|
+ write_uint16(fp,PCX_header.bytes_per_line);
|
|
+ write_uint16(fp,PCX_header.palette_type);
|
|
if (!fwrite(PCX_header.filter,1,58,fp)) return 0;
|
|
return 1;
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/imlib/readwav.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/readwav.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/readwav.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -37,30 +37,30 @@
|
|
void read_chunk(wav_chunk &chunk, bFILE *fp)
|
|
{
|
|
fp->read(&chunk.id,4);
|
|
- chunk.size=fp->read_long();
|
|
+ chunk.size=fp->read_uint32();
|
|
fp->read(&chunk.type,4);
|
|
}
|
|
|
|
void read_tag(wav_tag &tag, bFILE *fp)
|
|
{
|
|
fp->read(&tag.id,4);
|
|
- tag.size=fp->read_long();
|
|
+ tag.size=fp->read_uint32();
|
|
}
|
|
|
|
void read_wav_format(wav_format &fmt, bFILE *fp)
|
|
{
|
|
- fmt.fmt_tag=fp->read_short();
|
|
- fmt.channels=fp->read_short();
|
|
- fmt.samplesps=fp->read_long();
|
|
- fmt.avg_bytesps=fp->read_long();
|
|
- fmt.align=fp->read_short();
|
|
+ fmt.fmt_tag=fp->read_uint16();
|
|
+ fmt.channels=fp->read_uint16();
|
|
+ fmt.samplesps=fp->read_uint32();
|
|
+ fmt.avg_bytesps=fp->read_uint32();
|
|
+ fmt.align=fp->read_uint16();
|
|
}
|
|
|
|
|
|
void read_pcm(pcm_wave &pcm, bFILE *fp)
|
|
{
|
|
read_wav_format(pcm.wf,fp);
|
|
- pcm.bitsps=fp->read_short();
|
|
+ pcm.bitsps=fp->read_uint16();
|
|
}
|
|
|
|
|
|
@@ -77,26 +77,26 @@
|
|
|
|
/*************** Write the chunk ***************************/
|
|
fp->write((void *)"RIFF",4);
|
|
- fp->write_long(data_size+36);
|
|
+ fp->write_uint32(data_size+36);
|
|
fp->write((void *)"WAVE",4);
|
|
|
|
|
|
/************** Write the tag *******************************/
|
|
fp->write((void *)"fmt ",4);
|
|
- fp->write_long(16);
|
|
+ fp->write_uint32(16);
|
|
|
|
|
|
/************** Write PCM ***********************************/
|
|
- fp->write_short(1); // format_tag
|
|
- fp->write_short(1); // mono recording
|
|
- fp->write_long(sample_rate);
|
|
- fp->write_long(sample_rate); // average bytes per sec
|
|
- fp->write_short(1); // allignment? Don't know what this does?
|
|
- fp->write_short(8); // 8 bits per sample
|
|
+ fp->write_uint16(1); // format_tag
|
|
+ fp->write_uint16(1); // mono recording
|
|
+ fp->write_uint32(sample_rate);
|
|
+ fp->write_uint32(sample_rate); // average bytes per sec
|
|
+ fp->write_uint16(1); // alignment? Don't know what this does?
|
|
+ fp->write_uint16(8); // 8 bits per sample
|
|
|
|
/************* Write data tag ******************************/
|
|
fp->write((void *)"data",4);
|
|
- fp->write_long(data_size);
|
|
+ fp->write_uint32(data_size);
|
|
|
|
/************ Now write sample data ************************/
|
|
fp->write(data,data_size);
|
|
@@ -154,7 +154,7 @@
|
|
ERROR((unsigned int)fp->read(data,tag.size)==tag.size,"Premature end of file");
|
|
ERROR(pcm.bitsps==8,"Only 8-bit samples supported");
|
|
ERROR(pcm.wf.channels==1,"Only mono samples supported");
|
|
- ERROR(pcm.wf.align==1,"Bad block allignment");
|
|
+ ERROR(pcm.wf.align==1,"Bad block alignment");
|
|
delete fp;
|
|
return data;
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/imlib/xwdread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/xwdread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/xwdread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -122,25 +122,25 @@
|
|
int bits_per_item, bits_used, bit_shift, bits_per_pixel, pixel_mask;
|
|
int bit_order, byte_swap;
|
|
char buf[4];
|
|
-unsigned char *byteP;
|
|
-unsigned short *shortP;
|
|
-unsigned long *longP;
|
|
+uint8_t *byteP;
|
|
+uint16_t *shortP;
|
|
+uint32_t *longP;
|
|
|
|
|
|
-int bs_int(int s);
|
|
-long bs_long(long s);
|
|
-short bs_short(short s );
|
|
+uint32_t bs_uint32(uint32_t s);
|
|
+uint16_t bs_uint16(uint16_t s );
|
|
|
|
|
|
image *getinit(FILE *file, palette *&pal, int *padrightP)
|
|
{
|
|
/* Assume X11 headers are larger than X10 ones. */
|
|
- unsigned char header[sizeof(X11WDFileHeader)];
|
|
+ uint8_t header[sizeof(X11WDFileHeader)];
|
|
image *im;
|
|
X11WDFileHeader *h11P;
|
|
char junk[800];
|
|
- int i, dummy1, dummy2, dummy3;
|
|
- unsigned short minred, maxred;
|
|
+ unsigned int i;
|
|
+ int dummy1, dummy2, dummy3;
|
|
+ uint16_t minred, maxred;
|
|
X11XColor x11col;
|
|
|
|
h11P = (X11WDFileHeader *) header;
|
|
@@ -273,16 +273,16 @@
|
|
bit_order = h11P->bitmap_bit_order;
|
|
pixel_mask = ( 1 << bits_per_pixel ) - 1;
|
|
|
|
- byteP = (unsigned char *) buf;
|
|
- shortP = (unsigned short *) buf;
|
|
- longP = (unsigned long *) buf;
|
|
+ byteP = (uint8_t *) buf;
|
|
+ shortP = (uint16_t *) buf;
|
|
+ longP = (uint32_t *) buf;
|
|
return im;
|
|
}
|
|
|
|
void getimage(FILE *file,image *im,int pad)
|
|
{
|
|
int i,j;
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
#if BYTE_ORDER!=BIG_ENDIAN
|
|
printf("little guys\n");
|
|
#endif
|
|
@@ -312,9 +312,9 @@
|
|
case 8:
|
|
break;
|
|
|
|
- case 16: *shortP=short_swap(*shortP); break;
|
|
+ case 16: *shortP=uint16_swap(*shortP); break;
|
|
|
|
- case 32: *longP=long_swap(*longP); break;
|
|
+ case 32: *longP=uint32_swap(*longP); break;
|
|
|
|
default:
|
|
fprintf(stderr, "can't happen" );
|
|
@@ -355,26 +355,26 @@
|
|
}
|
|
|
|
|
|
-short bs_short(short s )
|
|
+uint16_t bs_uint16(uint16_t s )
|
|
{
|
|
- short ss;
|
|
- unsigned char *bp, t;
|
|
+ uint16_t ss;
|
|
+ uint8_t *bp, t;
|
|
|
|
ss = s;
|
|
- bp = (unsigned char *) &ss;
|
|
+ bp = (uint8_t *) &ss;
|
|
t = bp[0];
|
|
bp[0] = bp[1];
|
|
bp[1] = t;
|
|
return ss;
|
|
}
|
|
|
|
-int bs_int(int i )
|
|
+uint32_t bs_uint32(uint32_t l )
|
|
{
|
|
- int ii;
|
|
- unsigned char *bp, t;
|
|
+ uint32_t ii;
|
|
+ uint8_t *bp, t;
|
|
|
|
- ii = i;
|
|
- bp = (unsigned char *) ⅈ
|
|
+ ii = l;
|
|
+ bp = (uint8_t *) ⅈ
|
|
t = bp[0];
|
|
bp[0] = bp[3];
|
|
bp[3] = t;
|
|
@@ -384,18 +384,13 @@
|
|
return ii;
|
|
}
|
|
|
|
-long bs_long(long l )
|
|
-{
|
|
- return bs_int( l );
|
|
-}
|
|
-
|
|
struct BMP_header
|
|
{
|
|
char id[2];
|
|
long filesize;
|
|
- short reserved[2];
|
|
+ int16_t reserved[2];
|
|
long headersize,infosize,width,height;
|
|
- short biplanes,bits;
|
|
+ int16_t biplanes,bits;
|
|
long bicompression, bisizeimage, bixpelspermeter, biypelspermeter,
|
|
biclrused,biclrimportant;
|
|
} bmp;
|
|
@@ -403,20 +398,20 @@
|
|
int read_BMP_header(FILE *fp)
|
|
{
|
|
if (!fread(&bmp.id,1,2,fp)) return 0; // 2 0
|
|
- bmp.filesize=read_long(fp); // 4 4
|
|
+ bmp.filesize=read_uint32(fp); // 4 4
|
|
if (!fread(bmp.reserved,1,4,fp)) return 0; // 4 8
|
|
- bmp.headersize=read_long(fp); // 4 12
|
|
- bmp.infosize=read_long(fp); // 4 16
|
|
- bmp.width=read_long(fp); // 4 20
|
|
- bmp.height=read_long(fp); // 4 24
|
|
- bmp.biplanes=read_short(fp); // 2 26
|
|
- bmp.bits=read_short(fp); // 2 28
|
|
- bmp.bicompression=read_long(fp); // 4 32
|
|
- bmp.bisizeimage=read_long(fp); // 4 36
|
|
- bmp.bixpelspermeter=read_long(fp); // 4 40
|
|
- bmp.biypelspermeter=read_long(fp); // 4 44
|
|
- bmp.biclrused=read_long(fp); // 4 48
|
|
- bmp.biclrimportant=read_long(fp); // 4 52
|
|
+ bmp.headersize=read_uint32(fp); // 4 12
|
|
+ bmp.infosize=read_uint32(fp); // 4 16
|
|
+ bmp.width=read_uint32(fp); // 4 20
|
|
+ bmp.height=read_uint32(fp); // 4 24
|
|
+ bmp.biplanes=read_uint16(fp); // 2 26
|
|
+ bmp.bits=read_uint16(fp); // 2 28
|
|
+ bmp.bicompression=read_uint32(fp); // 4 32
|
|
+ bmp.bisizeimage=read_uint32(fp); // 4 36
|
|
+ bmp.bixpelspermeter=read_uint32(fp); // 4 40
|
|
+ bmp.biypelspermeter=read_uint32(fp); // 4 44
|
|
+ bmp.biclrused=read_uint32(fp); // 4 48
|
|
+ bmp.biclrimportant=read_uint32(fp); // 4 52
|
|
return 1;
|
|
|
|
}
|
|
@@ -458,11 +453,11 @@
|
|
if (!im)
|
|
return NULL;
|
|
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
int trailer=im->width()%4;
|
|
if (trailer==1) trailer=3;
|
|
else if (trailer==3) trailer=1;
|
|
- uchar buf[9];
|
|
+ uint8_t buf[9];
|
|
for (i=im->height();i;i--)
|
|
{
|
|
sl=im->scan_line(i-1);
|
|
@@ -485,7 +480,7 @@
|
|
{
|
|
image *im;
|
|
FILE *fp;
|
|
- unsigned char pal_quad[4];
|
|
+ uint8_t pal_quad[4];
|
|
char *scrap;
|
|
int bytes,i;
|
|
fp=fopen(filename,"rb");
|
|
@@ -528,20 +523,20 @@
|
|
int write_BMP_header(FILE *fp)
|
|
{
|
|
if (!fwrite(&bmp.id,1,2,fp)) return 0;
|
|
- write_long(fp,bmp.filesize);
|
|
+ write_uint32(fp,bmp.filesize);
|
|
if (!fwrite(bmp.reserved,1,4,fp)) return 0;
|
|
- write_long(fp,bmp.headersize);
|
|
- write_long(fp,bmp.infosize);
|
|
- write_long(fp,bmp.width);
|
|
- write_long(fp,bmp.height);
|
|
- write_short(fp,bmp.biplanes);
|
|
- write_short(fp,bmp.bits);
|
|
- write_long(fp,bmp.bicompression);
|
|
- write_long(fp,bmp.bisizeimage);
|
|
- write_long(fp,bmp.bixpelspermeter);
|
|
- write_long(fp,bmp.biypelspermeter);
|
|
- write_long(fp,bmp.biclrused);
|
|
- write_long(fp,bmp.biclrimportant);
|
|
+ write_uint32(fp,bmp.headersize);
|
|
+ write_uint32(fp,bmp.infosize);
|
|
+ write_uint32(fp,bmp.width);
|
|
+ write_uint32(fp,bmp.height);
|
|
+ write_uint16(fp,bmp.biplanes);
|
|
+ write_uint16(fp,bmp.bits);
|
|
+ write_uint32(fp,bmp.bicompression);
|
|
+ write_uint32(fp,bmp.bisizeimage);
|
|
+ write_uint32(fp,bmp.bixpelspermeter);
|
|
+ write_uint32(fp,bmp.biypelspermeter);
|
|
+ write_uint32(fp,bmp.biclrused);
|
|
+ write_uint32(fp,bmp.biclrimportant);
|
|
return 1;
|
|
|
|
}
|
|
@@ -550,7 +545,7 @@
|
|
{
|
|
FILE *fp;
|
|
int i,bytes;
|
|
- unsigned char pal_quad[4];
|
|
+ uint8_t pal_quad[4];
|
|
fp=fopen(filename,"wb");
|
|
if (!fp)
|
|
{ printf("Error : unable to open %s for writing!\n",filename);
|
|
Index: abuse-sdl-0.7.0/src/imlib/readxwd.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/readxwd.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/readxwd.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -105,9 +105,8 @@
|
|
long *longP;
|
|
|
|
|
|
-int bs_int(int s);
|
|
-long bs_long(long s);
|
|
-short bs_short(short s );
|
|
+int32_t bs_int32(int32_t s);
|
|
+int16_t bs_int16(int16_t s );
|
|
|
|
|
|
HBITMAP getinit(FILE *file, palette *&pal, int *padrightP, int &xres, int &yres);)
|
|
@@ -324,7 +323,7 @@
|
|
}
|
|
|
|
|
|
-short bs_short(short s )
|
|
+short bs_int16(short s )
|
|
{
|
|
short ss;
|
|
unsigned char *bp, t;
|
|
@@ -337,13 +336,13 @@
|
|
return ss;
|
|
}
|
|
|
|
-int bs_int(int i )
|
|
+int32_t bs_int32(int32_t l )
|
|
{
|
|
- int ii;
|
|
- unsigned char *bp, t;
|
|
+ int32_t ii;
|
|
+ uint8_t *bp, t;
|
|
|
|
ii = i;
|
|
- bp = (unsigned char *) ⅈ
|
|
+ bp = (uint8_t *) ⅈ
|
|
t = bp[0];
|
|
bp[0] = bp[3];
|
|
bp[3] = t;
|
|
@@ -353,11 +352,6 @@
|
|
return ii;
|
|
}
|
|
|
|
-long bs_long(long l )
|
|
-{
|
|
- return bs_int( l );
|
|
-}
|
|
-
|
|
struct BMP_header
|
|
{
|
|
char id[2];
|
|
@@ -373,7 +367,7 @@
|
|
{
|
|
FILE *fp;
|
|
int i,bytes;
|
|
- unsigned char pal_quad[4];
|
|
+ uint8_t pal_quad[4];
|
|
// fp=fopen("d:\\windows\\256color.bmp","rb");
|
|
// fread(&bmp,1,sizeof(bmp),fp);
|
|
// fclose(fp);
|
|
@@ -410,9 +404,9 @@
|
|
image *image24(image *im, palette *pal, int rev)
|
|
{
|
|
image *ni;
|
|
- unsigned char *sl1,*sl2;
|
|
+ uint8_t *sl1,*sl2;
|
|
int i,x;
|
|
- unsigned char r,g,b;
|
|
+ uint8_t r,g,b;
|
|
printf("Creating image size (%d, %d)\n",im->width()*3,im->height());
|
|
ni=new image(im->width()*3,im->height());
|
|
printf("Image created\n");
|
|
@@ -428,7 +422,7 @@
|
|
return ni;
|
|
}
|
|
|
|
-unsigned char addb(int n1, int n2)
|
|
+uint8_t addb(int n1, int n2)
|
|
{ int n3;
|
|
n3=n1+n2;
|
|
return n3>255 ? 255 : (n3<0 ? 0 : n3);
|
|
@@ -440,7 +434,7 @@
|
|
image *color_dither(image *im, palette *pal, int rev)
|
|
{
|
|
image *i24;
|
|
- unsigned char min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
|
|
+ uint8_t min[3],max[3],mid[3],*ad,*sl,*sl2,crimp;
|
|
int i,j,x,y,delta;
|
|
(void *)ad=pal->addr();
|
|
|
|
@@ -522,10 +516,10 @@
|
|
display=0,bad=0,bmp=0,land=0,ch,xo=0,yo=0;
|
|
image *im,*i24;
|
|
palette *pal;
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
FILE *fp;
|
|
char def_name[10],*dev_name,*fname=NULL;
|
|
- unsigned char cp[500],mp[500],yp[500],kp[500];
|
|
+ uint8_t cp[500],mp[500],yp[500],kp[500];
|
|
strcpy(def_name,"\\dev\\lp"); // set the default output device to /dev/lp
|
|
// since we are in vpix, however we will use the backslash
|
|
dev_name=def_name; rev=0;
|
|
Index: abuse-sdl-0.7.0/src/imlib/palette.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/palette.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/palette.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -11,7 +11,7 @@
|
|
|
|
palette::palette(bFILE *fp)
|
|
{
|
|
- ncolors=fp->read_short();
|
|
+ ncolors=fp->read_uint16();
|
|
pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
|
|
usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
|
|
set_all_unused();
|
|
@@ -22,7 +22,7 @@
|
|
palette::palette(spec_entry *e, bFILE *fp)
|
|
{
|
|
fp->seek(e->offset,0);
|
|
- ncolors=fp->read_short();
|
|
+ ncolors=fp->read_uint16();
|
|
pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
|
|
usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
|
|
set_all_unused();
|
|
@@ -37,7 +37,7 @@
|
|
|
|
int palette::write(bFILE *fp)
|
|
{
|
|
- fp->write_short(ncolors);
|
|
+ fp->write_uint16(ncolors);
|
|
return fp->write(pal,sizeof(color)*ncolors)==ncolors;
|
|
}
|
|
|
|
@@ -88,13 +88,13 @@
|
|
return find;
|
|
}
|
|
|
|
-long palette::getquad(int x)
|
|
+uint32_t palette::getquad(int x)
|
|
{ char entry[4];
|
|
entry[3]=0;
|
|
entry[2]=pal[x].red;
|
|
entry[1]=pal[x].green;
|
|
entry[0]=pal[x].blue;
|
|
- return *((long *)entry);
|
|
+ return *((uint32_t *)entry);
|
|
}
|
|
|
|
|
|
@@ -481,7 +481,7 @@
|
|
long brv;
|
|
brv=0; bri=0;
|
|
|
|
- for (i=0;i<ncolors;i++)
|
|
+ for (i=0;i<(unsigned int)ncolors;i++)
|
|
{ if (all || used(i))
|
|
{
|
|
get(i,r,g,b);
|
|
@@ -501,7 +501,7 @@
|
|
long brv,x;
|
|
brv=(long)258*(long)258*(long)258; bri=0;
|
|
|
|
- for (i=0;i<ncolors;i++)
|
|
+ for (i=0;i<(unsigned int)ncolors;i++)
|
|
{ if (all || used(i))
|
|
{
|
|
get(i,r,g,b);
|
|
@@ -522,12 +522,16 @@
|
|
|
|
void palette::fade_to(int total_fades, int fade_on, int dest_r, int dest_g, int dest_b)
|
|
{
|
|
- unsigned char *sl=(unsigned char *)addr();
|
|
- int i;
|
|
+ uint8_t *sl=(uint8_t *)addr();
|
|
+ uint8_t x;
|
|
+ int i;
|
|
for (i=0;i<ncolors;i++)
|
|
{
|
|
- *(sl++)=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
|
|
- *(sl++)=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
|
|
- *(sl++)=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);
|
|
+ x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
|
|
+ *(sl++)=x;
|
|
+ x=(( dest_g-(int)*sl)*fade_on/total_fades+*sl);
|
|
+ *(sl++)=x;
|
|
+ x=(( dest_b-(int)*sl)*fade_on/total_fades+*sl);
|
|
+ *(sl++)=x;
|
|
}
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/imlib/glread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/glread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/glread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -8,12 +8,12 @@
|
|
image *read_glfont(char *fn)
|
|
{
|
|
image *im,*sub;
|
|
- unsigned short length,y;
|
|
- unsigned char size,first,width,height,gsize,last;
|
|
+ uint16_t length,y;
|
|
+ uint8_t size,first,width,height,gsize,last;
|
|
FILE *fp;
|
|
fp=fopen(fn,"rb");
|
|
if (!fp) return NULL;
|
|
- fread(&length,1,2,fp); length=int_to_local(length);
|
|
+ fread(&length,1,2,fp); length=uint16_to_local(length);
|
|
fread(&size,1,1,fp);
|
|
fread(&first,1,1,fp);
|
|
if (size+first>255) { set_error(imFILE_CORRUPTED); fclose(fp); return NULL; }
|
|
@@ -44,8 +44,8 @@
|
|
{
|
|
image *im;
|
|
char x[4],bpp;
|
|
- unsigned char *sl=NULL,esc,c,n,marker,vmode;
|
|
- unsigned short w,h,len,bufsize,blocks,sn,esize,edesc;
|
|
+ uint8_t *sl=NULL,esc,c,n,marker,vmode;
|
|
+ uint16_t w,h,len,bufsize,blocks,sn,esize,edesc;
|
|
int xx,yy;
|
|
FILE *fp;
|
|
im=NULL;
|
|
@@ -54,7 +54,7 @@
|
|
fread(&x[0],1,2,fp);
|
|
fread(&w,1,2,fp);
|
|
fread(&h,1,2,fp);
|
|
- w=int_to_local(w); h=int_to_local(h);
|
|
+ w=uint16_to_local(w); h=uint16_to_local(h);
|
|
fread(x,1,4,fp);
|
|
fread(&bpp,1,1,fp);
|
|
fread(&marker,1,1,fp);
|
|
@@ -65,9 +65,9 @@
|
|
|
|
fread(&vmode,1,1,fp);
|
|
fread(&edesc,1,2,fp);
|
|
- edesc=int_to_local(edesc);
|
|
+ edesc=uint16_to_local(edesc);
|
|
fread(&esize,1,2,fp);
|
|
- esize=int_to_local(esize);
|
|
+ esize=uint16_to_local(esize);
|
|
if (esize==768 && !pal)
|
|
{ pal=new palette(1<<bpp);
|
|
fread(pal->addr(),1,(1<<bpp)*3,fp);
|
|
@@ -76,16 +76,16 @@
|
|
else if (esize)
|
|
fseek(fp,esize,SEEK_CUR);
|
|
fread(&blocks,1,2,fp);
|
|
- blocks=int_to_local(blocks);
|
|
+ blocks=uint16_to_local(blocks);
|
|
|
|
yy=h; xx=w;
|
|
|
|
while (blocks-- && w>=1 && yy>=0)
|
|
{
|
|
fread(&bufsize,1,2,fp);
|
|
- bufsize=int_to_local(bufsize);
|
|
+ bufsize=uint16_to_local(bufsize);
|
|
fread(&len,1,2,fp);
|
|
- len=int_to_local(len);
|
|
+ len=uint16_to_local(len);
|
|
fread(&esc,1,1,fp);
|
|
while (yy>=0 && len)
|
|
{
|
|
@@ -112,7 +112,7 @@
|
|
else
|
|
{
|
|
fread(&sn,1,2,fp);
|
|
- sn=int_to_local(sn);
|
|
+ sn=uint16_to_local(sn);
|
|
fread(&c,1,1,fp);
|
|
while (sn-- && yy>=0 && len)
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/imlib/lbmread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/lbmread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/lbmread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -19,7 +19,7 @@
|
|
}
|
|
else
|
|
{
|
|
- long size=read_other_long(fp);
|
|
+ int32_t size=read_other_uint32(fp);
|
|
fread(type,1,4,fp);
|
|
if (memcmp(type,"PBM ",4))
|
|
{
|
|
@@ -29,31 +29,31 @@
|
|
}
|
|
else
|
|
{
|
|
- long offset=12,ssize;
|
|
+ int32_t ssize;
|
|
char stype[4];
|
|
- short w=0,h=0,x,y,tcolor,pagew,pageh;
|
|
- char planes,masking,compr,padl,xa,ya;
|
|
+ int16_t w=0,h=0,x,y,tcolor,pagew,pageh;
|
|
+ char planes,masking,compr=0,padl,xa,ya;
|
|
|
|
while (ftell(fp)+4<size)
|
|
{
|
|
fread(stype,1,4,fp);
|
|
- ssize=read_other_long(fp);
|
|
+ ssize=read_other_uint32(fp);
|
|
if (ssize &1) ssize++; // specs say all chunks are padded by 2
|
|
if (!memcmp(stype,"BMHD",4))
|
|
{
|
|
- w=read_other_short(fp);
|
|
- h=read_other_short(fp);
|
|
- x=read_other_short(fp);
|
|
- y=read_other_short(fp);
|
|
+ w=read_other_uint16(fp);
|
|
+ h=read_other_uint16(fp);
|
|
+ x=read_other_uint16(fp);
|
|
+ y=read_other_uint16(fp);
|
|
planes=fgetc(fp);
|
|
masking=fgetc(fp);
|
|
compr=fgetc(fp);
|
|
padl=fgetc(fp);
|
|
- tcolor=read_other_short(fp);
|
|
+ tcolor=read_other_uint16(fp);
|
|
xa=fgetc(fp);
|
|
ya=fgetc(fp);
|
|
- pagew=read_other_short(fp);
|
|
- pageh=read_other_short(fp);
|
|
+ pagew=read_other_uint16(fp);
|
|
+ pageh=read_other_uint16(fp);
|
|
} else if (!memcmp(stype,"CMAP",4))
|
|
{
|
|
pal=new palette(256);
|
|
@@ -62,7 +62,7 @@
|
|
{
|
|
if (im) delete im; // shouldn't be two BODY's butjust in case...
|
|
im=new image(w,h);
|
|
- int x,y;
|
|
+ int y;
|
|
if (!compr)
|
|
{
|
|
for (y=0;y<h;h++)
|
|
Index: abuse-sdl-0.7.0/src/imlib/timage.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/timage.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/timage.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -2,7 +2,7 @@
|
|
|
|
void trans_image::make_color(int c)
|
|
{
|
|
- unsigned char *dp=data;
|
|
+ uint8_t *dp=data;
|
|
int y,x;
|
|
for (y=0;y<h;y++)
|
|
{
|
|
@@ -24,7 +24,7 @@
|
|
image *trans_image::make_image()
|
|
{
|
|
image *im=new image(w,h);
|
|
- unsigned char *d=im->scan_line(0),*dp=data,*dline;
|
|
+ uint8_t *d=im->scan_line(0),*dp=data,*dline;
|
|
int y,x;
|
|
for (y=0;y<h;y++)
|
|
{
|
|
@@ -53,7 +53,7 @@
|
|
trans_image::trans_image(image *im, char *name)
|
|
{
|
|
int size=0,x,y;
|
|
- unsigned char *sl,*datap,*marker;
|
|
+ uint8_t *sl,*datap,*marker;
|
|
w=im->width();
|
|
h=im->height();
|
|
|
|
@@ -83,9 +83,9 @@
|
|
#ifdef MEM_CHECK
|
|
char st[80];
|
|
sprintf(st,"trans_image::data (%s)",name);
|
|
- data=(unsigned char *)jmalloc(size,st);
|
|
+ data=(uint8_t *)jmalloc(size,st);
|
|
#else
|
|
- data=(unsigned char *)jmalloc(size,"");
|
|
+ data=(uint8_t *)jmalloc(size,"");
|
|
#endif
|
|
int ww=im->width(),hh=im->height();
|
|
datap=data;
|
|
@@ -124,12 +124,12 @@
|
|
|
|
void trans_image::put_scan_line(image *screen, int x, int y, int line) // always transparent
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
if (y+line<y1 || y+line>y2 || x>x2 || x+w-1<x1) // clipped off completely?
|
|
return;
|
|
|
|
- unsigned char *datap=data;
|
|
+ uint8_t *datap=data;
|
|
int ix;
|
|
while (line) // skip scan line data until we get to the line of interest
|
|
{
|
|
@@ -150,7 +150,7 @@
|
|
|
|
|
|
// now slam this list of runs to the screen
|
|
- unsigned char *screen_line=screen->scan_line(y)+x;
|
|
+ uint8_t *screen_line=screen->scan_line(y)+x;
|
|
|
|
for (ix=0;ix<w;)
|
|
{
|
|
@@ -201,14 +201,14 @@
|
|
}
|
|
|
|
|
|
-inline unsigned char *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2,
|
|
+inline uint8_t *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2,
|
|
int x, int &y, int &ysteps)
|
|
{
|
|
// check to see if it is total clipped out first
|
|
if (y+h<=y1 || y>y2 || x>x2 || x+w<=x1)
|
|
return NULL;
|
|
|
|
- register unsigned char *datap=data;
|
|
+ register uint8_t *datap=data;
|
|
|
|
|
|
ysteps=height();
|
|
@@ -244,13 +244,13 @@
|
|
}
|
|
|
|
void trans_image::put_image_filled(image *screen, int x, int y,
|
|
- uchar fill_color)
|
|
+ uint8_t fill_color)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
+ register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
if (!datap) return ; // if clip_y says nothing to draw, return
|
|
|
|
screen_line=screen->scan_line(y)+x;
|
|
@@ -315,11 +315,11 @@
|
|
}
|
|
}
|
|
|
|
-void trans_image::put_image_offseted(image *screen, uchar *s_off) // if screen x & y offset already calculated save a mul
|
|
+void trans_image::put_image_offseted(image *screen, uint8_t *s_off) // if screen x & y offset already calculated save a mul
|
|
{
|
|
int ix,ysteps=height();
|
|
int screen_skip=screen->width()-w;
|
|
- uchar skip,*datap=data;
|
|
+ uint8_t skip,*datap=data;
|
|
for (;ysteps;ysteps--)
|
|
{
|
|
for (ix=0;ix<w;)
|
|
@@ -352,11 +352,11 @@
|
|
|
|
void trans_image::put_image(image *screen, int x, int y)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
+ register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
if (!datap) return ; // if clip_y says nothing to draw, return
|
|
|
|
screen_line=screen->scan_line(y)+x;
|
|
@@ -413,13 +413,13 @@
|
|
}
|
|
}
|
|
|
|
-void trans_image::put_remaped(image *screen, int x, int y, unsigned char *remap)
|
|
+void trans_image::put_remaped(image *screen, int x, int y, uint8_t *remap)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
+ register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
if (!datap) return ; // if clip_y says nothing to draw, return
|
|
|
|
screen_line=screen->scan_line(y)+x;
|
|
@@ -469,7 +469,7 @@
|
|
else
|
|
counter=slam_length;
|
|
|
|
- register unsigned char *sl=screen_line+ix,*sl2=datap;
|
|
+ register uint8_t *sl=screen_line+ix,*sl2=datap;
|
|
ix+=slam_length;
|
|
datap+=slam_length;
|
|
while (counter)
|
|
@@ -489,13 +489,13 @@
|
|
|
|
|
|
|
|
-void trans_image::put_double_remaped(image *screen, int x, int y, unsigned char *remap, unsigned char *remap2)
|
|
+void trans_image::put_double_remaped(image *screen, int x, int y, uint8_t *remap, uint8_t *remap2)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
+ register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
if (!datap) return ; // if clip_y says nothing to draw, return
|
|
|
|
screen_line=screen->scan_line(y)+x;
|
|
@@ -545,7 +545,7 @@
|
|
else
|
|
counter=slam_length;
|
|
|
|
- register unsigned char *sl=screen_line+ix,*sl2=datap;
|
|
+ register uint8_t *sl=screen_line+ix,*sl2=datap;
|
|
ix+=slam_length;
|
|
datap+=slam_length;
|
|
while (counter)
|
|
@@ -569,15 +569,15 @@
|
|
int frame_on, int total_frames,
|
|
color_filter *f, palette *pal)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int ix,slam_length,chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
+ uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
*screen_line;
|
|
if (!datap) return ;
|
|
|
|
- unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
|
|
+ uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
|
|
*caddr1,*caddr2,r_dest,g_dest,b_dest;
|
|
|
|
long fixmul=(frame_on<<16)/total_frames;
|
|
@@ -658,18 +658,18 @@
|
|
|
|
void trans_image::put_fade_tint(image *screen, int x, int y,
|
|
int frame_on, int total_frames,
|
|
- uchar *tint,
|
|
+ uint8_t *tint,
|
|
color_filter *f, palette *pal)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int ix,slam_length,chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
+ uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
*screen_line;
|
|
if (!datap) return ;
|
|
|
|
- unsigned char *screen_run,*paddr=(unsigned char *)pal->addr(),
|
|
+ uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(),
|
|
*caddr1,*caddr2,r_dest,g_dest,b_dest;
|
|
|
|
long fixmul=(frame_on<<16)/total_frames;
|
|
@@ -752,11 +752,11 @@
|
|
|
|
void trans_image::put_color(image *screen, int x, int y, int color)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int ix,slam_length,chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
+ uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
*screen_line;
|
|
if (!datap) return ;
|
|
|
|
@@ -818,12 +818,12 @@
|
|
int blendx, int blendy, int blend_amount, color_filter *f, palette *pal)
|
|
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int ix,slam_length,chop_length,ysteps;
|
|
- unsigned char *paddr=(unsigned char *)pal->addr();
|
|
+ uint8_t *paddr=(uint8_t *)pal->addr();
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
+ uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),
|
|
*blend_line,*screen_line;
|
|
if (!datap) return ;
|
|
CONDITION(y>=blendy && y+ysteps<blendy+blend->height()+1,"Blend doesn't fit on trans_image");
|
|
@@ -875,7 +875,7 @@
|
|
chop_length=x2-x-ix;
|
|
else chop_length=slam_length;
|
|
|
|
- unsigned char *screen_run=screen_line+x+ix,
|
|
+ uint8_t *screen_run=screen_line+x+ix,
|
|
*blend_run=blend_line+x+ix-blendx,
|
|
*caddr1,*caddr2,r_dest,g_dest,b_dest;
|
|
|
|
@@ -917,11 +917,11 @@
|
|
|
|
void trans_image::put_predator(image *screen, int x, int y)
|
|
{
|
|
- short x1,y1,x2,y2;
|
|
+ int16_t x1,y1,x2,y2;
|
|
int chop_length,ysteps;
|
|
|
|
screen->get_clip(x1,y1,x2,y2);
|
|
- register unsigned char *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
+ register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;
|
|
if (!datap) return ; // if clip_y says nothing to draw, return
|
|
|
|
// see if the last scanline is clipped off
|
|
@@ -1001,7 +1001,7 @@
|
|
|
|
int trans_image::size()
|
|
{
|
|
- uchar *d=data;
|
|
+ uint8_t *d=data;
|
|
int t=0;
|
|
for (int y=0;y<h;y++)
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/imlib/packet.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/packet.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/packet.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -4,25 +4,25 @@
|
|
#include <string.h>
|
|
|
|
|
|
-int packet::advance(long offset)
|
|
+int packet::advance(int32_t offset)
|
|
{
|
|
ro+=offset;
|
|
return ro<=rend;
|
|
}
|
|
|
|
-void packet::write_long(ulong x)
|
|
+void packet::write_uint32(uint32_t x)
|
|
{
|
|
x=lltl(x);
|
|
- write((uchar *)&x,4);
|
|
+ write((uint8_t *)&x,4);
|
|
}
|
|
|
|
-void packet::write_short(ushort x)
|
|
+void packet::write_uint16(uint16_t x)
|
|
{
|
|
x=lstl(x);
|
|
- write((uchar *)&x,2);
|
|
+ write((uint8_t *)&x,2);
|
|
}
|
|
|
|
-void packet::write_byte(uchar x)
|
|
+void packet::write_uint8(uint8_t x)
|
|
{
|
|
write(&x,1);
|
|
}
|
|
@@ -40,7 +40,7 @@
|
|
#endif
|
|
|
|
buf_size=1000;
|
|
- buf=(uchar *)jmalloc(buf_size,"packet buffer");
|
|
+ buf=(uint8_t *)jmalloc(buf_size,"packet buffer");
|
|
reset();
|
|
|
|
#ifdef MANAGE_MEM
|
|
@@ -71,11 +71,11 @@
|
|
if (buf_size<max)
|
|
{
|
|
buf_size=max;
|
|
- buf=(uchar *)jrealloc(buf,max,"packet buffer");
|
|
+ buf=(uint8_t *)jrealloc(buf,max,"packet buffer");
|
|
}
|
|
}
|
|
|
|
-int packet::read(uchar *buffer, int size)
|
|
+int packet::read(uint8_t *buffer, int size)
|
|
{
|
|
if (size>rend-ro)
|
|
size=rend-ro;
|
|
@@ -89,7 +89,7 @@
|
|
}
|
|
|
|
|
|
-int packet::write(uchar *buffer, int size)
|
|
+int packet::write(uint8_t *buffer, int size)
|
|
{
|
|
if (size>buf_size-wo)
|
|
make_bigger(wo+size);
|
|
Index: abuse-sdl-0.7.0/src/imlib/mdlread.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/mdlread.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/mdlread.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -10,15 +10,15 @@
|
|
// images. Note, only the mode 320x200x256 is sopprted here for saving
|
|
// images. All images should be sized so they will fit on an mdl screen
|
|
// but no checking of that is done hhere.
|
|
-void write_mdl(image **images, short total_images, palette *pal,char *fn,
|
|
- short firstpage, short images_per_page)
|
|
+void write_mdl(image **images, int16_t total_images, palette *pal,char *fn,
|
|
+ int16_t firstpage, int16_t images_per_page)
|
|
{
|
|
FILE *fp;
|
|
char buf[18];
|
|
- unsigned short xy[2],x;
|
|
+ uint16_t xy[2],x;
|
|
char name[13],page;
|
|
unsigned char *c;
|
|
- short i;
|
|
+ int16_t i;
|
|
palette *np;
|
|
clear_errors();
|
|
CONDITION(images && pal && fn && total_images>0,"bad parms");
|
|
@@ -42,7 +42,7 @@
|
|
{
|
|
memset(buf,0,6); // each image has 6 bytes of reserved 0
|
|
fwrite(buf,6,1,fp);
|
|
- xy[0]=int_to_intel(i%100+20); xy[1]=int_to_intel(30); // the x and y position on the screen
|
|
+ xy[0]=uint16_to_intel(i%100+20); xy[1]=uint16_to_intel(30); // the x and y position on the screen
|
|
fwrite(xy,4,1,fp);
|
|
sprintf(name,"JC%-10d",i); // set the name of the image
|
|
fwrite(name,12,1,fp);
|
|
@@ -50,14 +50,14 @@
|
|
page=firstpage+i/images_per_page;
|
|
|
|
fwrite(&page,1,1,fp); // put all of the image on the first page
|
|
- xy[0]=int_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image
|
|
+ xy[0]=uint16_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image
|
|
|
|
fwrite(xy,2,1,fp);
|
|
- xy[0]=int_to_intel(images[i]->width());
|
|
+ xy[0]=uint16_to_intel(images[i]->width());
|
|
fwrite(xy,2,1,fp);
|
|
- xy[0]=int_to_intel(images[i]->height());
|
|
+ xy[0]=uint16_to_intel(images[i]->height());
|
|
fwrite(xy,2,1,fp);
|
|
- for (x=0;x<(unsigned short)images[i]->height();x++) // write all the scan_lines for the
|
|
+ for (x=0;x<(uint16_t)images[i]->height();x++) // write all the scan_lines for the
|
|
{ c=images[i]->scan_line(x); // image
|
|
fwrite(c,images[i]->width(),1,fp);
|
|
}
|
|
@@ -66,10 +66,10 @@
|
|
}
|
|
}
|
|
|
|
-short mdl_total_images(char *fn)
|
|
+int16_t mdl_total_images(char *fn)
|
|
{
|
|
char buf[800];
|
|
- unsigned short xy[2],t;
|
|
+ uint16_t xy[2],t;
|
|
FILE *fp;
|
|
fp=fopen(fn,"rb");
|
|
if (!fp)
|
|
@@ -91,7 +91,7 @@
|
|
{ if (fread(buf,1,23,fp)==23)
|
|
{
|
|
fread(xy,2,1,fp);
|
|
- xy[0]=int_to_local(xy[0]);
|
|
+ xy[0]=uint16_to_local(xy[0]);
|
|
fseek(fp,xy[0],SEEK_CUR);
|
|
t++;
|
|
}
|
|
@@ -103,12 +103,12 @@
|
|
// read_mdl returns an array containing pointers to all the desired images
|
|
// and a palette that is read form the file
|
|
// to load image numbers 4 through 9 let start =4, end=9
|
|
-image **read_mdl(char *fn, palette *&pal, short startn, short endn, short &total)
|
|
+image **read_mdl(char *fn, palette *&pal, int16_t startn, int16_t endn, int16_t &total)
|
|
{
|
|
FILE *fp;
|
|
image **im;
|
|
char buf[50];
|
|
- unsigned short xy[2],i,j;
|
|
+ uint16_t xy[2],i,j;
|
|
clear_errors();
|
|
make_block(sizeof(FILE));
|
|
im=NULL;
|
|
@@ -146,7 +146,7 @@
|
|
{ if (fread(buf,1,23,fp)!=23)
|
|
set_error(imFILE_CORRUPTED);
|
|
fread(xy,2,1,fp);
|
|
- xy[0]=int_to_local(xy[0]);
|
|
+ xy[0]=uint16_to_local(xy[0]);
|
|
fseek(fp,xy[0],SEEK_CUR);
|
|
startn--; if (endn>0) endn--;
|
|
}
|
|
@@ -160,13 +160,13 @@
|
|
if (fread(&j,1,2,fp)!=2) set_error(imFILE_CORRUPTED);
|
|
else
|
|
{
|
|
- j=int_to_local(j);
|
|
+ j=uint16_to_local(j);
|
|
j-=4;
|
|
xy[0]=5; xy[1]=5;
|
|
if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED);
|
|
make_block(sizeof(image));
|
|
- xy[0]=int_to_local(xy[0]);
|
|
- xy[1]=int_to_local(xy[1]);
|
|
+ xy[0]=uint16_to_local(xy[0]);
|
|
+ xy[1]=uint16_to_local(xy[1]);
|
|
im[startn]=new image(xy[0],xy[1]);
|
|
total++;
|
|
for (i=0;i<xy[1];i++)
|
|
Index: abuse-sdl-0.7.0/src/imlib/specs.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/specs.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/specs.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -3,6 +3,7 @@
|
|
#include "specs.hpp"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
+#include <stdint.h>
|
|
#include <ctype.h>
|
|
#include <fcntl.h>
|
|
#include "system.h"
|
|
@@ -23,25 +24,25 @@
|
|
"Palette", // 2
|
|
"Invalid Type", // 3
|
|
"Image", // 4
|
|
- "Fore Tile",
|
|
+ "Fore Tile",
|
|
"Back Tile",
|
|
"Character",
|
|
"8 Morph",
|
|
"16 Morph",
|
|
- "Grue objs",
|
|
- "Extern WAV",
|
|
- "DMX MUS",
|
|
- "Patched morph",
|
|
- "Normal file",
|
|
- "Compress1 file",
|
|
- "Vector Image",
|
|
- "Light list",
|
|
- "Grue fgmap",
|
|
- "Grue bgmap",
|
|
- "Data array",
|
|
- "Character2",
|
|
- "Particle",
|
|
- "Extern lcache"
|
|
+ "Grue objs",
|
|
+ "Extern WAV",
|
|
+ "DMX MUS",
|
|
+ "Patched morph",
|
|
+ "Normal file",
|
|
+ "Compress1 file",
|
|
+ "Vector Image",
|
|
+ "Light list",
|
|
+ "Grue fgmap",
|
|
+ "Grue bgmap",
|
|
+ "Data array",
|
|
+ "Character2",
|
|
+ "Particle",
|
|
+ "Extern lcache"
|
|
};
|
|
|
|
|
|
@@ -150,7 +151,7 @@
|
|
{
|
|
if (wbuf_end!=0)
|
|
{
|
|
- long ret=unbuffered_write(wbuf,wbuf_end);
|
|
+ unsigned long ret=unbuffered_write(wbuf,wbuf_end);
|
|
if (ret!=wbuf_end && no_space_handle_fun)
|
|
no_space_handle_fun();
|
|
|
|
@@ -171,7 +172,7 @@
|
|
{
|
|
if (rbuf_start<rbuf_end)
|
|
{
|
|
- int avail_size=rbuf_end-rbuf_start;
|
|
+ unsigned int avail_size=rbuf_end-rbuf_start;
|
|
int copy_size=avail_size>count ? count : avail_size;
|
|
memcpy(buf,rbuf+rbuf_start,copy_size);
|
|
buf=(void *)(((unsigned char *)buf)+copy_size);
|
|
@@ -208,7 +209,7 @@
|
|
count-=copy_size;
|
|
buf=(void *)(((char *)buf)+copy_size);
|
|
if (wbuf_end==wbuf_size)
|
|
- if (flush_writes()!=wbuf_size)
|
|
+ if ((unsigned int)flush_writes()!=wbuf_size)
|
|
return total_written;
|
|
|
|
total_written+=copy_size;
|
|
@@ -216,7 +217,7 @@
|
|
return total_written;
|
|
} else
|
|
{
|
|
- long ret=unbuffered_write(buf,count);
|
|
+ unsigned long ret=unbuffered_write(buf,count);
|
|
if (ret!=count && no_space_handle_fun)
|
|
no_space_handle_fun();
|
|
}
|
|
@@ -233,7 +234,7 @@
|
|
if (whence==SEEK_CUR) offset+=curpos;
|
|
else if (whence==SEEK_END) offset=file_size()-offset;
|
|
|
|
- if (offset<realpos-rbuf_end || offset>=realpos)
|
|
+ if (offset<realpos-(long)rbuf_end || offset>=realpos)
|
|
{
|
|
rbuf_start=rbuf_end=0;
|
|
unbuffered_seek(offset,SEEK_SET);
|
|
@@ -269,13 +270,13 @@
|
|
|
|
#if (defined(__APPLE__) && !defined(__MACH__))
|
|
spec_main_jfile.open_external(filename,"rb",O_BINARY|O_RDONLY);
|
|
- spec_main_fd = spec_main_jfile.get_fd();
|
|
- spec_main_sd.startup(&spec_main_jfile);
|
|
#else
|
|
spec_main_jfile.open_external(filename,"rb",O_RDONLY);
|
|
+#endif
|
|
spec_main_fd = spec_main_jfile.get_fd();
|
|
+ if (spec_main_fd==-1)
|
|
+ return;
|
|
spec_main_sd.startup(&spec_main_jfile);
|
|
-#endif
|
|
}
|
|
|
|
void fast_load_start_recording(char *filename)
|
|
@@ -334,7 +335,7 @@
|
|
if ((flags&O_APPEND)==0)
|
|
{
|
|
skip_size=1;
|
|
- int errval = unlink(tmp_name);
|
|
+ //int errval = unlink(tmp_name);
|
|
}
|
|
|
|
flags-=O_WRONLY;
|
|
@@ -419,14 +420,14 @@
|
|
spec_entry *se=spec_main_sd.find(filename);
|
|
if (se)
|
|
{
|
|
- start_offset=se->offset;
|
|
- current_offset = 0;
|
|
- file_length=se->size;
|
|
- rbuf_start=rbuf_end=0;
|
|
+ start_offset=se->offset;
|
|
+ current_offset = 0;
|
|
+ file_length=se->size;
|
|
+ rbuf_start=rbuf_end=0;
|
|
} else
|
|
{
|
|
- close(fd);
|
|
- fd=-1;
|
|
+ close(fd);
|
|
+ fd=-1;
|
|
}
|
|
}
|
|
}
|
|
@@ -486,7 +487,7 @@
|
|
|
|
int jFILE::unbuffered_read(void *buf, size_t count)
|
|
{
|
|
- long len;
|
|
+ unsigned long len;
|
|
|
|
if (fd == spec_main_fd)
|
|
{
|
|
@@ -504,7 +505,7 @@
|
|
|
|
len = ::read(fd,(char*)buf,count);
|
|
::write(fast_load_fd,(char*)&len,sizeof(len));
|
|
- ::write(fast_load_fd,(char*)buf,count);
|
|
+ ::write(fast_load_fd,(char*)buf,len);
|
|
break;
|
|
case 2:
|
|
::read(fast_load_fd,(char*)&len,sizeof(len));
|
|
@@ -524,7 +525,7 @@
|
|
case 1:
|
|
len = ::read(fd,(char*)buf,count);
|
|
::write(fast_load_fd,(char*)&len,sizeof(len));
|
|
- ::write(fast_load_fd,(char*)buf,count);
|
|
+ ::write(fast_load_fd,(char*)buf,len);
|
|
break;
|
|
case 2:
|
|
::read(fast_load_fd,(char*)&len,sizeof(len));
|
|
@@ -547,28 +548,28 @@
|
|
|
|
int jFILE::unbuffered_seek(long offset, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
|
|
{
|
|
- long ret;
|
|
-
|
|
- if (fast_load_mode == 2)
|
|
- {
|
|
- switch (whence)
|
|
- {
|
|
+ long ret;
|
|
+
|
|
+ if (fast_load_mode == 2)
|
|
+ {
|
|
+ switch (whence)
|
|
+ {
|
|
case SEEK_SET :
|
|
- current_offset = start_offset+offset;
|
|
- break;
|
|
+ current_offset = start_offset+offset;
|
|
+ break;
|
|
case SEEK_END :
|
|
- current_offset = start_offset+file_length-offset;
|
|
- break;
|
|
+ current_offset = start_offset+file_length-offset;
|
|
+ break;
|
|
case SEEK_CUR :
|
|
- current_offset += offset;
|
|
- break;
|
|
+ current_offset += offset;
|
|
+ break;
|
|
default:
|
|
- ret = -1;
|
|
- break;
|
|
+ ret = -1;
|
|
+ break;
|
|
}
|
|
- return current_offset;
|
|
- }
|
|
-
|
|
+ return current_offset;
|
|
+ }
|
|
+
|
|
switch (whence)
|
|
{
|
|
case SEEK_SET :
|
|
@@ -583,67 +584,67 @@
|
|
}
|
|
if (ret>=0)
|
|
{
|
|
- current_offset = ret - start_offset;
|
|
- if (spec_main_fd == fd)
|
|
- spec_main_offset = ret;
|
|
- return ret;
|
|
+ current_offset = ret - start_offset;
|
|
+ if (spec_main_fd == fd)
|
|
+ spec_main_offset = ret;
|
|
+ return ret;
|
|
}
|
|
else
|
|
- return -1; // if a bad whence, then failure
|
|
+ return -1; // if a bad whence, then failure
|
|
}
|
|
|
|
|
|
-unsigned char bFILE::read_byte()
|
|
-{ unsigned char x;
|
|
+uint8_t bFILE::read_uint8()
|
|
+{ uint8_t x;
|
|
read(&x,1);
|
|
return x;
|
|
}
|
|
|
|
-unsigned short bFILE::read_short()
|
|
+uint16_t bFILE::read_uint16()
|
|
{
|
|
- unsigned short x;
|
|
+ uint16_t x;
|
|
read(&x,2);
|
|
- return int_to_local(x);
|
|
+ return uint16_to_local(x);
|
|
}
|
|
|
|
|
|
-unsigned long bFILE::read_long()
|
|
+uint32_t bFILE::read_uint32()
|
|
{
|
|
- unsigned long x;
|
|
+ uint32_t x;
|
|
read(&x,4);
|
|
- return long_to_local(x);
|
|
+ return uint32_to_local(x);
|
|
}
|
|
|
|
-void bFILE::write_byte(unsigned char x)
|
|
+void bFILE::write_uint8(uint8_t x)
|
|
{
|
|
write(&x,1);
|
|
}
|
|
|
|
-void bFILE::write_short(unsigned short x)
|
|
+void bFILE::write_uint16(uint16_t x)
|
|
{
|
|
- x=int_to_local(x);
|
|
+ x=uint16_to_local(x);
|
|
write(&x,2);
|
|
}
|
|
|
|
|
|
-void bFILE::write_long(unsigned long x)
|
|
+void bFILE::write_uint32(uint32_t x)
|
|
{
|
|
- x=long_to_local(x);
|
|
+ x=uint32_to_local(x);
|
|
write(&x,4);
|
|
}
|
|
|
|
void bFILE::write_double(double x)
|
|
{
|
|
double a;
|
|
- write_long((long)(modf(x,&a)*(double)(1<<32-1)));
|
|
- write_long((long)a);
|
|
+ write_uint32((long)(modf(x,&a)*(double)(1<<32-1)));
|
|
+ write_uint32((long)a);
|
|
}
|
|
|
|
double bFILE::read_double()
|
|
{
|
|
long a,b;
|
|
- a=read_long();
|
|
- b=read_long();
|
|
+ a=read_uint32();
|
|
+ b=read_uint32();
|
|
return (double)b+a/(double)(1<<32-1);
|
|
}
|
|
|
|
@@ -754,12 +755,13 @@
|
|
void spec_directory::startup(bFILE *fp)
|
|
{
|
|
char buf[256];
|
|
+ memset(buf,0,256);
|
|
fp->read(buf,8);
|
|
buf[9]=0;
|
|
size=0;
|
|
if (!strcmp(buf,SPEC_SIGNATURE))
|
|
{
|
|
- total=fp->read_short();
|
|
+ total=fp->read_uint16();
|
|
entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries");
|
|
long start=fp->tell();
|
|
|
|
@@ -790,8 +792,8 @@
|
|
fp->read(se->name,len);
|
|
fp->read(&flags,1);
|
|
|
|
- se->size=fp->read_long();
|
|
- se->offset=fp->read_long();
|
|
+ se->size=fp->read_uint32();
|
|
+ se->offset=fp->read_uint32();
|
|
dp+=((sizeof(spec_entry)+len)+3)&(~3);
|
|
}
|
|
}
|
|
@@ -877,7 +879,7 @@
|
|
strcpy(sig,SPEC_SIGNATURE);
|
|
|
|
if (fp->write(sig,sizeof(sig))!=sizeof(sig)) return 0;
|
|
- fp->write_short(total);
|
|
+ fp->write_uint16(total);
|
|
|
|
|
|
int i;
|
|
@@ -888,9 +890,9 @@
|
|
flags=0;
|
|
if (fp->write(&flags,1)!=1) return 0;
|
|
|
|
- data_size=long_to_intel((*e)->size);
|
|
+ data_size=uint32_to_intel((*e)->size);
|
|
if (fp->write((char *)&data_size,4)!=4) return 0;
|
|
- offset=long_to_intel((*e)->offset);
|
|
+ offset=uint32_to_intel((*e)->offset);
|
|
if (fp->write((char *)&offset,4)!=4) return 0;
|
|
|
|
}
|
|
@@ -910,58 +912,58 @@
|
|
|
|
}
|
|
|
|
-unsigned short read_short(FILE *fp)
|
|
+uint16_t read_uint16(FILE *fp)
|
|
{
|
|
- unsigned short x;
|
|
+ uint16_t x;
|
|
fread(&x,1,2,fp);
|
|
- return int_to_local(x);
|
|
+ return uint16_to_local(x);
|
|
}
|
|
|
|
-unsigned long read_long(FILE *fp)
|
|
+uint32_t read_uint32(FILE *fp)
|
|
{
|
|
- unsigned long x;
|
|
+ uint32_t x;
|
|
fread(&x,1,4,fp);
|
|
- return (long)long_to_local(x);
|
|
+ return uint32_to_local(x);
|
|
}
|
|
-void write_short(FILE *fp, unsigned short x)
|
|
+void write_uint16(FILE *fp, uint16_t x)
|
|
{
|
|
- x=int_to_local(x);
|
|
+ x=uint16_to_local(x);
|
|
fwrite(&x,1,2,fp);
|
|
}
|
|
|
|
-void write_long(FILE *fp, unsigned long x)
|
|
+void write_uint32(FILE *fp, uint32_t x)
|
|
{
|
|
- x=long_to_local(x);
|
|
+ x=uint32_to_local(x);
|
|
fwrite(&x,1,4,fp);
|
|
}
|
|
|
|
-unsigned char read_byte(FILE *fp) { return fgetc(fp)&0xff; }
|
|
-void write_byte(FILE *fp, unsigned char x) { fputc(x,fp); }
|
|
+uint8_t read_uint8(FILE *fp) { return fgetc(fp)&0xff; }
|
|
+void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }
|
|
|
|
-unsigned short read_other_long(FILE *fp)
|
|
+uint32_t read_other_int32(FILE *fp)
|
|
{
|
|
- unsigned long x;
|
|
+ uint32_t x;
|
|
fread(&x,1,4,fp);
|
|
- return big_long_to_local(x);
|
|
+ return big_uint32_to_local(x);
|
|
}
|
|
|
|
-unsigned long read_other_short(FILE *fp)
|
|
+uint16_t read_other_uint16(FILE *fp)
|
|
{
|
|
- unsigned short x;
|
|
+ uint16_t x;
|
|
fread(&x,1,2,fp);
|
|
- return big_short_to_local(x);
|
|
+ return big_uint16_to_local(x);
|
|
}
|
|
|
|
|
|
-void write_other_short(FILE *fp, unsigned short x)
|
|
+void write_other_uint16(FILE *fp, uint16_t x)
|
|
{
|
|
- x=big_short_to_local(x);
|
|
+ x=big_uint16_to_local(x);
|
|
fwrite(&x,1,2,fp);
|
|
}
|
|
|
|
-void write_other_long(FILE *fp, unsigned long x)
|
|
+void write_other_int32(FILE *fp, uint32_t x)
|
|
{
|
|
- x=big_long_to_local(x);
|
|
+ x=big_uint32_to_local(x);
|
|
fwrite(&x,1,4,fp);
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/image.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/image.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/image.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -11,7 +11,7 @@
|
|
#endif
|
|
#include <stdlib.h>
|
|
|
|
-extern unsigned char current_background;
|
|
+extern uint8_t current_background;
|
|
char *imerr_messages[]={"No error",
|
|
"Error occured while reading",
|
|
"Incorrect file type",
|
|
@@ -22,10 +22,10 @@
|
|
"Error occured while writing, (disk full?)"};
|
|
|
|
|
|
-short imerror=0;
|
|
-short swpfile_num=0;
|
|
+int16_t imerror=0;
|
|
+int16_t swpfile_num=0;
|
|
|
|
-short current_error()
|
|
+int16_t current_error()
|
|
{ return imerror; }
|
|
|
|
void clear_errors()
|
|
@@ -47,12 +47,12 @@
|
|
}
|
|
}
|
|
|
|
-void set_error(short x)
|
|
+void set_error(int16_t x)
|
|
{ imerror=x; }
|
|
|
|
-short last_error()
|
|
+int16_t last_error()
|
|
{
|
|
- short ec;
|
|
+ int16_t ec;
|
|
ec=imerror;
|
|
imerror=0;
|
|
return ec;
|
|
@@ -61,7 +61,7 @@
|
|
linked_list image_list;
|
|
|
|
|
|
-image_descriptor::image_descriptor(short length, short height,
|
|
+image_descriptor::image_descriptor(int16_t length, int16_t height,
|
|
int keep_dirties, int static_memory)
|
|
|
|
{ clipx1=0; clipy1=0;
|
|
@@ -71,7 +71,7 @@
|
|
static_mem=static_memory;
|
|
}
|
|
|
|
-void image::change_size(short new_width, short new_height, unsigned char *page)
|
|
+void image::change_size(int16_t new_width, int16_t new_height, uint8_t *page)
|
|
{
|
|
delete_page();
|
|
w=new_width;
|
|
@@ -96,14 +96,14 @@
|
|
if (dat) jfree((char *)dat);
|
|
}
|
|
|
|
-unsigned char image::pixel(short x, short y)
|
|
+uint8_t image::pixel(int16_t x, int16_t y)
|
|
{
|
|
CONDITION(x>=0 && x<width() && y>=0 && y<height(),
|
|
"image::pixel Bad pixel xy");
|
|
return (*(scan_line(y)+x));
|
|
}
|
|
|
|
-void image::putpixel(short x, short y, char color)
|
|
+void image::putpixel(int16_t x, int16_t y, char color)
|
|
{
|
|
CONDITION(x>=0 && x<width() && y>=0 && y<height(),
|
|
"image::putpixel Bad pixel xy");
|
|
@@ -115,7 +115,7 @@
|
|
}
|
|
|
|
|
|
-image::image(short width, short height, unsigned char *page_buffer, short create_descriptor)
|
|
+image::image(int16_t width, int16_t height, uint8_t *page_buffer, int16_t create_descriptor)
|
|
{
|
|
w=width;
|
|
h=height;
|
|
@@ -131,10 +131,10 @@
|
|
|
|
image::image(spec_entry *e, bFILE *fp)
|
|
{
|
|
- short i;
|
|
+ int16_t i;
|
|
fp->seek(e->offset,0);
|
|
- w=fp->read_short();
|
|
- h=fp->read_short();
|
|
+ w=fp->read_uint16();
|
|
+ h=fp->read_uint16();
|
|
special=NULL;
|
|
make_page(w,h,NULL);
|
|
for (i=0;i<h;i++)
|
|
@@ -144,9 +144,9 @@
|
|
|
|
image::image(bFILE *fp)
|
|
{
|
|
- short i;
|
|
- w=fp->read_short();
|
|
- h=fp->read_short();
|
|
+ int16_t i;
|
|
+ w=fp->read_uint16();
|
|
+ h=fp->read_uint16();
|
|
special=NULL;
|
|
make_page(w,h,NULL);
|
|
for (i=0;i<h;i++)
|
|
@@ -171,12 +171,12 @@
|
|
|
|
void image_init()
|
|
{
|
|
- unsigned char bt[2];
|
|
- unsigned short wrd,*up;
|
|
+ uint8_t bt[2];
|
|
+ uint16_t wrd,*up;
|
|
bt[0]=1;
|
|
bt[1]=0;
|
|
- up=(unsigned short *)bt;
|
|
- wrd=int_to_intel(*up);
|
|
+ up=(uint16_t *)bt;
|
|
+ wrd=uint16_to_intel(*up);
|
|
if (wrd!=0x01)
|
|
{ printf("Compiled under wrong ENDING-nes, edit system.h and try again\n");
|
|
printf("1 (intel) = %d\n",(int)wrd);
|
|
@@ -186,11 +186,11 @@
|
|
}
|
|
|
|
|
|
-long image::total_pixels(unsigned char background)
|
|
+int32_t image::total_pixels(uint8_t background)
|
|
{
|
|
- short i,j;
|
|
- long co;
|
|
- unsigned char *c;
|
|
+ int16_t i,j;
|
|
+ int32_t co;
|
|
+ uint8_t *c;
|
|
for (co=0,i=height()-1;i>=0;i--)
|
|
{ c=scan_line(i);
|
|
for (j=width()-1;j>=0;j--,c++)
|
|
@@ -199,9 +199,9 @@
|
|
return co;
|
|
}
|
|
|
|
-void image::clear(short color)
|
|
+void image::clear(int16_t color)
|
|
{
|
|
- short i;
|
|
+ int16_t i;
|
|
if (color==-1) color=current_background;
|
|
if (special)
|
|
{ if (special->x1_clip()<=special->x2_clip())
|
|
@@ -219,9 +219,9 @@
|
|
image *image::copy()
|
|
{
|
|
image *im;
|
|
- unsigned char *c,*dat;
|
|
+ uint8_t *c,*dat;
|
|
int i;
|
|
- dat=(unsigned char *)jmalloc(width(),"image copy");
|
|
+ dat=(uint8_t *)jmalloc(width(),"image copy");
|
|
im=new image(width(),height());
|
|
for (i=height()-1;i>=0;i--)
|
|
{ c=scan_line(i);
|
|
@@ -235,13 +235,13 @@
|
|
|
|
|
|
|
|
-void image::line(short x1, short y1,short x2, short y2, unsigned char color)
|
|
+void image::line(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
|
|
{
|
|
- short i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
|
|
+ int16_t i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;
|
|
unsigned dcy,dcx;
|
|
// check to make sure that both endpoint are on the screen
|
|
|
|
- short cx1,cy1,cx2,cy2;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
|
|
// check to see if the line is completly clipped off
|
|
get_clip(cx1,cy1,cx2,cy2);
|
|
@@ -377,10 +377,10 @@
|
|
}
|
|
|
|
|
|
-void image::put_image(image *screen, short x, short y, char transparent)
|
|
+void image::put_image(image *screen, int16_t x, int16_t y, char transparent)
|
|
{
|
|
- short i,j,xl,yl;
|
|
- unsigned char *pg1,*pg2,*source,*dest;
|
|
+ int16_t i,j,xl,yl;
|
|
+ uint8_t *pg1,*pg2,*source,*dest;
|
|
if (screen->special) // the screen is clipped then we onl want to put
|
|
// part of the image
|
|
put_part(screen,x,y,0,0,width()-1,height()-1,transparent);
|
|
@@ -416,10 +416,10 @@
|
|
}
|
|
}
|
|
|
|
-void image::fill_image(image *screen, short x1, short y1, short x2, short y2, short allign)
|
|
+void image::fill_image(image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t align)
|
|
{
|
|
- short i,j,w,xx,start,xl,starty;
|
|
- unsigned char *pg1,*pg2;
|
|
+ int16_t i,j,w,xx,start,xl,starty;
|
|
+ uint8_t *pg1,*pg2;
|
|
CHECK(x1<=x2 && y1<=y2); // we should have gotten this
|
|
|
|
if (screen->special)
|
|
@@ -438,7 +438,7 @@
|
|
return ;
|
|
screen->add_dirty(x1,y1,x2,y2);
|
|
w=width();
|
|
- if (allign)
|
|
+ if (align)
|
|
{
|
|
start=x1%w;
|
|
starty=y1%height();
|
|
@@ -466,12 +466,12 @@
|
|
}
|
|
|
|
|
|
-void image::put_part(image *screen, short x, short y,
|
|
- short x1, short y1, short x2, short y2, char transparent)
|
|
+void image::put_part(image *screen, int16_t x, int16_t y,
|
|
+ int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
|
|
{
|
|
- short xl,yl,j,i;
|
|
- short cx1,cy1,cx2,cy2;
|
|
- unsigned char *pg1,*pg2,*source,*dest;
|
|
+ int16_t xl,yl,j,i;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
+ uint8_t *pg1,*pg2,*source,*dest;
|
|
CHECK(x1<=x2 && y1<=y2);
|
|
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
@@ -532,12 +532,12 @@
|
|
}
|
|
}
|
|
|
|
-void image::put_part_xrev(image *screen, short x, short y,
|
|
- short x1, short y1, short x2, short y2, char transparent)
|
|
+void image::put_part_xrev(image *screen, int16_t x, int16_t y,
|
|
+ int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent)
|
|
{
|
|
- short xl,yl,j,i;
|
|
- short cx1,cy1,cx2,cy2;
|
|
- unsigned char *pg1,*pg2,*source,*dest;
|
|
+ int16_t xl,yl,j,i;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
+ uint8_t *pg1,*pg2,*source,*dest;
|
|
CHECK(x1<=x2 && y1<=y2);
|
|
|
|
i=x1; x1=width()-x2-1; // reverse the x locations
|
|
@@ -595,13 +595,13 @@
|
|
}
|
|
|
|
|
|
-void image::put_part_masked(image *screen, image *mask, short x, short y,
|
|
- short maskx, short masky,
|
|
- short x1, short y1, short x2, short y2)
|
|
-{
|
|
- short xl,yl,j,i,ml,mh;
|
|
- short cx1,cy1,cx2,cy2;
|
|
- unsigned char *pg1,*pg2,*pg3;
|
|
+void image::put_part_masked(image *screen, image *mask, int16_t x, int16_t y,
|
|
+ int16_t maskx, int16_t masky,
|
|
+ int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
+{
|
|
+ int16_t xl,yl,j,i,ml,mh;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
+ uint8_t *pg1,*pg2,*pg3;
|
|
CHECK(x1<=x2 && y1<=y2);
|
|
|
|
if (screen->special)
|
|
@@ -657,18 +657,18 @@
|
|
|
|
|
|
|
|
-unsigned char image::brightest_color(palette *pal)
|
|
-{ unsigned char *p,r,g,b,bri;
|
|
- short i,j;
|
|
- long brv;
|
|
+uint8_t image::brightest_color(palette *pal)
|
|
+{ uint8_t *p,r,g,b,bri;
|
|
+ int16_t i,j;
|
|
+ int32_t brv;
|
|
brv=0; bri=0;
|
|
for (j=0;j<h;j++)
|
|
{
|
|
p=scan_line(j);
|
|
for (i=0;i<w;i++)
|
|
{ pal->get(p[i],r,g,b);
|
|
- if ((long)r*(long)g*(long)b>brv)
|
|
- { brv=(long)r*(long)g*(long)b;
|
|
+ if ((int32_t)r*(int32_t)g*(int32_t)b>brv)
|
|
+ { brv=(int32_t)r*(int32_t)g*(int32_t)b;
|
|
bri=p[i];
|
|
}
|
|
}
|
|
@@ -676,17 +676,17 @@
|
|
return bri;
|
|
}
|
|
|
|
-unsigned char image::darkest_color(palette *pal, short noblack)
|
|
-{ unsigned char *p,r,g,b,bri;
|
|
- short i,j;
|
|
- long brv,x;
|
|
- brv=(long)258*(long)258*(long)258; bri=0;
|
|
+uint8_t image::darkest_color(palette *pal, int16_t noblack)
|
|
+{ uint8_t *p,r,g,b,bri;
|
|
+ int16_t i,j;
|
|
+ int32_t brv,x;
|
|
+ brv=(int32_t)258*(int32_t)258*(int32_t)258; bri=0;
|
|
for (j=0;j<h;j++)
|
|
{
|
|
p=scan_line(j);
|
|
for (i=0;i<w;i++)
|
|
{ pal->get(p[i],r,g,b);
|
|
- x=(long)r*(long)g*(long)b;
|
|
+ x=(int32_t)r*(int32_t)g*(int32_t)b;
|
|
if (x<brv && (x || !noblack))
|
|
{ brv=x;
|
|
bri=p[i];
|
|
@@ -696,7 +696,7 @@
|
|
return bri;
|
|
}
|
|
|
|
-void image::rectangle(short x1, short y1,short x2, short y2, unsigned char color)
|
|
+void image::rectangle(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color)
|
|
{
|
|
line(x1,y1,x2,y1,color);
|
|
line(x2,y1,x2,y2,color);
|
|
@@ -704,7 +704,7 @@
|
|
line(x1,y1,x1,y2,color);
|
|
}
|
|
|
|
-void image::set_clip(short x1, short y1, short x2, short y2)
|
|
+void image::set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
{
|
|
// If the image does not already have an Image descriptor, allocate one.
|
|
|
|
@@ -717,7 +717,7 @@
|
|
// should be it will adjust to fit wiothin the image.
|
|
}
|
|
|
|
-void image::get_clip (short &x1, short &y1, short &x2, short &y2)
|
|
+void image::get_clip (int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2)
|
|
{
|
|
if (special)
|
|
special->get_clip(x1,y1,x2,y2);
|
|
@@ -725,7 +725,7 @@
|
|
{ x1=0; y1=0; x2=width()-1; y2=height()-1; }
|
|
}
|
|
|
|
-void image::in_clip (short x1, short y1, short x2, short y2)
|
|
+void image::in_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
{
|
|
if (special)
|
|
{
|
|
@@ -746,7 +746,7 @@
|
|
void image_descriptor::reduce_dirties()
|
|
{
|
|
dirty_rect *p,*q;
|
|
- short x1,y1,x2,y2,nn;
|
|
+ int16_t x1,y1,x2,y2,nn;
|
|
x1=6000; y1=6000;
|
|
x2=0; y2=0;
|
|
p=(dirty_rect *)dirties.first();
|
|
@@ -768,7 +768,7 @@
|
|
|
|
void image_descriptor::delete_dirty(int x1, int y1, int x2, int y2)
|
|
{
|
|
- short i,ax1,ay1,ax2,ay2;
|
|
+ int16_t i,ax1,ay1,ax2,ay2;
|
|
dirty_rect *p,*next;
|
|
if (keep_dirt)
|
|
{
|
|
@@ -868,7 +868,7 @@
|
|
// specifies that an area is a dirty
|
|
void image_descriptor::add_dirty(int x1, int y1, int x2, int y2)
|
|
{
|
|
- short i;
|
|
+ int16_t i;
|
|
dirty_rect *p;
|
|
if (keep_dirt)
|
|
{
|
|
@@ -940,9 +940,9 @@
|
|
}
|
|
}
|
|
|
|
-void image::bar (short x1, short y1, short x2, short y2, unsigned char color)
|
|
+void image::bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
|
|
{
|
|
- short y;
|
|
+ int16_t y;
|
|
if (x1>x2 || y1>y2) return ;
|
|
if (special)
|
|
{ x1=special->bound_x1(x1);
|
|
@@ -963,9 +963,9 @@
|
|
add_dirty(x1,y1,x2,y2);
|
|
}
|
|
|
|
-void image::xor_bar (short x1, short y1, short x2, short y2, unsigned char color)
|
|
+void image::xor_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
|
|
{
|
|
- short y,x;
|
|
+ int16_t y,x;
|
|
if (x1>x2 || y1>y2) return ;
|
|
if (special)
|
|
{ x1=special->bound_x1(x1);
|
|
@@ -982,10 +982,10 @@
|
|
if (x2<0 || y2<0 || x1>=width() || y1>=height() || x2<x1 || y2<y1)
|
|
return ;
|
|
|
|
- unsigned char *sl=scan_line(y1)+x1;
|
|
+ uint8_t *sl=scan_line(y1)+x1;
|
|
for (y=y1;y<=y2;y++)
|
|
{
|
|
- unsigned char *s=sl;
|
|
+ uint8_t *s=sl;
|
|
for (x=x1;x<=x2;x++,s++)
|
|
*s=(*s)^color;
|
|
sl+=w;
|
|
@@ -995,11 +995,11 @@
|
|
}
|
|
|
|
|
|
-void image::unpack_scanline(short line, char bitsperpixel)
|
|
+void image::unpack_scanline(int16_t line, char bitsperpixel)
|
|
{
|
|
- short x;
|
|
- unsigned char *sl,*ex,mask,bt,sh;
|
|
- ex=(unsigned char *)jmalloc(width(),"image::unpacked scanline");
|
|
+ int16_t x;
|
|
+ uint8_t *sl,*ex,mask,bt,sh;
|
|
+ ex=(uint8_t *)jmalloc(width(),"image::unpacked scanline");
|
|
sl=scan_line(line);
|
|
memcpy(ex,sl,width());
|
|
|
|
@@ -1017,13 +1017,13 @@
|
|
|
|
void image::dither(palette *pal)
|
|
{
|
|
- short x,y,i,j;
|
|
- unsigned char dt_matrix[]={0, 136,24, 170,
|
|
+ int16_t x,y,i,j;
|
|
+ uint8_t dt_matrix[]={0, 136,24, 170,
|
|
68, 204,102,238,
|
|
51, 187, 17,153,
|
|
119,255, 85,221};
|
|
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
for (y=height()-1;y>=0;y--)
|
|
{
|
|
sl=scan_line(y);
|
|
@@ -1048,10 +1048,10 @@
|
|
}
|
|
}
|
|
|
|
-void image::resize(short new_width, short new_height)
|
|
+void image::resize(int16_t new_width, int16_t new_height)
|
|
{
|
|
int old_width=width(),old_height=height();
|
|
- unsigned char *im=(unsigned char *)jmalloc(width()*height(),"image::resized");
|
|
+ uint8_t *im=(uint8_t *)jmalloc(width()*height(),"image::resized");
|
|
memcpy(im,scan_line(0),width()*height());
|
|
|
|
delete_page();
|
|
@@ -1059,8 +1059,8 @@
|
|
w=new_width; // set the new hieght and width
|
|
h=new_height;
|
|
|
|
- unsigned char *sl1,*sl2;
|
|
- short y,y2,x2;
|
|
+ uint8_t *sl1,*sl2;
|
|
+ int16_t y,y2,x2;
|
|
double yc,xc,yd,xd;
|
|
|
|
|
|
@@ -1079,17 +1079,17 @@
|
|
if (special) special->resize(new_width,new_height);
|
|
}
|
|
|
|
-void image::scroll(short x1, short y1, short x2, short y2, short xd, short yd)
|
|
+void image::scroll(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd)
|
|
{
|
|
- short cx1,cy1,cx2,cy2;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<width() && y2<height());
|
|
if (special)
|
|
{
|
|
special->get_clip(cx1,cy1,cx2,cy2);
|
|
x1=max(x1,cx1); y1=max(cy1,y1); x2=min(x2,cx2); y2=min(y2,cy2);
|
|
}
|
|
- short xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
|
|
- unsigned char *src,*dst;
|
|
+ int16_t xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;
|
|
+ uint8_t *src,*dst;
|
|
if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; }
|
|
if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; }
|
|
for (ytot=y2-y1-abs(yd)+1;ytot;ytot--)
|
|
@@ -1106,9 +1106,9 @@
|
|
}
|
|
|
|
|
|
-image *image::create_smooth(short smoothness)
|
|
+image *image::create_smooth(int16_t smoothness)
|
|
{
|
|
- short i,j,k,l,t,d;
|
|
+ int16_t i,j,k,l,t,d;
|
|
image *im;
|
|
CHECK(smoothness>=0);
|
|
if (!smoothness) return NULL;
|
|
@@ -1128,8 +1128,8 @@
|
|
return im;
|
|
}
|
|
|
|
-void image::wiget_bar(short x1, short y1, short x2, short y2,
|
|
- unsigned char light, unsigned char med, unsigned char dark)
|
|
+void image::wiget_bar(int16_t x1, int16_t y1, int16_t x2, int16_t y2,
|
|
+ uint8_t light, uint8_t med, uint8_t dark)
|
|
{
|
|
line(x1,y1,x2,y1,light);
|
|
line(x1,y1,x1,y2,light);
|
|
@@ -1141,17 +1141,17 @@
|
|
class fill_rec
|
|
{
|
|
public :
|
|
- short x,y;
|
|
+ int16_t x,y;
|
|
fill_rec *last;
|
|
- fill_rec(short X, short Y, fill_rec *Last)
|
|
+ fill_rec(int16_t X, int16_t Y, fill_rec *Last)
|
|
{ x=X; y=Y; last=Last; }
|
|
} ;
|
|
|
|
-void image::flood_fill(short x, short y, unsigned char color)
|
|
+void image::flood_fill(int16_t x, int16_t y, uint8_t color)
|
|
{
|
|
- unsigned char *sl,*above,*below;
|
|
+ uint8_t *sl,*above,*below;
|
|
fill_rec *recs=NULL,*r;
|
|
- unsigned char fcolor;
|
|
+ uint8_t fcolor;
|
|
sl=scan_line(y);
|
|
fcolor=sl[x];
|
|
if (fcolor==color) return ;
|
|
@@ -1230,16 +1230,16 @@
|
|
|
|
#define LED_L 5
|
|
#define LED_H 5
|
|
-void image::burn_led(short x, short y, long num, short color, short scale)
|
|
+void image::burn_led(int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale)
|
|
{
|
|
char st[100];
|
|
- short ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
|
|
- short ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
|
|
+ int16_t ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};
|
|
+ int16_t ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};
|
|
|
|
- short dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,
|
|
+ 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,
|
|
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};
|
|
- short xx,yy,zz;
|
|
- sprintf(st,"%8ld",num);
|
|
+ int16_t xx,yy,zz;
|
|
+ sprintf(st,"%8ld",(long int)num);
|
|
for (xx=0;xx<8;xx++)
|
|
{
|
|
if (st[xx]!=' ')
|
|
@@ -1257,16 +1257,16 @@
|
|
}
|
|
}
|
|
|
|
-unsigned char dither_matrix[]={0, 136,24, 170,
|
|
+uint8_t dither_matrix[]={0, 136,24, 170,
|
|
68, 204,102,238,
|
|
51, 187, 17,153,
|
|
119,255, 85,221};
|
|
|
|
-image *image::copy_part_dithered (short x1, short y1, short x2, short y2)
|
|
+image *image::copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
|
{
|
|
- short x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
|
|
+ int16_t x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;
|
|
image *ret;
|
|
- unsigned char *sl1,*sl2;
|
|
+ uint8_t *sl1,*sl2;
|
|
get_clip(cx1,cy1,cx2,cy2);
|
|
if (y1<cy1) y1=cy1;
|
|
if (x1<cx1) x1=cx1;
|
|
@@ -1303,7 +1303,7 @@
|
|
|
|
void image::flip_x()
|
|
{
|
|
- unsigned char *rev=(unsigned char *)jmalloc(width(),"image tmp::flipped_x"),*sl;
|
|
+ uint8_t *rev=(uint8_t *)jmalloc(width(),"image tmp::flipped_x"),*sl;
|
|
CONDITION(rev,"memory allocation");
|
|
int y,x,i;
|
|
for (y=0;y<height();y++)
|
|
@@ -1317,7 +1317,7 @@
|
|
|
|
void image::flip_y()
|
|
{
|
|
- unsigned char *rev=(unsigned char *)jmalloc(width(),"image::flipped_y"),*sl;
|
|
+ uint8_t *rev=(uint8_t *)jmalloc(width(),"image::flipped_y"),*sl;
|
|
CONDITION(rev,"memory allocation");
|
|
int y;
|
|
for (y=0;y<height()/2;y++)
|
|
@@ -1328,9 +1328,9 @@
|
|
}
|
|
}
|
|
|
|
-void image::make_color(unsigned char color)
|
|
+void image::make_color(uint8_t color)
|
|
{
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
int y,x;
|
|
for (y=0;y<height();y++)
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/imlib/filesel.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/filesel.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/filesel.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -56,9 +56,9 @@
|
|
wid=0;
|
|
int i=0;
|
|
for (;i<tf;i++)
|
|
- if (strlen(f[i])>wid) wid=strlen(f[i]);
|
|
+ if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
|
|
for (i=0;i<td;i++)
|
|
- if (strlen(d[i])+2>wid) wid=strlen(d[i])+2;
|
|
+ if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
|
|
sx=0;
|
|
|
|
|
|
@@ -102,9 +102,9 @@
|
|
wid=0;
|
|
int i=0;
|
|
for (;i<tf;i++)
|
|
- if (strlen(f[i])>wid) wid=strlen(f[i]);
|
|
+ if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
|
|
for (i=0;i<td;i++)
|
|
- if (strlen(d[i])+2>wid) wid=strlen(d[i])+2;
|
|
+ if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
|
|
reconfigure();
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/imlib/pmenu.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/pmenu.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/pmenu.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -275,7 +275,7 @@
|
|
int w=bar->screen->width();
|
|
|
|
|
|
- int total=0,tx,tw,i=0,x;
|
|
+ int total=0,tw,i=0,x=0;
|
|
for (pmenu_item *pp=top;pp;pp=pp->next,i++)
|
|
{ if (pp==p) x=i;
|
|
total++;
|
|
Index: abuse-sdl-0.7.0/src/imlib/morph.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/morph.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/morph.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -354,20 +354,20 @@
|
|
|
|
for (i=0;i<total;i++)
|
|
{
|
|
- ((morph_point16 *)p+i)->x1=fp->read_short();
|
|
- ((morph_point16 *)p+i)->y1=fp->read_short();
|
|
- ((morph_point16 *)p+i)->x2=fp->read_short();
|
|
- ((morph_point16 *)p+i)->y2=fp->read_short();
|
|
+ ((morph_point16 *)p+i)->x1=fp->read_uint16();
|
|
+ ((morph_point16 *)p+i)->y1=fp->read_uint16();
|
|
+ ((morph_point16 *)p+i)->x2=fp->read_uint16();
|
|
+ ((morph_point16 *)p+i)->y2=fp->read_uint16();
|
|
fp->read( &((morph_point16 *)p+i)->start_color,1);
|
|
fp->read( &((morph_point16 *)p+i)->end_color,1);
|
|
}
|
|
|
|
small=0;
|
|
}
|
|
- w[0]=fp->read_short();
|
|
- h[0]=fp->read_short();
|
|
- w[1]=fp->read_short();
|
|
- h[1]=fp->read_short();
|
|
+ w[0]=fp->read_uint16();
|
|
+ h[0]=fp->read_uint16();
|
|
+ w[1]=fp->read_uint16();
|
|
+ h[1]=fp->read_uint16();
|
|
}
|
|
|
|
void jmorph::show_frame(image *screen, int x, int y,
|
|
@@ -677,7 +677,7 @@
|
|
int i;
|
|
|
|
|
|
- fp->write_long(total);
|
|
+ fp->write_uint32(total);
|
|
if (small)
|
|
{
|
|
|
|
@@ -690,18 +690,18 @@
|
|
else
|
|
{
|
|
for (i=0;i<total;i++)
|
|
- { fp->write_short(((morph_point16 *)p+i)->x1);
|
|
- fp->write_short(((morph_point16 *)p+i)->y1);
|
|
- fp->write_short(((morph_point16 *)p+i)->x2);
|
|
- fp->write_short(((morph_point16 *)p+i)->y2);
|
|
+ { fp->write_uint16(((morph_point16 *)p+i)->x1);
|
|
+ fp->write_uint16(((morph_point16 *)p+i)->y1);
|
|
+ fp->write_uint16(((morph_point16 *)p+i)->x2);
|
|
+ fp->write_uint16(((morph_point16 *)p+i)->y2);
|
|
fp->write( &((morph_point16 *)p+i)->start_color,1);
|
|
fp->write( &((morph_point16 *)p+i)->end_color,1);
|
|
}
|
|
}
|
|
- fp->write_short(w[0]);
|
|
- fp->write_short(h[0]);
|
|
- fp->write_short(w[1]);
|
|
- fp->write_short(h[1]);
|
|
+ fp->write_uint16(w[0]);
|
|
+ fp->write_uint16(h[0]);
|
|
+ fp->write_uint16(w[1]);
|
|
+ fp->write_uint16(h[1]);
|
|
return 1;
|
|
}
|
|
|
|
@@ -876,12 +876,12 @@
|
|
{
|
|
int i;
|
|
|
|
- patches=fp->read_short();
|
|
+ patches=fp->read_uint16();
|
|
pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
|
|
|
|
for (i=0;i<patches;i++)
|
|
{
|
|
- pats[i].patches=fp->read_short();
|
|
+ pats[i].patches=fp->read_uint16();
|
|
if (pats[i].patches)
|
|
{
|
|
pats[i].patch_data=(unsigned char *)jmalloc(3*pats[i].patches,"patched_morph::patch_data");
|
|
Index: abuse-sdl-0.7.0/src/imlib/fonts.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/fonts.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/fonts.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -36,11 +36,11 @@
|
|
|
|
void JCFont::put_char(image *screen, int x, int y, char ch, int color)
|
|
{
|
|
- if (let[ch])
|
|
+ if (let[(int)ch])
|
|
{
|
|
if (color>=0)
|
|
- let[ch]->put_color(screen,x,y,color);
|
|
- else let[ch]->put_image(screen,x,y);
|
|
+ let[(int)ch]->put_color(screen,x,y,color);
|
|
+ else let[(int)ch]->put_image(screen,x,y);
|
|
}
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/include/compiled.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/compiled.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/compiled.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,7 +1,7 @@
|
|
#ifndef __COMPILED_HPP_
|
|
#define __COMPILED_HPP_
|
|
#include "macs.hpp"
|
|
-extern long S_fall_start,S_falling,S_landing,S_pounce_wait,
|
|
+extern int32_t S_fall_start,S_falling,S_landing,S_pounce_wait,
|
|
S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
|
|
S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
|
|
S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
|
|
@@ -24,7 +24,7 @@
|
|
void compiled_init();
|
|
void compiled_uninit();
|
|
|
|
-extern uchar *bad_guy_array; // list flaging each character saying they are a bad bug or not
|
|
+extern uint8_t *bad_guy_array; // list flaging each character saying they are a bad bug or not
|
|
// mainly used by the rocket to find targets
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/include/netface.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/netface.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/netface.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -95,25 +95,25 @@
|
|
|
|
struct net_packet
|
|
{
|
|
- unsigned char data[PACKET_MAX_SIZE];
|
|
+ uint8_t data[PACKET_MAX_SIZE];
|
|
int packet_prefix_size() { return 5; } // 2 byte size, 2 byte check sum, 1 byte packet order
|
|
- unsigned short packet_size() { unsigned short size=(*(unsigned short *)data); return lstl(size); }
|
|
- unsigned char tick_received() { return data[4]; }
|
|
- void set_tick_received(unsigned char x) { data[4]=x; }
|
|
- unsigned char *packet_data() { return data+packet_prefix_size(); }
|
|
- unsigned short get_checksum() { unsigned short cs=*((unsigned short *)data+1); return lstl(cs); }
|
|
- unsigned short calc_checksum()
|
|
+ uint16_t packet_size() { uint16_t size=(*(uint16_t *)data); return lstl(size); }
|
|
+ uint8_t tick_received() { return data[4]; }
|
|
+ void set_tick_received(uint8_t x) { data[4]=x; }
|
|
+ uint8_t *packet_data() { return data+packet_prefix_size(); }
|
|
+ uint16_t get_checksum() { uint16_t cs=*((uint16_t *)data+1); return lstl(cs); }
|
|
+ uint16_t calc_checksum()
|
|
{
|
|
- *((unsigned short *)data+1)=0;
|
|
+ *((uint16_t *)data+1)=0;
|
|
int i,size=packet_prefix_size()+packet_size();
|
|
- unsigned char c1=0,c2=0,*p=data;
|
|
+ uint8_t c1=0,c2=0,*p=data;
|
|
for (i=0;i<size;i++,p++)
|
|
{
|
|
c1+=*p;
|
|
c2+=c1;
|
|
}
|
|
- unsigned short cs=( (((unsigned short)c1)<<8) | c2);
|
|
- *((unsigned short *)data+1)=lstl(cs);
|
|
+ uint16_t cs=( (((uint16_t)c1)<<8) | c2);
|
|
+ *((uint16_t *)data+1)=lstl(cs);
|
|
return cs;
|
|
}
|
|
|
|
@@ -128,11 +128,11 @@
|
|
set_packet_size(packet_size()+size);
|
|
}
|
|
}
|
|
- void write_byte(unsigned char x) { add_to_packet(&x,1); }
|
|
- void write_short(unsigned short x) { x=lstl(x); add_to_packet(&x,2); }
|
|
- void write_long(unsigned long x) { x=lltl(x); add_to_packet(&x,4); }
|
|
+ void write_uint8(uint8_t x) { add_to_packet(&x,1); }
|
|
+ void write_uint16(uint16_t x) { x=lstl(x); add_to_packet(&x,2); }
|
|
+ void write_uint32(uint32_t x) { x=lltl(x); add_to_packet(&x,4); }
|
|
|
|
- void set_packet_size(unsigned short x) { *((unsigned short *)data)=lstl(x); }
|
|
+ void set_packet_size(uint16_t x) { *((uint16_t *)data)=lstl(x); }
|
|
|
|
|
|
} ;
|
|
@@ -142,13 +142,13 @@
|
|
net_packet packet, // current tick data
|
|
last_packet; // last tick data (in case a client misses input, we can resend)
|
|
|
|
- short mem_lock;
|
|
- short calc_crcs;
|
|
- short get_lsf;
|
|
- short wait_reload;
|
|
- short need_reload;
|
|
- short input_state; // COLLECTING or PROCESSING
|
|
- short current_tick; // set by engine, used by driver to confirm packet is not left over
|
|
+ int16_t mem_lock;
|
|
+ int16_t calc_crcs;
|
|
+ int16_t get_lsf;
|
|
+ int16_t wait_reload;
|
|
+ int16_t need_reload;
|
|
+ int16_t input_state; // COLLECTING or PROCESSING
|
|
+ int16_t current_tick; // set by engine, used by driver to confirm packet is not left over
|
|
|
|
join_struct *join_list;
|
|
} ;
|
|
Index: abuse-sdl-0.7.0/src/include/transp.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/transp.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/transp.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -2,6 +2,6 @@
|
|
#define __TRANSP_HPP_
|
|
#include "image.hpp"
|
|
#include "macs.hpp"
|
|
-void transp_put(image *im, image *screen, uchar *table, int x, int y);
|
|
+void transp_put(image *im, image *screen, uint8_t *table, int x, int y);
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/include/lisp.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/lisp.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/lisp.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,6 +1,8 @@
|
|
#ifndef __LISP_HPP_
|
|
#define __LISP_HPP_
|
|
|
|
+#include <stdint.h>
|
|
+
|
|
#include "lisp_opt.hpp"
|
|
|
|
#ifdef L_PROFILE
|
|
@@ -34,8 +36,8 @@
|
|
L_OBJECT_VAR, L_1D_ARRAY,
|
|
L_FIXED_POINT, L_COLLECTED_OBJECT };
|
|
|
|
-typedef long ltype; // make sure structures aren't packed differently on various compiler
|
|
- // and sure that word, etc are word alligned
|
|
+typedef uint64_t ltype; // make sure structures aren't packed differently on various compiler
|
|
+ // and sure that word, etc are word aligned
|
|
|
|
struct lisp_object_var
|
|
{
|
|
@@ -82,7 +84,7 @@
|
|
{
|
|
ltype type;
|
|
#ifndef NO_LIBS
|
|
- long alist,blist; // id for cached blocks
|
|
+ intptr_t alist,blist; // id for cached blocks
|
|
#else
|
|
void *arg_list,*block_list;
|
|
#endif
|
|
@@ -103,8 +105,8 @@
|
|
struct lisp_character
|
|
{
|
|
ltype type;
|
|
- short pad;
|
|
- unsigned short ch;
|
|
+ int16_t pad;
|
|
+ uint16_t ch;
|
|
} ;
|
|
|
|
struct lisp_pointer
|
|
@@ -117,7 +119,7 @@
|
|
struct lisp_fixed_point
|
|
{
|
|
ltype type;
|
|
- long x;
|
|
+ int32_t x;
|
|
} ;
|
|
|
|
|
|
@@ -127,7 +129,7 @@
|
|
#define item_type(c) ((c) ? *((ltype *)c) : (ltype)L_CONS_CELL)
|
|
void *lget_array_element(void *a, long x);
|
|
void *lpointer_value(void *lpointer);
|
|
-long lnumber_value(void *lnumber);
|
|
+int32_t lnumber_value(void *lnumber);
|
|
char *lstring_value(void *lstring);
|
|
unsigned short lcharacter_value(void *c);
|
|
long lfixed_point_value(void *c);
|
|
@@ -155,7 +157,7 @@
|
|
lisp_symbol *make_find_symbol(char *name);
|
|
|
|
void push_onto_list(void *object, void *&list);
|
|
-lisp_symbol *add_c_object(void *symbol, short number);
|
|
+lisp_symbol *add_c_object(void *symbol, int16_t number);
|
|
lisp_symbol *add_c_function(char *name, short min_args, short max_args, short number);
|
|
lisp_symbol *add_c_bool_fun(char *name, short min_args, short max_args, short number);
|
|
lisp_symbol *add_lisp_function(char *name, short min_args, short max_args, short number);
|
|
@@ -166,13 +168,13 @@
|
|
|
|
lisp_number *new_lisp_number(long num);
|
|
lisp_pointer *new_lisp_pointer(void *addr);
|
|
-lisp_character *new_lisp_character(unsigned short ch);
|
|
+lisp_character *new_lisp_character(uint16_t ch);
|
|
lisp_string *new_lisp_string(char *string);
|
|
lisp_string *new_lisp_string(char *string, int length);
|
|
-lisp_string *new_lisp_string(long length);
|
|
-lisp_fixed_point *new_lisp_fixed_point(long x);
|
|
-lisp_object_var *new_lisp_object_var(short number);
|
|
-lisp_1d_array *new_lisp_1d_array(unsigned short size, void *rest);
|
|
+lisp_string *new_lisp_string(int length);
|
|
+lisp_fixed_point *new_lisp_fixed_point(int32_t x);
|
|
+lisp_object_var *new_lisp_object_var(int16_t number);
|
|
+lisp_1d_array *new_lisp_1d_array(int size, void *rest);
|
|
lisp_sys_function *new_lisp_sys_function(int min_args, int max_args, int fun_number);
|
|
lisp_sys_function *new_lisp_c_function(int min_args, int max_args, int fun_number);
|
|
lisp_sys_function *new_lisp_c_bool(int min_args, int max_args, int fun_number);
|
|
@@ -180,7 +182,7 @@
|
|
#ifdef NO_LIBS
|
|
lisp_user_function *new_lisp_user_function(void *arg_list, void *block_list);
|
|
#else
|
|
-lisp_user_function *new_lisp_user_function(long arg_list, long block_list);
|
|
+lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list);
|
|
#endif
|
|
|
|
lisp_sys_function *new_user_lisp_function(int min_args, int max_args, int fun_number);
|
|
Index: abuse-sdl-0.7.0/src/include/view.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/view.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/view.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -11,9 +11,9 @@
|
|
|
|
struct suggest_struct
|
|
{
|
|
- long cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y;
|
|
- long new_weapon;
|
|
- uchar send_view,send_weapon_change;
|
|
+ int32_t cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y;
|
|
+ int32_t new_weapon;
|
|
+ uint8_t send_view,send_weapon_change;
|
|
} ;
|
|
|
|
|
|
@@ -22,7 +22,7 @@
|
|
|
|
class view
|
|
{
|
|
- uchar keymap[512/8];
|
|
+ uint8_t keymap[512/8];
|
|
char chat_buf[60];
|
|
public :
|
|
int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
|
|
@@ -32,7 +32,7 @@
|
|
|
|
char name[100];
|
|
struct suggest_struct suggest;
|
|
- long cx1,cy1,cx2,cy2, // view area to show
|
|
+ int32_t cx1,cy1,cx2,cy2, // view area to show
|
|
shift_down,shift_right; // shift of view
|
|
|
|
int god; // :) if you believe in such things
|
|
@@ -40,9 +40,9 @@
|
|
|
|
int draw_solid; // -1 if don't draw solid
|
|
|
|
- long *weapons; // [0..total_weapons-1]
|
|
- long *last_weapons; // last history of above array (for updating statbar)
|
|
- long current_weapon;
|
|
+ int32_t *weapons; // [0..total_weapons-1]
|
|
+ int32_t *last_weapons; // last history of above array (for updating statbar)
|
|
+ int32_t current_weapon;
|
|
|
|
|
|
game_object *focus; // object we are focusing on (player)
|
|
@@ -58,28 +58,28 @@
|
|
|
|
|
|
short ambient; // ambient lighting setting, used by draw
|
|
- long pan_x,pan_y,no_xleft,no_xright,no_ytop,no_ybottom,
|
|
+ int32_t pan_x,pan_y,no_xleft,no_xright,no_ytop,no_ybottom,
|
|
last_x,last_y,last_last_x,last_last_y,view_percent;
|
|
|
|
- long last_left,last_right,last_up,last_down, // how many frames ago were these pressed (<=0)
|
|
+ int32_t last_left,last_right,last_up,last_down, // how many frames ago were these pressed (<=0)
|
|
last_b1,last_b2,last_b3,last_b4,last_hp,last_ammo,last_type;
|
|
- long secrets,kills,tsecrets,tkills;
|
|
+ int32_t secrets,kills,tsecrets,tkills;
|
|
|
|
view(game_object *Focus, view *Next, int number);
|
|
void draw_character_damage(); // draws the characters 'status' on the viewer
|
|
|
|
- long x_center(); // center of attention
|
|
- long y_center();
|
|
- long xoff(); // top left and right corner of the screen
|
|
- long interpolated_xoff();
|
|
- long yoff();
|
|
- long interpolated_yoff();
|
|
+ int32_t x_center(); // center of attention
|
|
+ int32_t y_center();
|
|
+ int32_t xoff(); // top left and right corner of the screen
|
|
+ int32_t interpolated_xoff();
|
|
+ int32_t yoff();
|
|
+ int32_t interpolated_yoff();
|
|
int drawable(); // network viewables are not drawable
|
|
int local_player(); // just in case I ever need non-viewable local players.
|
|
|
|
view *next; // next viewable player (singly linked list)
|
|
void get_input();
|
|
- int process_input(char cmd, uchar *&pk);
|
|
+ int process_input(char cmd, uint8_t *&pk);
|
|
|
|
void add_ammo (int weapon_type, int total);
|
|
int has_weapon (int weapon_type) { return god || (weapons[weapon_type]!=-1); }
|
|
@@ -93,7 +93,7 @@
|
|
void draw_hp();
|
|
void draw_ammo();
|
|
void draw_logo();
|
|
- void resize_view(long Cx1, long Cy1, long Cx2, long Cy2);
|
|
+ void resize_view(int32_t Cx1, int32_t Cy1, int32_t Cx2, int32_t Cy2);
|
|
void set_input(int cx, int cy, int b1, int b2, int b3, int b4, int px, int py);
|
|
int view_changed() { return suggest.send_view; }
|
|
int weapon_changed() { return suggest.send_weapon_change; }
|
|
@@ -103,8 +103,8 @@
|
|
|
|
void reset_player();
|
|
int receive_failed() { return focus==NULL; }
|
|
- long get_view_var_value(int num);
|
|
- long set_view_var_value(int num, long x);
|
|
+ int32_t get_view_var_value(int num);
|
|
+ int32_t set_view_var_value(int num, int32_t x);
|
|
void configure_for_area(area_controller *a);
|
|
~view();
|
|
} ;
|
|
@@ -114,7 +114,7 @@
|
|
int total_local_players();
|
|
void recalc_local_view_space();
|
|
|
|
-void process_packet_commands(uchar *pk, int size);
|
|
+void process_packet_commands(uint8_t *pk, int size);
|
|
|
|
object_node *make_player_onodes(int player_num=-1);
|
|
int total_view_vars();
|
|
Index: abuse-sdl-0.7.0/src/include/dev.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/dev.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/dev.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -18,7 +18,7 @@
|
|
|
|
class pal_win
|
|
{
|
|
- long scale,w,h,x,y,last_selected;
|
|
+ int32_t scale,w,h,x,y,last_selected;
|
|
unsigned short *pat;
|
|
void draw();
|
|
|
|
@@ -100,8 +100,8 @@
|
|
void close_ai_window();
|
|
void make_ambient();
|
|
int ok_to_scroll();
|
|
- long snap_x(long x);
|
|
- long snap_y(long y);
|
|
+ int32_t snap_x(int32_t x);
|
|
+ int32_t snap_y(int32_t y);
|
|
void area_handle_input(event &ev);
|
|
void pick_handle_input(event &ev);
|
|
void close_area_win(int read_values);
|
|
Index: abuse-sdl-0.7.0/src/include/fakelib.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/fakelib.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/fakelib.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -4,15 +4,11 @@
|
|
#define jmalloc(x,y) malloc(x)
|
|
#define jrealloc(x,y,z) realloc(x,y)
|
|
#define jfree(x) free(x)
|
|
-#define uchar unsigned char
|
|
-#define schar signed char
|
|
-#define sshort signed short
|
|
|
|
#ifdef __sgi
|
|
#include <sys/bsd_types.h>
|
|
#else
|
|
-#define ulong unsigned long
|
|
-#define ushort unsigned short
|
|
+#include <stdint.h>
|
|
#endif
|
|
|
|
class bFILE
|
|
Index: abuse-sdl-0.7.0/src/include/particle.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/particle.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/particle.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -16,7 +16,7 @@
|
|
struct part
|
|
{
|
|
short x,y;
|
|
- uchar color;
|
|
+ uint8_t color;
|
|
} ;
|
|
|
|
class part_frame
|
|
Index: abuse-sdl-0.7.0/src/include/items.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/items.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/items.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -14,7 +14,7 @@
|
|
{
|
|
public :
|
|
boundary(bFILE *fp,char *er_name);
|
|
- unsigned char *inside; // tells which side of the line is on the inside
|
|
+ uint8_t *inside; // tells which side of the line is on the inside
|
|
boundary(boundary *p); // flips the *inside list
|
|
~boundary() { if (tot) jfree(inside); }
|
|
} ;
|
|
@@ -22,11 +22,11 @@
|
|
class backtile
|
|
{
|
|
public :
|
|
- unsigned short next;
|
|
+ uint16_t next;
|
|
image *im;
|
|
backtile(spec_entry *e, bFILE *fp);
|
|
backtile(bFILE *fp);
|
|
- long size() { return 2+4+im->width()*im->height(); }
|
|
+ int32_t size() { return 2+4+im->width()*im->height(); }
|
|
~backtile() { delete im; }
|
|
} ;
|
|
|
|
@@ -34,16 +34,16 @@
|
|
{
|
|
public :
|
|
trans_image *im;
|
|
- unsigned short next;
|
|
- unsigned char damage;
|
|
- uchar ylevel; // for fast intersections, this is the y level offset for the ground
|
|
+ uint16_t next;
|
|
+ uint8_t damage;
|
|
+ uint8_t ylevel; // for fast intersections, this is the y level offset for the ground
|
|
// if ground is not level this is 255
|
|
boundary *points;
|
|
|
|
image *micro_image;
|
|
|
|
foretile(bFILE *fp);
|
|
- long size() { return im->width()*im->height()+4+2+1+points->size(); }
|
|
+ int32_t size() { return im->width()*im->height()+4+2+1+points->size(); }
|
|
~foretile() { delete im; delete points; delete micro_image; }
|
|
} ;
|
|
|
|
@@ -51,8 +51,8 @@
|
|
{
|
|
public :
|
|
trans_image *forward,*backward;
|
|
- unsigned char hit_damage,xcfg;
|
|
- signed char advance;
|
|
+ uint8_t hit_damage,xcfg;
|
|
+ int8_t advance;
|
|
point_list *hit;
|
|
boundary *f_damage,*b_damage;
|
|
int size();
|
|
@@ -61,7 +61,7 @@
|
|
int width() { return forward->width(); }
|
|
int height() { return forward->height(); }
|
|
|
|
-/* long size(int type) // taken from spaint items
|
|
+/* int32_t size(int type) // taken from spaint items
|
|
{
|
|
if
|
|
return forward->width()*backward->height()+4+
|
|
@@ -79,7 +79,7 @@
|
|
class char_tint
|
|
{
|
|
public :
|
|
- uchar data[256];
|
|
+ uint8_t data[256];
|
|
~char_tint() { ; }
|
|
char_tint(bFILE *fp); // should be a palette entry
|
|
} ;
|
|
Index: abuse-sdl-0.7.0/src/include/demo.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/demo.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/demo.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -33,7 +33,7 @@
|
|
|
|
|
|
|
|
-extern int last_demo_mx,last_demo_my,last_demo_mbut;
|
|
+extern int32_t last_demo_mx,last_demo_my,last_demo_mbut;
|
|
//extern ulong demo_tick_on;
|
|
#endif
|
|
|
|
Index: abuse-sdl-0.7.0/src/include/objects.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/objects.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/objects.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -27,9 +27,9 @@
|
|
|
|
|
|
|
|
-#define RC_C 0
|
|
-#define RC_S 1
|
|
-#define RC_L 2
|
|
+#define RC_8 0
|
|
+#define RC_16 1
|
|
+#define RC_32 2
|
|
|
|
|
|
|
|
@@ -47,7 +47,7 @@
|
|
sequence *current_sequence() { return figures[otype]->get_sequence(state); }
|
|
public :
|
|
game_object *next,*next_active;
|
|
- long *lvars;
|
|
+ int32_t *lvars;
|
|
|
|
int size();
|
|
int decide(); // returns 0 if you want to be deleted
|
|
@@ -71,8 +71,8 @@
|
|
|
|
void drawer();
|
|
void draw_above(view *v);
|
|
- void do_damage(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel);
|
|
- void damage_fun(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel);
|
|
+ void do_damage(int amount, game_object *from, int32_t hitx, int32_t hity, int32_t push_xvel, int32_t push_yvel);
|
|
+ void damage_fun(int amount, game_object *from, int32_t hitx, int32_t hity, int32_t push_xvel, int32_t push_yvel);
|
|
|
|
|
|
void note_attack(game_object *whom);
|
|
@@ -93,14 +93,14 @@
|
|
void set_state(character_state s, int frame_direction=1);
|
|
int has_sequence(character_state s) { return figures[otype]->has_sequence(s); }
|
|
|
|
- game_object *try_move(long x, long y, long &xv, long &yv, int checks); // 1=down,2=up,3=both
|
|
+ game_object *try_move(int32_t x, int32_t y, int32_t &xv, int32_t &yv, int checks); // 1=down,2=up,3=both
|
|
game_object *bmove(int &whit, game_object *exclude); // ballestic move, return hit object,
|
|
// or NULL (whit is 1 if hit wall)
|
|
trans_image *picture() { return current_sequence()->get_frame(current_frame,direction); }
|
|
|
|
int next_picture();
|
|
- long x_center();
|
|
- long height();
|
|
+ int32_t x_center();
|
|
+ int32_t height();
|
|
|
|
void stop_acel() { set_xacel(0); set_yacel(0); set_fxacel(0); set_fyacel(0); }
|
|
void stop_vel() { set_xvel(0); set_yvel(0); set_fxvel(0); set_fyvel(0); }
|
|
@@ -114,7 +114,7 @@
|
|
int mover(int cx, int cy, int button);
|
|
figure *current_figure() { return current_sequence()->get_figure(current_frame); }
|
|
int total_frames() { return current_sequence()->length(); }
|
|
- void picture_space(long &x1, long &y1,long &x2, long &y2);
|
|
+ void picture_space(int32_t &x1, int32_t &y1,int32_t &x2, int32_t &y2);
|
|
int tx(int x) { if (direction>0) return x-x_center(); else return x_center()-x; }
|
|
int ty(int y) { return y-picture()->height()+1; }
|
|
void defaults();
|
|
@@ -133,8 +133,8 @@
|
|
void reload_notify();
|
|
|
|
void change_type(int new_type);
|
|
- int set_var_by_name(char *name, long value);
|
|
- long get_var_by_name(char *name, int &error);
|
|
+ int set_var_by_name(char *name, int32_t value);
|
|
+ int32_t get_var_by_name(char *name, int &error);
|
|
game_object *copy();
|
|
void change_aitype(int new_type);
|
|
~game_object();
|
|
@@ -150,12 +150,12 @@
|
|
|
|
extern game_object *current_object;
|
|
extern view *current_view;
|
|
-game_object *create(int type, long x, long y, int skip_constructor=0, int aitype=0);
|
|
+game_object *create(int type, int32_t x, int32_t y, int skip_constructor=0, int aitype=0);
|
|
int base_size();
|
|
|
|
void delete_object_list(object_node *first);
|
|
int object_to_number_in_list(game_object *who, object_node *list);
|
|
-game_object *number_to_object_in_list(long x, object_node *list);
|
|
+game_object *number_to_object_in_list(int32_t x, object_node *list);
|
|
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/include/cache.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/cache.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/cache.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -22,10 +22,10 @@
|
|
struct cache_item
|
|
{
|
|
void *data;
|
|
- long last_access;
|
|
- unsigned char type;
|
|
- short file_number;
|
|
- long offset;
|
|
+ int32_t last_access;
|
|
+ uint8_t type;
|
|
+ int16_t file_number;
|
|
+ int32_t offset;
|
|
} ;
|
|
|
|
|
|
@@ -34,7 +34,7 @@
|
|
{
|
|
public :
|
|
int crc_calculated;
|
|
- ulong crc;
|
|
+ uint32_t crc;
|
|
char *filename;
|
|
crced_file(char *name);
|
|
~crced_file();
|
|
@@ -47,9 +47,9 @@
|
|
public :
|
|
crc_manager();
|
|
int get_filenumber(char *filename);
|
|
- ulong get_crc(long filenumber, int &failed);
|
|
- void set_crc(long filenumber, ulong crc);
|
|
- char *get_filename(long filenumber);
|
|
+ uint32_t get_crc(int32_t filenumber, int &failed);
|
|
+ void set_crc(int32_t filenumber, uint32_t crc);
|
|
+ char *get_filename(int32_t filenumber);
|
|
void clean_up();
|
|
int total_filenames() { return total_files; }
|
|
int write_crc_file(char *filename);
|
|
@@ -61,17 +61,17 @@
|
|
class cache_list
|
|
{
|
|
cache_item *list;
|
|
- long total,last_registered,last_access,poll_start_access;
|
|
- short last_file; // for speed leave the last file accessed open
|
|
+ int32_t total,last_registered,last_access,poll_start_access;
|
|
+ int16_t last_file; // for speed leave the last file accessed open
|
|
|
|
bFILE *fp,*cache_file,*cache_read_file;
|
|
spec_directory *last_dir;
|
|
- long last_offset; // store the last offset so we don't have to seek if
|
|
+ int32_t last_offset; // store the last offset so we don't have to seek if
|
|
// we don't need to
|
|
|
|
|
|
- short lcache_number;
|
|
- long alloc_id();
|
|
+ int16_t lcache_number;
|
|
+ int32_t alloc_id();
|
|
void locate(cache_item *i, int local_only=0); // set up file and offset for this item
|
|
void normalize();
|
|
void unmalloc(cache_item *i);
|
|
@@ -86,9 +86,9 @@
|
|
void free_oldest();
|
|
int in_use() { if (used) { used=0; return 1; } else return 0; }
|
|
int full() { if (ful) { ful=0; return 1; } else return 0; }
|
|
- long reg_object(char *filename, void *object, int type, int rm_dups); // lisp object
|
|
- long reg(char *filename, char *name, int type=-1, int rm_dups=0); // returns id to item
|
|
- long reg_lisp_block(Cell *block);
|
|
+ int32_t reg_object(char *filename, void *object, int type, int rm_dups); // lisp object
|
|
+ int32_t reg(char *filename, char *name, int type=-1, int rm_dups=0); // returns id to item
|
|
+ int32_t reg_lisp_block(Cell *block);
|
|
int loaded(int id);
|
|
void unreg(int id);
|
|
void note_need(int id);
|
|
@@ -113,7 +113,7 @@
|
|
int offset_compare(int a, int b);
|
|
|
|
void load_cache_prof_info(char *filename, level *lev);
|
|
- int search(int *sarray, ushort filenum, long offset); // sarray is a index table sorted by offset/filenum
|
|
+ int search(int *sarray, uint16_t filenum, int32_t offset); // sarray is a index table sorted by offset/filenum
|
|
|
|
void show_accessed();
|
|
void empty();
|
|
Index: abuse-sdl-0.7.0/src/include/level.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/level.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/level.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -26,23 +26,23 @@
|
|
class area_controller
|
|
{
|
|
public :
|
|
- long x,y,w,h,active;
|
|
- long ambient,view_xoff,view_yoff;
|
|
- long ambient_speed, view_xoff_speed,view_yoff_speed;
|
|
+ int32_t x,y,w,h,active;
|
|
+ int32_t ambient,view_xoff,view_yoff;
|
|
+ int32_t ambient_speed, view_xoff_speed,view_yoff_speed;
|
|
area_controller *next;
|
|
- area_controller(long X, long Y, long W, long H, area_controller *Next);
|
|
+ area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next);
|
|
} ;
|
|
|
|
-extern long last_tile_hit_x,last_tile_hit_y;
|
|
+extern int32_t last_tile_hit_x,last_tile_hit_y;
|
|
extern int dev;
|
|
class level // contain map info and objects
|
|
{
|
|
- unsigned short *map_fg, // just big 2d arrays
|
|
- *map_bg,
|
|
- bg_width,bg_height,
|
|
- fg_width,fg_height;
|
|
+ uint16_t *map_fg, // just big 2d arrays
|
|
+ *map_bg,
|
|
+ bg_width,bg_height,
|
|
+ fg_width,fg_height;
|
|
char *Name,*first_name;
|
|
- long total_objs;
|
|
+ int32_t total_objs;
|
|
game_object *first,*first_active,*last;
|
|
|
|
game_object **attack_list; // list of characters for tick which can attack someone
|
|
@@ -63,12 +63,12 @@
|
|
game_object **all_block_list; // list of characters who can block a character or can be hurt
|
|
int all_block_list_size,all_block_total;
|
|
void add_all_block(game_object *who);
|
|
- ulong ctick;
|
|
+ uint32_t ctick;
|
|
|
|
public :
|
|
char *original_name() { if (first_name) return first_name; else return Name; }
|
|
- ulong tick_counter() { return ctick; }
|
|
- void set_tick_counter(ulong x);
|
|
+ uint32_t tick_counter() { return ctick; }
|
|
+ void set_tick_counter(uint32_t x);
|
|
area_controller *area_list;
|
|
|
|
void clear_active_list() { first_active=NULL; }
|
|
@@ -79,10 +79,10 @@
|
|
|
|
game_object *first_object() { return first; }
|
|
game_object *first_active_object() { return first_active; }
|
|
- unsigned short foreground_width() { return fg_width; }
|
|
- unsigned short foreground_height() { return fg_height; }
|
|
- unsigned short background_width() { return bg_width; }
|
|
- unsigned short background_height() { return bg_height; }
|
|
+ uint16_t foreground_width() { return fg_width; }
|
|
+ uint16_t foreground_height() { return fg_height; }
|
|
+ uint16_t background_width() { return bg_width; }
|
|
+ uint16_t background_height() { return bg_height; }
|
|
int load_failed() { return map_fg==NULL; }
|
|
level(spec_directory *sd, bFILE *fp, char *lev_name);
|
|
void load_fail();
|
|
@@ -97,26 +97,26 @@
|
|
int fg_raised(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
|
|
return (*(map_fg+x+y*fg_width))&0x4000; }
|
|
void fg_set_raised(int x, int y, int r) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
|
|
- ushort v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000);
|
|
+ uint16_t v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000);
|
|
if (r) (*(map_fg+x+y*fg_width))=v|0x4000;
|
|
else (*(map_fg+x+y*fg_width))=v;
|
|
}
|
|
void mark_seen(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);
|
|
(*(map_fg+x+y*fg_width))|=0x8000; }
|
|
- void clear_fg(long x, long y) { *(map_fg+x+y*fg_width)&=0x7fff; }
|
|
+ void clear_fg(int32_t x, int32_t y) { *(map_fg+x+y*fg_width)&=0x7fff; }
|
|
|
|
- unsigned short *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }
|
|
- unsigned short *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }
|
|
- unsigned short get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)
|
|
+ uint16_t *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }
|
|
+ uint16_t *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }
|
|
+ uint16_t get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)
|
|
return fgvalue(*(map_fg+x+y*fg_width));
|
|
else return 0;
|
|
}
|
|
- unsigned short get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)
|
|
+ uint16_t get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)
|
|
return *(map_bg+x+y*bg_width);
|
|
else return 0;
|
|
}
|
|
- void put_fg(int x, int y, unsigned short tile) { *(map_fg+x+y*fg_width)=tile; }
|
|
- void put_bg(int x, int y, unsigned short tile) { *(map_bg+x+y*bg_width)=tile; }
|
|
+ void put_fg(int x, int y, uint16_t tile) { *(map_fg+x+y*fg_width)=tile; }
|
|
+ void put_bg(int x, int y, uint16_t tile) { *(map_bg+x+y*bg_width)=tile; }
|
|
void draw_objects(view *v);
|
|
void interpolate_draw_objects(view *v);
|
|
void draw_areas(view *v);
|
|
@@ -140,24 +140,24 @@
|
|
|
|
void unactivate_all();
|
|
// forms all the objects in processing range into a linked list
|
|
- int add_actives(long x1, long y1, long x2, long y2); //returns total added
|
|
+ int add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2); //returns total added
|
|
void pull_actives(game_object *o, game_object *&last_active, int &t);
|
|
- int add_drawables(long x1, long y1, long x2, long y2); //returns total added
|
|
+ int add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2); //returns total added
|
|
|
|
- game_object *find_object(long x, long y);
|
|
+ game_object *find_object(int32_t x, int32_t y);
|
|
|
|
- game_object *damage_intersect(long x1, long y1, long &x2, long &y2, game_object *exclude);
|
|
- game_object *boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2);
|
|
- game_object *all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2);
|
|
+ game_object *damage_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2, game_object *exclude);
|
|
+ game_object *boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
|
|
+ game_object *all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
|
|
int crush(game_object *by_who, int xamount, int yamount);
|
|
int push_characters(game_object *by_who, int xamount, int yamount); // return 0 if fail on any.
|
|
int platform_push(game_object *by_who, int xamount, int yamount);
|
|
- void foreground_intersect(long x1, long y1, long &x2, long &y2);
|
|
- void vforeground_intersect(long x1, long y1, long &y2);
|
|
+ void foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2);
|
|
+ void vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2);
|
|
|
|
- void hurt_radius(long x, long y,long r, long m, game_object *from, game_object *exclude,
|
|
+ void hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude,
|
|
int max_push);
|
|
- void send_signal(long signal);
|
|
+ void send_signal(int32_t signal);
|
|
void next_focus();
|
|
void to_front(game_object *o);
|
|
void to_back(game_object *o);
|
|
@@ -181,11 +181,11 @@
|
|
bFILE *create_dir(char *filename, int save_all,
|
|
object_node *save_list, object_node *exclude_list);
|
|
view *make_view_list(int nplayers);
|
|
- long total_light_links(object_node *list);
|
|
- long total_object_links(object_node *save_list);
|
|
- game_object *find_object_in_area(long x, long y, long x1, long y1,
|
|
- long x2, long y2, Cell *list, game_object *exclude);
|
|
- game_object *find_object_in_angle(long x, long y, long start_angle, long end_angle,
|
|
+ int32_t total_light_links(object_node *list);
|
|
+ int32_t total_object_links(object_node *save_list);
|
|
+ game_object *find_object_in_area(int32_t x, int32_t y, int32_t x1, int32_t y1,
|
|
+ int32_t x2, int32_t y2, Cell *list, game_object *exclude);
|
|
+ game_object *find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle,
|
|
void *list, game_object *exclude);
|
|
object_node *make_not_list(object_node *list);
|
|
int load_player_info(bFILE *fp, spec_directory *sd, object_node *save_list);
|
|
Index: abuse-sdl-0.7.0/src/include/game.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/game.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/game.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -45,7 +45,7 @@
|
|
|
|
extern char **start_argv;
|
|
extern int start_argc;
|
|
-extern long current_vxadd,current_vyadd;
|
|
+extern int32_t current_vxadd,current_vyadd;
|
|
extern int frame_panic,massive_frame_panic;
|
|
extern int demo_start,idle_ticks;
|
|
|
|
@@ -57,7 +57,7 @@
|
|
int bright_color,med_color,dark_color, // for boundaries and windows, etc
|
|
morph_bright_color,morph_med_color,morph_dark_color;
|
|
|
|
- long last_time,fps;
|
|
+ int32_t last_time,fps;
|
|
char mapname[100],command[200],help_text[200];
|
|
int refresh,mousex,mousey,help_text_frames;
|
|
int has_joystick,no_delay;
|
|
@@ -65,7 +65,7 @@
|
|
|
|
jwindow *top_menu,*joy_win,*last_input;
|
|
JCFont *game_font;
|
|
- uchar keymap[512/8];
|
|
+ uint8_t keymap[512/8];
|
|
|
|
public :
|
|
int key_down(int key) { return keymap[key/8]&(1<<(key%8)); }
|
|
@@ -92,14 +92,14 @@
|
|
return cash.foret(foretiles[BLACK]); else
|
|
return cash.foret(foretiles[x]); }
|
|
|
|
- void ftile_on(int screenx, int screeny, long &x, long &y);
|
|
- void btile_on(int screenx, int screeny, long &x, long &y);
|
|
+ void ftile_on(int screenx, int screeny, int32_t &x, int32_t &y);
|
|
+ void btile_on(int screenx, int screeny, int32_t &x, int32_t &y);
|
|
void toggle_delay();
|
|
void set_delay(int on) { no_delay=!on; }
|
|
void pan(int xv, int yv);
|
|
|
|
- void mouse_to_game(long x, long y, long &gamex, long &gamey, view *v=NULL);
|
|
- void game_to_mouse(long gamex, long gamey, view *which, long &x, long &y);
|
|
+ void mouse_to_game(int32_t x, int32_t y, int32_t &gamex, int32_t &gamey, view *v=NULL);
|
|
+ void game_to_mouse(int32_t gamex, int32_t gamey, view *which, int32_t &x, int32_t &y);
|
|
view *view_in(int mousex, int mousey);
|
|
|
|
int calc_speed();
|
|
@@ -138,7 +138,7 @@
|
|
void set_state(int new_state);
|
|
int game_over();
|
|
void grow_views(int amount);
|
|
- void play_sound(int id, int vol, long x, long y);
|
|
+ void play_sound(int id, int vol, int32_t x, int32_t y);
|
|
void request_level_load(char *name);
|
|
void request_end();
|
|
~game();
|
|
Index: abuse-sdl-0.7.0/src/include/extend.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/extend.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/extend.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -22,18 +22,18 @@
|
|
class simple_object
|
|
{
|
|
public :
|
|
- schar Fade_dir;
|
|
- uchar Fade_count,Fade_max;
|
|
- uchar Flags,grav_on,targetable_on;
|
|
- long Xvel,Yvel,Xacel,Yacel;
|
|
- uchar Fx,Fy,Fxvel,Fyvel,Fxacel,Fyacel;
|
|
- uchar Aitype;
|
|
- ushort Aistate,Aistate_time;
|
|
- unsigned short Hp,Mp,Fmp;
|
|
- schar Frame_dir;
|
|
+ int8_t Fade_dir;
|
|
+ uint8_t Fade_count,Fade_max;
|
|
+ uint8_t Flags,grav_on,targetable_on;
|
|
+ int32_t Xvel,Yvel,Xacel,Yacel;
|
|
+ uint8_t Fx,Fy,Fxvel,Fyvel,Fxacel,Fyacel;
|
|
+ uint8_t Aitype;
|
|
+ uint16_t Aistate,Aistate_time;
|
|
+ uint16_t Hp,Mp,Fmp;
|
|
+ int8_t Frame_dir;
|
|
|
|
|
|
- uchar tobjs,tlights;
|
|
+ uint8_t tobjs,tlights;
|
|
game_object **objs,*link;
|
|
light_source **lights;
|
|
|
|
@@ -42,15 +42,15 @@
|
|
int total_vars();
|
|
char *var_name(int x);
|
|
int var_type(int x);
|
|
- void set_var(int x, ulong v);
|
|
- long get_var(int x);
|
|
+ void set_var(int x, uint32_t v);
|
|
+ int32_t get_var(int x);
|
|
|
|
// leave these public, so I don't have monster code changes.
|
|
simple_object();
|
|
- long x,y,
|
|
+ int32_t x,y,
|
|
last_x,last_y; // used for frame interpolation on fast machines
|
|
- schar direction,active;
|
|
- ushort otype;
|
|
+ int8_t direction,active;
|
|
+ uint16_t otype;
|
|
character_state state;
|
|
short current_frame;
|
|
|
|
@@ -59,38 +59,38 @@
|
|
int floating() { return flags()&FLOATING_FLAG; }
|
|
|
|
int keep_ai_info() { return 1; }
|
|
- uchar flags() { return Flags; }
|
|
- long xvel() { return Xvel; }
|
|
- long yvel() { return Yvel; }
|
|
- long xacel() { return Xacel; }
|
|
- long yacel() { return Yacel; }
|
|
-
|
|
- uchar fx() { return Fx; }
|
|
- uchar fy() { return Fy; }
|
|
- uchar fxvel() { return Fxvel; }
|
|
- uchar fyvel() { return Fyvel; }
|
|
- uchar fxacel() { return Fxacel; }
|
|
- uchar fyacel() { return Fyacel; }
|
|
-
|
|
- uchar sfx() { return Fx; } // x & y should always be positive
|
|
- uchar sfy() { return Fy; }
|
|
- uchar sfxvel() { if (Xvel>=0) return Fxvel; else return -Fxvel; }
|
|
- uchar sfyvel() { if (Yvel>=0) return Fyvel; else return -Fyvel; }
|
|
- uchar sfxacel() { if (Xacel>=0) return Fxacel; else return -Fxacel; }
|
|
- uchar sfyacel() { if (Yacel>=0) return Fyacel; else return -Fyacel; }
|
|
-
|
|
- uchar aitype() { return Aitype; }
|
|
- ushort aistate() { return Aistate; }
|
|
- ushort aistate_time() { return Aistate_time; }
|
|
- ushort hp() { return Hp; }
|
|
- ushort mp() { return Mp; }
|
|
- ushort fmp() { return Fmp; }
|
|
- schar fade_dir() { return Fade_dir; }
|
|
- schar frame_dir() { return Frame_dir; }
|
|
- uchar fade_count() { return Fade_count; }
|
|
- uchar fade_max() { return Fade_max; }
|
|
- uchar total_objects() { return tobjs; }
|
|
- uchar total_lights() { return tlights; }
|
|
+ uint8_t flags() { return Flags; }
|
|
+ int32_t xvel() { return Xvel; }
|
|
+ int32_t yvel() { return Yvel; }
|
|
+ int32_t xacel() { return Xacel; }
|
|
+ int32_t yacel() { return Yacel; }
|
|
+
|
|
+ uint8_t fx() { return Fx; }
|
|
+ uint8_t fy() { return Fy; }
|
|
+ uint8_t fxvel() { return Fxvel; }
|
|
+ uint8_t fyvel() { return Fyvel; }
|
|
+ uint8_t fxacel() { return Fxacel; }
|
|
+ uint8_t fyacel() { return Fyacel; }
|
|
+
|
|
+ uint8_t sfx() { return Fx; } // x & y should always be positive
|
|
+ uint8_t sfy() { return Fy; }
|
|
+ uint8_t sfxvel() { if (Xvel>=0) return Fxvel; else return -Fxvel; }
|
|
+ uint8_t sfyvel() { if (Yvel>=0) return Fyvel; else return -Fyvel; }
|
|
+ uint8_t sfxacel() { if (Xacel>=0) return Fxacel; else return -Fxacel; }
|
|
+ uint8_t sfyacel() { if (Yacel>=0) return Fyacel; else return -Fyacel; }
|
|
+
|
|
+ uint8_t aitype() { return Aitype; }
|
|
+ uint16_t aistate() { return Aistate; }
|
|
+ uint16_t aistate_time() { return Aistate_time; }
|
|
+ uint16_t hp() { return Hp; }
|
|
+ uint16_t mp() { return Mp; }
|
|
+ uint16_t fmp() { return Fmp; }
|
|
+ int8_t fade_dir() { return Fade_dir; }
|
|
+ int8_t frame_dir() { return Frame_dir; }
|
|
+ uint8_t fade_count() { return Fade_count; }
|
|
+ uint8_t fade_max() { return Fade_max; }
|
|
+ uint8_t total_objects() { return tobjs; }
|
|
+ uint8_t total_lights() { return tlights; }
|
|
|
|
morph_char *morph_status() { return mc; }
|
|
light_source *get_light(int x)
|
|
@@ -99,32 +99,32 @@
|
|
{ if (x>=tobjs) { lbreak("bad x for object\n"); exit(0); } return objs[x]; }
|
|
view *controller() { return Controller; }
|
|
|
|
- void set_targetable(uchar x) { targetable_on=x; }
|
|
- void set_flags(uchar f) { Flags=f; }
|
|
- void set_xvel(long xv) { Xvel=xv; }
|
|
- void set_yvel(long yv) { Yvel=yv; }
|
|
- void set_xacel(long xa) { Xacel=xa; }
|
|
- void set_yacel(long ya) { Yacel=ya; }
|
|
- void set_fx(uchar x) { Fx=x; }
|
|
- void set_fy(uchar y) { Fy=y; }
|
|
- void set_fxvel(uchar xv) { Fxvel=abs(xv); }
|
|
- void set_fyvel(uchar yv) { Fyvel=abs(yv); }
|
|
- void set_fxacel(uchar xa) { Fxacel=abs(xa); }
|
|
- void set_fyacel(uchar ya) { Fyacel=abs(ya); }
|
|
- void set_aitype(uchar t) { Aitype=t; }
|
|
- void set_aistate(ushort s) { Aistate=s; }
|
|
- void set_aistate_time(ushort t) { Aistate_time=t; }
|
|
- void set_hp(ushort h) { Hp=h; }
|
|
- void set_mp(ushort m) { Mp=m; }
|
|
- void set_fmp(ushort m) { Fmp=m; }
|
|
+ void set_targetable(uint8_t x) { targetable_on=x; }
|
|
+ void set_flags(uint8_t f) { Flags=f; }
|
|
+ void set_xvel(int32_t xv) { Xvel=xv; }
|
|
+ void set_yvel(int32_t yv) { Yvel=yv; }
|
|
+ void set_xacel(int32_t xa) { Xacel=xa; }
|
|
+ void set_yacel(int32_t ya) { Yacel=ya; }
|
|
+ void set_fx(uint8_t x) { Fx=x; }
|
|
+ void set_fy(uint8_t y) { Fy=y; }
|
|
+ void set_fxvel(uint8_t xv) { Fxvel=abs(xv); }
|
|
+ void set_fyvel(uint8_t yv) { Fyvel=abs(yv); }
|
|
+ void set_fxacel(uint8_t xa) { Fxacel=abs(xa); }
|
|
+ void set_fyacel(uint8_t ya) { Fyacel=abs(ya); }
|
|
+ void set_aitype(uint8_t t) { Aitype=t; }
|
|
+ void set_aistate(uint16_t s) { Aistate=s; }
|
|
+ void set_aistate_time(uint16_t t) { Aistate_time=t; }
|
|
+ void set_hp(uint16_t h) { Hp=h; }
|
|
+ void set_mp(uint16_t m) { Mp=m; }
|
|
+ void set_fmp(uint16_t m) { Fmp=m; }
|
|
|
|
|
|
|
|
- void set_fade_count(uchar f) { Fade_count=f; }
|
|
- void set_fade_max(uchar m) { Fade_max=m; }
|
|
- void set_fade_dir(schar d) { Fade_dir=d; }
|
|
+ void set_fade_count(uint8_t f) { Fade_count=f; }
|
|
+ void set_fade_max(uint8_t m) { Fade_max=m; }
|
|
+ void set_fade_dir(int8_t d) { Fade_dir=d; }
|
|
|
|
- void set_frame_dir(schar d) { Frame_dir=d; }
|
|
+ void set_frame_dir(int8_t d) { Frame_dir=d; }
|
|
void add_light(light_source *ls);
|
|
void add_object(game_object *o);
|
|
|
|
Index: abuse-sdl-0.7.0/src/include/light.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/light.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/light.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -7,26 +7,26 @@
|
|
#include "crc.hpp"
|
|
|
|
#define TTINTS 9
|
|
-extern uchar *tints[TTINTS];
|
|
-extern unsigned char *white_light,*white_light_initial,*green_light,*trans_table;
|
|
-extern short ambient_ramp;
|
|
+extern uint8_t *tints[TTINTS];
|
|
+extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
|
|
+extern int16_t ambient_ramp;
|
|
#define REVERSE_GREEN_TINT 8
|
|
|
|
-extern short shutdown_lighting_value,shutdown_lighting;
|
|
+extern int16_t shutdown_lighting_value,shutdown_lighting;
|
|
|
|
class light_source
|
|
{
|
|
public :
|
|
- long type,x,xshift,y,yshift;
|
|
- long outer_radius,mul_div,inner_radius;
|
|
+ int32_t type,x,xshift,y,yshift;
|
|
+ int32_t outer_radius,mul_div,inner_radius;
|
|
|
|
- long x1,y1,x2,y2;
|
|
+ int32_t x1,y1,x2,y2;
|
|
char known;
|
|
light_source *next;
|
|
|
|
void calc_range();
|
|
- light_source(char Type, long X, long Y, long Inner_radius, long Outer_radius,
|
|
- long Xshift, long Yshift,
|
|
+ light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, int32_t Outer_radius,
|
|
+ int32_t Xshift, int32_t Yshift,
|
|
light_source *Next);
|
|
light_source *copy();
|
|
} ;
|
|
@@ -34,25 +34,25 @@
|
|
class light_patch
|
|
{
|
|
public :
|
|
- long total,x1,y1,x2,y2;
|
|
+ int32_t total,x1,y1,x2,y2;
|
|
light_source **lights;
|
|
light_patch *next;
|
|
- light_patch(long X1, long Y1, long X2, long Y2, light_patch *Next)
|
|
+ light_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_patch *Next)
|
|
{
|
|
x1=X1; y1=Y1; x2=X2; y2=Y2;
|
|
next=Next;
|
|
total=0;
|
|
lights=NULL;
|
|
}
|
|
- void add_light(long X1, long Y1, long X2, long Y2, light_source *who);
|
|
+ void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who);
|
|
light_patch *copy(light_patch *Next);
|
|
~light_patch() { if (total) jfree(lights); }
|
|
} ;
|
|
|
|
void delete_all_lights();
|
|
void delete_light(light_source *which);
|
|
-light_source *add_light_source(char type, long x, long y,
|
|
- long inner, long outer, long xshift, long yshift);
|
|
+light_source *add_light_source(char type, int32_t x, int32_t y,
|
|
+ int32_t inner, int32_t outer, int32_t xshift, int32_t yshift);
|
|
|
|
void add_light_spec(spec_directory *sd, char *level_name);
|
|
void write_lights(bFILE *fp);
|
|
@@ -61,16 +61,16 @@
|
|
|
|
void delete_patch_list(light_patch *first);
|
|
light_patch *find_patch(int screenx, int screeny, light_patch *list);
|
|
-int calc_light_value(long x, long y, light_patch *which);
|
|
-void light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient);
|
|
-void double_light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient,
|
|
- image *out, long out_x, long out_y);
|
|
+int calc_light_value(int32_t x, int32_t y, light_patch *which);
|
|
+void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
|
|
+void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
|
|
+ image *out, int32_t out_x, int32_t out_y);
|
|
|
|
void calc_light_table(palette *pal);
|
|
extern light_source *first_light_source;
|
|
extern int light_detail;
|
|
|
|
-extern long light_to_number(light_source *l);
|
|
-extern light_source *number_to_light(long x);
|
|
+extern int32_t light_to_number(light_source *l);
|
|
+extern light_source *number_to_light(int32_t x);
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/include/crc.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/crc.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/crc.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -3,8 +3,8 @@
|
|
#include "specs.hpp"
|
|
#include "macs.hpp"
|
|
|
|
-unsigned short calc_crc(unsigned char *buf, long len);
|
|
-ulong crc_file(bFILE *fp);
|
|
+uint16_t calc_crc(uint8_t *buf, int len);
|
|
+uint32_t crc_file(bFILE *fp);
|
|
|
|
|
|
#endif
|
|
Index: abuse-sdl-0.7.0/src/include/intsect.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/intsect.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/intsect.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,8 +1,8 @@
|
|
#ifndef __INTSECT_HPP_
|
|
#define __INTSECT_HPP_
|
|
|
|
-int setback_intersect(long x1, long y1, long &x2, long &y2,
|
|
- long xp1, long yp1, long xp2, long yp2, long inside);
|
|
+int setback_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2,
|
|
+ int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2, int32_t inside);
|
|
|
|
#endif
|
|
|
|
Index: abuse-sdl-0.7.0/src/sdlport/setup.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/sdlport/setup.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/sdlport/setup.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -39,6 +39,7 @@
|
|
printf( "** Abuse Options **\n" );
|
|
printf( " -size <arg> Set the size of the screen\n" );
|
|
printf( " -edit Startup in editor mode\n" );
|
|
+ printf( " -a <arg> Use addon named <arg>\n" );
|
|
printf( " -f <arg> Load map file named <arg>\n" );
|
|
printf( " -lisp Startup in lisp interpreter mode\n" );
|
|
printf( " -nodelay Run at maximum speed\n" );
|
|
@@ -72,7 +73,7 @@
|
|
if( (fd = fopen( rcfile, "w" )) != NULL )
|
|
{
|
|
fputs( "; Abuse-SDL Configuration file\n\n", fd );
|
|
- fputs( "; Location of the datafiles\ndatadir=/usr/local/share/games/abuse\n\n", fd );
|
|
+ fputs( "; Location of the datafiles\ndatadir=/var/games/abuse\n\n", fd );
|
|
fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd );
|
|
fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd );
|
|
fputs( "; Use mono audio only\nmono=0\n\n", fd );
|
|
@@ -105,7 +106,7 @@
|
|
char *result;
|
|
|
|
rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
|
|
- sprintf( rcfile, "%s/abuserc\0", get_save_filename_prefix() );
|
|
+ sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() );
|
|
if( (fd = fopen( rcfile, "r" )) != NULL )
|
|
{
|
|
while( fgets( buf, sizeof( buf ), fd ) != NULL )
|
|
@@ -358,8 +359,8 @@
|
|
|
|
if( (homedir = getenv( "HOME" )) != NULL )
|
|
{
|
|
- savedir = (char *)jmalloc( strlen( homedir ) + 8, "savedir" );
|
|
- sprintf( savedir, "%s/.abuse/\0", homedir );
|
|
+ savedir = (char *)jmalloc( strlen( homedir ) + 9, "savedir" );
|
|
+ sprintf( savedir, "%s/.abuse/", homedir );
|
|
// Check if we already have a savegame directory
|
|
if( (fd = fopen( savedir, "r" )) == NULL )
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/sdlport/event.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/sdlport/event.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/sdlport/event.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -149,22 +149,7 @@
|
|
{
|
|
case SDL_QUIT:
|
|
{
|
|
- if( the_game->state == RUN_STATE )
|
|
- {
|
|
- // We're in the actual game so just confirm the user
|
|
- // wishes to quit and exit the game.
|
|
- if( confirm_quit() )
|
|
- {
|
|
- the_game->end_session();
|
|
- }
|
|
- }
|
|
- else
|
|
- {
|
|
- // We're at the menu screen so simluate the user
|
|
- // pressing the ESC key.
|
|
- ev.type = EV_KEY;
|
|
- ev.key = JK_ESC;
|
|
- }
|
|
+ exit(0);
|
|
break;
|
|
}
|
|
case SDL_MOUSEBUTTONUP:
|
|
@@ -343,6 +328,8 @@
|
|
ev.key = SDLK_COLON; break;
|
|
case SDLK_QUOTE:
|
|
ev.key = SDLK_QUOTEDBL; break;
|
|
+ default:
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/sdlport/video.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/sdlport/video.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/sdlport/video.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -225,13 +225,12 @@
|
|
//
|
|
void put_part_image( image *im, int x, int y, int x1, int y1, int x2, int y2 )
|
|
{
|
|
- int xs, xe, ys, ye;
|
|
+ int xe, ye;
|
|
SDL_Rect srcrect, dstrect;
|
|
int ii, jj;
|
|
int srcx, srcy, xstep, ystep;
|
|
Uint8 *dpixel;
|
|
Uint16 dinset;
|
|
- int dest_addr, line_width;
|
|
|
|
if( (unsigned)y > yres || (unsigned)x > xres )
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/sdlport/sound.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/sdlport/sound.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/sdlport/sound.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -66,7 +66,7 @@
|
|
{
|
|
if( handle->length > 0 && handle->pos )
|
|
{
|
|
- len = ( len > handle->length ? handle->length : len );
|
|
+ len = ( len > (int)handle->length ? handle->length : len );
|
|
SDL_MixAudio( stream, handle->pos, len, handle->volume );
|
|
handle->pos += len;
|
|
handle->length -= len;
|
|
@@ -111,8 +111,8 @@
|
|
|
|
// Check for the sfx directory, disable sound if we can't find it.
|
|
datadir = get_filename_prefix();
|
|
- sfxdir = (char *)jmalloc( strlen( datadir ) + 6, "sfxdir" );
|
|
- sprintf( sfxdir, "%s/sfx/\0", datadir );
|
|
+ sfxdir = (char *)jmalloc( strlen( datadir ) + 5 + 1, "sfxdir" );
|
|
+ sprintf( sfxdir, "%s/sfx/", datadir );
|
|
if( (fd = fopen( sfxdir,"r" )) == NULL )
|
|
{
|
|
// Didn't find the directory, so disable sound.
|
|
Index: abuse-sdl-0.7.0/src/net/include/fileman.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/fileman.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/fileman.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -18,9 +18,9 @@
|
|
net_socket *sock;
|
|
int file_fd;
|
|
|
|
- long size_to_read;
|
|
- long size;
|
|
nfs_client *next;
|
|
+ int32_t size_to_read;
|
|
+ int32_t size;
|
|
nfs_client(net_socket *sock, int file_fd, nfs_client *next);
|
|
int send_read(); // flushes as much of size_to_read as possible
|
|
~nfs_client();
|
|
@@ -32,16 +32,16 @@
|
|
public :
|
|
net_socket *sock;
|
|
void r_close(char *reason);
|
|
- long size; // server tells us the size of the file when we open it
|
|
+ int32_t size; // server tells us the size of the file when we open it
|
|
int open_local;
|
|
remote_file *next;
|
|
remote_file(net_socket *sock, char *filename, char *mode, remote_file *Next);
|
|
|
|
int unbuffered_read(void *buffer, size_t count);
|
|
int unbuffered_write(void *buf, size_t count) { return 0; } // not supported
|
|
- long unbuffered_tell();
|
|
- long unbuffered_seek(long offset);
|
|
- long file_size() { return size; }
|
|
+ int32_t unbuffered_tell();
|
|
+ int32_t unbuffered_seek(int32_t offset);
|
|
+ int32_t file_size() { return size; }
|
|
int open_failure() { return sock==NULL; }
|
|
~remote_file();
|
|
int fd() { if (sock) return sock->get_fd(); else return -1; }
|
|
@@ -63,11 +63,11 @@
|
|
|
|
|
|
int rf_open_file(char *&filename, char *mode);
|
|
- long rf_tell(int fd);
|
|
- long rf_seek(int fd, long offset);
|
|
+ int32_t rf_tell(int fd);
|
|
+ int32_t rf_seek(int fd, int32_t offset);
|
|
int rf_read(int fd, void *buffer, size_t count);
|
|
int rf_close(int fd);
|
|
- long rf_file_size(int fd);
|
|
+ int32_t rf_file_size(int fd);
|
|
void set_default_fs(net_address *def) { default_fs=def->copy(); }
|
|
~file_manager() { if (default_fs) delete default_fs; }
|
|
} ;
|
|
Index: abuse-sdl-0.7.0/src/net/include/gserver.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/gserver.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/gserver.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -35,8 +35,8 @@
|
|
int need_reload_start_ok() { return get_flag(Need_reload_start_ok); }
|
|
void set_need_reload_start_ok(int x) { set_flag(Need_reload_start_ok,x); }
|
|
|
|
- net_socket *comm;
|
|
int client_id;
|
|
+ net_socket *comm;
|
|
net_address *data_address;
|
|
player_client *next;
|
|
player_client(int client_id, net_socket *comm, net_address *data_address, player_client *next) :
|
|
Index: abuse-sdl-0.7.0/src/net/include/endian.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/endian.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/endian.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -18,18 +18,16 @@
|
|
// across the net as the other computer might have a different endianess
|
|
|
|
#ifdef BIGUNS
|
|
-#define swap_short(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
|
|
-#define swap_long(x) \
|
|
- ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
|
|
- ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
|
|
+#define swap_uint16(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
|
|
+#define swap_uint32(x) \
|
|
+ ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
|
|
+ ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
|
|
#else
|
|
-#define swap_short(x) (x)
|
|
-#define swap_long(x) (x)
|
|
+#define swap_uint16(x) (x)
|
|
+#define swap_uint32(x) (x)
|
|
|
|
#endif
|
|
|
|
-#define uchar unsigned char
|
|
-
|
|
#endif
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/net/include/sock.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/sock.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/sock.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -16,6 +16,7 @@
|
|
virtual void print() { ; }
|
|
virtual net_address *copy() = 0;
|
|
virtual void store_string(char *st, int st_length) = 0; // this should be able to be used get_node_address()
|
|
+ virtual ~net_address() {;}
|
|
} ;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/net/include/tcpip.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/tcpip.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/tcpip.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -84,14 +84,15 @@
|
|
};
|
|
typedef isllist<RequestItem *>::iterator p_request;
|
|
isllist<RequestItem*> servers,returned;
|
|
- net_socket *responder;
|
|
- ip_address *bcast;
|
|
|
|
// Notification Data
|
|
net_socket *notifier;
|
|
char notify_data[512];
|
|
int notify_len;
|
|
|
|
+ net_socket *responder;
|
|
+ ip_address *bcast;
|
|
+
|
|
int handle_notification();
|
|
int handle_responder();
|
|
public :
|
|
Index: abuse-sdl-0.7.0/src/net/include/ipx.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/ipx.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/ipx.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -140,9 +140,9 @@
|
|
|
|
void add_to_packet(void *buf, int size);
|
|
|
|
- void write_byte(unsigned char x) { add_to_packet(&x,1); }
|
|
- void write_short(unsigned short x) { x=lstl(x); add_to_packet(&x,2); }
|
|
- void write_long(unsigned long x) { x=lltl(x); add_to_packet(&x,4); }
|
|
+ void write_uint8(uint8_t x) { add_to_packet(&x,1); }
|
|
+ void write_uint16(uint16_t x) { x=lstl(x); add_to_packet(&x,2); }
|
|
+ void write_uint32(uint32_t x) { x=lltl(x); add_to_packet(&x,4); }
|
|
|
|
|
|
} *pk;
|
|
Index: abuse-sdl-0.7.0/src/net/include/indian.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/include/indian.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/include/indian.hpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -9,18 +9,16 @@
|
|
// across the net as the other computer might have a different endianess
|
|
|
|
#ifdef BIGUNS
|
|
-#define lstl(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
|
|
+#define lstl(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
|
|
#define lltl(x) \
|
|
- ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
|
|
- ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
|
|
+ ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
|
|
+ ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
|
|
#else
|
|
#define lstl(x) (x)
|
|
#define lltl(x) (x)
|
|
|
|
#endif
|
|
|
|
-#define uchar unsigned char
|
|
-
|
|
#endif
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/net/tcpip.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/tcpip.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/tcpip.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -98,7 +98,7 @@
|
|
#else
|
|
char my_name[100]; // check to see if this address is 'hostname'
|
|
gethostname(my_name,100);
|
|
- ip_address *ret = 0;
|
|
+ //ip_address *ret = 0;
|
|
|
|
if (my_name[0]<'0' || my_name[0]>'9')
|
|
{
|
|
@@ -378,8 +378,8 @@
|
|
{
|
|
buf[len] = 0;
|
|
if (strcmp(buf, notify_signature)==0) {
|
|
- char s[256];
|
|
#ifdef TCPIP_DEBUG
|
|
+ char s[256];
|
|
addr->store_string(s,256);
|
|
printf("responding to %s",s);
|
|
#endif
|
|
@@ -536,7 +536,9 @@
|
|
|
|
if (!found)
|
|
{
|
|
+#ifdef TCPIP_DEBUG
|
|
char s[256];
|
|
+#endif
|
|
RequestItem *r = new RequestItem;
|
|
r->addr = addr;
|
|
strcpy(r->name,buf+5); // ack hard coded numbers for now
|
|
Index: abuse-sdl-0.7.0/src/net/netdrv.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/netdrv.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/netdrv.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -23,8 +23,8 @@
|
|
#include <bstring.h>
|
|
#include <netdb.h>
|
|
|
|
-#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((char *)(ptr)-(char *)base)))
|
|
-#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((long)(ptr)+(long)(base))))
|
|
+#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((uint8_t *)(ptr)-(uint8_t *)base)))
|
|
+#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((intptr_t)(ptr)+(intptr_t)(base))))
|
|
|
|
net_driver *driver=NULL;
|
|
|
|
@@ -137,7 +137,7 @@
|
|
comm_failed();
|
|
|
|
// wait for engine to ack it has attached
|
|
- uchar ack=0;
|
|
+ uint8_t ack=0;
|
|
if (in->read(&ack,1)!=1 || ack!=1)
|
|
comm_failed();
|
|
|
|
@@ -215,7 +215,7 @@
|
|
int ret=0;
|
|
if (in->ready_to_read()) // commands from engine?
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (in->read(&cmd,1)!=1) return 0;
|
|
|
|
if (debug)
|
|
@@ -280,11 +280,11 @@
|
|
|
|
case NFCMD_REQUEST_ENTRY :
|
|
{
|
|
- uchar len;
|
|
+ uint8_t len;
|
|
char name[256];
|
|
if (in->read(&len,1)!=1) { mdie("could not read server name length"); }
|
|
if (in->read(name,len)!=len) { mdie("could not read server name"); }
|
|
- ushort success=join_server(name);
|
|
+ uint16_t success=join_server(name);
|
|
if (out->write(&success,2)!=2) mdie("cound not send lsf read failure");
|
|
} break;
|
|
case NFCMD_BECOME_SERVER :
|
|
@@ -294,7 +294,7 @@
|
|
} break;
|
|
case NFCMD_REQUEST_LSF :
|
|
{
|
|
- uchar len;
|
|
+ uint8_t len;
|
|
char name[256];
|
|
if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
|
|
if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
|
|
@@ -312,7 +312,7 @@
|
|
|
|
case NFCMD_PROCESS_LSF :
|
|
{
|
|
- uchar len,name[256];
|
|
+ uint8_t len,name[256];
|
|
if (in->read(&len,1)!=1) { mdie("could not read lsf name length"); }
|
|
if (in->read(name,len)!=len) { mdie("could not read lsf name"); }
|
|
|
|
@@ -320,7 +320,7 @@
|
|
{
|
|
lsf_waiter *c=lsf_wait_list;
|
|
lsf_wait_list=lsf_wait_list->next;
|
|
- uchar status=1;
|
|
+ uint8_t status=1;
|
|
c->sock->write(&len,1);
|
|
c->sock->write(name,len);
|
|
delete c;
|
|
@@ -333,7 +333,7 @@
|
|
{
|
|
crc_waiter *c=crc_wait_list;
|
|
crc_wait_list=crc_wait_list->next;
|
|
- uchar status=1;
|
|
+ uint8_t status=1;
|
|
c->sock->write(&status,1);
|
|
delete c;
|
|
}
|
|
@@ -341,7 +341,7 @@
|
|
|
|
case NFCMD_SET_FS :
|
|
{
|
|
- uchar size;
|
|
+ uint8_t size;
|
|
char sn[256];
|
|
if (in->read(&size,1)!=1) mdie("could not read filename length");
|
|
if (in->read(sn,size)!=size) mdie("could not read server name");
|
|
@@ -353,7 +353,7 @@
|
|
|
|
case NFCMD_OPEN :
|
|
{
|
|
- uchar size[2];
|
|
+ uint8_t size[2];
|
|
char filename[300],mode[20],*fn;
|
|
fn=filename;
|
|
if (in->read(size,2)!=2 ||
|
|
@@ -364,18 +364,18 @@
|
|
int fd=fman->rf_open_file(fn,mode);
|
|
if (fd==-2)
|
|
{
|
|
- uchar st[2];
|
|
+ uint8_t st[2];
|
|
st[0]=NF_OPEN_LOCAL_FILE;
|
|
st[1]=strlen(fn)+1;
|
|
if (out->write(st,2)!=2) comm_failed();
|
|
if (out->write(fn,st[1])!=st[1]) comm_failed();
|
|
} else if (fd==-1)
|
|
{
|
|
- uchar st=NF_OPEN_FAILED;
|
|
+ uint8_t st=NF_OPEN_FAILED;
|
|
if (out->write(&st,1)!=1) comm_failed();
|
|
} else
|
|
{
|
|
- uchar st=NF_OPEN_REMOTE_FILE;
|
|
+ uint8_t st=NF_OPEN_REMOTE_FILE;
|
|
if (out->write(&st,1)!=1) comm_failed();
|
|
if (out->write(&fd,sizeof(fd))!=sizeof(fd)) comm_failed();
|
|
}
|
|
@@ -394,29 +394,29 @@
|
|
case NFCMD_CLOSE :
|
|
{
|
|
fman->rf_close(fd);
|
|
- uchar st=1;
|
|
+ uint8_t st=1;
|
|
if (out->write(&st,1)!=1) comm_failed();
|
|
} break;
|
|
case NFCMD_SIZE :
|
|
{
|
|
- long x=fman->rf_file_size(fd);
|
|
+ int32_t x=fman->rf_file_size(fd);
|
|
if (out->write(&x,sizeof(x))!=sizeof(x)) comm_failed();
|
|
} break;
|
|
case NFCMD_TELL :
|
|
{
|
|
- long offset=fman->rf_tell(fd);
|
|
+ int32_t offset=fman->rf_tell(fd);
|
|
if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();
|
|
} break;
|
|
case NFCMD_SEEK :
|
|
{
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (in->read(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();
|
|
offset=fman->rf_seek(fd,offset);
|
|
if (out->write(&offset,sizeof(offset))!=sizeof(offset)) comm_failed();
|
|
} break;
|
|
case NFCMD_READ :
|
|
{
|
|
- long size;
|
|
+ int32_t size;
|
|
if (in->read(&size,sizeof(size))!=sizeof(size)) comm_failed();
|
|
fman->rf_read(fd,out,size);
|
|
} break;
|
|
@@ -445,10 +445,10 @@
|
|
return 0;
|
|
}
|
|
|
|
- uchar ctype=CLIENT_ABUSE;
|
|
- ushort port=lstl(game_port),cnum;
|
|
+ uint8_t ctype=CLIENT_ABUSE;
|
|
+ uint16_t port=lstl(game_port),cnum;
|
|
|
|
- uchar reg;
|
|
+ uint8_t reg;
|
|
if (sock->write(&ctype,1)!=1 || // send server out game port
|
|
sock->read(®,1)!=1) // is remote engine registered?
|
|
{ delete sock; return 0; }
|
|
@@ -483,7 +483,7 @@
|
|
if (getlogin())
|
|
strcpy(uname,getlogin());
|
|
else strcpy(uname,"unknown");
|
|
- uchar len=strlen(uname)+1;
|
|
+ uint8_t len=strlen(uname)+1;
|
|
|
|
if (sock->write(&len,1)!=1 ||
|
|
sock->write(uname,len)!=len ||
|
|
@@ -531,8 +531,8 @@
|
|
net_socket *sock=connect_to_server(name);
|
|
if (!sock) return 0;
|
|
|
|
- uchar ctype=CLIENT_LSF_WAITER;
|
|
- uchar len;
|
|
+ uint8_t ctype=CLIENT_LSF_WAITER;
|
|
+ uint8_t len;
|
|
|
|
if (sock->write(&ctype,1)!=1 ||
|
|
sock->read(&len,1)!=1 || len==0 ||
|
|
@@ -552,7 +552,7 @@
|
|
{
|
|
net_socket *sock=connect_to_server(server);
|
|
if (!sock) return 0;
|
|
- uchar cmd=CLIENT_CRC_WAITER;
|
|
+ uint8_t cmd=CLIENT_CRC_WAITER;
|
|
if (sock->write(&cmd,1)!=1 ||
|
|
sock->read(&cmd,1)!=1)
|
|
{ delete sock; return 0; }
|
|
Index: abuse-sdl-0.7.0/src/net/engine.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/engine.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/engine.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -245,7 +245,7 @@
|
|
comm_failed();
|
|
|
|
// wait for engine to ack it has attached
|
|
- uchar ack=0;
|
|
+ uint8_t ack=0;
|
|
if (read(driver_in_fd,&ack,1)!=1 || ack!=1)
|
|
comm_failed();
|
|
}
|
|
@@ -466,9 +466,9 @@
|
|
char *name_start=name;
|
|
int fd=connect_to_server(name);
|
|
if (fd<0) return 0;
|
|
- uchar ctype=CLIENT_LSF_WAITER;
|
|
+ uint8_t ctype=CLIENT_LSF_WAITER;
|
|
if (write(fd,&ctype,1)!=1) { close(fd); return 0; }
|
|
- uchar len;
|
|
+ uint8_t len;
|
|
if (read(fd,&len,1)!=1 || len==0) { close(fd); return 0; }
|
|
if (read(fd,name_start,len)!=len) { close(fd); return 0; }
|
|
close(fd);
|
|
@@ -481,18 +481,18 @@
|
|
strcpy(sn_start,server_name);
|
|
|
|
int fd=connect_to_server(server_name);
|
|
- uchar ctype=CLIENT_ABUSE;
|
|
+ uint8_t ctype=CLIENT_ABUSE;
|
|
if (write(fd,&ctype,1)!=1) { close(fd); return 0; }
|
|
|
|
// send server out game port
|
|
- ushort port=lstl(packet_port);
|
|
+ uint16_t port=lstl(packet_port);
|
|
if (write(fd,&port,2)!=2) { close(fd); return 0; }
|
|
|
|
// read server's game port
|
|
if (read(fd,&port,2)!=2) { close(fd); return 0; }
|
|
port=lstl(port);
|
|
|
|
- ushort cnum;
|
|
+ uint16_t cnum;
|
|
if (read(fd,&cnum,2)!=2 || cnum==0) { close(fd); return 0; }
|
|
cnum=lstl(cnum);
|
|
|
|
@@ -515,13 +515,13 @@
|
|
{
|
|
if (!c->has_joined)
|
|
{
|
|
- ushort cnum=lstl(c->client_id);
|
|
+ uint16_t cnum=lstl(c->client_id);
|
|
if (write(c->socket_fd,&cnum,2)!=2) { c->delete_me=1; }
|
|
c->wait_reload=1;
|
|
c->has_joined=1;
|
|
} else if (!c->delete_me)
|
|
{
|
|
- uchar reload=CLCMD_RELOAD;
|
|
+ uint8_t reload=CLCMD_RELOAD;
|
|
if (write(c->socket_fd,&reload,1)!=1) { c->delete_me=1; }
|
|
c->wait_reload=1;
|
|
}
|
|
@@ -581,7 +581,7 @@
|
|
|
|
void process_engine_command()
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (read(driver_in_fd,&cmd,1)!=1) { mdie("could not read command from engine"); }
|
|
switch (cmd)
|
|
{
|
|
@@ -643,7 +643,7 @@
|
|
{
|
|
if (game_server_fd>0)
|
|
{
|
|
- uchar ok=CLCMD_RELOADED;
|
|
+ uint8_t ok=CLCMD_RELOADED;
|
|
if (!write(game_server_fd,&ok,1)) { mdie("could not send join_ok msg"); }
|
|
next_process();
|
|
}
|
|
@@ -656,19 +656,19 @@
|
|
|
|
case NFCMD_REQUEST_ENTRY :
|
|
{
|
|
- uchar len;
|
|
+ uint8_t len;
|
|
char name[256];
|
|
if (read(driver_in_fd,&len,1)!=1) { mdie("could not read server name length"); }
|
|
if (read(driver_in_fd,name,len)!=len) { mdie("could not read server name"); }
|
|
strcpy(net_server,name);
|
|
- ushort success=join_game(name);
|
|
+ uint16_t success=join_game(name);
|
|
if (write(driver_out_fd,&success,2)!=2) mdie("cound not send lsf read failure");
|
|
next_process();
|
|
} break;
|
|
|
|
case NFCMD_REQUEST_LSF :
|
|
{
|
|
- uchar len;
|
|
+ uint8_t len;
|
|
char name[256];
|
|
if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
|
|
if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
|
|
@@ -687,14 +687,14 @@
|
|
|
|
case NFCMD_PROCESS_LSF :
|
|
{
|
|
- uchar len,name[256];
|
|
+ uint8_t len,name[256];
|
|
if (read(driver_in_fd,&len,1)!=1) { mdie("could not read lsf name length"); }
|
|
if (read(driver_in_fd,name,len)!=len) { mdie("could not read lsf name"); }
|
|
while (lsf_wait_list)
|
|
{
|
|
lsf_waiter *c=lsf_wait_list;
|
|
lsf_wait_list=lsf_wait_list->next;
|
|
- uchar status=1;
|
|
+ uint8_t status=1;
|
|
write(c->socket_fd,&len,1);
|
|
write(c->socket_fd,name,len);
|
|
delete c;
|
|
@@ -708,7 +708,7 @@
|
|
{
|
|
crc_waiter *c=crc_wait_list;
|
|
crc_wait_list=crc_wait_list->next;
|
|
- uchar status=1;
|
|
+ uint8_t status=1;
|
|
write(c->socket_fd,&status,1);
|
|
delete c;
|
|
}
|
|
@@ -717,7 +717,7 @@
|
|
|
|
case NFCMD_SET_FS :
|
|
{
|
|
- uchar size;
|
|
+ uint8_t size;
|
|
char sn[256];
|
|
if (read(driver_in_fd,&size,1)!=1) mdie("could not read filename length");
|
|
if (read(driver_in_fd,sn,size)!=size) mdie("could not read server name");
|
|
@@ -729,7 +729,7 @@
|
|
|
|
case NFCMD_OPEN :
|
|
{
|
|
- uchar size[2];
|
|
+ uint8_t size[2];
|
|
char filename[300],mode[20],*fn;
|
|
fn=filename;
|
|
if (read(driver_in_fd,size,2)!=2) mdie("could not read fd on open");
|
|
@@ -739,7 +739,7 @@
|
|
int fd=open_file(fn,mode);
|
|
if (fd==-2)
|
|
{
|
|
- uchar st[2];
|
|
+ uint8_t st[2];
|
|
st[0]=NF_OPEN_LOCAL_FILE;
|
|
st[1]=strlen(fn)+1;
|
|
if (write(driver_out_fd,st,2)!=2) comm_failed();
|
|
@@ -749,11 +749,11 @@
|
|
if (size!=st[1]) comm_failed();
|
|
} else if (fd==-1)
|
|
{
|
|
- uchar st=NF_OPEN_FAILED;
|
|
+ uint8_t st=NF_OPEN_FAILED;
|
|
if (write(driver_out_fd,&st,1)!=1) comm_failed();
|
|
} else
|
|
{
|
|
- uchar st=NF_OPEN_REMOTE_FILE;
|
|
+ uint8_t st=NF_OPEN_REMOTE_FILE;
|
|
if (write(driver_out_fd,&st,1)!=1) comm_failed();
|
|
if (write(driver_out_fd,&fd,sizeof(fd))!=sizeof(fd)) comm_failed();
|
|
}
|
|
@@ -777,7 +777,7 @@
|
|
{
|
|
unlink_remote_file(rf);
|
|
delete rf;
|
|
- uchar st=1;
|
|
+ uint8_t st=1;
|
|
if (write(driver_out_fd,&st,1)!=1) comm_failed();
|
|
} break;
|
|
case NFCMD_SIZE :
|
|
@@ -813,7 +813,7 @@
|
|
|
|
int process_client_command(client *c)
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (read(c->socket_fd,&cmd,1)!=1) return 0;
|
|
switch (cmd)
|
|
{
|
|
@@ -828,7 +828,7 @@
|
|
} break;
|
|
case CLCMD_REQUEST_RESEND :
|
|
{
|
|
- uchar tick;
|
|
+ uint8_t tick;
|
|
if (read(c->socket_fd,&tick,1)!=1) return 0;
|
|
|
|
|
|
@@ -877,11 +877,11 @@
|
|
|
|
int add_game_client(int fd, sockaddr *from) // returns false if could not join client
|
|
{
|
|
- ushort port;
|
|
+ uint16_t port;
|
|
if (read(fd,&port,2)!=2) { close(fd); return 0; }
|
|
port=lstl(port);
|
|
|
|
- ushort pport=lstl(packet_port);
|
|
+ uint16_t pport=lstl(packet_port);
|
|
if (write(fd,&pport,2)!=2) { close(fd); return 0; }
|
|
|
|
|
|
@@ -892,7 +892,7 @@
|
|
|
|
if (f===-1) { close(fd); return 0; }
|
|
|
|
- ushort client_id=lstl(f);
|
|
+ uint16_t client_id=lstl(f);
|
|
if (write(fd,&client_id,2)!=2) { close(fd); return 0; }
|
|
|
|
|
|
@@ -1123,7 +1123,7 @@
|
|
}
|
|
} else if (FD_ISSET(game_server_fd,&read_set))
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (read(game_server_fd,&cmd,1)!=1) { mdie("unable to read command from server"); }
|
|
switch (cmd)
|
|
{
|
|
@@ -1133,7 +1133,7 @@
|
|
} break;
|
|
case CLCMD_REQUEST_RESEND :
|
|
{
|
|
- uchar tick;
|
|
+ uint8_t tick;
|
|
if (read(game_server_fd,&tick,1)!=1) { mdie("unable to read resend tick from server"); }
|
|
|
|
fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
|
|
Index: abuse-sdl-0.7.0/src/net/gclient.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/gclient.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/gclient.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -23,13 +23,13 @@
|
|
|
|
int game_client::process_server_command()
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (client_sock->read(&cmd,1)!=1) return 0;
|
|
switch (cmd)
|
|
{
|
|
case CLCMD_REQUEST_RESEND :
|
|
{
|
|
- uchar tick;
|
|
+ uint8_t tick;
|
|
if (client_sock->read(&tick,1)!=1) return 0;
|
|
|
|
fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
|
|
@@ -37,7 +37,7 @@
|
|
|
|
if (tick==base->packet.tick_received() && !wait_local_input) // asking for this tick? make sure is collected
|
|
{
|
|
- fprintf(stderr,"resending client packet %d to server\n");
|
|
+ fprintf(stderr,"resending client packet %d to server\n",base->packet.tick_received());
|
|
net_packet *pack=&base->packet;
|
|
game_sock->write(pack->data,pack->packet_size()+pack->packet_prefix_size(),server_data_port);
|
|
|
|
@@ -66,7 +66,7 @@
|
|
int bytes_received=game_sock->read(tmp.data,PACKET_MAX_SIZE);
|
|
if (bytes_received==tmp.packet_size()+tmp.packet_prefix_size()) // was the packet complete?
|
|
{
|
|
- unsigned short rec_crc=tmp.get_checksum();
|
|
+ uint16_t rec_crc=tmp.get_checksum();
|
|
if (rec_crc==tmp.calc_checksum())
|
|
{
|
|
if (base->current_tick==tmp.tick_received())
|
|
@@ -140,14 +140,14 @@
|
|
|
|
int game_client::end_reload(int disconnect) // notify evryone you've reloaded the level (at server request)
|
|
{
|
|
- uchar cmd=CLCMD_RELOAD_END;
|
|
+ uint8_t cmd=CLCMD_RELOAD_END;
|
|
if (client_sock->write(&cmd,1)!=1) return 0;
|
|
return 1;
|
|
}
|
|
|
|
int game_client::start_reload()
|
|
{
|
|
- uchar cmd=CLCMD_RELOAD_START;
|
|
+ uint8_t cmd=CLCMD_RELOAD_START;
|
|
if (client_sock->write(&cmd,1)!=1) return 0;
|
|
if (client_sock->read(&cmd,1)!=1) return 0;
|
|
return 1;
|
|
@@ -165,7 +165,7 @@
|
|
|
|
int game_client::quit()
|
|
{
|
|
- uchar cmd=CLCMD_UNJOIN;
|
|
+ uint8_t cmd=CLCMD_UNJOIN;
|
|
if (client_sock->write(&cmd,1)!=1) return 0;
|
|
if (client_sock->read(&cmd,1)!=1) return 0;
|
|
return 1;
|
|
Index: abuse-sdl-0.7.0/src/net/netfile.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/netfile.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/netfile.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -100,8 +100,8 @@
|
|
if (FD_ISSET(socket_fd,&write_check)) // ready to write?
|
|
{
|
|
char buf[READ_PACKET_SIZE];
|
|
- short read_total;
|
|
- short actual;
|
|
+ int16_t read_total;
|
|
+ int16_t actual;
|
|
|
|
do
|
|
{
|
|
@@ -159,7 +159,7 @@
|
|
{
|
|
case NFCMD_READ :
|
|
{
|
|
- long size;
|
|
+ int32_t size;
|
|
if (read(c->socket_fd,&size,sizeof(size))!=sizeof(size)) return 0;
|
|
size=lltl(size);
|
|
|
|
@@ -172,7 +172,7 @@
|
|
} break;
|
|
case NFCMD_SEEK :
|
|
{
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (read(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
|
|
offset=lltl(offset);
|
|
offset=lseek(c->file_fd,offset,0);
|
|
@@ -182,7 +182,7 @@
|
|
} break;
|
|
case NFCMD_TELL :
|
|
{
|
|
- long offset=lseek(c->file_fd,0,SEEK_CUR);
|
|
+ int32_t offset=lseek(c->file_fd,0,SEEK_CUR);
|
|
offset=lltl(offset);
|
|
if (write(c->socket_fd,&offset,sizeof(offset))!=sizeof(offset)) return 0;
|
|
return 1;
|
|
@@ -199,7 +199,7 @@
|
|
|
|
void add_nfs_client(int fd)
|
|
{
|
|
- uchar size[2];
|
|
+ uint8_t size[2];
|
|
char filename[300],mode[20],*mp;
|
|
if (read(fd,size,2)!=2) { close(fd); return ; }
|
|
if (read(fd,filename,size[0])!=size[0]) { close(fd); return ; }
|
|
@@ -228,15 +228,15 @@
|
|
f=-1; // make sure this is -1
|
|
}
|
|
|
|
- long ret=lltl(f);
|
|
+ int32_t ret=lltl(f);
|
|
if (write(fd,&ret,sizeof(ret))!=sizeof(ret)) { close(fd); return ; }
|
|
|
|
if (f<0) // no file, sorry
|
|
close(fd);
|
|
else
|
|
{
|
|
- long cur_pos=lseek(f,0,SEEK_CUR);
|
|
- long size=lseek(f,0,SEEK_END);
|
|
+ int32_t cur_pos=lseek(f,0,SEEK_CUR);
|
|
+ int32_t size=lseek(f,0,SEEK_END);
|
|
lseek(f,cur_pos,SEEK_SET);
|
|
size=lltl(size);
|
|
if (write(fd,&size,sizeof(size))!=sizeof(size)) { close(f); close(fd); return ; }
|
|
@@ -252,7 +252,7 @@
|
|
fprintf(stderr,"remote_file : %s\n",reason);
|
|
if (socket_fd>=0)
|
|
{
|
|
- uchar cmd=NFCMD_CLOSE;
|
|
+ uint8_t cmd=NFCMD_CLOSE;
|
|
write(socket_fd,&cmd,1);
|
|
close(socket_fd);
|
|
}
|
|
@@ -271,21 +271,21 @@
|
|
return ;
|
|
}
|
|
|
|
- uchar sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
|
|
+ uint8_t sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
|
|
if (write(socket_fd,sizes,3)!=3) { r_close("could not send open info"); return ; }
|
|
if (write(socket_fd,filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
|
|
if (write(socket_fd,mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
|
|
|
|
- long remote_file_fd;
|
|
+ int32_t remote_file_fd;
|
|
if (read(socket_fd,&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd))
|
|
{ r_close("could not read remote fd"); return ; }
|
|
remote_file_fd=lltl(remote_file_fd);
|
|
if (remote_file_fd<0) { r_close("remote fd is bad"); return ; }
|
|
|
|
if (read(socket_fd,&size,sizeof(size))!=sizeof(size)) { r_close("could not read remote filesize"); return ; }
|
|
-// ulong remote_crc;
|
|
+// uint32_t remote_crc;
|
|
// if (read(socket_fd,&remote_crc,sizeof(remote_crc))!=sizeof(remote_crc)) { r_close("could not read remote checksum"); return ; }
|
|
-// ulong local_crc=
|
|
+// uint32_t local_crc=
|
|
|
|
size=lltl(size);
|
|
}
|
|
@@ -294,17 +294,17 @@
|
|
{
|
|
if (socket_fd>=0 && count)
|
|
{
|
|
- uchar cmd=NFCMD_READ;
|
|
+ uint8_t cmd=NFCMD_READ;
|
|
if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
|
|
|
|
- long rsize=lltl(count);
|
|
+ int32_t rsize=lltl(count);
|
|
if (write(socket_fd,&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
|
|
|
|
- long total_read=0,total;
|
|
+ int32_t total_read=0,total;
|
|
char buf[READ_PACKET_SIZE];
|
|
- ushort size;
|
|
+ uint16_t size;
|
|
|
|
- ushort packet_size;
|
|
+ uint16_t packet_size;
|
|
do
|
|
{
|
|
if (read(socket_fd,&packet_size,sizeof(packet_size))!=sizeof(packet_size))
|
|
@@ -314,7 +314,7 @@
|
|
}
|
|
packet_size=lstl(packet_size);
|
|
|
|
- ushort size_read=read(socket_fd,buf+2,packet_size);
|
|
+ uint16_t size_read=read(socket_fd,buf+2,packet_size);
|
|
|
|
if (size_read!=packet_size)
|
|
{
|
|
@@ -325,7 +325,7 @@
|
|
}
|
|
}
|
|
|
|
- *((short *)buf)=packet_size;
|
|
+ *((int16_t *)buf)=packet_size;
|
|
if (write(out_fd,buf,packet_size+2)!=packet_size+2) comm_failed();
|
|
|
|
total_read+=packet_size;
|
|
@@ -340,24 +340,24 @@
|
|
{
|
|
if (socket_fd>=0)
|
|
{
|
|
- uchar cmd=NFCMD_TELL;
|
|
+ uint8_t cmd=NFCMD_TELL;
|
|
if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
|
|
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }
|
|
return lltl(offset);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
-int remote_file::unbuffered_seek(long offset) // tell server to seek to a spot in a file
|
|
+int remote_file::unbuffered_seek(int32_t offset) // tell server to seek to a spot in a file
|
|
{
|
|
if (socket_fd>=0)
|
|
{
|
|
- uchar cmd=NFCMD_SEEK;
|
|
+ uint8_t cmd=NFCMD_SEEK;
|
|
if (write(socket_fd,&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
|
|
|
|
- long off=lltl(offset);
|
|
+ int32_t off=lltl(offset);
|
|
if (write(socket_fd,&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
|
|
|
|
if (read(socket_fd,&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }
|
|
@@ -449,7 +449,7 @@
|
|
return 0;
|
|
}
|
|
|
|
- uchar cmd=CLIENT_CRC_WAITER;
|
|
+ uint8_t cmd=CLIENT_CRC_WAITER;
|
|
if (write(socket_fd,&cmd,1)!=1) { close(socket_fd); return 0; }
|
|
if (read(socket_fd,&cmd,1)!=1) { close(socket_fd); return 0; }
|
|
close(socket_fd);
|
|
Index: abuse-sdl-0.7.0/src/net/fileman.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/fileman.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/fileman.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -80,7 +80,7 @@
|
|
{
|
|
case NFCMD_READ :
|
|
{
|
|
- long size;
|
|
+ int32_t size;
|
|
if (c->sock->read(&size,sizeof(size))!=sizeof(size)) return 0;
|
|
size=lltl(size);
|
|
|
|
@@ -93,7 +93,7 @@
|
|
} break;
|
|
case NFCMD_SEEK :
|
|
{
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (c->sock->read(&offset,sizeof(offset))!=sizeof(offset)) return 0;
|
|
offset=lltl(offset);
|
|
offset=lseek(c->file_fd,offset,0);
|
|
@@ -103,7 +103,7 @@
|
|
} break;
|
|
case NFCMD_TELL :
|
|
{
|
|
- long offset=lseek(c->file_fd,0,SEEK_CUR);
|
|
+ int32_t offset=lseek(c->file_fd,0,SEEK_CUR);
|
|
offset=lltl(offset);
|
|
if (c->sock->write(&offset,sizeof(offset))!=sizeof(offset)) return 0;
|
|
return 1;
|
|
@@ -214,7 +214,7 @@
|
|
|
|
void file_manager::add_nfs_client(net_socket *sock)
|
|
{
|
|
- uchar size[2];
|
|
+ uint8_t size[2];
|
|
char filename[300],mode[20],*mp;
|
|
if (sock->read(size,2)!=2) { delete sock; return ; }
|
|
if (sock->read(filename,size[0])!=size[0]) { delete sock; return ; }
|
|
@@ -248,15 +248,15 @@
|
|
f=-1; // make sure this is -1
|
|
|
|
|
|
- long ret=lltl(f);
|
|
+ int32_t ret=lltl(f);
|
|
if (sock->write(&ret,sizeof(ret))!=sizeof(ret)) { delete sock; return ; }
|
|
|
|
if (f<0) // no file, sorry
|
|
delete sock;
|
|
else
|
|
{
|
|
- long cur_pos=lseek(f,0,SEEK_CUR);
|
|
- long size=lseek(f,0,SEEK_END);
|
|
+ int32_t cur_pos=lseek(f,0,SEEK_CUR);
|
|
+ int32_t size=lseek(f,0,SEEK_END);
|
|
lseek(f,cur_pos,SEEK_SET);
|
|
size=lltl(size);
|
|
if (sock->write(&size,sizeof(size))!=sizeof(size)) { close(f); delete sock; sock=NULL; return ; }
|
|
@@ -285,12 +285,12 @@
|
|
next=Next;
|
|
open_local=0;
|
|
|
|
- uchar sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
|
|
+ uint8_t sizes[3]={CLIENT_NFS,strlen(filename)+1,strlen(mode)+1};
|
|
if (sock->write(sizes,3)!=3) { r_close("could not send open info"); return ; }
|
|
if (sock->write(filename,sizes[1])!=sizes[1]) { r_close("could not send filename"); return ; }
|
|
if (sock->write(mode,sizes[2])!=sizes[2]) { r_close("could not send mode"); return ; }
|
|
|
|
- long remote_file_fd;
|
|
+ int32_t remote_file_fd;
|
|
if (sock->read(&remote_file_fd,sizeof(remote_file_fd))!=sizeof(remote_file_fd))
|
|
{ r_close("could not read remote fd"); return ; }
|
|
remote_file_fd=lltl(remote_file_fd);
|
|
@@ -305,13 +305,13 @@
|
|
{
|
|
if (sock && count)
|
|
{
|
|
- uchar cmd=NFCMD_READ;
|
|
+ uint8_t cmd=NFCMD_READ;
|
|
if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("read : could not send command"); return 0; }
|
|
|
|
- long rsize=lltl(count);
|
|
+ int32_t rsize=lltl(count);
|
|
if (sock->write(&rsize,sizeof(rsize))!=sizeof(rsize)) { r_close("read : could not send size"); return 0; }
|
|
|
|
- long total_read=0;
|
|
+ int32_t total_read=0;
|
|
char buf[READ_PACKET_SIZE];
|
|
|
|
ushort packet_size;
|
|
@@ -347,28 +347,28 @@
|
|
return 0;
|
|
}
|
|
|
|
-long file_manager::remote_file::unbuffered_tell() // ask server where the offset of the file pointer is
|
|
+int32_t file_manager::remote_file::unbuffered_tell() // ask server where the offset of the file pointer is
|
|
{
|
|
if (sock)
|
|
{
|
|
- uchar cmd=NFCMD_TELL;
|
|
+ uint8_t cmd=NFCMD_TELL;
|
|
if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("tell : could not send command"); return 0; }
|
|
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("tell : could not read offset"); return 0; }
|
|
return lltl(offset);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
-long file_manager::remote_file::unbuffered_seek(long offset) // tell server to seek to a spot in a file
|
|
+int32_t file_manager::remote_file::unbuffered_seek(int32_t offset) // tell server to seek to a spot in a file
|
|
{
|
|
if (sock)
|
|
{
|
|
- uchar cmd=NFCMD_SEEK;
|
|
+ uint8_t cmd=NFCMD_SEEK;
|
|
if (sock->write(&cmd,sizeof(cmd))!=sizeof(cmd)) { r_close("seek : could not send command"); return 0; }
|
|
|
|
- long off=lltl(offset);
|
|
+ int32_t off=lltl(offset);
|
|
if (sock->write(&off,sizeof(off))!=sizeof(off)) { r_close("seek : could not send offset"); return 0; }
|
|
|
|
if (sock->read(&offset,sizeof(offset))!=sizeof(offset)) { r_close("seek : could not read offset"); return 0; }
|
|
@@ -465,14 +465,14 @@
|
|
}
|
|
|
|
|
|
-long file_manager::rf_tell(int fd)
|
|
+int32_t file_manager::rf_tell(int fd)
|
|
{
|
|
remote_file *rf=find_rf(fd);
|
|
if (rf) return rf->unbuffered_tell();
|
|
else return 0;
|
|
}
|
|
|
|
-long file_manager::rf_seek(int fd, long offset)
|
|
+int32_t file_manager::rf_seek(int fd, int32_t offset)
|
|
{
|
|
remote_file *rf=find_rf(fd);
|
|
if (rf) return rf->unbuffered_seek(offset);
|
|
@@ -503,7 +503,7 @@
|
|
}
|
|
}
|
|
|
|
-long file_manager::rf_file_size(int fd)
|
|
+int32_t file_manager::rf_file_size(int fd)
|
|
{
|
|
remote_file *rf=find_rf(fd);
|
|
if (rf) return rf->file_size();
|
|
Index: abuse-sdl-0.7.0/src/net/gserver.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/net/gserver.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/net/gserver.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -109,8 +109,8 @@
|
|
{
|
|
if (c->delete_me())
|
|
{
|
|
- base->packet.write_byte(SCMD_DELETE_CLIENT);
|
|
- base->packet.write_byte(c->client_id);
|
|
+ base->packet.write_uint8(SCMD_DELETE_CLIENT);
|
|
+ base->packet.write_uint8(c->client_id);
|
|
if (c->wait_reload())
|
|
{
|
|
c->set_wait_reload(0);
|
|
@@ -179,13 +179,13 @@
|
|
|
|
int game_server::process_client_command(player_client *c)
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (c->comm->read(&cmd,1)!=1) return 0;
|
|
switch (cmd)
|
|
{
|
|
case CLCMD_REQUEST_RESEND :
|
|
{
|
|
- uchar tick;
|
|
+ uint8_t tick;
|
|
if (c->comm->read(&tick,1)!=1) return 0;
|
|
|
|
fprintf(stderr,"request for resend tick %d (game cur=%d, pack=%d, last=%d)\n",
|
|
@@ -243,7 +243,7 @@
|
|
// make sure we got a complete packet and the packet was not a previous game tick packet
|
|
if (bytes_received==use->packet_size()+use->packet_prefix_size())
|
|
{
|
|
- unsigned short rec_crc=use->get_checksum();
|
|
+ uint16_t rec_crc=use->get_checksum();
|
|
if (rec_crc==use->calc_checksum())
|
|
{
|
|
player_client *f=player_list,*found=NULL;
|
|
@@ -350,7 +350,7 @@
|
|
{
|
|
if (!c->delete_me() && c->need_reload_start_ok()) // if the client is already waiting for reload state to start, send ok
|
|
{
|
|
- uchar cmd=CLCMD_RELOAD_START;
|
|
+ uint8_t cmd=CLCMD_RELOAD_START;
|
|
if (c->comm->write(&cmd,1)!=1) { c->set_delete_me(1); }
|
|
c->set_need_reload_start_ok(0);
|
|
}
|
|
@@ -374,19 +374,19 @@
|
|
{
|
|
if( total_players() >= main_net_cfg->max_players )
|
|
{
|
|
- uchar too_many = 2;
|
|
+ uint8_t too_many = 2;
|
|
sock->write( &too_many, 1 );
|
|
return 0;
|
|
}
|
|
|
|
- uchar reg = registered ? 1 : 0;
|
|
+ uint8_t reg = registered ? 1 : 0;
|
|
if( sock->write( ®, 1 ) != 1 )
|
|
return 0;
|
|
|
|
- ushort our_port = lstl( main_net_cfg->port + 1 ), cport;
|
|
+ uint16_t our_port = lstl( main_net_cfg->port + 1 ), cport;
|
|
char name[256];
|
|
- uchar len;
|
|
- short nkills=lstl(main_net_cfg->kills);
|
|
+ uint8_t len;
|
|
+ int16_t nkills=lstl(main_net_cfg->kills);
|
|
|
|
if( sock->read(&len,1)!=1 ||
|
|
sock->read(name,len)!=len ||
|
|
@@ -419,7 +419,7 @@
|
|
|
|
from->set_port( cport );
|
|
|
|
- ushort client_id = lstl( f );
|
|
+ uint16_t client_id = lstl( f );
|
|
if( sock->write( &client_id, 2 ) != 2 )
|
|
{
|
|
return 0;
|
|
@@ -457,7 +457,7 @@
|
|
{
|
|
player_client *d=c;
|
|
c=c->next;
|
|
- delete c;
|
|
+ delete d;
|
|
}
|
|
player_list=NULL;
|
|
return 1;
|
|
Index: abuse-sdl-0.7.0/src/old_server.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/old_server.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/old_server.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -48,7 +48,7 @@
|
|
if (f->connect)
|
|
{
|
|
packet pk;
|
|
- uchar cmd=SCMD_QUIT; // send quit command to server
|
|
+ uint8_t cmd=SCMD_QUIT; // send quit command to server
|
|
pk.write(&cmd,1);
|
|
send_pkt(f->connect,pk);
|
|
delete f->connect;
|
|
@@ -156,9 +156,9 @@
|
|
collect_inputs();
|
|
}
|
|
|
|
-ulong make_sync_long()
|
|
+uint32_t make_sync_uint32()
|
|
{
|
|
- ulong x=0;
|
|
+ uint32_t x=0;
|
|
for (view *v=player_list;v;v=v->next)
|
|
{
|
|
x^=v->focus->x;
|
|
@@ -167,7 +167,7 @@
|
|
return x^rand_on;
|
|
}
|
|
|
|
-int server::process_command(view *f, uchar command, packet &pk)
|
|
+int server::process_command(view *f, uint8_t command, packet &pk)
|
|
{
|
|
switch (command)
|
|
{
|
|
@@ -179,8 +179,8 @@
|
|
|
|
case SCMD_VIEW_RESIZE : // change view area
|
|
{
|
|
- ulong view_size[8];
|
|
- if (pk.read((uchar *)view_size,8*4)!=8*4)
|
|
+ uint32_t view_size[8];
|
|
+ if (pk.read((uint8_t *)view_size,8*4)!=8*4)
|
|
return 0;
|
|
else
|
|
{
|
|
@@ -192,19 +192,19 @@
|
|
f->suggest.send_view=0;
|
|
if (is_server) // if we are a server, tell everybody about this.
|
|
{
|
|
- uchar cmd=SCMD_VIEW_RESIZE;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
- ushort pn=lstl(f->player_number);
|
|
- next_out.write((uchar *)&pn,2);
|
|
- next_out.write((uchar *)view_size,8*4);
|
|
+ uint8_t cmd=SCMD_VIEW_RESIZE;
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ next_out.write((uint8_t *)&pn,2);
|
|
+ next_out.write((uint8_t *)view_size,8*4);
|
|
}
|
|
}
|
|
} break;
|
|
|
|
case SCMD_WEAPON_CHANGE : // change weapon
|
|
{
|
|
- ulong new_weap;
|
|
- if (pk.read((uchar *)&new_weap,4)!=4)
|
|
+ uint32_t new_weap;
|
|
+ if (pk.read((uint8_t *)&new_weap,4)!=4)
|
|
return 0;
|
|
else
|
|
{
|
|
@@ -212,11 +212,11 @@
|
|
f->suggest.send_weapon_change=0;
|
|
if (is_server) // if we are a server, tell everybody about this.
|
|
{
|
|
- uchar cmd=SCMD_WEAPON_CHANGE;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
- ushort pn=lstl(f->player_number);
|
|
- next_out.write((uchar *)&pn,2);
|
|
- next_out.write((uchar *)&new_weap,4);
|
|
+ uint8_t cmd=SCMD_WEAPON_CHANGE;
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ next_out.write((uint8_t *)&pn,2);
|
|
+ next_out.write((uint8_t *)&new_weap,4);
|
|
}
|
|
}
|
|
} break;
|
|
@@ -225,7 +225,7 @@
|
|
case SCMD_SET_INPUT : // set the input from this player
|
|
{
|
|
signed char inp[5];
|
|
- if (pk.read((uchar *)inp,5)!=5)
|
|
+ if (pk.read((uint8_t *)inp,5)!=5)
|
|
return 0;
|
|
else
|
|
f->set_input(inp[0],inp[1],inp[2],inp[3],inp[4]);
|
|
@@ -243,12 +243,12 @@
|
|
} break;
|
|
case SCMD_SYNC :
|
|
{
|
|
- ulong x;
|
|
- if (pk.read((uchar *)&x,4)!=4)
|
|
+ uint32_t x;
|
|
+ if (pk.read((uint8_t *)&x,4)!=4)
|
|
return 0;
|
|
else
|
|
{
|
|
- ulong s=make_sync_long();
|
|
+ uint32_t s=make_sync_uint32();
|
|
if (lltl(x)!=s)
|
|
printf("Out of sync, %x!=%x\n",lltl(x),s);
|
|
return 1;
|
|
@@ -265,18 +265,18 @@
|
|
{
|
|
if (f->view_changed())
|
|
{
|
|
- uchar cmd=SCMD_VIEW_RESIZE;
|
|
+ uint8_t cmd=SCMD_VIEW_RESIZE;
|
|
pk.write(&cmd,1);
|
|
if (number)
|
|
{
|
|
- ushort pn=lstl(f->player_number);
|
|
- pk.write((uchar *)&pn,2);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ pk.write((uint8_t *)&pn,2);
|
|
dprintf("Server : %s resized view %d %d %d %d\n",f->name,
|
|
f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
|
|
f->resize_view(f->suggest.cx1,f->suggest.cy1,f->suggest.cx2,f->suggest.cy2);
|
|
f->suggest.send_view=0;
|
|
} else dprintf("sending resize to server\n");
|
|
- ulong view_size[8];
|
|
+ uint32_t view_size[8];
|
|
view_size[0]=lltl(f->suggest.cx1);
|
|
view_size[1]=lltl(f->suggest.cy1);
|
|
view_size[2]=lltl(f->suggest.cx2);
|
|
@@ -285,23 +285,23 @@
|
|
view_size[5]=lltl(f->suggest.pan_y);
|
|
view_size[6]=lltl(f->suggest.shift_down);
|
|
view_size[7]=lltl(f->suggest.shift_right);
|
|
- pk.write((uchar *)view_size,8*4);
|
|
+ pk.write((uint8_t *)view_size,8*4);
|
|
}
|
|
|
|
if (f->weapon_changed())
|
|
{
|
|
- uchar cmd=SCMD_WEAPON_CHANGE;
|
|
+ uint8_t cmd=SCMD_WEAPON_CHANGE;
|
|
pk.write(&cmd,1);
|
|
if (number)
|
|
{
|
|
- ushort pn=lstl(f->player_number);
|
|
- pk.write((uchar *)&pn,2);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ pk.write((uint8_t *)&pn,2);
|
|
dprintf("Server : %s change weapon to %d\n",f->name,f->suggest.new_weapon);
|
|
f->current_weapon=f->suggest.new_weapon;
|
|
f->suggest.send_weapon_change=0;
|
|
} else dprintf("sending resize to server\n");
|
|
- ulong nw=lltl(f->suggest.new_weapon);
|
|
- pk.write((uchar *)&nw,4);
|
|
+ uint32_t nw=lltl(f->suggest.new_weapon);
|
|
+ pk.write((uint8_t *)&nw,4);
|
|
}
|
|
}
|
|
|
|
@@ -316,7 +316,7 @@
|
|
inp[3]=f->b1_suggestion;
|
|
inp[4]=f->b2_suggestion;
|
|
inp[5]=f->b3_suggestion;
|
|
- if (pk.write((uchar *)inp,6)!=6)
|
|
+ if (pk.write((uint8_t *)inp,6)!=6)
|
|
return 0;
|
|
if (!send_pkt(f->connect,pk))
|
|
return 0;
|
|
@@ -339,8 +339,8 @@
|
|
{
|
|
while (!pk.eop())
|
|
{
|
|
- uchar cmd;
|
|
- if (pk.read((uchar *)&cmd,1)==1)
|
|
+ uint8_t cmd;
|
|
+ if (pk.read((uint8_t *)&cmd,1)==1)
|
|
if (!process_command(f,cmd,pk))
|
|
{ remove_player(f); f=NULL; }
|
|
}
|
|
@@ -397,9 +397,9 @@
|
|
for (view *f=player_list;f;f=f->next)
|
|
{
|
|
cmd=SCMD_SET_INPUT;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
- ushort pn=lstl(f->player_number);
|
|
- next_out.write((uchar *)&pn,2);
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ next_out.write((uint8_t *)&pn,2);
|
|
|
|
signed char inp[5];
|
|
inp[0]=f->x_suggestion;
|
|
@@ -407,15 +407,15 @@
|
|
inp[2]=f->b1_suggestion;
|
|
inp[3]=f->b2_suggestion;
|
|
inp[4]=f->b3_suggestion;
|
|
- next_out.write((uchar *)inp,5);
|
|
+ next_out.write((uint8_t *)inp,5);
|
|
}
|
|
|
|
if (sync_check)
|
|
{
|
|
cmd=SCMD_SYNC;
|
|
- ulong x=lltl(make_sync_long());
|
|
- next_out.write((uchar *)&cmd,1);
|
|
- next_out.write((uchar *)&x,4);
|
|
+ uint32_t x=lltl(make_sync_uint32());
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
+ next_out.write((uint8_t *)&x,4);
|
|
}
|
|
|
|
for (f=player_list;f;)
|
|
@@ -437,7 +437,7 @@
|
|
if (nd)
|
|
{
|
|
packet pk;
|
|
-// pk.write_long(file_server->get_port());
|
|
+// pk.write_uint32(file_server->get_port());
|
|
if (!send_pkt(nd,pk))
|
|
{
|
|
printf("error writing to connection\n");
|
|
@@ -457,8 +457,8 @@
|
|
pk.get_string(name,100);
|
|
printf("Joined by player %s\n",name);
|
|
pk.reset();
|
|
- uchar ok=1;
|
|
- pk.write((uchar *)&ok,1); // write ok to join
|
|
+ uint8_t ok=1;
|
|
+ pk.write((uint8_t *)&ok,1); // write ok to join
|
|
send_pkt(nd,pk);
|
|
|
|
/**************** Read suggested view size from client ****/
|
|
@@ -467,11 +467,11 @@
|
|
printf("error reading view info from connection\n");
|
|
return ;
|
|
}
|
|
- long cx1,cy1,cx2,cy2;
|
|
- if (pk.read((uchar *)&cx1,4)!=4) return ; cx1=lltl(cx1);
|
|
- if (pk.read((uchar *)&cy1,4)!=4) return ; cy1=lltl(cy1);
|
|
- if (pk.read((uchar *)&cx2,4)!=4) return ; cx2=lltl(cx2);
|
|
- if (pk.read((uchar *)&cy2,4)!=4) return ; cy2=lltl(cy2);
|
|
+ int32_t cx1,cy1,cx2,cy2;
|
|
+ if (pk.read((uint8_t *)&cx1,4)!=4) return ; cx1=lltl(cx1);
|
|
+ if (pk.read((uint8_t *)&cy1,4)!=4) return ; cy1=lltl(cy1);
|
|
+ if (pk.read((uint8_t *)&cx2,4)!=4) return ; cx2=lltl(cx2);
|
|
+ if (pk.read((uint8_t *)&cy2,4)!=4) return ; cy2=lltl(cy2);
|
|
|
|
/**************** Create the player *******************/
|
|
for (view *f=player_list;f && f->next;f=f->next); // find last player, add one for pn
|
|
@@ -500,17 +500,17 @@
|
|
|
|
if (current_level->send(nd))
|
|
{
|
|
- uchar cmd=SCMD_ADD_VIEW;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
+ uint8_t cmd=SCMD_ADD_VIEW;
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
v->write_packet(next_out);
|
|
|
|
|
|
/********** Send all of the views to the player **********/
|
|
pk.reset();
|
|
- ushort tv=0;
|
|
+ uint16_t tv=0;
|
|
for (f=player_list;f;f=f->next) tv++;
|
|
tv=lstl(tv);
|
|
- pk.write((uchar *)&tv,2);
|
|
+ pk.write((uint8_t *)&tv,2);
|
|
if (!send_pkt(nd,pk)) return ;
|
|
|
|
for (f=player_list;f;f=f->next)
|
|
@@ -521,9 +521,9 @@
|
|
}
|
|
|
|
pk.reset();
|
|
- ushort r=lstl(rand_on);
|
|
- pk.write((uchar *)&r,2); // write current random seed
|
|
- pk.write((uchar *)rtable,1024*2);
|
|
+ uint16_t r=lstl(rand_on);
|
|
+ pk.write((uint8_t *)&r,2); // write current random seed
|
|
+ pk.write((uint8_t *)rtable,1024*2);
|
|
send_pkt(nd,pk);
|
|
|
|
}
|
|
@@ -542,8 +542,8 @@
|
|
|
|
if (!get_pkt(os,pk)) // read join status packet, 0 means we can't join
|
|
{ fputs(re,stderr); exit(0); }
|
|
- long nfs_port;
|
|
- if (pk.read((uchar *)&nfs_port,4)!=4)
|
|
+ int32_t nfs_port;
|
|
+ if (pk.read((uint8_t *)&nfs_port,4)!=4)
|
|
{ fputs(re,stderr); exit(0); }
|
|
|
|
// connect_to_nfs_server(server_name,lltl(nfs_port));
|
|
@@ -551,7 +551,7 @@
|
|
|
|
|
|
|
|
- pk.write((uchar *)name,strlen(name)+1); // send or name and see if it's ok to join in
|
|
+ pk.write((uint8_t *)name,strlen(name)+1); // send or name and see if it's ok to join in
|
|
if (!send_pkt(os,pk))
|
|
{
|
|
printf("Unable to write to server\n");
|
|
@@ -561,8 +561,8 @@
|
|
if (!get_pkt(os,pk)) // read join status packet, 0 means we can't join
|
|
{ fputs(re,stderr); exit(0); }
|
|
|
|
- uchar stat;
|
|
- if (pk.read((uchar *)&stat,1)!=1)
|
|
+ uint8_t stat;
|
|
+ if (pk.read((uint8_t *)&stat,1)!=1)
|
|
{ fputs(re,stderr); exit(0); }
|
|
|
|
if (stat==0)
|
|
@@ -575,8 +575,8 @@
|
|
if (current_level)
|
|
delete current_level;
|
|
|
|
- long vs[4]={lltl(320/2-155),lltl(200/2-95),lltl(320/2+155),lltl(200/2+70)};
|
|
- pk.write((uchar *)vs,4*4);
|
|
+ int32_t vs[4]={lltl(320/2-155),lltl(200/2-95),lltl(320/2+155),lltl(200/2+70)};
|
|
+ pk.write((uint8_t *)vs,4*4);
|
|
if (!send_pkt(os,pk)) { printf("Unable to write to server\n"); exit(0); }
|
|
|
|
|
|
@@ -592,8 +592,8 @@
|
|
printf("Unable to read views from server\n");
|
|
exit(0);
|
|
}
|
|
- ushort tv;
|
|
- if (pk.read((uchar *)&tv,2)!=2)
|
|
+ uint16_t tv;
|
|
+ if (pk.read((uint8_t *)&tv,2)!=2)
|
|
{ fputs(re,stderr); exit(0); }
|
|
tv=lstl(tv);
|
|
view *last=NULL;
|
|
@@ -614,14 +614,14 @@
|
|
}
|
|
|
|
if (!get_pkt(os,pk)) { fputs(re,stderr); exit(0); }
|
|
- if (pk.read((uchar *)&rand_on,2)!=2) // read the current random seed used by the server.
|
|
+ if (pk.read((uint8_t *)&rand_on,2)!=2) // read the current random seed used by the server.
|
|
{ fputs(re,stderr); exit(0); }
|
|
rand_on=lstl(rand_on);
|
|
- ushort *rtab=(ushort *)jmalloc(1024*2,"tmp rtab");
|
|
- if (!pk.read((uchar *)rtab,1024*2)) { fputs(re,stderr); exit(0); } // read the rand table
|
|
+ uint16_t *rtab=(uint16_t *)jmalloc(1024*2,"tmp rtab");
|
|
+ if (!pk.read((uint8_t *)rtab,1024*2)) { fputs(re,stderr); exit(0); } // read the rand table
|
|
|
|
for (int j=0;j<1024*2;j++)
|
|
- if (((uchar *)rtab)[j]!=((uchar *)rtable)[j])
|
|
+ if (((uint8_t *)rtab)[j]!=((uint8_t *)rtable)[j])
|
|
{ printf("rtables differ on byte %d\n",j); exit(0); }
|
|
|
|
jfree(rtab);
|
|
@@ -646,10 +646,10 @@
|
|
|
|
void server::remove_player(view *f)
|
|
{
|
|
- uchar cmd=SCMD_REMOVE_VIEW;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
- ushort pn=lstl(f->player_number);
|
|
- next_out.write((uchar *)&pn,2);
|
|
+ uint8_t cmd=SCMD_REMOVE_VIEW;
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
+ uint16_t pn=lstl(f->player_number);
|
|
+ next_out.write((uint8_t *)&pn,2);
|
|
if (f==player_list)
|
|
player_list=player_list->next;
|
|
else
|
|
@@ -668,15 +668,15 @@
|
|
{
|
|
|
|
cmd=SCMD_ADD_VIEW;
|
|
- next_out.write((uchar *)&cmd,1);
|
|
+ next_out.write((uint8_t *)&cmd,1);
|
|
|
|
- ushort pn=lstl(new_player->player_number);
|
|
- next_out.write((uchar *)&pn,2);
|
|
- ushort type=lstlli(new_player->focus->otype);
|
|
- next_out.write((uchar *)&type,2);
|
|
- ulong x=lltl(new_player->focus->x),y=lltl(new_player->focus->y);
|
|
- next_out.write((uchar *)&x,4);
|
|
- next_out.write((uchar *)&y,4);
|
|
+ uint16_t pn=lstl(new_player->player_number);
|
|
+ next_out.write((uint8_t *)&pn,2);
|
|
+ uint16_t type=lstlli(new_player->focus->otype);
|
|
+ next_out.write((uint8_t *)&type,2);
|
|
+ uint32_t x=lltl(new_player->focus->x),y=lltl(new_player->focus->y);
|
|
+ next_out.write((uint8_t *)&x,4);
|
|
+ next_out.write((uint8_t *)&y,4);
|
|
}*/
|
|
|
|
|
|
@@ -684,8 +684,8 @@
|
|
#define TOT_VIEW_VARS 32
|
|
view *server::add_view(packet &pk)
|
|
{
|
|
- ulong x[TOT_VIEW_VARS];
|
|
- if (!pk.read((uchar *)x,TOT_VIEW_VARS*4)) return NULL;
|
|
+ uint32_t x[TOT_VIEW_VARS];
|
|
+ if (!pk.read((uint8_t *)x,TOT_VIEW_VARS*4)) return NULL;
|
|
for (int i=0;i<TOT_VIEW_VARS;i++) x[i]=lltl(x[i]);
|
|
int skip=0;
|
|
for (view *f=player_list;f;f=f->next)
|
|
@@ -720,7 +720,7 @@
|
|
v->last_ammo=x[22]; v->last_type=x[23]; v->visor_time=x[28]; v->current_weapon=x[29];
|
|
v->secrets=x[30]; v->kills=x[31];
|
|
|
|
- pk.read((uchar *)v->weapons,total_objects*4);
|
|
+ pk.read((uint8_t *)v->weapons,total_objects*4);
|
|
pk.get_string(v->name,100);
|
|
|
|
|
|
@@ -740,7 +740,7 @@
|
|
int er=0;
|
|
while (!pk.eop() && !er)
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (pk.read(&cmd,1)!=1)
|
|
er=1;
|
|
else
|
|
@@ -749,8 +749,8 @@
|
|
int fail=0;
|
|
if (cmd!=SCMD_ADD_VIEW && cmd!=SCMD_SYNC)
|
|
{
|
|
- ushort player;
|
|
- if (pk.read((uchar *)&player,2)!=2)
|
|
+ uint16_t player;
|
|
+ if (pk.read((uint8_t *)&player,2)!=2)
|
|
er=1;
|
|
player=lstl(player);
|
|
for (f=player_list;f && f->player_number!=player;f=f->next);
|
|
Index: abuse-sdl-0.7.0/src/chars.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/chars.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/chars.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -412,7 +412,7 @@
|
|
else
|
|
{
|
|
lprint(lcar(field));
|
|
- lbreak("Unknown field for character definiltion");
|
|
+ lbreak("Unknown field for character definition");
|
|
exit(0);
|
|
}
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/cache.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/cache.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/cache.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -66,18 +66,18 @@
|
|
return 0;
|
|
}
|
|
|
|
- fp->write_short(total);
|
|
+ fp->write_uint16(total);
|
|
total=0;
|
|
for (i=0;i<total_files;i++)
|
|
{
|
|
- ulong crc;
|
|
+ uint32_t crc;
|
|
int failed=0;
|
|
crc=get_crc(i,failed);
|
|
if (!failed)
|
|
{
|
|
- fp->write_long(crc);
|
|
- uchar len=strlen(get_filename(i))+1;
|
|
- fp->write_byte(len);
|
|
+ fp->write_uint32(crc);
|
|
+ uint8_t len=strlen(get_filename(i))+1;
|
|
+ fp->write_uint8(len);
|
|
fp->write(get_filename(i),len);
|
|
total++;
|
|
}
|
|
@@ -95,13 +95,13 @@
|
|
return 0;
|
|
} else
|
|
{
|
|
- short total=fp->read_short();
|
|
+ short total=fp->read_uint16();
|
|
int i;
|
|
for (i=0;i<total;i++)
|
|
{
|
|
char name[256];
|
|
- ulong crc=fp->read_long();
|
|
- uchar len=fp->read_byte();
|
|
+ uint32_t crc=fp->read_uint32();
|
|
+ uint8_t len=fp->read_uint8();
|
|
fp->read(name,len);
|
|
set_crc(get_filenumber(name),crc);
|
|
}
|
|
@@ -147,13 +147,13 @@
|
|
return total_files-1;
|
|
}
|
|
|
|
-char *crc_manager::get_filename(long filenumber)
|
|
+char *crc_manager::get_filename(int32_t filenumber)
|
|
{
|
|
CHECK(filenumber>=0 && filenumber<total_files);
|
|
return files[filenumber]->filename;
|
|
}
|
|
|
|
-ulong crc_manager::get_crc(long filenumber, int &failed)
|
|
+uint32_t crc_manager::get_crc(int32_t filenumber, int &failed)
|
|
{
|
|
CHECK(filenumber>=0 && filenumber<total_files);
|
|
if (files[filenumber]->crc_calculated)
|
|
@@ -165,7 +165,7 @@
|
|
return 0;
|
|
}
|
|
|
|
-void crc_manager::set_crc(long filenumber, ulong crc)
|
|
+void crc_manager::set_crc(int32_t filenumber, uint32_t crc)
|
|
{
|
|
CHECK(filenumber>=0 && filenumber<total_files);
|
|
files[filenumber]->crc_calculated=1;
|
|
@@ -247,28 +247,28 @@
|
|
|
|
if (fp)
|
|
{
|
|
- fp->write_short(crc_man.total_filenames());
|
|
+ fp->write_uint16(crc_man.total_filenames());
|
|
for (i=0;i<crc_man.total_filenames();i++)
|
|
{
|
|
int l=strlen(crc_man.get_filename(i))+1;
|
|
- fp->write_byte(l);
|
|
+ fp->write_uint8(l);
|
|
fp->write(crc_man.get_filename(i),l);
|
|
}
|
|
|
|
int tsaved=0;
|
|
for (i=0;i<total;i++)
|
|
if (list[i].last_access>0) tsaved++;
|
|
- fp->write_long(tsaved);
|
|
+ fp->write_uint32(tsaved);
|
|
|
|
for (i=0;i<total;i++)
|
|
{
|
|
int id=ordered_ids[i];
|
|
if (list[id].last_access>0) // don't save unaccessed counts
|
|
{
|
|
- fp->write_byte(list[id].type); // save type, if type changed on reload
|
|
+ fp->write_uint8(list[id].type); // save type, if type changed on reload
|
|
// don't cache in-> its a different refrence
|
|
- fp->write_short(list[id].file_number);
|
|
- fp->write_long(list[id].offset);
|
|
+ fp->write_uint16(list[id].file_number);
|
|
+ fp->write_uint32(list[id].offset);
|
|
}
|
|
}
|
|
}
|
|
@@ -309,7 +309,7 @@
|
|
}
|
|
|
|
|
|
-int cache_list::search(int *sarray, ushort filenum, long offset)
|
|
+int cache_list::search(int *sarray, uint16_t filenum, int32_t offset)
|
|
{
|
|
int x1=0,x2=total-1;
|
|
int split;
|
|
@@ -422,7 +422,7 @@
|
|
|
|
|
|
int j;
|
|
- ushort *fg_line;
|
|
+ uint16_t *fg_line;
|
|
for (j=0;j<lev->foreground_height();j++)
|
|
{
|
|
fg_line=lev->get_fgline(j);
|
|
@@ -438,7 +438,7 @@
|
|
}
|
|
}
|
|
|
|
- ushort *bg_line;
|
|
+ uint16_t *bg_line;
|
|
for (j=0;j<lev->background_height();j++)
|
|
{
|
|
bg_line=lev->get_bgline(j);
|
|
@@ -480,7 +480,7 @@
|
|
int tnames=0;
|
|
int *fnum_remap; // remaps old filenumbers into current ones
|
|
|
|
- tnames=fp->read_short();
|
|
+ tnames=fp->read_uint16();
|
|
if (tnames) /// make sure there isn't bad info in the file
|
|
{
|
|
fnum_remap=(int *)jmalloc(sizeof(int)*tnames,"pfname remap");
|
|
@@ -488,7 +488,7 @@
|
|
int i;
|
|
for (i=0;i<tnames;i++)
|
|
{
|
|
- fp->read(name,fp->read_byte());
|
|
+ fp->read(name,fp->read_uint8());
|
|
fnum_remap[i]=-1; // initialize the map to no-map
|
|
|
|
int j;
|
|
@@ -497,7 +497,7 @@
|
|
fnum_remap[i]=j;
|
|
}
|
|
|
|
- long tsaved=fp->read_long();
|
|
+ uint32_t tsaved=fp->read_uint32();
|
|
|
|
|
|
int *priority=(int *)jmalloc(tsaved*sizeof(int),"priorities");
|
|
@@ -510,13 +510,13 @@
|
|
|
|
for (i=0;i<tsaved;i++)
|
|
{
|
|
- uchar type=fp->read_byte();
|
|
- short file_num=fp->read_short();
|
|
+ uint8_t type=fp->read_uint8();
|
|
+ short file_num=fp->read_uint16();
|
|
if (file_num>=tnames) // bad data?
|
|
file_num=-1;
|
|
else file_num=fnum_remap[file_num];
|
|
|
|
- ulong offset=fp->read_long();
|
|
+ uint32_t offset=fp->read_uint32();
|
|
|
|
// search for a match
|
|
j=search(sorted_id_list,file_num,offset);
|
|
@@ -804,7 +804,7 @@
|
|
used=1;
|
|
}
|
|
|
|
-long cache_list::alloc_id()
|
|
+int32_t cache_list::alloc_id()
|
|
{
|
|
int id;
|
|
if (prof_data)
|
|
@@ -850,9 +850,9 @@
|
|
|
|
|
|
|
|
-long cache_list::reg_lisp_block(Cell *block)
|
|
+int32_t cache_list::reg_lisp_block(Cell *block)
|
|
{
|
|
- long s;
|
|
+ uint32_t s;
|
|
if (lcache_number==-1)
|
|
lcache_number=crc_man.get_filenumber(lfname);
|
|
|
|
@@ -862,12 +862,11 @@
|
|
{
|
|
if (cache_read_file)
|
|
{
|
|
- delete cache_read_file;
|
|
- cache_read_file=NULL;
|
|
-
|
|
- cache_file=new jFILE(lfname,"ab");
|
|
- } else cache_file=new jFILE(lfname,"wb"); // first time we opened
|
|
+ delete cache_read_file;
|
|
+ cache_read_file=NULL;
|
|
|
|
+ cache_file=new jFILE(lfname,"ab");
|
|
+ } else cache_file=new jFILE(lfname,"wb"); // first time we opened
|
|
}
|
|
if (cache_file->open_failure())
|
|
{
|
|
@@ -893,12 +892,12 @@
|
|
ci->offset=cache_file->tell();
|
|
|
|
s=block_size(block);
|
|
- cache_file->write_long(s);
|
|
+ cache_file->write_uint32(s);
|
|
write_level(cache_file,block);
|
|
return id;
|
|
}
|
|
|
|
-long cache_list::reg_object(char *filename, void *object, int type, int rm_dups)
|
|
+int32_t cache_list::reg_object(char *filename, void *object, int type, int rm_dups)
|
|
{
|
|
char *name;
|
|
if (item_type(object)==L_CONS_CELL) // see if we got a object with a filename included
|
|
@@ -912,7 +911,7 @@
|
|
|
|
extern int total_files_open;
|
|
|
|
-long cache_list::reg(char *filename, char *name, int type, int rm_dups)
|
|
+int32_t cache_list::reg(char *filename, char *name, int type, int rm_dups)
|
|
{
|
|
int id=alloc_id(),i,fn=crc_man.get_filenumber(filename);
|
|
cache_item *ci=list+id;
|
|
@@ -1169,7 +1168,7 @@
|
|
|
|
int cache_size=80*1024; // 80K
|
|
cache_read_file->set_read_buffer_size(cache_size);
|
|
- uchar mini_buf;
|
|
+ uint8_t mini_buf;
|
|
cache_read_file->read(&mini_buf,1); // prime the buffer
|
|
}
|
|
|
|
@@ -1177,7 +1176,7 @@
|
|
|
|
int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
|
|
|
|
- long size=cache_read_file->read_long();
|
|
+ uint32_t size=cache_read_file->read_uint32();
|
|
void *space;
|
|
|
|
if (size)
|
|
@@ -1206,7 +1205,7 @@
|
|
|
|
void cache_list::free_oldest()
|
|
{
|
|
- long i,old_time=last_access;
|
|
+ uint32_t i,old_time=last_access;
|
|
cache_item *ci=list,*oldest=NULL;
|
|
ful=1;
|
|
|
|
@@ -1257,7 +1256,7 @@
|
|
old=ci->last_access;
|
|
printf("type=(%20s) file=(%20s) access=(%6ld)\n",spec_types[ci->type],
|
|
crc_man.get_filename(ci->file_number),
|
|
- ci->last_access);
|
|
+ (long int)ci->last_access);
|
|
}
|
|
} while (new_old);
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/sndserver.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/sndserver.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/sndserver.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -36,11 +36,11 @@
|
|
int numsounds; // number of sound effects
|
|
int longsound; // longest sound effect
|
|
int lengths[NUMSFX]; // lengths of all sound effects
|
|
-unsigned char mixbuffer[MIXBUFFERSIZE]; // mixing buffer
|
|
+uint8_t mixbuffer[MIXBUFFERSIZE]; // mixing buffer
|
|
int sfxdevice; // file descriptor of sfx device
|
|
int musdevice; // file descriptor of music device
|
|
-unsigned char *channels[8]; // the channel data pointers
|
|
-unsigned char *channelsend[8]; // the channel data end pointers
|
|
+uint8_t *channels[8]; // the channel data pointers
|
|
+uint8_t *channelsend[8]; // the channel data end pointers
|
|
int channelstart[8]; // time that the channel started playing
|
|
int channelhandles[8]; // the channel handles
|
|
|
|
@@ -74,10 +74,10 @@
|
|
} while (j);
|
|
if (d > 127) mixbuffer[i] = 255;
|
|
else if (d < -128) mixbuffer[i] = 0;
|
|
- else mixbuffer[i] = (unsigned char) (d+128);
|
|
+ else mixbuffer[i] = (uint8_t) (d+128);
|
|
// if (d > 127) mixbuffer[i] = 0;
|
|
// else if (d < -128) mixbuffer[i] = 255;
|
|
-// else mixbuffer[i] = (unsigned char) (-d+127);
|
|
+// else mixbuffer[i] = (uint8_t) (-d+127);
|
|
}
|
|
|
|
// check for freed channels
|
|
@@ -196,7 +196,7 @@
|
|
|
|
int i;
|
|
int rc = -1;
|
|
- static unsigned short handlenums = 0;
|
|
+ static uint16_t handlenums = 0;
|
|
int oldest = mytime;
|
|
int oldestnum = 0;
|
|
|
|
@@ -205,7 +205,7 @@
|
|
if (!channels[i])
|
|
{
|
|
channelsend[i] =
|
|
- (channels[i] = (unsigned char *) S_sfx[sfxid].data) + lengths[sfxid];
|
|
+ (channels[i] = (uint8_t *) S_sfx[sfxid].data) + lengths[sfxid];
|
|
if (!handlenums) handlenums = 100;
|
|
channelhandles[i] = rc = handlenums++;
|
|
channelstart[i] = mytime;
|
|
@@ -225,7 +225,7 @@
|
|
if (i == 8)
|
|
{
|
|
channelsend[oldestnum] =
|
|
- (channels[oldestnum] = (unsigned char *) S_sfx[sfxid].data)
|
|
+ (channels[oldestnum] = (uint8_t *) S_sfx[sfxid].data)
|
|
+ lengths[sfxid];
|
|
if (!handlenums) handlenums = 100;
|
|
channelhandles[oldestnum] = rc = handlenums++;
|
|
@@ -236,10 +236,10 @@
|
|
|
|
}
|
|
|
|
-void outputushort(int num)
|
|
+void output_uint16(int num)
|
|
{
|
|
|
|
- static unsigned char buff[5] = { 0, 0, 0, 0, '\n' };
|
|
+ static uint8_t buff[5] = { 0, 0, 0, 0, '\n' };
|
|
static char *badbuff = "xxxx\n";
|
|
|
|
// outputs a 16-bit # in hex or "xxxx" if -1.
|
|
@@ -263,7 +263,7 @@
|
|
void initdata(void)
|
|
{
|
|
int i;
|
|
- for (i=0 ; i<sizeof(channels)/sizeof(unsigned char *) ; i++) channels[i] = 0;
|
|
+ for (i=0 ; i<sizeof(channels)/sizeof(uint8_t *) ; i++) channels[i] = 0;
|
|
gettimeofday(&last, &whocares);
|
|
usleep(100000);
|
|
}
|
|
@@ -273,7 +273,7 @@
|
|
|
|
int done = 0;
|
|
int rc, nrc, sndnum, handle = 0;
|
|
- unsigned char commandbuf[10];
|
|
+ uint8_t commandbuf[10];
|
|
fd_set fdset, scratchset;
|
|
struct timeval zerowait = { 0, 0 };
|
|
|
|
Index: abuse-sdl-0.7.0/src/level.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/level.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/level.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -23,20 +23,21 @@
|
|
#include <sys/stat.h>
|
|
#endif
|
|
|
|
+#include <limits.h>
|
|
#include <time.h>
|
|
|
|
level *current_level;
|
|
|
|
game_object *level::attacker(game_object *who)
|
|
{
|
|
- long d=0x7fffffff;
|
|
+ int32_t d=0x7fffffff;
|
|
game_object *c=NULL;
|
|
view *f=the_game->first_view;
|
|
for (;f;f=f->next)
|
|
{
|
|
if (f->focus)
|
|
{
|
|
- long tmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y);
|
|
+ int32_t tmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y);
|
|
if (tmp_d<d)
|
|
{
|
|
d=tmp_d;
|
|
@@ -197,7 +198,7 @@
|
|
}
|
|
}
|
|
|
|
-int level::add_actives(long x1, long y1, long x2, long y2)
|
|
+int level::add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|
{
|
|
int t=0;
|
|
game_object *last_active=NULL;
|
|
@@ -209,7 +210,7 @@
|
|
{
|
|
if (!o->active)
|
|
{
|
|
- long xr=figures[o->otype]->rangex,
|
|
+ int32_t xr=figures[o->otype]->rangex,
|
|
yr=figures[o->otype]->rangey;
|
|
|
|
if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
|
|
@@ -241,7 +242,7 @@
|
|
}
|
|
|
|
|
|
-int level::add_drawables(long x1, long y1, long x2, long y2)
|
|
+int level::add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|
{
|
|
int t=0,ft=0;
|
|
game_object *last_active=NULL;
|
|
@@ -255,7 +256,7 @@
|
|
{
|
|
if (ft || !o->active)
|
|
{
|
|
- long xr=figures[o->otype]->draw_rangex,
|
|
+ int32_t xr=figures[o->otype]->draw_rangex,
|
|
yr=figures[o->otype]->draw_rangey;
|
|
|
|
if (o->x+xr>=x1 && o->x-xr<=x2 && o->y+yr>=y1 && o->y-yr<=y2)
|
|
@@ -321,7 +322,7 @@
|
|
|
|
void level::wall_push()
|
|
{
|
|
- long sx1,sy1,sx2,sy2,xv,yv;
|
|
+ int32_t sx1,sy1,sx2,sy2,xv,yv;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
{
|
|
@@ -361,7 +362,7 @@
|
|
int b1=subject->push_range(),b2=target->push_range();
|
|
if (abs(subject->x-target->x)<b1+b2)
|
|
{
|
|
- long tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;
|
|
+ int32_t tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;
|
|
if (subject->x>target->x)
|
|
xv=tmove/2;
|
|
else xv=-tmove/2;
|
|
@@ -381,7 +382,7 @@
|
|
void level::check_collisions()
|
|
{
|
|
game_object *target,*reciever=NULL;
|
|
- long sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
|
|
+ int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
|
|
s_centerx,t_centerx;
|
|
|
|
for (game_object *subject=first_active;subject;subject=subject->next_active)
|
|
@@ -415,7 +416,7 @@
|
|
{
|
|
for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !hit;j--)
|
|
{
|
|
- long x1,y1,x2,y2, // define the two line segments to check
|
|
+ int32_t x1,y1,x2,y2, // define the two line segments to check
|
|
xp1,yp1,xp2,yp2;
|
|
|
|
xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
@@ -458,10 +459,10 @@
|
|
}
|
|
*/
|
|
|
|
-game_object *level::boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
|
|
+game_object *level::boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
|
|
{
|
|
game_object *l=NULL;
|
|
- long tx1,ty1,tx2,ty2,t_centerx;
|
|
+ int32_t tx1,ty1,tx2,ty2,t_centerx;
|
|
game_object *target=first_active;
|
|
game_object **blist=block_list;
|
|
int t=block_total;
|
|
@@ -484,10 +485,10 @@
|
|
int iter=t_damage->tot-1;
|
|
while(iter-->0)
|
|
{
|
|
- long xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
- long yp1=target->y+target->ty(*t_dat); t_dat++;
|
|
- long xp2=target->x+target->tx(*t_dat);
|
|
- long yp2=target->y+target->ty(t_dat[1]);
|
|
+ int32_t xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
+ int32_t yp1=target->y+target->ty(*t_dat); t_dat++;
|
|
+ int32_t xp2=target->x+target->tx(*t_dat);
|
|
+ int32_t yp2=target->y+target->ty(t_dat[1]);
|
|
|
|
// now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
|
|
if (*ins)
|
|
@@ -510,10 +511,10 @@
|
|
}
|
|
|
|
|
|
-game_object *level::all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
|
|
+game_object *level::all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
|
|
{
|
|
game_object *l=NULL;
|
|
- long tx1,ty1,tx2,ty2,t_centerx;
|
|
+ int32_t tx1,ty1,tx2,ty2,t_centerx;
|
|
game_object *target=first_active;
|
|
game_object **blist=all_block_list;
|
|
int t=all_block_total;
|
|
@@ -536,10 +537,10 @@
|
|
int iter=t_damage->tot-1;
|
|
while(iter-->0)
|
|
{
|
|
- long xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
- long yp1=target->y+target->ty(*t_dat); t_dat++;
|
|
- long xp2=target->x+target->tx(*t_dat);
|
|
- long yp2=target->y+target->ty(t_dat[1]);
|
|
+ int32_t xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
+ int32_t yp1=target->y+target->ty(*t_dat); t_dat++;
|
|
+ int32_t xp2=target->x+target->tx(*t_dat);
|
|
+ int32_t yp2=target->y+target->ty(t_dat[1]);
|
|
|
|
// now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
|
|
if (*ins)
|
|
@@ -565,7 +566,7 @@
|
|
|
|
void level::interpolate_draw_objects(view *v)
|
|
{
|
|
- long old_x,old_y;
|
|
+ int32_t old_x,old_y;
|
|
current_view=v;
|
|
|
|
game_object *o=first_active;
|
|
@@ -606,7 +607,7 @@
|
|
if (current_demo_mode()==DEMO_PLAY)
|
|
{
|
|
if (!rcheck) rcheck=open_file("rcheck","rb");
|
|
- long x=rcheck->read_long();
|
|
+ int32_t x=rcheck->read_uint32();
|
|
if (x!=rand_on)
|
|
dprintf("off!\n");
|
|
} else if (current_demo_mode()==DEMO_RECORD)
|
|
@@ -616,7 +617,7 @@
|
|
rcheck=open_file("rcheck","wb");
|
|
rcheck_lp=open_file("rcheck.lp","wb");
|
|
}
|
|
- rcheck->write_long(rand_on);
|
|
+ rcheck->write_uint32(rand_on);
|
|
} else
|
|
{
|
|
if (rcheck)
|
|
@@ -644,11 +645,11 @@
|
|
if (c)
|
|
{
|
|
area_controller *a,*smallest=NULL;
|
|
- long smallest_size=0xfffffff;
|
|
+ int32_t smallest_size=0xffffffff;
|
|
for (a=area_list;a;a=a->next)
|
|
if (o->x>=a->x && o->y>=a->y && o->x<=a->x+a->w && o->y<=a->y+a->h)
|
|
{
|
|
- long size=a->w*a->h;
|
|
+ int32_t size=a->w*a->h;
|
|
if (size<smallest_size)
|
|
{
|
|
smallest=a;
|
|
@@ -692,7 +693,7 @@
|
|
|
|
if (o->otype!=current_start_type)
|
|
{
|
|
- long fmp=o->fmp();
|
|
+ int32_t fmp=o->fmp();
|
|
int reduce=figures[o->otype]->morph_power;
|
|
if (reduce)
|
|
{
|
|
@@ -759,14 +760,14 @@
|
|
return ret;
|
|
}
|
|
|
|
-void level::set_tick_counter(ulong x)
|
|
+void level::set_tick_counter(uint32_t x)
|
|
{
|
|
ctick=x;
|
|
}
|
|
|
|
void level::draw_areas(view *v)
|
|
{
|
|
- long sx1,sy1,sx2,sy2;
|
|
+ int32_t sx1,sy1,sx2,sy2;
|
|
area_controller *a=area_list;
|
|
for (;a;a=a->next)
|
|
{
|
|
@@ -806,7 +807,7 @@
|
|
clear_tmp();
|
|
}
|
|
|
|
-void calc_bgsize(unsigned short fgw, unsigned short fgh, unsigned short &bgw, unsigned short &bgh)
|
|
+void calc_bgsize(uint16_t fgw, uint16_t fgh, uint16_t &bgw, uint16_t &bgh)
|
|
{
|
|
bgw=fgw/ASPECT+8;
|
|
bgh=fgh/ASPECT+8;
|
|
@@ -821,17 +822,17 @@
|
|
return ;
|
|
}
|
|
|
|
- unsigned short *new_fg,*new_bg;
|
|
- new_fg=(unsigned short *)jmalloc(w*h*sizeof(short),"Map fg : resized");
|
|
- memset(new_fg,0,w*h*sizeof(short));
|
|
+ uint16_t *new_fg,*new_bg;
|
|
+ new_fg=(uint16_t *)jmalloc(w*h*sizeof(int16_t),"Map fg : resized");
|
|
+ memset(new_fg,0,w*h*sizeof(int16_t));
|
|
|
|
int x,y,miny=(h<fg_height)? h : fg_height,minx=(w<fg_width)? w : fg_width;
|
|
|
|
- unsigned short nbw,nbh;
|
|
+ uint16_t nbw,nbh;
|
|
calc_bgsize(w,h,nbw,nbh);
|
|
|
|
- new_bg=(unsigned short *)jmalloc((int)nbw*(int)nbh*sizeof(short),"map bg : resized");
|
|
- memset(new_bg,0,(int)nbw*(int)nbh*sizeof(short));
|
|
+ new_bg=(uint16_t *)jmalloc((int)nbw*(int)nbh*sizeof(int16_t),"map bg : resized");
|
|
+ memset(new_bg,0,(int)nbw*(int)nbh*sizeof(int16_t));
|
|
|
|
for (y=0;y<miny;y++)
|
|
for (x=0;x<minx;x++)
|
|
@@ -865,7 +866,7 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (RC_type_size(fp->read_byte())!=size)
|
|
+ if (RC_type_size(fp->read_uint8())!=size)
|
|
return 0;
|
|
else return 1;
|
|
}
|
|
@@ -884,12 +885,12 @@
|
|
{
|
|
fp->seek(se->offset,0);
|
|
/******************************* Read debug info ******************************/
|
|
- short old_tot=fp->read_short();
|
|
- unsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");
|
|
+ int16_t old_tot=fp->read_uint16();
|
|
+ uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");
|
|
char old_name[150];
|
|
for (i=0;i<old_tot;i++)
|
|
{
|
|
- fp->read(old_name,fp->read_byte()); // read the name
|
|
+ fp->read(old_name,fp->read_uint8()); // read the name
|
|
for (o_remap[i]=0xffff,j=0;j<total_objects;j++) // check for matching current name
|
|
{
|
|
if (!strcmp(old_name,object_names[j]))
|
|
@@ -899,28 +900,28 @@
|
|
|
|
|
|
/***************************** Read state names *********************************/
|
|
- int old_stot=fp->read_short();
|
|
+ int old_stot=fp->read_uint16();
|
|
unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array");
|
|
for (i=0;i<old_stot;i++)
|
|
{
|
|
- fp->read(old_name,fp->read_byte());
|
|
+ fp->read(old_name,fp->read_uint8());
|
|
s_remap[i]=stopped; // non exsitant states get mapped into stopped state
|
|
for (j=0;j<MAX_STATE;j++) // see if old state exist now
|
|
if (!strcmp(state_names[j],old_name))
|
|
s_remap[i]=j;
|
|
}
|
|
- total_objs=fp->read_long();
|
|
+ total_objs=fp->read_uint32();
|
|
|
|
se=sd->find("type");
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
last=NULL;
|
|
- if (fp->read_byte()==RC_S) // read type array, this should be type RC_S
|
|
+ if (fp->read_uint8()==RC_16) // read type array, this should be type RC_16
|
|
{
|
|
for (i=0;i<total_objs;i++)
|
|
{
|
|
- ushort t=fp->read_short();
|
|
+ uint16_t t=fp->read_uint16();
|
|
game_object *p=new game_object(o_remap[t],1);
|
|
clear_tmp();
|
|
if (!first) first=p; else last->next=p;
|
|
@@ -932,12 +933,12 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_S) // read state array, this should be type RC_S
|
|
+ if (fp->read_uint8()==RC_16) // read state array, this should be type RC_16
|
|
{
|
|
game_object *l=first;
|
|
for (i=0;i<total_objs;i++,l=l->next)
|
|
{
|
|
- character_state s=(character_state)s_remap[fp->read_short()];
|
|
+ character_state s=(character_state)s_remap[fp->read_uint16()];
|
|
if (l->otype!=0xffff)
|
|
{
|
|
if (l->has_sequence((character_state)s))
|
|
@@ -963,7 +964,7 @@
|
|
{
|
|
fp->seek(se->offset,0);
|
|
int t=object_descriptions[j].type;
|
|
- if (fp->read_byte()!=t)
|
|
+ if (fp->read_uint8()!=t)
|
|
dprintf("Warning : load level -> var '%s' size changed\n");
|
|
else
|
|
{
|
|
@@ -972,9 +973,9 @@
|
|
{
|
|
switch (t)
|
|
{
|
|
- case RC_C : f->set_var(j,fp->read_byte()); break;
|
|
- case RC_S : f->set_var(j,fp->read_short()); break;
|
|
- case RC_L : f->set_var(j,fp->read_long()); break;
|
|
+ case RC_8 : f->set_var(j,fp->read_uint8()); break;
|
|
+ case RC_16 : f->set_var(j,fp->read_uint16()); break;
|
|
+ case RC_32 : f->set_var(j,fp->read_uint32()); break;
|
|
}
|
|
|
|
// check to make sure the frame number is not out of bounds from the time
|
|
@@ -1016,18 +1017,18 @@
|
|
else if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- short old_tot=fp->read_short();
|
|
+ int16_t old_tot=fp->read_uint16();
|
|
se=sd->find("describe_names");
|
|
if (!se || !old_tot)
|
|
return ;
|
|
|
|
- unsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");
|
|
- unsigned short *o_backmap=(unsigned short *)jmalloc(total_objects*2,"obj remap array");
|
|
+ uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");
|
|
+ uint16_t *o_backmap=(uint16_t *)jmalloc(total_objects*2,"obj remap array");
|
|
memset(o_backmap,0xff,total_objects*2);
|
|
char old_name[150];
|
|
for (i=0;i<old_tot;i++)
|
|
{
|
|
- fp->read(old_name,fp->read_byte()); // read the name
|
|
+ fp->read(old_name,fp->read_uint8()); // read the name
|
|
for (o_remap[i]=0xffff,j=0;j<total_objects;j++) // check for matching current name
|
|
{
|
|
if (!strcmp(old_name,object_names[j]))
|
|
@@ -1040,17 +1041,17 @@
|
|
|
|
se=sd->find("describe_states");
|
|
if (!se) { jfree(o_remap); jfree(o_backmap); return ; }
|
|
- short **s_remap=(short **)jmalloc(old_tot*sizeof(short *),"big state remap array");
|
|
- short *s_remap_totals=(short *)jmalloc(old_tot*sizeof(short),"big state rmp totals");
|
|
+ int16_t **s_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big state remap array");
|
|
+ int16_t *s_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big state rmp totals");
|
|
fp->seek(se->offset,0);
|
|
int i=0;
|
|
for (;i<old_tot;i++)
|
|
{
|
|
- short t=fp->read_short();
|
|
+ int16_t t=fp->read_uint16();
|
|
s_remap_totals[i]=t;
|
|
if (t)
|
|
{
|
|
- s_remap[i]=(short *)jmalloc(t*sizeof(short),"state remap");
|
|
+ s_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"state remap");
|
|
int j=0;
|
|
for (;j<t;j++)
|
|
*(s_remap[i]+j)=stopped; // if no remap found, then go to stopped state
|
|
@@ -1060,7 +1061,7 @@
|
|
int j=0;
|
|
for (;j<t;j++)
|
|
{
|
|
- fp->read(old_name,fp->read_byte());
|
|
+ fp->read(old_name,fp->read_uint8());
|
|
int new_type=o_remap[i];
|
|
if (new_type<total_objects) // make sure old object still exsist
|
|
{
|
|
@@ -1075,30 +1076,30 @@
|
|
}
|
|
}
|
|
|
|
- short **v_remap=NULL;
|
|
- short *v_remap_totals=NULL;
|
|
+ int16_t **v_remap=NULL;
|
|
+ int16_t *v_remap_totals=NULL;
|
|
int load_vars=1;
|
|
se=sd->find("describe_lvars");
|
|
if (se)
|
|
{
|
|
- v_remap=(short **)jmalloc(old_tot*sizeof(short *),"big var remap array");
|
|
- v_remap_totals=(short *)jmalloc(old_tot*sizeof(short),"big var rmp totals");
|
|
+ v_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big var remap array");
|
|
+ v_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big var rmp totals");
|
|
|
|
fp->seek(se->offset,0);
|
|
int i=0;
|
|
for (;i<old_tot;i++)
|
|
{
|
|
- short t=fp->read_short();
|
|
+ int16_t t=fp->read_uint16();
|
|
v_remap_totals[i]=t;
|
|
if (t)
|
|
{
|
|
- v_remap[i]=(short *)jmalloc(t*sizeof(short),"var remap");
|
|
- memset(v_remap[i],0xff,t*sizeof(short));
|
|
+ v_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"var remap");
|
|
+ memset(v_remap[i],0xff,t*sizeof(int16_t));
|
|
} else { v_remap[i]=NULL; }
|
|
int j=0;
|
|
for (;j<t;j++)
|
|
{
|
|
- fp->read(old_name,fp->read_byte());
|
|
+ fp->read(old_name,fp->read_uint8());
|
|
int new_type=o_remap[i];
|
|
if (new_type!=0xffff) // make sure old object still exsist
|
|
{
|
|
@@ -1120,19 +1121,19 @@
|
|
se=sd->find("object_list");
|
|
if (se)
|
|
{
|
|
- total_objs=fp->read_long();
|
|
+ total_objs=fp->read_uint32();
|
|
|
|
se=sd->find("type");
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
last=NULL;
|
|
- if (fp->read_byte()==RC_S) // read type array, this should be type RC_S
|
|
+ if (fp->read_uint8()==RC_16) // read type array, this should be type RC_16
|
|
{
|
|
int i=0;
|
|
for (;i<total_objs;i++)
|
|
{
|
|
- ushort t=fp->read_short();
|
|
+ uint16_t t=fp->read_uint16();
|
|
game_object *p=new game_object(o_remap[t],1);
|
|
clear_tmp();
|
|
if (!first) first=p; else last->next=p;
|
|
@@ -1143,12 +1144,12 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_S) // read state array, this should be type RC_S
|
|
+ if (fp->read_uint8()==RC_16) // read state array, this should be type RC_16
|
|
{
|
|
game_object *l=first;
|
|
for (i=0;i<total_objs;i++,l=l->next)
|
|
{
|
|
- int st=fp->read_short();
|
|
+ int st=fp->read_uint16();
|
|
if (l->otype==0xffff)
|
|
l->state=stopped;
|
|
else
|
|
@@ -1171,14 +1172,14 @@
|
|
game_object *o=first;
|
|
for (;o && !abort;o=o->next)
|
|
{
|
|
- short ot=fp->read_short();
|
|
+ int16_t ot=fp->read_uint16();
|
|
int k=0;
|
|
for (;k<ot;k++)
|
|
{
|
|
- if (fp->read_byte()!=RC_L) abort=1;
|
|
+ if (fp->read_uint8()!=RC_32) abort=1;
|
|
else
|
|
{
|
|
- long v=fp->read_long();
|
|
+ int32_t v=fp->read_uint32();
|
|
if (o->otype!=0xffff) // non-exstant object
|
|
{
|
|
int remap=*(v_remap[o_backmap[o->otype]]+k);
|
|
@@ -1206,7 +1207,7 @@
|
|
{
|
|
fp->seek(se->offset,0);
|
|
int t=object_descriptions[j].type;
|
|
- if (fp->read_byte()!=t)
|
|
+ if (fp->read_uint8()!=t)
|
|
dprintf("Warning : load level -> var '%s' size changed\n");
|
|
else
|
|
{
|
|
@@ -1215,12 +1216,12 @@
|
|
{
|
|
switch (t)
|
|
{
|
|
- case RC_C :
|
|
- { f->set_var(j,fp->read_byte()); } break;
|
|
- case RC_S :
|
|
- { f->set_var(j,fp->read_short()); } break;
|
|
- case RC_L :
|
|
- { f->set_var(j,fp->read_long()); } break;
|
|
+ case RC_8 :
|
|
+ { f->set_var(j,fp->read_uint8()); } break;
|
|
+ case RC_16 :
|
|
+ { f->set_var(j,fp->read_uint16()); } break;
|
|
+ case RC_32 :
|
|
+ { f->set_var(j,fp->read_uint32()); } break;
|
|
}
|
|
|
|
// check to make sure the frame number is not out of bounds from the time
|
|
@@ -1291,7 +1292,7 @@
|
|
if (e)
|
|
{
|
|
fp->seek(e->offset,0);
|
|
- int len=fp->read_byte(); // read the length of the string
|
|
+ int len=fp->read_uint8(); // read the length of the string
|
|
first_name=(char *)jmalloc(len,"level first name");
|
|
fp->read(first_name,len); // read the string
|
|
} else
|
|
@@ -1306,12 +1307,12 @@
|
|
if (e)
|
|
{
|
|
fp->seek(e->offset,0);
|
|
- fg_width=fp->read_long();
|
|
- fg_height=fp->read_long();
|
|
- map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
|
|
+ fg_width=fp->read_uint32();
|
|
+ fg_height=fp->read_uint32();
|
|
+ map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
|
|
fp->read((char *)map_fg,2*fg_width*fg_height);
|
|
int t=fg_width*fg_height;
|
|
- unsigned short *map=map_fg;
|
|
+ uint16_t *map=map_fg;
|
|
while (t) { *map=lstl(*map); map++; t--; }
|
|
} else
|
|
{
|
|
@@ -1324,12 +1325,12 @@
|
|
if (e)
|
|
{
|
|
fp->seek(e->offset,0);
|
|
- bg_width=fp->read_long();
|
|
- bg_height=fp->read_long();
|
|
- map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
|
|
+ bg_width=fp->read_uint32();
|
|
+ bg_height=fp->read_uint32();
|
|
+ map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
|
|
fp->read((char *)map_bg,2*bg_width*bg_height);
|
|
int t=bg_width*bg_height;
|
|
- unsigned short *map=map_bg;
|
|
+ uint16_t *map=map_bg;
|
|
while (t) { *map=lstl(*map); map++; t--; }
|
|
} else
|
|
{
|
|
@@ -1341,7 +1342,7 @@
|
|
{
|
|
fg_width=bg_width;
|
|
fg_height=bg_height;
|
|
- map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
|
|
+ map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
|
|
memset(map_fg,0,2*fg_width*fg_height);
|
|
}
|
|
|
|
@@ -1349,14 +1350,14 @@
|
|
{
|
|
bg_width=fg_width/8+8;
|
|
bg_height=fg_height/8+8;
|
|
- map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
|
|
+ map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
|
|
memset(map_bg,0,2*bg_width*bg_height);
|
|
}
|
|
stat_man->update(10);
|
|
|
|
/***************** Check map for non exsistant tiles **************************/
|
|
- long i,w;
|
|
- unsigned short *m;
|
|
+ int32_t i,w;
|
|
+ uint16_t *m;
|
|
spec_entry *load_all=sd->find("player_info");
|
|
for (i=0,w=fg_width*fg_height,m=map_fg;i<w;i++,m++)
|
|
{
|
|
@@ -1568,10 +1569,10 @@
|
|
|
|
|
|
|
|
- // how many objects are we goint to save, use a long to specify how many
|
|
+ // how many objects are we goint to save, use a int32_t to specify how many
|
|
sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"object_list",NULL,4,0));
|
|
|
|
- long t=0;
|
|
+ int32_t t=0;
|
|
object_node *o=save_list;
|
|
for (;o;o=o->next)
|
|
t++;
|
|
@@ -1642,8 +1643,8 @@
|
|
strftime(buf,80,"%T %A %B %d",localtime(&t));
|
|
eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf);
|
|
|
|
- fp->write_short(i->width());
|
|
- fp->write_short(i->height());
|
|
+ fp->write_uint16(i->width());
|
|
+ fp->write_uint16(i->height());
|
|
int y=0;
|
|
for (;y<i->height();y++)
|
|
fp->write(i->scan_line(y),i->width());
|
|
@@ -1653,36 +1654,36 @@
|
|
|
|
void level::write_player_info(bFILE *fp, object_node *save_list)
|
|
{
|
|
- long t=0;
|
|
+ int32_t t=0;
|
|
view *v=player_list;
|
|
for (;v;v=v->next) t++;
|
|
- fp->write_long(t);
|
|
+ fp->write_uint32(t);
|
|
|
|
for (v=player_list;v;v=v->next)
|
|
- fp->write_long(object_to_number_in_list(v->focus,save_list));
|
|
+ fp->write_uint32(object_to_number_in_list(v->focus,save_list));
|
|
|
|
int tv=total_view_vars();
|
|
int i=0;
|
|
for (;i<tv;i++)
|
|
{
|
|
- fp->write_byte(RC_L);
|
|
+ fp->write_uint8(RC_32);
|
|
for (v=player_list;v;v=v->next)
|
|
- fp->write_long(v->get_view_var_value(i));
|
|
+ fp->write_uint32(v->get_view_var_value(i));
|
|
}
|
|
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(rand_on);
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(rand_on);
|
|
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(total_weapons);
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(total_weapons);
|
|
for (v=player_list;v;v=v->next)
|
|
for (i=0;i<total_weapons;i++)
|
|
- fp->write_long(v->weapons[i]);
|
|
+ fp->write_uint32(v->weapons[i]);
|
|
|
|
for (v=player_list;v;v=v->next)
|
|
{
|
|
int len=strlen(v->name)+1;
|
|
- fp->write_byte(len);
|
|
+ fp->write_uint8(len);
|
|
fp->write(v->name,len);
|
|
}
|
|
}
|
|
@@ -1724,12 +1725,12 @@
|
|
delete v;
|
|
}
|
|
|
|
- long total_players=fp->read_long();
|
|
+ int32_t total_players=fp->read_uint32();
|
|
view *last=NULL;
|
|
int i=0;
|
|
for (;i<total_players;i++)
|
|
{
|
|
- game_object *o=number_to_object_in_list(fp->read_long(),save_list);
|
|
+ game_object *o=number_to_object_in_list(fp->read_uint32(),save_list);
|
|
v=new view(o,NULL,0);
|
|
if (o) o->set_controller(v);
|
|
if (player_list)
|
|
@@ -1748,10 +1749,10 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
+ if (fp->read_uint8()==RC_32)
|
|
{
|
|
for (v=player_list;v;v=v->next)
|
|
- v->set_view_var_value(i,fp->read_long());
|
|
+ v->set_view_var_value(i,fp->read_uint32());
|
|
}
|
|
} else
|
|
{
|
|
@@ -1764,23 +1765,23 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
- rand_on=fp->read_long();
|
|
+ if (fp->read_uint8()==RC_32)
|
|
+ rand_on=fp->read_uint32();
|
|
} else rand_on=0;
|
|
|
|
se=sd->find("weapon_array");
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
+ if (fp->read_uint8()==RC_32)
|
|
{
|
|
- long m=fp->read_long(); // read how many weapons exsisted when last saved
|
|
+ int32_t m=fp->read_uint32(); // read how many weapons exsisted when last saved
|
|
int i;
|
|
for (v=player_list;v;v=v->next)
|
|
{
|
|
for (i=0;i<m;i++)
|
|
{
|
|
- long x=fp->read_long();
|
|
+ int32_t x=fp->read_uint32();
|
|
if (i<total_weapons)
|
|
{
|
|
v->weapons[i]=x;
|
|
@@ -1793,8 +1794,8 @@
|
|
{
|
|
for (v=player_list;v;v=v->next)
|
|
{
|
|
- memset(v->last_weapons,0xff,total_weapons*sizeof(long));
|
|
- memset(v->weapons,0xff,total_weapons*sizeof(long));
|
|
+ memset(v->last_weapons,0xff,total_weapons*sizeof(int32_t));
|
|
+ memset(v->weapons,0xff,total_weapons*sizeof(int32_t));
|
|
}
|
|
}
|
|
|
|
@@ -1804,7 +1805,7 @@
|
|
fp->seek(se->offset,0);
|
|
for (v=player_list;v;v=v->next)
|
|
{
|
|
- uchar len=fp->read_byte();
|
|
+ uint8_t len=fp->read_uint8();
|
|
fp->read(v->name,len);
|
|
}
|
|
}
|
|
@@ -1852,12 +1853,12 @@
|
|
{
|
|
// record information in the file about what the data structures look like
|
|
// right now, so if they change later, they don't get get screwed up
|
|
- fp->write_short(total_objects); // mark how many objects we know about right now
|
|
+ fp->write_uint16(total_objects); // mark how many objects we know about right now
|
|
|
|
int i=0;
|
|
for (;i<total_objects;i++) // loop through all the object types we know of
|
|
{
|
|
- fp->write_byte(strlen(object_names[i])+1); // sizeof name
|
|
+ fp->write_uint8(strlen(object_names[i])+1); // sizeof name
|
|
fp->write(object_names[i],strlen(object_names[i])+1); // write object name
|
|
}
|
|
|
|
@@ -1869,13 +1870,13 @@
|
|
int j=0;
|
|
for (;j<figures[i]->ts;j++)
|
|
if (figures[i]->seq[j]) total++;
|
|
- fp->write_short(total);
|
|
+ fp->write_uint16(total);
|
|
|
|
for (j=0;j<figures[i]->ts;j++)
|
|
if (figures[i]->seq[j])
|
|
{
|
|
char *state_name=lstring_value(symbol_name(figures[i]->seq_syms[j]));
|
|
- fp->write_byte(strlen(state_name)+1);
|
|
+ fp->write_uint8(strlen(state_name)+1);
|
|
fp->write(state_name,strlen(state_name)+1);
|
|
}
|
|
}
|
|
@@ -1884,7 +1885,7 @@
|
|
// write object lvar names
|
|
for (i=0;i<total_objects;i++)
|
|
{
|
|
- fp->write_short(figures[i]->tv);
|
|
+ fp->write_uint16(figures[i]->tv);
|
|
int j,x;
|
|
|
|
for (x=0;x<figures[i]->tv;x++)
|
|
@@ -1894,66 +1895,66 @@
|
|
if (figures[i]->vars[j] && figures[i]->var_index[j]==x)
|
|
{
|
|
char *var_name=lstring_value(symbol_name(figures[i]->vars[j]));
|
|
- fp->write_byte(strlen(var_name)+1);
|
|
+ fp->write_uint8(strlen(var_name)+1);
|
|
fp->write(var_name,strlen(var_name)+1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
- long t=0;
|
|
+ int32_t t=0;
|
|
object_node *o=save_list;
|
|
for (;o;o=o->next) t++;
|
|
- fp->write_long(t);
|
|
+ fp->write_uint32(t);
|
|
|
|
|
|
- fp->write_byte(RC_S); // save type info for each record
|
|
- for (o=save_list;o;o=o->next) fp->write_short(o->me->type());
|
|
+ fp->write_uint8(RC_16); // save type info for each record
|
|
+ for (o=save_list;o;o=o->next) fp->write_uint16(o->me->type());
|
|
|
|
- fp->write_byte(RC_S); // save state info for each record
|
|
- for (o=save_list;o;o=o->next) fp->write_short(o->me->reduced_state());
|
|
+ fp->write_uint8(RC_16); // save state info for each record
|
|
+ for (o=save_list;o;o=o->next) fp->write_uint16(o->me->reduced_state());
|
|
|
|
for (o=save_list;o;o=o->next) // save lvars
|
|
{
|
|
- fp->write_short(figures[o->me->otype]->tv);
|
|
+ fp->write_uint16(figures[o->me->otype]->tv);
|
|
for (i=0;i<figures[o->me->otype]->tv;i++)
|
|
{
|
|
- fp->write_byte(RC_L); // for now the only type allowed is long
|
|
- fp->write_long(o->me->lvars[i]);
|
|
+ fp->write_uint8(RC_32); // for now the only type allowed is int32_t
|
|
+ fp->write_uint32(o->me->lvars[i]);
|
|
}
|
|
}
|
|
|
|
for (i=0;i<default_simple.total_vars();i++)
|
|
{
|
|
int t=object_descriptions[i].type;
|
|
- fp->write_byte(t);
|
|
+ fp->write_uint8(t);
|
|
for (o=save_list;o;o=o->next)
|
|
{
|
|
switch (t)
|
|
{
|
|
- case RC_C :
|
|
- { fp->write_byte(o->me->get_var(i)); } break;
|
|
- case RC_S :
|
|
- { fp->write_short(o->me->get_var(i)); } break;
|
|
- case RC_L :
|
|
- { fp->write_long(o->me->get_var(i)); } break;
|
|
+ case RC_8 :
|
|
+ { fp->write_uint8(o->me->get_var(i)); } break;
|
|
+ case RC_16 :
|
|
+ { fp->write_uint16(o->me->get_var(i)); } break;
|
|
+ case RC_32 :
|
|
+ { fp->write_uint32(o->me->get_var(i)); } break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-long level::total_object_links(object_node *list)
|
|
+int32_t level::total_object_links(object_node *list)
|
|
{
|
|
- long tl=0;
|
|
+ int32_t tl=0;
|
|
for (object_node *o=list;o;o=o->next)
|
|
tl+=o->me->total_objects();
|
|
return tl;
|
|
}
|
|
|
|
-long level::total_light_links(object_node *list)
|
|
+int32_t level::total_light_links(object_node *list)
|
|
{
|
|
- long tl=0;
|
|
+ int32_t tl=0;
|
|
for (object_node *o=list;o;o=o->next)
|
|
tl+=o->me->total_lights();
|
|
return tl;
|
|
@@ -1961,8 +1962,8 @@
|
|
|
|
void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list)
|
|
{
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(total_object_links(save_list));
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(total_object_links(save_list));
|
|
|
|
int x=1;
|
|
object_node *o=save_list;
|
|
@@ -1972,17 +1973,17 @@
|
|
int i=0;
|
|
for (;i<o->me->total_objects();i++)
|
|
{
|
|
- fp->write_long(x);
|
|
- long x=object_to_number_in_list(o->me->get_object(i),save_list);
|
|
+ fp->write_uint32(x);
|
|
+ int32_t x=object_to_number_in_list(o->me->get_object(i),save_list);
|
|
if (x)
|
|
- fp->write_long(x);
|
|
+ fp->write_uint32(x);
|
|
else // save links to excluded items as negative
|
|
- fp->write_long((long)(-(object_to_number_in_list(o->me,exclude_list))));
|
|
+ fp->write_uint32((int32_t)(-(object_to_number_in_list(o->me,exclude_list))));
|
|
}
|
|
}
|
|
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(total_light_links(save_list));
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(total_light_links(save_list));
|
|
|
|
x=1;
|
|
for (o=save_list;o;o=o->next,x++)
|
|
@@ -1990,8 +1991,8 @@
|
|
int i=0;
|
|
for (;i<o->me->total_lights();i++)
|
|
{
|
|
- fp->write_long(x);
|
|
- fp->write_long(light_to_number(o->me->get_light(i)));
|
|
+ fp->write_uint32(x);
|
|
+ fp->write_uint32(light_to_number(o->me->get_light(i)));
|
|
}
|
|
}
|
|
|
|
@@ -2005,14 +2006,14 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
+ if (fp->read_uint8()==RC_32)
|
|
{
|
|
- long t=fp->read_long();
|
|
+ int32_t t=fp->read_uint32();
|
|
while (t)
|
|
{
|
|
- long x1=fp->read_long();
|
|
+ int32_t x1=fp->read_uint32();
|
|
CONDITION(x1>=0,"expected x1 for object link to be > 0\n");
|
|
- long x2=fp->read_long();
|
|
+ int32_t x2=fp->read_uint32();
|
|
game_object *p,*q=number_to_object_in_list(x1,save_list);
|
|
if (x2>0)
|
|
p=number_to_object_in_list(x2,save_list);
|
|
@@ -2030,13 +2031,13 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
+ if (fp->read_uint8()==RC_32)
|
|
{
|
|
- long t=fp->read_long();
|
|
+ int32_t t=fp->read_uint32();
|
|
while (t)
|
|
{
|
|
- long x1=fp->read_long();
|
|
- long x2=fp->read_long();
|
|
+ int32_t x1=fp->read_uint32();
|
|
+ int32_t x2=fp->read_uint32();
|
|
game_object *p=number_to_object_in_list(x1,save_list);
|
|
if (p)
|
|
p->add_light(number_to_light(x2));
|
|
@@ -2052,34 +2053,34 @@
|
|
void level::write_options(bFILE *fp)
|
|
{
|
|
// save background scroll rate
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(bg_xmul);
|
|
- fp->write_long(bg_xdiv);
|
|
- fp->write_long(bg_ymul);
|
|
- fp->write_long(bg_ydiv);
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(bg_xmul);
|
|
+ fp->write_uint32(bg_xdiv);
|
|
+ fp->write_uint32(bg_ymul);
|
|
+ fp->write_uint32(bg_ydiv);
|
|
|
|
- fp->write_byte(RC_L);
|
|
+ fp->write_uint8(RC_32);
|
|
int ta=0;
|
|
area_controller *a=area_list;
|
|
for (;a;a=a->next) ta++;
|
|
- fp->write_long(ta);
|
|
+ fp->write_uint32(ta);
|
|
for (a=area_list;a;a=a->next)
|
|
{
|
|
- fp->write_long(a->x);
|
|
- fp->write_long(a->y);
|
|
- fp->write_long(a->w);
|
|
- fp->write_long(a->h);
|
|
- fp->write_long(a->active);
|
|
-
|
|
- fp->write_long(a->ambient);
|
|
- fp->write_long(a->view_xoff);
|
|
- fp->write_long(a->view_yoff);
|
|
- fp->write_long(a->ambient_speed);
|
|
- fp->write_long(a->view_xoff_speed);
|
|
- fp->write_long(a->view_yoff_speed);
|
|
+ fp->write_uint32(a->x);
|
|
+ fp->write_uint32(a->y);
|
|
+ fp->write_uint32(a->w);
|
|
+ fp->write_uint32(a->h);
|
|
+ fp->write_uint32(a->active);
|
|
+
|
|
+ fp->write_uint32(a->ambient);
|
|
+ fp->write_uint32(a->view_xoff);
|
|
+ fp->write_uint32(a->view_yoff);
|
|
+ fp->write_uint32(a->ambient_speed);
|
|
+ fp->write_uint32(a->view_xoff_speed);
|
|
+ fp->write_uint32(a->view_yoff_speed);
|
|
}
|
|
- fp->write_byte(RC_L);
|
|
- fp->write_long(tick_counter());
|
|
+ fp->write_uint8(RC_32);
|
|
+ fp->write_uint32(tick_counter());
|
|
}
|
|
|
|
void level::load_options(spec_directory *sd, bFILE *fp)
|
|
@@ -2088,14 +2089,14 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()!=RC_L)
|
|
+ if (fp->read_uint8()!=RC_32)
|
|
{ bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
|
|
else
|
|
{
|
|
- bg_xmul=fp->read_long();
|
|
- bg_xdiv=fp->read_long();
|
|
- bg_ymul=fp->read_long();
|
|
- bg_ydiv=fp->read_long();
|
|
+ bg_xmul=fp->read_uint32();
|
|
+ bg_xdiv=fp->read_uint32();
|
|
+ bg_ymul=fp->read_uint32();
|
|
+ bg_ydiv=fp->read_uint32();
|
|
}
|
|
} else { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
|
|
|
|
@@ -2103,29 +2104,29 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
+ if (fp->read_uint8()==RC_32)
|
|
{
|
|
area_controller *l=NULL,*p;
|
|
- long ta=fp->read_long();
|
|
+ int32_t ta=fp->read_uint32();
|
|
int i=0;
|
|
for (;i<ta;i++)
|
|
{
|
|
- long x,y,w,h;
|
|
- x=fp->read_long();
|
|
- y=fp->read_long();
|
|
- w=fp->read_long();
|
|
- h=fp->read_long();
|
|
+ int32_t x,y,w,h;
|
|
+ x=fp->read_uint32();
|
|
+ y=fp->read_uint32();
|
|
+ w=fp->read_uint32();
|
|
+ h=fp->read_uint32();
|
|
p=new area_controller(x,y,w,h,NULL);
|
|
if (l) l->next=p;
|
|
else area_list=p;
|
|
l=p;
|
|
- p->active=fp->read_long();
|
|
- p->ambient=fp->read_long();
|
|
- p->view_xoff=fp->read_long();
|
|
- p->view_yoff=fp->read_long();
|
|
- p->ambient_speed=fp->read_long();
|
|
- p->view_xoff_speed=fp->read_long();
|
|
- p->view_yoff_speed=fp->read_long();
|
|
+ p->active=fp->read_uint32();
|
|
+ p->ambient=fp->read_uint32();
|
|
+ p->view_xoff=fp->read_uint32();
|
|
+ p->view_yoff=fp->read_uint32();
|
|
+ p->ambient_speed=fp->read_uint32();
|
|
+ p->view_xoff_speed=fp->read_uint32();
|
|
+ p->view_yoff_speed=fp->read_uint32();
|
|
}
|
|
}
|
|
}
|
|
@@ -2134,8 +2135,8 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,0);
|
|
- if (fp->read_byte()==RC_L)
|
|
- set_tick_counter(fp->read_long());
|
|
+ if (fp->read_uint8()==RC_32)
|
|
+ set_tick_counter(fp->read_uint32());
|
|
else set_tick_counter(0);
|
|
} else set_tick_counter(0);
|
|
}
|
|
@@ -2202,8 +2203,8 @@
|
|
dprintf("unable to open backup file %s\n", bkname );
|
|
else
|
|
{
|
|
- long size = fp->file_size();
|
|
- uchar *buf = (uchar *)jmalloc(0x1000,"copy buf");
|
|
+ int32_t size = fp->file_size();
|
|
+ uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf");
|
|
int tr = 1;
|
|
while( size && tr )
|
|
{
|
|
@@ -2246,23 +2247,23 @@
|
|
{
|
|
if( first_name )
|
|
{
|
|
- fp->write_byte( strlen( first_name ) + 1 );
|
|
+ fp->write_uint8( strlen( first_name ) + 1 );
|
|
fp->write( first_name, strlen( first_name ) + 1 );
|
|
}
|
|
else
|
|
{
|
|
- fp->write_byte( 1 );
|
|
- fp->write_byte( 0 );
|
|
+ fp->write_uint8( 1 );
|
|
+ fp->write_uint8( 0 );
|
|
}
|
|
|
|
- fp->write_long( fg_width );
|
|
- fp->write_long( fg_height );
|
|
+ fp->write_uint32( fg_width );
|
|
+ fp->write_uint32( fg_height );
|
|
|
|
int t = fg_width * fg_height;
|
|
- ushort *rm = map_fg;
|
|
+ uint16_t *rm = map_fg;
|
|
for (;t;t--,rm++)
|
|
{
|
|
- ushort x = *rm;
|
|
+ uint16_t x = *rm;
|
|
x = lstl(x); // convert to intel endianess
|
|
*rm = x;
|
|
}
|
|
@@ -2272,19 +2273,19 @@
|
|
rm = map_fg;
|
|
for (;t;t--,rm++)
|
|
{
|
|
- ushort x = *rm;
|
|
+ uint16_t x = *rm;
|
|
x = lstl( x ); // convert to intel endianess
|
|
*rm = x;
|
|
}
|
|
|
|
- fp->write_long( bg_width );
|
|
- fp->write_long( bg_height );
|
|
+ fp->write_uint32( bg_width );
|
|
+ fp->write_uint32( bg_height );
|
|
t = bg_width * bg_height;
|
|
rm = map_bg;
|
|
|
|
for (;t;t--,rm++)
|
|
{
|
|
- ushort x=*rm;
|
|
+ uint16_t x=*rm;
|
|
x = lstl( x ); // convert to intel endianess
|
|
*rm = x;
|
|
}
|
|
@@ -2295,7 +2296,7 @@
|
|
|
|
for (;t;t--,rm++)
|
|
{
|
|
- ushort x = *rm;
|
|
+ uint16_t x = *rm;
|
|
x = lstl( x ); // convert to intel endianess
|
|
*rm = x;
|
|
}
|
|
@@ -2366,13 +2367,13 @@
|
|
fg_height=height;
|
|
calc_bgsize(fg_width,fg_height,bg_width,bg_height);
|
|
|
|
- map_bg=(unsigned short *)jmalloc(sizeof(short)*bg_width*bg_height,"map bg");
|
|
- map_fg=(unsigned short *)jmalloc(sizeof(short)*fg_width*fg_height,"map fg");
|
|
+ map_bg=(uint16_t *)jmalloc(sizeof(int16_t)*bg_width*bg_height,"map bg");
|
|
+ map_fg=(uint16_t *)jmalloc(sizeof(int16_t)*fg_width*fg_height,"map fg");
|
|
|
|
|
|
|
|
- memset(map_bg,0,sizeof(short)*bg_width*bg_height);
|
|
- memset(map_fg,0,sizeof(short)*fg_width*fg_height);
|
|
+ memset(map_bg,0,sizeof(int16_t)*bg_width*bg_height);
|
|
+ memset(map_fg,0,sizeof(int16_t)*fg_width*fg_height);
|
|
|
|
int i;
|
|
for (i=0;i<fg_width;i++)
|
|
@@ -2575,9 +2576,9 @@
|
|
return me;
|
|
}
|
|
|
|
-game_object *level::find_object(long x, long y)
|
|
+game_object *level::find_object(int32_t x, int32_t y)
|
|
{
|
|
- long x1,y1,x2,y2;
|
|
+ int32_t x1,y1,x2,y2;
|
|
game_object *o=first;
|
|
for (;o;o=o->next)
|
|
{
|
|
@@ -2588,23 +2589,23 @@
|
|
return NULL;
|
|
}
|
|
|
|
-long last_tile_hit_x,last_tile_hit_y;
|
|
+int32_t last_tile_hit_x,last_tile_hit_y;
|
|
|
|
#define remapx(x) (x==0 ? -1 : x==tl-1 ? tl+1 : x)
|
|
#define remapy(y) (y==0 ? -1 : y==th-1 ? th+1 : y)
|
|
|
|
-void level::foreground_intersect(long x1, long y1, long &x2, long &y2)
|
|
+void level::foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
|
|
{
|
|
/* if (x1==x2)
|
|
{ vforeground_intersect(x1,y1,y2);
|
|
return ;
|
|
} */
|
|
|
|
- long tl=the_game->ftile_width(),th=the_game->ftile_height(),
|
|
+ int32_t tl=the_game->ftile_width(),th=the_game->ftile_height(),
|
|
j,
|
|
xp1,yp1,xp2,yp2, // starting and ending points of block line segment
|
|
swap; // temp var
|
|
- long blockx1,blocky1,blockx2,blocky2,block,bx,by;
|
|
+ int32_t blockx1,blocky1,blockx2,blocky2,block,bx,by;
|
|
point_list *block_list;
|
|
unsigned char *bdat;
|
|
|
|
@@ -2641,7 +2642,7 @@
|
|
unsigned char total=block_list->tot;
|
|
bdat=block_list->data;
|
|
unsigned char *ins=f->points->inside;
|
|
- long xo=bx*tl,yo=by*th;
|
|
+ int32_t xo=bx*tl,yo=by*th;
|
|
for (j=0;j<total-1;j++,ins++)
|
|
{
|
|
// find the starting and ending points for this segment
|
|
@@ -2655,7 +2656,7 @@
|
|
yp2=yo+remapy(bdat[1]);
|
|
|
|
|
|
- long ox2=x2,oy2=y2;
|
|
+ int32_t ox2=x2,oy2=y2;
|
|
if (*ins)
|
|
setback_intersect(x1,y1,x2,y2,xp1,yp1,xp2,yp2,1);
|
|
else
|
|
@@ -2673,12 +2674,12 @@
|
|
}
|
|
|
|
|
|
-void level::vforeground_intersect(long x1, long y1, long &y2)
|
|
+void level::vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2)
|
|
{
|
|
- long tl=f_wid,th=f_hi,
|
|
+ int32_t tl=f_wid,th=f_hi,
|
|
j,
|
|
xp1,yp1,xp2,yp2; // starting and ending points of block line segment temp var
|
|
- long blocky1,blocky2,block,bx,by,checkx;
|
|
+ int32_t blocky1,blocky2,block,bx,by,checkx;
|
|
point_list *block_list;
|
|
unsigned char *bdat;
|
|
|
|
@@ -2716,7 +2717,7 @@
|
|
bdat=block_list->data;
|
|
unsigned char *ins=f->points->inside;
|
|
|
|
-// long xo=bx*tl,yo=by*th;
|
|
+// int32_t xo=bx*tl,yo=by*th;
|
|
for (j=0;j<total-1;j++,ins++)
|
|
{
|
|
// find the starting and ending points for this segment
|
|
@@ -2730,7 +2731,7 @@
|
|
yp2=remapy(bdat[1]);
|
|
|
|
|
|
- long oy2=y2;
|
|
+ int32_t oy2=y2;
|
|
if (*ins)
|
|
setback_intersect(checkx,y1,checkx,y2,xp1,yp1,xp2,yp2,1);
|
|
else
|
|
@@ -2747,7 +2748,7 @@
|
|
|
|
|
|
|
|
-void level::send_signal(long signal)
|
|
+void level::send_signal(int32_t signal)
|
|
{
|
|
if (signal) // signal 0 is never sent!
|
|
{
|
|
@@ -2760,7 +2761,7 @@
|
|
|
|
int level::crush(game_object *by_who, int xamount, int yamount)
|
|
{
|
|
- long xv,yv,crushed=0;
|
|
+ int32_t xv,yv,crushed=0;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
{
|
|
@@ -2797,14 +2798,14 @@
|
|
int level::platform_push(game_object *by_who, int xamount, int yamount)
|
|
{
|
|
int failed=0;
|
|
- long xv,yv;
|
|
+ int32_t xv,yv;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
{
|
|
if (o->is_playable() && o->state!=dieing && o->state!=dead)
|
|
{
|
|
// check to see if the platform is going up and will run into us.
|
|
- long tvx,tvy;
|
|
+ int32_t tvx,tvy;
|
|
if (yamount<0)
|
|
{
|
|
tvx=-xamount;
|
|
@@ -2847,7 +2848,7 @@
|
|
|
|
int level::push_characters(game_object *by_who, int xamount, int yamount)
|
|
{
|
|
- long xv,yv;
|
|
+ int32_t xv,yv;
|
|
int failed=0;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
@@ -2856,7 +2857,7 @@
|
|
{
|
|
xv=-xamount;
|
|
yv=-yamount;
|
|
- long tvx,tvy;
|
|
+ int32_t tvx,tvy;
|
|
if (xv>0) tvx=xv+1; else if (xv<0) tvx=xv-1; else tvx=0;
|
|
if (yv>0) tvy=yv+1; else if (yv<0) tvx=yv-1; else tvy=0;
|
|
if (o->try_move(o->x+xamount,o->y+yamount,tvx,tvy,3)==by_who)
|
|
@@ -2876,7 +2877,7 @@
|
|
|
|
game_object *level::find_xrange(int x, int y, int type, int xd)
|
|
{
|
|
- long find_ydist=100000;
|
|
+ int32_t find_ydist=100000;
|
|
game_object *find=NULL;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
@@ -2899,7 +2900,7 @@
|
|
|
|
game_object *level::find_xclosest(int x, int y, int type, game_object *who)
|
|
{
|
|
- long find_ydist=100000,find_xdist=0xffffff;
|
|
+ int32_t find_ydist=100000,find_xdist=0xffffff;
|
|
game_object *find=NULL;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
@@ -2929,7 +2930,7 @@
|
|
|
|
game_object *level::find_closest(int x, int y, int type, game_object *who)
|
|
{
|
|
- long find_dist=100000;
|
|
+ int32_t find_dist=100000;
|
|
game_object *find=NULL;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
@@ -2984,7 +2985,7 @@
|
|
return l;
|
|
}
|
|
|
|
-void level::hurt_radius(long x, long y,long r, long m, game_object *from, game_object *exclude,
|
|
+void level::hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude,
|
|
int max_push)
|
|
{
|
|
if (r<1) return ; // avoid dev vy zero
|
|
@@ -2993,8 +2994,8 @@
|
|
{
|
|
if (o!=exclude && o->hurtable())
|
|
{
|
|
- long y1=o->y,y2=o->y-o->picture()->height();
|
|
- long cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);
|
|
+ int32_t y1=o->y,y2=o->y-o->picture()->height();
|
|
+ int32_t cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);
|
|
if (cx<cy1)
|
|
d1=cx+cy1-(cx>>1);
|
|
else d1=cx+cy1-(cy1>>1);
|
|
@@ -3055,7 +3056,7 @@
|
|
{
|
|
if (v!=exclude)
|
|
{
|
|
- long cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;
|
|
+ int32_t cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;
|
|
if (cx<cy)
|
|
d=cx+cy-(cx>>1);
|
|
else d=cx+cy-(cy>>1);
|
|
@@ -3151,15 +3152,15 @@
|
|
}
|
|
|
|
|
|
-game_object *level::find_object_in_area(long x, long y, long x1, long y1, long x2, long y2,
|
|
+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,
|
|
Cell *list, game_object *exclude)
|
|
{
|
|
game_object *closest=NULL;
|
|
- long closest_distance=0xfffffff,distance,xo,yo;
|
|
+ int32_t closest_distance=0xfffffff,distance,xo,yo;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
{
|
|
- long xp1,yp1,xp2,yp2;
|
|
+ int32_t xp1,yp1,xp2,yp2;
|
|
o->picture_space(xp1,yp1,xp2,yp2);
|
|
|
|
|
|
@@ -3187,15 +3188,15 @@
|
|
|
|
|
|
|
|
-game_object *level::find_object_in_angle(long x, long y, long start_angle, long end_angle,
|
|
+game_object *level::find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle,
|
|
void *list, game_object *exclude)
|
|
{
|
|
game_object *closest=NULL;
|
|
- long closest_distance=0xfffffff,distance,xo,yo;
|
|
+ int32_t closest_distance=0xfffffff,distance,xo,yo;
|
|
game_object *o=first_active;
|
|
for (;o;o=o->next_active)
|
|
{
|
|
- long angle=lisp_atan2(o->y-y,o->x-x);
|
|
+ int32_t angle=lisp_atan2(o->y-y,o->x-x);
|
|
if (((start_angle<=end_angle && (angle>=start_angle && angle<=end_angle))
|
|
|| (start_angle>end_angle && (angle>=start_angle || angle<=end_angle)))
|
|
&& o!=exclude)
|
|
@@ -3249,15 +3250,15 @@
|
|
game_object *o=first;
|
|
for (;o;o=o->next)
|
|
{
|
|
- fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype],o->x,o->y,
|
|
- o->xvel(),o->yvel(),o->current_frame);
|
|
+ fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype],(long)o->x,(long)o->y,
|
|
+ (long)o->xvel(),(long)o->yvel(),o->current_frame);
|
|
}
|
|
fclose(fp);
|
|
}
|
|
}
|
|
|
|
|
|
-area_controller::area_controller(long X, long Y, long W, long H, area_controller *Next)
|
|
+area_controller::area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next)
|
|
{
|
|
x=X; y=Y; w=W; h=H;
|
|
next=Next; active=0;
|
|
Index: abuse-sdl-0.7.0/src/game.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/game.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/game.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -57,8 +57,8 @@
|
|
int dev,shift_down=SHIFT_DOWN_DEFAULT,shift_right=SHIFT_RIGHT_DEFAULT;
|
|
double sum_diffs=1,total_diffs=12;
|
|
int total_active=0;
|
|
-long map_xoff=0,map_yoff=0;
|
|
-long current_vxadd,current_vyadd;
|
|
+int32_t map_xoff=0,map_yoff=0;
|
|
+int32_t current_vxadd,current_vyadd;
|
|
int frame_panic=0,massive_frame_panic=0;
|
|
int demo_start=0,idle_ticks=0;
|
|
int req_end=0;
|
|
@@ -70,7 +70,7 @@
|
|
char req_name[100];
|
|
|
|
int registered=0;
|
|
-extern uchar chatting_enabled;
|
|
+extern uint8_t chatting_enabled;
|
|
|
|
extern int confirm_quit();
|
|
|
|
@@ -135,7 +135,7 @@
|
|
}
|
|
}
|
|
|
|
-void game::play_sound(int id, int vol, long x, long y)
|
|
+void game::play_sound(int id, int vol, int32_t x, int32_t y)
|
|
{
|
|
if( sound_avail & SFX_INITIALIZED )
|
|
{
|
|
@@ -144,13 +144,13 @@
|
|
if( !player_list )
|
|
return;
|
|
|
|
- ulong mdist = 0xffffffff;
|
|
+ uint32_t mdist = 0xffffffff;
|
|
view *cd = NULL;
|
|
for( view *f = player_list; f ; f = f->next )
|
|
{
|
|
if( f->local_player() )
|
|
{
|
|
- long cx = abs(f->x_center()-x),cy = abs(f->y_center()-y), d;
|
|
+ int32_t cx = abs(f->x_center()-x),cy = abs(f->y_center()-y), d;
|
|
if( cx < cy )
|
|
d = cx + cy - ( cx >> 1 );
|
|
else
|
|
@@ -276,7 +276,7 @@
|
|
else return 0;
|
|
}
|
|
|
|
-void game::ftile_on(int screenx, int screeny, long &x, long &y)
|
|
+void game::ftile_on(int screenx, int screeny, int32_t &x, int32_t &y)
|
|
{
|
|
mouse_to_game(screenx,screeny,x,y);
|
|
x/=ftile_width();
|
|
@@ -284,8 +284,8 @@
|
|
/* view *f=view_in(screenx,screeny);
|
|
if (f)
|
|
{
|
|
- x=((long)(screenx)-(long)f->cx1+f->xoff())/(long)f_wid;
|
|
- y=((long)(screeny)-(long)f->cy1+f->yoff())/(long)f_hi;
|
|
+ x=((int32_t)(screenx)-(int32_t)f->cx1+f->xoff())/(int32_t)f_wid;
|
|
+ y=((int32_t)(screeny)-(int32_t)f->cy1+f->yoff())/(int32_t)f_hi;
|
|
}
|
|
else
|
|
{
|
|
@@ -294,13 +294,13 @@
|
|
}*/
|
|
}
|
|
|
|
-void game::btile_on(int screenx, int screeny, long &x, long &y)
|
|
+void game::btile_on(int screenx, int screeny, int32_t &x, int32_t &y)
|
|
{
|
|
view *f=view_in(screenx,screeny);
|
|
if (f)
|
|
{
|
|
- x=((long)(screenx)-(long)f->cx1+f->xoff()*bg_xmul/bg_xdiv)/(long)b_wid;
|
|
- y=((long)(screeny)-(long)f->cy1+f->yoff()*bg_ymul/bg_ydiv)/(long)b_hi;
|
|
+ x=((int32_t)(screenx)-(int32_t)f->cx1+f->xoff()*bg_xmul/bg_xdiv)/(int32_t)b_wid;
|
|
+ y=((int32_t)(screeny)-(int32_t)f->cy1+f->yoff()*bg_ymul/bg_ydiv)/(int32_t)b_hi;
|
|
}
|
|
else
|
|
{
|
|
@@ -310,7 +310,7 @@
|
|
}
|
|
|
|
|
|
-void game::mouse_to_game(long x, long y, long &gamex, long &gamey, view *f)
|
|
+void game::mouse_to_game(int32_t x, int32_t y, int32_t &gamex, int32_t &gamey, view *f)
|
|
{
|
|
if (!f)
|
|
{
|
|
@@ -323,23 +323,23 @@
|
|
|
|
if (dev&MAP_MODE)
|
|
{
|
|
- gamex=((x-(long)f->cx1)*ftile_width()/AUTOTILE_WIDTH+map_xoff*ftile_width());
|
|
- gamey=((y-(long)f->cy1)*ftile_height()/AUTOTILE_HEIGHT+map_yoff*ftile_height());
|
|
+ gamex=((x-(int32_t)f->cx1)*ftile_width()/AUTOTILE_WIDTH+map_xoff*ftile_width());
|
|
+ gamey=((y-(int32_t)f->cy1)*ftile_height()/AUTOTILE_HEIGHT+map_yoff*ftile_height());
|
|
} else
|
|
{
|
|
- gamex=(x-(long)f->cx1+f->xoff());
|
|
- gamey=(y-(long)f->cy1+f->yoff());
|
|
+ gamex=(x-(int32_t)f->cx1+f->xoff());
|
|
+ gamey=(y-(int32_t)f->cy1+f->yoff());
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-void game::game_to_mouse(long gamex, long gamey, view *which, long &x, long &y)
|
|
+void game::game_to_mouse(int32_t gamex, int32_t gamey, view *which, int32_t &x, int32_t &y)
|
|
{
|
|
if (dev&MAP_MODE)
|
|
{
|
|
- long x1,y1;
|
|
+ int32_t x1,y1;
|
|
if (dev&EDIT_MODE)
|
|
{
|
|
x1=map_xoff;
|
|
@@ -544,6 +544,7 @@
|
|
{
|
|
spec_directory sd(fp);
|
|
|
|
+#if 0
|
|
spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved");
|
|
if (!e)
|
|
{
|
|
@@ -552,6 +553,7 @@
|
|
the_game->need_refresh();
|
|
}
|
|
else
|
|
+#endif
|
|
current_level=new level(&sd,fp,name);
|
|
delete fp;
|
|
}
|
|
@@ -683,11 +685,11 @@
|
|
}
|
|
}
|
|
|
|
-void remap_area(image *screen, int x1, int y1, int x2, int y2, uchar *remap)
|
|
+void remap_area(image *screen, int x1, int y1, int x2, int y2, uint8_t *remap)
|
|
{
|
|
- uchar *sl=(uchar *)screen->scan_line(y1)+x1;
|
|
+ uint8_t *sl=(uint8_t *)screen->scan_line(y1)+x1;
|
|
int x,y,a=screen->width()-(x2-x1+1);
|
|
- uchar c;
|
|
+ uint8_t c;
|
|
for (y=y1;y<=y2;y++)
|
|
{
|
|
for (x=x1;x<=x2;x++)
|
|
@@ -754,7 +756,7 @@
|
|
return ;
|
|
}
|
|
|
|
- long old_cx1=0,old_cy1=0,old_cx2=0,old_cy2=0; // if we do a small render, we need to restore these
|
|
+ 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
|
|
image *old_screen=NULL;
|
|
if (small_render && (dev&DRAW_LIGHTS)) // cannot do this if we skip lighting
|
|
{
|
|
@@ -775,10 +777,10 @@
|
|
|
|
|
|
|
|
-// long max_xoff=(current_level->foreground_width()-1)*ftile_width()-(v->cx2-v->cx1+1);
|
|
-// long max_yoff=(current_level->foreground_height()-1)*ftile_height()-(v->cy2-v->cy1+1);
|
|
+// int32_t max_xoff=(current_level->foreground_width()-1)*ftile_width()-(v->cx2-v->cx1+1);
|
|
+// int32_t max_yoff=(current_level->foreground_height()-1)*ftile_height()-(v->cy2-v->cy1+1);
|
|
|
|
- long xoff,yoff;
|
|
+ int32_t xoff,yoff;
|
|
if (interpolate)
|
|
{
|
|
xoff=v->interpolated_xoff();
|
|
@@ -800,8 +802,8 @@
|
|
nxoff=xoff*bg_xmul/bg_xdiv;
|
|
nyoff=yoff*bg_ymul/bg_ydiv;
|
|
|
|
-// long max_bg_xoff=(current_level->background_width())*btile_width()-(v->cx2-v->cx1+1);
|
|
-// long max_bg_yoff=(current_level->background_height())*btile_height()-(v->cy2-v->cy1+1);
|
|
+// int32_t max_bg_xoff=(current_level->background_width())*btile_width()-(v->cx2-v->cx1+1);
|
|
+// int32_t max_bg_yoff=(current_level->background_height())*btile_height()-(v->cy2-v->cy1+1);
|
|
// if (nxoff>max_bg_xoff) nxoff=max_xoff;
|
|
// if (nyoff>max_bg_yoff) nyoff=max_yoff;
|
|
|
|
@@ -823,7 +825,7 @@
|
|
yinc=btile_height();
|
|
|
|
int bh=current_level->background_height(),bw=current_level->background_width();
|
|
- ushort *bl;
|
|
+ uint16_t *bl;
|
|
for (draw_y=yo,y=y1;y<=y2;y++,draw_y+=yinc)
|
|
{
|
|
if (y>=bh)
|
|
@@ -850,7 +852,7 @@
|
|
// if (!(dev&EDIT_MODE))
|
|
// server_check();
|
|
|
|
- uchar rescan=0;
|
|
+ uint8_t rescan=0;
|
|
|
|
int fw,fh;
|
|
|
|
@@ -915,8 +917,8 @@
|
|
{
|
|
if (!(draw_y<ncy1 ||draw_y+yinc>=ncy2))
|
|
{
|
|
- ushort *cl=current_level->get_fgline(y)+x1;
|
|
- uchar *sl1=screen->scan_line(draw_y)+xo;
|
|
+ uint16_t *cl=current_level->get_fgline(y)+x1;
|
|
+ uint8_t *sl1=screen->scan_line(draw_y)+xo;
|
|
for (x=x1,draw_x=xo;x<=x2;x++,cl++,sl1+=xinc,draw_x+=xinc)
|
|
{
|
|
if (!(draw_x<ncx1 || draw_x+xinc>=ncx2))
|
|
@@ -926,8 +928,8 @@
|
|
fort_num=fgvalue(*cl);
|
|
// else fort_num=0;
|
|
|
|
- uchar *sl2=get_fg(fort_num)->micro_image->scan_line(0);
|
|
- uchar *sl3=sl1;
|
|
+ uint8_t *sl2=get_fg(fort_num)->micro_image->scan_line(0);
|
|
+ uint8_t *sl3=sl1;
|
|
memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
|
|
memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w;
|
|
memcpy(sl3,sl2,AUTOTILE_WIDTH);
|
|
@@ -946,11 +948,11 @@
|
|
for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
|
|
{
|
|
|
|
- ushort *cl;
|
|
+ uint16_t *cl;
|
|
if (y<fg_h)
|
|
cl=current_level->get_fgline(y)+x1;
|
|
else cl=NULL;
|
|
- uchar *sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo;
|
|
+ uint8_t *sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo;
|
|
|
|
for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++,sl1+=xinc)
|
|
{
|
|
@@ -983,7 +985,7 @@
|
|
// if (!(dev&EDIT_MODE))
|
|
// server_check();
|
|
|
|
- long ro=rand_on;
|
|
+ int32_t ro=rand_on;
|
|
if (dev & DRAW_PEOPLE_LAYER)
|
|
{
|
|
if (interpolate)
|
|
@@ -1004,7 +1006,7 @@
|
|
{
|
|
for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
|
|
{
|
|
- ushort *cl=current_level->get_fgline(y)+x1;
|
|
+ uint16_t *cl=current_level->get_fgline(y)+x1;
|
|
for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++)
|
|
{
|
|
if (above_tile(*cl))
|
|
@@ -1038,7 +1040,7 @@
|
|
|
|
for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc)
|
|
{
|
|
- ushort *cl;
|
|
+ uint16_t *cl;
|
|
if (y<fg_h)
|
|
cl=current_level->get_fgline(y)+x1;
|
|
else cl=NULL;
|
|
@@ -1050,7 +1052,7 @@
|
|
if (fort_num!=BLACK)
|
|
{
|
|
point_list *p=get_fg(fort_num)->points;
|
|
- uchar *d=p->data;
|
|
+ uint8_t *d=p->data;
|
|
if (p->tot)
|
|
{
|
|
for (int i=1;i<p->tot;i++)
|
|
@@ -1199,8 +1201,8 @@
|
|
|
|
for (i=0;i<steps;i++)
|
|
{
|
|
- uchar *sl1=(uchar *)pal->addr();
|
|
- uchar *sl2=(uchar *)old_pal->addr();
|
|
+ uint8_t *sl1=(uint8_t *)pal->addr();
|
|
+ uint8_t *sl2=(uint8_t *)old_pal->addr();
|
|
int j;
|
|
int v=(i+1)*256/steps;
|
|
for (j=0;j<256;j++)
|
|
@@ -1223,8 +1225,8 @@
|
|
int i;
|
|
for (i=0;i<steps;i++)
|
|
{
|
|
- uchar *sl1=(uchar *)pal->addr();
|
|
- uchar *sl2=(uchar *)old_pal->addr();
|
|
+ uint8_t *sl1=(uint8_t *)pal->addr();
|
|
+ uint8_t *sl2=(uint8_t *)old_pal->addr();
|
|
int j;
|
|
int v=(steps-i)*256/steps;
|
|
for (j=0;j<256;j++)
|
|
@@ -1245,7 +1247,7 @@
|
|
pal->load();
|
|
}
|
|
|
|
-int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color);
|
|
+int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
|
|
|
|
void do_title()
|
|
{
|
|
@@ -1308,7 +1310,7 @@
|
|
smoke[0]->put_image( screen, dx + 24, dy + 5 );
|
|
|
|
fade_in( NULL, 16 );
|
|
- uchar cmap[32];
|
|
+ uint8_t cmap[32];
|
|
for( i = 0; i < 32; i++ )
|
|
cmap[i] = pal->find_closest( i * 256 / 32, i * 256 / 32, i * 256 / 32 );
|
|
|
|
@@ -1419,8 +1421,8 @@
|
|
|
|
// ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof
|
|
char *fastpath;
|
|
- fastpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 13, "fastpath" );
|
|
- sprintf( fastpath, "%sfastload.dat\0", get_save_filename_prefix() );
|
|
+ fastpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12 + 1, "fastpath" );
|
|
+ sprintf( fastpath, "%sfastload.dat", get_save_filename_prefix() );
|
|
fast_load_start_recording( fastpath );
|
|
load_data(argc,argv);
|
|
fast_load_stop_recording();
|
|
@@ -1664,7 +1666,7 @@
|
|
if (avg_fps>15 && ((dev&EDIT_MODE)==0 || need_delay))
|
|
{
|
|
frame_panic = 0;
|
|
- long stime=(long)((1/15.0-1.0/possible_fps)*1000.0);
|
|
+ int32_t stime=(int32_t)((1/15.0-1.0/possible_fps)*1000.0);
|
|
if (stime>0 && !no_delay)
|
|
{
|
|
milli_wait(stime);
|
|
@@ -1730,17 +1732,17 @@
|
|
if(ev.key < 256 )
|
|
{
|
|
if( chat && chat->chat_event( ev ) )
|
|
- base->packet.write_byte( SCMD_CHAT_KEYPRESS );
|
|
+ base->packet.write_uint8( SCMD_CHAT_KEYPRESS );
|
|
else
|
|
- base->packet.write_byte( SCMD_KEYPRESS );
|
|
+ base->packet.write_uint8( SCMD_KEYPRESS );
|
|
}
|
|
else
|
|
- base->packet.write_byte( SCMD_EXT_KEYPRESS );
|
|
- base->packet.write_byte( client_number() );
|
|
+ base->packet.write_uint8( SCMD_EXT_KEYPRESS );
|
|
+ base->packet.write_uint8( client_number() );
|
|
if( ev.key > 256 )
|
|
- base->packet.write_byte( ev.key - 256 );
|
|
+ base->packet.write_uint8( ev.key - 256 );
|
|
else
|
|
- base->packet.write_byte( ev.key );
|
|
+ base->packet.write_uint8( ev.key );
|
|
}
|
|
}
|
|
else if(ev.type == EV_KEYRELEASE )
|
|
@@ -1749,14 +1751,14 @@
|
|
if( playing_state( state ) )
|
|
{
|
|
if( ev.key < 256 )
|
|
- base->packet.write_byte( SCMD_KEYRELEASE );
|
|
+ base->packet.write_uint8( SCMD_KEYRELEASE );
|
|
else
|
|
- base->packet.write_byte( SCMD_EXT_KEYRELEASE );
|
|
- base->packet.write_byte( client_number() );
|
|
+ base->packet.write_uint8( SCMD_EXT_KEYRELEASE );
|
|
+ base->packet.write_uint8( client_number() );
|
|
if( ev.key > 255 )
|
|
- base->packet.write_byte( ev.key - 256 );
|
|
+ base->packet.write_uint8( ev.key - 256 );
|
|
else
|
|
- base->packet.write_byte( ev.key );
|
|
+ base->packet.write_uint8( ev.key );
|
|
}
|
|
}
|
|
|
|
@@ -2029,11 +2031,11 @@
|
|
p->get_input();
|
|
|
|
|
|
- base->packet.write_byte(SCMD_SYNC);
|
|
- base->packet.write_short(make_sync());
|
|
+ base->packet.write_uint8(SCMD_SYNC);
|
|
+ base->packet.write_uint16(make_sync());
|
|
|
|
if (base->join_list)
|
|
- base->packet.write_byte(SCMD_RELOAD);
|
|
+ base->packet.write_uint8(SCMD_RELOAD);
|
|
|
|
// printf("save tick %d, pk size=%d, rand_on=%d, sync=%d\n",current_level->tick_counter(),
|
|
// base->packet.packet_size(),rand_on,make_sync());
|
|
@@ -2046,7 +2048,7 @@
|
|
{
|
|
if (!(dev&EDIT_MODE) && current_level)
|
|
{
|
|
- uchar buf[PACKET_MAX_SIZE+1];
|
|
+ uint8_t buf[PACKET_MAX_SIZE+1];
|
|
int size;
|
|
|
|
if (demo_man.state==demo_manager::PLAYING)
|
|
@@ -2572,7 +2574,7 @@
|
|
|
|
fprintf(stderr,"Mac Options: ");
|
|
xres = 320; yres = 200;
|
|
- GetKeys((unsigned long*)&km);
|
|
+ GetKeys((uint32_t*)&km);
|
|
if ((km[ 0x3a >>3] >> (0x3a & 7)) &1 != 0)
|
|
{
|
|
dev|=EDIT_MODE;
|
|
Index: abuse-sdl-0.7.0/src/loadgame.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/loadgame.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/loadgame.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -191,8 +191,9 @@
|
|
if (total_saved>MAX_SAVE_GAMES)
|
|
total_saved=MAX_SAVE_GAMES;
|
|
|
|
- int i,ih=cash.img(save_buts[0])->height();
|
|
-/* ico_button *buts[MAX_SAVE_GAMES];
|
|
+ int i;
|
|
+/* int ih=cash.img(save_buts[0])->height();
|
|
+ ico_button *buts[MAX_SAVE_GAMES];
|
|
int y=WINDOW_FRAME_TOP;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/specache.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/specache.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/specache.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -4,7 +4,7 @@
|
|
|
|
void spec_directory_cache::load(bFILE *fp)
|
|
{
|
|
- short tfn=fp->read_short();
|
|
+ short tfn=fp->read_uint16();
|
|
int i;
|
|
unsigned char len;
|
|
char fn[256];
|
|
@@ -23,7 +23,7 @@
|
|
filename_node *f=fn_list;
|
|
for (;f;f=f->next)
|
|
total++;
|
|
- fp->write_short(total);
|
|
+ fp->write_uint16(total);
|
|
for (f=fn_list;f;f=f->next)
|
|
{
|
|
unsigned char len=strlen(f->filename())+1;
|
|
Index: abuse-sdl-0.7.0/src/lisp_gc.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/lisp_gc.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/lisp_gc.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -74,11 +74,11 @@
|
|
return a;
|
|
}
|
|
|
|
-static uchar *cstart,*cend,*collected_start,*collected_end;
|
|
+static uint8_t *cstart,*cend,*collected_start,*collected_end;
|
|
|
|
inline void *collect_cons_cell(void *x)
|
|
{
|
|
- cons_cell *last=NULL,*first;
|
|
+ cons_cell *last=NULL,*first=NULL;
|
|
if (!x) return x;
|
|
for (;x && item_type(x)==L_CONS_CELL;)
|
|
{
|
|
@@ -106,7 +106,7 @@
|
|
{
|
|
void *ret=x;
|
|
|
|
- if (((uchar *)x)>=cstart && ((uchar *)x)<cend)
|
|
+ if (((uint8_t *)x)>=cstart && ((uint8_t *)x)<cend)
|
|
{
|
|
switch (item_type(x))
|
|
{
|
|
@@ -187,7 +187,7 @@
|
|
}
|
|
((lisp_collected_object *)x)->type=L_COLLECTED_OBJECT;
|
|
((lisp_collected_object *)x)->new_reference=ret;
|
|
- } else if ((uchar *)x<collected_start || (uchar *)x>=collected_end)
|
|
+ } else if ((uint8_t *)x<collected_start || (uint8_t *)x>=collected_end)
|
|
{
|
|
if (item_type(x)==L_CONS_CELL) // still need to remap cons_cells outside of space
|
|
{
|
|
@@ -240,17 +240,19 @@
|
|
|
|
void collect_space(int which_space) // should be tmp or permenant
|
|
{
|
|
+ return; /* XXX */
|
|
+
|
|
int old_space=current_space;
|
|
- cstart=(uchar *)space[which_space];
|
|
- cend=(uchar *)free_space[which_space];
|
|
+ cstart=(uint8_t *)space[which_space];
|
|
+ cend=(uint8_t *)free_space[which_space];
|
|
|
|
space_size[GC_SPACE]=space_size[which_space];
|
|
void *new_space=jmalloc(space_size[GC_SPACE],"collect lisp space");
|
|
current_space=GC_SPACE;
|
|
free_space[GC_SPACE]=space[GC_SPACE]=(char *)new_space;
|
|
|
|
- collected_start=(uchar *)new_space;
|
|
- collected_end=(((uchar *)new_space)+space_size[GC_SPACE]);
|
|
+ collected_start=(uint8_t *)new_space;
|
|
+ collected_end=(((uint8_t *)new_space)+space_size[GC_SPACE]);
|
|
|
|
collect_symbols(lsym_root);
|
|
collect_stacks();
|
|
@@ -260,7 +262,7 @@
|
|
|
|
space[which_space]=(char *)new_space;
|
|
free_space[which_space]=((char *)new_space)+
|
|
- (((uchar *)free_space[GC_SPACE])-((uchar *)space[GC_SPACE]));
|
|
+ (((uint8_t *)free_space[GC_SPACE])-((uint8_t *)space[GC_SPACE]));
|
|
current_space=old_space;
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/extend.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/extend.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/extend.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -3,29 +3,29 @@
|
|
|
|
|
|
Simple object (power ups, non-moving objects)
|
|
- long x,y;
|
|
- schar direction;
|
|
- ushort otype,state
|
|
- ushort current_frame;
|
|
+ int32_t x,y;
|
|
+ int8_t direction;
|
|
+ uint16_t otype,state
|
|
+ uint16_t current_frame;
|
|
extension *
|
|
|
|
|
|
Moving object (simple lisp controlled characters)
|
|
- uchar flags;
|
|
- long xvel,yvel,xacel,yacel;
|
|
- uchar fx,fy,fxvel,fyvel,fxacel,fyacel,aitype;
|
|
- ushort aistate,aistate_time;
|
|
- unsigned short hp,mp,
|
|
+ uint8_t flags;
|
|
+ int32_t xvel,yvel,xacel,yacel;
|
|
+ uint8_t fx,fy,fxvel,fyvel,fxacel,fyacel,aitype;
|
|
+ uint16_t aistate,aistate_time;
|
|
+ uint16_t hp,mp,
|
|
extension *
|
|
|
|
|
|
Complex objects (can controll lights, other characters, and have a neural net ai)
|
|
- uchar tobjs,tlights;
|
|
+ uint8_t tobjs,tlights;
|
|
object_list *
|
|
light_list *
|
|
nnet_info *
|
|
- schar fade_dir, frame_dir;
|
|
- unsigned char fade_count,fade_max;
|
|
+ int8_t fade_dir, frame_dir;
|
|
+ uint8_t fade_count,fade_max;
|
|
morph_char *morph_status;
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/old_earth_menu.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/old_earth_menu.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/old_earth_menu.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -34,13 +34,13 @@
|
|
|
|
for (y=y1;y<=y2;y++)
|
|
{
|
|
- unsigned char *sl=screen->scan_line(y)+x1;
|
|
+ uint8_t *sl=screen->scan_line(y)+x1;
|
|
for (x=x1;x<=x2;x++,sl++)
|
|
{
|
|
- unsigned char *paddr=(unsigned char *)pal->addr()+(*sl)*3;
|
|
- unsigned char r=((*(paddr++))-r_to)*percent/256+r_to;
|
|
- unsigned char g=((*(paddr++))-g_to)*percent/256+g_to;
|
|
- unsigned char b=((*(paddr++))-b_to)*percent/256+b_to;
|
|
+ uint8_t *paddr=(uint8_t *)pal->addr()+(*sl)*3;
|
|
+ uint8_t r=((*(paddr++))-r_to)*percent/256+r_to;
|
|
+ uint8_t g=((*(paddr++))-g_to)*percent/256+g_to;
|
|
+ uint8_t b=((*(paddr++))-b_to)*percent/256+b_to;
|
|
*sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
|
|
}
|
|
}
|
|
@@ -60,13 +60,13 @@
|
|
|
|
for (y=y1;y<=y2;y++)
|
|
{
|
|
- unsigned char *sl=screen->scan_line(y)+x1;
|
|
+ uint8_t *sl=screen->scan_line(y)+x1;
|
|
for (x=x1;x<=x2;x++,sl++)
|
|
{
|
|
- unsigned char *paddr=(unsigned char *)pal->addr()+(*sl)*3;
|
|
- unsigned char r=(*(paddr++))*amount/256;
|
|
- unsigned char g=(*(paddr++))*amount/256;
|
|
- unsigned char b=(*(paddr++))*amount/256;
|
|
+ uint8_t *paddr=(uint8_t *)pal->addr()+(*sl)*3;
|
|
+ uint8_t r=(*(paddr++))*amount/256;
|
|
+ uint8_t g=(*(paddr++))*amount/256;
|
|
+ uint8_t b=(*(paddr++))*amount/256;
|
|
*sl=color_table->lookup_color((r)>>3,(g)>>3,(b)>>3);
|
|
}
|
|
}
|
|
@@ -250,7 +250,7 @@
|
|
struct mask_line
|
|
{
|
|
int x,size;
|
|
- ushort *remap;
|
|
+ uint16_t *remap;
|
|
} ;
|
|
|
|
|
|
@@ -260,15 +260,15 @@
|
|
{
|
|
int x1=10000,x2=0;
|
|
int iw=im->width();
|
|
- ushort r,co,off,cc;
|
|
+ uint16_t r,co,off,cc;
|
|
int y=0;
|
|
for (;y<mask_height;y++)
|
|
{
|
|
mask_line *n=p+y;
|
|
- uchar *sl=screen->scan_line(y+sy)+sx+n->x;
|
|
- uchar *sl2=im->scan_line(y);
|
|
-// uchar *sl3=clouds->scan_line(y);
|
|
- ushort *rem=n->remap;
|
|
+ uint8_t *sl=screen->scan_line(y+sy)+sx+n->x;
|
|
+ uint8_t *sl2=im->scan_line(y);
|
|
+// uint8_t *sl3=clouds->scan_line(y);
|
|
+ uint16_t *rem=n->remap;
|
|
if (sx+n->x<x1) x1=sx+n->x;
|
|
int x=0;
|
|
for (;x<n->size;x++,sl++,rem++)
|
|
@@ -300,7 +300,7 @@
|
|
for (int y=0;y<mask->height();y++)
|
|
{
|
|
// find the start of the run..
|
|
- uchar *sl=mask->scan_line(y);
|
|
+ uint8_t *sl=mask->scan_line(y);
|
|
int x=0;
|
|
while (*sl==0) { sl++; x++; }
|
|
p[y].x=x;
|
|
@@ -312,8 +312,8 @@
|
|
p[y].size=size;
|
|
|
|
// now calculate remap for line
|
|
- p[y].remap=(ushort *)jmalloc(size*2,"mask remap");
|
|
- ushort *rem=p[y].remap;
|
|
+ p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap");
|
|
+ uint16_t *rem=p[y].remap;
|
|
for (x=0;x<size;x++,rem++)
|
|
{
|
|
if (x<=size/2)
|
|
@@ -507,7 +507,7 @@
|
|
char name[20];
|
|
ico_button *buts[MENU_TICONS];
|
|
|
|
- long maxx=0,maxy=0;
|
|
+ int32_t maxx=0,maxy=0;
|
|
int i=0;
|
|
for (;i<MENU_TICONS;i++)
|
|
{
|
|
@@ -518,8 +518,8 @@
|
|
sprintf(name,"icon%04d.pcx",i*3+2);
|
|
menu_icons[i*3+2]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
|
|
|
|
- long x=WINDOW_FRAME_LEFT+(i%9)*cash.img(menu_icons[0])->width();
|
|
- long y=WINDOW_FRAME_TOP+(i/9)*cash.img(menu_icons[0])->height();
|
|
+ int32_t x=WINDOW_FRAME_LEFT+(i%9)*cash.img(menu_icons[0])->width();
|
|
+ int32_t y=WINDOW_FRAME_TOP+(i/9)*cash.img(menu_icons[0])->height();
|
|
if (x>maxx) maxx=x;
|
|
if (y>maxy) maxy=y;
|
|
buts[i]=new ico_button(x,y,menu_icons_ids[i],
|
|
@@ -586,7 +586,7 @@
|
|
int eoff=0,coff=0;
|
|
event ev;
|
|
// main_pm->draw(screen,eh,1);
|
|
- long x=84,y=60;
|
|
+ int32_t x=84,y=60;
|
|
Cell *v=find_symbol("earth_x");
|
|
if (v && DEFINEDP(v)) x=lnumber_value(symbol_value(v));
|
|
|
|
Index: abuse-sdl-0.7.0/src/profile.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/profile.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/profile.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -11,7 +11,7 @@
|
|
|
|
struct prof_info
|
|
{
|
|
- ushort otype;
|
|
+ uint16_t otype;
|
|
float total_time;
|
|
};
|
|
|
|
Index: abuse-sdl-0.7.0/src/go.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/go.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/go.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -59,7 +59,7 @@
|
|
elcontrol::elcontrol(FILE *fp, unsigned char *state_remap)
|
|
{
|
|
load(fp,state_remap);
|
|
- allow_dir=read_short(fp);
|
|
+ allow_dir=read_uint16(fp);
|
|
}
|
|
|
|
|
|
@@ -117,15 +117,15 @@
|
|
elevator::elevator(FILE *fp, unsigned char *state_remap)
|
|
{
|
|
load(fp,state_remap);
|
|
- dir=read_short(fp);
|
|
- speed=read_short(fp);
|
|
+ dir=read_uint16(fp);
|
|
+ speed=read_uint16(fp);
|
|
}
|
|
|
|
void elevator::save(FILE *fp)
|
|
{
|
|
game_object::save(fp);
|
|
- write_short(fp,dir);
|
|
- write_short(fp,speed);
|
|
+ write_uint16(fp,dir);
|
|
+ write_uint16(fp,speed);
|
|
}
|
|
|
|
|
|
@@ -267,23 +267,23 @@
|
|
|
|
void sensor::save(FILE *fp)
|
|
{ game_object::save(fp);
|
|
- write_short(fp,xrange);
|
|
- write_short(fp,yrange);
|
|
- write_short(fp,signal);
|
|
+ write_uint16(fp,xrange);
|
|
+ write_uint16(fp,yrange);
|
|
+ write_uint16(fp,signal);
|
|
|
|
- write_byte(fp,strlen(aname())+1);
|
|
+ write_uint8(fp,strlen(aname())+1);
|
|
fwrite(aname(),strlen(aname())+1,1,fp);
|
|
}
|
|
|
|
sensor::sensor(FILE *fp, unsigned char *state_remap)
|
|
{
|
|
load(fp,state_remap);
|
|
- xrange=read_short(fp);
|
|
- yrange=read_short(fp);
|
|
- signal=read_short(fp);
|
|
+ xrange=read_uint16(fp);
|
|
+ yrange=read_uint16(fp);
|
|
+ signal=read_uint16(fp);
|
|
|
|
char name[200];
|
|
- fread(name,read_byte(fp),1,fp);
|
|
+ fread(name,read_uint8(fp),1,fp);
|
|
get_activate(name);
|
|
}
|
|
|
|
Index: abuse-sdl-0.7.0/src/netcfg.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/netcfg.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/netcfg.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -58,6 +58,8 @@
|
|
case RESTART_CLIENT :
|
|
case RESTART_SINGLE :
|
|
return 1;
|
|
+ default:
|
|
+ break;
|
|
}
|
|
return 0;
|
|
}
|
|
@@ -69,6 +71,7 @@
|
|
case RESTART_SERVER : { state=SERVER; } break;
|
|
case RESTART_CLIENT : { state=CLIENT; } break;
|
|
case RESTART_SINGLE : { state=SINGLE_PLAYER; } break;
|
|
+ default: break;
|
|
}
|
|
|
|
|
|
@@ -249,9 +252,9 @@
|
|
ns->put_image(screen,x,y);
|
|
JCFont *fnt=eh->font();
|
|
|
|
- uchar *remap=white_light+30*256;
|
|
+ uint8_t *remap=white_light+30*256;
|
|
|
|
- uchar *sl=screen->scan_line(0);
|
|
+ uint8_t *sl=screen->scan_line(0);
|
|
int xx=screen->width()*screen->height();
|
|
for (;xx;xx--,sl++) *sl=remap[*sl];
|
|
|
|
Index: abuse-sdl-0.7.0/src/light.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/light.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/light.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -12,14 +12,14 @@
|
|
#include "dev.hpp"
|
|
|
|
light_source *first_light_source=NULL;
|
|
-unsigned char *white_light,*white_light_initial,*green_light,*trans_table;
|
|
+uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
|
|
short ambient_ramp=0;
|
|
short shutdown_lighting_value,shutdown_lighting=0;
|
|
extern char disable_autolight; // defined in dev.hpp
|
|
|
|
int light_detail=MEDIUM_DETAIL;
|
|
|
|
-long light_to_number(light_source *l)
|
|
+int32_t light_to_number(light_source *l)
|
|
{
|
|
|
|
if (!l) return 0;
|
|
@@ -30,7 +30,7 @@
|
|
}
|
|
|
|
|
|
-light_source *number_to_light(long x)
|
|
+light_source *number_to_light(int32_t x)
|
|
{
|
|
if (x==0) return NULL;
|
|
x--;
|
|
@@ -134,8 +134,8 @@
|
|
mul_div=(1<<16)/(outer_radius-inner_radius)*64;
|
|
}
|
|
|
|
-light_source::light_source(char Type, long X, long Y, long Inner_radius,
|
|
- long Outer_radius, long Xshift, long Yshift, light_source *Next)
|
|
+light_source::light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius,
|
|
+ int32_t Outer_radius, int32_t Xshift, int32_t Yshift, light_source *Next)
|
|
{
|
|
type=Type;
|
|
x=X; y=Y;
|
|
@@ -157,8 +157,8 @@
|
|
return t;
|
|
}
|
|
|
|
-light_source *add_light_source(char type, long x, long y,
|
|
- long inner, long outer, long xshift, long yshift)
|
|
+light_source *add_light_source(char type, int32_t x, int32_t y,
|
|
+ int32_t inner, int32_t outer, int32_t xshift, int32_t yshift)
|
|
{
|
|
first_light_source=new light_source(type,x,y,inner,outer,xshift,yshift,first_light_source);
|
|
return first_light_source;
|
|
@@ -166,10 +166,10 @@
|
|
|
|
|
|
#define TTINTS 9
|
|
-uchar *tints[TTINTS];
|
|
-uchar bright_tint[256];
|
|
+uint8_t *tints[TTINTS];
|
|
+uint8_t bright_tint[256];
|
|
|
|
-void calc_tint(uchar *tint, int rs, int gs, int bs, int ra, int ga, int ba, palette *pal)
|
|
+void calc_tint(uint8_t *tint, int rs, int gs, int bs, int ra, int ga, int ba, palette *pal)
|
|
{
|
|
palette npal;
|
|
memset(npal.addr(),0,256);
|
|
@@ -191,19 +191,19 @@
|
|
|
|
void calc_light_table(palette *pal)
|
|
{
|
|
- white_light_initial=(unsigned char *)jmalloc(256*64,"light table");
|
|
+ white_light_initial=(uint8_t *)jmalloc(256*64,"light table");
|
|
white_light=white_light_initial;
|
|
|
|
-// green_light=(unsigned char *)jmalloc(256*64,"green light");
|
|
+// green_light=(uint8_t *)jmalloc(256*64,"green light");
|
|
int i = 0;
|
|
for( ; i < TTINTS; i++ )
|
|
{
|
|
- tints[i] = (uchar *)jmalloc( 256, "color tint" );
|
|
+ tints[i] = (uint8_t *)jmalloc( 256, "color tint" );
|
|
}
|
|
|
|
char *lightpath;
|
|
- lightpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "lightpath" );
|
|
- sprintf( lightpath, "%slight.tbl\0", get_save_filename_prefix() );
|
|
+ lightpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "lightpath" );
|
|
+ sprintf( lightpath, "%slight.tbl", get_save_filename_prefix() );
|
|
|
|
bFILE *fp=open_file( lightpath, "rb" );
|
|
int recalc = 0;
|
|
@@ -214,7 +214,7 @@
|
|
}
|
|
else
|
|
{
|
|
- if (fp->read_short()!=calc_crc((unsigned char *)pal->addr(),768))
|
|
+ if (fp->read_uint16()!=calc_crc((uint8_t *)pal->addr(),768))
|
|
recalc=1;
|
|
else
|
|
{
|
|
@@ -223,7 +223,7 @@
|
|
for (i=0;i<TTINTS;i++)
|
|
fp->read(tints[i],256);
|
|
fp->read(bright_tint,256);
|
|
-// trans_table=(uchar *)jmalloc(256*256,"transparency table");
|
|
+// trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
|
|
// fp.read(trans_table,256*256);
|
|
}
|
|
delete fp;
|
|
@@ -236,7 +236,7 @@
|
|
int color=0;
|
|
for (;color<256;color++)
|
|
{
|
|
- unsigned char r,g,b;
|
|
+ uint8_t r,g,b;
|
|
pal->get(color,r,g,b);
|
|
stat_man->update(color*100/256);
|
|
for (int intensity=63;intensity>=0;intensity--)
|
|
@@ -254,7 +254,7 @@
|
|
for (color=0;color<256;color++)
|
|
{
|
|
stat_man->update(color*100/256);
|
|
- unsigned char r,g,b;
|
|
+ uint8_t r,g,b;
|
|
pal->get(color,b,r,g);
|
|
r=r*3/5; b=b*3/5; g+=7; if (g>255) g=255;
|
|
|
|
@@ -273,7 +273,7 @@
|
|
stat_man->pop(); */
|
|
|
|
stat_man->push("tints",NULL);
|
|
- uchar t[TTINTS*6]={0,0,0,0,0,0, // normal
|
|
+ uint8_t t[TTINTS*6]={0,0,0,0,0,0, // normal
|
|
0,0,0,1,0,0, // red
|
|
0,0,0,1,1,0, // yellow
|
|
0,0,0,1,0,1, // purple
|
|
@@ -289,8 +289,8 @@
|
|
|
|
0,0,0,0,0,0 // reverse green (night vision effect)
|
|
} ;
|
|
- uchar *ti=t+6;
|
|
- uchar *c;
|
|
+ uint8_t *ti=t+6;
|
|
+ uint8_t *c;
|
|
for (i=0,c=tints[0];i<256;i++,c++) *c=i; // make the normal tint (maps everthing to itself)
|
|
for (i=0,c=tints[TTINTS-1];i<256;i++,c++) // reverse green
|
|
{
|
|
@@ -316,12 +316,12 @@
|
|
}
|
|
stat_man->pop();
|
|
/* fprintf(stderr,"calculating transparency tables (256 total)\n");
|
|
- trans_table=(uchar *)jmalloc(256*256,"transparency table");
|
|
+ trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
|
|
|
|
- uchar *tp=trans_table;
|
|
+ uint8_t *tp=trans_table;
|
|
for (i=0;i<256;i++)
|
|
{
|
|
- uchar r1,g1,b1,r2,g2,b2;
|
|
+ uint8_t r1,g1,b1,r2,g2,b2;
|
|
pal->get(i,r1,g1,b1);
|
|
if ((i%16)==0)
|
|
fprintf(stderr,"%d ",i);
|
|
@@ -343,7 +343,7 @@
|
|
dprintf( "Unable to open file light.tbl for writing\n" );
|
|
else
|
|
{
|
|
- f->write_short(calc_crc((unsigned char *)pal->addr(),768));
|
|
+ f->write_uint16(calc_crc((uint8_t *)pal->addr(),768));
|
|
f->write(white_light,256*64);
|
|
// f->write(green_light,256*64);
|
|
for (int i=0;i<TTINTS;i++)
|
|
@@ -391,7 +391,7 @@
|
|
}
|
|
}
|
|
|
|
-void add_light(light_patch *&first, long x1, long y1, long x2, long y2,
|
|
+void add_light(light_patch *&first, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
|
light_source *who)
|
|
{
|
|
light_patch *next;
|
|
@@ -522,7 +522,7 @@
|
|
}
|
|
|
|
/* shit
|
|
-int calc_light_value(light_patch *which, long x, long y)
|
|
+int calc_light_value(light_patch *which, int32_t x, int32_t y)
|
|
{
|
|
int lv=0;
|
|
int t=which->total;
|
|
@@ -536,9 +536,9 @@
|
|
}
|
|
else
|
|
{
|
|
- long dx=abs(fn->x-x)<<fn->xshift;
|
|
- long dy=abs(fn->y-y)<<fn->yshift;
|
|
- long r2;
|
|
+ int32_t dx=abs(fn->x-x)<<fn->xshift;
|
|
+ int32_t dy=abs(fn->y-y)<<fn->yshift;
|
|
+ int32_t r2;
|
|
if (dx<dy)
|
|
r2=dx+dy-(dx>>1);
|
|
else r2=dx+dy-(dy>>1);
|
|
@@ -563,13 +563,13 @@
|
|
|
|
}
|
|
|
|
-light_patch *make_patch_list(int width, int height, long screenx, long screeny)
|
|
+light_patch *make_patch_list(int width, int height, int32_t screenx, int32_t screeny)
|
|
{
|
|
light_patch *first=new light_patch(0,0,width-1,height-1,NULL);
|
|
|
|
for (light_source *f=first_light_source;f;f=f->next) // determine which lights will have effect
|
|
{
|
|
- long x1=f->x1-screenx,y1=f->y1-screeny,
|
|
+ int32_t x1=f->x1-screenx,y1=f->y1-screeny,
|
|
x2=f->x2-screenx,y2=f->y2-screeny;
|
|
if (x1<0) x1=0;
|
|
if (y1<0) y1=0;
|
|
@@ -598,56 +598,59 @@
|
|
/*
|
|
#ifdef __WATCOMC__
|
|
extern "C" {
|
|
-extern long MAP_PUT(long pad, long screen_addr, long remap, long w);
|
|
+extern int32_t MAP_PUT(int32_t pad, int32_t screen_addr, int32_t remap, int32_t w);
|
|
} ;
|
|
#else*/
|
|
|
|
-inline void MAP_PUT(long screen_addr, long remap, long w)
|
|
+inline void MAP_PUT(uint8_t * screen_addr, uint8_t * remap, int w)
|
|
{
|
|
register int cx=w;
|
|
- register int di=screen_addr;
|
|
- register int si=remap;
|
|
+ register uint8_t * di=screen_addr;
|
|
+ register uint8_t * si=remap;
|
|
while (cx--)
|
|
- *((uchar *)(di++))=*((uchar *)si+*((uchar *)di));
|
|
+ {
|
|
+ uint8_t x=*((uint8_t *)si+*((uint8_t *)di));
|
|
+ *((uint8_t *)(di++))=x;
|
|
+ }
|
|
}
|
|
|
|
-inline void MAP_2PUT(long in_addr, long out_addr, long remap, long w)
|
|
+inline void MAP_2PUT(uint8_t * in_addr, uint8_t * out_addr, uint8_t * remap, int w)
|
|
{
|
|
while (w--)
|
|
{
|
|
- uchar x=*(((uchar *)remap)+(*(uchar *)(in_addr++)));
|
|
- *((uchar *)(out_addr++))=x;
|
|
- *((uchar *)(out_addr++))=x;
|
|
+ uint8_t x=*(((uint8_t *)remap)+(*(uint8_t *)(in_addr++)));
|
|
+ *((uint8_t *)(out_addr++))=x;
|
|
+ *((uint8_t *)(out_addr++))=x;
|
|
}
|
|
}
|
|
|
|
/*
|
|
#endif
|
|
|
|
-inline void PUT8(long *addr, uchar *remap)
|
|
+inline void PUT8(int32_t *addr, uint8_t *remap)
|
|
{
|
|
- register ulong in_pixels;
|
|
- register ulong pixel;
|
|
- register ulong out_pixels;
|
|
+ register uint32_t in_pixels;
|
|
+ register uint32_t pixel;
|
|
+ register uint32_t out_pixels;
|
|
in_pixels=*addr;
|
|
pixel=in_pixels;
|
|
- out_pixels=remap[(uchar)pixel];
|
|
+ out_pixels=remap[(uint8_t)pixel];
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=8;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=8;
|
|
out_pixels|=pixel;
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=16;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=16;
|
|
out_pixels|=pixel;
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=24;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=24;
|
|
out_pixels|=pixel;
|
|
|
|
@@ -662,29 +665,29 @@
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=8;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=8;
|
|
out_pixels|=pixel;
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=16;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=16;
|
|
out_pixels|=pixel;
|
|
|
|
pixel=in_pixels;
|
|
pixel>>=24;
|
|
- pixel=remap[(uchar)pixel];
|
|
+ pixel=remap[(uint8_t)pixel];
|
|
pixel<<=24;
|
|
out_pixels|=pixel;
|
|
addr[1]=out_pixels; // send out bus
|
|
|
|
}
|
|
|
|
-inline long MAP_PUT2(long dest_addr, long screen_addr, long remap, long w)
|
|
+inline int32_t MAP_PUT2(int32_t dest_addr, int32_t screen_addr, int32_t remap, int32_t w)
|
|
{ while (w--)
|
|
{
|
|
- *((uchar *)(dest_addr))=*((uchar *)remap+*((uchar *)screen_addr));
|
|
+ *((uint8_t *)(dest_addr))=*((uint8_t *)remap+*((uint8_t *)screen_addr));
|
|
screen_addr++;
|
|
dest_addr++;
|
|
}
|
|
@@ -693,11 +696,11 @@
|
|
|
|
*/
|
|
|
|
-ushort min_light_level;
|
|
+uint16_t min_light_level;
|
|
// calculate the light value for this block. sum up all contritors
|
|
inline int calc_light_value(light_patch *lp, // light patch to look at
|
|
- long sx, // screen x & y
|
|
- long sy)
|
|
+ int32_t sx, // screen x & y
|
|
+ int32_t sy)
|
|
{
|
|
int lv=min_light_level,r2,light_count;
|
|
register int dx,dy; // x and y distances
|
|
@@ -707,10 +710,10 @@
|
|
for (light_count=lp->total;light_count>0;light_count--)
|
|
{
|
|
light_source *fn=*lon_p;
|
|
- register long *dt=&(*lon_p)->type;
|
|
+ register int32_t *dt=&(*lon_p)->type;
|
|
// note we are accessing structure members by bypassing the compiler
|
|
// for speed, this may not work on all compilers, but don't
|
|
- // see why it shouldn't.. all members are long
|
|
+ // see why it shouldn't.. all members are int32_t
|
|
|
|
if (*dt==9) // (dt==type), if light is a Solid rectangle, return it value
|
|
return fn->inner_radius;
|
|
@@ -745,16 +748,16 @@
|
|
|
|
/*#ifdef __WATCOMC__
|
|
|
|
-extern "C" void remap_line_asm(uchar *screen_line,uchar *light_lookup,uchar *remap_line,int count);
|
|
+extern "C" void remap_line_asm(uint8_t *screen_line,uint8_t *light_lookup,uint8_t *remap_line,int count);
|
|
|
|
#else */
|
|
|
|
-void remap_line_asm2(uchar *addr,uchar *light_lookup,uchar *remap_line,int count)
|
|
-//inline void remap_line_asm2(uchar *addr,uchar *light_lookup,uchar *remap_line,int count)
|
|
+void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
|
|
+//inline void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
|
|
{
|
|
while (count--)
|
|
{
|
|
- uchar *off=light_lookup+(((long)*remap_line)<<8);
|
|
+ uint8_t *off=light_lookup+(((int32_t)*remap_line)<<8);
|
|
remap_line++;
|
|
|
|
*addr=off[*addr];
|
|
@@ -773,13 +776,13 @@
|
|
//#endif
|
|
|
|
|
|
-inline void put_8line(uchar *in_line, uchar *out_line, uchar *remap, uchar *light_lookup, int count)
|
|
+inline void put_8line(uint8_t *in_line, uint8_t *out_line, uint8_t *remap, uint8_t *light_lookup, int count)
|
|
{
|
|
- uchar v;
|
|
+ uint8_t v;
|
|
int x;
|
|
for (x=0;x<count;x++)
|
|
{
|
|
- uchar *off=light_lookup+(((long)*remap)<<8);
|
|
+ uint8_t *off=light_lookup+(((int32_t)*remap)<<8);
|
|
|
|
v=off[*(in_line++)];
|
|
*(out_line++)=v;
|
|
@@ -818,7 +821,7 @@
|
|
}
|
|
|
|
|
|
-void light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient)
|
|
+void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient)
|
|
{
|
|
int lx_run=0,ly_run; // light block x & y run size in pixels == (1<<lx_run)
|
|
|
|
@@ -858,19 +861,19 @@
|
|
|
|
int suffix=(cx2-cx1-prefix+1)&7;
|
|
|
|
- long remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
|
|
+ int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
|
|
|
|
- uchar *remap_line=(uchar *)jmalloc(remap_size,"light remap line");
|
|
+ uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
|
|
|
|
light_patch *f=first;
|
|
- uchar *screen_line=screen->scan_line(cy1)+cx1;
|
|
+ uint8_t *screen_line=screen->scan_line(cy1)+cx1;
|
|
|
|
for (int y=cy1;y<=cy2;)
|
|
{
|
|
int x,count;
|
|
// while (f->next && f->y2<y)
|
|
// f=f->next;
|
|
- uchar *rem=remap_line;
|
|
+ uint8_t *rem=remap_line;
|
|
|
|
int todoy=4-((screeny+y)&3);
|
|
if (y+todoy>cy2)
|
|
@@ -884,21 +887,21 @@
|
|
light_patch *lp=f;
|
|
for (;(lp->y1>y-cy1 || lp->y2<y-cy1 ||
|
|
lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
|
|
- long caddr=(long)screen_line+cx2-cx1+1-suffix;
|
|
- uchar *r=light_lookup+(((long)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
|
|
+ uint8_t * caddr=(uint8_t *)screen_line+cx2-cx1+1-suffix;
|
|
+ uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
|
|
switch (todoy)
|
|
{
|
|
case 4 :
|
|
{
|
|
- MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;
|
|
+ MAP_PUT(caddr,r,suffix); caddr+=scr_w;
|
|
}
|
|
case 3 :
|
|
- { MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;}
|
|
+ { MAP_PUT(caddr,r,suffix); caddr+=scr_w;}
|
|
case 2 :
|
|
- { MAP_PUT(caddr,(long)r,suffix); caddr+=scr_w;}
|
|
+ { MAP_PUT(caddr,r,suffix); caddr+=scr_w;}
|
|
case 1 :
|
|
{
|
|
- MAP_PUT(caddr,(long)r,suffix);
|
|
+ MAP_PUT(caddr,r,suffix);
|
|
}
|
|
}
|
|
}
|
|
@@ -909,21 +912,21 @@
|
|
for (;(lp->y1>y-cy1 || lp->y2<y-cy1 ||
|
|
lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
|
|
|
|
- uchar *r=light_lookup+(((long)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
|
|
- long caddr=(long)screen_line;
|
|
+ uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
|
|
+ uint8_t * caddr=(uint8_t *)screen_line;
|
|
switch (todoy)
|
|
{
|
|
case 4 :
|
|
{
|
|
- MAP_PUT(caddr,(long)r,prefix);
|
|
+ MAP_PUT(caddr,r,prefix);
|
|
caddr+=scr_w;
|
|
}
|
|
case 3 :
|
|
- { MAP_PUT(caddr,(long)r,prefix); caddr+=scr_w; }
|
|
+ { MAP_PUT(caddr,r,prefix); caddr+=scr_w; }
|
|
case 2 :
|
|
- { MAP_PUT(caddr,(long)r,prefix); caddr+=scr_w; }
|
|
+ { MAP_PUT(caddr,r,prefix); caddr+=scr_w; }
|
|
case 1 :
|
|
- { MAP_PUT(caddr,(long)r,prefix); }
|
|
+ { MAP_PUT(caddr,r,prefix); }
|
|
}
|
|
screen_line+=prefix;
|
|
}
|
|
@@ -968,8 +971,8 @@
|
|
}
|
|
|
|
|
|
-void double_light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient,
|
|
- image *out, long out_x, long out_y)
|
|
+void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
|
|
+ image *out, int32_t out_x, int32_t out_y)
|
|
{
|
|
if (sc->width()*2+out_x>out->width() ||
|
|
sc->height()*2+out_y>out->height())
|
|
@@ -1000,11 +1003,11 @@
|
|
|
|
if (ambient==63) // lights off, just double the pixels
|
|
{
|
|
- uchar *src=sc->scan_line(0);
|
|
- uchar *dst=out->scan_line(out_y+cy1*2)+cx1*2+out_x;
|
|
+ uint8_t *src=sc->scan_line(0);
|
|
+ uint8_t *dst=out->scan_line(out_y+cy1*2)+cx1*2+out_x;
|
|
int d_skip=out->width()-sc->width()*2;
|
|
int x,y;
|
|
- ushort v;
|
|
+ uint16_t v;
|
|
for (y=sc->height();y;y--)
|
|
{
|
|
for (x=sc->width();x;x--)
|
|
@@ -1034,13 +1037,13 @@
|
|
|
|
int suffix=(cx2-cx1-prefix+1)&7;
|
|
|
|
- long remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
|
|
+ int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
|
|
|
|
- uchar *remap_line=(uchar *)jmalloc(remap_size,"light remap line");
|
|
+ uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
|
|
|
|
light_patch *f=first;
|
|
- uchar *in_line=sc->scan_line(cy1)+cx1;
|
|
- uchar *out_line=out->scan_line(cy1*2+out_y)+cx1*2+out_x;
|
|
+ uint8_t *in_line=sc->scan_line(cy1)+cx1;
|
|
+ uint8_t *out_line=out->scan_line(cy1*2+out_y)+cx1*2+out_x;
|
|
|
|
|
|
for (int y=cy1;y<=cy2;)
|
|
@@ -1048,7 +1051,7 @@
|
|
int x,count;
|
|
// while (f->next && f->y2<y)
|
|
// f=f->next;
|
|
- uchar *rem=remap_line;
|
|
+ uint8_t *rem=remap_line;
|
|
|
|
int todoy=4-((screeny+y)&3);
|
|
if (y+todoy>cy2)
|
|
@@ -1062,31 +1065,31 @@
|
|
light_patch *lp=f;
|
|
for (;(lp->y1>y-cy1 || lp->y2<y-cy1 ||
|
|
lp->x1>suffix_x || lp->x2<suffix_x);lp=lp->next);
|
|
- long caddr=(long)in_line+cx2-cx1+1-suffix;
|
|
- long daddr=(long)out_line+(cx2-cx1+1-suffix)*2;
|
|
+ uint8_t * caddr=(uint8_t *)in_line+cx2-cx1+1-suffix;
|
|
+ uint8_t * daddr=(uint8_t *)out_line+(cx2-cx1+1-suffix)*2;
|
|
|
|
- uchar *r=light_lookup+(((long)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
|
|
+ uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,suffix_x+screenx,calcy)<<8));
|
|
switch (todoy)
|
|
{
|
|
case 4 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 3 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 2 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 1 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,suffix); daddr+=dscr_w; caddr+=scr_w;
|
|
} break;
|
|
}
|
|
}
|
|
@@ -1097,30 +1100,30 @@
|
|
for (;(lp->y1>y-cy1 || lp->y2<y-cy1 ||
|
|
lp->x1>prefix_x || lp->x2<prefix_x);lp=lp->next);
|
|
|
|
- uchar *r=light_lookup+(((long)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
|
|
- long caddr=(long)in_line;
|
|
- long daddr=(long)out_line;
|
|
+ uint8_t *r=light_lookup+(((int32_t)calc_light_value(lp,prefix_x+screenx,calcy)<<8));
|
|
+ uint8_t * caddr=(uint8_t *)in_line;
|
|
+ uint8_t * daddr=(uint8_t *)out_line;
|
|
switch (todoy)
|
|
{
|
|
case 4 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 3 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 2 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
}
|
|
case 1 :
|
|
{
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w;
|
|
- MAP_2PUT(caddr,daddr,(long)r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w;
|
|
+ MAP_2PUT(caddr,daddr,r,prefix); daddr+=dscr_w; caddr+=scr_w;
|
|
} break;
|
|
}
|
|
in_line+=prefix;
|
|
@@ -1183,7 +1186,7 @@
|
|
|
|
void add_light_spec(spec_directory *sd, char *level_name)
|
|
{
|
|
- long size=4+4; // number of lights and minimum light levels
|
|
+ int32_t size=4+4; // number of lights and minimum light levels
|
|
for (light_source *f=first_light_source;f;f=f->next)
|
|
size+=6*4+1;
|
|
sd->add_by_hand(new spec_entry(SPEC_LIGHT_LIST,"lights",NULL,size,0));
|
|
@@ -1194,17 +1197,17 @@
|
|
int t=0;
|
|
light_source *f=first_light_source;
|
|
for (;f;f=f->next) t++;
|
|
- fp->write_long(t);
|
|
- fp->write_long(min_light_level);
|
|
+ fp->write_uint32(t);
|
|
+ fp->write_uint32(min_light_level);
|
|
for (f=first_light_source;f;f=f->next)
|
|
{
|
|
- fp->write_long(f->x);
|
|
- fp->write_long(f->y);
|
|
- fp->write_long(f->xshift);
|
|
- fp->write_long(f->yshift);
|
|
- fp->write_long(f->inner_radius);
|
|
- fp->write_long(f->outer_radius);
|
|
- fp->write_byte(f->type);
|
|
+ fp->write_uint32(f->x);
|
|
+ fp->write_uint32(f->y);
|
|
+ fp->write_uint32(f->xshift);
|
|
+ fp->write_uint32(f->yshift);
|
|
+ fp->write_uint32(f->inner_radius);
|
|
+ fp->write_uint32(f->outer_radius);
|
|
+ fp->write_uint8(f->type);
|
|
}
|
|
}
|
|
|
|
@@ -1216,19 +1219,19 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,SEEK_SET);
|
|
- long t=fp->read_long();
|
|
- min_light_level=fp->read_long();
|
|
- light_source *last;
|
|
+ int32_t t=fp->read_uint32();
|
|
+ min_light_level=fp->read_uint32();
|
|
+ light_source *last=NULL;
|
|
while (t)
|
|
{
|
|
t--;
|
|
- long x=fp->read_long();
|
|
- long y=fp->read_long();
|
|
- long xshift=fp->read_long();
|
|
- long yshift=fp->read_long();
|
|
- long ir=fp->read_long();
|
|
- long ora=fp->read_long();
|
|
- long ty=fp->read_byte();
|
|
+ int32_t x=fp->read_uint32();
|
|
+ int32_t y=fp->read_uint32();
|
|
+ int32_t xshift=fp->read_uint32();
|
|
+ int32_t yshift=fp->read_uint32();
|
|
+ int32_t ir=fp->read_uint32();
|
|
+ int32_t ora=fp->read_uint32();
|
|
+ int32_t ty=fp->read_uint8();
|
|
|
|
light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
|
|
|
|
Index: abuse-sdl-0.7.0/src/crc.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/crc.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/crc.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,8 +1,8 @@
|
|
#include "crc.hpp"
|
|
|
|
-unsigned short calc_crc(unsigned char *buf, long len)
|
|
+uint16_t calc_crc(uint8_t *buf, int len)
|
|
{
|
|
- unsigned char c1=0,c2=0;
|
|
+ uint8_t c1=0,c2=0;
|
|
while (len)
|
|
{
|
|
len--;
|
|
@@ -15,12 +15,12 @@
|
|
|
|
|
|
|
|
-ulong crc_file(bFILE *fp)
|
|
+uint32_t crc_file(bFILE *fp)
|
|
{
|
|
- uchar crc1=0,crc2=0,crc3=0,crc4=0;
|
|
+ uint8_t crc1=0,crc2=0,crc3=0,crc4=0;
|
|
|
|
int size=0x1000;
|
|
- uchar *buffer=(uchar *)jmalloc(size,"crc_buffer"),*c;
|
|
+ uint8_t *buffer=(uint8_t *)jmalloc(size,"crc_buffer"),*c;
|
|
long l=fp->file_size();
|
|
long cur_pos=fp->tell();
|
|
fp->seek(0,0);
|
|
Index: abuse-sdl-0.7.0/src/intsect.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/intsect.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/intsect.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,8 +1,8 @@
|
|
#include "macs.hpp"
|
|
#include <stdlib.h>
|
|
|
|
-void pushback(long x1,long y1,long &x2,long &y2,
|
|
- long xp1, long yp1, long xp2, long yp2, int xdir, int ydir, int inside)
|
|
+void pushback(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
|
|
+ int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2, int xdir, int ydir, int inside)
|
|
{
|
|
|
|
// determine if the lines are intersecting before we set back
|
|
@@ -14,10 +14,10 @@
|
|
}
|
|
|
|
|
|
-/* int setback_intersect(long x1,long y1,long &x2,long &y2,
|
|
- long xp1, long yp1, long xp2, long yp2)
|
|
+/* int setback_intersect(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
|
|
+ int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2)
|
|
{
|
|
- long mx1,my1,b1,mx2,my2,b2,side1,side2,tx2,ty2;
|
|
+ int32_t mx1,my1,b1,mx2,my2,b2,side1,side2,tx2,ty2;
|
|
my1=(y2-y1);
|
|
if (!my1) // is the first line strait across?
|
|
{
|
|
@@ -109,14 +109,14 @@
|
|
{
|
|
if (abs(mx1)>abs(my1))
|
|
{
|
|
- long ae_bd=my1*mx2-mx1*my2;
|
|
+ int32_t ae_bd=my1*mx2-mx1*my2;
|
|
CONDITION(ae_bd,"line intersect fuck up");
|
|
tx2=(mx1*mx2*(b2-b1))/ae_bd+xadd;
|
|
ty2=my1*tx2/mx1+b1;
|
|
}
|
|
else
|
|
{
|
|
- long db_ea=(my2*mx1-mx2*my1);
|
|
+ int32_t db_ea=(my2*mx1-mx2*my1);
|
|
CONDITION(db_ea,"line intersect fuck up");
|
|
ty2=(mx1*b1*my2-my1*mx2*b2)/db_ea+yadd;
|
|
tx2=mx1*(ty2-b1)/my1;
|
|
@@ -136,15 +136,15 @@
|
|
} */
|
|
|
|
|
|
-int setback_intersect(long x1,long y1,long &x2,long &y2,
|
|
- long xp1, long yp1, long xp2, long yp2,
|
|
- long inside) // which side is inside the polygon? (0 always setback)
|
|
+int setback_intersect(int32_t x1,int32_t y1,int32_t &x2,int32_t &y2,
|
|
+ int32_t xp1, int32_t yp1, int32_t xp2, int32_t yp2,
|
|
+ int32_t inside) // which side is inside the polygon? (0 always setback)
|
|
{
|
|
// the line equations will be put in the form
|
|
// x(y2-y1)+y(x1-x2)-x1*y2+x2*y1=0
|
|
// A B C
|
|
|
|
- long a1,b1,c1,a2,b2,c2,r1,r2;
|
|
+ int32_t a1,b1,c1,a2,b2,c2,r1,r2;
|
|
|
|
a1=y2-y1;
|
|
b1=x1-x2;
|
|
@@ -156,8 +156,8 @@
|
|
r1=xp1; xp1=xp2; xp2=r1;
|
|
}
|
|
|
|
- long xdiff,ydiff;
|
|
-/* long xdiff=abs(xp1-xp2),ydiff=yp1-yp2;
|
|
+ int32_t xdiff,ydiff;
|
|
+/* int32_t xdiff=abs(xp1-xp2),ydiff=yp1-yp2;
|
|
if (xdiff>=ydiff) // increment the endpoints
|
|
if (xp2<xp1) { xp2--; xp1++; }
|
|
else { xp2++; xp1--; }
|
|
@@ -186,7 +186,7 @@
|
|
(xp1>=xp2 && ((r2^inside)<0)) ||
|
|
inside==0 || r2==0)
|
|
{
|
|
- long ae=a1*b2,bd=b1*a2;
|
|
+ int32_t ae=a1*b2,bd=b1*a2;
|
|
if (ae!=bd) // co-linear returns 0
|
|
{
|
|
x2=(b1*c2-b2*c1)/(ae-bd);
|
|
Index: abuse-sdl-0.7.0/src/unixnfc.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/unixnfc.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/unixnfc.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -27,11 +27,8 @@
|
|
#define DIN_NAME "/tmp/.abuse_ndrv_out" // opposite of driver's in/out
|
|
#define DOUT_NAME "/tmp/.abuse_ndrv_in"
|
|
|
|
-#define uchar unsigned char
|
|
-#define ushort unsigned short
|
|
-
|
|
-#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((char *)(ptr)-(char *)base)))
|
|
-#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((long)(ptr)+(long)(base))))
|
|
+#define real2shm(type,ptr) (ptr==NULL ? NULL : ((type *)((uint8_t *)(ptr)-(uint8_t *)base)))
|
|
+#define shm2real(type,ptr) (ptr==NULL ? NULL : ((type *)((intptr_t)(ptr)+(intptr_t)(base))))
|
|
|
|
#ifdef __sgi
|
|
#define next_process() sginap(0)
|
|
@@ -191,11 +188,11 @@
|
|
if (write(net_out_fd,filename,cm[1])!=cm[1]) { kill_net(); return -1; }
|
|
if (write(net_out_fd,mode,cm[2])!=cm[2]) { kill_net(); return -1; }
|
|
|
|
- uchar file_type;
|
|
+ uint8_t file_type;
|
|
if (read(net_in_fd,&file_type,1)!=1) { kill_net(); return -1; }
|
|
if (file_type==NF_OPEN_LOCAL_FILE)
|
|
{
|
|
- uchar name_size;
|
|
+ uint8_t name_size;
|
|
if (read(net_in_fd,&name_size,1)!=1) { kill_net(); return -1; }
|
|
int size=read(net_in_fd,filename,name_size);
|
|
if (size!=name_size) { kill_net(); return -1; }
|
|
@@ -210,7 +207,7 @@
|
|
} else return -2; // return open local
|
|
}
|
|
|
|
-long NF_close(int fd)
|
|
+int32_t NF_close(int fd)
|
|
{
|
|
if (net_installed)
|
|
{
|
|
@@ -224,7 +221,7 @@
|
|
}
|
|
|
|
|
|
-long NF_read(int fd, void *buf, long size)
|
|
+int32_t NF_read(int fd, void *buf, int32_t size)
|
|
{
|
|
if (net_installed && size)
|
|
{
|
|
@@ -234,8 +231,8 @@
|
|
if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
|
|
if (write(net_out_fd,&size,sizeof(size))!=sizeof(size)) { kill_net(); return 0; }
|
|
|
|
- long total_read=0;
|
|
- ushort t=0xffff;
|
|
+ int32_t total_read=0;
|
|
+ uint16_t t=0xffff;
|
|
while (size && t>=READ_PACKET_SIZE-2)
|
|
{
|
|
if (read(net_in_fd,&t,sizeof(t))!=sizeof(t)) { kill_net(); return 0; }
|
|
@@ -252,33 +249,33 @@
|
|
}
|
|
|
|
|
|
-long NF_filelength(int fd)
|
|
+int32_t NF_filelength(int fd)
|
|
{
|
|
if (net_installed)
|
|
{
|
|
char cm=NFCMD_SIZE;
|
|
if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
|
|
if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
|
|
- long size;
|
|
+ int32_t size;
|
|
if (read(net_in_fd,&size,sizeof(size))!=sizeof(size)) { kill_net(); return 0; }
|
|
return size;
|
|
} else return 0;
|
|
}
|
|
|
|
-long NF_tell(int fd)
|
|
+int32_t NF_tell(int fd)
|
|
{
|
|
if (net_installed)
|
|
{
|
|
char cm=NFCMD_TELL;
|
|
if (write(net_out_fd,&cm,1)!=1) { kill_net(); return 0; }
|
|
if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset)) { kill_net(); return 0; }
|
|
return offset;
|
|
} else return 0;
|
|
}
|
|
|
|
-long NF_seek(int fd, long offset)
|
|
+int32_t NF_seek(int fd, int32_t offset)
|
|
{
|
|
if (net_installed)
|
|
{
|
|
@@ -287,7 +284,7 @@
|
|
if (write(net_out_fd,&fd,sizeof(fd))!=sizeof(fd)) { kill_net(); return 0; }
|
|
if (write(net_out_fd,&offset,sizeof(offset))!=sizeof(offset)) { kill_net(); return 0; }
|
|
|
|
- long offset;
|
|
+ int32_t offset;
|
|
if (read(net_in_fd,&offset,sizeof(offset))!=sizeof(offset)) { kill_net(); return 0; }
|
|
return offset;
|
|
} else return 0;
|
|
@@ -321,7 +318,7 @@
|
|
base->calc_crcs=0;
|
|
base->mem_lock=0;
|
|
|
|
- uchar cmd=NFCMD_CRCS_CALCED;
|
|
+ uint8_t cmd=NFCMD_CRCS_CALCED;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
} else base->mem_lock=0;
|
|
}
|
|
@@ -331,7 +328,7 @@
|
|
{
|
|
base->get_lsf=0;
|
|
base->mem_lock=0;
|
|
- uchar c[2]={NFCMD_PROCESS_LSF,strlen(lsf)+1};
|
|
+ uint8_t c[2]={NFCMD_PROCESS_LSF,strlen(lsf)+1};
|
|
if (write(net_out_fd,&c,2)!=2) { kill_net(); return ; }
|
|
if (write(net_out_fd,lsf,c[1])!=c[1]) { kill_net(); return ; }
|
|
} else base->mem_lock=0;
|
|
@@ -345,10 +342,10 @@
|
|
{
|
|
if (net_installed)
|
|
{
|
|
- uchar cm[2]={NFCMD_REQUEST_LSF,strlen(name)+1};
|
|
+ uint8_t cm[2]={NFCMD_REQUEST_LSF,strlen(name)+1};
|
|
if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
|
|
if (write(net_out_fd,name,cm[1])!=cm[1]) { kill_net(); return 0; }
|
|
- uchar size;
|
|
+ uint8_t size;
|
|
if (read(net_in_fd,&size,1)!=1) { kill_net(); return 0; }
|
|
if (size==0) return 0;
|
|
if (read(net_in_fd,filename,size)!=size) { kill_net(); return 0; }
|
|
@@ -361,10 +358,10 @@
|
|
if (net_installed)
|
|
{
|
|
if (!net_server) return 0;
|
|
- uchar cm[2]={NFCMD_REQUEST_ENTRY,strlen(net_server)+1};
|
|
+ uint8_t cm[2]={NFCMD_REQUEST_ENTRY,strlen(net_server)+1};
|
|
if (write(net_out_fd,cm,2)!=2) { kill_net(); return 0; }
|
|
if (write(net_out_fd,net_server,cm[1])!=cm[1]) { kill_net(); return 0; }
|
|
- ushort cnum; // client number
|
|
+ uint16_t cnum; // client number
|
|
if (read(net_in_fd,&cnum,2)!=2) { kill_net(); return 0; }
|
|
if (cnum==0) return 0;
|
|
local_client_number=cnum;
|
|
@@ -377,7 +374,7 @@
|
|
{
|
|
if (net_installed)
|
|
{
|
|
- uchar cmd=NFCMD_RELOAD_START;
|
|
+ uint8_t cmd=NFCMD_RELOAD_START;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
return cmd;
|
|
@@ -389,7 +386,7 @@
|
|
{
|
|
if (net_installed)
|
|
{
|
|
- uchar cmd=NFCMD_RELOAD_END;
|
|
+ uint8_t cmd=NFCMD_RELOAD_END;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
return cmd;
|
|
@@ -415,6 +412,7 @@
|
|
|
|
spec_directory sd(fp);
|
|
|
|
+#if 0
|
|
spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved");
|
|
if (!e)
|
|
{
|
|
@@ -423,6 +421,7 @@
|
|
the_game->need_refresh();
|
|
}
|
|
else
|
|
+#endif
|
|
current_level=new level(&sd,fp,NET_STARTFILE);
|
|
|
|
delete fp;
|
|
@@ -502,9 +501,9 @@
|
|
if (net_installed)
|
|
{
|
|
if (base->join_list)
|
|
- base->packet.write_byte(SCMD_RELOAD);
|
|
+ base->packet.write_uint8(SCMD_RELOAD);
|
|
|
|
- uchar cmd=NFCMD_SEND_INPUT;
|
|
+ uint8_t cmd=NFCMD_SEND_INPUT;
|
|
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
@@ -516,7 +515,7 @@
|
|
{
|
|
if (net_installed)
|
|
{
|
|
- uchar cmd=NFCMD_KILL_SLACKERS;
|
|
+ uint8_t cmd=NFCMD_KILL_SLACKERS;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
}
|
|
@@ -547,7 +546,7 @@
|
|
if ((((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000)>20)
|
|
{
|
|
// fprintf(stderr,"receive timeout %d\n",(((now.tv_sec-start.tv_sec)*100)+(now.tv_usec-start.tv_usec)/10000));
|
|
- uchar cmd=NFCMD_INPUT_MISSING;
|
|
+ uint8_t cmd=NFCMD_INPUT_MISSING;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; } // block, so net driver can request input
|
|
gettimeofday(&start,NULL);
|
|
@@ -621,7 +620,7 @@
|
|
{ close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
|
|
else
|
|
{
|
|
- uchar cmd=NFCMD_BLOCK;
|
|
+ uint8_t cmd=NFCMD_BLOCK;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return ; }
|
|
if (base->input_state==INPUT_NET_DEAD)
|
|
{ close(net_out_fd); close(net_in_fd); net_installed=0; kill_net(); }
|
|
@@ -641,7 +640,7 @@
|
|
{
|
|
if (net_installed)
|
|
{
|
|
- uchar cmd=NFCMD_BECOME_SERVER;
|
|
+ uint8_t cmd=NFCMD_BECOME_SERVER;
|
|
if (write(net_out_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
if (read(net_in_fd,&cmd,1)!=1) { kill_net(); return 0; }
|
|
|
|
Index: abuse-sdl-0.7.0/src/clisp.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/clisp.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/clisp.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -19,8 +19,8 @@
|
|
#include "jdir.hpp"
|
|
#include "netcfg.hpp"
|
|
|
|
-extern uchar major_version;
|
|
-extern uchar minor_version;
|
|
+extern uint8_t major_version;
|
|
+extern uint8_t minor_version;
|
|
extern int has_joystick;
|
|
|
|
// the following are references to lisp symbols
|
|
@@ -59,7 +59,7 @@
|
|
*l_statbar_health_bg_color,
|
|
|
|
*l_statbar_logo_x,*l_statbar_logo_y;
|
|
-uchar chatting_enabled=0;
|
|
+uint8_t chatting_enabled=0;
|
|
|
|
extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s);
|
|
extern void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s);
|
|
@@ -778,10 +778,10 @@
|
|
} break;
|
|
case 24 :
|
|
{
|
|
- long x1=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
- long y1=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
- long x2=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
- long y2=lnumber_value(eval(CAR(args)));
|
|
+ int32_t x1=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t y1=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t x2=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t y2=lnumber_value(eval(CAR(args)));
|
|
current_level->foreground_intersect(x1,y1,x2,y2);
|
|
void *ret=NULL;
|
|
push_onto_list(new_lisp_number(y2),ret);
|
|
@@ -815,7 +815,7 @@
|
|
case 36 :
|
|
{
|
|
|
|
- long xm,ym,but;
|
|
+ int32_t xm,ym,but;
|
|
xm=lnumber_value(CAR(args)); args=CDR(args);
|
|
ym=lnumber_value(CAR(args)); args=CDR(args);
|
|
but=lnumber_value(CAR(args));
|
|
@@ -891,10 +891,10 @@
|
|
} break;
|
|
case 49 :
|
|
{
|
|
- long x=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
- long y=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t x=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t y=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->mouse_to_game(x,y,rx,ry);
|
|
void *ret=NULL;
|
|
{
|
|
@@ -906,10 +906,10 @@
|
|
} break;
|
|
case 50 :
|
|
{
|
|
- long x=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
- long y=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t x=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
+ int32_t y=lnumber_value(eval(CAR(args))); args=CDR(args);
|
|
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->game_to_mouse(x,y,current_view,rx,ry);
|
|
void *ret=NULL;
|
|
{
|
|
@@ -1002,7 +1002,7 @@
|
|
{
|
|
long x;
|
|
sscanf(lstring_value(eval(CAR(args))),"%lx",&x);
|
|
- return new_lisp_pointer((void *)x);
|
|
+ return new_lisp_pointer((void *)(intptr_t)x);
|
|
} break;
|
|
case 64 :
|
|
{
|
|
@@ -1137,7 +1137,7 @@
|
|
case 21 : return current_object->fade_dir(); break;
|
|
case 22 :
|
|
{
|
|
- long x1,y1,x2,y2,xp1,yp1,xp2,yp2;
|
|
+ int32_t x1,y1,x2,y2,xp1,yp1,xp2,yp2;
|
|
current_level->attacker(current_object)->picture_space(x1,y1,x2,y2);
|
|
current_object->picture_space(xp1,yp1,xp2,yp2);
|
|
if (xp1>x2 || xp2<x1 || yp1>y2 || yp2<y1) return 0;
|
|
@@ -1155,13 +1155,13 @@
|
|
case 30 : return current_object->x; break;
|
|
case 31 : return current_object->y; break;
|
|
case 32 :
|
|
- { long v=lnumber_value(CAR(args));
|
|
+ { int32_t v=lnumber_value(CAR(args));
|
|
current_object->x=v;
|
|
// current_object->last_x=v;
|
|
return 1;
|
|
} break;
|
|
case 33 :
|
|
- { long v=lnumber_value(CAR(args));
|
|
+ { int32_t v=lnumber_value(CAR(args));
|
|
current_object->y=v;
|
|
// current_object->last_y=v;
|
|
return 1;
|
|
@@ -1173,7 +1173,7 @@
|
|
|
|
case 37 :
|
|
{
|
|
- long s=lnumber_value(CAR(args));
|
|
+ int32_t s=lnumber_value(CAR(args));
|
|
current_object->set_state((character_state)s);
|
|
return (s==current_object->state);
|
|
} break;
|
|
@@ -1279,11 +1279,11 @@
|
|
case 91 : current_object->add_object((game_object *)lpointer_value(CAR(args))); return 1; break;
|
|
case 92 :
|
|
{
|
|
- long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long c=lnumber_value(CAR(args));
|
|
+ int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t c=lnumber_value(CAR(args));
|
|
the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
|
|
the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
|
|
screen->line(cx1,cy1,cx2,cy2,c);
|
|
@@ -1301,7 +1301,7 @@
|
|
|
|
case 104 :
|
|
{ light_source *l=(light_source *)lpointer_value(CAR(args));
|
|
- long x=lnumber_value(CAR(CDR(args)));
|
|
+ int32_t x=lnumber_value(CAR(CDR(args)));
|
|
if (x>=1)
|
|
l->inner_radius=x;
|
|
l->calc_range();
|
|
@@ -1309,7 +1309,7 @@
|
|
} break;
|
|
case 105 :
|
|
{ light_source *l=(light_source *)lpointer_value(CAR(args));
|
|
- long x=lnumber_value(CAR(CDR(args)));
|
|
+ int32_t x=lnumber_value(CAR(CDR(args)));
|
|
if (x>l->inner_radius)
|
|
l->outer_radius=x;
|
|
l->calc_range();
|
|
@@ -1396,14 +1396,14 @@
|
|
int vol=lnumber_value(lcar(a)); a=CDR(a);
|
|
if (a)
|
|
{
|
|
- long x=lnumber_value(lcar(a)); a=CDR(a);
|
|
+ int32_t x=lnumber_value(lcar(a)); a=CDR(a);
|
|
if (!a)
|
|
{
|
|
lprint(args);
|
|
lbreak("expecting y after x in play_sound\n");
|
|
exit(1);
|
|
}
|
|
- long y=lnumber_value(lcar(a));
|
|
+ int32_t y=lnumber_value(lcar(a));
|
|
the_game->play_sound(id,vol,x,y);
|
|
} else cash.sfx(id)->play(vol);
|
|
}
|
|
@@ -1413,14 +1413,14 @@
|
|
case 137 : return defun_pseq(args); break;
|
|
case 138 :
|
|
{ int id=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long dir=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t dir=lnumber_value(CAR(args));
|
|
add_panim(id,x,y,dir);
|
|
} break;
|
|
case 142 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
if (x<0 || x>=total_weapons)
|
|
{
|
|
lbreak("weapon out of range (%d)\n",x);
|
|
@@ -1430,12 +1430,12 @@
|
|
} break;
|
|
case 143 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long r=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long m=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t r=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t m=lnumber_value(CAR(args)); args=CDR(args);
|
|
game_object *o=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
|
|
- long mp=lnumber_value(CAR(args));
|
|
+ int32_t mp=lnumber_value(CAR(args));
|
|
current_level->hurt_radius(x,y,r,m,current_object,o,mp);
|
|
} break;
|
|
|
|
@@ -1445,8 +1445,8 @@
|
|
if (!v) dprintf("Can't add weapons for non-players\n");
|
|
else
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
if (x<0 || x>=total_weapons)
|
|
{ lbreak("weapon out of range (%d)\n",x); exit(0); }
|
|
v->add_ammo(x,y);
|
|
@@ -1502,18 +1502,18 @@
|
|
case 153 :
|
|
{
|
|
game_object *o=(game_object *)lpointer_value(CAR(args));
|
|
- long x=o->x-current_object->x,
|
|
+ int32_t x=o->x-current_object->x,
|
|
y=-(o->y-o->picture()->height()/2-(current_object->y-(current_object->picture()->height()/2)));
|
|
return lisp_atan2(y,x);
|
|
} break;
|
|
case 154 :
|
|
{
|
|
- long ang=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long mag=lfixed_point_value(CAR(args));
|
|
- long xvel=(lisp_cos(ang)>>8)*(mag>>8);
|
|
+ int32_t ang=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t mag=lfixed_point_value(CAR(args));
|
|
+ int32_t xvel=(lisp_cos(ang)>>8)*(mag>>8);
|
|
current_object->set_xvel(xvel>>16);
|
|
current_object->set_fxvel((xvel&0xffff)>>8);
|
|
- long yvel=-(lisp_sin(ang)>>8)*(mag>>8);
|
|
+ int32_t yvel=-(lisp_sin(ang)>>8)*(mag>>8);
|
|
current_object->set_yvel(yvel>>16);
|
|
current_object->set_fyvel((yvel&0xffff)>>8);
|
|
} break;
|
|
@@ -1521,14 +1521,14 @@
|
|
{
|
|
int tframes=current_object->total_frames(),f;
|
|
|
|
- long ang1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t ang1=lnumber_value(CAR(args)); args=CDR(args);
|
|
if (ang1<0) ang1=(ang1%360)+360;
|
|
else if (ang1>=360) ang1=ang1%360;
|
|
- long ang2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t ang2=lnumber_value(CAR(args)); args=CDR(args);
|
|
if (ang2<0) ang2=(ang2%360)+360;
|
|
else if (ang2>=360) ang2=ang2%360;
|
|
|
|
- long ang=(lnumber_value(CAR(args))+90/tframes)%360;
|
|
+ int32_t ang=(lnumber_value(CAR(args))+90/tframes)%360;
|
|
if (ang1>ang2)
|
|
{
|
|
if (ang<ang1 && ang>ang2)
|
|
@@ -1556,12 +1556,12 @@
|
|
case 168 : if (current_object->morph_status()) return 1; else return 0; break;
|
|
case 169 :
|
|
{
|
|
- long am=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t am=lnumber_value(CAR(args)); args=CDR(args);
|
|
game_object *from=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
|
|
- long hitx=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long hity=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long px=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long py=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t hitx=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t hity=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t px=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t py=lnumber_value(CAR(args)); args=CDR(args);
|
|
current_object->damage_fun(am,from,hitx,hity,px,py);
|
|
} break;
|
|
case 170 : return current_object->gravity(); break;
|
|
@@ -1628,7 +1628,7 @@
|
|
case 179 :
|
|
{
|
|
view *v=lget_view(CAR(args),"set_ambient_light"); args=CDR(args);
|
|
- long x=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args));
|
|
if (x>=0 && x<64) v->ambient=x;
|
|
} break;
|
|
case 180 : return lget_view(CAR(args),"ambient_light")->ambient; break;
|
|
@@ -1656,9 +1656,9 @@
|
|
} break;
|
|
case 192 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long type=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t type=lnumber_value(CAR(args));
|
|
if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
|
|
lbreak("%d %d is out of range of fg map",x,y);
|
|
else
|
|
@@ -1666,17 +1666,17 @@
|
|
} break;
|
|
case 193 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args));
|
|
if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
|
|
lbreak("%d %d is out of range of fg map",x,y);
|
|
else return current_level->get_fg(x,y);
|
|
} break;
|
|
case 194 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long type=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t type=lnumber_value(CAR(args));
|
|
if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
|
|
lbreak("%d %d is out of range of fg map",x,y);
|
|
else
|
|
@@ -1684,8 +1684,8 @@
|
|
} break;
|
|
case 195 :
|
|
{
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args));
|
|
if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
|
|
lbreak("%d %d is out of range of fg map",x,y);
|
|
else return current_level->get_bg(x,y);
|
|
@@ -1740,13 +1740,13 @@
|
|
} break;
|
|
case 200 :
|
|
{
|
|
- long xv=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long yv=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t xv=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t yv=lnumber_value(CAR(args)); args=CDR(args);
|
|
int top=2;
|
|
if (args)
|
|
if (!CAR(args)) top=0;
|
|
|
|
- long oxv=xv,oyv=yv;
|
|
+ int32_t oxv=xv,oyv=yv;
|
|
current_object->try_move(current_object->x,current_object->y,xv,yv,1|top);
|
|
current_object->x+=xv;
|
|
current_object->y+=yv;
|
|
@@ -1754,17 +1754,17 @@
|
|
} break;
|
|
case 201 :
|
|
{
|
|
- long x=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args));
|
|
return figures[current_object->otype]->get_sequence((character_state)x)->length();
|
|
} break;
|
|
case 202 :
|
|
{
|
|
- long x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
void *block_all=CAR(args);
|
|
- long nx2=x2,ny2=y2;
|
|
+ int32_t nx2=x2,ny2=y2;
|
|
current_level->foreground_intersect(x1,y1,x2,y2);
|
|
if (x2!=nx2 || y2!=ny2) return 0;
|
|
|
|
@@ -1795,7 +1795,7 @@
|
|
} break;
|
|
case 206 :
|
|
{
|
|
- long x=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args));
|
|
if (x<current_object->total_frames())
|
|
current_object->current_frame=x;
|
|
else
|
|
@@ -1833,9 +1833,9 @@
|
|
} break;
|
|
case 216 :
|
|
{
|
|
- long x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long id=lnumber_value(CAR(args));
|
|
+ int32_t x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t id=lnumber_value(CAR(args));
|
|
cash.img(id)->put_image(screen,x1,y1,1);
|
|
} break;
|
|
case 217 :
|
|
@@ -1908,16 +1908,16 @@
|
|
case 228 :
|
|
{
|
|
palette *p=pal->copy();
|
|
- uchar *addr=(uchar *)p->addr();
|
|
+ uint8_t *addr=(uint8_t *)p->addr();
|
|
int r,g,b;
|
|
int ra=lnumber_value(CAR(args)); args=CDR(args);
|
|
int ga=lnumber_value(CAR(args)); args=CDR(args);
|
|
int ba=lnumber_value(CAR(args));
|
|
for (int i=0;i<256;i++)
|
|
{
|
|
- r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uchar)r; addr++;
|
|
- g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uchar)g; addr++;
|
|
- b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uchar)b; addr++;
|
|
+ r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uint8_t)r; addr++;
|
|
+ g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uint8_t)g; addr++;
|
|
+ b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uint8_t)b; addr++;
|
|
}
|
|
p->load();
|
|
delete p;
|
|
@@ -1934,7 +1934,7 @@
|
|
if (!v) lbreak("object has no view : local_player");
|
|
else
|
|
{
|
|
- long x=lnumber_value(CAR(args));
|
|
+ int32_t x=lnumber_value(CAR(args));
|
|
if (x<0 || x>=total_weapons)
|
|
{ lbreak("weapon out of range (%d)\n",x); exit(0); }
|
|
v->current_weapon=x;
|
|
@@ -1956,12 +1956,12 @@
|
|
|
|
case 234 :
|
|
{
|
|
- long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long c=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long s=lnumber_value(CAR(args));
|
|
+ int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t c=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t s=lnumber_value(CAR(args));
|
|
the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
|
|
the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
|
|
scatter_line(cx1,cy1,cx2,cy2,c,s);
|
|
@@ -2008,13 +2008,13 @@
|
|
} break;
|
|
case 244 :
|
|
{
|
|
- long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long c1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long c2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long s=lnumber_value(CAR(args));
|
|
+ int32_t cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t c1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t c2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t s=lnumber_value(CAR(args));
|
|
the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
|
|
the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
|
|
ascatter_line(cx1,cy1,cx2,cy2,c1,c2,s);
|
|
@@ -2031,11 +2031,11 @@
|
|
} break;
|
|
case 247 :
|
|
{
|
|
- long cx1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cx2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long cy2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
- long c1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cx1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cx2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t cy2=lnumber_value(CAR(args)); args=lcdr(args);
|
|
+ int32_t c1=lnumber_value(CAR(args)); args=lcdr(args);
|
|
screen->bar(cx1,cy1,cx2,cy2,c1);
|
|
} break;
|
|
case 248 :
|
|
@@ -2186,8 +2186,8 @@
|
|
case 277 :
|
|
{
|
|
JCFont *fnt=(JCFont *)lpointer_value(CAR(args)); args=CDR(args);
|
|
- long x=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y=lnumber_value(CAR(args)); args=CDR(args);
|
|
char *st=lstring_value(CAR(args)); args=CDR(args);
|
|
int color=-1;
|
|
if (args)
|
|
@@ -2205,20 +2205,20 @@
|
|
} break;
|
|
case 282 :
|
|
{
|
|
- long x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long c=lnumber_value(CAR(args));
|
|
+ int32_t x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t c=lnumber_value(CAR(args));
|
|
screen->bar(x1,y1,x2,y2,c);
|
|
} break;
|
|
case 283 :
|
|
{
|
|
- long x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
- long c=lnumber_value(CAR(args));
|
|
+ int32_t x1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y1=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t x2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t y2=lnumber_value(CAR(args)); args=CDR(args);
|
|
+ int32_t c=lnumber_value(CAR(args));
|
|
screen->rectangle(x1,y1,x2,y2,c);
|
|
} break;
|
|
case 284 :
|
|
Index: abuse-sdl-0.7.0/src/collide.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/collide.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/collide.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -4,17 +4,17 @@
|
|
class collide_patch
|
|
{
|
|
public :
|
|
- long total,x1,y1,x2,y2;
|
|
+ int32_t total,x1,y1,x2,y2;
|
|
game_object **touch;
|
|
collide_patch *next;
|
|
- collide_patch(long X1, long Y1, long X2, long Y2, collide_patch *Next)
|
|
+ collide_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, collide_patch *Next)
|
|
{
|
|
x1=X1; y1=Y1; x2=X2; y2=Y2;
|
|
next=Next;
|
|
total=0;
|
|
touch=NULL;
|
|
}
|
|
- void add_collide(long X1, long Y1, long X2, long Y2, game_object *who);
|
|
+ void add_collide(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, game_object *who);
|
|
collide_patch *copy(collide_patch *Next);
|
|
~collide_patch() { if (total) jfree(touch); }
|
|
} ;
|
|
@@ -35,7 +35,7 @@
|
|
}
|
|
|
|
|
|
-void add_collide(collide_patch *&first, long x1, long y1, long x2, long y2,
|
|
+void add_collide(collide_patch *&first, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
|
game_object *who)
|
|
{
|
|
collide_patch *next;
|
|
@@ -147,7 +147,7 @@
|
|
void level::check_collisions()
|
|
{
|
|
game_object *target,*rec,*subject;
|
|
- long sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,t_centerx;
|
|
+ int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx=0,hity=0,t_centerx;
|
|
|
|
for (int l=0;l<attack_total;l++)
|
|
{
|
|
@@ -183,7 +183,7 @@
|
|
{
|
|
for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !rec;j--)
|
|
{
|
|
- long x1,y1,x2,y2, // define the two line segments to check
|
|
+ int32_t x1,y1,x2,y2, // define the two line segments to check
|
|
xp1,yp1,xp2,yp2;
|
|
|
|
xp1=target->x+target->tx(*t_dat); t_dat++;
|
|
@@ -199,7 +199,7 @@
|
|
|
|
// ok, now we know which line segemnts to check for intersection
|
|
// now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
|
|
- int _x2=x2,_y2=y2;
|
|
+ int32_t _x2=x2,_y2=y2;
|
|
setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0);
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/morpher.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/morpher.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/morpher.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -7,7 +7,7 @@
|
|
{
|
|
if (fleft)
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->game_to_mouse(who->x-(cx>>16),who->y-(cy>>16),v,rx,ry);
|
|
mor->show(screen,rx,ry,color_table,pal,1000);
|
|
cx+=dcx;
|
|
Index: abuse-sdl-0.7.0/src/gamma.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/gamma.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/gamma.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -179,7 +179,7 @@
|
|
FILE *fp;
|
|
|
|
gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 10, "gammapath" );
|
|
- sprintf( gammapath, "%sgamma.lsp\0", get_save_filename_prefix() );
|
|
+ sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
|
|
fp = open_FILE( gammapath, "wb" );
|
|
if( fp )
|
|
{
|
|
@@ -219,7 +219,7 @@
|
|
pal = new palette;
|
|
for( int i = 0; i < 256; i++ )
|
|
{
|
|
- uchar oldr, oldg, oldb;
|
|
+ uint8_t oldr, oldg, oldb;
|
|
old_pal->get( i, oldr, oldg, oldb );
|
|
pal->set( i, (int)( pow( oldr / 255.0, gamma ) * 255 ),
|
|
(int)( pow( oldg / 255.0, gamma ) * 255 ),
|
|
Index: abuse-sdl-0.7.0/src/ant.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/ant.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/ant.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -16,9 +16,9 @@
|
|
|
|
void *ant_ai();
|
|
|
|
-int can_see(game_object *o, long x1, long y1, long x2, long y2)
|
|
+int can_see(game_object *o, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
|
|
{
|
|
- long nx2=x2,ny2=y2;
|
|
+ int32_t nx2=x2,ny2=y2;
|
|
current_level->foreground_intersect(x1,y1,x2,y2);
|
|
if (x2!=nx2 || y2!=ny2) return 0;
|
|
|
|
@@ -94,8 +94,8 @@
|
|
|
|
static void fire_at_player(game_object *o, game_object *b)
|
|
{
|
|
- long firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
|
|
- playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
|
|
+ int32_t firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
|
|
+ playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
|
|
if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
|
|
{
|
|
int angle=lisp_atan2(firey-playery,playerx-firex);
|
|
@@ -223,7 +223,7 @@
|
|
{
|
|
if (!o->next_picture())
|
|
{
|
|
- long xv=0,yv=2;
|
|
+ int32_t xv=0,yv=2;
|
|
o->try_move(o->x,o->y,xv,yv,1);
|
|
if (yv!=0)
|
|
{
|
|
@@ -263,8 +263,8 @@
|
|
o->set_aistate(ANT_JUMP);
|
|
else
|
|
{
|
|
- long xm=o->direction>0 ? get_ability(o->otype,run_top_speed) : -get_ability(o->otype,run_top_speed);
|
|
- long ym=0,new_xm=xm;
|
|
+ int32_t xm=o->direction>0 ? get_ability(o->otype,run_top_speed) : -get_ability(o->otype,run_top_speed);
|
|
+ int32_t ym=0,new_xm=xm;
|
|
if (o->state!=running) o->set_state(running);
|
|
|
|
o->try_move(o->x,o->y,new_xm,ym,3);
|
|
@@ -348,7 +348,7 @@
|
|
o->set_state((character_state)S_jump_up);
|
|
// o->set_yvel(o->yvel()+1);
|
|
o->set_xacel(0);
|
|
- long xv=0,yv=o->yvel();
|
|
+ int32_t xv=0,yv=o->yvel();
|
|
o->y-=31;
|
|
o->try_move(o->x,o->y,xv,yv,1);
|
|
o->y+=31+yv;
|
|
Index: abuse-sdl-0.7.0/src/compiled.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/compiled.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/compiled.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -5,10 +5,10 @@
|
|
|
|
extern int total_objects;
|
|
|
|
-uchar *bad_guy_array=NULL; // list flaging each character saying they are a bad bug or not
|
|
+uint8_t *bad_guy_array=NULL; // list flaging each character saying they are a bad bug or not
|
|
// mainly used by the rocket to find targets
|
|
|
|
-long S_fall_start,S_falling,S_landing,S_pounce_wait,
|
|
+int32_t S_fall_start,S_falling,S_landing,S_pounce_wait,
|
|
S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
|
|
S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
|
|
S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
|
|
@@ -27,7 +27,7 @@
|
|
|
|
int compile_error=0;
|
|
|
|
-long c_state(char *name)
|
|
+int32_t c_state(char *name)
|
|
{
|
|
void *sym=find_symbol(name);
|
|
if (sym)
|
|
@@ -113,11 +113,11 @@
|
|
if (b && DEFINEDP(symbol_value(b)))
|
|
{
|
|
b=symbol_value(b);
|
|
- bad_guy_array=(uchar *)jmalloc(total_objects,"bad_guy_array");
|
|
+ bad_guy_array=(uint8_t *)jmalloc(total_objects,"bad_guy_array");
|
|
memset(bad_guy_array,0,total_objects);
|
|
while (b)
|
|
{
|
|
- long x=lnumber_value(CAR(b));
|
|
+ int32_t x=lnumber_value(CAR(b));
|
|
if (x>=0 && x<total_objects)
|
|
bad_guy_array[x]=1;
|
|
else { lbreak("objetc number out of range %d\n",x); }
|
|
Index: abuse-sdl-0.7.0/src/endgame.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/endgame.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/endgame.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -20,12 +20,12 @@
|
|
struct mask_line
|
|
{
|
|
int x,size;
|
|
- ushort *remap;
|
|
- uchar *light;
|
|
+ uint16_t *remap;
|
|
+ uint8_t *light;
|
|
} ;
|
|
|
|
|
|
-int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color);
|
|
+int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
|
|
|
|
mask_line *make_mask_lines(image *mask, int map_width)
|
|
{
|
|
@@ -33,7 +33,7 @@
|
|
for (int y=0;y<mask->height();y++)
|
|
{
|
|
// find the start of the run..
|
|
- uchar *sl=mask->scan_line(y);
|
|
+ uint8_t *sl=mask->scan_line(y);
|
|
int x=0;
|
|
while (*sl==0) { sl++; x++; }
|
|
p[y].x=x;
|
|
@@ -41,15 +41,15 @@
|
|
|
|
// find the length of the run
|
|
int size=0;
|
|
- uchar *sl_start=sl;
|
|
+ uint8_t *sl_start=sl;
|
|
while (*sl!=0 && x<mask->width()) { sl++; x++; size++; }
|
|
p[y].size=size;
|
|
|
|
// now calculate remap for line
|
|
- p[y].remap=(ushort *)jmalloc(size*2,"mask remap");
|
|
- p[y].light=(uchar *)jmalloc(size,"mask light");
|
|
- ushort *rem=p[y].remap;
|
|
- uchar *lrem=p[y].light;
|
|
+ p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap");
|
|
+ p[y].light=(uint8_t *)jmalloc(size,"mask light");
|
|
+ uint16_t *rem=p[y].remap;
|
|
+ uint8_t *lrem=p[y].light;
|
|
for (x=0;x<size;x++,rem++)
|
|
{
|
|
*(lrem++)=*(sl_start++);
|
|
@@ -68,23 +68,23 @@
|
|
}
|
|
|
|
|
|
-void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, long *paddr, mask_line *p, int mask_height,
|
|
+void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height,
|
|
int xoff, int coff)
|
|
{
|
|
int x1=10000,x2=0;
|
|
int iw=im1->width();
|
|
- ushort r,off;
|
|
+ uint16_t r,off;
|
|
int y=0;
|
|
- uchar *l;
|
|
+ uint8_t *l;
|
|
|
|
for (;y<mask_height;y++)
|
|
{
|
|
mask_line *n=p+y;
|
|
- uchar *sl=screen->scan_line(y+sy)+sx+n->x;
|
|
- uchar *sl2=im1->scan_line(y);
|
|
- uchar *sl3=im2->scan_line(y);
|
|
+ uint8_t *sl=screen->scan_line(y+sy)+sx+n->x;
|
|
+ uint8_t *sl2=im1->scan_line(y);
|
|
+ uint8_t *sl3=im2->scan_line(y);
|
|
l=n->light;
|
|
- ushort *rem=n->remap;
|
|
+ uint16_t *rem=n->remap;
|
|
if (sx+n->x<x1) x1=sx+n->x;
|
|
int x=0;
|
|
for (;x<n->size;x++,sl++,rem++,l++)
|
|
@@ -94,8 +94,8 @@
|
|
off=(r+xoff);
|
|
if (off>=iw) off-=iw;
|
|
|
|
- long p1=*(paddr+sl2[off]);
|
|
- long p2=*(paddr+sl3[off]);
|
|
+ int32_t p1=*(paddr+sl2[off]);
|
|
+ int32_t p2=*(paddr+sl3[off]);
|
|
|
|
int r1=p1>>16,g1=(p1>>8)&0xff,b1=p1&0xff;
|
|
int r2=p2>>16,g2=(p2>>8)&0xff,b2=p2&0xff;
|
|
@@ -103,7 +103,7 @@
|
|
g3=g1+(g2-g1)*fade256/256,
|
|
b3=b1+(b2-b1)*fade256/256;
|
|
|
|
- uchar c=color_table->lookup_color(r3>>3,g3>>3,b3>>3);
|
|
+ uint8_t c=color_table->lookup_color(r3>>3,g3>>3,b3>>3);
|
|
|
|
*sl=*(white_light+((*l)/2+28+jrand()%4)*256+c);
|
|
|
|
@@ -122,7 +122,7 @@
|
|
|
|
class ex_char {
|
|
public :
|
|
- uchar frame,char_num;
|
|
+ uint8_t frame,char_num;
|
|
int x,y;
|
|
ex_char *next;
|
|
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; }
|
|
@@ -174,7 +174,7 @@
|
|
pal->find_closest(200,200,200),
|
|
pal->find_closest(100,100,100),
|
|
pal->find_closest(64,64,64)};
|
|
- ushort sinfo[800*3],*si;
|
|
+ uint16_t sinfo[800*3],*si;
|
|
|
|
for (si=sinfo,i=0;i<800;i++)
|
|
{
|
|
@@ -183,7 +183,7 @@
|
|
*(si++)=c[jrand()%4];
|
|
screen->putpixel(si[-3],si[-2],si[-1]);
|
|
}
|
|
- long paddr[256];
|
|
+ int32_t paddr[256];
|
|
if (old_pal)
|
|
{
|
|
for (i=0;i<256;i++)
|
|
@@ -353,7 +353,7 @@
|
|
} while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
|
|
|
|
|
|
- uchar cmap[32];
|
|
+ uint8_t cmap[32];
|
|
for (i=0;i<32;i++)
|
|
cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
|
|
|
|
@@ -427,7 +427,7 @@
|
|
lstring_value(to_be));
|
|
fade_in(NULL,32);
|
|
|
|
- uchar cmap[32];
|
|
+ uint8_t cmap[32];
|
|
int i;
|
|
for (i=0;i<32;i++)
|
|
cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
|
|
@@ -479,7 +479,7 @@
|
|
|
|
fade_in(im,32);
|
|
|
|
- uchar cmap[32];
|
|
+ uint8_t cmap[32];
|
|
int i;
|
|
for (i=0;i<32;i++)
|
|
cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
|
|
Index: abuse-sdl-0.7.0/src/nfclient.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/nfclient.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/nfclient.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -73,11 +73,11 @@
|
|
}
|
|
|
|
int remote_file_num=net_crcs->get_filenumber(local_filename);
|
|
- ulong remote_crc=net_crcs->get_crc(remote_file_num,fail2);
|
|
+ uint32_t remote_crc=net_crcs->get_crc(remote_file_num,fail2);
|
|
if (!fail2)
|
|
{
|
|
int local_file_num=crc_man.get_filenumber(local_filename);
|
|
- ulong local_crc=crc_man.get_crc(local_file_num,fail1);
|
|
+ uint32_t local_crc=crc_man.get_crc(local_file_num,fail1);
|
|
if (fail1)
|
|
{
|
|
bFILE *fp=new jFILE(local_filename,"rb");
|
|
@@ -134,7 +134,7 @@
|
|
else if (nfs_fd>=0)
|
|
{
|
|
long a=NF_read(nfs_fd,buf,count);
|
|
- if (a>count)
|
|
+ if (a>(long)count)
|
|
{
|
|
fprintf(stderr,"ooch read too much\n");
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/transp.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/transp.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/transp.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -1,7 +1,7 @@
|
|
#include "transp.hpp"
|
|
|
|
|
|
-void transp_put(image *im, image *screen, uchar *table, int x, int y)
|
|
+void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
|
|
{
|
|
short cx1,cy1,cx2,cy2;
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
@@ -31,13 +31,13 @@
|
|
int ye=ys+yl;
|
|
int xe=xs+xl;
|
|
|
|
- uchar *isl=im->scan_line(ys)+xs;
|
|
- uchar *ssl=screen->scan_line(y)+x;
|
|
+ uint8_t *isl=im->scan_line(ys)+xs;
|
|
+ uint8_t *ssl=screen->scan_line(y)+x;
|
|
int iw=im->width(),sw=screen->width();
|
|
|
|
for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
|
|
{
|
|
- uchar *s=ssl,*i=isl;
|
|
+ uint8_t *s=ssl,*i=isl;
|
|
for (int ix=xs;ix<xe;ix++,s++,i++)
|
|
{
|
|
if (*i)
|
|
@@ -49,7 +49,7 @@
|
|
|
|
|
|
/*
|
|
-void transp_put(image *im, image *screen, uchar *table, int x, int y)
|
|
+void transp_put(image *im, image *screen, uint8_t *table, int x, int y)
|
|
{
|
|
short cx1,cy1,cx2,cy2;
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
@@ -79,13 +79,13 @@
|
|
int ye=ys+yl;
|
|
int xe=xs+xl;
|
|
|
|
- uchar *isl=im->scan_line(ys)+xs;
|
|
- uchar *ssl=screen->scan_line(y)+x;
|
|
+ uint8_t *isl=im->scan_line(ys)+xs;
|
|
+ uint8_t *ssl=screen->scan_line(y)+x;
|
|
int iw=im->width(),sw=screen->width();
|
|
|
|
for (int iy=ys;iy<ye;iy++,y++,isl+=iw,ssl+=sw)
|
|
{
|
|
- uchar *s=ssl,*i=isl;
|
|
+ uint8_t *s=ssl,*i=isl;
|
|
for (int ix=xs;ix<xe;ix++,s++,i++)
|
|
*s=table[((*i)<<8)|(*s)];
|
|
}
|
|
Index: abuse-sdl-0.7.0/src/lisp.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/lisp.cpp 2006-06-21 15:02:33.000000000 +0200
|
|
+++ abuse-sdl-0.7.0/src/lisp.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -214,7 +214,7 @@
|
|
return ret;
|
|
}
|
|
|
|
-lisp_1d_array *new_lisp_1d_array(ushort size, void *rest)
|
|
+lisp_1d_array *new_lisp_1d_array(int size, void *rest)
|
|
{
|
|
p_ref r11(rest);
|
|
long s=sizeof(lisp_1d_array)+size*sizeof(void *);
|
|
@@ -263,7 +263,7 @@
|
|
return ((lisp_1d_array *)p);
|
|
}
|
|
|
|
-lisp_fixed_point *new_lisp_fixed_point(long x)
|
|
+lisp_fixed_point *new_lisp_fixed_point(int32_t x)
|
|
{
|
|
lisp_fixed_point *p=(lisp_fixed_point *)lmalloc(sizeof(lisp_fixed_point),current_space);
|
|
p->type=L_FIXED_POINT;
|
|
@@ -272,7 +272,7 @@
|
|
}
|
|
|
|
|
|
-lisp_object_var *new_lisp_object_var(short number)
|
|
+lisp_object_var *new_lisp_object_var(int16_t number)
|
|
{
|
|
lisp_object_var *p=(lisp_object_var *)lmalloc(sizeof(lisp_object_var),current_space);
|
|
p->type=L_OBJECT_VAR;
|
|
@@ -290,7 +290,7 @@
|
|
return p;
|
|
}
|
|
|
|
-struct lisp_character *new_lisp_character(unsigned short ch)
|
|
+struct lisp_character *new_lisp_character(uint16_t ch)
|
|
{
|
|
lisp_character *c=(lisp_character *)lmalloc(sizeof(lisp_character),current_space);
|
|
c->type=L_CHARACTER;
|
|
@@ -300,7 +300,7 @@
|
|
|
|
struct lisp_string *new_lisp_string(char *string)
|
|
{
|
|
- long size=sizeof(lisp_string)+strlen(string)+1;
|
|
+ int size=sizeof(lisp_string)+strlen(string)+1;
|
|
if (size<8) size=8;
|
|
|
|
lisp_string *s=(lisp_string *)lmalloc(size,current_space);
|
|
@@ -312,7 +312,7 @@
|
|
|
|
struct lisp_string *new_lisp_string(char *string, int length)
|
|
{
|
|
- long size=sizeof(lisp_string)+length+1;
|
|
+ int size=sizeof(lisp_string)+length+1;
|
|
if (size<8) size=8;
|
|
lisp_string *s=(lisp_string *)lmalloc(size,current_space);
|
|
s->type=L_STRING;
|
|
@@ -322,9 +322,9 @@
|
|
return s;
|
|
}
|
|
|
|
-struct lisp_string *new_lisp_string(long length)
|
|
+struct lisp_string *new_lisp_string(int length)
|
|
{
|
|
- long size=sizeof(lisp_string)+length;
|
|
+ int size=sizeof(lisp_string)+length;
|
|
if (size<8) size=8;
|
|
lisp_string *s=(lisp_string *)lmalloc(size,current_space);
|
|
s->type=L_STRING;
|
|
@@ -344,7 +344,7 @@
|
|
return lu;
|
|
}
|
|
#else
|
|
-lisp_user_function *new_lisp_user_function(long arg_list, long block_list)
|
|
+lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list)
|
|
{
|
|
int sp=current_space;
|
|
if (current_space!=GC_SPACE)
|
|
@@ -500,7 +500,7 @@
|
|
return ((lisp_pointer *)lpointer)->addr;
|
|
}
|
|
|
|
-long lnumber_value(void *lnumber)
|
|
+int32_t lnumber_value(void *lnumber)
|
|
{
|
|
switch (item_type(lnumber))
|
|
{
|
|
@@ -509,7 +509,7 @@
|
|
case L_FIXED_POINT :
|
|
return (((lisp_fixed_point *)lnumber)->x)>>16;
|
|
case L_STRING :
|
|
- return (uchar)*lstring_value(lnumber);
|
|
+ return (uint8_t)*lstring_value(lnumber);
|
|
case L_CHARACTER :
|
|
return lcharacter_value(lnumber);
|
|
default :
|
|
@@ -561,7 +561,7 @@
|
|
else return NULL;
|
|
}
|
|
|
|
-unsigned short lcharacter_value(void *c)
|
|
+uint16_t lcharacter_value(void *c)
|
|
{
|
|
#ifdef TYPE_CHECKING
|
|
if (item_type(c)!=L_CHARACTER)
|
|
@@ -933,7 +933,7 @@
|
|
}
|
|
if (l1!=0)
|
|
{
|
|
- void *first=NULL,*last=NULL,*cur=NULL;
|
|
+ void *first=NULL,*last=NULL,*cur=NULL,*tmp;
|
|
p_ref r1(first),r2(last),r3(cur);
|
|
while (list1)
|
|
{
|
|
@@ -944,8 +944,10 @@
|
|
last=cur;
|
|
|
|
cons_cell *cell=new_cons_cell();
|
|
- ((cons_cell *)cell)->car=lcar(list1);
|
|
- ((cons_cell *)cell)->cdr=lcar(list2);
|
|
+ tmp=lcar(list1);
|
|
+ ((cons_cell *)cell)->car=tmp;
|
|
+ tmp=lcar(list2);
|
|
+ ((cons_cell *)cell)->cdr=tmp;
|
|
((cons_cell *)cur)->car=cell;
|
|
|
|
list1=((cons_cell *)list1)->cdr;
|
|
@@ -1002,7 +1004,7 @@
|
|
return s;
|
|
}
|
|
|
|
-lisp_symbol *add_c_object(void *symbol, short number)
|
|
+lisp_symbol *add_c_object(void *symbol, int16_t number)
|
|
{
|
|
need_perm_space("add_c_object");
|
|
lisp_symbol *s=(lisp_symbol *)symbol;
|
|
@@ -1152,35 +1154,38 @@
|
|
return true_symbol;
|
|
else if (n[0]=='\'') // short hand for quote function
|
|
{
|
|
- void *cs=new_cons_cell(),*c2=NULL;
|
|
+ void *cs=new_cons_cell(),*c2=NULL,*tmp;
|
|
p_ref r1(cs),r2(c2);
|
|
|
|
((cons_cell *)cs)->car=quote_symbol;
|
|
c2=new_cons_cell();
|
|
- ((cons_cell *)c2)->car=compile(s);
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)c2)->car=tmp;
|
|
((cons_cell *)c2)->cdr=NULL;
|
|
((cons_cell *)cs)->cdr=c2;
|
|
ret=cs;
|
|
}
|
|
else if (n[0]=='`') // short hand for backquote function
|
|
{
|
|
- void *cs=new_cons_cell(),*c2=NULL;
|
|
+ void *cs=new_cons_cell(),*c2=NULL,*tmp;
|
|
p_ref r1(cs),r2(c2);
|
|
|
|
((cons_cell *)cs)->car=backquote_symbol;
|
|
c2=new_cons_cell();
|
|
- ((cons_cell *)c2)->car=compile(s);
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)c2)->car=tmp;
|
|
((cons_cell *)c2)->cdr=NULL;
|
|
((cons_cell *)cs)->cdr=c2;
|
|
ret=cs;
|
|
} else if (n[0]==',') // short hand for comma function
|
|
{
|
|
- void *cs=new_cons_cell(),*c2=NULL;
|
|
+ void *cs=new_cons_cell(),*c2=NULL,*tmp;
|
|
p_ref r1(cs),r2(c2);
|
|
|
|
((cons_cell *)cs)->car=comma_symbol;
|
|
c2=new_cons_cell();
|
|
- ((cons_cell *)c2)->car=compile(s);
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)c2)->car=tmp;
|
|
((cons_cell *)c2)->cdr=NULL;
|
|
((cons_cell *)cs)->cdr=c2;
|
|
ret=cs;
|
|
@@ -1208,18 +1213,22 @@
|
|
lerror(s,"token '.' not allowed here\n");
|
|
else
|
|
{
|
|
+ void *tmp;
|
|
read_ltoken(s,n); // skip the '.'
|
|
- ((cons_cell *)last)->cdr=compile(s); // link the last cdr to
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)last)->cdr=tmp; // link the last cdr to
|
|
last=NULL;
|
|
}
|
|
} else if (!last && first)
|
|
lerror(s,"illegal end of dotted list\n");
|
|
else
|
|
{
|
|
+ void *tmp;
|
|
cur=new_cons_cell();
|
|
p_ref r1(cur);
|
|
if (!first) first=cur;
|
|
- ((cons_cell *)cur)->car=compile(s);
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)cur)->car=tmp;
|
|
if (last)
|
|
((cons_cell *)last)->cdr=cur;
|
|
last=cur;
|
|
@@ -1267,11 +1276,13 @@
|
|
}
|
|
else if (n[1]==0) // short hand for function
|
|
{
|
|
- void *cs=new_cons_cell(),*c2=NULL;
|
|
+ void *cs=new_cons_cell(),*c2=NULL,*tmp;
|
|
p_ref r4(cs),r5(c2);
|
|
- ((cons_cell *)cs)->car=make_find_symbol("function");
|
|
+ tmp=make_find_symbol("function");
|
|
+ ((cons_cell *)cs)->car=tmp;
|
|
c2=new_cons_cell();
|
|
- ((cons_cell *)c2)->car=compile(s);
|
|
+ tmp=compile(s);
|
|
+ ((cons_cell *)c2)->car=tmp;
|
|
((cons_cell *)cs)->cdr=c2;
|
|
ret=cs;
|
|
}
|
|
@@ -1280,7 +1291,9 @@
|
|
lbreak("Unknown #\\ notation : %s\n",n);
|
|
exit(0);
|
|
}
|
|
- } else return make_find_symbol(n);
|
|
+ } else {
|
|
+ ret = make_find_symbol(n);
|
|
+ }
|
|
return ret;
|
|
}
|
|
|
|
@@ -1295,16 +1308,16 @@
|
|
{
|
|
s++;
|
|
if (*s=='n')
|
|
- current_print_file->write_byte('\n');
|
|
+ current_print_file->write_uint8('\n');
|
|
else if (*s=='r')
|
|
- current_print_file->write_byte('\r');
|
|
+ current_print_file->write_uint8('\r');
|
|
else if (*s=='t')
|
|
- current_print_file->write_byte('\t');
|
|
+ current_print_file->write_uint8('\t');
|
|
else if (*s=='\\')
|
|
- current_print_file->write_byte('\\');
|
|
+ current_print_file->write_uint8('\\');
|
|
}
|
|
else*/
|
|
- current_print_file->write_byte(*s);
|
|
+ current_print_file->write_uint8(*s);
|
|
}
|
|
}
|
|
else
|
|
@@ -1392,11 +1405,11 @@
|
|
{
|
|
if (current_print_file)
|
|
{
|
|
- uchar ch=((lisp_character *)i)->ch;
|
|
+ uint8_t ch=((lisp_character *)i)->ch;
|
|
current_print_file->write(&ch,1);
|
|
} else
|
|
{
|
|
- unsigned short ch=((lisp_character *)i)->ch;
|
|
+ uint16_t ch=((lisp_character *)i)->ch;
|
|
dprintf("#\\");
|
|
switch (ch)
|
|
{
|
|
@@ -1528,13 +1541,15 @@
|
|
} break;
|
|
case L_C_FUNCTION :
|
|
{
|
|
- void *first=NULL,*cur=NULL;
|
|
+ void *first=NULL,*cur=NULL,*tmp;
|
|
p_ref r1(first),r2(cur);
|
|
while (arg_list)
|
|
{
|
|
- if (first)
|
|
- cur=((cons_cell *)cur)->cdr=new_cons_cell();
|
|
- else
|
|
+ if (first) {
|
|
+ tmp=new_cons_cell();
|
|
+ ((cons_cell *)cur)->cdr=tmp;
|
|
+ cur=tmp;
|
|
+ } else
|
|
cur=first=new_cons_cell();
|
|
|
|
void *val=eval(CAR(arg_list));
|
|
@@ -1545,13 +1560,15 @@
|
|
} break;
|
|
case L_C_BOOL :
|
|
{
|
|
- void *first=NULL,*cur=NULL;
|
|
+ void *first=NULL,*cur=NULL,*tmp;
|
|
p_ref r1(first),r2(cur);
|
|
while (arg_list)
|
|
{
|
|
- if (first)
|
|
- cur=((cons_cell *)cur)->cdr=new_cons_cell();
|
|
- else
|
|
+ if (first) {
|
|
+ tmp=new_cons_cell();
|
|
+ ((cons_cell *)cur)->cdr=tmp;
|
|
+ cur=tmp;
|
|
+ } else
|
|
cur=first=new_cons_cell();
|
|
|
|
void *val=eval(CAR(arg_list));
|
|
@@ -1564,7 +1581,7 @@
|
|
else ret=NULL;
|
|
} break;
|
|
default :
|
|
- fprintf(stderr,"not a fun, sholdn't happed\n");
|
|
+ fprintf(stderr,"not a fun, shouldn't happen\n");
|
|
}
|
|
|
|
#ifdef L_PROFILE
|
|
@@ -1783,7 +1800,7 @@
|
|
return eval(CAR(CDR(args)));
|
|
else
|
|
{
|
|
- void *first=NULL,*last=NULL,*cur=NULL;
|
|
+ void *first=NULL,*last=NULL,*cur=NULL,*tmp;
|
|
p_ref ref1(first),ref2(last),ref3(cur),ref4(args);
|
|
while (args)
|
|
{
|
|
@@ -1791,7 +1808,8 @@
|
|
{
|
|
if (CAR(args)==comma_symbol) // dot list with a comma?
|
|
{
|
|
- ((cons_cell *)last)->cdr=eval(CAR(CDR(args)));
|
|
+ tmp=eval(CAR(CDR(args)));
|
|
+ ((cons_cell *)last)->cdr=tmp;
|
|
args=NULL;
|
|
}
|
|
else
|
|
@@ -1802,12 +1820,14 @@
|
|
else
|
|
first=cur;
|
|
last=cur;
|
|
- ((cons_cell *)cur)->car=backquote_eval(CAR(args));
|
|
+ tmp=backquote_eval(CAR(args));
|
|
+ ((cons_cell *)cur)->car=tmp;
|
|
args=CDR(args);
|
|
}
|
|
} else
|
|
{
|
|
- ((cons_cell *)last)->cdr=backquote_eval(args);
|
|
+ tmp=backquote_eval(args);
|
|
+ ((cons_cell *)last)->cdr=tmp;
|
|
args=NULL;
|
|
}
|
|
|
|
@@ -2107,7 +2127,7 @@
|
|
|
|
while (var_list)
|
|
{
|
|
- void *var_name=CAR(CAR(var_list));
|
|
+ void *var_name=CAR(CAR(var_list)),*tmp;
|
|
#ifdef TYPE_CHECKING
|
|
if (item_type(var_name)!=L_SYMBOL)
|
|
{
|
|
@@ -2118,7 +2138,8 @@
|
|
#endif
|
|
|
|
l_user_stack.push(((lisp_symbol *)var_name)->value);
|
|
- ((lisp_symbol *)var_name)->value=eval(CAR(CDR(CAR(var_list))));
|
|
+ tmp=eval(CAR(CDR(CAR(var_list))));
|
|
+ ((lisp_symbol *)var_name)->value=tmp;
|
|
var_list=CDR(var_list);
|
|
}
|
|
|
|
@@ -2162,8 +2183,8 @@
|
|
void *block_list=CDR(CDR(arg_list));
|
|
|
|
#ifndef NO_LIBS
|
|
- long a=cash.reg_lisp_block(lcar(lcdr(arg_list)));
|
|
- long b=cash.reg_lisp_block(block_list);
|
|
+ intptr_t a=cash.reg_lisp_block(lcar(lcdr(arg_list)));
|
|
+ intptr_t b=cash.reg_lisp_block(block_list);
|
|
lisp_user_function *ufun=new_lisp_user_function(a,b);
|
|
#else
|
|
lisp_user_function *ufun=new_lisp_user_function(lcar(lcdr(arg_list)),block_list);
|
|
@@ -2378,8 +2399,8 @@
|
|
if( strcmp( st, "gamma.lsp" ) == 0 )
|
|
{
|
|
char *gammapath;
|
|
- gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 10, "gammapath" );
|
|
- sprintf( gammapath, "%sgamma.lsp\0", get_save_filename_prefix() );
|
|
+ gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "gammapath" );
|
|
+ sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
|
|
fp = new jFILE( gammapath, "rb" );
|
|
jfree( gammapath );
|
|
}
|
|
@@ -2788,8 +2809,8 @@
|
|
else return NULL; } break;
|
|
case 85 : // num2str
|
|
{
|
|
- char str[10];
|
|
- sprintf(str,"%ld",lnumber_value(eval(CAR(arg_list))));
|
|
+ char str[20];
|
|
+ sprintf(str,"%ld",(long int)lnumber_value(eval(CAR(arg_list))));
|
|
ret=new_lisp_string(str);
|
|
} break;
|
|
case 86 : // nconc
|
|
@@ -2941,7 +2962,8 @@
|
|
p_ref r19(arg_list);
|
|
for (;f_arg;f_arg=CDR(f_arg))
|
|
{
|
|
- l_user_stack.push(((lisp_symbol *)CAR(f_arg))->value);
|
|
+ lisp_symbol *s = (lisp_symbol *)CAR(f_arg);
|
|
+ l_user_stack.push(s->value);
|
|
}
|
|
|
|
// open block so that local vars aren't saved on the stack
|
|
Index: abuse-sdl-0.7.0/src/view.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/view.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/view.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -36,7 +36,7 @@
|
|
}
|
|
|
|
|
|
-extern uchar bright_tint[256];
|
|
+extern uint8_t bright_tint[256];
|
|
|
|
void view::add_ammo(int weapon_type, int total)
|
|
{
|
|
@@ -95,7 +95,7 @@
|
|
}
|
|
|
|
|
|
-long view::xoff()
|
|
+int32_t view::xoff()
|
|
{
|
|
if (focus)
|
|
{
|
|
@@ -105,7 +105,7 @@
|
|
} else return pan_x;
|
|
}
|
|
|
|
-long view::interpolated_xoff()
|
|
+int32_t view::interpolated_xoff()
|
|
{
|
|
if (focus)
|
|
{
|
|
@@ -116,7 +116,7 @@
|
|
}
|
|
|
|
|
|
-long view::yoff()
|
|
+int32_t view::yoff()
|
|
{
|
|
if (focus)
|
|
{
|
|
@@ -127,7 +127,7 @@
|
|
}
|
|
|
|
|
|
-long view::interpolated_yoff()
|
|
+int32_t view::interpolated_yoff()
|
|
{
|
|
if (focus)
|
|
{
|
|
@@ -248,10 +248,10 @@
|
|
|
|
if (total_weapons)
|
|
{
|
|
- weapons=(long *)jmalloc(total_weapons*sizeof(long),"weapon array");
|
|
- last_weapons=(long *)jmalloc(total_weapons*sizeof(long),"last weapon array");
|
|
- memset(weapons,0xff,total_weapons*sizeof(long)); // set all to -1
|
|
- memset(last_weapons,0xff,total_weapons*sizeof(long)); // set all to -1
|
|
+ weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"weapon array");
|
|
+ last_weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"last weapon array");
|
|
+ memset(weapons,0xff,total_weapons*sizeof(int32_t)); // set all to -1
|
|
+ memset(last_weapons,0xff,total_weapons*sizeof(int32_t)); // set all to -1
|
|
}
|
|
|
|
if (total_weapons)
|
|
@@ -261,7 +261,7 @@
|
|
sbar.need_refresh();
|
|
}
|
|
|
|
-long view::x_center()
|
|
+int32_t view::x_center()
|
|
{
|
|
if (!focus)
|
|
return (cx1+cx2)/2;
|
|
@@ -269,7 +269,7 @@
|
|
return focus->x;
|
|
}
|
|
|
|
-long view::y_center()
|
|
+int32_t view::y_center()
|
|
{
|
|
if (!focus)
|
|
return (cy1+cy2)/2;
|
|
@@ -294,9 +294,9 @@
|
|
|
|
|
|
|
|
-ushort make_sync()
|
|
+uint16_t make_sync()
|
|
{
|
|
- ushort x=0;
|
|
+ uint16_t x=0;
|
|
if (!current_level) return 0;
|
|
if (current_level)
|
|
{
|
|
@@ -320,7 +320,7 @@
|
|
void view::get_input()
|
|
{
|
|
int sug_x,sug_y,sug_b1,sug_b2,sug_b3,sug_b4;
|
|
- long sug_px,sug_py;
|
|
+ int32_t sug_px,sug_py;
|
|
|
|
// NOTE:(AK) I have commented this out so we don't use the lisp
|
|
// file "input.lsp" to get our key mappings.
|
|
@@ -351,9 +351,9 @@
|
|
sug_b4 = 1;
|
|
else sug_b4 = 0;
|
|
|
|
- long bx = lnumber_value( CAR( ret ) );
|
|
+ int32_t bx = lnumber_value( CAR( ret ) );
|
|
ret = CDR( ret );
|
|
- long by = lnumber_value( CAR( ret ) );
|
|
+ int32_t by = lnumber_value( CAR( ret ) );
|
|
ret = CDR( ret );
|
|
the_game->mouse_to_game( bx, by, sug_px, sug_py, this );
|
|
|
|
@@ -375,30 +375,30 @@
|
|
|
|
if( view_changed() )
|
|
{
|
|
- base->packet.write_byte( SCMD_VIEW_RESIZE );
|
|
- base->packet.write_byte( player_number );
|
|
- base->packet.write_long( suggest.cx1 );
|
|
- base->packet.write_long( suggest.cy1 );
|
|
- base->packet.write_long( suggest.cx2 );
|
|
- base->packet.write_long( suggest.cy2 );
|
|
-
|
|
- base->packet.write_long( suggest.pan_x );
|
|
- base->packet.write_long( suggest.pan_y );
|
|
- base->packet.write_long( suggest.shift_down );
|
|
- base->packet.write_long( suggest.shift_right );
|
|
+ base->packet.write_uint8( SCMD_VIEW_RESIZE );
|
|
+ base->packet.write_uint8( player_number );
|
|
+ base->packet.write_uint32( suggest.cx1 );
|
|
+ base->packet.write_uint32( suggest.cy1 );
|
|
+ base->packet.write_uint32( suggest.cx2 );
|
|
+ base->packet.write_uint32( suggest.cy2 );
|
|
+
|
|
+ base->packet.write_uint32( suggest.pan_x );
|
|
+ base->packet.write_uint32( suggest.pan_y );
|
|
+ base->packet.write_uint32( suggest.shift_down );
|
|
+ base->packet.write_uint32( suggest.shift_right );
|
|
}
|
|
|
|
if( weapon_changed() )
|
|
{
|
|
- base->packet.write_byte( SCMD_WEAPON_CHANGE );
|
|
- base->packet.write_byte( player_number );
|
|
- base->packet.write_long( suggest.new_weapon );
|
|
+ base->packet.write_uint8( SCMD_WEAPON_CHANGE );
|
|
+ base->packet.write_uint8( player_number );
|
|
+ base->packet.write_uint32( suggest.new_weapon );
|
|
}
|
|
|
|
- base->packet.write_byte( SCMD_SET_INPUT );
|
|
- base->packet.write_byte( player_number );
|
|
+ base->packet.write_uint8( SCMD_SET_INPUT );
|
|
+ base->packet.write_uint8( player_number );
|
|
|
|
- uchar mflags = 0;
|
|
+ uint8_t mflags = 0;
|
|
if( sug_x > 0 )
|
|
mflags |= 1;
|
|
else if ( sug_x < 0 )
|
|
@@ -418,9 +418,9 @@
|
|
if( sug_b4 )
|
|
mflags |= 128;
|
|
|
|
- base->packet.write_byte( mflags );
|
|
- base->packet.write_short((ushort)((short)sug_px));
|
|
- base->packet.write_short((ushort)((short)sug_py));
|
|
+ base->packet.write_uint8( mflags );
|
|
+ base->packet.write_uint16((uint16_t)((int16_t)sug_px));
|
|
+ base->packet.write_uint16((uint16_t)((int16_t)sug_py));
|
|
}
|
|
|
|
|
|
@@ -469,7 +469,7 @@
|
|
}
|
|
}
|
|
|
|
-int view::process_input(char cmd, uchar *&pk) // return 0 if something went wrong
|
|
+int view::process_input(char cmd, uint8_t *&pk) // return 0 if something went wrong
|
|
{
|
|
switch (cmd)
|
|
{
|
|
@@ -479,7 +479,7 @@
|
|
} break;
|
|
case SCMD_VIEW_RESIZE :
|
|
{
|
|
- long x[8];
|
|
+ int32_t x[8];
|
|
memcpy(x,pk,8*4); pk+=8*4;
|
|
cx1=lltl(x[0]);
|
|
cy1=lltl(x[1]);
|
|
@@ -502,7 +502,7 @@
|
|
}
|
|
case SCMD_WEAPON_CHANGE :
|
|
{
|
|
- long x;
|
|
+ int32_t x;
|
|
memcpy(&x,pk,4); pk+=4;
|
|
current_weapon=lltl(x);
|
|
|
|
@@ -514,7 +514,7 @@
|
|
|
|
case SCMD_SET_INPUT :
|
|
{
|
|
- uchar x=*(pk++);
|
|
+ uint8_t x=*(pk++);
|
|
|
|
if (x&1) x_suggestion=1;
|
|
else if (x&2) x_suggestion=-1;
|
|
@@ -529,11 +529,11 @@
|
|
if (x&64) b3_suggestion=1; else b3_suggestion=0;
|
|
if (x&128) b4_suggestion=1; else b4_suggestion=0;
|
|
|
|
- ushort p[2];
|
|
+ uint16_t p[2];
|
|
memcpy(p,pk,2*2); pk+=2*2;
|
|
|
|
- pointer_x=(short)(lstl(p[0]));
|
|
- pointer_y=(short)(lstl(p[1]));
|
|
+ pointer_x=(int16_t)(lstl(p[0]));
|
|
+ pointer_y=(int16_t)(lstl(p[1]));
|
|
|
|
return 1;
|
|
} break;
|
|
@@ -817,7 +817,7 @@
|
|
}
|
|
|
|
|
|
-void view::resize_view(long Cx1, long Cy1, long Cx2, long Cy2)
|
|
+void view::resize_view(int32_t Cx1, int32_t Cy1, int32_t Cx2, int32_t Cy2)
|
|
{
|
|
if (cx1!=Cx1 || cx2!=Cx2 || cy1!=Cy1 || cy2!=Cy2)
|
|
{
|
|
@@ -857,8 +857,8 @@
|
|
dprintf("reset position to %d %d\n",start->x,start->y);
|
|
}
|
|
focus->set_state(stopped);
|
|
- memset(weapons,0xff,total_weapons*sizeof(long));
|
|
- memset(last_weapons,0xff,total_weapons*sizeof(long));
|
|
+ memset(weapons,0xff,total_weapons*sizeof(int32_t));
|
|
+ memset(last_weapons,0xff,total_weapons*sizeof(int32_t));
|
|
|
|
shift_down=SHIFT_DOWN_DEFAULT;
|
|
shift_right=SHIFT_RIGHT_DEFAULT;
|
|
@@ -979,7 +979,7 @@
|
|
char *get_view_var_name(int num)
|
|
{ return vv_names[num]; }
|
|
|
|
-long view::get_view_var_value(int num)
|
|
+int32_t view::get_view_var_value(int num)
|
|
{
|
|
switch (num)
|
|
{
|
|
@@ -1034,7 +1034,7 @@
|
|
|
|
|
|
|
|
-long view::set_view_var_value(int num, long x)
|
|
+int32_t view::set_view_var_value(int num, int32_t x)
|
|
{
|
|
switch (num)
|
|
{
|
|
@@ -1144,14 +1144,14 @@
|
|
}
|
|
|
|
|
|
-void process_packet_commands(uchar *pk, int size)
|
|
+void process_packet_commands(uint8_t *pk, int size)
|
|
{
|
|
- long sync_short=-1;
|
|
+ int32_t sync_uint16=-1;
|
|
|
|
if (!size) return ;
|
|
pk[size]=SCMD_END_OF_PACKET;
|
|
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
int already_reloaded=0;
|
|
|
|
|
|
@@ -1169,7 +1169,7 @@
|
|
case SCMD_EXT_KEYRELEASE :
|
|
case SCMD_CHAT_KEYPRESS :
|
|
{
|
|
- uchar player_num=*(pk++);
|
|
+ uint8_t player_num=*(pk++);
|
|
|
|
view *v=player_list;
|
|
for (;v && v->player_number!=player_num;v=v->next);
|
|
@@ -1195,17 +1195,17 @@
|
|
|
|
case SCMD_SYNC :
|
|
{
|
|
- ushort x;
|
|
+ uint16_t x;
|
|
memcpy(&x,pk,2); pk+=2;
|
|
x=lstl(x);
|
|
if (demo_man.current_state()==demo_manager::PLAYING)
|
|
- sync_short=make_sync();
|
|
+ sync_uint16=make_sync();
|
|
|
|
- if (sync_short==-1)
|
|
- sync_short=x;
|
|
- else if (x!=sync_short && !already_reloaded)
|
|
+ if (sync_uint16==-1)
|
|
+ sync_uint16=x;
|
|
+ else if (x!=sync_uint16 && !already_reloaded)
|
|
{
|
|
- dprintf("out of sync %d (packet=%d, calced=%d)\n",current_level->tick_counter(),x,sync_short);
|
|
+ dprintf("out of sync %d (packet=%d, calced=%d)\n",current_level->tick_counter(),x,sync_uint16);
|
|
if (demo_man.current_state()==demo_manager::NORMAL)
|
|
net_reload();
|
|
already_reloaded=1;
|
|
@@ -1213,7 +1213,7 @@
|
|
} break;
|
|
case SCMD_DELETE_CLIENT :
|
|
{
|
|
- uchar player_num=*(pk++);
|
|
+ uint8_t player_num=*(pk++);
|
|
view *v=player_list,*last=NULL;
|
|
for (;v && v->player_number!=player_num;v=v->next)
|
|
last=v;
|
|
Index: abuse-sdl-0.7.0/src/old.nfclient.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/old.nfclient.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/old.nfclient.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -18,7 +18,7 @@
|
|
virtual int unbuffered_read(void *buf, size_t count); // returns number of bytes read
|
|
int new_read(void *buf, size_t count); // returns number of bytes read
|
|
virtual int unbuffered_write(void *buf, size_t count); // returns number of bytes written
|
|
- virtual int unbuffered_seek(long offset, int whence); // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
|
|
+ virtual int unbuffered_seek(int32_t offset, int whence); // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
|
|
virtual int unbuffered_tell();
|
|
virtual int file_size();
|
|
virtual ~nfs_file();
|
|
@@ -79,21 +79,21 @@
|
|
{
|
|
delete local_test;
|
|
local_test=NULL;
|
|
- pk.write_byte(NFS_OPEN);
|
|
+ pk.write_uint8(NFS_OPEN);
|
|
}
|
|
else
|
|
{
|
|
- pk.write_byte(NFS_CRC_OPEN);
|
|
+ pk.write_uint8(NFS_CRC_OPEN);
|
|
int fail;
|
|
- ulong crc=crc_man.get_crc(crc_man.get_filenumber(filename),fail); // skip crc calc if we can
|
|
+ uint32_t crc=crc_man.get_crc(crc_man.get_filenumber(filename),fail); // skip crc calc if we can
|
|
if (fail) crc=crc_file(local_test);
|
|
- pk.write_long(crc);
|
|
+ pk.write_uint32(crc);
|
|
}
|
|
|
|
- pk.write_byte(strlen(filename)+1);
|
|
- pk.write((uchar *)filename,strlen(filename)+1);
|
|
- pk.write_byte(strlen(mode)+1);
|
|
- pk.write((uchar *)mode,strlen(mode)+1);
|
|
+ pk.write_uint8(strlen(filename)+1);
|
|
+ pk.write((uint8_t *)filename,strlen(filename)+1);
|
|
+ pk.write_uint8(strlen(mode)+1);
|
|
+ pk.write((uint8_t *)mode,strlen(mode)+1);
|
|
dprintf("try open %s,%s\n",filename,mode);
|
|
offset=0;
|
|
if (!nfs_server->send(pk))
|
|
@@ -103,8 +103,8 @@
|
|
if (!nfs_server->get(pk)) nfs_disconnect();
|
|
else
|
|
{
|
|
- long fd;
|
|
- if (pk.read((uchar *)&fd,4)!=4)
|
|
+ int32_t fd;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4)
|
|
nfs_disconnect();
|
|
else
|
|
{
|
|
@@ -150,9 +150,9 @@
|
|
else
|
|
{
|
|
packet pk;
|
|
- pk.write_byte(NFS_READ);
|
|
- pk.write_long(nfs_fd);
|
|
- pk.write_long(count);
|
|
+ pk.write_uint8(NFS_READ);
|
|
+ pk.write_uint32(nfs_fd);
|
|
+ pk.write_uint32(count);
|
|
dprintf("try read %d,%d\n",nfs_fd,count);
|
|
if (!nfs_server->send(pk))
|
|
{
|
|
@@ -164,13 +164,13 @@
|
|
|
|
int fail=0;
|
|
int rtotal=0;
|
|
- ushort size=1;
|
|
+ uint16_t size=1;
|
|
while (count>0 && !fail && size)
|
|
{
|
|
if (!nfs_server->get(pk)) fail=1;
|
|
else
|
|
{
|
|
- if (pk.read((uchar *)&size,2)!=2) fail=1;
|
|
+ if (pk.read((uint8_t *)&size,2)!=2) fail=1;
|
|
else
|
|
{
|
|
size=lstl(size);
|
|
@@ -179,7 +179,7 @@
|
|
{
|
|
int need_size=size>count ? count : size;
|
|
|
|
- if (pk.read((uchar *)buf,need_size)!=need_size) fail=1;
|
|
+ if (pk.read((uint8_t *)buf,need_size)!=need_size) fail=1;
|
|
else
|
|
{
|
|
count-=need_size;
|
|
@@ -218,18 +218,18 @@
|
|
}
|
|
|
|
|
|
-int nfs_file::unbuffered_seek(long off, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
|
|
+int nfs_file::unbuffered_seek(int32_t off, int whence) // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
|
|
{
|
|
if (local)
|
|
return local->seek(off,whence);
|
|
else
|
|
{
|
|
packet pk;
|
|
- pk.write_byte(NFS_SEEK);
|
|
- pk.write_long(nfs_fd);
|
|
+ pk.write_uint8(NFS_SEEK);
|
|
+ pk.write_uint32(nfs_fd);
|
|
|
|
- pk.write_long(off);
|
|
- pk.write_long(whence);
|
|
+ pk.write_uint32(off);
|
|
+ pk.write_uint32(whence);
|
|
dprintf("seek %d %d %d\n",nfs_fd,off,whence);
|
|
if (!nfs_server->send(pk))
|
|
{
|
|
@@ -248,8 +248,8 @@
|
|
else if (nfs_server)
|
|
{
|
|
packet pk;
|
|
- pk.write_byte(NFS_TELL);
|
|
- pk.write_long(nfs_fd);
|
|
+ pk.write_uint8(NFS_TELL);
|
|
+ pk.write_uint32(nfs_fd);
|
|
if (!nfs_server->send(pk))
|
|
{
|
|
nfs_disconnect();
|
|
@@ -262,8 +262,8 @@
|
|
return 0;
|
|
} else
|
|
{
|
|
- long off;
|
|
- if (pk.read((uchar *)&off,4)!=4)
|
|
+ int32_t off;
|
|
+ if (pk.read((uint8_t *)&off,4)!=4)
|
|
{
|
|
dprintf("Disconnected on tell()\n");
|
|
nfs_disconnect();
|
|
@@ -283,8 +283,8 @@
|
|
else if (nfs_server)
|
|
{
|
|
packet pk;
|
|
- pk.write_byte(NFS_FILESIZE);
|
|
- pk.write_long(nfs_fd);
|
|
+ pk.write_uint8(NFS_FILESIZE);
|
|
+ pk.write_uint32(nfs_fd);
|
|
if (!nfs_server->send(pk))
|
|
{
|
|
nfs_disconnect();
|
|
@@ -297,8 +297,8 @@
|
|
return 0;
|
|
} else
|
|
{
|
|
- long size;
|
|
- if (pk.read((uchar *)&size,4)!=4)
|
|
+ int32_t size;
|
|
+ if (pk.read((uint8_t *)&size,4)!=4)
|
|
{
|
|
dprintf("disconnected on filesize\n");
|
|
nfs_disconnect();
|
|
@@ -317,8 +317,8 @@
|
|
else if (nfs_server && !open_failure())
|
|
{
|
|
packet pk;
|
|
- pk.write_byte(NFS_CLOSE);
|
|
- pk.write_long(nfs_fd);
|
|
+ pk.write_uint8(NFS_CLOSE);
|
|
+ pk.write_uint32(nfs_fd);
|
|
dprintf("close %d\n",nfs_fd);
|
|
if (!nfs_server->send(pk))
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/director.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/director.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/director.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -24,7 +24,7 @@
|
|
|
|
|
|
|
|
-int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uchar *cmap, char color)
|
|
+int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color)
|
|
{
|
|
short cx1,cy1,cx2,cy2,word_size,word_len;
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
Index: abuse-sdl-0.7.0/src/dev.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/dev.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/dev.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -275,7 +275,7 @@
|
|
}
|
|
|
|
|
|
-long dev_controll::snap_x(long x)
|
|
+int32_t dev_controll::snap_x(int32_t x)
|
|
{
|
|
if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
|
|
return x-(x%the_game->ftile_width());
|
|
@@ -284,7 +284,7 @@
|
|
else return x;
|
|
}
|
|
|
|
-long dev_controll::snap_y(long y)
|
|
+int32_t dev_controll::snap_y(int32_t y)
|
|
{
|
|
if (eh->key_pressed(JK_CTRL_L) || eh->key_pressed(JK_CTRL_R))
|
|
return y-(y%the_game->ftile_height())-1;
|
|
@@ -340,7 +340,7 @@
|
|
void scale_put(image *im, image *screen, int x, int y, short new_width, short new_height)
|
|
{
|
|
unsigned char *sl1,*sl2;
|
|
- long xstep=(im->width()<<16)/new_width,
|
|
+ int32_t xstep=(im->width()<<16)/new_width,
|
|
ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
|
|
screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
|
|
|
|
@@ -379,7 +379,7 @@
|
|
void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height)
|
|
{
|
|
unsigned char *sl1,*sl2;
|
|
- long xstep=(im->width()<<16)/new_width,
|
|
+ int32_t xstep=(im->width()<<16)/new_width,
|
|
ystep=(im->height()<<16)/new_height,iy,ix,sx,ix_start,iy_start;
|
|
screen->add_dirty(x,y,x+new_width-1,y+new_height-1);
|
|
|
|
@@ -404,7 +404,7 @@
|
|
if (y+new_height>cy2)
|
|
new_height-=y+new_height-cy2;
|
|
|
|
- uchar d;
|
|
+ uint8_t d;
|
|
for (iy=iy_start;new_height>0;new_height--,y++,iy+=ystep)
|
|
{
|
|
sl1=im->scan_line(iy>>16);
|
|
@@ -437,10 +437,10 @@
|
|
|
|
void dev_controll::dev_draw(view *v)
|
|
{
|
|
- long x1,y1,x2,y2;
|
|
+ int32_t x1,y1,x2,y2;
|
|
if (dev&EDIT_MODE)
|
|
{
|
|
- long vx=v->xoff(),vy=v->yoff();
|
|
+ int32_t vx=v->xoff(),vy=v->yoff();
|
|
|
|
if (dev&DRAW_LINKS)
|
|
{
|
|
@@ -458,7 +458,7 @@
|
|
|
|
if (link_object)
|
|
{
|
|
- long rx1,ry1;
|
|
+ int32_t rx1,ry1;
|
|
the_game->game_to_mouse(link_object->x,link_object->y,v,rx1,ry1);
|
|
screen->line(rx1,ry1,dlastx,dlasty,yellow);
|
|
}
|
|
@@ -467,7 +467,7 @@
|
|
{
|
|
image *i=cash.img(light_buttons[0]);
|
|
int l=i->width()/2,h=i->height()/2;
|
|
- long rx1,ry1;
|
|
+ int32_t rx1,ry1;
|
|
the_game->game_to_mouse(selected_light->x,selected_light->y,v,rx1,ry1);
|
|
screen->rectangle(rx1-l,ry1-h,rx1+l,ry1+h,eh->bright_color());
|
|
}
|
|
@@ -509,7 +509,7 @@
|
|
if (selected_object)
|
|
{
|
|
selected_object->picture_space(x1,y1,x2,y2);
|
|
- long rx1,ry1,rx2,ry2;
|
|
+ int32_t rx1,ry1,rx2,ry2;
|
|
the_game->game_to_mouse(x1,y1,v,rx1,ry1);
|
|
the_game->game_to_mouse(x2,y2,v,rx2,ry2);
|
|
screen->rectangle(rx1,ry1,rx2,ry2,eh->bright_color());
|
|
@@ -529,7 +529,7 @@
|
|
update_memprof();
|
|
}
|
|
|
|
-light_source *find_light(long x, long y)
|
|
+light_source *find_light(int32_t x, int32_t y)
|
|
{
|
|
image *i=cash.img(light_buttons[0]);
|
|
int l=i->width()/2,h=i->height()/2;
|
|
@@ -567,7 +567,7 @@
|
|
jfree(st);
|
|
jfree(ch);
|
|
char buf[100];
|
|
- sprintf(buf,"%8ld %8ld",j_allocated(),j_available());
|
|
+ sprintf(buf,"%8ld %8ld",(long int)j_allocated(),(long int)j_available());
|
|
eh->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-eh->font()->height(),buf);
|
|
|
|
}
|
|
@@ -1030,11 +1030,11 @@
|
|
if (current_level && player_list && player_list->focus)
|
|
{
|
|
edit_object=selected_object=NULL;
|
|
- long cx=player_list->focus->x,cy=player_list->focus->y;
|
|
+ int32_t cx=player_list->focus->x,cy=player_list->focus->y;
|
|
|
|
// save the old weapon array
|
|
- long *w=(long *)jmalloc(total_weapons*sizeof(long),"tmp weapon array");
|
|
- memcpy(w,player_list->weapons,total_weapons*sizeof(long));
|
|
+ int32_t *w=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"tmp weapon array");
|
|
+ memcpy(w,player_list->weapons,total_weapons*sizeof(int32_t));
|
|
|
|
char tmp[100];
|
|
strcpy(tmp,current_level->name());
|
|
@@ -1047,7 +1047,7 @@
|
|
player_list->focus->x=cx;
|
|
player_list->focus->y=cy;
|
|
|
|
- memcpy(player_list->weapons,w,total_weapons*sizeof(long));
|
|
+ memcpy(player_list->weapons,w,total_weapons*sizeof(int32_t));
|
|
jfree(w);
|
|
|
|
the_game->need_refresh();
|
|
@@ -1056,7 +1056,7 @@
|
|
|
|
if (!strcmp(fword,"unchop"))
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->btile_on(dlastx,dlasty,rx,ry);
|
|
if (rx>=0 && ry>=0)
|
|
{
|
|
@@ -1178,7 +1178,7 @@
|
|
|
|
if (t>=0) // did we find it?
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->mouse_to_game(dlastx,dlasty,rx,ry);
|
|
edit_object=create(t,rx,ry);
|
|
current_level->add_object(edit_object);
|
|
@@ -1215,7 +1215,7 @@
|
|
|
|
if (!strcmp(fword,"clear_auto"))
|
|
{
|
|
- long i,j;
|
|
+ int32_t i,j;
|
|
for (i=0;i<current_level->foreground_width();i++)
|
|
for (j=0;j<current_level->foreground_height();j++)
|
|
current_level->clear_fg(i,j);
|
|
@@ -1223,7 +1223,7 @@
|
|
|
|
if (!strcmp(fword,"fg_select"))
|
|
{
|
|
- long x,y;
|
|
+ int32_t x,y;
|
|
the_game->ftile_on(dlastx,dlasty,x,y);
|
|
if (x>=0 && y>=0 && x<current_level->foreground_width() &&
|
|
y<current_level->foreground_height())
|
|
@@ -1237,7 +1237,7 @@
|
|
|
|
if (!strcmp(fword,"toggle_fg_raise"))
|
|
{
|
|
- long x,y;
|
|
+ int32_t x,y;
|
|
the_game->ftile_on(dlastx,dlasty,x,y);
|
|
if (x>=0 && y>=0 && x<current_level->foreground_width() &&
|
|
y<current_level->foreground_height())
|
|
@@ -1486,7 +1486,7 @@
|
|
if (aiw)
|
|
{
|
|
game_object *o=ai_object;
|
|
- long x;
|
|
+ int32_t x;
|
|
if (o)
|
|
{
|
|
if (figures[o->otype]->total_fields)
|
|
@@ -1536,7 +1536,7 @@
|
|
|
|
if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
|
|
{
|
|
- long gx,gy;
|
|
+ int32_t gx,gy;
|
|
the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
|
|
if (!current_level) return ;
|
|
current_area=current_level->area_list=new area_controller(gx,gy,
|
|
@@ -1576,11 +1576,11 @@
|
|
if (!current_level) return;
|
|
if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button)
|
|
{
|
|
- long mx=last_demo_mx,my=last_demo_my;
|
|
+ int32_t mx=last_demo_mx,my=last_demo_my;
|
|
view *v=the_game->view_in(mx,my);
|
|
for (area_controller *a=current_level->area_list;a;a=a->next)
|
|
{
|
|
- long x1,y1,x2,y2;
|
|
+ int32_t x1,y1,x2,y2;
|
|
the_game->game_to_mouse(a->x,a->y,v,x1,y1);
|
|
the_game->game_to_mouse(a->x+a->w,a->y+a->h,v,x2,y2);
|
|
if (abs(x1-mx)<2 && abs(y1-my)<2)
|
|
@@ -1645,7 +1645,7 @@
|
|
|
|
void dev_controll::handle_event(event &ev)
|
|
{
|
|
- long x,y;
|
|
+ int32_t x,y;
|
|
if (link_object && (dlastx!=last_link_x || dlasty!=last_link_y))
|
|
{
|
|
last_link_x=dlastx;
|
|
@@ -1723,7 +1723,7 @@
|
|
}
|
|
if (ev.window==NULL && ev.type==EV_KEY && ev.key=='d')
|
|
{
|
|
- long xv=0,yv=100;
|
|
+ int32_t xv=0,yv=100;
|
|
edit_object->try_move(edit_object->x,edit_object->y,xv,yv,1);
|
|
edit_object->y+=yv;
|
|
state=DEV_SELECT;
|
|
@@ -1821,7 +1821,7 @@
|
|
{
|
|
if (current_area)
|
|
{
|
|
- long gx,gy;
|
|
+ int32_t gx,gy;
|
|
the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
|
|
if (gx>current_area->x && gy>current_area->y)
|
|
{
|
|
@@ -1844,7 +1844,7 @@
|
|
{
|
|
if (current_area)
|
|
{
|
|
- long gx,gy;
|
|
+ int32_t gx,gy;
|
|
the_game->mouse_to_game(last_demo_mx,last_demo_my,gx,gy);
|
|
if (gx<current_area->x+current_area->w && gy<current_area->y+current_area->h)
|
|
{
|
|
@@ -1871,7 +1871,7 @@
|
|
selected_object=NULL;
|
|
if (ev.window==NULL)
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->mouse_to_game(last_demo_mx,last_demo_my,rx,ry);
|
|
|
|
if (!(dev & MAP_MODE))
|
|
@@ -1891,7 +1891,7 @@
|
|
{
|
|
if (ev.mouse_button==1 && !selected_object && !selected_light)
|
|
{
|
|
- long xs,ys;
|
|
+ int32_t xs,ys;
|
|
the_game->ftile_on(last_demo_mx,last_demo_my,xs,ys);
|
|
if (xs>=0 && ys>=0 && xs<current_level->foreground_width() &&
|
|
ys<current_level->foreground_height())
|
|
@@ -1899,7 +1899,7 @@
|
|
the_game->need_refresh();
|
|
} else if (ev.mouse_button==1 && !selected_object && !selected_light)
|
|
{
|
|
- long xs,ys;
|
|
+ int32_t xs,ys;
|
|
the_game->btile_on(last_demo_mx,last_demo_my,xs,ys);
|
|
if (xs>=0 && ys>=0 && xs<current_level->background_width() &&
|
|
ys<current_level->background_height())
|
|
@@ -2002,6 +2002,8 @@
|
|
}
|
|
}
|
|
}
|
|
+ default:
|
|
+ break;
|
|
}
|
|
|
|
switch (ev.type)
|
|
@@ -2515,7 +2517,7 @@
|
|
case DEV_LIGHT8 :
|
|
case DEV_LIGHT9 :
|
|
{
|
|
- long lx,ly;
|
|
+ int32_t lx,ly;
|
|
the_game->mouse_to_game(last_demo_mx,last_demo_my,lx,ly);
|
|
lx=snap_x(lx);
|
|
ly=snap_y(ly);
|
|
@@ -2852,7 +2854,7 @@
|
|
case 'R' : do_command("reload",ev); break;
|
|
case 'w' :
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->mouse_to_game(dlastx,dlasty,rx,ry);
|
|
char msg[100]; sprintf(msg,symbol_str("mouse_at"),rx,ry);
|
|
the_game->show_help(msg);
|
|
@@ -2874,7 +2876,7 @@
|
|
{
|
|
if (current_level && player_list && player_list->focus)
|
|
{
|
|
- long rx,ry;
|
|
+ int32_t rx,ry;
|
|
the_game->mouse_to_game(dlastx,dlasty,rx,ry);
|
|
player_list->focus->x=rx;
|
|
player_list->focus->y=ry;
|
|
@@ -3147,7 +3149,7 @@
|
|
case JK_ESC : close_window(); break;
|
|
case ' ' :
|
|
{
|
|
- long xs,ys,xx,yy;
|
|
+ int32_t xs,ys,xx,yy;
|
|
the_game->ftile_on(me->x,me->y,xs,ys);
|
|
|
|
for (xx=xs;xx<xs+w;xx++)
|
|
@@ -3162,7 +3164,7 @@
|
|
} break;
|
|
case 't' :
|
|
{
|
|
- long xs,ys;
|
|
+ int32_t xs,ys;
|
|
the_game->ftile_on(me->x,me->y,xs,ys);
|
|
dev_cont->fg_fill(-1,xs,ys,this);
|
|
} break;
|
|
@@ -3208,7 +3210,7 @@
|
|
y=me->y;
|
|
}
|
|
|
|
- fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,w,h,x,y,scale);
|
|
+ fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,(long)w,(long)h,(long)x,(long)y,(long)scale);
|
|
int i;
|
|
for (i=0;i<w*h;i++)
|
|
fprintf(fp,"%d ",pat[i]&0x7fff);
|
|
Index: abuse-sdl-0.7.0/src/newlight.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/newlight.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/newlight.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -182,7 +182,7 @@
|
|
if (fp.open_failure()) recalc=1;
|
|
else
|
|
{
|
|
- if (fp.read_short()!=calc_crc((unsigned char *)pal->addr(),768))
|
|
+ if (fp.read_uint16()!=calc_crc((unsigned char *)pal->addr(),768))
|
|
recalc=1;
|
|
else
|
|
{
|
|
@@ -272,7 +272,7 @@
|
|
|
|
|
|
jFILE f("light.tbl","wb");
|
|
- f.write_short(calc_crc((unsigned char *)pal->addr(),768));
|
|
+ f.write_uint16(calc_crc((unsigned char *)pal->addr(),768));
|
|
f.write(white_light,256*64);
|
|
f.write(green_light,256*64);
|
|
for (int i=0;i<TTINTS;i++)
|
|
@@ -779,17 +779,17 @@
|
|
{
|
|
int t=0;
|
|
for (light_source *f=first_light_source;f;f=f->next) t++;
|
|
- fp->write_long(t);
|
|
- fp->write_long(min_light_level);
|
|
+ fp->write_uint32(t);
|
|
+ fp->write_uint32(min_light_level);
|
|
for (f=first_light_source;f;f=f->next)
|
|
{
|
|
- fp->write_long(f->x);
|
|
- fp->write_long(f->y);
|
|
- fp->write_long(f->xshift);
|
|
- fp->write_long(f->yshift);
|
|
- fp->write_long(f->inner_radius);
|
|
- fp->write_long(f->outer_radius);
|
|
- fp->write_byte(f->type);
|
|
+ fp->write_uint32(f->x);
|
|
+ fp->write_uint32(f->y);
|
|
+ fp->write_uint32(f->xshift);
|
|
+ fp->write_uint32(f->yshift);
|
|
+ fp->write_uint32(f->inner_radius);
|
|
+ fp->write_uint32(f->outer_radius);
|
|
+ fp->write_uint8(f->type);
|
|
}
|
|
}
|
|
|
|
@@ -799,19 +799,19 @@
|
|
packet pk;
|
|
int t=0;
|
|
for (light_source *f=first_light_source;f;f=f->next) t++;
|
|
- pk.write_long(t);
|
|
- pk.write_short(min_light_level);
|
|
+ pk.write_uint32(t);
|
|
+ pk.write_uint16(min_light_level);
|
|
if (!os->send(pk)) return 0;
|
|
for (f=first_light_source;f;f=f->next)
|
|
{
|
|
pk.reset();
|
|
- pk.write_long(f->x);
|
|
- pk.write_long(f->y);
|
|
- pk.write_long(f->xshift);
|
|
- pk.write_long(f->yshift);
|
|
- pk.write_long(f->inner_radius);
|
|
- pk.write_long(f->outer_radius);
|
|
- pk.write_long(f->type);
|
|
+ pk.write_uint32(f->x);
|
|
+ pk.write_uint32(f->y);
|
|
+ pk.write_uint32(f->xshift);
|
|
+ pk.write_uint32(f->yshift);
|
|
+ pk.write_uint32(f->inner_radius);
|
|
+ pk.write_uint32(f->outer_radius);
|
|
+ pk.write_uint32(f->type);
|
|
if (!os->send(pk)) return 0;
|
|
}
|
|
return 1;
|
|
@@ -825,19 +825,19 @@
|
|
if (se)
|
|
{
|
|
fp->seek(se->offset,SEEK_SET);
|
|
- long t=fp->read_long();
|
|
- min_light_level=fp->read_long();
|
|
+ long t=fp->read_uint32();
|
|
+ min_light_level=fp->read_uint32();
|
|
light_source *last;
|
|
while (t)
|
|
{
|
|
t--;
|
|
- long x=fp->read_long();
|
|
- long y=fp->read_long();
|
|
- long xshift=fp->read_long();
|
|
- long yshift=fp->read_long();
|
|
- long ir=fp->read_long();
|
|
- long ora=fp->read_long();
|
|
- long ty=fp->read_byte();
|
|
+ long x=fp->read_uint32();
|
|
+ long y=fp->read_uint32();
|
|
+ long xshift=fp->read_uint32();
|
|
+ long yshift=fp->read_uint32();
|
|
+ long ir=fp->read_uint32();
|
|
+ long ora=fp->read_uint32();
|
|
+ long ty=fp->read_uint8();
|
|
|
|
light_source *p=new light_source(ty,x,y,ir,ora,xshift,yshift,NULL);
|
|
|
|
Index: abuse-sdl-0.7.0/src/cop.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/cop.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/cop.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -142,8 +142,8 @@
|
|
signed char *fire_off=o->otype==S_DFRIS_TOP ? large_fire_off :
|
|
(o->otype==S_ROCKET_TOP ? large_fire_off :
|
|
(o->otype==S_BFG_TOP ? large_fire_off : small_fire_off));
|
|
- signed char *f=fire_off,*fb;
|
|
- int best_diff=200,best_num;
|
|
+ signed char *f=fire_off,*fb=NULL;
|
|
+ int best_diff=200,best_num=0;
|
|
int iy=f[1],ix=f[6*2];
|
|
|
|
int best_angle=lisp_atan2(q->y-iy-v->pointer_y,v->pointer_x-q->x-ix);
|
|
@@ -203,7 +203,7 @@
|
|
|
|
// fire try to move up to gun level
|
|
|
|
- long x2=o->x,y2=firey;
|
|
+ int32_t x2=o->x,y2=firey;
|
|
// current_level->foreground_intersect(other->x,other->y,x2,y2); // find first location we can actuall "see"
|
|
// current_level->all_boundary_setback(o,other->x,other->y,x2,y2); // to make we don't fire through walls
|
|
other->y=y2;
|
|
@@ -246,7 +246,7 @@
|
|
{
|
|
if (!o->lvars[fire_delay1]) // make sur we are not waiting of previous fire
|
|
{
|
|
- long value=lnumber_value(eval(CAR(args)));
|
|
+ int32_t value=lnumber_value(eval(CAR(args)));
|
|
if (value) // do we have ammo ?
|
|
{
|
|
o->lvars[fire_delay1]=3;
|
|
@@ -288,7 +288,7 @@
|
|
{
|
|
if (!o->lvars[fire_delay1]) // make sur we are not waiting of previous fire
|
|
{
|
|
- long value=lnumber_value(eval(CAR(args)));
|
|
+ int32_t value=lnumber_value(eval(CAR(args)));
|
|
if (value) // do we have ammo ?
|
|
{
|
|
o->lvars[fire_delay1]=6;
|
|
@@ -315,7 +315,7 @@
|
|
{
|
|
if (!o->lvars[fire_delay1]) // make sur we are not waiting of previous fire
|
|
{
|
|
- long value=lnumber_value(eval(CAR(args)));
|
|
+ int32_t value=lnumber_value(eval(CAR(args)));
|
|
if (value) // do we have ammo ?
|
|
{
|
|
o->lvars[fire_delay1]=2;
|
|
@@ -339,7 +339,7 @@
|
|
{
|
|
if (!o->lvars[fire_delay1]) // make sur we are not waiting of previous fire
|
|
{
|
|
- long value=lnumber_value(eval(CAR(args)));
|
|
+ int32_t value=lnumber_value(eval(CAR(args)));
|
|
if (value) // do we have ammo ?
|
|
{
|
|
o->lvars[fire_delay1]=1;
|
|
@@ -366,7 +366,7 @@
|
|
{
|
|
if (!o->lvars[fire_delay1]) // make sur we are not waiting of previous fire
|
|
{
|
|
- long value=lnumber_value(eval(CAR(args)));
|
|
+ int32_t value=lnumber_value(eval(CAR(args)));
|
|
if (value) // do we have ammo ?
|
|
{
|
|
o->lvars[fire_delay1]=6;
|
|
@@ -465,7 +465,7 @@
|
|
o->lvars[used_special_power]=1;
|
|
o->lvars[last1_x]=o->x;
|
|
o->lvars[last1_y]=o->y;
|
|
- long oyvel=o->yvel();
|
|
+ int32_t oyvel=o->yvel();
|
|
int in=o->lvars[in_climbing_area];
|
|
|
|
player_move(o,xm,ym,but);
|
|
@@ -531,7 +531,7 @@
|
|
|
|
/* if (o->lvars[special_power]==FAST_POWER)
|
|
{
|
|
- long xv=0,yv=4;
|
|
+ int32_t xv=0,yv=4;
|
|
o->try_move(o->x,o->y,xv,yv,1);
|
|
if (yv==4)
|
|
o->y+=3;
|
|
@@ -556,7 +556,7 @@
|
|
}
|
|
if (xm) // trying to get off the ladder, check to see if that's ok
|
|
{
|
|
- long x2=0,y2=-20;
|
|
+ int32_t x2=0,y2=-20;
|
|
o->try_move(o->x,o->y,x2,y2,3);
|
|
if (y2==-20)
|
|
{
|
|
@@ -796,14 +796,14 @@
|
|
o->lvars[b_ramp]=b;
|
|
|
|
palette *p=pal->copy();
|
|
- uchar *addr=(uchar *)p->addr();
|
|
+ uint8_t *addr=(uint8_t *)p->addr();
|
|
int ra,ga,ba;
|
|
|
|
for (int i=0;i<256;i++)
|
|
{
|
|
- ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uchar)ra; addr++;
|
|
- ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(uchar)ga; addr++;
|
|
- ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(uchar)ba; addr++;
|
|
+ ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uint8_t)ra; addr++;
|
|
+ ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(uint8_t)ga; addr++;
|
|
+ ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(uint8_t)ba; addr++;
|
|
}
|
|
p->load();
|
|
delete p;
|
|
@@ -835,6 +835,7 @@
|
|
case run_jump : o->state=(character_state)S_fast_run_jump; break;
|
|
case run_jump_fall : o->state=(character_state)S_fast_run_jump_fall; break;
|
|
case end_run_jump : o->state=(character_state)S_fast_end_run_jump; break;
|
|
+ default: break;
|
|
}
|
|
|
|
player_draw(just_fired,o->controller()->player_number);
|
|
@@ -854,6 +855,7 @@
|
|
case run_jump : o->state=(character_state)S_fly_run_jump; break;
|
|
case run_jump_fall : o->state=(character_state)S_fly_run_jump_fall; break;
|
|
case end_run_jump : o->state=(character_state)S_fly_end_run_jump; break;
|
|
+ default: break;
|
|
}
|
|
|
|
player_draw(just_fired,o->controller()->player_number);
|
|
@@ -895,13 +897,13 @@
|
|
o->lvars[sgb_lasty]=o->y;
|
|
o->lvars[sgb_speed]=o->lvars[sgb_speed]*6/5;
|
|
|
|
- long ang=o->lvars[sgb_angle];
|
|
- long mag=o->lvars[sgb_speed];
|
|
+ int32_t ang=o->lvars[sgb_angle];
|
|
+ int32_t mag=o->lvars[sgb_speed];
|
|
|
|
- long xvel=(lisp_cos(ang))*(mag);
|
|
+ int32_t xvel=(lisp_cos(ang))*(mag);
|
|
current_object->set_xvel(xvel>>16);
|
|
current_object->set_fxvel((xvel&0xffff)>>8);
|
|
- long yvel=-(lisp_sin(ang))*(mag);
|
|
+ int32_t yvel=-(lisp_sin(ang))*(mag);
|
|
current_object->set_yvel(yvel>>16);
|
|
current_object->set_fyvel((yvel&0xffff)>>8);
|
|
|
|
@@ -1016,7 +1018,7 @@
|
|
for (i=0;i<tp;i++)
|
|
{
|
|
int color=lnumber_value(lget_array_element(symbol_value(l_player_text_color),sorted_players[i]->player_number));
|
|
- sprintf(msg,"%3ld %s",sorted_players[i]->kills,sorted_players[i]->name);
|
|
+ sprintf(msg,"%3ld %s",(long)sorted_players[i]->kills,sorted_players[i]->name);
|
|
if (sorted_players[i]==local)
|
|
strcat(msg," <<");
|
|
|
|
@@ -1063,7 +1065,7 @@
|
|
char msg[100];
|
|
|
|
|
|
- sprintf(msg,"%-17s %3ld %3ld",max_name,v->kills,v->tkills+v->kills);
|
|
+ sprintf(msg,"%-17s %3ld %3ld",max_name,(long)v->kills,(long)(v->tkills+v->kills));
|
|
fnt->put_string(screen,x,y,msg,color);
|
|
|
|
y+=fnt->height();
|
|
Index: abuse-sdl-0.7.0/src/old.nfserver.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/old.nfserver.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/old.nfserver.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -83,7 +83,7 @@
|
|
|
|
int nfs_server::process_packet(packet &pk, nfs_server_client_node *c)
|
|
{
|
|
- uchar cmd;
|
|
+ uint8_t cmd;
|
|
if (pk.read(&cmd,1)!=1)
|
|
{
|
|
dprintf("Could not read command from nfs packet\n");
|
|
@@ -96,25 +96,25 @@
|
|
{ return 0; } break;
|
|
case NFS_CRC_OPEN :
|
|
{
|
|
- uchar fn_len;
|
|
+ uint8_t fn_len;
|
|
char fn[255],newfn[255],perm[255];
|
|
- ulong crc;
|
|
- if (pk.read((uchar *)&crc,4)!=4) return 0; crc=lltl(crc);
|
|
+ uint32_t crc;
|
|
+ if (pk.read((uint8_t *)&crc,4)!=4) return 0; crc=lltl(crc);
|
|
if (pk.read(&fn_len,1)!=1) return 0;
|
|
- if (pk.read((uchar *)fn,fn_len)!=fn_len) return 0;
|
|
- if (pk.read((uchar *)&fn_len,1)!=1) return 0;
|
|
- if (pk.read((uchar *)perm,fn_len)!=fn_len) return 0; // read permission string
|
|
+ if (pk.read((uint8_t *)fn,fn_len)!=fn_len) return 0;
|
|
+ if (pk.read((uint8_t *)&fn_len,1)!=1) return 0;
|
|
+ if (pk.read((uint8_t *)perm,fn_len)!=fn_len) return 0; // read permission string
|
|
dprintf("nfs open %s,%s\n",fn,perm);
|
|
packet opk;
|
|
int fail;
|
|
- ulong my_crc=crc_man.get_crc(crc_man.get_filenumber(fn),fail);
|
|
+ uint32_t my_crc=crc_man.get_crc(crc_man.get_filenumber(fn),fail);
|
|
if (fail)
|
|
{
|
|
jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
|
|
if (fp->open_failure())
|
|
{
|
|
delete fp;
|
|
- opk.write_long((long)-1);
|
|
+ opk.write_uint32((int32_t)-1);
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
} else
|
|
@@ -127,7 +127,7 @@
|
|
|
|
if (my_crc==crc)
|
|
{
|
|
- opk.write_long((long)-2);
|
|
+ opk.write_uint32((int32_t)-2);
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
}
|
|
@@ -136,36 +136,36 @@
|
|
if (fp->open_failure())
|
|
{
|
|
delete fp;
|
|
- opk.write_long((long)-1);
|
|
+ opk.write_uint32((int32_t)-1);
|
|
} else
|
|
- opk.write_long(c->add_file(fp));
|
|
+ opk.write_uint32(c->add_file(fp));
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
} break;
|
|
case NFS_OPEN :
|
|
{
|
|
- uchar fn_len;
|
|
+ uint8_t fn_len;
|
|
char fn[255],newfn[255],perm[255];
|
|
if (pk.read(&fn_len,1)!=1) return 0;
|
|
- if (pk.read((uchar *)fn,fn_len)!=fn_len) return 0;
|
|
- if (pk.read((uchar *)&fn_len,1)!=1) return 0;
|
|
- if (pk.read((uchar *)perm,fn_len)!=fn_len) return 0; // read permission string
|
|
+ if (pk.read((uint8_t *)fn,fn_len)!=fn_len) return 0;
|
|
+ if (pk.read((uint8_t *)&fn_len,1)!=1) return 0;
|
|
+ if (pk.read((uint8_t *)perm,fn_len)!=fn_len) return 0; // read permission string
|
|
dprintf("nfs open %s,%s\n",fn,perm);
|
|
packet opk;
|
|
jFILE *fp=new jFILE(squash_path(fn,newfn),perm);
|
|
if (fp->open_failure())
|
|
{
|
|
delete fp;
|
|
- opk.write_long((long)-1);
|
|
+ opk.write_uint32((int32_t)-1);
|
|
} else
|
|
- opk.write_long(c->add_file(fp));
|
|
+ opk.write_uint32(c->add_file(fp));
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
} break;
|
|
case NFS_CLOSE :
|
|
{
|
|
- long fd;
|
|
- if (pk.read((uchar *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
+ int32_t fd;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
dprintf("nfs close %d\n",fd);
|
|
if (!c->delete_file(fd))
|
|
{
|
|
@@ -176,12 +176,12 @@
|
|
} break;
|
|
case NFS_READ :
|
|
{
|
|
- long fd,size;
|
|
- if (pk.read((uchar *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
- if (pk.read((uchar *)&size,4)!=4) return 0; size=lltl(size);
|
|
+ int32_t fd,size;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
+ if (pk.read((uint8_t *)&size,4)!=4) return 0; size=lltl(size);
|
|
dprintf("nfs read %d,%d\n",fd,size);
|
|
bFILE *fp=c->get_file(fd);
|
|
- uchar buf[NFSFILE_BUFFER_SIZE];
|
|
+ uint8_t buf[NFSFILE_BUFFER_SIZE];
|
|
packet opk;
|
|
if (!fp) return 0;
|
|
int total;
|
|
@@ -190,7 +190,7 @@
|
|
opk.reset();
|
|
int to_read=NFSFILE_BUFFER_SIZE < size ? NFSFILE_BUFFER_SIZE : size;
|
|
total=fp->read(buf,to_read);
|
|
- opk.write_short(total);
|
|
+ opk.write_uint16(total);
|
|
opk.write(buf,total);
|
|
printf("sending %d bytes\n",total);
|
|
if (!c->nd->send(opk))
|
|
@@ -210,10 +210,10 @@
|
|
} break;
|
|
case NFS_SEEK :
|
|
{
|
|
- long fd,off,type;
|
|
- if (pk.read((uchar *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
- if (pk.read((uchar *)&off,4)!=4) return 0; off=lltl(off);
|
|
- if (pk.read((uchar *)&type,4)!=4) return 0; type=lltl(type);
|
|
+ int32_t fd,off,type;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
+ if (pk.read((uint8_t *)&off,4)!=4) return 0; off=lltl(off);
|
|
+ if (pk.read((uint8_t *)&type,4)!=4) return 0; type=lltl(type);
|
|
dprintf("seek %d %d %d\n",fd,off,type);
|
|
bFILE *fp=c->get_file(fd);
|
|
if (!fp) { dprintf("bad fd for seek\n"); return 0; }
|
|
@@ -222,23 +222,23 @@
|
|
} break;
|
|
case NFS_FILESIZE :
|
|
{
|
|
- long fd,off,type;
|
|
- if (pk.read((uchar *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
+ int32_t fd,off,type;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
bFILE *fp=c->get_file(fd);
|
|
if (!fp) return 0;
|
|
packet opk;
|
|
- opk.write_long(fp->file_size());
|
|
+ opk.write_uint32(fp->file_size());
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
} break;
|
|
case NFS_TELL :
|
|
{
|
|
- long fd,off,type;
|
|
- if (pk.read((uchar *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
+ int32_t fd,off,type;
|
|
+ if (pk.read((uint8_t *)&fd,4)!=4) return 0; fd=lltl(fd);
|
|
bFILE *fp=c->get_file(fd);
|
|
if (!fp) return 0;
|
|
packet opk;
|
|
- opk.write_long(fp->tell());
|
|
+ opk.write_uint32(fp->tell());
|
|
if (!c->nd->send(opk)) return 0;
|
|
return 1;
|
|
} break;
|
|
Index: abuse-sdl-0.7.0/src/version.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/version.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/version.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -3,8 +3,8 @@
|
|
#include "macs.hpp"
|
|
#include <string.h>
|
|
|
|
-uchar major_version=2;
|
|
-uchar minor_version=00;
|
|
+uint8_t major_version=2;
|
|
+uint8_t minor_version=00;
|
|
|
|
extern int get_option(char *name);
|
|
|
|
@@ -28,7 +28,7 @@
|
|
dprintf(msg2);
|
|
|
|
for (i=0;i<80;i++)
|
|
- *((unsigned char *)(0xb8000+i*2+1))=0x17;
|
|
+ *((uint8_t *)(0xb8000+i*2+1))=0x17;
|
|
}
|
|
#else
|
|
static void setup()
|
|
Index: abuse-sdl-0.7.0/src/server2.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/server2.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/server2.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -129,11 +129,11 @@
|
|
/* client_descriptor *last=NULL;
|
|
if (sync_check)
|
|
{
|
|
- next_out.write_byte(SCMD_SYNC);
|
|
- next_out.write_long(make_sync_long());
|
|
+ next_out.write_uint8(SCMD_SYNC);
|
|
+ next_out.write_uint32(make_sync_uint32());
|
|
}
|
|
|
|
- next_out.write_byte(SCMD_END_OF_PACKET); // so clients knows when to stop reading
|
|
+ next_out.write_uint8(SCMD_END_OF_PACKET); // so clients knows when to stop reading
|
|
|
|
for (client_descriptor *p=client_list;p;)
|
|
{
|
|
@@ -210,14 +210,14 @@
|
|
{
|
|
packet pk;
|
|
current_level->save("netstart.spe",1);
|
|
- printf("%d sync for save\n",make_sync_long());
|
|
+ printf("%d sync for save\n",make_sync_uint32());
|
|
|
|
client_descriptor *last=NULL;
|
|
for (p=client_list;p;p=p->next)
|
|
{
|
|
if (p->player)
|
|
{
|
|
- pk.write_byte(SCMD_JOIN_START);
|
|
+ pk.write_uint8(SCMD_JOIN_START);
|
|
int error=!p->connection->send(pk);
|
|
if (!error)
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/particle.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/particle.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/particle.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -104,20 +104,20 @@
|
|
|
|
part_frame::part_frame(bFILE *fp)
|
|
{
|
|
- t=fp->read_long();
|
|
+ t=fp->read_uint32();
|
|
data=(part *)jmalloc(sizeof(part)*t,"particle frame");
|
|
x1=y1=100000; x2=y2=-100000;
|
|
for (int i=0;i<t;i++)
|
|
{
|
|
- short x=fp->read_short();
|
|
- short y=fp->read_short();
|
|
+ int16_t x=fp->read_uint16();
|
|
+ int16_t y=fp->read_uint16();
|
|
if (x<x1) x1=x;
|
|
if (y<y1) y1=y;
|
|
if (x>x2) x2=x;
|
|
if (y>y2) y2=x;
|
|
data[i].x=x;
|
|
data[i].y=y;
|
|
- data[i].color=fp->read_byte();
|
|
+ data[i].color=fp->read_uint8();
|
|
}
|
|
}
|
|
|
|
@@ -155,7 +155,7 @@
|
|
|
|
void part_frame::draw(image *screen, int x, int y, int dir)
|
|
{
|
|
- short cx1,cy1,cx2,cy2;
|
|
+ int16_t cx1,cy1,cx2,cy2;
|
|
screen->get_clip(cx1,cy1,cx2,cy2);
|
|
if (x+x1>cx2 || x+x2<cx1 || y+y1>cy2 || y+y2<cy1) return ;
|
|
|
|
@@ -195,7 +195,7 @@
|
|
|
|
void scatter_line(int x1, int y1, int x2, int y2, int c, int s)
|
|
{
|
|
- short cx1, cy1, cx2, cy2;
|
|
+ int16_t cx1, cy1, cx2, cy2;
|
|
screen->get_clip( cx1, cy1, cx2, cy2 );
|
|
|
|
int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
|
|
@@ -222,7 +222,7 @@
|
|
|
|
void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s)
|
|
{
|
|
- short cx1, cy1, cx2, cy2;
|
|
+ int16_t cx1, cy1, cx2, cy2;
|
|
screen->get_clip( cx1, cy1, cx2, cy2 );
|
|
|
|
int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1;
|
|
@@ -233,7 +233,7 @@
|
|
s = ( 15 - s );
|
|
|
|
int w = screen->width();
|
|
- uchar *addr;
|
|
+ uint8_t *addr;
|
|
|
|
while( t-- )
|
|
{
|
|
Index: abuse-sdl-0.7.0/src/innet.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/innet.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/innet.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -209,7 +209,7 @@
|
|
net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
|
|
|
|
if (!sock) { printf("set_file_server::connect failed\n"); return 0; }
|
|
- uchar cmd=CLIENT_CRC_WAITER;
|
|
+ uint8_t cmd=CLIENT_CRC_WAITER;
|
|
if ( (sock->write(&cmd,1)!=1 && printf("set_file_server::writefailed\n")) ||
|
|
(sock->read(&cmd,1)!=1 && printf("set_file_server::read failed\n"))) // wait for confirmation that crc's are written
|
|
{ delete sock; return 0; }
|
|
@@ -290,7 +290,7 @@
|
|
net_socket *new_sock=comm_sock->accept(addr);
|
|
if (new_sock)
|
|
{
|
|
- uchar client_type;
|
|
+ uint8_t client_type;
|
|
if (new_sock->read(&client_type,1)!=1)
|
|
{
|
|
delete addr;
|
|
@@ -315,7 +315,7 @@
|
|
} break;
|
|
case CLIENT_LSF_WAITER : // wants to know which .lsp file to start with
|
|
{
|
|
- uchar len=strlen(lsf);
|
|
+ uint8_t len=strlen(lsf);
|
|
new_sock->write(&len,1);
|
|
new_sock->write(lsf,len);
|
|
delete new_sock;
|
|
@@ -351,8 +351,8 @@
|
|
net_socket *sock=prot->connect_to_server(addr,net_socket::SOCKET_SECURE);
|
|
if (!sock) return 0;
|
|
|
|
- uchar ctype=CLIENT_LSF_WAITER;
|
|
- uchar len;
|
|
+ uint8_t ctype=CLIENT_LSF_WAITER;
|
|
+ uint8_t len;
|
|
|
|
if (sock->write(&ctype,1)!=1 ||
|
|
sock->read(&len,1)!=1 || len==0 ||
|
|
@@ -390,10 +390,10 @@
|
|
return 0;
|
|
}
|
|
|
|
- uchar ctype=CLIENT_ABUSE;
|
|
- ushort port=lstl(main_net_cfg->port+1),cnum;
|
|
+ uint8_t ctype=CLIENT_ABUSE;
|
|
+ uint16_t port=lstl(main_net_cfg->port+1),cnum;
|
|
|
|
- uchar reg;
|
|
+ uint8_t reg;
|
|
if (sock->write(&ctype,1)!=1 || // send server out game port
|
|
sock->read(®,1)!=1) // is remote engine registered?
|
|
{ delete sock; return 0; }
|
|
@@ -426,7 +426,7 @@
|
|
if (get_login())
|
|
strcpy(uname,get_login());
|
|
else strcpy(uname,"unknown");
|
|
- uchar len=strlen(uname)+1;
|
|
+ uint8_t len=strlen(uname)+1;
|
|
short nkills;
|
|
|
|
if (sock->write(&len,1)!=1 ||
|
|
@@ -489,6 +489,7 @@
|
|
|
|
spec_directory sd(fp);
|
|
|
|
+#if 0
|
|
spec_entry *e=sd.find("Copyright 1995 Crack dot Com, All Rights reserved");
|
|
if (!e)
|
|
{
|
|
@@ -497,6 +498,7 @@
|
|
the_game->need_refresh();
|
|
}
|
|
else
|
|
+#endif
|
|
current_level=new level(&sd,fp,NET_STARTFILE);
|
|
|
|
delete fp;
|
|
Index: abuse-sdl-0.7.0/src/lcache.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/lcache.cpp 2006-06-21 15:02:33.000000000 +0200
|
|
+++ abuse-sdl-0.7.0/src/lcache.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -47,25 +47,25 @@
|
|
void write_level(bFILE *fp, Cell *level)
|
|
{
|
|
int type=item_type(level);
|
|
- fp->write_byte(type);
|
|
+ fp->write_uint8(type);
|
|
|
|
|
|
switch (type)
|
|
{
|
|
case L_NUMBER :
|
|
- { fp->write_long(lnumber_value(level)); } break;
|
|
+ { fp->write_uint32(lnumber_value(level)); } break;
|
|
case L_CHARACTER :
|
|
- { fp->write_short(lcharacter_value(level)); } break;
|
|
+ { fp->write_uint16(lcharacter_value(level)); } break;
|
|
case L_STRING :
|
|
{ long l=strlen(lstring_value(level))+1;
|
|
- fp->write_long(l);
|
|
+ fp->write_uint32(l);
|
|
fp->write(lstring_value(level),l);
|
|
} break;
|
|
case L_SYMBOL :
|
|
- { fp->write_long((long)level); } break;
|
|
+ { fp->write_uint32((long)level); } break;
|
|
case L_CONS_CELL :
|
|
{
|
|
- if (!level) fp->write_long(0);
|
|
+ if (!level) fp->write_uint32(0);
|
|
else
|
|
{
|
|
long t=0;
|
|
@@ -73,10 +73,10 @@
|
|
for (;b && item_type(b)==L_CONS_CELL;b=CDR(b)) t++;
|
|
if (b)
|
|
{
|
|
- fp->write_long(-t); // negative number means dotted list
|
|
+ fp->write_uint32(-t); // negative number means dotted list
|
|
write_level(fp,b); // save end of dotted list
|
|
}
|
|
- else fp->write_long(t);
|
|
+ else fp->write_uint32(t);
|
|
|
|
for (b=level;b && item_type(b)==L_CONS_CELL;b=CDR(b))
|
|
write_level(fp,CAR(b));
|
|
@@ -87,29 +87,29 @@
|
|
|
|
Cell *load_block(bFILE *fp)
|
|
{
|
|
- int type=fp->read_byte();
|
|
+ int type=fp->read_uint8();
|
|
switch (type)
|
|
{
|
|
case L_NUMBER :
|
|
- { return new_lisp_number(fp->read_long()); } break;
|
|
+ { return new_lisp_number(fp->read_uint32()); } break;
|
|
case L_CHARACTER :
|
|
- { return new_lisp_character(fp->read_short()); } break;
|
|
+ { return new_lisp_character(fp->read_uint16()); } break;
|
|
case L_STRING :
|
|
- { long l=fp->read_long();
|
|
+ { long l=fp->read_uint32();
|
|
lisp_string *s=new_lisp_string(l);
|
|
fp->read(lstring_value(s),l);
|
|
return s;
|
|
} break;
|
|
case L_SYMBOL :
|
|
- { return (void *)fp->read_long(); } break;
|
|
+ { return (void *)fp->read_uint32(); } break;
|
|
case L_CONS_CELL :
|
|
{
|
|
- long t=fp->read_long();
|
|
+ long t=fp->read_uint32();
|
|
if (!t) return NULL;
|
|
else
|
|
{
|
|
long x=abs(t);
|
|
- cons_cell *last,*first=NULL;
|
|
+ cons_cell *last=NULL,*first=NULL;
|
|
while (x)
|
|
{
|
|
cons_cell *c=new_cons_cell();
|
|
Index: abuse-sdl-0.7.0/src/items.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/items.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/items.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -17,10 +17,10 @@
|
|
exit(0);
|
|
}
|
|
|
|
- inside=(unsigned char *)jmalloc(tot,"Boundary point list");
|
|
+ inside=(uint8_t *)jmalloc(tot,"Boundary point list");
|
|
}
|
|
|
|
- unsigned char *point_on;
|
|
+ uint8_t *point_on;
|
|
|
|
for (i=0,point_on=data;i<tot-1;i++)
|
|
{
|
|
@@ -33,7 +33,7 @@
|
|
checky=(y1+y2)/2;
|
|
|
|
int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;
|
|
- unsigned char *point2,segs_left=0,segs_right=0,segs_down=0;
|
|
+ uint8_t *point2,segs_left=0,segs_right=0,segs_down=0;
|
|
int skip_next=0;
|
|
int check_left=0,check_right=0,check_down=0;
|
|
|
|
@@ -100,10 +100,10 @@
|
|
boundary::boundary(boundary *p) : point_list(p->tot,p->data)
|
|
{
|
|
int x1,y1,x2,y2,checkx,checky,i;
|
|
- unsigned char *point_on;
|
|
+ uint8_t *point_on;
|
|
if (tot)
|
|
{
|
|
- inside=(unsigned char *)jmalloc(tot,"Boundary point list");
|
|
+ inside=(uint8_t *)jmalloc(tot,"Boundary point list");
|
|
} else inside=NULL;
|
|
for (i=0,point_on=data;i<tot-1;i++)
|
|
{
|
|
@@ -116,7 +116,7 @@
|
|
checky=(y1+y2)/2;
|
|
|
|
int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny;
|
|
- unsigned char *point2,segs_left=0,segs_right=0,segs_down=0;
|
|
+ uint8_t *point2,segs_left=0,segs_right=0,segs_down=0;
|
|
int skip_next=0;
|
|
int check_left=0,check_right=0,check_down=0;
|
|
|
|
@@ -185,24 +185,24 @@
|
|
backtile::backtile(bFILE *fp)
|
|
{
|
|
im=load_image(fp);
|
|
- next=fp->read_short();
|
|
+ next=fp->read_uint16();
|
|
}
|
|
|
|
backtile::backtile(spec_entry *e, bFILE *fp)
|
|
{
|
|
im=load_image(e,fp);
|
|
- next=fp->read_short();
|
|
+ next=fp->read_uint16();
|
|
}
|
|
|
|
foretile::foretile(bFILE *fp)
|
|
{
|
|
- unsigned char *sl;
|
|
+ uint8_t *sl;
|
|
image *img=load_image(fp);
|
|
|
|
|
|
// create the micro image of the fore tile by aveginging the color values in 2 x 2 space
|
|
// and storeing teh closest match
|
|
-// unsigned char *buffer=(unsigned char *)µ_image;
|
|
+// uint8_t *buffer=(uint8_t *)µ_image;
|
|
int x,y,w=img->width(),h=img->height(),l;
|
|
int r[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
|
|
g[AUTOTILE_WIDTH*AUTOTILE_HEIGHT],
|
|
@@ -249,7 +249,7 @@
|
|
im=new trans_image(img,"foretile");
|
|
delete img;
|
|
|
|
- next=fp->read_short();
|
|
+ next=fp->read_uint16();
|
|
fp->read(&damage,1);
|
|
|
|
|
|
@@ -284,7 +284,7 @@
|
|
{
|
|
point_list p(fp);
|
|
advance=0;
|
|
- } else advance=fp->read_byte();
|
|
+ } else advance=fp->read_uint8();
|
|
|
|
f_damage=new boundary(fp,"fig bound");
|
|
b_damage=new boundary(f_damage);
|
|
@@ -295,7 +295,7 @@
|
|
char_tint::char_tint(bFILE *fp) // se should be a palette entry
|
|
{
|
|
palette *p=new palette(fp);
|
|
- uchar *t=data,*p_addr=(uchar *)p->addr();
|
|
+ uint8_t *t=data,*p_addr=(uint8_t *)p->addr();
|
|
for (int i=0;i<256;i++,t++,p_addr+=3)
|
|
*t=pal->find_closest(*p_addr,p_addr[1],p_addr[2]);
|
|
|
|
Index: abuse-sdl-0.7.0/src/demo.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/demo.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/demo.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -61,17 +61,17 @@
|
|
|
|
the_game->load_level(name);
|
|
record_file->write((void *)"DEMO,VERSION:2",14);
|
|
- record_file->write_byte(strlen(name)+1);
|
|
+ record_file->write_uint8(strlen(name)+1);
|
|
record_file->write(name,strlen(name)+1);
|
|
|
|
|
|
if (DEFINEDP(symbol_value(l_difficulty)))
|
|
{
|
|
- if (symbol_value(l_difficulty)==l_easy) record_file->write_byte(0);
|
|
- else if (symbol_value(l_difficulty)==l_medium) record_file->write_byte(1);
|
|
- else if (symbol_value(l_difficulty)==l_hard) record_file->write_byte(2);
|
|
- else record_file->write_byte(3);
|
|
- } else record_file->write_byte(3);
|
|
+ if (symbol_value(l_difficulty)==l_easy) record_file->write_uint8(0);
|
|
+ else if (symbol_value(l_difficulty)==l_medium) record_file->write_uint8(1);
|
|
+ else if (symbol_value(l_difficulty)==l_hard) record_file->write_uint8(2);
|
|
+ else record_file->write_uint8(3);
|
|
+ } else record_file->write_uint8(3);
|
|
|
|
|
|
state=RECORDING;
|
|
@@ -93,20 +93,20 @@
|
|
if (p->local_player())
|
|
p->get_input();
|
|
|
|
- base->packet.write_byte(SCMD_SYNC);
|
|
- base->packet.write_short(make_sync());
|
|
+ base->packet.write_uint8(SCMD_SYNC);
|
|
+ base->packet.write_uint16(make_sync());
|
|
demo_man.save_packet(base->packet.packet_data(),base->packet.packet_size());
|
|
process_packet_commands(base->packet.packet_data(),base->packet.packet_size());
|
|
|
|
} break;
|
|
case PLAYING :
|
|
{
|
|
- uchar buf[1500];
|
|
+ uint8_t buf[1500];
|
|
int size;
|
|
if (get_packet(buf,size)) // get starting inputs
|
|
{
|
|
process_packet_commands(buf,size);
|
|
- long mx,my;
|
|
+ int32_t mx,my;
|
|
the_game->game_to_mouse(player_list->pointer_x,player_list->pointer_y,player_list,mx,my);
|
|
eh->set_mouse_position(small_render ? mx*2 : mx, small_render ? my*2 : my);
|
|
}
|
|
@@ -116,6 +116,8 @@
|
|
return ;
|
|
}
|
|
} break;
|
|
+ default :
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
@@ -135,7 +137,7 @@
|
|
|
|
int demo_manager::start_playing(char *filename)
|
|
{
|
|
- uchar sig[15];
|
|
+ uint8_t sig[15];
|
|
record_file=open_file(filename,"rb");
|
|
if (record_file->open_failure()) { delete record_file; return 0; }
|
|
char name[100],nsize,diff;
|
|
@@ -208,6 +210,8 @@
|
|
|
|
|
|
} break;
|
|
+ default :
|
|
+ break;
|
|
}
|
|
|
|
switch (new_state)
|
|
@@ -227,7 +231,7 @@
|
|
{
|
|
if (state==RECORDING)
|
|
{
|
|
- ushort ps=lstl(packet_size);
|
|
+ uint16_t ps=lstl(packet_size);
|
|
if (record_file->write(&ps,2)!=2 ||
|
|
record_file->write(packet,packet_size)!=packet_size)
|
|
{
|
|
@@ -242,7 +246,7 @@
|
|
{
|
|
if (state==PLAYING)
|
|
{
|
|
- ushort ps;
|
|
+ uint16_t ps;
|
|
if (record_file->read(&ps,2)!=2)
|
|
{
|
|
set_state(NORMAL);
|
|
Index: abuse-sdl-0.7.0/src/loader2.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/loader2.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/loader2.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -32,7 +32,7 @@
|
|
int nforetiles,nbacktiles,f_wid,f_hi,b_wid,b_hi,total_songs=0,sfx_volume,music_volume,sound_avail=0;
|
|
song *current_song=NULL;
|
|
|
|
-ushort current_start_type,start_position_type,last_start_number;
|
|
+uint16_t current_start_type,start_position_type,last_start_number;
|
|
int light_buttons[13];
|
|
int joy_picts[2*9];
|
|
palette *pal;
|
|
@@ -283,9 +283,10 @@
|
|
|
|
int should_save_sd_cache = 0;
|
|
|
|
+# if 0
|
|
char *cachepath;
|
|
- cachepath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12, "cachepath" );
|
|
- sprintf( cachepath, "%ssd_cache.tmp\0", get_save_filename_prefix() );
|
|
+ cachepath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12 + 1, "cachepath" );
|
|
+ sprintf( cachepath, "%ssd_cache.tmp", get_save_filename_prefix() );
|
|
|
|
bFILE *load = open_file( cachepath, "rb" );
|
|
if( !load->open_failure() )
|
|
@@ -297,6 +298,7 @@
|
|
should_save_sd_cache = 1;
|
|
}
|
|
delete load;
|
|
+#endif
|
|
|
|
if (!net_start()) // don't let them specify a startup file we are connect elsewhere
|
|
{
|
|
@@ -443,6 +445,7 @@
|
|
b_wid=cash.backt(backtiles[0])->im->width();
|
|
b_hi=cash.backt(backtiles[0])->im->height();
|
|
|
|
+#if 0
|
|
if( should_save_sd_cache )
|
|
{
|
|
bFILE *save = open_file( cachepath, "wb" );
|
|
@@ -452,10 +455,13 @@
|
|
}
|
|
delete save;
|
|
}
|
|
+#endif
|
|
|
|
sd_cache.clear();
|
|
past_startup = 1;
|
|
+#if 0
|
|
jfree( cachepath );
|
|
+#endif
|
|
}
|
|
|
|
|
|
Index: abuse-sdl-0.7.0/src/objects.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/objects.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/objects.cpp 2006-06-21 15:02:35.000000000 +0200
|
|
@@ -45,43 +45,43 @@
|
|
|
|
|
|
obj_desc object_descriptions[TOTAL_OBJECT_VARS]={
|
|
- {"fade_dir", RC_C },
|
|
- {"frame_dir", RC_C },
|
|
- {"direction", RC_C },
|
|
- {"gravity_on", RC_C },
|
|
- {"fade_count", RC_C },
|
|
-
|
|
- {"fade_max", RC_C },
|
|
- {"active", RC_C },
|
|
- {"flags", RC_C },
|
|
- {"aitype", RC_C },
|
|
- {"xvel", RC_L },
|
|
-
|
|
- {"fxvel", RC_C },
|
|
- {"yvel", RC_L },
|
|
- {"fyvel", RC_C },
|
|
- {"xacel", RC_L },
|
|
- {"fxacel", RC_C },
|
|
-
|
|
- {"yacel", RC_L },
|
|
- {"fyacel", RC_C },
|
|
- {"x", RC_L },
|
|
- {"fx", RC_C },
|
|
- {"y", RC_L },
|
|
-
|
|
- {"fy", RC_C },
|
|
- {"hp", RC_S },
|
|
- {"mp", RC_S },
|
|
- {"fmp", RC_S },
|
|
- {"cur_frame", RC_S },
|
|
-
|
|
- {"aistate", RC_S },
|
|
- {"aistate_time", RC_S },
|
|
- {"targetable", RC_C }
|
|
+ {"fade_dir", RC_8 },
|
|
+ {"frame_dir", RC_8 },
|
|
+ {"direction", RC_8 },
|
|
+ {"gravity_on", RC_8 },
|
|
+ {"fade_count", RC_8 },
|
|
+
|
|
+ {"fade_max", RC_8 },
|
|
+ {"active", RC_8 },
|
|
+ {"flags", RC_8 },
|
|
+ {"aitype", RC_8 },
|
|
+ {"xvel", RC_32 },
|
|
+
|
|
+ {"fxvel", RC_8 },
|
|
+ {"yvel", RC_32 },
|
|
+ {"fyvel", RC_8 },
|
|
+ {"xacel", RC_32 },
|
|
+ {"fxacel", RC_8 },
|
|
+
|
|
+ {"yacel", RC_32 },
|
|
+ {"fyacel", RC_8 },
|
|
+ {"x", RC_32 },
|
|
+ {"fx", RC_8 },
|
|
+ {"y", RC_32 },
|
|
+
|
|
+ {"fy", RC_8 },
|
|
+ {"hp", RC_16 },
|
|
+ {"mp", RC_16 },
|
|
+ {"fmp", RC_16 },
|
|
+ {"cur_frame", RC_16 },
|
|
+
|
|
+ {"aistate", RC_16 },
|
|
+ {"aistate_time", RC_16 },
|
|
+ {"targetable", RC_8 }
|
|
|
|
};
|
|
|
|
-long game_object::get_var_by_name(char *name, int &error)
|
|
+int32_t game_object::get_var_by_name(char *name, int &error)
|
|
{
|
|
error=0;
|
|
int i=0;
|
|
@@ -111,7 +111,7 @@
|
|
return 0;
|
|
}
|
|
|
|
-int game_object::set_var_by_name(char *name, long value)
|
|
+int game_object::set_var_by_name(char *name, int32_t value)
|
|
{
|
|
int i=0;
|
|
for (;i<TOTAL_OBJECT_VARS;i++)
|
|
@@ -143,7 +143,7 @@
|
|
}
|
|
|
|
|
|
-void simple_object::set_var(int xx, ulong v)
|
|
+void simple_object::set_var(int xx, uint32_t v)
|
|
{
|
|
switch (xx)
|
|
{
|
|
@@ -183,7 +183,7 @@
|
|
}
|
|
}
|
|
|
|
-long simple_object::get_var(int xx)
|
|
+int32_t simple_object::get_var(int xx)
|
|
{
|
|
switch (xx)
|
|
{
|
|
@@ -233,11 +233,11 @@
|
|
{
|
|
switch (type)
|
|
{
|
|
- case RC_C :
|
|
+ case RC_8 :
|
|
{ return 1; } break;
|
|
- case RC_S :
|
|
+ case RC_16 :
|
|
{ return 2; } break;
|
|
- case RC_L :
|
|
+ case RC_32 :
|
|
{ return 4; } break;
|
|
}
|
|
CHECK(0);
|
|
@@ -369,13 +369,13 @@
|
|
|
|
void game_object::draw_above(view *v)
|
|
{
|
|
- long x1,y1,x2,y2,sy1,sy2,sx,i;
|
|
+ int32_t x1,y1,x2,y2,sy1,sy2,sx,i;
|
|
picture_space(x1,y1,x2,y2);
|
|
|
|
the_game->game_to_mouse(x1,y1,v,sx,sy2);
|
|
if (sy2>=v->cy1)
|
|
{
|
|
- long draw_to=y1-(sy2-v->cy1),tmp=x;
|
|
+ int32_t draw_to=y1-(sy2-v->cy1),tmp=x;
|
|
current_level->foreground_intersect(x,y1,tmp,draw_to);
|
|
the_game->game_to_mouse(x1,draw_to,v,i,sy1); // calculate sy1
|
|
|
|
@@ -403,7 +403,7 @@
|
|
current_object=this;
|
|
void *m=mark_heap(TMP_SPACE);
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -455,8 +455,8 @@
|
|
}
|
|
|
|
|
|
-void game_object::do_damage(int amount, game_object *from, long hitx, long hity,
|
|
- long push_xvel, long push_yvel)
|
|
+void game_object::do_damage(int amount, game_object *from, int32_t hitx, int32_t hity,
|
|
+ int32_t push_xvel, int32_t push_yvel)
|
|
{
|
|
|
|
void *d=figures[otype]->get_fun(OFUN_DAMAGE);
|
|
@@ -502,7 +502,7 @@
|
|
((cons_cell *)hy)->cdr=px;
|
|
((cons_cell *)px)->cdr=py;
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -526,8 +526,8 @@
|
|
#endif
|
|
}
|
|
|
|
-void game_object::damage_fun(int amount, game_object *from, long hitx, long hity,
|
|
- long push_xvel, long push_yvel)
|
|
+void game_object::damage_fun(int amount, game_object *from, int32_t hitx, int32_t hity,
|
|
+ int32_t push_xvel, int32_t push_yvel)
|
|
{
|
|
if (!hurtable() || !alive()) return ;
|
|
|
|
@@ -568,7 +568,7 @@
|
|
}
|
|
|
|
|
|
-void game_object::picture_space(long &x1, long &y1,long &x2, long &y2)
|
|
+void game_object::picture_space(int32_t &x1, int32_t &y1,int32_t &x2, int32_t &y2)
|
|
{
|
|
int xc=x_center(),w=picture()->width(),h=picture()->height();
|
|
if (direction>0)
|
|
@@ -604,7 +604,7 @@
|
|
}
|
|
|
|
|
|
-long game_object::x_center()
|
|
+int32_t game_object::x_center()
|
|
{
|
|
return current_sequence()->x_center(current_frame);
|
|
}
|
|
@@ -617,7 +617,7 @@
|
|
current_object=this;
|
|
|
|
void *m=mark_heap(TMP_SPACE);
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -644,7 +644,7 @@
|
|
current_object=this;
|
|
|
|
void *m=mark_heap(TMP_SPACE);
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -747,12 +747,12 @@
|
|
}
|
|
}
|
|
|
|
-game_object *game_object::try_move(long x, long y, long &xv, long &yv, int checks)
|
|
+game_object *game_object::try_move(int32_t x, int32_t y, int32_t &xv, int32_t &yv, int checks)
|
|
{
|
|
if (xv || yv) // make sure they are suggesting movement
|
|
{
|
|
game_object *who1=NULL,*who2=NULL; // who did we intersect?
|
|
- long x2,y2,h;
|
|
+ int32_t x2,y2,h;
|
|
|
|
if (checks&1)
|
|
{
|
|
@@ -790,7 +790,7 @@
|
|
|
|
void *game_object::float_tick() // returns 1 if you hit something, 0 otherwise
|
|
{
|
|
- long ret=0;
|
|
+ int32_t ret=0;
|
|
if (hp()<=0)
|
|
{
|
|
if (state!=dead)
|
|
@@ -815,8 +815,8 @@
|
|
}
|
|
}
|
|
|
|
- long fxv=sfxvel()+sfxacel(),fyv=sfyvel()+sfyacel();
|
|
- long xv=xvel()+xacel()+(fxv>>8),yv=yvel()+yacel()+(fyv>>8);
|
|
+ int32_t fxv=sfxvel()+sfxacel(),fyv=sfyvel()+sfyacel();
|
|
+ int32_t xv=xvel()+xacel()+(fxv>>8),yv=yvel()+yacel()+(fyv>>8);
|
|
|
|
if (xv!=xvel() || yv!=yvel()) // only store vel's if changed so we don't increase object size
|
|
{
|
|
@@ -833,13 +833,13 @@
|
|
|
|
if (fxv || fyv || xv || yv) // don't even try if there is no velocity
|
|
{
|
|
- long ffx=fx()+sfxvel(),ffy=fy()+sfyvel();
|
|
- long nxv=xvel()+(ffx>>8);
|
|
- long nyv=yvel()+(ffy>>8);
|
|
+ int32_t ffx=fx()+sfxvel(),ffy=fy()+sfyvel();
|
|
+ int32_t nxv=xvel()+(ffx>>8);
|
|
+ int32_t nyv=yvel()+(ffy>>8);
|
|
set_fx(ffx&0xff);
|
|
set_fy(ffy&0xff);
|
|
|
|
- long old_nxv=nxv,old_nyv=nyv;
|
|
+ int32_t old_nxv=nxv,old_nyv=nyv;
|
|
game_object *hit_object=try_move(x,y,nxv,nyv,3); // now find out what velocity is safe to use
|
|
|
|
/* if (get_cflag(CFLAG_STOPPABLE))
|
|
@@ -852,7 +852,7 @@
|
|
y+=nyv;
|
|
if (old_nxv!=nxv || old_nyv!=nyv)
|
|
{
|
|
- long lx=last_tile_hit_x,ly=last_tile_hit_y;
|
|
+ int32_t lx=last_tile_hit_x,ly=last_tile_hit_y;
|
|
stop();
|
|
if (old_nxv==0)
|
|
{
|
|
@@ -864,7 +864,7 @@
|
|
else if (old_nxv<0) ret|=BLOCKED_LEFT;
|
|
} else
|
|
{
|
|
- long tx=(old_nxv>0 ? 1 : -1),ty=0;
|
|
+ int32_t tx=(old_nxv>0 ? 1 : -1),ty=0;
|
|
try_move(x,y,tx,ty,3);
|
|
if (!tx)
|
|
ret|=(old_nxv>0 ? BLOCKED_RIGHT : BLOCKED_LEFT);
|
|
@@ -905,7 +905,7 @@
|
|
{
|
|
int blocked=0;
|
|
|
|
- long xt=0,yt=2;
|
|
+ int32_t xt=0,yt=2;
|
|
try_move(x,y-2,xt,yt,1); // make sure we are not falling through the floor
|
|
y=y-2+yt;
|
|
|
|
@@ -925,12 +925,12 @@
|
|
}
|
|
|
|
// first let's move the guy acording to his physics
|
|
- long xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
|
|
+ int32_t xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
|
|
if (xa || ya || fxa || fya)
|
|
{
|
|
int fxv=sfxvel(),fyv=sfyvel();
|
|
fxv+=fxa; fyv+=fya;
|
|
- long xv=xvel()+xa+(fxv>>8);
|
|
+ int32_t xv=xvel()+xa+(fxv>>8);
|
|
set_xvel(xvel()+xa+(fxv>>8));
|
|
set_yvel(yvel()+ya+(fyv>>8));
|
|
set_fxvel(fxv&0xff);
|
|
@@ -938,14 +938,14 @@
|
|
}
|
|
|
|
// check to see if this advancement causes him to collide with objects
|
|
- long old_vy=yvel(),old_vx=xvel(); // save the correct veloicties
|
|
+ int32_t old_vy=yvel(),old_vx=xvel(); // save the correct veloicties
|
|
|
|
if (old_vx || old_vy)
|
|
{
|
|
int up=0;
|
|
if (yvel()<=0) // if we are going up or a strait across check up and down
|
|
up=2;
|
|
- long xv=xvel(),yv=yvel();
|
|
+ int32_t xv=xvel(),yv=yvel();
|
|
game_object *h=try_move(x,y,xv,yv,1|up); // now find out what velocity is safe to use
|
|
set_xvel(xv);
|
|
set_yvel(yv);
|
|
@@ -958,7 +958,7 @@
|
|
{
|
|
if (gravity()) // was he going up or down?
|
|
{
|
|
- long fall_xv=0,old_fall_vy,fall_vy;
|
|
+ int32_t fall_xv=0,old_fall_vy,fall_vy;
|
|
old_fall_vy=fall_vy=old_vy-yvel(); // make sure he gets all of his yvel
|
|
try_move(x,y,fall_xv,fall_vy,1|up);
|
|
if (old_vy>0 && fall_vy<old_fall_vy) // he was trying to fall, but he hit the ground
|
|
@@ -1000,7 +1000,7 @@
|
|
{
|
|
if (old_vy!=0)
|
|
{
|
|
- long testx=old_vx<0 ? -1 : 1,testy=0; // see if we were stopped left/right
|
|
+ int32_t testx=old_vx<0 ? -1 : 1,testy=0; // see if we were stopped left/right
|
|
// or just up down
|
|
try_move(x,y,testx,testy,1|up);
|
|
if (testx==0) // blocked left/right, set flag
|
|
@@ -1031,9 +1031,9 @@
|
|
}
|
|
else // see if we can make him 'climb' the hill
|
|
{
|
|
- long ox=x,oy=y; // rember orginal position in case climb doesn't work
|
|
+ int32_t ox=x,oy=y; // rember orginal position in case climb doesn't work
|
|
|
|
- long climb_xvel=0,climb_yvel=-5; // try to move up one pixel to step over the
|
|
+ int32_t climb_xvel=0,climb_yvel=-5; // try to move up one pixel to step over the
|
|
try_move(x,y,climb_xvel,climb_yvel,3); // jutting polygon line
|
|
y+=climb_yvel;
|
|
|
|
@@ -1081,7 +1081,7 @@
|
|
|
|
if (yacel()==0 && !gravity()) // he is not falling, make sure he can't
|
|
{
|
|
- long nvx=0,nvy=yvel()+12; // check three pixels below for ground
|
|
+ int32_t nvx=0,nvy=yvel()+12; // check three pixels below for ground
|
|
try_move(x,y,nvx,nvy,1);
|
|
if (nvy>11) // if he falls more than 2 pixels, then he falls
|
|
{
|
|
@@ -1116,9 +1116,9 @@
|
|
int ad=current_sequence()->get_advance(current_frame);
|
|
if (ad && current_level)
|
|
{
|
|
- long xv;
|
|
+ int32_t xv;
|
|
if (direction>0) xv=ad; else xv=-ad;
|
|
- long yv=0;
|
|
+ int32_t yv=0;
|
|
try_move(x,y,xv,yv,3);
|
|
x+=xv;
|
|
}
|
|
@@ -1138,7 +1138,7 @@
|
|
}
|
|
|
|
|
|
-game_object *create(int type, long x, long y, int skip_constructor, int aitype)
|
|
+game_object *create(int type, int32_t x, int32_t y, int skip_constructor, int aitype)
|
|
{
|
|
game_object *g=new game_object(type,skip_constructor);
|
|
g->x=x; g->y=y; g->last_x=x; g->last_y=y;
|
|
@@ -1151,7 +1151,7 @@
|
|
|
|
void *m=mark_heap(TMP_SPACE);
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -1218,7 +1218,7 @@
|
|
|
|
void *m=mark_heap(TMP_SPACE);
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -1298,7 +1298,7 @@
|
|
} // not pressing left or right, so slow down or stop
|
|
else if (!gravity() && state!=start_run_jump)
|
|
{
|
|
- long stop_acel;
|
|
+ int32_t stop_acel;
|
|
if (xvel()<0) // he was going left
|
|
{
|
|
stop_acel=get_ability(type(),stop_accel); // find out how fast he can slow down
|
|
@@ -1447,21 +1447,21 @@
|
|
{
|
|
|
|
// first let's move the guy acording to his physics
|
|
- long xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
|
|
+ int32_t xa=xacel(),ya=yacel(),fxa=sfxacel(),fya=sfyacel();
|
|
if (xa || ya || fxa || fya)
|
|
{
|
|
int fxv=sfxvel(),fyv=sfyvel();
|
|
fxv+=fxa; fyv+=fya;
|
|
- long xv=xvel()+xa+(fxv>>8);
|
|
+ int32_t xv=xvel()+xa+(fxv>>8);
|
|
set_xvel(xvel()+xa+(fxv>>8));
|
|
set_yvel(yvel()+ya+(fyv>>8));
|
|
set_fxvel(fxv&0xff);
|
|
set_fyvel(fyv&0xff);
|
|
}
|
|
|
|
- long ox2,oy2;
|
|
+ int32_t ox2,oy2;
|
|
|
|
- long nx=x+xvel(),nfx=fx()+fxvel(),ny=y+yvel(),nfy=fy()+fyvel();
|
|
+ int32_t nx=x+xvel(),nfx=fx()+fxvel(),ny=y+yvel(),nfy=fy()+fyvel();
|
|
nx+=nfx>>8;
|
|
ny+=nfy>>8;
|
|
|
|
@@ -1505,7 +1505,7 @@
|
|
return 0;
|
|
}
|
|
|
|
-game_object *number_to_object_in_list(long x, object_node *list)
|
|
+game_object *number_to_object_in_list(int32_t x, object_node *list)
|
|
{
|
|
if (!x) return NULL; x--;
|
|
while (x && list) { list=list->next; x--; }
|
|
@@ -1525,9 +1525,9 @@
|
|
}
|
|
|
|
|
|
-long object_list_length(object_node *list)
|
|
+int32_t object_list_length(object_node *list)
|
|
{
|
|
- long x=0;
|
|
+ int32_t x=0;
|
|
while (list) { list=list->next; x++; }
|
|
return x;
|
|
|
|
@@ -1542,7 +1542,7 @@
|
|
int t=figures[Type]->tv;
|
|
if (t)
|
|
{
|
|
- lvars=(long *)jmalloc(t*4,"object vars");
|
|
+ lvars=(int32_t *)jmalloc(t*4,"object vars");
|
|
memset(lvars,0,t*4);
|
|
}
|
|
else lvars=NULL;
|
|
@@ -1555,7 +1555,7 @@
|
|
|
|
int game_object::reduced_state()
|
|
{
|
|
- long x=0;
|
|
+ int32_t x=0;
|
|
for (int i=0;i<figures[otype]->ts;i++)
|
|
{
|
|
if (i==state) return x;
|
|
@@ -1577,7 +1577,7 @@
|
|
game_object *o=current_object;
|
|
current_object=(game_object *)this;
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
@@ -1606,7 +1606,7 @@
|
|
int t=figures[new_type]->tv;
|
|
if (t)
|
|
{
|
|
- lvars=(long *)jmalloc(t*4,"object vars");
|
|
+ lvars=(int32_t *)jmalloc(t*4,"object vars");
|
|
memset(lvars,0,t*4);
|
|
}
|
|
else lvars=NULL;
|
|
@@ -1620,7 +1620,7 @@
|
|
|
|
void *m=mark_heap(TMP_SPACE);
|
|
|
|
- time_marker *prof1;
|
|
+ time_marker *prof1=NULL;
|
|
if (profiling())
|
|
prof1=new time_marker;
|
|
|
|
Index: abuse-sdl-0.7.0/src/include/lcache.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/lcache.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/lcache.hpp 2006-06-21 15:02:32.000000000 +0200
|
|
@@ -5,7 +5,7 @@
|
|
#ifdef SCADALISP
|
|
#define can_cache_lisp() 0
|
|
#else
|
|
-#define can_cache_lisp() 1
|
|
+#define can_cache_lisp() 0 /* XXX */
|
|
#endif
|
|
|
|
long block_size(Cell *level); // return number of bytes to save this block of code
|
|
Index: abuse-sdl-0.7.0/src/include/bus_type.hpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/include/bus_type.hpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/include/bus_type.hpp 2006-06-21 15:02:33.000000000 +0200
|
|
@@ -2,35 +2,35 @@
|
|
#define BUS_TYPE_HPP
|
|
|
|
#ifdef __sgi
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef sun
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef SUN3
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef SUN4
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef __sgi
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef _AIX
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef __sparc__
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#ifdef __arm__
|
|
-#define WORD_ALLIGN 1
|
|
+#define WORD_ALIGN 1
|
|
#endif
|
|
|
|
#endif // BUS_TYPE_HPP
|
|
Index: abuse-sdl-0.7.0/src/lisp.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/lisp.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/lisp.cpp 2006-06-21 15:02:33.000000000 +0200
|
|
@@ -171,7 +171,9 @@
|
|
|
|
void *lmalloc(int size, int which_space)
|
|
{
|
|
-#ifdef WORD_ALLIGN
|
|
+ return malloc(size); /* XXX */
|
|
+
|
|
+#ifdef WORD_ALIGN
|
|
size=(size+3)&(~3);
|
|
#endif
|
|
|
|
Index: abuse-sdl-0.7.0/src/lcache.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/lcache.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/lcache.cpp 2006-06-21 15:02:33.000000000 +0200
|
|
@@ -35,7 +35,7 @@
|
|
{ ret=sizeof(lisp_pointer); }
|
|
else ret=0;
|
|
}
|
|
-#ifdef WORD_ALLIGN
|
|
+#ifdef WORD_ALIGN
|
|
return (ret+3)&(~3);
|
|
#else
|
|
return ret;
|
|
Index: abuse-sdl-0.7.0/src/imlib/keys.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/keys.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/keys.cpp 2006-06-21 15:02:34.000000000 +0200
|
|
@@ -11,7 +11,7 @@
|
|
|
|
void key_name(int key, char *buffer)
|
|
{
|
|
- static char sing[2];
|
|
+ //static char sing[2];
|
|
if( key > 255 && key <= JK_MAX_KEY )
|
|
strcpy(buffer,jk_key_names[key-256]);
|
|
else if( key == JK_BACKSPACE )
|
|
Index: abuse-sdl-0.7.0/src/imlib/jwindow.cpp
|
|
===================================================================
|
|
--- abuse-sdl-0.7.0.orig/src/imlib/jwindow.cpp 2002-12-15 06:00:32.000000000 +0100
|
|
+++ abuse-sdl-0.7.0/src/imlib/jwindow.cpp 2006-06-21 15:02:34.000000000 +0200
|
|
@@ -175,7 +175,7 @@
|
|
ev.window->next=NULL;
|
|
if (red)
|
|
{
|
|
- jwindow *j=ev.window,*p;
|
|
+ jwindow *j=ev.window;
|
|
/* screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1);
|
|
for (p=first;p!=j;p=p->next)
|
|
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);*/
|
|
@@ -282,8 +282,8 @@
|
|
{
|
|
jwindow *p,*q;
|
|
|
|
- int mx,my,but;
|
|
- image *mouse_pic,*mouse_save;
|
|
+ int mx=0,my=0;
|
|
+ image *mouse_pic=NULL,*mouse_save=NULL;
|
|
|
|
if (has_mouse())
|
|
{
|
|
@@ -426,7 +426,7 @@
|
|
|
|
ifield *input_manager::unlink(int id) // unlinks ID from fields list and return the pointer to it
|
|
{
|
|
- for (ifield *i=first,*last;i;i=i->next)
|
|
+ for (ifield *i=first,*last=NULL;i;i=i->next)
|
|
{
|
|
if (i->id==id)
|
|
{
|