summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-17 21:34:17 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-17 21:34:17 (GMT)
commit4b073de82a77db344b728434ee9ed18f69a06b4e (patch)
tree17a4f27f3c8f12a10f12d79442bb76e18e7f40ed /src/graphics.c
parent36de2f19f57ff056166ae268404f1f3851ea3077 (diff)
downloadpowder-4b073de82a77db344b728434ee9ed18f69a06b4e.zip
powder-4b073de82a77db344b728434ee9ed18f69a06b4e.tar.gz
Revert "Moved soap and stick men graphics things to special functions."
This reverts commit 7f5408f196002476c4765f1cae833e1441e4b276. Conflicts: includes/powder.h
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c132
1 files changed, 130 insertions, 2 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 20a6a39..765306b 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -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))
{