Merge branch 'upstream' into dev
Conflicts: src/main.c
This commit is contained in:
commit
c9725c6004
@ -8,9 +8,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAVE_VERSION 46
|
#define SAVE_VERSION 46
|
||||||
#define MINOR_VERSION 1
|
#define MINOR_VERSION 3
|
||||||
#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 BETA
|
//#define BETA
|
||||||
|
|
||||||
#define SERVER "powdertoy.co.uk"
|
#define SERVER "powdertoy.co.uk"
|
||||||
|
|
||||||
|
@ -52,10 +52,9 @@ static menu_wall mwalls[] =
|
|||||||
#define SC_LIQUID 4
|
#define SC_LIQUID 4
|
||||||
#define SC_NUCLEAR 7
|
#define SC_NUCLEAR 7
|
||||||
#define SC_LIFE 9
|
#define SC_LIFE 9
|
||||||
#define SC_LIFE2 10
|
|
||||||
#define SC_CRACKER 12
|
#define SC_CRACKER 12
|
||||||
#define SC_CRACKER2 13
|
#define SC_CRACKER2 13
|
||||||
#define SC_TOTAL 11
|
#define SC_TOTAL 10
|
||||||
|
|
||||||
static menu_section msections[] =
|
static menu_section msections[] =
|
||||||
{
|
{
|
||||||
|
@ -511,11 +511,11 @@ static const part_type ptypes[PT_NUM] =
|
|||||||
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
|
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
|
||||||
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -448,6 +448,8 @@ void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswa
|
|||||||
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
|
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
|
||||||
{
|
{
|
||||||
int i, j, c;
|
int i, j, c;
|
||||||
|
if (x > XRES-26 || x < 0)
|
||||||
|
return 26;
|
||||||
if (b>=UI_WALLSTART)
|
if (b>=UI_WALLSTART)
|
||||||
{
|
{
|
||||||
b = b-100;
|
b = b-100;
|
||||||
|
@ -1531,13 +1531,14 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
|
|||||||
|
|
||||||
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
|
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
|
||||||
{
|
{
|
||||||
int h,x,y,n=0,height,width,sy,rows=0;
|
int h,x,y,n=0,height,width,sy,rows=0,xoff=0,fwidth;
|
||||||
SEC = SEC2;
|
SEC = SEC2;
|
||||||
mx /= sdl_scale;
|
mx /= sdl_scale;
|
||||||
my /= sdl_scale;
|
my /= sdl_scale;
|
||||||
rows = ceil((float)msections[i].itemcount/16.0f);
|
rows = ceil((float)msections[i].itemcount/16.0f);
|
||||||
height = (ceil((float)msections[i].itemcount/16.0f)*18);
|
height = (ceil((float)msections[i].itemcount/16.0f)*18);
|
||||||
width = restrict_flt(msections[i].itemcount*31, 0, 16*31);
|
width = restrict_flt(msections[i].itemcount*31, 0, 16*31);
|
||||||
|
fwidth = msections[i].itemcount*31;
|
||||||
h = -1;
|
h = -1;
|
||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y = YRES+1;
|
y = YRES+1;
|
||||||
@ -1548,11 +1549,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
{
|
{
|
||||||
if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
|
if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
|
||||||
{
|
{
|
||||||
if (x-18<=2)
|
/*if (x-18<=2)
|
||||||
{
|
{
|
||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y += 19;
|
y += 19;
|
||||||
}
|
}*/
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
@ -1585,11 +1586,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
{
|
{
|
||||||
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
|
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
|
||||||
{
|
{
|
||||||
if (x-18<=0)
|
/*if (x-18<=0)
|
||||||
{
|
{
|
||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y += 19;
|
y += 19;
|
||||||
}
|
}*/
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
@ -1619,11 +1620,11 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
{
|
{
|
||||||
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
||||||
{
|
{
|
||||||
if (x-18<=0)
|
/*if (x-18<=0)
|
||||||
{
|
{
|
||||||
x = XRES-BARSIZE-18;
|
x = XRES-BARSIZE-18;
|
||||||
y += 19;
|
y += 19;
|
||||||
}
|
}*/
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
@ -1652,37 +1653,36 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (fwidth > XRES-BARSIZE){
|
||||||
|
float overflow = fwidth-(XRES-BARSIZE), location = ((float)XRES-BARSIZE)/((float)(mx-(XRES-BARSIZE)));
|
||||||
|
xoff = (int)(overflow / location);
|
||||||
|
}
|
||||||
for (n = 0; n<PT_NUM; n++)
|
for (n = 0; n<PT_NUM; n++)
|
||||||
{
|
{
|
||||||
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
||||||
{
|
{
|
||||||
if (x-18<=0)
|
x -= draw_tool_xy(vid_buf, x-xoff, y, n, ptypes[n].pcolors)+5;
|
||||||
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15)
|
||||||
{
|
{
|
||||||
x = XRES-BARSIZE-18;
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 0, 0, 255);
|
||||||
y += 19;
|
|
||||||
}
|
|
||||||
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
|
||||||
{
|
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
|
|
||||||
h = n;
|
h = n;
|
||||||
}
|
}
|
||||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
|
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
h = n;
|
h = n;
|
||||||
}
|
}
|
||||||
else if (n==SLALT)
|
else if (n==SLALT)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
}
|
}
|
||||||
else if (n==*sl)
|
else if (n==*sl)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 0, 0, 255);
|
||||||
}
|
}
|
||||||
else if (n==*sr)
|
else if (n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1889,6 +1889,7 @@ void set_cmode(int cm)
|
|||||||
else if (cmode==CM_PERS)
|
else if (cmode==CM_PERS)
|
||||||
{
|
{
|
||||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||||
|
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||||
strcpy(itc_msg, "Persistent Display");
|
strcpy(itc_msg, "Persistent Display");
|
||||||
}
|
}
|
||||||
else if (cmode==CM_PRESS)
|
else if (cmode==CM_PRESS)
|
||||||
|
209
src/main.c
209
src/main.c
@ -169,7 +169,8 @@ int FPSB = 0;
|
|||||||
int MSIGN =-1;
|
int MSIGN =-1;
|
||||||
//int CGOL = 0;
|
//int CGOL = 0;
|
||||||
//int GSPEED = 1;//causes my .exe to crash..
|
//int GSPEED = 1;//causes my .exe to crash..
|
||||||
int sound_enable;
|
int sound_enable = 0;
|
||||||
|
int file_script = 0;
|
||||||
|
|
||||||
sign signs[MAXSIGNS];
|
sign signs[MAXSIGNS];
|
||||||
|
|
||||||
@ -1215,6 +1216,7 @@ int main(int argc, char *argv[])
|
|||||||
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;
|
SDL_AudioSpec fmt;
|
||||||
|
int username_flash = 0, username_flash_t = 1;
|
||||||
GSPEED = 1;
|
GSPEED = 1;
|
||||||
|
|
||||||
/* Set 16-bit stereo audio at 22Khz */
|
/* Set 16-bit stereo audio at 22Khz */
|
||||||
@ -1224,16 +1226,7 @@ int main(int argc, char *argv[])
|
|||||||
fmt.samples = 512;
|
fmt.samples = 512;
|
||||||
fmt.callback = mixaudio;
|
fmt.callback = mixaudio;
|
||||||
fmt.userdata = NULL;
|
fmt.userdata = NULL;
|
||||||
/* Open the audio device and start playing sound! */
|
|
||||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sound_enable = 1;
|
|
||||||
SDL_PauseAudio(0);
|
|
||||||
}
|
|
||||||
#ifdef MT
|
#ifdef MT
|
||||||
numCores = core_count();
|
numCores = core_count();
|
||||||
#endif
|
#endif
|
||||||
@ -1282,9 +1275,27 @@ int main(int argc, char *argv[])
|
|||||||
else if (!strncmp(argv[i], "kiosk", 5))
|
else if (!strncmp(argv[i], "kiosk", 5))
|
||||||
{
|
{
|
||||||
kiosk_enable = 1;
|
kiosk_enable = 1;
|
||||||
sdl_scale = 2;
|
//sdl_scale = 2; //Removed because some displays cannot handle the resolution
|
||||||
hud_enable = 0;
|
hud_enable = 0;
|
||||||
}
|
}
|
||||||
|
else if (!strncmp(argv[i], "sound", 5))
|
||||||
|
{
|
||||||
|
/* Open the audio device and start playing sound! */
|
||||||
|
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sound_enable = 1;
|
||||||
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strncmp(argv[i], "scripts", 5))
|
||||||
|
{
|
||||||
|
file_script = 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save_presets(0);
|
save_presets(0);
|
||||||
@ -1401,7 +1412,6 @@ int main(int argc, char *argv[])
|
|||||||
check_data = http_async_req_stop(http_session_check, &http_s_ret, NULL);
|
check_data = http_async_req_stop(http_session_check, &http_s_ret, NULL);
|
||||||
if(http_ret==200 && check_data)
|
if(http_ret==200 && check_data)
|
||||||
{
|
{
|
||||||
printf("{%s}\n", check_data);
|
|
||||||
if(!strncmp(check_data, "EXPIRED", 7))
|
if(!strncmp(check_data, "EXPIRED", 7))
|
||||||
{
|
{
|
||||||
//Session expired
|
//Session expired
|
||||||
@ -1425,6 +1435,7 @@ int main(int argc, char *argv[])
|
|||||||
svf_own = 0;
|
svf_own = 0;
|
||||||
svf_admin = 0;
|
svf_admin = 0;
|
||||||
svf_mod = 0;
|
svf_mod = 0;
|
||||||
|
error_ui(vid_buf, "Unable to log in", "Your account has been suspended, consider reading the rules.");
|
||||||
}
|
}
|
||||||
else if(!strncmp(check_data, "OK", 2))
|
else if(!strncmp(check_data, "OK", 2))
|
||||||
{
|
{
|
||||||
@ -1440,9 +1451,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
svf_admin = 0;
|
svf_admin = 0;
|
||||||
svf_mod = 1;
|
svf_mod = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save_presets(0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1456,9 +1466,26 @@ int main(int argc, char *argv[])
|
|||||||
svf_admin = 0;
|
svf_admin = 0;
|
||||||
svf_mod = 0;
|
svf_mod = 0;
|
||||||
}
|
}
|
||||||
|
save_presets(0);
|
||||||
free(check_data);
|
free(check_data);
|
||||||
}
|
}
|
||||||
http_session_check = NULL;
|
http_session_check = NULL;
|
||||||
|
} else {
|
||||||
|
clearrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14);
|
||||||
|
drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255);
|
||||||
|
drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255);
|
||||||
|
if(username_flash>30){
|
||||||
|
username_flash_t = -1;
|
||||||
|
username_flash = 30;
|
||||||
|
} else if(username_flash<0) {
|
||||||
|
username_flash_t = 1;
|
||||||
|
username_flash = 0;
|
||||||
|
}
|
||||||
|
username_flash += username_flash_t;
|
||||||
|
if (svf_login)
|
||||||
|
drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 175-(username_flash*5));
|
||||||
|
else
|
||||||
|
drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[checking]", 255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
do_s_check = (do_s_check+1) & 15;
|
do_s_check = (do_s_check+1) & 15;
|
||||||
}
|
}
|
||||||
@ -2282,8 +2309,10 @@ int main(int argc, char *argv[])
|
|||||||
if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476)))
|
if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476)))
|
||||||
{
|
{
|
||||||
login_ui(vid_buf);
|
login_ui(vid_buf);
|
||||||
if (svf_login)
|
if (svf_login){
|
||||||
save_presets(0);
|
save_presets(0);
|
||||||
|
http_session_check = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (x>=37 && x<=187 && svf_login)
|
if (x>=37 && x<=187 && svf_login)
|
||||||
{
|
{
|
||||||
@ -2303,6 +2332,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
search_ui(vid_buf);
|
search_ui(vid_buf);
|
||||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||||
|
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||||
memset(fire_r, 0, sizeof(fire_r));
|
memset(fire_r, 0, sizeof(fire_r));
|
||||||
memset(fire_g, 0, sizeof(fire_g));
|
memset(fire_g, 0, sizeof(fire_g));
|
||||||
memset(fire_b, 0, sizeof(fire_b));
|
memset(fire_b, 0, sizeof(fire_b));
|
||||||
@ -2736,83 +2766,92 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
|
|||||||
}
|
}
|
||||||
else if(strcmp(console2, "file")==0)
|
else if(strcmp(console2, "file")==0)
|
||||||
{
|
{
|
||||||
FILE *f=fopen(console3, "r");
|
if(file_script){
|
||||||
if(f)
|
FILE *f=fopen(console3, "r");
|
||||||
{
|
if(f)
|
||||||
char fileread[5000];//TODO: make this change with file size
|
|
||||||
char pch[5000];
|
|
||||||
char tokens[10];
|
|
||||||
int tokensize;
|
|
||||||
nx = 0;
|
|
||||||
ny = 0;
|
|
||||||
j = 0;
|
|
||||||
m = 0;
|
|
||||||
console_parse_coords(console4, &nx , &ny, console_error);
|
|
||||||
memset(pch,0,sizeof(pch));
|
|
||||||
memset(fileread,0,sizeof(fileread));
|
|
||||||
fread(fileread,1,5000,f);
|
|
||||||
for(i=0; i<strlen(fileread); i++)
|
|
||||||
{
|
{
|
||||||
if(fileread[i] != '\n')
|
char fileread[5000];//TODO: make this change with file size
|
||||||
|
char pch[5000];
|
||||||
|
char tokens[10];
|
||||||
|
int tokensize;
|
||||||
|
nx = 0;
|
||||||
|
ny = 0;
|
||||||
|
j = 0;
|
||||||
|
m = 0;
|
||||||
|
console_parse_coords(console4, &nx , &ny, console_error);
|
||||||
|
memset(pch,0,sizeof(pch));
|
||||||
|
memset(fileread,0,sizeof(fileread));
|
||||||
|
fread(fileread,1,5000,f);
|
||||||
|
for(i=0; i<strlen(fileread); i++)
|
||||||
{
|
{
|
||||||
pch[i-j] = fileread[i];
|
if(fileread[i] != '\n')
|
||||||
if(fileread[i] != ' ')
|
|
||||||
tokens[i-m] = fileread[i];
|
|
||||||
}
|
|
||||||
if(fileread[i] == ' ' || fileread[i] == '\n')
|
|
||||||
{
|
|
||||||
if(sregexp(tokens,"^x.[0-9],y.[0-9]")==0)//TODO: fix regex matching to work with x,y ect, right now it has to have a +0 or -0
|
|
||||||
{
|
{
|
||||||
char temp[5];
|
pch[i-j] = fileread[i];
|
||||||
int starty = 0;
|
if(fileread[i] != ' ')
|
||||||
tokensize = strlen(tokens);
|
tokens[i-m] = fileread[i];
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
sscanf(tokens,"x%d,y%d",&x,&y);
|
|
||||||
sscanf(tokens,"%9s,%9s",xcoord,ycoord);
|
|
||||||
x += nx;
|
|
||||||
y += ny;
|
|
||||||
sprintf(xcoord,"%d",x);
|
|
||||||
sprintf(ycoord,"%d",y);
|
|
||||||
for(k = 0; k<strlen(xcoord);k++)//rewrite pch with numbers
|
|
||||||
{
|
|
||||||
pch[i-j-tokensize+k] = xcoord[k];
|
|
||||||
starty = k+1;
|
|
||||||
}
|
|
||||||
pch[i-j-tokensize+starty] = ',';
|
|
||||||
starty++;
|
|
||||||
for(k=0;k<strlen(ycoord);k++)
|
|
||||||
{
|
|
||||||
pch[i-j-tokensize+starty+k] = ycoord[k];
|
|
||||||
|
|
||||||
}
|
|
||||||
pch[i-j-tokensize +strlen(xcoord) +1 +strlen(ycoord)] = ' ';
|
|
||||||
j = j -tokensize +strlen(xcoord) +1 +strlen(ycoord);
|
|
||||||
}
|
}
|
||||||
memset(tokens,0,sizeof(tokens));
|
if(fileread[i] == ' ' || fileread[i] == '\n')
|
||||||
m = i+1;
|
|
||||||
}
|
|
||||||
if(fileread[i] == '\n')
|
|
||||||
{
|
|
||||||
|
|
||||||
if(do_next)
|
|
||||||
{
|
{
|
||||||
if(strcmp(pch,"else")==0)
|
if(sregexp(tokens,"^x.[0-9],y.[0-9]")==0)//TODO: fix regex matching to work with x,y ect, right now it has to have a +0 or -0
|
||||||
do_next = 0;
|
{
|
||||||
else
|
char temp[5];
|
||||||
do_next = process_command(vid_buf, pch, console_error);
|
int starty = 0;
|
||||||
|
tokensize = strlen(tokens);
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
sscanf(tokens,"x%d,y%d",&x,&y);
|
||||||
|
sscanf(tokens,"%9s,%9s",xcoord,ycoord);
|
||||||
|
x += nx;
|
||||||
|
y += ny;
|
||||||
|
sprintf(xcoord,"%d",x);
|
||||||
|
sprintf(ycoord,"%d",y);
|
||||||
|
for(k = 0; k<strlen(xcoord);k++)//rewrite pch with numbers
|
||||||
|
{
|
||||||
|
pch[i-j-tokensize+k] = xcoord[k];
|
||||||
|
starty = k+1;
|
||||||
|
}
|
||||||
|
pch[i-j-tokensize+starty] = ',';
|
||||||
|
starty++;
|
||||||
|
for(k=0;k<strlen(ycoord);k++)
|
||||||
|
{
|
||||||
|
pch[i-j-tokensize+starty+k] = ycoord[k];
|
||||||
|
|
||||||
|
}
|
||||||
|
pch[i-j-tokensize +strlen(xcoord) +1 +strlen(ycoord)] = ' ';
|
||||||
|
j = j -tokensize +strlen(xcoord) +1 +strlen(ycoord);
|
||||||
|
}
|
||||||
|
memset(tokens,0,sizeof(tokens));
|
||||||
|
m = i+1;
|
||||||
|
}
|
||||||
|
if(fileread[i] == '\n')
|
||||||
|
{
|
||||||
|
|
||||||
|
if(do_next)
|
||||||
|
{
|
||||||
|
if(strcmp(pch,"else")==0)
|
||||||
|
do_next = 0;
|
||||||
|
else
|
||||||
|
do_next = process_command(vid_buf, pch, console_error);
|
||||||
|
}
|
||||||
|
else if(strcmp(pch,"endif")==0 || strcmp(pch,"else")==0)
|
||||||
|
do_next = 1;
|
||||||
|
memset(pch,0,sizeof(pch));
|
||||||
|
j = i+1;
|
||||||
}
|
}
|
||||||
else if(strcmp(pch,"endif")==0 || strcmp(pch,"else")==0)
|
|
||||||
do_next = 1;
|
|
||||||
memset(pch,0,sizeof(pch));
|
|
||||||
j = i+1;
|
|
||||||
}
|
}
|
||||||
|
//sprintf(console_error, "%s exists", console3);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(console_error, "%s does not exist", console3);
|
||||||
}
|
}
|
||||||
//sprintf(console_error, "%s exists", console3);
|
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf(console_error, "%s does not exist", console3);
|
{
|
||||||
|
sprintf(console_error, "Scripts are not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(strcmp(console2, "sound")==0)
|
else if(strcmp(console2, "sound")==0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user