diff --git a/includes/defines.h b/includes/defines.h index 8dd1975b1..f7f459341 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,9 +8,9 @@ #endif #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 BETA +//#define BETA #define SERVER "powdertoy.co.uk" diff --git a/includes/interface.h b/includes/interface.h index a49f75f9e..ea1f9a5be 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -52,10 +52,9 @@ static menu_wall mwalls[] = #define SC_LIQUID 4 #define SC_NUCLEAR 7 #define SC_LIFE 9 -#define SC_LIFE2 10 #define SC_CRACKER 12 #define SC_CRACKER2 13 -#define SC_TOTAL 11 +#define SC_TOTAL 10 static menu_section msections[] = { diff --git a/includes/powder.h b/includes/powder.h index f5fa948d5..9964abadd 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -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}, {"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}, - {"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}, - {"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}, - {"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}, - {"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}, - {"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}, + {"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_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_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_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_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 }; diff --git a/src/graphics.c b/src/graphics.c index a3cbf8774..ea8d0d545 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -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 i, j, c; + if (x > XRES-26 || x < 0) + return 26; if (b>=UI_WALLSTART) { b = b-100; diff --git a/src/interface.c b/src/interface.c index 12f13f6cd..a762b39d7 100644 --- a/src/interface.c +++ b/src/interface.c @@ -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) { - 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; mx /= sdl_scale; my /= sdl_scale; rows = ceil((float)msections[i].itemcount/16.0f); height = (ceil((float)msections[i].itemcount/16.0f)*18); width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + fwidth = msections[i].itemcount*31; h = -1; x = XRES-BARSIZE-18; 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 (x-18<=2) + /*if (x-18<=2) { x = XRES-BARSIZE-18; y += 19; - } + }*/ x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5; if (!bq && mx>=x+32 && mx=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 (x-18<=0) + /*if (x-18<=0) { x = XRES-BARSIZE-18; y += 19; - } + }*/ x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5; if (!bq && mx>=x+32 && mx=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 (x-18<=0) + /*if (x-18<=0) { x = XRES-BARSIZE-18; y += 19; - } + }*/ x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; if (!bq && mx>=x+32 && mx=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 { + 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=x+32-xoff && mx=y && my< y+15) { - x = XRES-BARSIZE-18; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5; - if (!bq && mx>=x+32 && mx=y && my< y+15) - { - 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); h = n; } - if (!bq && mx>=x+32 && mx=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))) + if (!bq && mx>=x+32-xoff && mx=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; } 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) { - 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) { - 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) { memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); strcpy(itc_msg, "Persistent Display"); } else if (cmode==CM_PRESS) diff --git a/src/main.c b/src/main.c index 9fcebfbe9..3dbebd339 100644 --- a/src/main.c +++ b/src/main.c @@ -169,7 +169,8 @@ int FPSB = 0; int MSIGN =-1; //int CGOL = 0; //int GSPEED = 1;//causes my .exe to crash.. -int sound_enable; +int sound_enable = 0; +int file_script = 0; sign signs[MAXSIGNS]; @@ -1215,6 +1216,7 @@ int main(int argc, char *argv[]) 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; SDL_AudioSpec fmt; + int username_flash = 0, username_flash_t = 1; GSPEED = 1; /* Set 16-bit stereo audio at 22Khz */ @@ -1224,16 +1226,7 @@ int main(int argc, char *argv[]) fmt.samples = 512; fmt.callback = mixaudio; 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 numCores = core_count(); #endif @@ -1282,9 +1275,27 @@ int main(int argc, char *argv[]) else if (!strncmp(argv[i], "kiosk", 5)) { kiosk_enable = 1; - sdl_scale = 2; + //sdl_scale = 2; //Removed because some displays cannot handle the resolution 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); @@ -1401,7 +1412,6 @@ int main(int argc, char *argv[]) check_data = http_async_req_stop(http_session_check, &http_s_ret, NULL); if(http_ret==200 && check_data) { - printf("{%s}\n", check_data); if(!strncmp(check_data, "EXPIRED", 7)) { //Session expired @@ -1425,6 +1435,7 @@ int main(int argc, char *argv[]) svf_own = 0; svf_admin = 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)) { @@ -1440,9 +1451,8 @@ int main(int argc, char *argv[]) { svf_admin = 0; svf_mod = 1; - } - } - save_presets(0); + } + } } else { @@ -1456,9 +1466,26 @@ int main(int argc, char *argv[]) svf_admin = 0; svf_mod = 0; } + save_presets(0); free(check_data); } 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; } @@ -2282,8 +2309,10 @@ int main(int argc, char *argv[]) if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { login_ui(vid_buf); - if (svf_login) + if (svf_login){ save_presets(0); + http_session_check = NULL; + } } if (x>=37 && x<=187 && svf_login) { @@ -2303,6 +2332,7 @@ int main(int argc, char *argv[]) { search_ui(vid_buf); memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); memset(fire_r, 0, sizeof(fire_r)); memset(fire_g, 0, sizeof(fire_g)); 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) { - 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