MCPcopy Create free account
hub / github.com/SimHacker/micropolis / n_smarble

Method n_smarble

MicropolisCore/src/CellEngine/src/cellengine.cpp:3174–3241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3172 result = ((c << 3) + nw + n + ne + w + frob + e + sw + s + se) >> 4;
3173
3174void CellEngine::n_smarble()
3175{
3176 QUAD *front = (QUAD *)frontMem;
3177 QUAD *back = (QUAD *)(backMem +
3178 (backBorder - 1) +
3179 ((backBorder - 1) * backRowBytes));
3180 long backline = backRowBytes >> 2;
3181 long backstride = backline - ((width >> 2) + 1);
3182 long frontstride = (screenRowBytes >> 2) - (width >> 2);
3183 long xsteps = width >> 2;
3184 long yy;
3185
3186 total = 0;
3187
3188 for (yy = height;
3189 yy > 0;
3190 back += backstride,
3191 front += frontstride,
3192 yy--) {
3193 register QUAD b1, b2;
3194 register QUAD c1, c2;
3195 register QUAD d1, d2;
3196 long xx;
3197
3198 b2 = back[0];
3199 c2 = back[backline];
3200 d2 = back[backline << 1];
3201 back++;
3202
3203 for (xx = xsteps;
3204 xx > 0;
3205 xx--) {
3206 long result, cells = 0;
3207
3208 b1 = b2; b2 = back[0];
3209 c1 = c2; c2 = back[backline];
3210 d1 = d2; d2 = back[backline << 1];
3211 back++;
3212
3213 SMARBLE( BYTE0(b1), BYTE1(b1), BYTE2(b1),
3214 BYTE0(c1), BYTE1(c1), BYTE2(c1),
3215 BYTE0(d1), BYTE1(d1), BYTE2(d1) );
3216 total += result;
3217 SETBYTE0(cells, result);
3218
3219 SMARBLE( BYTE1(b1), BYTE2(b1), BYTE3(b1),
3220 BYTE1(c1), BYTE2(c1), BYTE3(c1),
3221 BYTE1(d1), BYTE2(d1), BYTE3(d1) );
3222 total += result;
3223 SETBYTE1(cells, result);
3224
3225 SMARBLE( BYTE2(b1), BYTE3(b1), BYTE0(b2),
3226 BYTE2(c1), BYTE3(c1), BYTE0(c2),
3227 BYTE2(d1), BYTE3(d1), BYTE0(d2) );
3228 total += result;
3229 SETBYTE2(cells, result);
3230
3231 SMARBLE( BYTE3(b1), BYTE0(b2), BYTE1(b2),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected