Revert "Moved soap and stick men graphics things to special functions."

This reverts commit 7f5408f196.

Conflicts:

	includes/powder.h
This commit is contained in:
Simon Robertshaw 2012-06-17 22:34:17 +01:00
parent 36de2f19f5
commit 4b073de82a
9 changed files with 150 additions and 166 deletions

View File

@ -275,8 +275,8 @@
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
#define FLAG_MOVABLE 0x4 // if can move
#define GRAPHICS_FUNC_ARGS particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb, pixel *vid
#define GRAPHICS_FUNC_SUBCALL_ARGS cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb, vid
#define GRAPHICS_FUNC_ARGS particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
#define GRAPHICS_FUNC_SUBCALL_ARGS cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
struct particle

View File

@ -28,6 +28,7 @@
#define PMODE_LFLARE 0x00000040
#define PMODE_ADD 0x00000080
#define PMODE_BLEND 0x00000100
#define PSPEC_STICKMAN 0x00000200
#define OPTIONS 0x0000F000
#define NO_DECO 0x00001000
@ -42,13 +43,13 @@
#define EFFECT_GRAVOUT 0x02000000
#define EFFECT_LINES 0x04000000
#define RENDER_EFFE OPTIONS | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE
#define RENDER_FIRE OPTIONS | PMODE_FLAT | PMODE_ADD | PMODE_BLEND | FIREMODE
#define RENDER_GLOW OPTIONS | PMODE_FLAT | PMODE_GLOW | PMODE_ADD | PMODE_BLEND
#define RENDER_BLUR OPTIONS | PMODE_FLAT | PMODE_BLUR | PMODE_ADD | PMODE_BLEND
#define RENDER_BLOB OPTIONS | PMODE_FLAT | PMODE_BLOB | PMODE_ADD | PMODE_BLEND
#define RENDER_BASC OPTIONS | PMODE_FLAT | PMODE_ADD | PMODE_BLEND
#define RENDER_NONE OPTIONS | PMODE_FLAT
#define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE
#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND | FIREMODE
#define RENDER_GLOW OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_GLOW | PMODE_ADD | PMODE_BLEND
#define RENDER_BLUR OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_BLUR | PMODE_ADD | PMODE_BLEND
#define RENDER_BLOB OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_BLOB | PMODE_ADD | PMODE_BLEND
#define RENDER_BASC OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND
#define RENDER_NONE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT
#define COLOUR_HEAT 0x00000001
#define COLOUR_LIFE 0x00000002

View File

@ -180,7 +180,7 @@ part_type ptypes[PT_NUM] =
/*FREE*/{"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, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL, NULL},
/*FREE*/{"WIND", PIXPACK(0x101010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_SPECIAL, 0.0f, 40, "", ST_NONE, ST_NONE, NULL, NULL},
{"HYGN", PIXPACK(0x5070FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.10f, 0.00f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 251, "Combines with O2 to make WATR", ST_GAS, TYPE_GAS, &update_H2, NULL},
{"SOAP", PIXPACK(0xF5F5DC), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Soap. Creates bubbles.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_SOAP, &graphics_SOAP},
{"SOAP", PIXPACK(0xF5F5DC), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Soap. Creates bubbles.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_SOAP, NULL},
{"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Black hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NBHL, NULL},
{"WHOL", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "White hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NWHL, NULL},
{"MERC", PIXPACK(0x736B6D), 0.4f, 0.04f * CFDS, 0.94f, 0.80f, 0.0f, 0.3f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 91, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Mercury. Volume changes with temperature, Conductive.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTABSORB|PROP_LIFE_DEC, &update_MERC, NULL},

View File

@ -107,6 +107,7 @@ int update_FIGH(UPDATE_FUNC_ARGS)
int graphics_FIGH(GRAPHICS_FUNC_ARGS)
{
playerst * cplayer = &fighters[(unsigned char)cpart->tmp];
*pixel_mode = PSPEC_STICKMAN;
if (cplayer->elem<PT_NUM)
{
*colr = PIXR(ptypes[cplayer->elem].pcolors);
@ -117,6 +118,5 @@ int graphics_FIGH(GRAPHICS_FUNC_ARGS)
{
*colr = *colg = *colb = 255;
}
graphics_stickmen(GRAPHICS_FUNC_SUBCALL_ARGS);
return 0;
return 1;
}

View File

@ -562,149 +562,4 @@ int graphics_COAL(GRAPHICS_FUNC_ARGS) //Both COAL and Broken Coal
}
return 0;
}
int graphics_SOAP(GRAPHICS_FUNC_ARGS)
{
if (decorations_enable && cpart->dcolour)
{
int a = (cpart->dcolour>>24)&0xFF;
*firer = *colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
*fireg = *colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
*fireb = *colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
}
if ((cpart->ctype&7) == 7)
draw_line(vid, nx, ny, (int)(parts[cpart->tmp].x+0.5f), (int)(parts[cpart->tmp].y+0.5f), *colr, *colg, *colb, XRES+BARSIZE);
return 0;
}
int graphics_stickmen(GRAPHICS_FUNC_ARGS)
{
char buff[20]; //Buffer for HP
int s;
int legr, legg, legb;
playerst *cplayer;
*pixel_mode = 0;
switch(cpart->type)
{
case PT_STKM:
cplayer = &player;
break;
case PT_STKM2:
cplayer = &player2;
break;
case PT_FIGH:
cplayer = &fighters[(unsigned char)cpart->tmp];
break;
default:
return 0;
}
if (mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mouse is in the head
{
sprintf(buff, "%3d", cpart->life); //Show HP
drawtext(vid, mousex-8-2*(cpart->life<100)-2*(cpart->life<10), mousey-12, buff, 255, 255, 255, 255);
}
if (colour_mode!=COLOUR_HEAT)
{
if (cplayer->elem<PT_NUM)
{
colr = PIXR(ptypes[cplayer->elem].pcolors);
colg = PIXG(ptypes[cplayer->elem].pcolors);
colb = PIXB(ptypes[cplayer->elem].pcolors);
}
else
{
colr = 0x80;
colg = 0x80;
colb = 0xFF;
}
}
#ifdef OGLR
glColor4f(((float)colr)/255.0f, ((float)colg)/255.0f, ((float)colb)/255.0f, 1.0f);
glBegin(GL_LINE_STRIP);
if(t==PT_FIGH)
{
glVertex2f(fnx, fny+2);
glVertex2f(fnx+2, fny);
glVertex2f(fnx, fny-2);
glVertex2f(fnx-2, fny);
glVertex2f(fnx, fny+2);
}
else
{
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();
glBegin(GL_LINES);
if (colour_mode!=COLOUR_HEAT)
{
if (t==PT_STKM2)
glColor4f(100.0f/255.0f, 100.0f/255.0f, 1.0f, 1.0f);
else
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
glVertex2f(nx, ny+3);
glVertex2f(cplayer->legs[0], cplayer->legs[1]);
glVertex2f(cplayer->legs[0], cplayer->legs[1]);
glVertex2f(cplayer->legs[4], cplayer->legs[5]);
glVertex2f(nx, ny+3);
glVertex2f(cplayer->legs[8], cplayer->legs[9]);
glVertex2f(cplayer->legs[8], cplayer->legs[9]);
glVertex2f(cplayer->legs[12], cplayer->legs[13]);
glEnd();
#else
s = XRES+BARSIZE;
if (cpart->type==PT_STKM2)
{
legr = 100;
legg = 100;
legb = 255;
}
else
{
legr = 255;
legg = 255;
legb = 255;
}
if (colour_mode==COLOUR_HEAT)
{
legr = colr;
legg = colg;
legb = colb;
}
//head
if(cpart->type==PT_FIGH)
{
draw_line(vid , nx, ny+2, nx+2, ny, colr, colg, colb, s);
draw_line(vid , nx+2, ny, nx, ny-2, colr, colg, colb, s);
draw_line(vid , nx, ny-2, nx-2, ny, colr, colg, colb, s);
draw_line(vid , nx-2, ny, nx, ny+2, colr, colg, colb, s);
}
else
{
draw_line(vid , nx-2, ny+2, nx+2, ny+2, colr, colg, colb, s);
draw_line(vid , nx-2, ny-2, nx+2, ny-2, colr, colg, colb, s);
draw_line(vid , nx-2, ny-2, nx-2, ny+2, colr, colg, colb, s);
draw_line(vid , nx+2, ny-2, nx+2, ny+2, colr, colg, colb, s);
}
//legs
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], legr, legg, legb, 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], legr, legg, legb, s);
#endif
return 0;
}

View File

@ -292,11 +292,11 @@ int graphics_PIPE(GRAPHICS_FUNC_ARGS)
*colb = PIXR(ptypes[t].pcolors);
if (ptypes[t].graphics_func)
{
(*(ptypes[t].graphics_func))(&tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb, vid);
(*(ptypes[t].graphics_func))(&tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
}
else
{
graphics_DEFAULT(&tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb, vid);
graphics_DEFAULT(&tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
}
}
//*colr = PIXR(ptypes[cpart->tmp&0xFF].pcolors);

View File

@ -32,6 +32,7 @@ int update_STKM(UPDATE_FUNC_ARGS)
int graphics_STKM(GRAPHICS_FUNC_ARGS)
{
*pixel_mode = PSPEC_STICKMAN;
if ((int)player.elem<PT_NUM)
{
*colr = PIXR(ptypes[player.elem].pcolors);
@ -42,8 +43,7 @@ int graphics_STKM(GRAPHICS_FUNC_ARGS)
{
*colr = *colg = *colb = 255;
}
graphics_stickmen(GRAPHICS_FUNC_SUBCALL_ARGS);
return 0;
return 1;
}
int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
@ -57,7 +57,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
playerp->elem = parts[i].ctype;
playerp->frames++;
//Temperature handling
//Tempirature handling
if (parts[i].temp<243)
parts[i].life -= 1;
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))

View File

@ -29,6 +29,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
int graphics_STKM2(GRAPHICS_FUNC_ARGS)
{
*pixel_mode = PSPEC_STICKMAN;
if ((int)player2.elem<PT_NUM)
{
*colr = PIXR(ptypes[player2.elem].pcolors);
@ -39,6 +40,5 @@ int graphics_STKM2(GRAPHICS_FUNC_ARGS)
{
*colr = *colg = *colb = 255;
}
graphics_stickmen(GRAPHICS_FUNC_SUBCALL_ARGS);
return 0;
return 1;
}

View File

@ -1891,7 +1891,7 @@ void render_parts(pixel *vid)
if (ptypes[t].graphics_func)
{
#endif
if ((*(ptypes[t].graphics_func))(&(parts[i]), nx, ny, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb, vid)) //That's a lot of args, a struct might be better
if ((*(ptypes[t].graphics_func))(&(parts[i]), nx, ny, &pixel_mode, &cola, &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;
@ -1907,7 +1907,7 @@ void render_parts(pixel *vid)
}
else
{
if(graphics_DEFAULT(&(parts[i]), nx, ny, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb, vid))
if(graphics_DEFAULT(&(parts[i]), nx, ny, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb))
{
graphicscache[t].isready = 1;
graphicscache[t].pixel_mode = pixel_mode;
@ -2024,6 +2024,134 @@ void render_parts(pixel *vid)
#endif
//Pixel rendering
if (t==PT_SOAP)
{
if ((parts[i].ctype&7) == 7)
draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), colr, colg, colb, XRES+BARSIZE);
}
if(pixel_mode & PSPEC_STICKMAN)
{
char buff[20]; //Buffer for HP
int s;
int legr, legg, legb;
playerst *cplayer;
if(t==PT_STKM)
cplayer = &player;
else if(t==PT_STKM2)
cplayer = &player2;
else if(t==PT_FIGH)
cplayer = &fighters[(unsigned char)parts[i].tmp];
else
continue;
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 (colour_mode!=COLOUR_HEAT)
{
if (cplayer->elem<PT_NUM)
{
colr = PIXR(ptypes[cplayer->elem].pcolors);
colg = PIXG(ptypes[cplayer->elem].pcolors);
colb = PIXB(ptypes[cplayer->elem].pcolors);
}
else
{
colr = 0x80;
colg = 0x80;
colb = 0xFF;
}
}
#ifdef OGLR
glColor4f(((float)colr)/255.0f, ((float)colg)/255.0f, ((float)colb)/255.0f, 1.0f);
glBegin(GL_LINE_STRIP);
if(t==PT_FIGH)
{
glVertex2f(fnx, fny+2);
glVertex2f(fnx+2, fny);
glVertex2f(fnx, fny-2);
glVertex2f(fnx-2, fny);
glVertex2f(fnx, fny+2);
}
else
{
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();
glBegin(GL_LINES);
if (colour_mode!=COLOUR_HEAT)
{
if (t==PT_STKM2)
glColor4f(100.0f/255.0f, 100.0f/255.0f, 1.0f, 1.0f);
else
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
glVertex2f(nx, ny+3);
glVertex2f(cplayer->legs[0], cplayer->legs[1]);
glVertex2f(cplayer->legs[0], cplayer->legs[1]);
glVertex2f(cplayer->legs[4], cplayer->legs[5]);
glVertex2f(nx, ny+3);
glVertex2f(cplayer->legs[8], cplayer->legs[9]);
glVertex2f(cplayer->legs[8], cplayer->legs[9]);
glVertex2f(cplayer->legs[12], cplayer->legs[13]);
glEnd();
#else
s = XRES+BARSIZE;
if (t==PT_STKM2)
{
legr = 100;
legg = 100;
legb = 255;
}
else
{
legr = 255;
legg = 255;
legb = 255;
}
if (colour_mode==COLOUR_HEAT)
{
legr = colr;
legg = colg;
legb = colb;
}
//head
if(t==PT_FIGH)
{
draw_line(vid , nx, ny+2, nx+2, ny, colr, colg, colb, s);
draw_line(vid , nx+2, ny, nx, ny-2, colr, colg, colb, s);
draw_line(vid , nx, ny-2, nx-2, ny, colr, colg, colb, s);
draw_line(vid , nx-2, ny, nx, ny+2, colr, colg, colb, s);
}
else
{
draw_line(vid , nx-2, ny+2, nx+2, ny+2, colr, colg, colb, s);
draw_line(vid , nx-2, ny-2, nx+2, ny-2, colr, colg, colb, s);
draw_line(vid , nx-2, ny-2, nx-2, ny+2, colr, colg, colb, s);
draw_line(vid , nx+2, ny-2, nx+2, ny+2, colr, colg, colb, s);
}
//legs
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], legr, legg, legb, 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], legr, legg, legb, s);
#endif
}
#ifdef OGLR
if((display_mode & DISPLAY_EFFE) && (fabs(fnx-flx)>1.5f || fabs(fny-fly)>1.5f))
{