Replace use of gravy and gravf with gravxf and gravyf
This commit is contained in:
parent
1af0a86e0d
commit
37e15bf3ad
@ -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)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
src/powder.c
18
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
|
||||
|
Loading…
Reference in New Issue
Block a user