Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy

This commit is contained in:
Simon Robertshaw 2011-11-01 19:17:04 +00:00
commit 4f74cfa35d
7 changed files with 265 additions and 153 deletions

View File

@ -313,6 +313,7 @@ int graphics_EMP(GRAPHICS_FUNC_ARGS);
int graphics_LIGH(GRAPHICS_FUNC_ARGS); int graphics_LIGH(GRAPHICS_FUNC_ARGS);
int graphics_FIGH(GRAPHICS_FUNC_ARGS); int graphics_FIGH(GRAPHICS_FUNC_ARGS);
int graphics_ELEC(GRAPHICS_FUNC_ARGS); int graphics_ELEC(GRAPHICS_FUNC_ARGS);
int graphics_WIRE(GRAPHICS_FUNC_ARGS);
#define UPDATE_FUNC_ARGS int i, int x, int y, int surround_space, int nt #define UPDATE_FUNC_ARGS int i, int x, int y, int surround_space, int nt
// to call another update function with same arguments: // to call another update function with same arguments:
@ -506,7 +507,7 @@ static const part_type ptypes[PT_NUM] =
{"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", ST_GAS, TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_NEUT, &graphics_NEUT}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", ST_GAS, TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_NEUT, &graphics_NEUT},
{"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", ST_SOLID, TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, &update_PLUT, NULL}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", ST_SOLID, TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, &update_PLUT, NULL},
{"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", ST_SOLID, TYPE_SOLID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_PLNT, NULL}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", ST_SOLID, TYPE_SOLID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_PLNT, NULL},
{"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", ST_LIQUID, TYPE_LIQUID, &update_ACID, &graphics_ACID}, {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", ST_LIQUID, TYPE_LIQUID|PROP_DEADLY, &update_ACID, &graphics_ACID},
{"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", ST_SOLID, TYPE_SOLID, NULL, NULL}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", ST_SOLID, TYPE_SOLID, NULL, NULL},
{"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", ST_GAS, TYPE_GAS, &update_WTRV, NULL}, {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", ST_GAS, TYPE_GAS, &update_WTRV, NULL},
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", ST_SOLID, TYPE_PART|PROP_HOT_GLOW, NULL, NULL}, {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", ST_SOLID, TYPE_PART|PROP_HOT_GLOW, NULL, NULL},
@ -641,7 +642,7 @@ static const part_type ptypes[PT_NUM] =
{"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN, &graphics_PBCN}, {"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN, &graphics_PBCN},
{"GPMP", PIXPACK(0x0A3B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP, &graphics_GPMP}, {"GPMP", PIXPACK(0x0A3B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP, &graphics_GPMP},
{"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST, &graphics_CLST}, {"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST, &graphics_CLST},
{"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,&update_WIRE, NULL}, {"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,&update_WIRE, &graphics_WIRE},
{"GBMB", PIXPACK(0x1144BB), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Sticks to first object it touches then produces strong gravity push.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_GBMB, &graphics_GBMB}, {"GBMB", PIXPACK(0x1144BB), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Sticks to first object it touches then produces strong gravity push.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_GBMB, &graphics_GBMB},
{"FIGH", 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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Fighter. Tries to kill stickmans.", ST_NONE, 0, &update_FIGH, &graphics_FIGH}, {"FIGH", 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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Fighter. Tries to kill stickmans.", ST_NONE, 0, &update_FIGH, &graphics_FIGH},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description

View File

@ -45,20 +45,34 @@ int update_FIGH(UPDATE_FUNC_ARGS)
case 1: case 1:
if ((pow(tarx-x, 2) + pow(tary-y, 2))<600) if ((pow(tarx-x, 2) + pow(tary-y, 2))<600)
{ {
if (figh->elem == PT_FIRE || figh->elem == PT_LIGH) if (figh->elem == PT_LIGH || figh->elem == PT_NEUT
|| ptypes[figh->elem].properties&(PROP_DEADLY|PROP_RADIOACTIVE)
|| ptypes[figh->elem].heat>=323 || ptypes[figh->elem].heat<=243)
figh->comm = (int)figh->comm | 0x08; figh->comm = (int)figh->comm | 0x08;
} }
else else
if (tarx<x) if (tarx<x )
{ {
figh->comm = 0x01; if(!eval_move(PT_DUST, figh->legs[4]-10, figh->legs[5]+6, NULL))
if (!eval_move(PT_DUST, figh->legs[4]-4, figh->legs[5]-1, NULL) || !eval_move(PT_DUST, figh->legs[12]-4, figh->legs[13]-1, NULL)) figh->comm = 0x01;
else
figh->comm = 0x02;
if (!eval_move(PT_DUST, figh->legs[4]-4, figh->legs[5]-1, NULL)
|| !eval_move(PT_DUST, figh->legs[12]-4, figh->legs[13]-1, NULL)
|| eval_move(PT_DUST, 2*figh->legs[4]-figh->legs[6], figh->legs[5]+5, NULL))
figh->comm = (int)figh->comm | 0x04; figh->comm = (int)figh->comm | 0x04;
} }
else else
{ {
figh->comm = 0x02; if (!eval_move(PT_DUST, figh->legs[12]+10, figh->legs[13]+6, NULL))
if (!eval_move(PT_DUST, figh->legs[4]+4, figh->legs[5]-1, NULL) || !eval_move(PT_DUST, figh->legs[12]+4, figh->legs[13]-1, NULL)) figh->comm = 0x02;
else
figh->comm = 0x01;
if (!eval_move(PT_DUST, figh->legs[4]+4, figh->legs[5]-1, NULL)
|| !eval_move(PT_DUST, figh->legs[4]+4, figh->legs[5]-1, NULL)
|| eval_move(PT_DUST, 2*figh->legs[12]-figh->legs[14], figh->legs[13]+5, NULL))
figh->comm = (int)figh->comm | 0x04; figh->comm = (int)figh->comm | 0x04;
} }
break; break;

View File

@ -13,7 +13,7 @@ int graphics_PLSM(GRAPHICS_FUNC_ARGS)
*fireg = *colg; *fireg = *colg;
*fireb = *colb; *fireb = *colb;
*pixel_mode = PMODE_GLOW; //Clear default, don't draw pixel *pixel_mode = PMODE_GLOW | PMODE_ADD; //Clear default, don't draw pixel
*pixel_mode |= FIRE_ADD; *pixel_mode |= FIRE_ADD;
//Returning 0 means dynamic, do not cache //Returning 0 means dynamic, do not cache
return 0; return 0;

View File

@ -427,13 +427,17 @@ void STKM_interact(playerst* playerp, int i, int x, int y)
playerp->accs[3] -= 1; playerp->accs[3] -= 1;
} }
if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
if (ptypes[r&0xFF].properties&PROP_DEADLY) if (ptypes[r&0xFF].properties&PROP_DEADLY)
switch (r&0xFF)
{
case PT_ACID:
parts[i].life -= 5;
break;
default:
parts[i].life -= 1;
}
if (ptypes[r&0xFF].properties&PROP_RADIOACTIVE)
parts[i].life -= 1; parts[i].life -= 1;
if ((r&0xFF)==PT_PRTI && parts[i].type) if ((r&0xFF)==PT_PRTI && parts[i].type)

View File

@ -38,3 +38,30 @@ int update_WIRE(UPDATE_FUNC_ARGS) {
parts[i].ctype=1; parts[i].ctype=1;
return 0; return 0;
} }
int graphics_WIRE(GRAPHICS_FUNC_ARGS)
{
if (cpart->ctype==0)
{
*colr = 255;
*colg = 204;
*colb = 0;
return 0;
}
if (cpart->ctype==1)
{
*colr = 50;
*colg = 100;
*colb = 255;
//*pixel_mode |= PMODE_GLOW;
return 0;
}
if (cpart->ctype==2)
{
*colr = 255;
*colg = 100;
*colb = 50;
//*pixel_mode |= PMODE_GLOW;
return 0;
}
}

View File

@ -1622,6 +1622,8 @@ GLuint glowV[(YRES*XRES)*2];
GLfloat glowC[(YRES*XRES)*4]; GLfloat glowC[(YRES*XRES)*4];
GLuint flatV[(YRES*XRES)*2]; GLuint flatV[(YRES*XRES)*2];
GLfloat flatC[(YRES*XRES)*4]; GLfloat flatC[(YRES*XRES)*4];
GLuint addV[(YRES*XRES)*2];
GLfloat addC[(YRES*XRES)*4];
GLfloat lineV[(((YRES*XRES)*2)*6)]; GLfloat lineV[(((YRES*XRES)*2)*6)];
GLfloat lineC[(((YRES*XRES)*2)*6)]; GLfloat lineC[(((YRES*XRES)*2)*6)];
#endif #endif
@ -1637,11 +1639,9 @@ void render_parts(pixel *vid)
int cblurV = 0, cblurC = 0, cblur = 0; int cblurV = 0, cblurC = 0, cblur = 0;
int cglowV = 0, cglowC = 0, cglow = 0; int cglowV = 0, cglowC = 0, cglow = 0;
int cflatV = 0, cflatC = 0, cflat = 0; int cflatV = 0, cflatC = 0, cflat = 0;
int caddV = 0, caddC = 0, cadd = 0;
int clineV = 0, clineC = 0, cline = 0; int clineV = 0, clineC = 0, cline = 0;
GLuint origBlendSrc, origBlendDst; GLuint origBlendSrc, origBlendDst;
//Set coord offset
glScalef(1,-1,1);
glTranslatef(0, -YRES/*-(YRES+MENUSIZE)*/, 0);
glGetIntegerv(GL_BLEND_SRC, &origBlendSrc); glGetIntegerv(GL_BLEND_SRC, &origBlendSrc);
glGetIntegerv(GL_BLEND_DST, &origBlendDst); glGetIntegerv(GL_BLEND_DST, &origBlendDst);
@ -1777,7 +1777,7 @@ void render_parts(pixel *vid)
case CM_VEL: case CM_VEL:
case CM_PRESS: case CM_PRESS:
case CM_GRAD: case CM_GRAD:
if(pixel_mode & FIRE_ADD) pixel_mode = (pixel_mode & ~FIRE_ADD) | PMODE_GLOW | PMODE_FLAT; if(pixel_mode & FIRE_ADD) pixel_mode = (pixel_mode & ~(FIRE_ADD|PMODE_FLAT)) | PMODE_GLOW | PMODE_ADD;
if(pixel_mode & FIRE_BLEND) pixel_mode = (pixel_mode & ~FIRE_BLEND) | PMODE_BLUR; if(pixel_mode & FIRE_BLEND) pixel_mode = (pixel_mode & ~FIRE_BLEND) | PMODE_BLUR;
case CM_FIRE: case CM_FIRE:
if(pixel_mode & PMODE_BLOB) pixel_mode = (pixel_mode & ~PMODE_BLOB) | PMODE_FLAT; if(pixel_mode & PMODE_BLOB) pixel_mode = (pixel_mode & ~PMODE_BLOB) | PMODE_FLAT;
@ -1870,6 +1870,7 @@ void render_parts(pixel *vid)
#else #else
char buff[20]; //Buffer for HP char buff[20]; //Buffer for HP
int s; int s;
int legr, legg, legb;
pixel pc; pixel pc;
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head
@ -1879,8 +1880,31 @@ void render_parts(pixel *vid)
} }
if (cplayer->elem<PT_NUM) pc = ptypes[cplayer->elem].pcolors; if (cplayer->elem<PT_NUM) pc = ptypes[cplayer->elem].pcolors;
else pc = PIXPACK(0xFFFFFF); else pc = PIXPACK(0x8080FF);
s = XRES+BARSIZE; s = XRES+BARSIZE;
if (t==PT_STKM2)
{
legr = 100;
legg = 100;
legb = 255;
}
else
{
legr = 255;
legg = 255;
legb = 255;
}
if (cmode == CM_HEAT)
{
pc = PIXRGB(colr, colg, colb);
legr = colr;
legg = colg;
legb = colb;
}
//head //head
if(t==PT_FIGH) if(t==PT_FIGH)
{ {
@ -1897,10 +1921,10 @@ void render_parts(pixel *vid)
draw_line(vid , nx+2, ny-2, nx+2, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s); draw_line(vid , nx+2, ny-2, nx+2, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s);
} }
//legs //legs
draw_line(vid , nx, ny+3, cplayer->legs[0], cplayer->legs[1], 255, 255, 255, s); draw_line(vid , nx, ny+3, cplayer->legs[0], cplayer->legs[1], legr, legg, legb, s);
draw_line(vid , cplayer->legs[0], cplayer->legs[1], cplayer->legs[4], cplayer->legs[5], 255, 255, 255, s); draw_line(vid , cplayer->legs[0], cplayer->legs[1], cplayer->legs[4], cplayer->legs[5], legr, legg, legb, s);
draw_line(vid , nx, ny+3, cplayer->legs[8], cplayer->legs[9], 255, 255, 255, s); draw_line(vid , nx, ny+3, cplayer->legs[8], cplayer->legs[9], legr, legg, legb, s);
draw_line(vid , cplayer->legs[8], cplayer->legs[9], cplayer->legs[12], cplayer->legs[13], 255, 255, 255, s); draw_line(vid , cplayer->legs[8], cplayer->legs[9], cplayer->legs[12], cplayer->legs[13], legr, legg, legb, s);
#endif #endif
} }
if(pixel_mode & PMODE_FLAT) if(pixel_mode & PMODE_FLAT)
@ -1934,13 +1958,13 @@ void render_parts(pixel *vid)
if(pixel_mode & PMODE_ADD) if(pixel_mode & PMODE_ADD)
{ {
#ifdef OGLR #ifdef OGLR
flatV[cflatV++] = nx; addV[caddV++] = nx;
flatV[cflatV++] = ny; addV[caddV++] = ny;
flatC[cflatC++] = ((float)colr)/255.0f; addC[caddC++] = ((float)colr)/255.0f;
flatC[cflatC++] = ((float)colg)/255.0f; addC[caddC++] = ((float)colg)/255.0f;
flatC[cflatC++] = ((float)colb)/255.0f; addC[caddC++] = ((float)colb)/255.0f;
flatC[cflatC++] = ((float)cola)/255.0f; addC[caddC++] = ((float)cola)/255.0f;
cflat++; cadd++;
#else #else
addpixel(vid, nx, ny, colr, colg, colb, cola); addpixel(vid, nx, ny, colr, colg, colb, cola);
#endif #endif
@ -2378,6 +2402,22 @@ void render_parts(pixel *vid)
// -- END GLOW -- // // -- END GLOW -- //
} }
if(cadd)
{
// -- BEGIN ADD -- //
//Set point size (size of fire texture)
glPointSize(1.0f);
glColorPointer(4, GL_FLOAT, 0, &addC[0]);
glVertexPointer(2, GL_INT, 0, &addV[0]);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDrawArrays(GL_POINTS, 0, cadd);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//Clear some stuff we set
// -- END ADD -- //
}
if(cline) if(cline)
{ {
// -- BEGIN LINES -- // // -- BEGIN LINES -- //
@ -2446,9 +2486,6 @@ void render_parts(pixel *vid)
//Reset FBO //Reset FBO
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glTranslatef(0, -MENUSIZE, 0);
//TODO: Do shit on the fbo like gravity lensing or turning stickmen into turds here
//Drawing the FBO onto the screen sounds like a cool idea now //Drawing the FBO onto the screen sounds like a cool idea now
glEnable( GL_TEXTURE_2D ); glEnable( GL_TEXTURE_2D );
@ -2479,13 +2516,13 @@ void render_parts(pixel *vid)
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2d(1, 0); glTexCoord2d(1, 0);
glVertex3f(XRES*sdl_scale, (YRES)*sdl_scale, 1.0); glVertex3f(XRES*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 1.0);
glTexCoord2d(0, 0); glTexCoord2d(0, 0);
glVertex3f(0, (YRES)*sdl_scale, 1.0); glVertex3f(0, (YRES+MENUSIZE)*sdl_scale, 1.0);
glTexCoord2d(0, 1); glTexCoord2d(0, 1);
glVertex3f(0, 0, 1.0); glVertex3f(0, MENUSIZE*sdl_scale, 1.0);
glTexCoord2d(1, 1); glTexCoord2d(1, 1);
glVertex3f(XRES*sdl_scale, 0, 1.0); glVertex3f(XRES*sdl_scale, MENUSIZE*sdl_scale, 1.0);
glEnd(); glEnd();
if(cmode==CM_FANCY) if(cmode==CM_FANCY)
@ -2495,9 +2532,6 @@ void render_parts(pixel *vid)
} }
glDisable( GL_TEXTURE_2D ); glDisable( GL_TEXTURE_2D );
//Reset coords/offset
glTranslatef(0, YRES+MENUSIZE, 0);
glScalef(1,-1,1);
glBlendFunc(origBlendSrc, origBlendDst); glBlendFunc(origBlendSrc, origBlendDst);
#endif #endif
} }
@ -3181,26 +3215,32 @@ void dim_copy_pers(pixel *dst, pixel *src) //for persistent view, reduces rgb sl
void render_zoom(pixel *img) //draws the zoom box void render_zoom(pixel *img) //draws the zoom box
{ {
#ifdef OGLR #ifdef OGLR
int origBlendSrc, origBlendDst;
float zcx1, zcx0, zcy1, zcy0, yfactor, xfactor; //X-Factor is shit, btw float zcx1, zcx0, zcy1, zcy0, yfactor, xfactor; //X-Factor is shit, btw
xfactor = 1.0f/(float)XRES; xfactor = 1.0f/(float)XRES;
yfactor = 1.0f/(float)YRES; yfactor = 1.0f/(float)YRES;
zcx0 = (zoom_x)*xfactor; zcx0 = (zoom_x)*xfactor;
zcx1 = (zoom_x+ZSIZE)*xfactor; zcx1 = (zoom_x+ZSIZE)*xfactor;
zcy0 = (YRES-zoom_y+1)*yfactor; zcy0 = (zoom_y)*yfactor;
zcy1 = (YRES-(zoom_y+ZSIZE)+1)*yfactor; zcy1 = ((zoom_y+ZSIZE))*yfactor;
glLineWidth(sdl_scale);
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex3i(zoom_wx-1, YRES+MENUSIZE-zoom_wy, 0); glVertex3i((zoom_wx-1)*sdl_scale, (YRES+MENUSIZE-zoom_wy)*sdl_scale, 0);
glVertex3i(zoom_wx-1, YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR), 0); glVertex3i((zoom_wx-1)*sdl_scale, (YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR))*sdl_scale, 0);
glVertex3i(zoom_wx+ZSIZE*ZFACTOR, YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR), 0); glVertex3i((zoom_wx+ZSIZE*ZFACTOR)*sdl_scale, (YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR))*sdl_scale, 0);
glVertex3i(zoom_wx+ZSIZE*ZFACTOR, YRES+MENUSIZE-zoom_wy, 0); glVertex3i((zoom_wx+ZSIZE*ZFACTOR)*sdl_scale, (YRES+MENUSIZE-zoom_wy)*sdl_scale, 0);
glVertex3i(zoom_wx-1, YRES+MENUSIZE-zoom_wy, 0); glVertex3i((zoom_wx-1)*sdl_scale, (YRES+MENUSIZE-zoom_wy)*sdl_scale, 0);
glEnd(); glEnd();
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
glGetIntegerv(GL_BLEND_SRC, &origBlendSrc);
glGetIntegerv(GL_BLEND_DST, &origBlendDst);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable( GL_TEXTURE_2D ); glEnable( GL_TEXTURE_2D );
//glReadBuffer(GL_AUX0); //glReadBuffer(GL_AUX0);
glBindTexture(GL_TEXTURE_2D, partsFboTex); glBindTexture(GL_TEXTURE_2D, partsFboTex);
@ -3208,17 +3248,18 @@ void render_zoom(pixel *img) //draws the zoom box
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2d(zcx1, zcy1); glTexCoord2d(zcx1, zcy1);
glVertex3f(zoom_wx+ZSIZE*ZFACTOR, YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR), 1.0); glVertex3f((zoom_wx+ZSIZE*ZFACTOR)*sdl_scale, (YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR))*sdl_scale, 1.0);
glTexCoord2d(zcx0, zcy1); glTexCoord2d(zcx0, zcy1);
glVertex3f(zoom_wx, YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR), 1.0); glVertex3f(zoom_wx*sdl_scale, (YRES+MENUSIZE-(zoom_wy+ZSIZE*ZFACTOR))*sdl_scale, 1.0);
glTexCoord2d(zcx0, zcy0); glTexCoord2d(zcx0, zcy0);
glVertex3f(zoom_wx, YRES+MENUSIZE-zoom_wy, 1.0); glVertex3f(zoom_wx*sdl_scale, (YRES+MENUSIZE-zoom_wy)*sdl_scale, 1.0);
glTexCoord2d(zcx1, zcy0); glTexCoord2d(zcx1, zcy0);
glVertex3f(zoom_wx+ZSIZE*ZFACTOR, YRES+MENUSIZE-zoom_wy, 1.0); glVertex3f((zoom_wx+ZSIZE*ZFACTOR)*sdl_scale, (YRES+MENUSIZE-zoom_wy)*sdl_scale, 1.0);
glEnd(); glEnd();
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable( GL_TEXTURE_2D ); glDisable( GL_TEXTURE_2D );
glBlendFunc(origBlendSrc, origBlendDst);
if(zoom_en) if(zoom_en)
{ {
@ -3227,14 +3268,15 @@ void render_zoom(pixel *img) //draws the zoom box
glLogicOp(GL_XOR); glLogicOp(GL_XOR);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex3i(zoom_x-1, YRES+MENUSIZE-(zoom_y-1), 0); glVertex3i((zoom_x-1)*sdl_scale, (YRES+MENUSIZE-(zoom_y-1))*sdl_scale, 0);
glVertex3i(zoom_x-1, YRES+MENUSIZE-(zoom_y+ZSIZE), 0); glVertex3i((zoom_x-1)*sdl_scale, (YRES+MENUSIZE-(zoom_y+ZSIZE))*sdl_scale, 0);
glVertex3i(zoom_x+ZSIZE, YRES+MENUSIZE-(zoom_y+ZSIZE), 0); glVertex3i((zoom_x+ZSIZE)*sdl_scale, (YRES+MENUSIZE-(zoom_y+ZSIZE))*sdl_scale, 0);
glVertex3i(zoom_x+ZSIZE, YRES+MENUSIZE-(zoom_y-1), 0); glVertex3i((zoom_x+ZSIZE)*sdl_scale, (YRES+MENUSIZE-(zoom_y-1))*sdl_scale, 0);
glVertex3i(zoom_x-1, YRES+MENUSIZE-(zoom_y-1), 0); glVertex3i((zoom_x-1)*sdl_scale, (YRES+MENUSIZE-(zoom_y-1))*sdl_scale, 0);
glEnd(); glEnd();
glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_COLOR_LOGIC_OP);
} }
glLineWidth(1);
#else #else
int x, y, i, j; int x, y, i, j;
pixel pix; pixel pix;
@ -3555,28 +3597,32 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
glLogicOp(GL_XOR); glLogicOp(GL_XOR);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
y *= sdl_scale;
x *= sdl_scale;
ry *= sdl_scale;
rx *= sdl_scale;
if (CURRENT_BRUSH==SQUARE_BRUSH) if (CURRENT_BRUSH==SQUARE_BRUSH)
{ {
glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); glVertex2f(x-rx+1, ((YRES+MENUSIZE)*sdl_scale-y)-ry+1);
glVertex2f(x+rx+1, (YRES+MENUSIZE-y)-ry+1); glVertex2f(x+rx+1, ((YRES+MENUSIZE)*sdl_scale-y)-ry+1);
glVertex2f(x+rx+1, (YRES+MENUSIZE-y)+ry+1); glVertex2f(x+rx+1, ((YRES+MENUSIZE)*sdl_scale-y)+ry+1);
glVertex2f(x-rx+1, (YRES+MENUSIZE-y)+ry+1); glVertex2f(x-rx+1, ((YRES+MENUSIZE)*sdl_scale-y)+ry+1);
glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); glVertex2f(x-rx+1, ((YRES+MENUSIZE)*sdl_scale-y)-ry+1);
} }
else if (CURRENT_BRUSH==CIRCLE_BRUSH) else if (CURRENT_BRUSH==CIRCLE_BRUSH)
{ {
for (i = 0; i < 360; i++) for (i = 0; i < 360; i++)
{ {
float degInRad = i*(M_PI/180.0f); float degInRad = i*(M_PI/180.0f);
glVertex2f((cos(degInRad)*rx)+x, (sin(degInRad)*ry)+YRES+MENUSIZE-y); glVertex2f((cos(degInRad)*rx)+x, (sin(degInRad)*ry)+(YRES+MENUSIZE)*sdl_scale-y);
} }
} }
else if (CURRENT_BRUSH==TRI_BRUSH) else if (CURRENT_BRUSH==TRI_BRUSH)
{ {
glVertex2f(x+1, (YRES+MENUSIZE-y)+ry+1); glVertex2f(x+1, ((YRES+MENUSIZE)*sdl_scale-y)+ry+1);
glVertex2f(x+rx+1, (YRES+MENUSIZE-y)-ry+1); glVertex2f(x+rx+1, ((YRES+MENUSIZE)*sdl_scale-y)-ry+1);
glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); glVertex2f(x-rx+1, ((YRES+MENUSIZE)*sdl_scale-y)-ry+1);
glVertex2f(x+1, (YRES+MENUSIZE-y)+ry+1); glVertex2f(x+1, ((YRES+MENUSIZE)*sdl_scale-y)+ry+1);
} }
glEnd(); glEnd();
glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_COLOR_LOGIC_OP);
@ -3657,6 +3703,7 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
#endif #endif
} }
int sdl_opened = 0;
int sdl_open(void) int sdl_open(void)
{ {
if (SDL_Init(SDL_INIT_VIDEO)<0) if (SDL_Init(SDL_INIT_VIDEO)<0)
@ -3669,20 +3716,31 @@ int sdl_open(void)
sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_OPENGL); sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_OPENGL);
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
glMatrixMode(GL_PROJECTION); if(sdl_opened)
glLoadIdentity(); {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1); glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
}
else
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRasterPos2i(0, (YRES+MENUSIZE)); glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1);
glPixelZoom(sdl_scale, -sdl_scale);
//glPixelZoom(1, -1);
glEnable(GL_BLEND); glMatrixMode(GL_MODELVIEW);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glLoadIdentity();
glRasterPos2i(0, (YRES+MENUSIZE));
glPixelZoom(1, -1);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//FBO Texture //FBO Texture
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
@ -3702,91 +3760,91 @@ int sdl_open(void)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Texture for main UI //Texture for main UI
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &vidBuf); glGenTextures(1, &vidBuf);
glBindTexture(GL_TEXTURE_2D, vidBuf); glBindTexture(GL_TEXTURE_2D, vidBuf);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Texture for air to be drawn //Texture for air to be drawn
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &airBuf); glGenTextures(1, &airBuf);
glBindTexture(GL_TEXTURE_2D, airBuf); glBindTexture(GL_TEXTURE_2D, airBuf);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Zoom texture //Zoom texture
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &zoomTex); glGenTextures(1, &zoomTex);
glBindTexture(GL_TEXTURE_2D, zoomTex); glBindTexture(GL_TEXTURE_2D, zoomTex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Texture for velocity maps for gravity //Texture for velocity maps for gravity
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &partsTFX); glGenTextures(1, &partsTFX);
glBindTexture(GL_TEXTURE_2D, partsTFX); glBindTexture(GL_TEXTURE_2D, partsTFX);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glGenTextures(1, &partsTFY); glGenTextures(1, &partsTFY);
glBindTexture(GL_TEXTURE_2D, partsTFY); glBindTexture(GL_TEXTURE_2D, partsTFY);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Texture for velocity maps for air //Texture for velocity maps for air
//TODO: Combine all air maps into 3D array or structs //TODO: Combine all air maps into 3D array or structs
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &airVX); glGenTextures(1, &airVX);
glBindTexture(GL_TEXTURE_2D, airVX); glBindTexture(GL_TEXTURE_2D, airVX);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glGenTextures(1, &airVY); glGenTextures(1, &airVY);
glBindTexture(GL_TEXTURE_2D, airVY); glBindTexture(GL_TEXTURE_2D, airVY);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glGenTextures(1, &airPV); glGenTextures(1, &airPV);
glBindTexture(GL_TEXTURE_2D, airPV); glBindTexture(GL_TEXTURE_2D, airPV);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//Fire alpha texture //Fire alpha texture
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &fireAlpha); glGenTextures(1, &fireAlpha);
glBindTexture(GL_TEXTURE_2D, fireAlpha); glBindTexture(GL_TEXTURE_2D, fireAlpha);
@ -3823,7 +3881,8 @@ int sdl_open(void)
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
loadShaders(); loadShaders();
}
#else #else
#ifdef PIX16 #ifdef PIX16
if (kiosk_enable) if (kiosk_enable)
@ -3855,6 +3914,7 @@ int sdl_open(void)
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1); XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
sdl_wminfo.info.x11.unlock_func(); sdl_wminfo.info.x11.unlock_func();
#endif #endif
sdl_opened = 1;
return 1; return 1;
} }
#ifdef OGLR #ifdef OGLR

View File

@ -1800,6 +1800,9 @@ int main(int argc, char *argv[])
update_airh(); update_airh();
} }
#ifdef OGLR
part_vbuf = vid_buf;
#else
if(ngrav_enable && cmode==CM_FANCY) if(ngrav_enable && cmode==CM_FANCY)
{ {
part_vbuf = part_vbuf_store; part_vbuf = part_vbuf_store;
@ -1807,6 +1810,7 @@ int main(int argc, char *argv[])
} else { } else {
part_vbuf = vid_buf; part_vbuf = vid_buf;
} }
#endif
if(gravwl_timeout) if(gravwl_timeout)
{ {
@ -1978,8 +1982,10 @@ int main(int argc, char *argv[])
render_signs(part_vbuf); render_signs(part_vbuf);
#ifndef OGLR
if(ngrav_enable && cmode==CM_FANCY) if(ngrav_enable && cmode==CM_FANCY)
render_gravlensing(part_vbuf, vid_buf); render_gravlensing(part_vbuf, vid_buf);
#endif
memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE);//clear menu areas memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE);//clear menu areas
clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES);