////////// // // Register window holds r1,r2,r3,r4, as well as carry? and zero? flags // ////// void iiDebo1_renderRegisters(void) { RECT lrc; ////////// // Overlay the logo info ////// SetRect(&lrc, 0, 0, bmpRegisters->rc.right, bmpLibSF_386_x40->bi.biHeight); iBmp_bitBlt(bmpRegisters, &lrc, bmpLibSF_386_x40); }
// Note: tfSquareSize is how far each side of the square should extend out from the connection point for the node lines void iiNode_get_bitmapExtents(SNode* node, SNode* nodeStopper1, SNode* nodeStopper2, s32 tnArrivalDirection, SBitmap* bmp, RECT* rc, POINTS p_anchor, POINTS p_arrival, f64 tfRodLength, u32 tnIter_uid, SNodeProps* props, bool tlGoDeeper, SNodeFlags* nodeFlags, bool tlDeeperNodesExtendInAllDirections) { s32 lnI, lnWidth, lnHeight, lnHalfWidth, lnHalfHeight; f64 lfHalfHeight, lfHalfWidth; POINTS p_origin, p_rodStart, p_rodEnd; // Make sure our environment is sane, and that we're not walking over ourselves if (node && node->render.iter_uid != tnIter_uid && between(tnArrivalDirection, (s32)_NODE_MIN, (s32)_NODE_MAX)) { ////////// // Compute the sizes ///// if (node->render.bmp) { lnHalfWidth = (node->render.bmp->bi.biWidth / 2); lnHalfHeight = (node->render.bmp->bi.biHeight / 2); lnWidth = node->render.bmp->bi.biWidth; lnHeight = node->render.bmp->bi.biHeight; } else { // Assume 0 size lnHalfWidth = 0; lnHalfHeight = 0; lnWidth = 0; lnHeight = 0; } ////////// // Note: rc grows in these directions, to encompass the entire node assembly: // // top // - // // +--+--+ // left - + + + + right // +--+--+ // // + // bottom ////// // Based on the arrival direction of the rod, increase rc's extents if needed switch (tnArrivalDirection) { case _NODE_N0: case _NODE_N1: case _NODE_N2: rc->left = min(rc->left, p_anchor.x + iDelta(p_anchor.x, p_arrival.x - lnHalfWidth)); // Connecting point: +--+--+ rc->top = min(rc->top, p_anchor.y - iDelta(p_anchor.y, p_arrival.y - lnHeight)); // + + + rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x - lnHalfWidth + lnWidth)); // +--o--+ p_origin.x = p_arrival.x; p_origin.y = p_arrival.y - (s16)lnHeight + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x - lnHalfWidth, p_arrival.y - lnHeight, p_arrival.x - lnHalfWidth + lnWidth, p_arrival.y); break; case _NODE_E0: case _NODE_E1: case _NODE_E2: rc->top = min(rc->top, p_anchor.y - iDelta(p_anchor.y, p_arrival.y - lnHalfHeight)); // Connecting point: +--+--+ rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x + lnWidth)); // o + + rc->bottom = max(rc->bottom, p_anchor.y + iDelta(p_anchor.y, p_arrival.y - lnHalfHeight + lnHeight)); // +--+--+ p_origin.x = p_arrival.x + (s16)lnHalfWidth; p_origin.y = p_arrival.y; SetRect(&node->render.rc, p_arrival.x, p_arrival.y - lnHalfHeight, p_arrival.x + lnWidth, p_arrival.y - lnHalfHeight + lnHeight); break; case _NODE_C0: case _NODE_C1: case _NODE_C2: rc->left = min(rc->left, p_anchor.x - iDelta(p_anchor.x, p_arrival.x - lnHalfWidth)); // Connecting point: +--+--+ rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x - lnHalfWidth + lnWidth)); // + o + rc->top = min(rc->top, p_anchor.y - iDelta(p_anchor.y, p_arrival.y - lnHalfHeight)); // +--+--+ rc->bottom = max(rc->bottom, p_anchor.y + iDelta(p_anchor.y, p_arrival.y - lnHalfHeight + lnHeight)); // p_origin.x = p_arrival.x; p_origin.y = p_arrival.y; SetRect(&node->render.rc, p_arrival.x - lnHalfWidth, p_arrival.y - lnHalfHeight, p_arrival.x - lnHalfWidth + lnWidth, p_arrival.y - lnHalfHeight + lnHeight); break; case _NODE_S0: case _NODE_S1: case _NODE_S2: rc->left = min(rc->left, p_anchor.x - iDelta(p_anchor.x, p_arrival.x - lnHalfWidth)); // Connecting point: +--o--+ rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x - lnHalfWidth + lnWidth)); // + + + rc->bottom = max(rc->bottom, p_anchor.y + iDelta(p_anchor.y, p_arrival.y + lnHeight)); // +--+--+ p_origin.x = p_arrival.x; p_origin.y = p_arrival.y + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x - lnHalfWidth, p_arrival.y, p_arrival.x - lnHalfWidth + lnWidth, p_arrival.y + lnHeight); break; case _NODE_W0: case _NODE_W1: case _NODE_W2: rc->top = min(rc->top, p_anchor.x - iDelta(p_anchor.y, p_arrival.y - lnHalfHeight)); // Connecting point: +--+--+ rc->left = min(rc->left, p_anchor.x - iDelta(p_anchor.x, p_arrival.x - lnWidth)); // + + o rc->bottom = max(rc->bottom, p_anchor.y + iDelta(p_anchor.y, p_arrival.y - lnHalfHeight + lnHeight)); // +--+--+ p_origin.x = p_arrival.x - (s16)lnWidth + (s16)lnHalfWidth; p_origin.y = p_arrival.y; SetRect(&node->render.rc, p_arrival.x - lnWidth, p_arrival.y - lnHalfHeight, p_arrival.x, p_arrival.y - lnHalfHeight + lnHeight); break; case _NODE_NE0: case _NODE_NE1: case _NODE_NE2: rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x + lnWidth)); // Connecting point: +--+--+ rc->top = min(rc->top, p_anchor.y - iDelta(p_anchor.y, p_arrival.y - lnHeight)); // + + + // o--+--+ p_origin.x = p_arrival.x + (s16)lnHalfWidth; p_origin.y = p_arrival.y - (s16)lnHeight + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x, p_arrival.y - lnHeight, p_arrival.x + lnWidth, p_arrival.y); break; case _NODE_SE0: case _NODE_SE1: case _NODE_SE2: rc->right = max(rc->right, p_anchor.x + iDelta(p_anchor.x, p_arrival.x + lnWidth)); // Connecting point: o--+--+ rc->bottom = max(rc->bottom, p_anchor.x + iDelta(p_anchor.y, p_arrival.y + lnHeight)); // + + + // +--+--+ p_origin.x = p_arrival.x + (s16)lnHalfWidth; p_origin.y = p_arrival.y + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x, p_arrival.y, p_arrival.x + lnWidth, p_arrival.y + lnHeight); break; case _NODE_SW0: case _NODE_SW1: case _NODE_SW2: rc->left = min(rc->left, p_anchor.x - iDelta(p_anchor.x, p_arrival.x - lnWidth)); // Connecting point: +--+--o rc->bottom = max(rc->bottom, p_anchor.y + iDelta(p_anchor.y, p_arrival.y + lnHeight)); // + + + // +--+--+ p_origin.x = p_arrival.x - (s16)lnWidth + (s16)lnHalfWidth; p_origin.y = p_arrival.y + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x - lnWidth, p_arrival.y, p_arrival.x, p_arrival.y + lnHeight); break; case _NODE_NW0: case _NODE_NW1: case _NODE_NW2: rc->left = min(rc->left, p_anchor.x - iDelta(p_anchor.x, p_arrival.x - lnWidth)); // Connecting point: +--+--+ rc->top = min(rc->top, p_anchor.y - iDelta(p_anchor.y, p_arrival.y - lnHeight)); // + + + // +--+--o p_origin.x = p_arrival.x - (s16)lnWidth + (s16)lnHalfWidth; p_origin.y = p_arrival.y - (s16)lnHeight + (s16)lnHalfHeight; SetRect(&node->render.rc, p_arrival.x - lnWidth, p_arrival.y - lnHeight, p_arrival.x, p_arrival.y); break; } // Set the iteration uid node->render.iter_uid = tnIter_uid; // Render the rectangle if we're drawing if (bmp && node->render.bmp) iBmp_bitBlt(bmp, &node->render.rc, node->render.bmp); // Compute distances from the origin to side and top, which then can extend to all 8 points through gnNodeRodeMaps[] lfHalfWidth = (f64)(lnWidth / 2); lfHalfHeight = (f64)(lnHeight / 2); tfRodLength = max(tfRodLength, 8.0); ////////// // Kick off the nodes in each direction ////// if (tlGoDeeper) { // Iterate off in all directions for (lnI = 0; lnI < (s32)_NODE_COUNT; lnI++) { // Are we're supposed to go this way? // We're supposed to go this way, and the node exists, and we haven't already rendered it if ((!nodeFlags || nodeFlags->n[lnI]) && node->n[lnI] && node->n[lnI]->render.iter_uid != tnIter_uid) { // And it's not self if (node->n[lnI] != node) { // And it's not our stopper if (node->n[lnI] != nodeStopper1 && node->n[lnI] != nodeStopper2) { // Determine the ending point at the connecting rod p_rodStart.x = p_origin.x + (s32)(gsfNodeRodMaps[lnI].x * lfHalfWidth); p_rodStart.y = p_origin.y + (s32)(gsfNodeRodMaps[lnI].y * lfHalfHeight); p_rodEnd.x = p_rodStart.x + (s32)(gsfNodeRodMaps[lnI].x * tfRodLength); p_rodEnd.y = p_rodStart.y + (s32)(gsfNodeRodMaps[lnI].y * tfRodLength); // Draw connections to the next direction (if we're drawing) if (bmp) iBmp_drawArbitraryLine(bmp, p_rodStart.x, p_rodStart.y, p_rodEnd.x, p_rodEnd.y, props->rodColor); // Indicate that we want to render everything out from there iiNode_get_bitmapExtents(node->n[lnI], nodeStopper1, node, lnI, bmp, rc, p_anchor, p_rodEnd, tfRodLength, tnIter_uid, props, true, ((tlDeeperNodesExtendInAllDirections) ? &gsfNodeFlags_all : nodeFlags), tlDeeperNodesExtendInAllDirections); } } } } } } }