diff --git a/includes/graphics.h b/includes/graphics.h index 0f30405f3..22986a5d3 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -269,16 +269,29 @@ uniform sampler2D tfY;\ uniform float xres;\ uniform float yres;\ void main () {\ - vec4 transformX = texture2D(tfX, vec2(gl_TexCoord[0].s, -gl_TexCoord[0].t));\ - vec4 transformY = -texture2D(tfY, vec2(gl_TexCoord[0].s, -gl_TexCoord[0].t));\ - transformX.r /= xres;\ - transformY.g /= yres;\ - vec4 texColor = vec4(\ - texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.75, transformY.g*0.75)).r,\ - texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.875, transformY.g*0.875)).g,\ - texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r, transformY.g)).b,\ + vec4 transformX = texture2D(tfX, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t));\ + vec4 transformY = texture2D(tfY, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t));\ + transformX.r /= xres/4.0;\ + transformY.g /= yres/4.0;\ + vec4 texColor1 = vec4(\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.90, transformY.g*0.90)).r,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.80, transformY.g*0.80)).g,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.70, transformY.g*0.70)).b,\ 1.0\ );\ + vec4 texColor2 = vec4(\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.95, transformY.g*0.95)).r,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.85, transformY.g*0.85)).g,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.75, transformY.g*0.75)).b,\ + 1.0\ + );\ + vec4 texColor3 = vec4(\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.85, transformY.g*0.85)).r,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.75, transformY.g*0.75)).g,\ + texture2D(pTex, gl_TexCoord[0].st-vec2(transformX.r*0.65, transformY.g*0.65)).b,\ + 1.0\ + );\ + vec4 texColor = texColor1*0.6 + texColor2*0.2 + texColor3*0.2;\ gl_FragColor = texColor;\ }"; const char * lensVertex = "#version 120\n\ diff --git a/includes/powder.h b/includes/powder.h index 92310c144..3488d2825 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -283,6 +283,7 @@ struct particle int type; int life, ctype; float x, y, vx, vy; + float lastX, lastY; float temp; float pavg[2]; int flags; diff --git a/src/elements/neut.c b/src/elements/neut.c index 658195ae2..afb052301 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -40,6 +40,8 @@ int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)// parts[i].x = (float)x; parts[i].y = (float)y; + parts[i].lastX = (float)x; + parts[i].lastY = (float)y; parts[i].type = t; parts[i].life = rand()%480+480; parts[i].vx = r*cosf(a); @@ -160,6 +162,7 @@ int graphics_NEUT(GRAPHICS_FUNC_ARGS) *fireg = 80; *fireb = 120; - *pixel_mode |= FIRE_ADD; + *pixel_mode &= ~PMODE_FLAT; + *pixel_mode |= FIRE_ADD | PMODE_ADD; return 1; } diff --git a/src/elements/phot.c b/src/elements/phot.c index 66cf4eb77..ba6fd2515 100644 --- a/src/elements/phot.c +++ b/src/elements/phot.c @@ -94,6 +94,7 @@ int graphics_PHOT(GRAPHICS_FUNC_ARGS) *fireg = *colg; *fireb = *colb; - *pixel_mode |= FIRE_ADD; + *pixel_mode &= ~PMODE_FLAT; + *pixel_mode |= FIRE_ADD | PMODE_ADD; return 0; } diff --git a/src/graphics.c b/src/graphics.c index d39db8e65..1b1e8ce7e 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -24,8 +24,7 @@ #if defined(OGLR) #ifdef MACOSX -#include -#include +#include #include #elif defined(WIN32) #include @@ -458,6 +457,7 @@ void clearScreenNP(float alpha) void ogl_blit(int x, int y, int w, int h, pixel *src, int pitch, int scale) { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //glDrawPixels(w,h,GL_BGRA,GL_UNSIGNED_BYTE,src); //Why does this still think it's ABGR? glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, vidBuf); @@ -475,6 +475,7 @@ void ogl_blit(int x, int y, int w, int h, pixel *src, int pitch, int scale) glEnd(); glDisable( GL_TEXTURE_2D ); + glBlendFunc(GL_ONE, GL_ONE); glFlush(); SDL_GL_SwapBuffers (); } @@ -1750,12 +1751,16 @@ GLuint addV[(YRES*XRES)*2]; GLfloat addC[(YRES*XRES)*4]; GLfloat lineV[(((YRES*XRES)*2)*6)]; GLfloat lineC[(((YRES*XRES)*2)*6)]; +GLfloat blurLineV[(((YRES*XRES)*2))]; +GLfloat blurLineC[(((YRES*XRES)*2)*4)]; +GLfloat ablurLineV[(((YRES*XRES)*2))]; +GLfloat ablurLineC[(((YRES*XRES)*2)*4)]; #endif void render_parts(pixel *vid) { int deca, decr, decg, decb, cola, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, q, i, t, nx, ny, x, y, caddress; int orbd[4] = {0, 0, 0, 0}, orbl[4] = {0, 0, 0, 0}; - float gradv, flicker, fnx, fny; + float gradv, flicker, fnx, fny, flx, fly; #ifdef OGLR int cfireV = 0, cfireC = 0, cfire = 0; int csmokeV = 0, csmokeC = 0, csmoke = 0; @@ -1765,6 +1770,8 @@ void render_parts(pixel *vid) int cflatV = 0, cflatC = 0, cflat = 0; int caddV = 0, caddC = 0, cadd = 0; int clineV = 0, clineC = 0, cline = 0; + int cblurLineV = 0, cblurLineC = 0, cblurLine = 0; + int cablurLineV = 0, cablurLineC = 0, cablurLine = 0; GLuint origBlendSrc, origBlendDst; glGetIntegerv(GL_BLEND_SRC, &origBlendSrc); @@ -1792,6 +1799,8 @@ void render_parts(pixel *vid) ny = (int)(parts[i].y+0.5f); fnx = parts[i].x; fny = parts[i].y; + flx = parts[i].lastX; + fly = parts[i].lastY; if(photons[ny][nx]&0xFF && !(ptypes[t].properties & TYPE_ENERGY)) continue; @@ -2099,6 +2108,65 @@ void render_parts(pixel *vid) 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)) + { + if(pixel_mode & PMODE_FLAT) + { + blurLineV[cblurLineV++] = nx; + blurLineV[cblurLineV++] = ny; + blurLineC[cblurLineC++] = ((float)colr)/255.0f; + blurLineC[cblurLineC++] = ((float)colg)/255.0f; + blurLineC[cblurLineC++] = ((float)colb)/255.0f; + blurLineC[cblurLineC++] = 1.0f; + cblurLine++; + + blurLineV[cblurLineV++] = flx; + blurLineV[cblurLineV++] = fly; + blurLineC[cblurLineC++] = ((float)colr)/255.0f; + blurLineC[cblurLineC++] = ((float)colg)/255.0f; + blurLineC[cblurLineC++] = ((float)colb)/255.0f; + blurLineC[cblurLineC++] = 0.0f; + cblurLine++; + } + else if(pixel_mode & PMODE_BLEND) + { + blurLineV[cblurLineV++] = nx; + blurLineV[cblurLineV++] = ny; + blurLineC[cblurLineC++] = ((float)colr)/255.0f; + blurLineC[cblurLineC++] = ((float)colg)/255.0f; + blurLineC[cblurLineC++] = ((float)colb)/255.0f; + blurLineC[cblurLineC++] = ((float)cola)/255.0f; + cblurLine++; + + blurLineV[cblurLineV++] = flx; + blurLineV[cblurLineV++] = fly; + blurLineC[cblurLineC++] = ((float)colr)/255.0f; + blurLineC[cblurLineC++] = ((float)colg)/255.0f; + blurLineC[cblurLineC++] = ((float)colb)/255.0f; + blurLineC[cblurLineC++] = 0.0f; + cblurLine++; + } + else if(pixel_mode & PMODE_ADD) + { + ablurLineV[cablurLineV++] = nx; + ablurLineV[cablurLineV++] = ny; + ablurLineC[cablurLineC++] = ((float)colr)/255.0f; + ablurLineC[cablurLineC++] = ((float)colg)/255.0f; + ablurLineC[cablurLineC++] = ((float)colb)/255.0f; + ablurLineC[cablurLineC++] = ((float)cola)/255.0f; + cablurLine++; + + ablurLineV[cablurLineV++] = flx; + ablurLineV[cablurLineV++] = fly; + ablurLineC[cablurLineC++] = ((float)colr)/255.0f; + ablurLineC[cablurLineC++] = ((float)colg)/255.0f; + ablurLineC[cablurLineC++] = ((float)colb)/255.0f; + ablurLineC[cablurLineC++] = 0.0f; + cablurLine++; + } + } +#endif if(pixel_mode & PMODE_FLAT) { #ifdef OGLR @@ -2546,6 +2614,36 @@ void render_parts(pixel *vid) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if(cablurLine) + { + // -- BEGIN LINES -- // + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glEnable( GL_LINE_SMOOTH ); + glColorPointer(4, GL_FLOAT, 0, &ablurLineC[0]); + glVertexPointer(2, GL_FLOAT, 0, &ablurLineV[0]); + + glDrawArrays(GL_LINES, 0, cablurLine); + + //Clear some stuff we set + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_LINE_SMOOTH); + // -- END LINES -- // + } + if(cblurLine) + { + // -- BEGIN LINES -- // + glEnable( GL_LINE_SMOOTH ); + glColorPointer(4, GL_FLOAT, 0, &blurLineC[0]); + glVertexPointer(2, GL_FLOAT, 0, &blurLineV[0]); + + glDrawArrays(GL_LINES, 0, cblurLine); + + //Clear some stuff we set + glDisable(GL_LINE_SMOOTH); + // -- END LINES -- // + } + if(cflat) { // -- BEGIN FLAT -- // @@ -3310,7 +3408,7 @@ void prepare_alpha(int size, float intensity) for (x=0; xx, ystart, ed->w, ed->count*16, 255, 255, 255, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); clearrect(vid_buf, ed->x-2, ystart-2, ed->w+4, (ed->count*16)+4); } @@ -955,6 +960,9 @@ void error_ui(pixel *vid_buf, int err, char *txt) drawtextwrap(vid_buf, x0+8, y0+26, 224, msg, 255, 255, 255, 255); drawtext(vid_buf, x0+5, y0+textheight+37, "Dismiss", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+textheight+32, 240, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0 && mx=y0+textheight+32 && my<=y0+textheight+48) @@ -1024,6 +1032,9 @@ char *input_ui(pixel *vid_buf, char *title, char *prompt, char *text, char *shad drawtext(vid_buf, x0+5, y0+ysize-11, "OK", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+ysize-16, xsize, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0 && mx=y0+ysize-16 && my<=y0+ysize) @@ -1116,6 +1127,9 @@ void prop_edit_ui(pixel *vid_buf, int x, int y) drawtext(vid_buf, x0+5, y0+ysize-11, "OK", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+ysize-16, xsize, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0 && mx=y0+ysize-16 && my<=y0+ysize) @@ -1258,6 +1272,9 @@ void info_ui(pixel *vid_buf, char *top, char *txt) drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) @@ -1286,6 +1303,9 @@ void info_box(pixel *vid_buf, char *msg) drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); #ifndef RENDERER +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); #endif } @@ -1340,6 +1360,9 @@ void copytext_ui(pixel *vid_buf, char *top, char *txt, char *copytxt) drawtext(vid_buf, x0+5, y0+ysize-11, "OK", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+ysize-16, xsize, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0 && mx=y0+ysize-16 && my<=y0+ysize) @@ -1391,6 +1414,9 @@ int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) drawrect(vid_buf, x0, y0+textheight+32, 160, 16, 192, 192, 192, 255); drawrect(vid_buf, x0+160, y0+textheight+32, 80, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b && !bq && mx>=x0+160 && mx=y0+textheight+32 && my<=y0+textheight+48) @@ -1476,6 +1502,10 @@ void login_ui(pixel *vid_buf) drawtext(vid_buf, x0+187-textwidth("Sign in"), y0+69, "Sign in", 255, 255, 55, 255); drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); drawrect(vid_buf, x0, y0+64, 96, 16, 192, 192, 192, 255); + +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); ui_edit_process(mx, my, b, &ed1); @@ -1682,6 +1712,9 @@ int stamp_ui(pixel *vid_buf) } } +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (b==1&&r!=-1) @@ -1817,6 +1850,9 @@ void tag_list_ui(pixel *vid_buf) ui_edit_draw(vid_buf, &ed); drawtext(vid_buf, x0+5, y0+245, "Close", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+240, 192, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); ui_edit_process(mx, my, b, &ed); @@ -1972,6 +2008,9 @@ int save_name_ui(pixel *vid_buf) ui_copytext_draw(vid_buf, &ctb); ui_copytext_process(mx, my, b, bq, &ctb); } +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); @@ -2968,6 +3007,9 @@ char *download_ui(pixel *vid_buf, char *uri, int *len) drawtext(vid_buf, x0+120-textwidth("Waiting...")/2, y0+48, "Waiting...", 255, 216, 32, 255); drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); } @@ -3819,6 +3861,9 @@ int report_ui(pixel* vid_buf, char *save_id) return 0; } ui_edit_draw(vid_buf, &ed); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); ui_edit_process(mx, my, b, &ed); } @@ -4329,6 +4374,9 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if (!info_ready || !data_ready) { info_box(vid_buf, "Loading"); } +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); if (info_ready && svf_login) { @@ -5704,6 +5752,9 @@ unsigned int decorations_ui(pixel *vid_buf,int *bsx,int *bsy, unsigned int saved if (zoom_en) render_zoom(vid_buf); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (sdl_wheel) @@ -6020,7 +6071,9 @@ int save_filename_ui(pixel *vid_buf) ui_edit_draw(vid_buf, &ed); drawtext(vid_buf, x0+12+textwidth(ed.str), y0+25, ".cps", 240, 240, 255, 180); - +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); @@ -6308,6 +6361,9 @@ void catalogue_ui(pixel * vid_buf) //srctemp+=(XRES+BARSIZE);//*PIXELSIZE; } } +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); if (sdl_key==SDLK_RETURN) break; @@ -6382,6 +6438,8 @@ void drawIcon(pixel * vid_buf, int x, int y, int cmode) void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation) { pixel * o_vid_buf; + pixel *part_vbuf; //Extra video buffer + pixel *part_vbuf_store; int i, j, count, changed, temp; int xsize; int ysize; @@ -6472,7 +6530,10 @@ void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation) } o_vid_buf = calloc((YRES+MENUSIZE) * (XRES+BARSIZE), PIXELSIZE); - memcpy(o_vid_buf, vid_buf, ((YRES+MENUSIZE) * (XRES+BARSIZE)) * PIXELSIZE); + //memcpy(o_vid_buf, vid_buf, ((YRES+MENUSIZE) * (XRES+BARSIZE)) * PIXELSIZE); + + part_vbuf = calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); //Extra video buffer + part_vbuf_store = part_vbuf; while (!sdl_poll()) { @@ -6487,7 +6548,64 @@ void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation) b = mouse_get_state(&mx, &my); memcpy(vid_buf, o_vid_buf, ((YRES+MENUSIZE) * (XRES+BARSIZE)) * PIXELSIZE); - render_parts(vid_buf); + + if(ngrav_enable && display_mode & DISPLAY_WARP) + { + part_vbuf = part_vbuf_store; + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } else { + part_vbuf = vid_buf; + } + +#ifdef OGLR + if (display_mode & DISPLAY_PERS)//save background for persistent, then clear + { + clearScreen(0.01f); + memset(part_vbuf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + else //clear screen every frame + { + clearScreen(1.0f); + memset(part_vbuf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + if (display_mode & DISPLAY_AIR)//air only gets drawn in these modes + { + draw_air(part_vbuf); + } + } +#else + if (display_mode & DISPLAY_AIR)//air only gets drawn in these modes + { + draw_air(part_vbuf); + } + else if (display_mode & DISPLAY_PERS)//save background for persistent, then clear + { + memcpy(part_vbuf, pers_bg, (XRES+BARSIZE)*YRES*PIXELSIZE); + memset(part_vbuf+((XRES+BARSIZE)*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-((XRES+BARSIZE)*YRES*PIXELSIZE)); + } + else //clear screen every frame + { + memset(part_vbuf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } +#endif + + if(ngrav_enable && drawgrav_enable) + draw_grav(vid_buf); + + draw_walls(part_vbuf); + + render_parts(part_vbuf); + draw_other(part_vbuf); +#ifndef OGLR + if (render_mode & FIREMODE) + render_fire(part_vbuf); +#endif + render_signs(part_vbuf); + +#ifndef OGLR + if(ngrav_enable && display_mode & DISPLAY_WARP) + render_gravlensing(part_vbuf, vid_buf); +#endif + draw_svf_ui(vid_buf, sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)); clearrect(vid_buf, xcoord-2, ycoord-2, xsize+4, ysize+4); drawrect(vid_buf, xcoord, ycoord, xsize, ysize, 192, 192, 192, 255); @@ -6618,11 +6736,12 @@ void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation) } } - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); #ifdef OGLR clearScreenNP(1.0f); draw_parts_fbo(); #endif + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + if (sdl_key==SDLK_RETURN) break; if (sdl_key==SDLK_ESCAPE) @@ -6644,6 +6763,8 @@ void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation) break; } + free(part_vbuf); + free(o_vid_buf); } @@ -6774,6 +6895,9 @@ void simulation_ui(pixel * vid_buf) ui_checkbox_draw(vid_buf, &cb6); ui_list_draw(vid_buf, &list); ui_list_draw(vid_buf, &list2); +#ifdef OGLR + clearScreen(1.0f); +#endif sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); ui_checkbox_process(mx, my, b, bq, &cb); ui_checkbox_process(mx, my, b, bq, &cb2); diff --git a/src/main.c b/src/main.c index 1f014bf7b..87baa4a15 100644 --- a/src/main.c +++ b/src/main.c @@ -2255,7 +2255,7 @@ int main(int argc, char *argv[]) } if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { - render_ui(vid_buf, XRES+BARSIZE-(510-491), YRES-2, 3); + render_ui(vid_buf, XRES+BARSIZE-(510-491)+1, YRES+22, 3); } if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) sys_pause = !sys_pause; diff --git a/src/powder.c b/src/powder.c index 3d5ed421b..4724b7a3f 100644 --- a/src/powder.c +++ b/src/powder.c @@ -888,6 +888,8 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a { parts[i].x = (float)x; parts[i].y = (float)y; + parts[i].lastX = (float)x; + parts[i].lastY = (float)y; parts[i].type = t; parts[i].vx = 0; parts[i].vy = 0; @@ -1031,6 +1033,8 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a { parts[i].x = (float)x; parts[i].y = (float)y; + parts[i].lastX = (float)x; + parts[i].lastY = (float)y; parts[i].type = PT_STKM; parts[i].vx = 0; parts[i].vy = 0; @@ -1053,6 +1057,8 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a { parts[i].x = (float)x; parts[i].y = (float)y; + parts[i].lastX = (float)x; + parts[i].lastY = (float)y; parts[i].type = PT_STKM2; parts[i].vx = 0; parts[i].vy = 0; @@ -1077,6 +1083,8 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a { parts[i].x = (float)x; parts[i].y = (float)y; + parts[i].lastX = (float)x; + parts[i].lastY = (float)y; parts[i].type = PT_FIGH; parts[i].vx = 0; parts[i].vy = 0; @@ -1721,6 +1729,8 @@ void update_particles_i(pixel *vid, int start, int inc) if (parts[i].type) { t = parts[i].type; + parts[i].lastX = parts[i].x; + parts[i].lastY = parts[i].y; if (t<0 || t>=PT_NUM) { kill_part(i); diff --git a/src/save.c b/src/save.c index 320e89ff5..cf13994bd 100644 --- a/src/save.c +++ b/src/save.c @@ -1345,6 +1345,9 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c if(i >= partsDataLen) goto fail; partsptr[newIndex].tmp2 = partsData[i++]; } + + partsptr[newIndex].lastX = partsptr[newIndex].x - partsptr[newIndex].vx; + partsptr[newIndex].lastY = partsptr[newIndex].y - partsptr[newIndex].vy; if ((player.spwn == 1 && partsptr[newIndex].type==PT_STKM) || (player2.spwn == 1 && partsptr[newIndex].type==PT_STKM2)) { @@ -2023,6 +2026,8 @@ int parse_save_PSv(void *save, int size, int replace, int x0, int y0, unsigned c { parts[i].vx = (d[p++]-127.0f)/16.0f; parts[i].vy = (d[p++]-127.0f)/16.0f; + parts[i].lastX = parts[i].x - parts[i].vx; + parts[i].lastY = parts[i].y - parts[i].vy; } else p += 2;