Changes for Windows Compilation
This commit is contained in:
parent
7076587196
commit
5a41f64a08
60
powder.c
60
powder.c
@ -352,7 +352,11 @@ void *update_air_th(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline unsigned clamp_flt(float f, float min, float max)
|
||||||
|
#else
|
||||||
inline unsigned clamp_flt(float f, float min, float max)
|
inline unsigned clamp_flt(float f, float min, float max)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if(f<min)
|
if(f<min)
|
||||||
return 0;
|
return 0;
|
||||||
@ -361,7 +365,11 @@ inline unsigned clamp_flt(float f, float min, float max)
|
|||||||
return (int)(255.0f*(f-min)/(max-min));
|
return (int)(255.0f*(f-min)/(max-min));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline float restrict_flt(float f, float min, float max)
|
||||||
|
#else
|
||||||
inline float restrict_flt(float f, float min, float max)
|
inline float restrict_flt(float f, float min, float max)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if(f<min)
|
if(f<min)
|
||||||
return min;
|
return min;
|
||||||
@ -933,7 +941,11 @@ void kill_part(int i)
|
|||||||
pfree = i;
|
pfree = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int create_part(int p, int x, int y, int t)
|
||||||
|
#else
|
||||||
inline int create_part(int p, int x, int y, int t)
|
inline int create_part(int p, int x, int y, int t)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1125,7 +1137,11 @@ inline int create_part(int p, int x, int y, int t)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline void delete_part(int x, int y)
|
||||||
|
#else
|
||||||
inline void delete_part(int x, int y)
|
inline void delete_part(int x, int y)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
@ -1139,7 +1155,11 @@ inline void delete_part(int x, int y)
|
|||||||
pmap[y][x] = 0; // just in case
|
pmap[y][x] = 0; // just in case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||||
|
#else
|
||||||
inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
pixel t;
|
pixel t;
|
||||||
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
||||||
@ -1154,7 +1174,12 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
|||||||
vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b);
|
vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int sign(float i) //Signum function
|
//Signum function
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int sign(float i)
|
||||||
|
#else
|
||||||
|
inline int sign(float i)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (i<0)
|
if (i<0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1223,11 +1248,20 @@ void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
|||||||
|
|
||||||
int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a);
|
int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int is_wire(int x, int y)
|
||||||
|
#else
|
||||||
inline int is_wire(int x, int y)
|
inline int is_wire(int x, int y)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12;
|
return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int is_wire_off(int x, int y)
|
||||||
|
#else
|
||||||
inline int is_wire_off(int x, int y)
|
inline int is_wire_off(int x, int y)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8;
|
return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8;
|
||||||
}
|
}
|
||||||
@ -1288,7 +1322,11 @@ void set_emap(int x, int y)
|
|||||||
set_emap(x, y+1);
|
set_emap(x, y+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int parts_avg(int ci, int ni)
|
||||||
|
#else
|
||||||
inline int parts_avg(int ci, int ni)
|
inline int parts_avg(int ci, int ni)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)];
|
int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)];
|
||||||
if((pmr>>8) < NPART && (pmr>>8) >= 0)
|
if((pmr>>8) < NPART && (pmr>>8) >= 0)
|
||||||
@ -2940,6 +2978,8 @@ justdraw:
|
|||||||
}
|
}
|
||||||
} else if(t==PT_PLUT&&cmode == 3)
|
} else if(t==PT_PLUT&&cmode == 3)
|
||||||
{
|
{
|
||||||
|
int tempx;
|
||||||
|
int tempy;
|
||||||
cr = 0x40;
|
cr = 0x40;
|
||||||
cg = 0x70;
|
cg = 0x70;
|
||||||
cb = 0x20;
|
cb = 0x20;
|
||||||
@ -2948,8 +2988,8 @@ justdraw:
|
|||||||
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
|
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
|
||||||
blendpixel(vid, nx, ny+1, cr, cg, cb, 96);
|
blendpixel(vid, nx, ny+1, cr, cg, cb, 96);
|
||||||
blendpixel(vid, nx, ny-1, cr, cg, cb, 96);
|
blendpixel(vid, nx, ny-1, cr, cg, cb, 96);
|
||||||
for(int tempx = 2; tempx < 10; tempx++) {
|
for(tempx = 2; tempx < 10; tempx++) {
|
||||||
for(int tempy = 2; tempy < 10; tempy++) {
|
for(tempy = 2; tempy < 10; tempy++) {
|
||||||
blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5);
|
||||||
blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5);
|
||||||
blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5);
|
||||||
@ -2958,6 +2998,8 @@ justdraw:
|
|||||||
}
|
}
|
||||||
} else if(t==PT_URAN&&cmode == 3)
|
} else if(t==PT_URAN&&cmode == 3)
|
||||||
{
|
{
|
||||||
|
int tempx;
|
||||||
|
int tempy;
|
||||||
cr = 0x70;
|
cr = 0x70;
|
||||||
cg = 0x70;
|
cg = 0x70;
|
||||||
cb = 0x20;
|
cb = 0x20;
|
||||||
@ -2966,8 +3008,8 @@ justdraw:
|
|||||||
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
|
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
|
||||||
blendpixel(vid, nx, ny+1, cr, cg, cb, 96);
|
blendpixel(vid, nx, ny+1, cr, cg, cb, 96);
|
||||||
blendpixel(vid, nx, ny-1, cr, cg, cb, 96);
|
blendpixel(vid, nx, ny-1, cr, cg, cb, 96);
|
||||||
for(int tempx = 2; tempx < 10; tempx++) {
|
for(tempx = 2; tempx < 10; tempx++) {
|
||||||
for(int tempy = 2; tempy < 10; tempy++) {
|
for(tempy = 2; tempy < 10; tempy++) {
|
||||||
blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5);
|
||||||
blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5);
|
||||||
blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5);
|
blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5);
|
||||||
@ -5292,7 +5334,11 @@ void del_stamp(int d)
|
|||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||||
|
#else
|
||||||
inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
pixel t;
|
pixel t;
|
||||||
if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE)
|
if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE)
|
||||||
@ -5307,7 +5353,11 @@ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
|||||||
vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b);
|
vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
||||||
|
#else
|
||||||
inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int i, j, w, bn = 0, ba = 0;
|
int i, j, w, bn = 0, ba = 0;
|
||||||
char *rp = font_data + font_ptrs[c];
|
char *rp = font_data + font_ptrs[c];
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#define SAVE_VERSION 40
|
#define SAVE_VERSION 41
|
||||||
#define MINOR_VERSION 3
|
#define MINOR_VERSION 0
|
||||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||||
|
|
||||||
#define MENUV3
|
#define MENUV3
|
||||||
|
Reference in New Issue
Block a user