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

Method n_dendrite

MicropolisCore/src/CellEngine/src/cellengine.cpp:4928–5137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4926
4927
4928void CellEngine::n_dendrite()
4929{
4930 Byte *front = frontMem;
4931 unsigned char *nw;
4932 unsigned char *ne;
4933 unsigned char *sw;
4934 unsigned char *se;
4935 unsigned char *data = front;
4936 int xx, yy;
4937 // nw ne
4938 // sw se
4939 for (yy = 0; yy < height; yy += 2) {
4940 if (phase == 0) {
4941 nw = data;
4942 ne = nw + 1;
4943 sw = data + screenRowBytes;
4944 se = sw + 1;
4945 } else {
4946 se = data;
4947 sw = se + (width - 1);
4948 ne = data +
4949 ((yy == 0)
4950 ? ((height - 1) * screenRowBytes)
4951 : (-screenRowBytes));
4952 nw = ne + (width - 1);
4953 } // if
4954
4955 for (xx = 0; xx < width; xx += 2) {
4956 unsigned char nw0 = *nw;
4957 unsigned char ne0 = *ne;
4958 unsigned char sw0 = *sw;
4959 unsigned char se0 = *se;
4960 unsigned char r = (unsigned char)Rand8();
4961
4962 // nw ne
4963 // sw se
4964
4965 // MARG_RULE(c, cw, ccw, opp, r, phase)
4966
4967#if 1
4968 unsigned char collision =
4969 ((nw0 & 1) == (ne0 & 1)) &&
4970 ((sw0 & 1) == (se0 & 1)) &&
4971 ((nw0 & 1) != (sw0 & 1));
4972 unsigned char frozen =
4973 (nw0 | ne0 | sw0 | se0) & 128;
4974 unsigned char nw1, ne1, sw1, se1;
4975 // nw ne
4976 // sw se
4977 if (frozen) {
4978 int t = ticks >> 4;
4979 nw1 =
4980 (nw0 == 0)
4981 ? 0
4982 : ((nw0 & 128)
4983 ? nw0
4984 : (t | 128));
4985 ne1 =

Callers

nothing calls this directly

Calls 2

MARG_RULE_GASFunction · 0.85
Rand8Function · 0.70

Tested by

no test coverage detected