test with increased element limit, there seems to be no performace decrease to me anyway. element limit of 4096

This commit is contained in:
Cracker64 2011-01-17 19:11:30 -05:00
parent 926450a9a3
commit e1eeaf9e9a
5 changed files with 788 additions and 784 deletions

View File

@ -195,7 +195,7 @@
#define PT_TEST3 144
#define PT_FROG 145
#define PT_BRAN 146
#define PT_NUM 147
#define PT_NUM 147 //note for future elements, please SKIP numbers 222-240 and 255, these are walls. Element limit is now 4096 (experimental)
#define R_TEMP 22
#define MAX_TEMP 9999
@ -437,7 +437,7 @@ static const part_type ptypes[PT_NUM] =
{"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", 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", 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", 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
};
static part_state pstates[PT_NUM] =

View File

@ -447,7 +447,7 @@ 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(b>=UI_WALLSTART)
if(b>=UI_WALLSTART && b<=UI_WALLSTART+UI_WALLCOUNT)
{
b = b-100;
//x = (2+32*((b-22)/1));
@ -2901,8 +2901,8 @@ void render_signs(pixel *vid_buf)
}
if(strcmp(signs[i].text, "{t}")==0)
{
if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)<NPART)
sprintf(buff, "Temp: %4.2f", parts[pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...tempirature
if((pmap[signs[i].y][signs[i].x]>>12)>0 && (pmap[signs[i].y][signs[i].x]>>12)<NPART)
sprintf(buff, "Temp: %4.2f", parts[pmap[signs[i].y][signs[i].x]>>12].temp-273.15); //...tempirature
else
sprintf(buff, "Temp: 0.00"); //...tempirature
drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255);

View File

@ -1659,7 +1659,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255);
}
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART))
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART&&h<=UI_WALLSTART+UI_WALLCOUNT))
{
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-UI_WALLSTART].descs)-BARSIZE, sy-10, (char *)mwalls[h-UI_WALLSTART].descs, 255, 255, 255, 255);
}

View File

@ -496,7 +496,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
pmap[y][x] = (i<<8)|1;
pmap[y][x] = (i<<12)|1;
}
else
fp[nf++] = i;
@ -573,7 +573,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
if(pmap[y][x])
{
k = pmap[y][x]>>8;
k = pmap[y][x]>>12;
parts[k].type = j;
if(j == PT_PHOT)
parts[k].ctype = 0x3fffffff;
@ -1747,28 +1747,28 @@ int main(int argc, char *argv[])
}else{
cr = pmap[y/sdl_scale][x/sdl_scale];
}
if(!((cr>>8)>=NPART || !cr))
if(!((cr>>12)>=NPART || !cr))
{
#ifdef BETA
if(DEBUG_MODE)
{
int tctype = parts[cr>>8].ctype;
int tctype = parts[cr>>12].ctype;
if(tctype>=PT_NUM)
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[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&0xFFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, ptypes[parts[cr>>12].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
} else
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&0xFFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
#else
if(DEBUG_MODE)
{
int tctype = parts[cr>>8].ctype;
int tctype = parts[cr>>12].ctype;
if(tctype>=PT_NUM)
tctype = 0;
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %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,parts[cr>>8].tmp);
//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,tmp: %d", ptypes[cr&0xFFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life,parts[cr>>12].tmp);
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFFF].name, ptypes[parts[cr>>12].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f, parts[cr>>12].life);
} 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&0xFFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>12].temp-273.15f);
}
#endif
}
@ -2076,6 +2076,9 @@ int main(int argc, char *argv[])
memset(bmap, 0, sizeof(bmap));
memset(emap, 0, sizeof(emap));
memset(parts, 0, sizeof(particle)*NPART);
memset(photons, 0,sizeof(photons));
memset(wireless, 0, sizeof(wireless));
memset(gol2, 0, sizeof(gol2));
for(i=0; i<NPART-1; i++)
parts[i].life = i+1;
parts[NPART-1].life = -1;
@ -2132,10 +2135,7 @@ int main(int argc, char *argv[])
if(x>=19 && x<=35 && svf_last && svf_open && !bq){
//int tpval = sys_pause;
parse_save(svf_last, svf_lsize, 1, 0, 0);
for(j= 0;j<99;j++){ //reset wifi on reload
wireless[j][0] = 0;
wireless[j][1] = 0;
}
memset(wireless, 0, sizeof(wireless));
//sys_pause = tpval;
}
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
@ -2235,9 +2235,9 @@ int main(int argc, char *argv[])
{
int cr;
cr = pmap[y][x];
if(!((cr>>8)>=NPART || !cr))
if(!((cr>>12)>=NPART || !cr))
{
c = sl = cr&0xFF;
c = sl = cr&0xFFF;
}
else
{

File diff suppressed because it is too large Load Diff