Pass particle pointer to graphics update function instead of index. Make PIPE use subcall to get graphics info. Cache for particle graphics properties. Stickman PSPEC_STICKMAN added and implemented

This commit is contained in:
Simon Robertshaw 2011-10-23 13:52:26 +01:00
parent 014c1fbad6
commit 1c7b9d9949
17 changed files with 424 additions and 253 deletions

View File

@ -1,5 +0,0 @@
uniform sampler2D fireAlpha;
void main () {
vec4 texColor = texture2D(fireAlpha, gl_PointCoord);
gl_FragColor = vec4(gl_Color.rgb, texColor.a*gl_Color.a);
}

View File

@ -1,18 +0,0 @@
tpt.register_step("do_step")
numberthing = 0
increment = 2
function do_step()
numberthing = numberthing + increment;
if numberthing >= 400 then
increment = -2
elseif numberthing < 4 then
increment = 2
end
tpt.drawtext(numberthing, 50, "Oh my god, this is amazing", 255, 255, 255, 255)
tpt.drawtext(mousex, mousey, "Oh my god, this is amazing", 255, 255, 255, 255)
tpt.reset_velocity(10, 10, 20, 20)
tpt.reset_gravity_field(10, 10, 20, 20)
tpt.set_pressure(10, 10, 20, 20)
tpt.set_gravity(75, 45, 1, 1, 8)
return false
end

View File

@ -1,5 +0,0 @@
void main(void)
{
gl_Position = ftransform();;
gl_FrontColor = gl_Color;
}

View File

@ -61,6 +61,21 @@ extern unsigned int fire_alpha[CELL*3][CELL*3];
extern pixel *fire_bg;
extern pixel *pers_bg;
struct gcache_item
{
int isready;
int pixel_mode;
int colr, colg, colb;
int firea, firer, fireg, fireb;
};
typedef struct gcache_item gcache_item;
gcache_item *graphicscache;
int graphics_DEFAULT(GRAPHICS_FUNC_ARGS);
void prepare_graphicscache();
void draw_rgba_image(pixel *vid, unsigned char *data, int x, int y, float a);
void *ptif_pack(pixel *src, int w, int h, int *result_size);

View File

@ -245,7 +245,23 @@
#define FLAG_STAGNANT 1
#define GRAPHICS_FUNC_ARGS int i, int nx, int ny, int *pixel_mode, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
#define GRAPHICS_FUNC_ARGS particle *cpart, int nx, int ny, int *pixel_mode, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
#define GRAPHICS_FUNC_SUBCALL_ARGS cpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb
struct particle
{
int type;
int life, ctype;
float x, y, vx, vy;
float temp;
float pavg[2];
int flags;
int tmp;
int tmp2;
unsigned int dcolour;
};
typedef struct particle particle;
int graphics_FIRE(GRAPHICS_FUNC_ARGS);
int graphics_SMKE(GRAPHICS_FUNC_ARGS);
@ -288,6 +304,8 @@ int graphics_FIRW(GRAPHICS_FUNC_ARGS);
int graphics_BOMB(GRAPHICS_FUNC_ARGS);
int graphics_GBMB(GRAPHICS_FUNC_ARGS);
int graphics_COAL(GRAPHICS_FUNC_ARGS);
int graphics_STKM(GRAPHICS_FUNC_ARGS);
int graphics_STKM2(GRAPHICS_FUNC_ARGS);
#define UPDATE_FUNC_ARGS int i, int x, int y, int surround_space, int nt
// to call another update function with same arguments:
@ -386,21 +404,6 @@ int run_stickman(float* playerp, UPDATE_FUNC_ARGS);
void STKM_init_legs(float* playerp, int i);
void STKM_interact(float* playerp, int i, int x, int y);
struct particle
{
int type;
int life, ctype;
float x, y, vx, vy;
float temp;
float pavg[2];
int flags;
int tmp;
int tmp2;
unsigned int dcolour;
};
typedef struct particle particle;
struct part_type
{
const char *name;
@ -513,7 +516,7 @@ static const part_type ptypes[PT_NUM] =
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL, NULL},
{"BTRY", PIXPACK(0x858505), 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_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", ST_SOLID, TYPE_SOLID, &update_BTRY, NULL},
{"LCRY", PIXPACK(0x505050), 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, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", ST_SOLID, TYPE_SOLID, &update_LCRY, &graphics_LCRY},
{"STKM", 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, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM, NULL},
{"STKM", 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, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM, &graphics_STKM},
{"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)", ST_SOLID, TYPE_SOLID, &update_SWCH, &graphics_SWCH},
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke", ST_SOLID, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, NULL, &graphics_SMKE},
{"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures", ST_LIQUID, TYPE_LIQUID, NULL, NULL},
@ -586,7 +589,7 @@ 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, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", ST_SOLID, TYPE_SOLID, NULL, &graphics_FILT},
{"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, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emitter. Rays create points when they collide", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_ARAY, 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, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL, NULL, &graphics_BRAY},
{"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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM2, 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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM2, &graphics_STKM2},
{"BOMB", PIXPACK(0xFFF288), 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, "Bomb.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_BOMB, &graphics_BOMB},
{"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_C5, NULL},
{"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_SING, NULL},

View File

@ -13,6 +13,8 @@
#define PMODE_ADD 0x00000080
#define PMODE_BLEND 0x00000100
#define PSPEC_STICKMAN 0x00000200
#define NO_DECO 0x00001000
#define FIREMODE 0x00FF0000

View File

@ -71,18 +71,18 @@ int update_DEUT(UPDATE_FUNC_ARGS) {
int graphics_DEUT(GRAPHICS_FUNC_ARGS)
{
if(parts[i].life>=700)
if(cpart->life>=700)
{
*colr += parts[i].life*1;
*colg += parts[i].life*2;
*colb += parts[i].life*3;
*colr += cpart->life*1;
*colg += cpart->life*2;
*colb += cpart->life*3;
*pixel_mode |= PMODE_GLOW;
}
else
{
*colr += parts[i].life*1;
*colg += parts[i].life*2;
*colb += parts[i].life*3;
*colr += cpart->life*1;
*colg += cpart->life*2;
*colb += cpart->life*3;
*pixel_mode |= PMODE_BLUR;
}
return 0;

View File

@ -2,7 +2,7 @@
int graphics_FIRE(GRAPHICS_FUNC_ARGS)
{
int caddress = restrict_flt(restrict_flt((float)((int)(parts[i].life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
*colr = (unsigned char)flm_data[caddress];
*colg = (unsigned char)flm_data[caddress+1];
*colb = (unsigned char)flm_data[caddress+2];

View File

@ -2,9 +2,9 @@
int graphics_LAVA(GRAPHICS_FUNC_ARGS)
{
*colr = parts[i].life * 2 + 0xE0;
*colg = parts[i].life * 1 + 0x50;
*colb = parts[i].life / 2 + 0x10;
*colr = cpart->life * 2 + 0xE0;
*colg = cpart->life * 1 + 0x50;
*colb = cpart->life / 2 + 0x10;
if (*colr>255) *colr = 255;
if (*colg>192) *colg = 192;
if (*colb>128) *colb = 128;

View File

@ -1,11 +1,11 @@
#include <element.h>
int graphics_QRTZ(GRAPHICS_FUNC_ARGS) //QRTZ and PQRT
{
int t = parts[i].type, z = parts[i].tmp - 5;//speckles!
if (parts[i].temp>(ptransitions[t].thv-800.0f))//hotglow for quartz
int t = cpart->type, z = cpart->tmp - 5;//speckles!
if (cpart->temp>(ptransitions[t].thv-800.0f))//hotglow for quartz
{
float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
int q = (parts[i].temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):parts[i].temp-(ptransitions[t].thv-800.0f);
int q = (cpart->temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):cpart->temp-(ptransitions[t].thv-800.0f);
*colr += sin(frequency*q) * 226 + (z * 16);
*colg += sin(frequency*q*4.55 +3.14) * 34 + (z * 16);
*colb += sin(frequency*q*2.22 +3.14) * 64 + (z * 16);
@ -20,7 +20,7 @@ int graphics_QRTZ(GRAPHICS_FUNC_ARGS) //QRTZ and PQRT
}
int graphics_CLST(GRAPHICS_FUNC_ARGS)
{
int z = parts[i].tmp - 5;//speckles!
int z = cpart->tmp - 5;//speckles!
*colr += z * 16;
*colg += z * 16;
*colb += z * 16;
@ -28,7 +28,7 @@ int graphics_CLST(GRAPHICS_FUNC_ARGS)
}
int graphics_CBNW(GRAPHICS_FUNC_ARGS)
{
int z = parts[i].tmp2 - 20;//speckles!
int z = cpart->tmp2 - 20;//speckles!
*colr += z * 1;
*colg += z * 2;
*colb += z * 8;
@ -36,9 +36,9 @@ int graphics_CBNW(GRAPHICS_FUNC_ARGS)
}
int graphics_SPNG(GRAPHICS_FUNC_ARGS)
{
*colr -= parts[i].life*15;
*colg -= parts[i].life*15;
*colb -= parts[i].life*15;
*colr -= cpart->life*15;
*colg -= cpart->life*15;
*colb -= cpart->life*15;
if (*colr<=50)
*colr = 50;
if (*colg<=50)
@ -50,50 +50,50 @@ int graphics_SPNG(GRAPHICS_FUNC_ARGS)
int graphics_LIFE(GRAPHICS_FUNC_ARGS)
{
pixel pc;
if (parts[i].ctype==NGT_LOTE)//colors for life states
if (cpart->ctype==NGT_LOTE)//colors for life states
{
if (parts[i].tmp==2)
if (cpart->tmp==2)
pc = PIXRGB(255, 128, 0);
else if (parts[i].tmp==1)
else if (cpart->tmp==1)
pc = PIXRGB(255, 255, 0);
else
pc = PIXRGB(255, 0, 0);
}
else if (parts[i].ctype==NGT_FRG2)//colors for life states
else if (cpart->ctype==NGT_FRG2)//colors for life states
{
if (parts[i].tmp==2)
if (cpart->tmp==2)
pc = PIXRGB(0, 100, 50);
else
pc = PIXRGB(0, 255, 90);
}
else if (parts[i].ctype==NGT_STAR)//colors for life states
else if (cpart->ctype==NGT_STAR)//colors for life states
{
if (parts[i].tmp==4)
if (cpart->tmp==4)
pc = PIXRGB(0, 0, 128);
else if (parts[i].tmp==3)
else if (cpart->tmp==3)
pc = PIXRGB(0, 0, 150);
else if (parts[i].tmp==2)
else if (cpart->tmp==2)
pc = PIXRGB(0, 0, 190);
else if (parts[i].tmp==1)
else if (cpart->tmp==1)
pc = PIXRGB(0, 0, 230);
else
pc = PIXRGB(0, 0, 70);
}
else if (parts[i].ctype==NGT_FROG)//colors for life states
else if (cpart->ctype==NGT_FROG)//colors for life states
{
if (parts[i].tmp==2)
if (cpart->tmp==2)
pc = PIXRGB(0, 100, 0);
else
pc = PIXRGB(0, 255, 0);
}
else if (parts[i].ctype==NGT_BRAN)//colors for life states
else if (cpart->ctype==NGT_BRAN)//colors for life states
{
if (parts[i].tmp==1)
if (cpart->tmp==1)
pc = PIXRGB(150, 150, 0);
else
pc = PIXRGB(255, 255, 0);
} else {
pc = gmenu[parts[i].ctype].colour;
pc = gmenu[cpart->ctype].colour;
}
*colr = PIXR(pc);
*colg = PIXG(pc);
@ -102,17 +102,17 @@ int graphics_LIFE(GRAPHICS_FUNC_ARGS)
}
int graphics_DUST(GRAPHICS_FUNC_ARGS)
{
if(parts[i].life >= 1)
if(cpart->life >= 1)
{
*colr = parts[i].flags;
*colg = parts[i].tmp;
*colb = parts[i].ctype;
if (decorations_enable && parts[i].dcolour)
*colr = cpart->flags;
*colg = cpart->tmp;
*colb = cpart->ctype;
if (decorations_enable && cpart->dcolour)
{
int a = (parts[i].dcolour>>24)&0xFF;
*colr = (a*((parts[i].dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
*colg = (a*((parts[i].dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
*colb = (a*((parts[i].dcolour)&0xFF) + (255-a)**colb) >> 8;
int a = (cpart->dcolour>>24)&0xFF;
*colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
*colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
*colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
}
*firea = 255;
*firer = *colr;
@ -126,38 +126,38 @@ int graphics_GRAV(GRAPHICS_FUNC_ARGS)
*colr = 20;
*colg = 20;
*colb = 20;
if (parts[i].vx>0)
if (cpart->vx>0)
{
*colr += (parts[i].vx)*GRAV_R;
*colg += (parts[i].vx)*GRAV_G;
*colb += (parts[i].vx)*GRAV_B;
*colr += (cpart->vx)*GRAV_R;
*colg += (cpart->vx)*GRAV_G;
*colb += (cpart->vx)*GRAV_B;
}
if (parts[i].vy>0)
if (cpart->vy>0)
{
*colr += (parts[i].vy)*GRAV_G;
*colg += (parts[i].vy)*GRAV_B;
*colb += (parts[i].vy)*GRAV_R;
*colr += (cpart->vy)*GRAV_G;
*colg += (cpart->vy)*GRAV_B;
*colb += (cpart->vy)*GRAV_R;
}
if (parts[i].vx<0)
if (cpart->vx<0)
{
*colr -= (parts[i].vx)*GRAV_B;
*colg -= (parts[i].vx)*GRAV_R;
*colb -= (parts[i].vx)*GRAV_G;
*colr -= (cpart->vx)*GRAV_B;
*colg -= (cpart->vx)*GRAV_R;
*colb -= (cpart->vx)*GRAV_G;
}
if (parts[i].vy<0)
if (cpart->vy<0)
{
*colr -= (parts[i].vy)*GRAV_R2;
*colg -= (parts[i].vy)*GRAV_G2;
*colb -= (parts[i].vy)*GRAV_B2;
*colr -= (cpart->vy)*GRAV_R2;
*colg -= (cpart->vy)*GRAV_G2;
*colb -= (cpart->vy)*GRAV_B2;
}
return 0;
}
int graphics_WIFI(GRAPHICS_FUNC_ARGS)
{
float frequency = 0.0628;
int q = parts[i].tmp;
int q = cpart->tmp;
*colr = sin(frequency*q + 0) * 127 + 128;
*colg = sin(frequency*q + 2) * 127 + 128;
*colb = sin(frequency*q + 4) * 127 + 128;
@ -192,75 +192,25 @@ int graphics_BIZR(GRAPHICS_FUNC_ARGS) //BIZR, BIZRG, BIZRS
*colb = 0;
*colr = 0;
for (x=0; x<12; x++) {
*colr += (parts[i].ctype >> (x+18)) & 1;
*colb += (parts[i].ctype >> x) & 1;
*colr += (cpart->ctype >> (x+18)) & 1;
*colb += (cpart->ctype >> x) & 1;
}
for (x=0; x<12; x++)
*colg += (parts[i].ctype >> (x+9)) & 1;
*colg += (cpart->ctype >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1);
*colr *= x;
*colg *= x;
*colb *= x;
if(fabs(parts[i].vx)+fabs(parts[i].vy)>0)
if(fabs(cpart->vx)+fabs(cpart->vy)>0)
{
*firea = 255;
*fireg = *colg/5 * fabs(parts[i].vx)+fabs(parts[i].vy);
*fireb = *colb/5 * fabs(parts[i].vx)+fabs(parts[i].vy);
*firer = *colr/5 * fabs(parts[i].vx)+fabs(parts[i].vy);
*fireg = *colg/5 * fabs(cpart->vx)+fabs(cpart->vy);
*fireb = *colb/5 * fabs(cpart->vx)+fabs(cpart->vy);
*firer = *colr/5 * fabs(cpart->vx)+fabs(cpart->vy);
*pixel_mode |= FIRE_ADD;
}
return 0;
}
int graphics_PIPE(GRAPHICS_FUNC_ARGS)
{
if (parts[i].ctype==2)
{
*colr = 50;
*colg = 1;
*colb = 1;
}
else if (parts[i].ctype==3)
{
*colr = 1;
*colg = 50;
*colb = 1;
}
else if (parts[i].ctype==4)
{
*colr = 1;
*colg = 1;
*colb = 50;
}
else if (parts[i].temp<272.15&&parts[i].ctype!=1)
{
if (parts[i].temp>173.25&&parts[i].temp<273.15)
{
*colr = 50;
*colg = 1;
*colb = 1;
}
if (parts[i].temp>73.25&&parts[i].temp<=173.15)
{
*colr = 1;
*colg = 50;
*colb = 1;
}
if (parts[i].temp>=0&&parts[i].temp<=73.15)
{
*colr = 1;
*colg = 1;
*colb = 50;
}
}
if ((parts[i].tmp&0xFF)>0 && (parts[i].tmp&0xFF)<PT_NUM)
{
//Maybe use a subcall to get the info of the embedded particle?
*colr = PIXR(ptypes[parts[i].tmp&0xFF].pcolors);
*colg = PIXG(ptypes[parts[i].tmp&0xFF].pcolors);
*colb = PIXB(ptypes[parts[i].tmp&0xFF].pcolors);
}
return 0;
}
int graphics_INVS(GRAPHICS_FUNC_ARGS)
{
if(pv[ny/CELL][nx/CELL]>4.0f || pv[ny/CELL][nx/CELL]<-4.0f)
@ -273,7 +223,7 @@ int graphics_INVS(GRAPHICS_FUNC_ARGS)
}
int graphics_ACID(GRAPHICS_FUNC_ARGS)
{
int s = parts[i].life;
int s = cpart->life;
if (s>75) s = 75; //These two should not be here.
if (s<49) s = 49;
s = (s-49)*3;
@ -286,19 +236,19 @@ int graphics_ACID(GRAPHICS_FUNC_ARGS)
}
int graphics_FILT(GRAPHICS_FUNC_ARGS)
{
int x, temp_bin = (int)((parts[i].temp-273.0f)*0.025f);
int x, temp_bin = (int)((cpart->temp-273.0f)*0.025f);
if (temp_bin < 0) temp_bin = 0;
if (temp_bin > 25) temp_bin = 25;
parts[i].ctype = 0x1F << temp_bin;
cpart->ctype = 0x1F << temp_bin;
*colg = 0;
*colb = 0;
*colr = 0;
for (x=0; x<12; x++) {
*colr += (parts[i].ctype >> (x+18)) & 1;
*colb += (parts[i].ctype >> x) & 1;
*colr += (cpart->ctype >> (x+18)) & 1;
*colb += (cpart->ctype >> x) & 1;
}
for (x=0; x<12; x++)
*colg += (parts[i].ctype >> (x+9)) & 1;
*colg += (cpart->ctype >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1);
*colr *= x;
*colg *= x;
@ -308,49 +258,49 @@ int graphics_FILT(GRAPHICS_FUNC_ARGS)
int graphics_BRAY(GRAPHICS_FUNC_ARGS)
{
int x, trans = 255;
if(parts[i].tmp==0)
if(cpart->tmp==0)
{
trans = parts[i].life * 7;
trans = cpart->life * 7;
if (trans>255) trans = 255;
if (parts[i].ctype) {
if (cpart->ctype) {
*colg = 0;
*colb = 0;
*colr = 0;
for (x=0; x<12; x++) {
*colr += (parts[i].ctype >> (x+18)) & 1;
*colb += (parts[i].ctype >> x) & 1;
*colr += (cpart->ctype >> (x+18)) & 1;
*colb += (cpart->ctype >> x) & 1;
}
for (x=0; x<12; x++)
*colg += (parts[i].ctype >> (x+9)) & 1;
*colg += (cpart->ctype >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1);
*colr *= x;
*colg *= x;
*colb *= x;
}
}
else if(parts[i].tmp==1)
else if(cpart->tmp==1)
{
trans = parts[i].life/4;
trans = cpart->life/4;
if (trans>255) trans = 255;
if (parts[i].ctype) {
if (cpart->ctype) {
*colg = 0;
*colb = 0;
*colr = 0;
for (x=0; x<12; x++) {
*colr += (parts[i].ctype >> (x+18)) & 1;
*colb += (parts[i].ctype >> x) & 1;
*colr += (cpart->ctype >> (x+18)) & 1;
*colb += (cpart->ctype >> x) & 1;
}
for (x=0; x<12; x++)
*colg += (parts[i].ctype >> (x+9)) & 1;
*colg += (cpart->ctype >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1);
*colr *= x;
*colg *= x;
*colb *= x;
}
}
else if(parts[i].tmp==2)
else if(cpart->tmp==2)
{
trans = parts[i].life*100;
trans = cpart->life*100;
if (trans>255) trans = 255;
*colr = 255;
*colr = 150;
@ -363,7 +313,7 @@ int graphics_BRAY(GRAPHICS_FUNC_ARGS)
}
int graphics_SWCH(GRAPHICS_FUNC_ARGS)
{
if(parts[i].life >= 10)
if(cpart->life >= 10)
{
*colr = 17;
*colg = 217;
@ -383,25 +333,25 @@ int graphics_THDR(GRAPHICS_FUNC_ARGS)
}
int graphics_GLOW(GRAPHICS_FUNC_ARGS)
{
*firer = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
*fireg = restrict_flt(parts[i].ctype, 0, 128)/50.0f;
*fireb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
*firer = restrict_flt(cpart->temp-(275.13f+32.0f), 0, 128)/50.0f;
*fireg = restrict_flt(cpart->ctype, 0, 128)/50.0f;
*fireb = restrict_flt(cpart->tmp, 0, 128)/50.0f;
*colr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
*colg = restrict_flt(64.0f+parts[i].ctype, 0, 255);
*colb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
*colr = restrict_flt(64.0f+cpart->temp-(275.13f+32.0f), 0, 255);
*colg = restrict_flt(64.0f+cpart->ctype, 0, 255);
*colb = restrict_flt(64.0f+cpart->tmp, 0, 255);
*pixel_mode |= FIRE_ADD;
return 0;
}
int graphics_LCRY(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*10);
if(parts[i].dcolour && parts[i].dcolour&0xFF000000)
int lifemod = ((cpart->life>10?10:cpart->life)*10);
if(cpart->dcolour && cpart->dcolour&0xFF000000)
{
*colr += (lifemod * (255-(parts[i].dcolour>>16)&0xFF))>>8;
*colg += (lifemod * (255-(parts[i].dcolour>>8)&0xFF))>>8;
*colb += (lifemod * (255-(parts[i].dcolour)&0xFF))>>8;
*colr += (lifemod * (255-(cpart->dcolour>>16)&0xFF))>>8;
*colg += (lifemod * (255-(cpart->dcolour>>8)&0xFF))>>8;
*colb += (lifemod * (255-(cpart->dcolour)&0xFF))>>8;
}
else
{
@ -414,21 +364,21 @@ int graphics_LCRY(GRAPHICS_FUNC_ARGS)
}
int graphics_PCLN(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*10);
int lifemod = ((cpart->life>10?10:cpart->life)*10);
*colr += lifemod;
*colg += lifemod;
return 0;
}
int graphics_PBCN(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*10);
int lifemod = ((cpart->life>10?10:cpart->life)*10);
*colr += lifemod;
*colg += lifemod/2;
return 0;
}
int graphics_DLAY(GRAPHICS_FUNC_ARGS)
{
int stage = (int)(((float)parts[i].life/(parts[i].temp-273.15))*100.0f);
int stage = (int)(((float)cpart->life/(cpart->temp-273.15))*100.0f);
*colr += stage;
*colg += stage;
*colb += stage;
@ -436,19 +386,19 @@ int graphics_DLAY(GRAPHICS_FUNC_ARGS)
}
int graphics_HSWC(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*19);
int lifemod = ((cpart->life>10?10:cpart->life)*19);
*colr += lifemod;
return 0;
}
int graphics_PVOD(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*16);
int lifemod = ((cpart->life>10?10:cpart->life)*16);
*colr += lifemod;
return 0;
}
int graphics_STOR(GRAPHICS_FUNC_ARGS)
{
if(parts[i].tmp){
if(cpart->tmp){
*colr = 0x50;
*colg = 0xDF;
*colb = 0xDF;
@ -461,20 +411,20 @@ int graphics_STOR(GRAPHICS_FUNC_ARGS)
}
int graphics_PUMP(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*19);
int lifemod = ((cpart->life>10?10:cpart->life)*19);
*colb += lifemod;
return 0;
}
int graphics_GPMP(GRAPHICS_FUNC_ARGS)
{
int lifemod = ((parts[i].life>10?10:parts[i].life)*19);
int lifemod = ((cpart->life>10?10:cpart->life)*19);
*colg += lifemod;
*colb += lifemod;
return 0;
}
int graphics_HFLM(GRAPHICS_FUNC_ARGS)
{
int caddress = restrict_flt(restrict_flt((float)((int)(parts[i].life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
*colr = (unsigned char)hflm_data[caddress];
*colg = (unsigned char)hflm_data[caddress+1];
*colb = (unsigned char)hflm_data[caddress+2];
@ -491,17 +441,17 @@ int graphics_HFLM(GRAPHICS_FUNC_ARGS)
}
int graphics_FIRW(GRAPHICS_FUNC_ARGS)
{
int caddress = restrict_flt(restrict_flt((float)((int)(parts[i].life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
*colr = (unsigned char)firw_data[caddress];
*colg = (unsigned char)firw_data[caddress+1];
*colb = (unsigned char)firw_data[caddress+2];
if (decorations_enable && parts[i].dcolour)
if (decorations_enable && cpart->dcolour)
{
int a = (parts[i].dcolour>>24)&0xFF;
*colr = (a*((parts[i].dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
*colg = (a*((parts[i].dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
*colb = (a*((parts[i].dcolour)&0xFF) + (255-a)**colb) >> 8;
int a = (cpart->dcolour>>24)&0xFF;
*colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
*colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
*colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
}
*firea = 255;
@ -516,7 +466,7 @@ int graphics_FIRW(GRAPHICS_FUNC_ARGS)
}
int graphics_BOMB(GRAPHICS_FUNC_ARGS)
{
if (parts[i].tmp==0) {
if (cpart->tmp==0) {
*pixel_mode |= PMODE_FLARE;
}
else
@ -527,7 +477,7 @@ int graphics_BOMB(GRAPHICS_FUNC_ARGS)
}
int graphics_GBMB(GRAPHICS_FUNC_ARGS)
{
if (parts[i].life <= 0) {
if (cpart->life <= 0) {
*pixel_mode |= PMODE_FLARE;
}
else
@ -538,7 +488,7 @@ int graphics_GBMB(GRAPHICS_FUNC_ARGS)
}
int graphics_COAL(GRAPHICS_FUNC_ARGS) //Both COAL and Broken Coal
{
*colr += (parts[i].tmp2-295.15f)/3;
*colr += (cpart->tmp2-295.15f)/3;
if (*colr > 170)
*colr = 170;
@ -547,10 +497,10 @@ int graphics_COAL(GRAPHICS_FUNC_ARGS) //Both COAL and Broken Coal
*colg = *colb = *colr;
if((parts[i].temp-295.15f) > 300.0f-200.0f)
if((cpart->temp-295.15f) > 300.0f-200.0f)
{
float frequency = 3.1415/(2*300.0f-(300.0f-200.0f));
int q = ((parts[i].temp-295.15f)>300.0f)?300.0f-(300.0f-200.0f):(parts[i].temp-295.15f)-(300.0f-200.0f);
int q = ((cpart->temp-295.15f)>300.0f)?300.0f-(300.0f-200.0f):(cpart->temp-295.15f)-(300.0f-200.0f);
*colr += sin(frequency*q) * 226;
*colg += sin(frequency*q*4.55 +3.14) * 34;

View File

@ -64,11 +64,11 @@ int graphics_PHOT(GRAPHICS_FUNC_ARGS)
int x = 0;
*colr = *colg = *colb = 0;
for (x=0; x<12; x++) {
*colr += (parts[i].ctype >> (x+18)) & 1;
*colb += (parts[i].ctype >> x) & 1;
*colr += (cpart->ctype >> (x+18)) & 1;
*colb += (cpart->ctype >> x) & 1;
}
for (x=0; x<12; x++)
*colg += (parts[i].ctype >> (x+9)) & 1;
*colg += (cpart->ctype >> (x+9)) & 1;
x = 624/(*colr+*colg+*colb+1);
*colr *= x;
*colg *= x;

View File

@ -235,3 +235,85 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
return 0;
}
int graphics_PIPE(GRAPHICS_FUNC_ARGS)
{
if (cpart->ctype==2)
{
*colr = 50;
*colg = 1;
*colb = 1;
}
else if (cpart->ctype==3)
{
*colr = 1;
*colg = 50;
*colb = 1;
}
else if (cpart->ctype==4)
{
*colr = 1;
*colg = 1;
*colb = 50;
}
else if (cpart->temp<272.15&&cpart->ctype!=1)
{
if (cpart->temp>173.25&&cpart->temp<273.15)
{
*colr = 50;
*colg = 1;
*colb = 1;
}
if (cpart->temp>73.25&&cpart->temp<=173.15)
{
*colr = 1;
*colg = 50;
*colb = 1;
}
if (cpart->temp>=0&&cpart->temp<=73.15)
{
*colr = 1;
*colg = 1;
*colb = 50;
}
}
if ((cpart->tmp&0xFF)>0 && (cpart->tmp&0xFF)<PT_NUM)
{
//Create a temp. particle and do a subcall.
particle tpart;
int t;
memset(&tpart, 0, sizeof(particle));
tpart.type = cpart->tmp&0xFF;
tpart.temp = cpart->temp;
tpart.life = cpart->flags;
tpart.tmp = cpart->pavg[0];
tpart.ctype = cpart->pavg[1];
t = tpart.type;
if (graphicscache[t].isready)
{
*pixel_mode = graphicscache[t].pixel_mode;
*colr = graphicscache[t].colr;
*colg = graphicscache[t].colg;
*colb = graphicscache[t].colb;
*firea = graphicscache[t].firea;
*firer = graphicscache[t].firer;
*fireg = graphicscache[t].fireg;
*fireb = graphicscache[t].fireb;
}
else
{
if (ptypes[t].graphics_func)
{
(*(ptypes[t].graphics_func))(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb);
}
else
{
graphics_DEFAULT(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb);
}
}
//*colr = PIXR(ptypes[cpart->tmp&0xFF].pcolors);
//*colg = PIXG(ptypes[cpart->tmp&0xFF].pcolors);
//*colb = PIXB(ptypes[cpart->tmp&0xFF].pcolors);
}
return 0;
}

View File

@ -2,7 +2,7 @@
int graphics_PLSM(GRAPHICS_FUNC_ARGS)
{
int caddress = restrict_flt(restrict_flt((float)parts[i].life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
int caddress = restrict_flt(restrict_flt((float)cpart->life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
*colr = (unsigned char)plasma_data[caddress];
*colg = (unsigned char)plasma_data[caddress+1];
*colb = (unsigned char)plasma_data[caddress+2];

View File

@ -13,6 +13,22 @@ int update_STKM(UPDATE_FUNC_ARGS)
return 0;
}
int graphics_STKM(GRAPHICS_FUNC_ARGS)
{
*pixel_mode = PSPEC_STICKMAN;
if ((int)player[2]<PT_NUM)
{
*colr = PIXR(ptypes[(int)player[2]].pcolors);
*colg = PIXG(ptypes[(int)player[2]].pcolors);
*colb = PIXB(ptypes[(int)player[2]].pcolors);
}
else
{
*colr = *colg = *colb = 255;
}
return 1;
}
int run_stickman(float* playerp, UPDATE_FUNC_ARGS) {
int r, rx, ry;
float pp, d;

View File

@ -12,3 +12,18 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
return 0;
}
int graphics_STKM2(GRAPHICS_FUNC_ARGS)
{
*pixel_mode = PSPEC_STICKMAN;
if ((int)player2[2]<PT_NUM)
{
*colr = PIXR(ptypes[(int)player2[2]].pcolors);
*colg = PIXG(ptypes[(int)player2[2]].pcolors);
*colb = PIXB(ptypes[(int)player2[2]].pcolors);
}
else
{
*colr = *colg = *colb = 255;
}
return 1;
}

View File

@ -1444,6 +1444,11 @@ void xor_rect(pixel *vid, int x, int y, int w, int h)
}
}
void prepare_graphicscache()
{
graphicscache = malloc(sizeof(gcache_item)*PT_NUM);
memset(graphicscache, 0, sizeof(gcache_item)*PT_NUM);
}
//New function for drawing particles
#ifdef OGLR
GLuint fireV[(YRES*XRES)*2];
@ -1463,6 +1468,7 @@ void render_parts(pixel *vid)
{
//TODO: Replace cmode with a set of flags
int deca, decr, decg, decb, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, i, t, nx, ny, x, y, caddress;
float gradv, flicker, fnx, fny;
#ifdef OGLR
int cfireV = 0, cfireC = 0, cfire = 0;
int csmokeV = 0, csmokeC = 0, csmoke = 0;
@ -1470,14 +1476,22 @@ void render_parts(pixel *vid)
int cblurV = 0, cblurC = 0, cblur = 0;
int cglowV = 0, cglowC = 0, cglow = 0;
int cflatV = 0, cflatC = 0, cflat = 0;
//Set coord offset
glScalef(1,-1,1);
glTranslatef(0, -YRES/*-(YRES+MENUSIZE)*/, 0);
//Render to the particle FBO
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, partsFbo);
#endif
float gradv, flicker;
for(i = 0; i<=parts_lastActiveIndex; i++) {
if (parts[i].type) {
t = parts[i].type;
nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f);
fnx = parts[i].x;
fny = parts[i].y;
if(photons[ny][nx]&0xFF && !(ptypes[t].properties & TYPE_ENERGY))
continue;
@ -1494,40 +1508,58 @@ void render_parts(pixel *vid)
decg = (parts[i].dcolour>>8)&0xFF;
decb = (parts[i].dcolour)&0xFF;
if (ptypes[t].graphics_func)
if (graphicscache[t].isready)
{
if ((*(ptypes[t].graphics_func))(i, nx, ny, &pixel_mode, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb)) //That's a lot of args, a struct might be better
{
//Data can be cached!
}
pixel_mode = graphicscache[t].pixel_mode;
colr = graphicscache[t].colr;
colg = graphicscache[t].colg;
colb = graphicscache[t].colb;
firea = graphicscache[t].firea;
firer = graphicscache[t].firer;
fireg = graphicscache[t].fireg;
fireb = graphicscache[t].fireb;
}
else
{
//Property based defaults
if(ptypes[t].properties & PROP_RADIOACTIVE) pixel_mode |= PMODE_GLOW;
if(ptypes[t].properties & PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f))
if (ptypes[t].graphics_func)
{
gradv = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
caddress = (parts[i].temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):parts[i].temp-(ptransitions[t].thv-800.0f);
colr += sin(gradv*caddress) * 226;;
colg += sin(gradv*caddress*4.55 +3.14) * 34;
colb += sin(gradv*caddress*2.22 +3.14) * 64;
if ((*(ptypes[t].graphics_func))(&(parts[i]), nx, ny, &pixel_mode, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb)) //That's a lot of args, a struct might be better
{
graphicscache[t].isready = 1;
graphicscache[t].pixel_mode = pixel_mode;
graphicscache[t].colr = colr;
graphicscache[t].colg = colg;
graphicscache[t].colb = colb;
graphicscache[t].firea = firea;
graphicscache[t].firer = firer;
graphicscache[t].fireg = fireg;
graphicscache[t].fireb = fireb;
}
}
if(ptypes[t].properties & TYPE_LIQUID)
else
{
pixel_mode |= PMODE_BLUR;
}
if(ptypes[t].properties & TYPE_GAS)
{
pixel_mode &= ~PMODE;
pixel_mode |= FIRE_BLEND;
firer = colr/2;
fireg = colg/2;
fireb = colb/2;
firea = 125;
if(graphics_DEFAULT(&(parts[i]), nx, ny, &pixel_mode, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb))
{
graphicscache[t].isready = 1;
graphicscache[t].pixel_mode = pixel_mode;
graphicscache[t].colr = colr;
graphicscache[t].colg = colg;
graphicscache[t].colb = colb;
graphicscache[t].firea = firea;
graphicscache[t].firer = firer;
graphicscache[t].fireg = fireg;
graphicscache[t].fireb = fireb;
}
}
}
if(ptypes[t].properties & PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f))
{
gradv = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
caddress = (parts[i].temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):parts[i].temp-(ptransitions[t].thv-800.0f);
colr += sin(gradv*caddress) * 226;;
colg += sin(gradv*caddress*4.55 +3.14) * 34;
colb += sin(gradv*caddress*2.22 +3.14) * 64;
}
if(cmode == CM_NOTHING)
{
#ifdef OGLR
@ -1588,6 +1620,95 @@ void render_parts(pixel *vid)
else if(colb<0) colb = 0;
//Pixel rendering
if(pixel_mode & PSPEC_STICKMAN)
{
//Special case for stickman
#ifdef OGLR
float *cplayer;
if(t==PT_STKM)
cplayer = player;
else
cplayer = player2;
glColor4f(((float)colr)/255.0f, ((float)colg)/255.0f, ((float)colb)/255.0f, 1.0f);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP);
glVertex2f(fnx-2, fny-2);
glVertex2f(fnx+2, fny-2);
glVertex2f(fnx+2, fny+2);
glVertex2f(fnx-2, fny+2);
glVertex2f(fnx-2, fny-2);
glEnd();
if(t==PT_STKM)
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
else
glColor4f(0.6f, 0.6f, 1.0f, 1.0f);
glBegin(GL_LINES);
glVertex2f(nx, ny+3);
glVertex2f(cplayer[3], cplayer[4]);
glVertex2f(cplayer[3], cplayer[4]);
glVertex2f(cplayer[7], cplayer[8]);
glVertex2f(nx, ny+3);
glVertex2f(cplayer[11], cplayer[12]);
glVertex2f(cplayer[11], cplayer[12]);
glVertex2f(cplayer[15], cplayer[16]);
glEnd();
glDisable(GL_LINE_SMOOTH);
#else
if (t==PT_STKM)
{
char buff[20]; //Buffer for HP
pixel pc;
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head
{
sprintf(buff, "%3d", parts[i].life); //Show HP
drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255);
}
if ((int)player[2]<PT_NUM) pc = ptypes[(int)player[2]].pcolors;
else pc = PIXPACK(0xFFFFFF);
s = XRES+BARSIZE;
//head
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);
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
draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s);
draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s);
draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s);
draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s);
}
else if (t==PT_STKM2)
{
char buff[20]; //Buffer for HP
pixel pc;
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head
{
sprintf(buff, "%3d", parts[i].life); //Show HP
drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255);
}
if ((int)player2[2]<PT_NUM) pc = ptypes[(int)player2[2]].pcolors;
else pc = PIXPACK(0xFFFFFF);
s = XRES+BARSIZE;
//head
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);
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
draw_line(vid , nx, ny+3, player2[3], player2[4], 100, 100, 255, s);
draw_line(vid , player2[3], player2[4], player2[7], player2[8], 100, 100, 255, s);
draw_line(vid , nx, ny+3, player2[11], player2[12], 100, 100, 255, s);
draw_line(vid , player2[11], player2[12], player2[15], player2[16], 100, 100, 255, s);
}
#endif
}
if(pixel_mode & PMODE_FLAT)
{
#ifdef OGLR
@ -1822,12 +1943,6 @@ void render_parts(pixel *vid)
}
}
#ifdef OGLR
//Set coord offset
glScalef(1,-1,1);
glTranslatef(0, -YRES/*-(YRES+MENUSIZE)*/, 0);
//Render to the particle FBO
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, partsFbo);
//Go into array mode
glEnableClientState(GL_COLOR_ARRAY);
@ -2732,8 +2847,8 @@ void render_zoom(pixel *img) //draws the zoom box
if(zoom_en)
{
//glEnable(GL_COLOR_LOGIC_OP);
glEnable(GL_LINE_SMOOTH);
//glLogicOp(GL_XOR);
//glEnable(GL_LINE_SMOOTH);
glLogicOp(GL_XOR);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_LINE_STRIP);
glVertex3i(zoom_x-1, YRES+MENUSIZE-(zoom_y-1), 0);

View File

@ -1740,6 +1740,7 @@ int main(int argc, char *argv[])
http_init(http_proxy_string[0] ? http_proxy_string : NULL);
prepare_alpha(CELL, 1.0f);
prepare_graphicscache();
if (cpu_check())
{