if ((dx == 0) && (dy == 0)) break;
/* Quadratic acceleration */
- dx = dx*(fabs(dx)+0.5);
- if (dx<0.0) dx-=0.5; else dx+=0.5;
- if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
+ dx = dx*(fabs(dx) + 0.5);
+ if (dx < 0.0) dx -= 0.5;
+ else dx += 0.5;
+ if (dx < -deltaMax) dx = -deltaMax;
+ else if (dx > deltaMax) dx = deltaMax;
- dy = dy*(fabs(dy)+0.5);
- if (dy<0.0) dy-=0.5; else dy+=0.5;
- if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
+ dy = dy*(fabs(dy) + 0.5);
+ if (dy < 0.0) dy -= 0.5;
+ else dy += 0.5;
+ if (dy < -deltaMax) dy= -deltaMax;
+ else if (dy > deltaMax) dy= deltaMax;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
dy = -dy;
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
rowstride = movie->header->Width * 3;
- if (bits != 16) if (movie->header->Width % 2) rowstride++;
+ if ((bits != 16) && (movie->header->Width % 2)) rowstride++;
for (y = 0; y < movie->header->Height; y++) {
memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);
*fp = basisu[i] * bp->vec[3];
sumdiv += *fp;
}
- if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
+ if ((sumdiv != 0.0f) && (sumdiv < 0.999f || sumdiv > 1.001f)) {
/* is normalizing needed? */
fp = sum;
for (i = istart; i <= iend; i++, fp++) {
/* search for id */
idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
- if (idtest) if (new_id(lb, idtest, name) == 0) id_sort_by_name(lb, idtest);
+ if (idtest && (new_id(lb, idtest, name) == 0)) {
+ id_sort_by_name(lb, idtest);
+ }
}
void text_idbutton(struct ID *id, char *text)
return 1;
}
-#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
- if ((event & mtex->mapto) & type) { pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
-
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
- if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
-
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
- if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
+ if ((event & mtex->mapto) & type) { \
+ pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
+ } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
+ if (event & type) { \
+ if (pvalue < 0.0f) \
+ pvalue = 1.0f + pvalue; \
+ CLAMP(pvalue, 0.0f, 1.0f); \
+ } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
+ if (event & type) { \
+ CLAMP(pvalue, -1.0f, 1.0f); \
+ } (void)0
static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
{
float value, rgba[4], texvec[3];
ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp =
- ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
- ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
+ ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
+ ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f;
ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
h = hashvectf + 3 * hash[b21 + b11];
n += i * (h[0] * jx + h[1] * jy + h[2] * jz);
- if (n < 0.0f) n = 0.0f; else if (n > 1.0f) n = 1.0f;
+ if (n < 0.0f) n = 0.0f;
+ else if (n > 1.0f) n = 1.0f;
return n;
}
y *= lacunarity;
z *= lacunarity;
weight = signal * gain;
- if (weight > 1.0f) weight = 1.0f; else if (weight < 0.0f) weight = 0.0f;
+ if (weight > 1.0f) weight = 1.0f;
+ else if (weight < 0.0f) weight = 0.0f;
signal = offset - fabsf(noisefunc(x, y, z));
signal *= signal;
signal *= weight;
/* what about resolu == 2? */
bp = &nu->bp[u];
for (v = 0; v < nu->pntsv - 1; v++, bp += nu->pntsu) {
- if (v) if (bp->f1 & SELECT) return 1;
+ if ((v != 0) && (bp->f1 & SELECT)) {
+ return TRUE;
+ }
}
- return 0;
+ return FALSE;
}
typedef struct NurbSort {
bp->vec[0] += fac * grid;
fac = (float)b - 1.5f;
bp->vec[1] += fac * grid;
- if (a == 1 || a == 2) if (b == 1 || b == 2) {
+ if ((a == 1 || a == 2) && (b == 1 || b == 2)) {
bp->vec[2] += grid;
}
mul_m4_v3(mat, bp->vec);
dir1 &= (UI_TOP | UI_DOWN);
}
- if (dir2 == 0) if (dir1 == UI_LEFT || dir1 == UI_RIGHT) dir2 = UI_DOWN;
- if (dir2 == 0) if (dir1 == UI_TOP || dir1 == UI_DOWN) dir2 = UI_LEFT;
+ if ((dir2 == 0) && (dir1 == UI_LEFT || dir1 == UI_RIGHT)) dir2 = UI_DOWN;
+ if ((dir2 == 0) && (dir1 == UI_TOP || dir1 == UI_DOWN)) dir2 = UI_LEFT;
/* no space at all? don't change */
if (left || right) {
return ibuf;
}
- if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
- if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
- if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
- if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
+ if (newx && (newx < ibuf->x)) scaledownx(ibuf, newx);
+ if (newy && (newy < ibuf->y)) scaledowny(ibuf, newy);
+ if (newx && (newx > ibuf->x)) scaleupx(ibuf, newx);
+ if (newy && (newy > ibuf->y)) scaleupy(ibuf, newy);
return(ibuf);
}