mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-19 14:41:29 +02:00
Visual Studio compatibility
Also fix two compiler warnings
This commit is contained in:
@@ -83,6 +83,10 @@ typedef unsigned int pixel;
|
|||||||
#define GLASS_IOR 1.9
|
#define GLASS_IOR 1.9
|
||||||
#define GLASS_DISP 0.07
|
#define GLASS_DISP 0.07
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
|
|
||||||
extern int amd;
|
extern int amd;
|
||||||
|
@@ -3841,7 +3841,7 @@ struct command_history {
|
|||||||
typedef struct command_history command_history;
|
typedef struct command_history command_history;
|
||||||
command_history *last_command = NULL;
|
command_history *last_command = NULL;
|
||||||
char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
|
char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
|
||||||
int mx,my,b,bq,cc,ci = -1;
|
int mx,my,b,cc,ci = -1;
|
||||||
command_history *currentcommand;
|
command_history *currentcommand;
|
||||||
ui_edit ed;
|
ui_edit ed;
|
||||||
ed.x = 15;
|
ed.x = 15;
|
||||||
@@ -3857,7 +3857,6 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
|||||||
//fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
|
//fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
|
||||||
while (!sdl_poll())
|
while (!sdl_poll())
|
||||||
{
|
{
|
||||||
bq = b;
|
|
||||||
b = SDL_GetMouseState(&mx, &my);
|
b = SDL_GetMouseState(&mx, &my);
|
||||||
mx /= sdl_scale;
|
mx /= sdl_scale;
|
||||||
my /= sdl_scale;
|
my /= sdl_scale;
|
||||||
@@ -3994,9 +3993,9 @@ int console_parse_coords(char *txt, int *x, int *y, char *err)
|
|||||||
}
|
}
|
||||||
int console_parse_partref(char *txt, int *which, char *err)
|
int console_parse_partref(char *txt, int *which, char *err)
|
||||||
{
|
{
|
||||||
|
int i = -1, nx, ny;
|
||||||
strcpy(err,"");
|
strcpy(err,"");
|
||||||
// TODO: use regex?
|
// TODO: use regex?
|
||||||
int i = -1, nx, ny;
|
|
||||||
if (strchr(txt,',') && console_parse_coords(txt, &nx, &ny, err))
|
if (strchr(txt,',') && console_parse_coords(txt, &nx, &ny, err))
|
||||||
{
|
{
|
||||||
i = pmap[ny][nx];
|
i = pmap[ny][nx];
|
||||||
|
16
src/main.c
16
src/main.c
@@ -1198,9 +1198,9 @@ int main(int argc, char *argv[])
|
|||||||
void *load_data=NULL;
|
void *load_data=NULL;
|
||||||
pixel *load_img=NULL;//, *fbi_img=NULL;
|
pixel *load_img=NULL;//, *fbi_img=NULL;
|
||||||
int save_mode=0, save_x=0, save_y=0, save_w=0, save_h=0, copy_mode=0;
|
int save_mode=0, save_x=0, save_y=0, save_w=0, save_h=0, copy_mode=0;
|
||||||
|
SDL_AudioSpec fmt;
|
||||||
GSPEED = 1;
|
GSPEED = 1;
|
||||||
|
|
||||||
SDL_AudioSpec fmt;
|
|
||||||
/* Set 16-bit stereo audio at 22Khz */
|
/* Set 16-bit stereo audio at 22Khz */
|
||||||
fmt.freq = 22050;
|
fmt.freq = 22050;
|
||||||
fmt.format = AUDIO_S16;
|
fmt.format = AUDIO_S16;
|
||||||
@@ -2361,16 +2361,18 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
int sldr;
|
int sldr;
|
||||||
|
char *buff2;
|
||||||
|
|
||||||
memset(buff, 0, sizeof(buff));
|
memset(buff, 0, sizeof(buff));
|
||||||
|
|
||||||
for(sldr=3; signs[signi].text[sldr] != '|'; sldr++)
|
for(sldr=3; signs[signi].text[sldr] != '|'; sldr++)
|
||||||
buff[sldr-3] = signs[signi].text[sldr];
|
buff[sldr-3] = signs[signi].text[sldr];
|
||||||
|
|
||||||
char buff2[sldr-2]; //TODO: Fix this for Visual Studio
|
buff2 = malloc(sldr-2);
|
||||||
memset(buff2, 0, sizeof(buff2));
|
memset(buff2, 0, sldr-2);
|
||||||
memcpy(&buff2, &buff, sldr-3);
|
memcpy(&buff2, &buff, sldr-3);
|
||||||
open_ui(vid_buf, buff2, 0);
|
open_ui(vid_buf, buff2, 0);
|
||||||
|
free(buff2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2753,18 +2755,18 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
|
|||||||
FILE *f=fopen(console3, "r");
|
FILE *f=fopen(console3, "r");
|
||||||
if(f)
|
if(f)
|
||||||
{
|
{
|
||||||
|
char fileread[5000];//TODO: make this change with file size
|
||||||
|
char pch[5000];
|
||||||
|
char tokens[10];
|
||||||
|
int tokensize;
|
||||||
nx = 0;
|
nx = 0;
|
||||||
ny = 0;
|
ny = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
m = 0;
|
m = 0;
|
||||||
if(console4)
|
if(console4)
|
||||||
console_parse_coords(console4, &nx , &ny, console_error);
|
console_parse_coords(console4, &nx , &ny, console_error);
|
||||||
char fileread[5000];//TODO: make this change with file size
|
|
||||||
char pch[5000];
|
|
||||||
memset(pch,0,sizeof(pch));
|
memset(pch,0,sizeof(pch));
|
||||||
memset(fileread,0,sizeof(fileread));
|
memset(fileread,0,sizeof(fileread));
|
||||||
char tokens[10];
|
|
||||||
int tokensize;
|
|
||||||
fread(fileread,1,5000,f);
|
fread(fileread,1,5000,f);
|
||||||
for(i=0; i<strlen(fileread); i++)
|
for(i=0; i<strlen(fileread); i++)
|
||||||
{
|
{
|
||||||
|
@@ -454,7 +454,7 @@ inline void part_change_type(int i, int x, int y, int t)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
|
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
|
||||||
return -1;
|
return;
|
||||||
parts[i].type = t;
|
parts[i].type = t;
|
||||||
if (t==PT_PHOT)// || t==PT_NEUT)
|
if (t==PT_PHOT)// || t==PT_NEUT)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user