diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-14 12:18:00 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-14 12:18:00 (GMT) |
| commit | 37e15bf3ad5a728e0394f40b9f4691de7464c6ea (patch) | |
| tree | 0373de1bc26047e211098277d24df38e77d89799 /src | |
| parent | 1af0a86e0d2f5659f4672a8db0ca67da6e980e51 (diff) | |
| download | powder-37e15bf3ad5a728e0394f40b9f4691de7464c6ea.zip powder-37e15bf3ad5a728e0394f40b9f4691de7464c6ea.tar.gz | |
Replace use of gravy and gravf with gravxf and gravyf
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 8 | ||||
| -rw-r--r-- | src/main.c | 8 | ||||
| -rw-r--r-- | src/powder.c | 18 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/graphics.c b/src/graphics.c index 1751f8a..abe8421 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1527,15 +1527,15 @@ void draw_grav(pixel *vid) { for (x=0; x<XRES/CELL; x++) { - if(fabsf(gravx[y][x]) <= 0.001f && fabsf(gravy[y][x]) <= 0.001f) + if(fabsf(gravpf[(y*XRES)+x]) <= 0.001f && fabsf(gravyf[((y*CELL)*XRES)+(x*CELL)]) <= 0.001f) continue; nx = x*CELL; ny = y*CELL; - dist = fabsf(gravx[y][x])+fabsf(gravy[y][x]); + dist = fabsf(gravyf[(y*XRES)+x])+fabsf(gravxf[(y*XRES)+x]); for(i = 0; i < 4; i++) { - nx -= gravx[y][x]*0.5f; - ny -= gravy[y][x]*0.5f; + nx -= gravxf[((y*CELL)*XRES)+(x*CELL)]*0.5f; + ny -= gravyf[((y*CELL)*XRES)+(x*CELL)]*0.5f; addpixel(vid, (int)(nx+0.5f), (int)(ny+0.5f), 255, 255, 255, (int)(dist*20.0f)); } } @@ -1826,9 +1826,9 @@ int main(int argc, char *argv[]) if(result) //Did the gravity thread finish? { memcpy(th_gravmap, gravmap, sizeof(gravmap)); //Move our current gravmap to be processed other thread - memcpy(gravy, th_gravy, sizeof(gravy)); //Hmm, Gravy - memcpy(gravx, th_gravx, sizeof(gravx)); //Move the processed velocity maps to be used - memcpy(gravp, th_gravp, sizeof(gravp)); + //memcpy(gravy, th_gravy, sizeof(gravy)); //Hmm, Gravy + //memcpy(gravx, th_gravx, sizeof(gravx)); //Move the processed velocity maps to be used + //memcpy(gravp, th_gravp, sizeof(gravp)); if (!sys_pause||framerender){ //Only update if not paused //Switch the full size gravmaps, we don't really need the two above any more @@ -2646,7 +2646,7 @@ int main(int argc, char *argv[]) sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); if (DEBUG_MODE) { - sprintf(coordtext, "X:%d Y:%d. GX: %.2f GY: %.2f", x/sdl_scale, y/sdl_scale, gravx[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], gravy[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + sprintf(coordtext, "X:%d Y:%d. GX: %.2f GY: %.2f", x/sdl_scale, y/sdl_scale, gravxf[((y/sdl_scale)*XRES)+(x/sdl_scale)], gravyf[((y/sdl_scale)*XRES)+(x/sdl_scale)]); } } } diff --git a/src/powder.c b/src/powder.c index 0633f75..b56426b 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1729,13 +1729,13 @@ void update_particles_i(pixel *vid, int start, int inc) if (t==PT_ANAR) { // perhaps we should have a ptypes variable for this - pGravX -= gravx[y/CELL][x/CELL]; - pGravY -= gravy[y/CELL][x/CELL]; + pGravX -= gravxf[(y*XRES)+x]; + pGravY -= gravyf[(y*XRES)+x]; } else if(t!=PT_STKM && t!=PT_STKM2 && !(ptypes[t].properties & TYPE_SOLID)) { - pGravX += gravx[y/CELL][x/CELL]; - pGravY += gravy[y/CELL][x/CELL]; + pGravX += gravxf[(y*XRES)+x]; + pGravY += gravyf[(y*XRES)+x]; } //velocity updates for the particle parts[i].vx *= ptypes[t].loss; @@ -1990,7 +1990,7 @@ void update_particles_i(pixel *vid, int start, int inc) s = 1; - gravtot = fabsf(gravy[y/CELL][x/CELL])+fabsf(gravx[y/CELL][x/CELL]); + gravtot = fabs(gravyf[(y*XRES)+x])+fabs(gravxf[(y*XRES)+x]); if (pv[y/CELL][x/CELL]>ptransitions[t].phv&&ptransitions[t].pht>-1) { // particle type change due to high pressure if (ptransitions[t].pht!=PT_NUM) @@ -2354,8 +2354,8 @@ killed: pGravX = ptGrav * ((float)(nx - XCNTR) / pGravD); pGravY = ptGrav * ((float)(ny - YCNTR) / pGravD); } - pGravX += gravx[ny/CELL][nx/CELL]; - pGravY += gravy[ny/CELL][nx/CELL]; + pGravX += gravxf[(ny*XRES)+nx]; + pGravY += gravyf[(ny*XRES)+nx]; if (fabsf(pGravY)>fabsf(pGravX)) mv = fabsf(pGravY); else @@ -2413,8 +2413,8 @@ killed: pGravX = ptGrav * ((float)(nx - XCNTR) / pGravD); pGravY = ptGrav * ((float)(ny - YCNTR) / pGravD); } - pGravX += gravx[ny/CELL][nx/CELL]; - pGravY += gravy[ny/CELL][nx/CELL]; + pGravX += gravxf[(ny*XRES)+nx]; + pGravY += gravyf[(ny*XRES)+nx]; if (fabsf(pGravY)>fabsf(pGravX)) mv = fabsf(pGravY); else |
