This commit is contained in:
Felix Wallin 2010-12-20 14:34:55 +01:00
parent cb6597f9e1
commit 14b4dfef87
8 changed files with 2580 additions and 2587 deletions

View File

@ -2,7 +2,7 @@ SOURCES := src/*.c
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
LFLAGS := -B static -lSDL -lm -lbz2 LFLAGS := -lSDL -lm -lbz2
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2
MFLAGS_SSE := -march=native -DX86 -DX86_SSE MFLAGS_SSE := -march=native -DX86 -DX86_SSE

4
includes/font.h Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ struct menu_section
char *icon; char *icon;
const char *name; const char *name;
int itemcount; int itemcount;
int doshow; int doshow;
}; };
typedef struct menu_section menu_section; typedef struct menu_section menu_section;

View File

@ -240,7 +240,7 @@ struct part_type
unsigned char hconduct; unsigned char hconduct;
const char *descs; const char *descs;
const unsigned short properties; const unsigned short properties;
int (*update_func) (int); int (*update_func) (int);
}; };
typedef struct part_type part_type; typedef struct part_type part_type;
@ -397,8 +397,8 @@ static const part_type ptypes[PT_NUM] =
{"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID, NULL}, {"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID, NULL},
{"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL}, {"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL}, {"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL}, {"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, 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
}; };
static part_state pstates[PT_NUM] = static part_state pstates[PT_NUM] =
@ -538,43 +538,43 @@ static part_state pstates[PT_NUM] =
static int grule[NGOL][9] = static int grule[NGOL][9] =
{ {
// 0,1,2,3,4,5,6,7,8 live=1 spawn=2 spawn&live=3 // 0,1,2,3,4,5,6,7,8 live=1 spawn=2 spawn&live=3
{0,0,0,0,0,0,0,0,0},//blank {0,0,0,0,0,0,0,0,0},//blank
{0,0,1,3,0,0,0,0,0},//GOL {0,0,1,3,0,0,0,0,0},//GOL
{0,0,1,3,0,0,2,0,0},//HLIF {0,0,1,3,0,0,2,0,0},//HLIF
{0,0,0,2,3,3,1,1,0},//ASIM {0,0,0,2,3,3,1,1,0},//ASIM
{0,1,1,2,0,1,2,0,0},//2x2 {0,1,1,2,0,1,2,0,0},//2x2
{0,0,0,3,1,0,3,3,3},//DANI {0,0,0,3,1,0,3,3,3},//DANI
{0,1,0,3,0,3,0,2,1},//AMOE {0,1,0,3,0,3,0,2,1},//AMOE
{0,0,1,2,1,1,2,0,2},//MOVE {0,0,1,2,1,1,2,0,2},//MOVE
{0,0,1,3,0,2,0,2,1},//PGOL {0,0,1,3,0,2,0,2,1},//PGOL
{0,0,0,2,0,3,3,3,3},//DMOE {0,0,0,2,0,3,3,3,3},//DMOE
{0,0,0,3,3,0,0,0,0},//34 {0,0,0,3,3,0,0,0,0},//34
{0,0,0,2,2,3,0,0,0},//LLIF {0,0,0,2,2,3,0,0,0},//LLIF
{0,0,1,3,0,1,3,3,3},//STAN {0,0,1,3,0,1,3,3,3},//STAN
}; };
static int loverule[9][9] = static int loverule[9][9] =
{ {
{0,0,1,1,0,0,0,0,0}, {0,0,1,1,0,0,0,0,0},
{0,1,0,0,1,1,0,0,0}, {0,1,0,0,1,1,0,0,0},
{1,0,0,0,0,0,1,0,0}, {1,0,0,0,0,0,1,0,0},
{1,0,0,0,0,0,0,1,0}, {1,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,0,1}, {0,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,1,0}, {1,0,0,0,0,0,0,1,0},
{1,0,0,0,0,0,1,0,0}, {1,0,0,0,0,0,1,0,0},
{0,1,0,0,1,1,0,0,0}, {0,1,0,0,1,1,0,0,0},
{0,0,1,1,0,0,0,0,0}, {0,0,1,1,0,0,0,0,0},
}; };
static int lolzrule[9][9] = static int lolzrule[9][9] =
{ {
{0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,1,0,0}, {1,0,0,0,0,0,1,0,0},
{1,0,0,0,0,0,1,0,0}, {1,0,0,0,0,0,1,0,0},
{1,0,0,1,1,0,0,1,0}, {1,0,0,1,1,0,0,1,0},
{1,0,1,0,0,1,0,1,0}, {1,0,1,0,0,1,0,1,0},
{1,0,1,0,0,1,0,1,0}, {1,0,1,0,0,1,0,1,0},
{0,1,0,1,1,0,0,1,0}, {0,1,0,1,1,0,0,1,0},
{0,1,0,0,0,0,0,1,0}, {0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0}, {0,1,0,0,0,0,0,1,0},
}; };
int portal[MAX_TEMP/100][8][8]; int portal[MAX_TEMP/100][8][8];
float portaltemp[MAX_TEMP/100][8][8]; float portaltemp[MAX_TEMP/100][8][8];

View File

@ -745,10 +745,10 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
void draw_menu(pixel *vid_buf, int i, int hover) void draw_menu(pixel *vid_buf, int i, int hover)
{ {
if(i==SEC&&SEC!=0) if(i==SEC&&SEC!=0)
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 0, 255, 255, 255); drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 0, 255, 255, 255);
else else
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
if(hover==i) if(hover==i)
{ {
fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
@ -1008,22 +1008,22 @@ int textnwidth(char *s, int n)
void textnpos(char *s, int n, int w, int *cx, int *cy) void textnpos(char *s, int n, int w, int *cx, int *cy)
{ {
int x = 0; int x = 0;
int y = 0; int y = 0;
//TODO: Implement Textnheight for wrapped text //TODO: Implement Textnheight for wrapped text
for(; *s; s++) for(; *s; s++)
{ {
if(!n){ if(!n) {
break; break;
} }
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
if(x>=w) { if(x>=w) {
x = 0; x = 0;
y += FONT_H+2; y += FONT_H+2;
} }
n--; n--;
} }
*cx = x-1; *cx = x-1;
*cy = y; *cy = y;
} }
int textwidthx(char *s, int w) int textwidthx(char *s, int w)
@ -1048,10 +1048,10 @@ int textposxy(char *s, int width, int w, int h)
if(x+(cw/2) >= w && y+6 >= h) if(x+(cw/2) >= w && y+6 >= h)
break; break;
x += cw; x += cw;
if(x>=width) { if(x>=width) {
x = 0; x = 0;
y += FONT_H+2; y += FONT_H+2;
} }
n++; n++;
} }
return n; return n;
@ -1124,42 +1124,42 @@ void draw_air(pixel *vid)
c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f));
} }
else if(cmode == CM_VEL) else if(cmode == CM_VEL)
{ {
c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),
clamp_flt(pv[y][x], 0.0f, 8.0f), clamp_flt(pv[y][x], 0.0f, 8.0f),
clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));
} }
else if(cmode == CM_CRACK) else if(cmode == CM_CRACK)
{ {
int r; int r;
int g; int g;
int b; int b;
r = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f); r = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
g = clamp_flt(fabsf(vx[y][x]), 0.0f, 20.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 24.0f); g = clamp_flt(fabsf(vx[y][x]), 0.0f, 20.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 24.0f);
b = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f); b = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
if(pv[y][x] > 0.0f) if(pv[y][x] > 0.0f)
{ {
r += clamp_flt(pv[y][x], 0.0f, 16.0f); r += clamp_flt(pv[y][x], 0.0f, 16.0f);
if(r>255) if(r>255)
r=255; r=255;
if(g>255) if(g>255)
g=255; g=255;
if(b>255) if(b>255)
b=255; b=255;
c = PIXRGB(r, g, b); c = PIXRGB(r, g, b);
} }
else else
{ {
b += clamp_flt(-pv[y][x], 0.0f, 16.0f); b += clamp_flt(-pv[y][x], 0.0f, 16.0f);
if(r>255) if(r>255)
r=255; r=255;
if(g>255) if(g>255)
g=255; g=255;
if(b>255) if(b>255)
b=255; b=255;
c = PIXRGB(r, g, b); c = PIXRGB(r, g, b);
} }
} }
for(j=0; j<CELL; j++) for(j=0; j<CELL; j++)
for(i=0; i<CELL; i++) for(i=0; i<CELL; i++)
vid[(x*CELL+i) + (y*CELL+j)*(XRES+BARSIZE)] = c; vid[(x*CELL+i) + (y*CELL+j)*(XRES+BARSIZE)] = c;
@ -1305,16 +1305,16 @@ void draw_parts(pixel *vid)
float fr, fg, fb; float fr, fg, fb;
float pt = R_TEMP; float pt = R_TEMP;
if(GRID_MODE) if(GRID_MODE)
{ {
for(ny=0;ny<YRES;ny++) for(ny=0; ny<YRES; ny++)
for(nx=0;nx<XRES;nx++) for(nx=0; nx<XRES; nx++)
{ {
if(ny%(4*GRID_MODE)==0) if(ny%(4*GRID_MODE)==0)
blendpixel(vid, nx, ny, 100, 100, 100, 80); blendpixel(vid, nx, ny, 100, 100, 100, 80);
if(nx%(4*GRID_MODE)==0) if(nx%(4*GRID_MODE)==0)
blendpixel(vid, nx, ny, 100, 100, 100, 80); blendpixel(vid, nx, ny, 100, 100, 100, 80);
} }
} }
for(i = 0; i<NPART; i++) { for(i = 0; i<NPART; i++) {
#ifdef OpenGL #ifdef OpenGL
if(cmode == CM_FANCY) //If fancy mode if(cmode == CM_FANCY) //If fancy mode
@ -1402,7 +1402,7 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss... isplayer = 1; //It's a secret. Tssss...
} }
else if(t==PT_STKM2) //Just draw head here else if(t==PT_STKM2) //Just draw head here
{ {
char buff[10]; //Buffer for HP char buff[10]; //Buffer for HP
@ -1427,82 +1427,82 @@ void draw_parts(pixel *vid)
isplayer2 = 1; //It's a secret. Tssss... isplayer2 = 1; //It's a secret. Tssss...
} }
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
{ {
if(t==PT_PHOT) if(t==PT_PHOT)
{ {
cg = 0; cg = 0;
cb = 0; cb = 0;
cr = 0; cr = 0;
for(x=0; x<12; x++) { for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1; cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1; cb += (parts[i].ctype >> x) & 1;
} }
for(x=0; x<14; x++) for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1; cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1); x = 624/(cr+cg+cb+1);
cr *= x; cr *= x;
cg *= x; cg *= x;
cb *= x; cb *= x;
cr = cr>255?255:cr; cr = cr>255?255:cr;
cg = cg>255?255:cg; cg = cg>255?255:cg;
cb = cb>255?255:cb; cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else else
{ {
cr = PIXR(ptypes[t].pcolors); cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors); cb = PIXB(ptypes[t].pcolors);
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
} }
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
{ {
if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370) if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
{ {
float frequency = 0.00146; float frequency = 0.00146;
int q = parts[i].temp-473; int q = parts[i].temp-473;
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors); cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors); cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors); cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
if(cr>=255) if(cr>=255)
cr = 255; cr = 255;
if(cg>=255) if(cg>=255)
cg = 255; cg = 255;
if(cb>=255) if(cb>=255)
cb = 255; cb = 255;
if(cr<=0) if(cr<=0)
cr = 0; cr = 0;
if(cg<=0) if(cg<=0)
cg = 0; cg = 0;
if(cb<=0) if(cb<=0)
cb = 0; cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else else
{ {
float frequency = 0.05; float frequency = 0.05;
int q = parts[i].temp-40; int q = parts[i].temp-40;
cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors); cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors); cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors); cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
if(cr>=255) if(cr>=255)
cr = 255; cr = 255;
if(cg>=255) if(cg>=255)
cg = 255; cg = 255;
if(cb>=255) if(cb>=255)
cb = 255; cb = 255;
if(cr<=0) if(cr<=0)
cr = 0; cr = 0;
if(cg<=0) if(cg<=0)
cg = 0; cg = 0;
if(cb<=0) if(cb<=0)
cb = 0; cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
} }
else if(t==PT_MWAX&&cmode == CM_FANCY) else if(t==PT_MWAX&&cmode == CM_FANCY)
{ {
for(x=-1; x<=1; x++) for(x=-1; x<=1; x++)
@ -1519,30 +1519,30 @@ void draw_parts(pixel *vid)
} }
} }
else if(t==PT_SPNG) else if(t==PT_SPNG)
{ {
cr = PIXR(ptypes[t].pcolors) - parts[i].life*15; cr = PIXR(ptypes[t].pcolors) - parts[i].life*15;
cg = PIXG(ptypes[t].pcolors) - parts[i].life*15; cg = PIXG(ptypes[t].pcolors) - parts[i].life*15;
cb = PIXB(ptypes[t].pcolors) - parts[i].life*15; cb = PIXB(ptypes[t].pcolors) - parts[i].life*15;
if(cr<=50) if(cr<=50)
cr = 50; cr = 50;
if(cg<=50) if(cg<=50)
cg = 50; cg = 50;
if(cb<=20) if(cb<=20)
cb = 20; cb = 20;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else if(t==PT_DEUT) else if(t==PT_DEUT)
{ {
if(parts[i].life>=700&&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) if(parts[i].life>=700&&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY))
{ {
x = nx/CELL; x = nx/CELL;
y = ny/CELL; y = ny/CELL;
cr = 20; cr = 20;
cg = 20; cg = 20;
cb = 20; cb = 20;
cg += fire_g[y][x]; cg += fire_g[y][x];
if(cg > 255) cg = 255; if(cg > 255) cg = 255;
fire_g[y][x] = cg; fire_g[y][x] = cg;
@ -1552,28 +1552,28 @@ void draw_parts(pixel *vid)
cr += fire_r[y][x]; cr += fire_r[y][x];
if(cr > 255) cr = 255; if(cr > 255) cr = 255;
fire_r[y][x] = cr; fire_r[y][x] = cr;
} }
else else
{ {
cr = PIXR(ptypes[t].pcolors) + parts[i].life*1; cr = PIXR(ptypes[t].pcolors) + parts[i].life*1;
cg = PIXG(ptypes[t].pcolors) + parts[i].life*2; cg = PIXG(ptypes[t].pcolors) + parts[i].life*2;
cb = PIXB(ptypes[t].pcolors) + parts[i].life*4; cb = PIXB(ptypes[t].pcolors) + parts[i].life*4;
if(cr>=255) if(cr>=255)
cr = 255; cr = 255;
if(cg>=255) if(cg>=255)
cg = 255; cg = 255;
if(cb>=255) if(cb>=255)
cb = 255; cb = 255;
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
} }
else if(t==PT_DUST && parts[i].life >= 1) else if(t==PT_DUST && parts[i].life >= 1)
{ {
x = nx; x = nx;
y = ny; y = ny;
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{ {
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags);
cg = parts[i].tmp/4; cg = parts[i].tmp/4;
@ -1591,94 +1591,94 @@ void draw_parts(pixel *vid)
if(cr > 255) cr = 255; if(cr > 255) cr = 255;
fire_r[y][x] = cr; fire_r[y][x] = cr;
} }
else else
blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255); blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
} }
else if(t==PT_GRAV) else if(t==PT_GRAV)
{ {
cr = 20; cr = 20;
cg = 20; cg = 20;
cb = 20; cb = 20;
if(parts[i].vx>0) if(parts[i].vx>0)
{
cr += (parts[i].vx)*GRAV_R;
cg += (parts[i].vx)*GRAV_G;
cb += (parts[i].vx)*GRAV_B;
}
if(parts[i].vy>0)
{
cr += (parts[i].vy)*GRAV_G;
cg += (parts[i].vy)*GRAV_B;
cb += (parts[i].vy)*GRAV_R;
}
if(parts[i].vx<0)
{
cr -= (parts[i].vx)*GRAV_B;
cg -= (parts[i].vx)*GRAV_R;
cb -= (parts[i].vx)*GRAV_G;
}
if(parts[i].vy<0)
{
cr -= (parts[i].vy)*GRAV_R2;
cg -= (parts[i].vy)*GRAV_G2;
cb -= (parts[i].vy)*GRAV_B2;
}
if(cr>255)
cr=255;
if(cg>255)
cg=255;
if(cb>255)
cb=255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_WIFI)
{
float frequency = 0.0628;
int q = parts[i].tmp;
cr = sin(frequency*q + 0) * 127 + 128;
cg = sin(frequency*q + 2) * 127 + 128;
cb = sin(frequency*q + 4) * 127 + 128;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
if(mousex==(nx) && mousey==(ny))
{ {
int z; cr += (parts[i].vx)*GRAV_R;
for(z = 0; z<NPART; z++) { cg += (parts[i].vx)*GRAV_G;
if(parts[z].type) cb += (parts[i].vx)*GRAV_B;
{
if(parts[z].type==PT_WIFI&&parts[z].tmp==parts[i].tmp)
xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
}
}
} }
} if(parts[i].vy>0)
else if((t==PT_BIZR||t==PT_BIZRG)&&parts[i].ctype) {
{ cr += (parts[i].vy)*GRAV_G;
cg = 0; cg += (parts[i].vy)*GRAV_B;
cb = 0; cb += (parts[i].vy)*GRAV_R;
cr = 0;
for(x=0; x<12; x++) { }
cr += (parts[i].ctype >> (x+18)) & 1; if(parts[i].vx<0)
cb += (parts[i].ctype >> x) & 1; {
} cr -= (parts[i].vx)*GRAV_B;
for(x=0; x<14; x++) cg -= (parts[i].vx)*GRAV_R;
cg += (parts[i].ctype >> (x+9)) & 1; cb -= (parts[i].vx)*GRAV_G;
x = 624/(cr+cg+cb+1);
cr *= x; }
cg *= x; if(parts[i].vy<0)
cb *= x; {
cr = cr>255?255:cr; cr -= (parts[i].vy)*GRAV_R2;
cg = cg>255?255:cg; cg -= (parts[i].vy)*GRAV_G2;
cb = cb>255?255:cb; cb -= (parts[i].vy)*GRAV_B2;
if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) { }
fg = 0; if(cr>255)
fb = 0; cr=255;
fr = 0; if(cg>255)
cg=255;
if(cb>255)
cb=255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_WIFI)
{
float frequency = 0.0628;
int q = parts[i].tmp;
cr = sin(frequency*q + 0) * 127 + 128;
cg = sin(frequency*q + 2) * 127 + 128;
cb = sin(frequency*q + 4) * 127 + 128;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
if(mousex==(nx) && mousey==(ny))
{
int z;
for(z = 0; z<NPART; z++) {
if(parts[z].type)
{
if(parts[z].type==PT_WIFI&&parts[z].tmp==parts[i].tmp)
xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
}
}
}
}
else if((t==PT_BIZR||t==PT_BIZRG)&&parts[i].ctype)
{
cg = 0;
cb = 0;
cr = 0;
for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1;
}
for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1);
cr *= x;
cg *= x;
cb *= x;
cr = cr>255?255:cr;
cg = cg>255?255:cg;
cb = cb>255?255:cb;
if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) {
fg = 0;
fb = 0;
fr = 0;
fg = cg/40 * fabs(parts[i].vx)+fabs(parts[i].vy); fg = cg/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
fb = cb/40 * fabs(parts[i].vx)+fabs(parts[i].vy); fb = cb/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
fr = cr/40 * fabs(parts[i].vx)+fabs(parts[i].vy); fr = cr/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255)); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255));
x = nx/CELL; x = nx/CELL;
y = ny/CELL; y = ny/CELL;
fg += fire_g[y][x]; fg += fire_g[y][x];
@ -1690,70 +1690,70 @@ void draw_parts(pixel *vid)
fr += fire_r[y][x]; fr += fire_r[y][x];
if(fr > 255) fr = 255; if(fr > 255) fr = 255;
fire_r[y][x] = fr; fire_r[y][x] = fr;
} }
else else
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else if(t==PT_PIPE) else if(t==PT_PIPE)
{ {
if(parts[i].ctype==2) if(parts[i].ctype==2)
{ {
cr = 50; cr = 50;
cg = 1; cg = 1;
cb = 1; cb = 1;
} }
else if(parts[i].ctype==3) else if(parts[i].ctype==3)
{ {
cr = 1; cr = 1;
cg = 50; cg = 50;
cb = 1; cb = 1;
} }
else if(parts[i].ctype==4) else if(parts[i].ctype==4)
{ {
cr = 1; cr = 1;
cg = 1; cg = 1;
cb = 50; cb = 50;
} }
else if(parts[i].temp<272.15&&parts[i].ctype!=1) else if(parts[i].temp<272.15&&parts[i].ctype!=1)
{ {
if(parts[i].temp>173.25&&parts[i].temp<273.15) if(parts[i].temp>173.25&&parts[i].temp<273.15)
{ {
cr = 50; cr = 50;
cg = 1; cg = 1;
cb = 1; cb = 1;
} }
if(parts[i].temp>73.25&&parts[i].temp<=173.15) if(parts[i].temp>73.25&&parts[i].temp<=173.15)
{ {
cr = 1; cr = 1;
cg = 50; cg = 50;
cb = 1; cb = 1;
} }
if(parts[i].temp>=0&&parts[i].temp<=73.15) if(parts[i].temp>=0&&parts[i].temp<=73.15)
{ {
cr = 1; cr = 1;
cg = 1; cg = 1;
cb = 50; cb = 50;
} }
} }
else else
{ {
cr = PIXR(ptypes[t].pcolors); cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors); cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors); cb = PIXB(ptypes[t].pcolors);
} }
if(parts[i].tmp) if(parts[i].tmp)
{ {
cr = PIXR(ptypes[parts[i].tmp].pcolors); cr = PIXR(ptypes[parts[i].tmp].pcolors);
cg = PIXG(ptypes[parts[i].tmp].pcolors); cg = PIXG(ptypes[parts[i].tmp].pcolors);
cb = PIXB(ptypes[parts[i].tmp].pcolors); cb = PIXB(ptypes[parts[i].tmp].pcolors);
} }
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else if(t==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f)) else if(t==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
blendpixel(vid, nx, ny, 15, 0, 150, 100); blendpixel(vid, nx, ny, 15, 0, 150, 100);
else if(t==PT_ACID) else if(t==PT_ACID)
{ {
if(parts[i].life>255) parts[i].life = 255; if(parts[i].life>255) parts[i].life = 255;
@ -1888,45 +1888,45 @@ void draw_parts(pixel *vid)
} }
} }
} }
else if(t==PT_FILT) else if(t==PT_FILT)
{ {
int temp_bin = (int)((parts[i].temp-273.0f)*0.025f); int temp_bin = (int)((parts[i].temp-273.0f)*0.025f);
if(temp_bin < 0) temp_bin = 0; if(temp_bin < 0) temp_bin = 0;
if(temp_bin > 25) temp_bin = 25; if(temp_bin > 25) temp_bin = 25;
parts[i].ctype = 0x1F << temp_bin; parts[i].ctype = 0x1F << temp_bin;
cg = 0; cg = 0;
cb = 0; cb = 0;
cr = 0; cr = 0;
for(x=0; x<12; x++) { for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1; cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1; cb += (parts[i].ctype >> x) & 1;
} }
for(x=0; x<14; x++) for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1; cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1); x = 624/(cr+cg+cb+1);
cr *= x; cr *= x;
cg *= x; cg *= x;
cb *= x; cb *= x;
cr = cr>255?255:cr; cr = cr>255?255:cr;
cg = cg>255?255:cg; cg = cg>255?255:cg;
cb = cb>255?255:cb; cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 127); blendpixel(vid, nx, ny, cr, cg, cb, 127);
} }
else if(t==PT_BRAY && parts[i].tmp==0) else if(t==PT_BRAY && parts[i].tmp==0)
{ {
int trans = parts[i].life * 7; int trans = parts[i].life * 7;
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
} }
else if(t==PT_BRAY && parts[i].tmp==1) else if(t==PT_BRAY && parts[i].tmp==1)
{ {
int trans = parts[i].life/4; int trans = parts[i].life/4;
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
} }
else if(t==PT_BRAY && parts[i].tmp==2) else if(t==PT_BRAY && parts[i].tmp==2)
{ {
int trans = parts[i].life*100; int trans = parts[i].life*100;
blendpixel(vid, nx, ny, 255, 150, 50, trans); blendpixel(vid, nx, ny, 255, 150, 50, trans);
} }
else if(t==PT_PHOT) else if(t==PT_PHOT)
{ {
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
@ -2291,7 +2291,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112); blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112);
} }
} }
else if(t==PT_PUMP) else if(t==PT_PUMP)
{ {
uint8 GR = 0x3B+(parts[i].life*19); uint8 GR = 0x3B+(parts[i].life*19);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, 10, GR); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, 10, GR);
@ -2604,7 +2604,7 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss... isplayer = 1; //It's a secret. Tssss...
} }
else if(t==PT_STKM2) //Stick man should be visible in heat mode else if(t==PT_STKM2) //Stick man should be visible in heat mode
{ {
char buff[10]; //Buffer for HP char buff[10]; //Buffer for HP
@ -2723,15 +2723,15 @@ void render_signs(pixel *vid_buf)
x+=dx; x+=dx;
y+=dy; y+=dy;
} }
if(MSIGN==i) if(MSIGN==i)
{ {
bq = b; bq = b;
b = SDL_GetMouseState(&mx, &my); b = SDL_GetMouseState(&mx, &my);
mx /= sdl_scale; mx /= sdl_scale;
my /= sdl_scale; my /= sdl_scale;
signs[i].x = mx; signs[i].x = mx;
signs[i].y = my; signs[i].y = my;
} }
} }
} }
@ -2961,12 +2961,12 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
if(!(j%2) && !(i%2)) if(!(j%2) && !(i%2))
fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0); fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
break; break;
case 4: case 4:
for(j=0; j<CELL; j+=2) for(j=0; j<CELL; j+=2)
for(i=(j>>1)&1; i<CELL; i+=2) for(i=(j>>1)&1; i<CELL; i+=2)
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF); fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
k++; k++;
break; break;
case 6: case 6:
for(j=0; j<CELL; j+=2) for(j=0; j<CELL; j+=2)
for(i=(j>>1)&1; i<CELL; i+=2) for(i=(j>>1)&1; i<CELL; i+=2)
@ -2986,7 +2986,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
else else
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080); fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
break; break;
case WL_WALL: case WL_WALL:
for(j=0; j<CELL; j++) for(j=0; j<CELL; j++)
for(i=0; i<CELL; i++) for(i=0; i<CELL; i++)
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080); fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
@ -3057,7 +3057,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w);
draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w);
} }
else if(j==PT_STKM2) else if(j==PT_STKM2)
{ {
//Stickman drawing //Stickman drawing
for(k=-2; k<=1; k++) for(k=-2; k<=1; k++)
@ -3180,24 +3180,24 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
int i,j,c; int i,j,c;
if(t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM) if(t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM)
{ {
if(rx<=0) if(rx<=0)
xor_pixel(x, y, vid); xor_pixel(x, y, vid);
else if(ry<=0) else if(ry<=0)
xor_pixel(x, y, vid); xor_pixel(x, y, vid);
if(rx+ry<=0) if(rx+ry<=0)
xor_pixel(x, y, vid); xor_pixel(x, y, vid);
else if(CURRENT_BRUSH==SQUARE_BRUSH) else if(CURRENT_BRUSH==SQUARE_BRUSH)
{ {
for(j=0; j<=ry; j++) for(j=0; j<=ry; j++)
for(i=0; i<=rx; i++) for(i=0; i<=rx; i++)
if(i*j<=ry*rx && ((i+1)>rx || (j+1)>ry)) if(i*j<=ry*rx && ((i+1)>rx || (j+1)>ry))
{ {
xor_pixel(x+i, y+j, vid); xor_pixel(x+i, y+j, vid);
xor_pixel(x-i, y-j, vid); xor_pixel(x-i, y-j, vid);
if(i&&j)xor_pixel(x+i, y-j, vid); if(i&&j)xor_pixel(x+i, y-j, vid);
if(i&&j)xor_pixel(x-i, y+j, vid); if(i&&j)xor_pixel(x-i, y+j, vid);
} }
} }
else if(CURRENT_BRUSH==CIRCLE_BRUSH) else if(CURRENT_BRUSH==CIRCLE_BRUSH)
for(j=0; j<=ry; j++) for(j=0; j<=ry; j++)
for(i=0; i<=rx; i++) for(i=0; i<=rx; i++)

View File

@ -106,11 +106,11 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
for(i=0; i<MAXSIGNS; i++) for(i=0; i<MAXSIGNS; i++)
if(signs[i].text[0]) if(signs[i].text[0])
{ {
if(i == MSIGN) if(i == MSIGN)
{ {
MSIGN = -1; MSIGN = -1;
return; return;
} }
get_sign_pos(i, &x, &y, &w, &h); get_sign_pos(i, &x, &y, &w, &h);
if(mx>=x && mx<=x+w && my>=y && my<=y+h) if(mx>=x && mx<=x+w && my>=y && my<=y+h)
break; break;
@ -181,8 +181,8 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255);
drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255);
drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255);
drawrect(vid_buf,x0+104,y0+42,26,15,255,255,255,255); drawrect(vid_buf,x0+104,y0+42,26,15,255,255,255,255);
drawtext(vid_buf, x0+110, y0+48, "Mv.", 255, 255, 255, 255); drawtext(vid_buf, x0+110, y0+48, "Mv.", 255, 255, 255, 255);
} }
drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255);
@ -200,10 +200,10 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
ju = 2; ju = 2;
if(!nm && b && !bq && mx>=x0+104 && mx<=x0+130 && my>=y0+42 && my<=y0+59) if(!nm && b && !bq && mx>=x0+104 && mx<=x0+130 && my>=y0+42 && my<=y0+59)
{ {
MSIGN = i; MSIGN = i;
break; break;
} }
if(b && !bq && mx>=x0+9 && mx<x0+23 && my>=y0+22 && my<y0+36) if(b && !bq && mx>=x0+9 && mx<x0+23 && my>=y0+22 && my<y0+36)
break; break;
if(b && !bq && mx>=x0 && mx<x0+192 && my>=y0+64 && my<=y0+80) if(b && !bq && mx>=x0 && mx<x0+192 && my>=y0+64 && my<=y0+80)
@ -246,24 +246,24 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed)
if(ed->str[0]) if(ed->str[0])
{ {
if(ed->multiline){ if(ed->multiline) {
drawtextwrap(vid_buf, ed->x, ed->y, ed->w-14, str, 255, 255, 255, 255); drawtextwrap(vid_buf, ed->x, ed->y, ed->w-14, str, 255, 255, 255, 255);
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
} else { } else {
drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255);
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
} }
} }
else if(!ed->focus) else if(!ed->focus)
drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255);
if(ed->focus) if(ed->focus)
{ {
if(ed->multiline){ if(ed->multiline) {
textnpos(str, ed->cursor, ed->w-14, &cx, &cy); textnpos(str, ed->cursor, ed->w-14, &cx, &cy);
} else { } else {
cx = textnwidth(str, ed->cursor); cx = textnwidth(str, ed->cursor);
cy = 0; cy = 0;
} }
for(i=-3; i<9; i++) for(i=-3; i<9; i++)
drawpixel(vid_buf, ed->x+cx, ed->y+i+cy, 255, 255, 255, 255); drawpixel(vid_buf, ed->x+cx, ed->y+i+cy, 255, 255, 255, 255);
@ -290,35 +290,35 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed)
else else
str = ed->str; str = ed->str;
if(ed->multiline){ if(ed->multiline) {
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11) if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
{ {
ed->focus = 1; ed->focus = 1;
ed->cursor = 0; ed->cursor = 0;
ed->str[0] = 0; ed->str[0] = 0;
} }
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+ed->h) else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+ed->h)
{ {
ed->focus = 1; ed->focus = 1;
ed->cursor = textposxy(str, ed->w-14, mx-ed->x, my-ed->y); ed->cursor = textposxy(str, ed->w-14, mx-ed->x, my-ed->y);
} }
else else
ed->focus = 0; ed->focus = 0;
} else { } else {
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11) if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
{ {
ed->focus = 1; ed->focus = 1;
ed->cursor = 0; ed->cursor = 0;
ed->str[0] = 0; ed->str[0] = 0;
} }
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11) else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
{ {
ed->focus = 1; ed->focus = 1;
ed->cursor = textwidthx(str, mx-ed->x); ed->cursor = textwidthx(str, mx-ed->x);
} }
else else
ed->focus = 0; ed->focus = 0;
} }
} }
if(ed->focus && sdl_key) if(ed->focus && sdl_key)
{ {
@ -551,14 +551,14 @@ void draw_svf_ui(pixel *vid_buf)
break; break;
case CM_FANCY: case CM_FANCY:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255);
break; break;
case CM_NOTHING: case CM_NOTHING:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
break; break;
case CM_CRACK: case CM_CRACK:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD4", 255, 55, 55, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD4", 255, 55, 55, 255);
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD5", 55, 255, 55, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD5", 55, 255, 55, 255);
break; break;
case CM_GRAD: case CM_GRAD:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255);
break; break;
@ -1183,7 +1183,7 @@ int save_name_ui(pixel *vid_buf)
ed.focus = 1; ed.focus = 1;
ed.hide = 0; ed.hide = 0;
ed.cursor = strlen(svf_name); ed.cursor = strlen(svf_name);
ed.multiline = 0; ed.multiline = 0;
strcpy(ed.str, svf_name); strcpy(ed.str, svf_name);
ed2.x = x0+13; ed2.x = x0+13;
@ -1195,7 +1195,7 @@ int save_name_ui(pixel *vid_buf)
ed2.focus = 0; ed2.focus = 0;
ed2.hide = 0; ed2.hide = 0;
ed2.cursor = strlen(svf_description); ed2.cursor = strlen(svf_description);
ed2.multiline = 1; ed2.multiline = 1;
strcpy(ed2.str, svf_description); strcpy(ed2.str, svf_description);
cb.x = x0+10; cb.x = x0+10;
@ -1231,7 +1231,7 @@ int save_name_ui(pixel *vid_buf)
drawtext(vid_buf, x0+5, y0+79+YRES/4, "Save simulation", 255, 255, 255, 255); drawtext(vid_buf, x0+5, y0+79+YRES/4, "Save simulation", 255, 255, 255, 255);
drawrect(vid_buf, x0, y0+74+YRES/4, 192, 16, 192, 192, 192, 255); drawrect(vid_buf, x0, y0+74+YRES/4, 192, 16, 192, 192, 192, 255);
draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE); draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE);
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
@ -1516,12 +1516,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); 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 && mx<x+58 && 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, 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, y-1, 29, 17, 0, 255, 255, 255);
} }
@ -1558,7 +1558,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255); drawrect(vid_buf, x+30, 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, y-1, 29, 17, 0, 255, 255, 255);
} }
@ -1592,7 +1592,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255); drawrect(vid_buf, x+30, 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, y-1, 29, 17, 0, 255, 255, 255);
} }
@ -1629,7 +1629,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255); drawrect(vid_buf, x+30, 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, y-1, 29, 17, 0, 255, 255, 255);
} }
@ -1645,12 +1645,12 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
} }
} }
if(!bq&&mx>=sdl_scale*((XRES+BARSIZE)-16) && mx<sdl_scale*(XRES+BARSIZE-1) &&my>= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && my<sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)+15)) if(!bq&&mx>=sdl_scale*((XRES+BARSIZE)-16) && mx<sdl_scale*(XRES+BARSIZE-1) &&my>= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && my<sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)+15))
{ {
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)) if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
if(i>=0&&i<SC_TOTAL) if(i>=0&&i<SC_TOTAL)
SEC = i; SEC = i;
} }
if(h==-1) if(h==-1)
{ {
@ -1667,41 +1667,41 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
if(b==1&&h==-1) if(b==1&&h==-1)
{ {
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0) if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{ {
SLALT = -1; SLALT = -1;
SEC2 = SEC; SEC2 = SEC;
} }
} }
if(b==1&&h!=-1) if(b==1&&h!=-1)
{ {
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)) if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{ {
SLALT = h; SLALT = h;
SEC2 = -1; SEC2 = -1;
} }
else{ else {
*sl = h; *sl = h;
} }
} }
if(b==4&&h==-1) if(b==4&&h==-1)
{ {
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0) if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{ {
SLALT = -1; SLALT = -1;
SEC2 = SEC; SEC2 = SEC;
} }
} }
if(b==4&&h!=-1) if(b==4&&h!=-1)
{ {
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)) if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{ {
SLALT = h; SLALT = h;
SEC2 = -1; SEC2 = -1;
} }
else{ else {
*sr = h; *sr = h;
} }
} }
} }
@ -1750,7 +1750,7 @@ int sdl_poll(void)
player[0] = (int)(player[0])|0x04; //Jump command player[0] = (int)(player[0])|0x04; //Jump command
} }
if(event.key.keysym.sym == SDLK_d) if(event.key.keysym.sym == SDLK_d)
{ {
player2[0] = (int)(player2[0])|0x02; //Go right command player2[0] = (int)(player2[0])|0x02; //Go right command
} }
@ -1787,7 +1787,7 @@ int sdl_poll(void)
player[0] = (int)(player[0])&7; player[0] = (int)(player[0])&7;
} }
if(event.key.keysym.sym == SDLK_d || event.key.keysym.sym == SDLK_a) if(event.key.keysym.sym == SDLK_d || event.key.keysym.sym == SDLK_a)
{ {
player2[1] = player2[0]; //Saving last movement player2[1] = player2[0]; //Saving last movement
player2[0] = (int)(player2[0])&12; //Stop command player2[0] = (int)(player2[0])&12; //Stop command
@ -2013,7 +2013,7 @@ int search_ui(pixel *vid_buf)
ed.focus = 1; ed.focus = 1;
ed.hide = 0; ed.hide = 0;
ed.cursor = strlen(search_expr); ed.cursor = strlen(search_expr);
ed.multiline = 0; ed.multiline = 0;
strcpy(ed.str, search_expr); strcpy(ed.str, search_expr);
sdl_wheel = 0; sdl_wheel = 0;
@ -2608,7 +2608,7 @@ int report_ui(pixel* vid_buf, char *save_id)
ed.def = "Report details"; ed.def = "Report details";
ed.focus = 0; ed.focus = 0;
ed.hide = 0; ed.hide = 0;
ed.multiline = 1; ed.multiline = 1;
ed.cursor = 0; ed.cursor = 0;
strcpy(ed.str, ""); strcpy(ed.str, "");
@ -2619,8 +2619,8 @@ int report_ui(pixel* vid_buf, char *save_id)
if(!b) if(!b)
break; break;
} }
while(!sdl_poll()){ while(!sdl_poll()) {
fillrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 0,0,0, 255); fillrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 0,0,0, 255);
drawrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 255, 255, 255, 255); drawrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 255, 255, 255, 255);
drawrect(vid_buf, 205, 155, (XRES+BARSIZE-400)-10, (YRES+MENUSIZE-300)-28, 255, 255, 255, 170); drawrect(vid_buf, 205, 155, (XRES+BARSIZE-400)-10, (YRES+MENUSIZE-300)-28, 255, 255, 255, 170);
@ -2636,25 +2636,25 @@ int report_ui(pixel* vid_buf, char *save_id)
drawrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 255); drawrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 255);
drawtext(vid_buf, (XRES+BARSIZE-400)+163, (YRES+MENUSIZE-150)-13, "Report", 255, 255, 255, 255); drawtext(vid_buf, (XRES+BARSIZE-400)+163, (YRES+MENUSIZE-150)-13, "Report", 255, 255, 255, 255);
if(mx>(XRES+BARSIZE-400)+150 && my>(YRES+MENUSIZE-150)-18 && mx<(XRES+BARSIZE-400)+200 && my<(YRES+MENUSIZE-150)){ if(mx>(XRES+BARSIZE-400)+150 && my>(YRES+MENUSIZE-150)-18 && mx<(XRES+BARSIZE-400)+200 && my<(YRES+MENUSIZE-150)) {
fillrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
if(b){ if(b) {
if(execute_report(vid_buf, save_id, ed.str)){ if(execute_report(vid_buf, save_id, ed.str)) {
info_ui(vid_buf, "Success", "This save has been reported"); info_ui(vid_buf, "Success", "This save has been reported");
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
} }
if(mx>200 && my>(YRES+MENUSIZE-150)-18 && mx<250 && my<(YRES+MENUSIZE-150)){ if(mx>200 && my>(YRES+MENUSIZE-150)-18 && mx<250 && my<(YRES+MENUSIZE-150)) {
fillrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
if(b) if(b)
return 0; return 0;
} }
ui_edit_draw(vid_buf, &ed); ui_edit_draw(vid_buf, &ed);
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
ui_edit_process(mx, my, b, &ed); ui_edit_process(mx, my, b, &ed);
} }
return 0; return 0;
} }
@ -2664,7 +2664,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1; int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1;
int nyd,nyu,ry,lv; int nyd,nyu,ry,lv;
char *uri, *uri_2, *o_uri; char *uri, *uri_2, *o_uri;
void *data, *info_data; void *data, *info_data;
save_info *info = malloc(sizeof(save_info)); save_info *info = malloc(sizeof(save_info));
void *http = NULL, *http_2 = NULL; void *http = NULL, *http_2 = NULL;
@ -2672,7 +2672,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
int status, status_2, info_ready = 0, data_ready = 0; int status, status_2, info_ready = 0, data_ready = 0;
time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT; time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT;
pixel *save_pic;// = malloc((XRES/2)*(YRES/2)); pixel *save_pic;// = malloc((XRES/2)*(YRES/2));
ui_edit ed; ui_edit ed;
pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
@ -2683,15 +2683,15 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255);
drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128);
ed.x = 57+(XRES/2)+1; ed.x = 57+(XRES/2)+1;
ed.y = YRES+MENUSIZE-118; ed.y = YRES+MENUSIZE-118;
ed.w = XRES+BARSIZE-114-((XRES/2)+1); ed.w = XRES+BARSIZE-114-((XRES/2)+1);
ed.h = 48; ed.h = 48;
ed.nx = 1; ed.nx = 1;
ed.def = "Add comment"; ed.def = "Add comment";
ed.focus = 1; ed.focus = 1;
ed.hide = 0; ed.hide = 0;
ed.multiline = 1; ed.multiline = 1;
ed.cursor = 0; ed.cursor = 0;
strcpy(ed.str, ""); strcpy(ed.str, "");
@ -2756,14 +2756,14 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
if(status == 200) if(status == 200)
{ {
pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); pixel *full_save = prerender_save(data, data_size, &imgw, &imgh);
if(full_save!=NULL){ if(full_save!=NULL) {
save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
data_ready = 1; data_ready = 1;
free(full_save); free(full_save);
} else { } else {
error_ui(vid_buf, 0, "Save may be from a newer version"); error_ui(vid_buf, 0, "Save may be from a newer version");
break; break;
} }
} }
active = 0; active = 0;
free(http); free(http);
@ -2801,72 +2801,72 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255); cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255);
drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200); drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200);
//Draw the score bars //Draw the score bars
if(info->voteup>0||info->votedown>0) if(info->voteup>0||info->votedown>0)
{ {
lv = (info->voteup>info->votedown)?info->voteup:info->votedown; lv = (info->voteup>info->votedown)?info->voteup:info->votedown;
lv = (lv>10)?lv:10; lv = (lv>10)?lv:10;
if(50>lv) if(50>lv)
{ {
ry = ((float)(50)/(float)lv); ry = ((float)(50)/(float)lv);
//if(lv<8) //if(lv<8)
//{ //{
// ry = ry/(8-lv); // ry = ry/(8-lv);
//} //}
nyu = info->voteup*ry; nyu = info->voteup*ry;
nyd = info->votedown*ry; nyd = info->votedown*ry;
} }
else else
{ {
ry = ((float)lv/(float)(50)); ry = ((float)lv/(float)(50));
nyu = info->voteup/ry; nyu = info->voteup/ry;
nyd = info->votedown/ry; nyd = info->votedown/ry;
} }
nyu = nyu>50?50:nyu; nyu = nyu>50?50:nyu;
nyd = nyd>50?50:nyd; nyd = nyd>50?50:nyd;
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 0, 107, 10, 255); fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 0, 107, 10, 255);
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 107, 10, 0, 255); fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 107, 10, 0, 255);
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 128, 128, 128, 255); drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 128, 128, 128, 255);
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 128, 128, 128, 255); drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 128, 128, 128, 255);
fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255); fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255);
fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255); fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255);
} }
ccy = 0; ccy = 0;
for(cc=0; cc<info->comment_count; cc++) { for(cc=0; cc<info->comment_count; cc++) {
if((ccy + 72 + ((textwidth(info->comments[cc])/(XRES+BARSIZE-100-((XRES/2)+1)-20)))*12)<(YRES+MENUSIZE-50)){ if((ccy + 72 + ((textwidth(info->comments[cc])/(XRES+BARSIZE-100-((XRES/2)+1)-20)))*12)<(YRES+MENUSIZE-50)) {
drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255);
ccy += 12; ccy += 12;
ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185);
ccy += 10; ccy += 10;
if(ccy+52<YRES+MENUSIZE-50){ //Try not to draw off the screen. if(ccy+52<YRES+MENUSIZE-50) { //Try not to draw off the screen.
draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE);
} }
} }
} }
hasdrawninfo = 1; hasdrawninfo = 1;
myown = svf_login && !strcmp(info->author, svf_user); myown = svf_login && !strcmp(info->author, svf_user);
authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod);
memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
} }
if(info_ready && svf_login){ if(info_ready && svf_login) {
//Render the comment box. //Render the comment box.
fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255); fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255);
drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255); drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255);
drawrect(vid_buf, 54+(XRES/2)+1, YRES+MENUSIZE-121, XRES+BARSIZE-108-((XRES/2)+1), 48, 255, 255, 255, 200); drawrect(vid_buf, 54+(XRES/2)+1, YRES+MENUSIZE-121, XRES+BARSIZE-108-((XRES/2)+1), 48, 255, 255, 255, 200);
ui_edit_draw(vid_buf, &ed); ui_edit_draw(vid_buf, &ed);
drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255);
drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255); drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255);
} }
//Open Button //Open Button
bc = openable?255:150; bc = openable?255:150;
drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc);
drawtext(vid_buf, 73, YRES+MENUSIZE-63, "Open", 255, 255, 255, bc); drawtext(vid_buf, 73, YRES+MENUSIZE-63, "Open", 255, 255, 255, bc);
drawtext(vid_buf, 58, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); drawtext(vid_buf, 58, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc);
@ -2881,102 +2881,102 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
drawtext(vid_buf, 168, YRES+MENUSIZE-63, "Report", 255, 255, 255, bc); drawtext(vid_buf, 168, YRES+MENUSIZE-63, "Report", 255, 255, 255, bc);
drawtext(vid_buf, 158, YRES+MENUSIZE-63, "!", 255, 255, 255, bc); drawtext(vid_buf, 158, YRES+MENUSIZE-63, "!", 255, 255, 255, bc);
//Delete Button //Delete Button
bc = authoritah?255:150; bc = authoritah?255:150;
drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc);
drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc); drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc);
drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc); drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc);
//Open in browser button //Open in browser button
bc = 255; bc = 255;
drawrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, bc); drawrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, bc);
drawtext(vid_buf, 273, YRES+MENUSIZE-63, "Open in Browser", 255, 255, 255, bc); drawtext(vid_buf, 273, YRES+MENUSIZE-63, "Open in Browser", 255, 255, 255, bc);
drawtext(vid_buf, 258, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); drawtext(vid_buf, 258, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc);
//Open Button //Open Button
if(sdl_key==SDLK_RETURN && openable) { if(sdl_key==SDLK_RETURN && openable) {
queue_open = 1; queue_open = 1;
} }
if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable && !queue_open) { if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable && !queue_open) {
fillrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
if(b && !bq) { if(b && !bq) {
//Button Clicked //Button Clicked
queue_open = 1; queue_open = 1;
} }
} }
//Fav Button //Fav Button
if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && !queue_open) { if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && !queue_open) {
fillrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
if(b && !bq) { if(b && !bq) {
//Button Clicked //Button Clicked
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
info_box(vid_buf, "Adding to favourites..."); info_box(vid_buf, "Adding to favourites...");
execute_fav(vid_buf, save_id); execute_fav(vid_buf, save_id);
}
}
//Report Button
if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
if(b && !bq) {
//Button Clicked
if(report_ui(vid_buf, save_id)){
retval = 0;
break;
}
} }
} }
//Delete Button //Report Button
if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown) && !queue_open) { if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
if(b && !bq) { if(b && !bq) {
//Button Clicked //Button Clicked
if(myown || !info->publish){ if(report_ui(vid_buf, save_id)) {
if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "You will not be able recover it.", "Delete")){ retval = 0;
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); break;
info_box(vid_buf, "Deleting..."); }
if(execute_delete(vid_buf, save_id)){ }
retval = 0; }
break; //Delete Button
} if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown) && !queue_open) {
} fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
} else { if(b && !bq) {
if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")){ //Button Clicked
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); if(myown || !info->publish) {
info_box(vid_buf, "Removing..."); if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "You will not be able recover it.", "Delete")) {
if(execute_delete(vid_buf, save_id)){ fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
retval = 0; info_box(vid_buf, "Deleting...");
break; if(execute_delete(vid_buf, save_id)) {
} retval = 0;
} break;
} }
} }
} } else {
//Open in browser button if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")) {
if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && !queue_open) { fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
info_box(vid_buf, "Removing...");
if(execute_delete(vid_buf, save_id)) {
retval = 0;
break;
}
}
}
}
}
//Open in browser button
if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && !queue_open) {
fillrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, 40); fillrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, 40);
if(b && !bq) { if(b && !bq) {
//Button Clicked //Button Clicked
//TODO: Open link //TODO: Open link
o_uri = malloc(7+strlen(SERVER)+41+strlen(save_id)*3); o_uri = malloc(7+strlen(SERVER)+41+strlen(save_id)*3);
strcpy(o_uri, "http://" SERVER "/Browse/View.html?ID="); strcpy(o_uri, "http://" SERVER "/Browse/View.html?ID=");
strcaturl(o_uri, save_id); strcaturl(o_uri, save_id);
open_link(o_uri); open_link(o_uri);
free(o_uri); free(o_uri);
} }
} }
//Submit Button //Submit Button
if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) { if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
if(b && !bq) { if(b && !bq) {
//Button Clicked //Button Clicked
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
info_box(vid_buf, "Submitting Comment..."); info_box(vid_buf, "Submitting Comment...");
execute_submit(vid_buf, save_id, ed.str); execute_submit(vid_buf, save_id, ed.str);
ed.str[0] = 0; ed.str[0] = 0;
} }
} }
if(!(mx>50 && my>50 && mx<XRES+BARSIZE-50 && my<YRES+MENUSIZE-50) && b && !queue_open){ if(!(mx>50 && my>50 && mx<XRES+BARSIZE-50 && my<YRES+MENUSIZE-50) && b && !queue_open) {
retval = 0; retval = 0;
break; break;
} }
if(queue_open) { if(queue_open) {
if(info_ready && data_ready) { if(info_ready && data_ready) {
@ -3026,34 +3026,34 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128);
} }
} }
if(!info_ready || !data_ready){ if(!info_ready || !data_ready) {
info_box(vid_buf, "Loading"); info_box(vid_buf, "Loading");
} }
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
if(info_ready && svf_login){ if(info_ready && svf_login) {
ui_edit_process(mx, my, b, &ed); ui_edit_process(mx, my, b, &ed);
} }
if(sdl_key==SDLK_ESCAPE){ if(sdl_key==SDLK_ESCAPE) {
retval = 0; retval = 0;
break; break;
} }
if(lasttime<TIMEOUT) if(lasttime<TIMEOUT)
lasttime++; lasttime++;
} }
//Prevent those mouse clicks being passed down. //Prevent those mouse clicks being passed down.
while(!sdl_poll()) while(!sdl_poll())
{ {
b = SDL_GetMouseState(&mx, &my); b = SDL_GetMouseState(&mx, &my);
if(!b) if(!b)
break; break;
} }
//Close open connections //Close open connections
if(http) if(http)
http_async_req_close(http); http_async_req_close(http);
if(http_2) if(http_2)
http_async_req_close(http_2); http_async_req_close(http_2);
return retval; return retval;
} }
@ -3594,7 +3594,7 @@ int execute_delete(pixel *vid_buf, char *id)
if(result) if(result)
free(result); free(result);
return 1; return 1;
} }
void execute_submit(pixel *vid_buf, char *id, char *message) void execute_submit(pixel *vid_buf, char *id, char *message)
@ -3665,7 +3665,7 @@ int execute_report(pixel *vid_buf, char *id, char *reason)
if(result) if(result)
free(result); free(result);
return 1; return 1;
} }
void execute_fav(pixel *vid_buf, char *id) void execute_fav(pixel *vid_buf, char *id)
@ -3737,30 +3737,30 @@ int execute_vote(pixel *vid_buf, char *id, char *action)
free(result); free(result);
return 1; return 1;
} }
void open_link(char *uri){ void open_link(char *uri) {
#ifdef WIN32 #ifdef WIN32
ShellExecute(0, "OPEN", uri, NULL, NULL, 0); ShellExecute(0, "OPEN", uri, NULL, NULL, 0);
#elif MACOSX #elif MACOSX
//char *cmd[] = { "open", uri, (char *)0 }; //char *cmd[] = { "open", uri, (char *)0 };
//execvp("open", cmd); //execvp("open", cmd);
//LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working //LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working
char *cmd = malloc(7+strlen(uri)); char *cmd = malloc(7+strlen(uri));
strcpy(cmd, "open "); strcpy(cmd, "open ");
strappend(cmd, uri); strappend(cmd, uri);
system(cmd); system(cmd);
#elif LIN32 #elif LIN32
//execlp("xdg-open", "xdg-open", uri, (char *)0); //execlp("xdg-open", "xdg-open", uri, (char *)0);
char *cmd = malloc(11+strlen(uri)); char *cmd = malloc(11+strlen(uri));
strcpy(cmd, "xdg-open "); strcpy(cmd, "xdg-open ");
strappend(cmd, uri); strappend(cmd, uri);
system(cmd); system(cmd);
#elif LIN64 #elif LIN64
//execlp("xdg-open", "xdg-open", uri, (char *)0); //execlp("xdg-open", "xdg-open", uri, (char *)0);
char *cmd = malloc(11+strlen(uri)); char *cmd = malloc(11+strlen(uri));
strcpy(cmd, "xdg-open "); strcpy(cmd, "xdg-open ");
strappend(cmd, uri); strappend(cmd, uri);
system(cmd); system(cmd);
#else #else
printf("Cannot open browser\n"); printf("Cannot open browser\n");
#endif #endif
} }

View File

@ -75,7 +75,7 @@ static const char *it_msg =
"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n"
"\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n"
"\bgCopyright (c) 2010 cracker64\n" "\bgCopyright (c) 2010 cracker64\n"
"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n"
"\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n"
"\n" "\n"
@ -307,24 +307,24 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
i = m[j]; i = m[j];
if(i){ if(i) {
//Everybody loves a 16bit int //Everybody loves a 16bit int
//d[p++] = (parts[i-1].life+3)/4; //d[p++] = (parts[i-1].life+3)/4;
int ttlife = (int)parts[i-1].life; int ttlife = (int)parts[i-1].life;
d[p++] = ((ttlife&0xFF00)>>8); d[p++] = ((ttlife&0xFF00)>>8);
d[p++] = (ttlife&0x00FF); d[p++] = (ttlife&0x00FF);
} }
} }
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
i = m[j]; i = m[j];
if(i){ if(i) {
//Now saving tmp! //Now saving tmp!
//d[p++] = (parts[i-1].life+3)/4; //d[p++] = (parts[i-1].life+3)/4;
int tttmp = (int)parts[i-1].tmp; int tttmp = (int)parts[i-1].tmp;
d[p++] = ((tttmp&0xFF00)>>8); d[p++] = ((tttmp&0xFF00)>>8);
d[p++] = (tttmp&0x00FF); d[p++] = (tttmp&0x00FF);
} }
} }
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
@ -427,18 +427,18 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
} }
else else
{ {
if(ver>=44){ if(ver>=44) {
legacy_enable = c[3]&0x01; legacy_enable = c[3]&0x01;
if(!sys_pause){ if(!sys_pause) {
sys_pause = (c[3]>>1)&0x01; sys_pause = (c[3]>>1)&0x01;
} }
} else { } else {
if(c[3]==1||c[3]==0){ if(c[3]==1||c[3]==0) {
legacy_enable = c[3]; legacy_enable = c[3];
} else { } else {
legacy_beta = 1; legacy_beta = 1;
} }
} }
} }
bw = c[6]; bw = c[6];
@ -504,35 +504,35 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
for(x=bx0; x<bx0+bw; x++) for(x=bx0; x<bx0+bw; x++)
{ {
if(d[p]) if(d[p])
{ {
bmap[y][x] = d[p]; bmap[y][x] = d[p];
if(bmap[y][x]==1) if(bmap[y][x]==1)
bmap[y][x]=WL_WALL; bmap[y][x]=WL_WALL;
if(bmap[y][x]==2) if(bmap[y][x]==2)
bmap[y][x]=WL_DESTROYALL; bmap[y][x]=WL_DESTROYALL;
if(bmap[y][x]==3) if(bmap[y][x]==3)
bmap[y][x]=WL_ALLOWLIQUID; bmap[y][x]=WL_ALLOWLIQUID;
if(bmap[y][x]==4) if(bmap[y][x]==4)
bmap[y][x]=WL_FAN; bmap[y][x]=WL_FAN;
if(bmap[y][x]==5) if(bmap[y][x]==5)
bmap[y][x]=WL_STREAM; bmap[y][x]=WL_STREAM;
if(bmap[y][x]==6) if(bmap[y][x]==6)
bmap[y][x]=WL_DETECT; bmap[y][x]=WL_DETECT;
if(bmap[y][x]==7) if(bmap[y][x]==7)
bmap[y][x]=WL_EWALL; bmap[y][x]=WL_EWALL;
if(bmap[y][x]==8) if(bmap[y][x]==8)
bmap[y][x]=WL_WALLELEC; bmap[y][x]=WL_WALLELEC;
if(bmap[y][x]==9) if(bmap[y][x]==9)
bmap[y][x]=WL_ALLOWAIR; bmap[y][x]=WL_ALLOWAIR;
if(bmap[y][x]==10) if(bmap[y][x]==10)
bmap[y][x]=WL_ALLOWSOLID; bmap[y][x]=WL_ALLOWSOLID;
if(bmap[y][x]==11) if(bmap[y][x]==11)
bmap[y][x]=WL_ALLOWALLELEC; bmap[y][x]=WL_ALLOWALLELEC;
if(bmap[y][x]==12) if(bmap[y][x]==12)
bmap[y][x]=WL_EHOLE; bmap[y][x]=WL_EHOLE;
if(bmap[y][x]==13) if(bmap[y][x]==13)
bmap[y][x]=WL_ALLOWGAS; bmap[y][x]=WL_ALLOWGAS;
} }
p++; p++;
} }
@ -566,7 +566,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
//TODO: Possibly some server side translation //TODO: Possibly some server side translation
j = PT_DUST;//goto corrupt; j = PT_DUST;//goto corrupt;
} }
gol[x][y]=0; gol[x][y]=0;
if(j)// && !(isplayer == 1 && j==PT_STKM)) if(j)// && !(isplayer == 1 && j==PT_STKM))
{ {
if(pmap[y][x]) if(pmap[y][x])
@ -582,10 +582,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
else if(i < nf) else if(i < nf)
{ {
parts[fp[i]].type = j; parts[fp[i]].type = j;
if(j == PT_COAL) if(j == PT_COAL)
parts[fp[i]].tmp = 50; parts[fp[i]].tmp = 50;
if(j == PT_FUSE) if(j == PT_FUSE)
parts[fp[i]].tmp = 50; parts[fp[i]].tmp = 50;
if(j == PT_PHOT) if(j == PT_PHOT)
parts[fp[i]].ctype = 0x3fffffff; parts[fp[i]].ctype = 0x3fffffff;
parts[fp[i]].x = (float)x; parts[fp[i]].x = (float)x;
@ -636,7 +636,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
player[18] = parts[i].y+12; player[18] = parts[i].y+12;
} }
if(parts[i].type == PT_STKM2) if(parts[i].type == PT_STKM2)
{ {
//player[2] = PT_DUST; //player[2] = PT_DUST;
@ -671,46 +671,46 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
i = m[j]; i = m[j];
if(i) if(i)
{ {
if(ver>=44){ if(ver>=44) {
if(p >= size) { if(p >= size) {
goto corrupt; goto corrupt;
} }
if(i <= NPART) { if(i <= NPART) {
ttv = (d[p++])<<8; ttv = (d[p++])<<8;
ttv |= (d[p++]); ttv |= (d[p++]);
parts[i-1].life = ttv; parts[i-1].life = ttv;
} else { } else {
p+=2; p+=2;
} }
} else { } else {
if(p >= size) if(p >= size)
goto corrupt; goto corrupt;
if(i <= NPART) if(i <= NPART)
parts[i-1].life = d[p++]*4; parts[i-1].life = d[p++]*4;
else else
p++; p++;
} }
}
}
if(ver>=44) {
for(j=0; j<w*h; j++)
{
i = m[j];
if(i)
{
if(p >= size) {
goto corrupt;
}
if(i <= NPART) {
ttv = (d[p++])<<8;
ttv |= (d[p++]);
parts[i-1].tmp = ttv;
} else {
p+=2;
}
}
} }
} }
if(ver>=44){
for(j=0; j<w*h; j++)
{
i = m[j];
if(i)
{
if(p >= size) {
goto corrupt;
}
if(i <= NPART) {
ttv = (d[p++])<<8;
ttv |= (d[p++]);
parts[i-1].tmp = ttv;
} else {
p+=2;
}
}
}
}
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
i = m[j]; i = m[j];
@ -1097,7 +1097,7 @@ int main(int argc, char *argv[])
int pastFPS = 0; int pastFPS = 0;
int past = 0; int past = 0;
pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE); pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
void *http_ver_check; void *http_ver_check;
char *ver_data=NULL, *tmp; char *ver_data=NULL, *tmp;
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len; int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
@ -1232,7 +1232,7 @@ int main(int argc, char *argv[])
if(!sys_pause||framerender) if(!sys_pause||framerender)
{ {
update_air(); update_air();
} }
#ifdef OpenGL #ifdef OpenGL
ClearScreen(); ClearScreen();
@ -1252,15 +1252,15 @@ int main(int argc, char *argv[])
} }
#endif #endif
//Can't be too sure... //Can't be too sure...
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
update_particles(vid_buf); update_particles(vid_buf);
draw_parts(vid_buf); draw_parts(vid_buf);
@ -1391,22 +1391,22 @@ int main(int argc, char *argv[])
{ {
set_cmode(CM_FANCY); set_cmode(CM_FANCY);
} }
if(sdl_key=='8') if(sdl_key=='8')
{ {
set_cmode(CM_NOTHING); set_cmode(CM_NOTHING);
} }
if(sdl_key=='9') if(sdl_key=='9')
{ {
set_cmode(CM_GRAD); set_cmode(CM_GRAD);
} }
if(sdl_key=='0') if(sdl_key=='0')
{ {
set_cmode(CM_CRACK); set_cmode(CM_CRACK);
} }
if(sdl_key==SDLK_TAB) if(sdl_key==SDLK_TAB)
{ {
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ; CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
} }
if(sdl_key==SDLK_LEFTBRACKET) { if(sdl_key==SDLK_LEFTBRACKET) {
if(sdl_zoom_trig==1) if(sdl_zoom_trig==1)
{ {
@ -1420,30 +1420,30 @@ int main(int argc, char *argv[])
else else
{ {
if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL))) if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{ {
bsx -= 1; bsx -= 1;
bsy -= 1; bsy -= 1;
} }
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL))) else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{ {
bsx -= 1; bsx -= 1;
} }
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT))) else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{ {
bsy -= 1; bsy -= 1;
} }
else else
{ {
bsx -= ceil((bsx/5)+0.5f); bsx -= ceil((bsx/5)+0.5f);
bsy -= ceil((bsy/5)+0.5f); bsy -= ceil((bsy/5)+0.5f);
} }
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
} }
} }
@ -1460,58 +1460,58 @@ int main(int argc, char *argv[])
else else
{ {
if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL))) if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{ {
bsx += 1; bsx += 1;
bsy += 1; bsy += 1;
} }
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL))) else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{ {
bsx += 1; bsx += 1;
} }
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT))) else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{ {
bsy += 1; bsy += 1;
} }
else else
{ {
bsx += ceil((bsx/5)+0.5f); bsx += ceil((bsx/5)+0.5f);
bsy += ceil((bsy/5)+0.5f); bsy += ceil((bsy/5)+0.5f);
} }
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
} }
} }
if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL))) if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)))
DEBUG_MODE = !DEBUG_MODE; DEBUG_MODE = !DEBUG_MODE;
if(sdl_key=='i') if(sdl_key=='i')
{ {
int nx, ny; int nx, ny;
for(nx = 0;nx<XRES/CELL;nx++) for(nx = 0; nx<XRES/CELL; nx++)
for(ny = 0;ny<YRES/CELL;ny++) for(ny = 0; ny<YRES/CELL; ny++)
{ {
pv[ny][nx] = -pv[ny][nx]; pv[ny][nx] = -pv[ny][nx];
vx[ny][nx] = -vx[ny][nx]; vx[ny][nx] = -vx[ny][nx];
vy[ny][nx] = -vy[ny][nx]; vy[ny][nx] = -vy[ny][nx];
} }
} }
if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT))) if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
active_menu = 11; active_menu = 11;
if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE) if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE)
REPLACE_MODE = !REPLACE_MODE; REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g') if(sdl_key=='g')
{ {
if(sdl_mod & (KMOD_SHIFT)) if(sdl_mod & (KMOD_SHIFT))
GRID_MODE = (GRID_MODE+9)%10; GRID_MODE = (GRID_MODE+9)%10;
else else
GRID_MODE = (GRID_MODE+1)%10; GRID_MODE = (GRID_MODE+1)%10;
} }
if(sdl_key=='t') if(sdl_key=='t')
VINE_MODE = !VINE_MODE; VINE_MODE = !VINE_MODE;
if(sdl_key==SDLK_SPACE) if(sdl_key==SDLK_SPACE)
sys_pause = !sys_pause; sys_pause = !sys_pause;
@ -1536,18 +1536,18 @@ int main(int argc, char *argv[])
} }
} }
} }
if(sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT))) if(sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT)))
{ {
save_mode = 1; save_mode = 1;
copy_mode = 4;//invert copy_mode = 4;//invert
} }
else if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) else if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
{ {
save_mode = 1; save_mode = 1;
copy_mode = 3;//rotate copy_mode = 3;//rotate
} }
else if(sdl_key=='r') else if(sdl_key=='r')
GENERATION = 0; GENERATION = 0;
if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
{ {
save_mode = 1; save_mode = 1;
@ -1606,24 +1606,24 @@ int main(int argc, char *argv[])
} }
else else
{ {
if(!(sdl_mod & (KMOD_SHIFT|KMOD_CTRL))) if(!(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{ {
bsx += sdl_wheel; bsx += sdl_wheel;
bsy += sdl_wheel; bsy += sdl_wheel;
} }
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL))) else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{ {
bsx += sdl_wheel; bsx += sdl_wheel;
} }
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT))) else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{ {
bsy += sdl_wheel; bsy += sdl_wheel;
} }
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
@ -1670,15 +1670,15 @@ int main(int argc, char *argv[])
#ifdef BETA #ifdef BETA
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
#else #else
if(DEBUG_MODE) if(DEBUG_MODE)
{ {
int tctype = parts[cr>>8].ctype; int tctype = parts[cr>>8].ctype;
if(tctype>=PT_NUM) if(tctype>=PT_NUM)
tctype = 0; tctype = 0;
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
} else { } else {
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
} }
#endif #endif
} }
@ -1904,22 +1904,22 @@ int main(int argc, char *argv[])
copy_mode = 0; copy_mode = 0;
clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
} }
else if(copy_mode==3)//rotation else if(copy_mode==3)//rotation
{ {
if(save_h>save_w) if(save_h>save_w)
save_w = save_h; save_w = save_h;
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now
save_mode = 0; save_mode = 0;
copy_mode = 0; copy_mode = 0;
} }
else if(copy_mode==4)//invertion else if(copy_mode==4)//invertion
{ {
if(save_h>save_w) if(save_h>save_w)
save_w = save_h; save_w = save_h;
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now
save_mode = 0; save_mode = 0;
copy_mode = 0; copy_mode = 0;
} }
else else
{ {
stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
@ -2033,11 +2033,11 @@ int main(int argc, char *argv[])
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));
} }
if(x>=19 && x<=35 && svf_last && svf_open && !bq){ if(x>=19 && x<=35 && svf_last && svf_open && !bq) {
//int tpval = sys_pause; //int tpval = sys_pause;
parse_save(svf_last, svf_lsize, 1, 0, 0); parse_save(svf_last, svf_lsize, 1, 0, 0);
//sys_pause = tpval; //sys_pause = tpval;
} }
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
{ {
if(b & SDL_BUTTON_LMASK) if(b & SDL_BUTTON_LMASK)
@ -2112,8 +2112,8 @@ int main(int argc, char *argv[])
} }
else if((sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) && (sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LALT))) else if((sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) && (sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LALT)))
{ {
if(sdl_mod & (KMOD_CAPS)) if(sdl_mod & (KMOD_CAPS))
c = 0; c = 0;
if(c!=WL_STREAM&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE) if(c!=WL_STREAM&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
flood_parts(x, y, c, -1, -1); flood_parts(x, y, c, -1, -1);
lx = x; lx = x;
@ -2200,14 +2200,14 @@ int main(int argc, char *argv[])
if(save_mode) if(save_mode)
{ {
if(copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles if(copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles
{ {
if(save_h>save_w) if(save_h>save_w)
save_w = save_h; save_w = save_h;
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL); xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL);
} }
else else
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
da = 51; da = 51;
db = 269; db = 269;
} }
@ -2333,19 +2333,19 @@ int main(int argc, char *argv[])
} }
#ifdef BETA #ifdef BETA
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS); sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
#else #else
if(DEBUG_MODE) if(DEBUG_MODE)
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION); sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
else else
sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB); sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
#endif #endif
if(REPLACE_MODE) if(REPLACE_MODE)
strappend(uitext, " [REPLACE MODE]"); strappend(uitext, " [REPLACE MODE]");
if(sdl_mod&(KMOD_CAPS)) if(sdl_mod&(KMOD_CAPS))
strappend(uitext, " [CAP LOCKS]"); strappend(uitext, " [CAP LOCKS]");
if(GRID_MODE) if(GRID_MODE)
sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE);
if(sdl_zoom_trig||zoom_en) if(sdl_zoom_trig||zoom_en)
{ {
@ -2378,7 +2378,7 @@ int main(int argc, char *argv[])
else else
player[2] = PT_DUST; player[2] = PT_DUST;
} }
if(isplayer2==0) if(isplayer2==0)
{ {
if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT) if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT)
player2[2] = sr; player2[2] = sr;

File diff suppressed because it is too large Load Diff