Files
lilygo-t-deck/tron-room-demo/examples/RoomView/RoomView.cpp
T
Dejvino 897361c881 Add tron-room-demo: orbiting top-down 3D view of the NetDeck demo map
Copy of the tron-demo emulator-only template with a new RoomView sketch
that renders the real demo floorplan (src/netdeck/nd_demomap.h, consumed
through MapSource) as an orbiting pseudo-3D flythrough: extruded shaded
boxes for walls/crates/door/terminal, network pylons with link packets,
patrolling entities, distance fog and checker floor. Makefile adds an
include path to ../src/netdeck instead of copying the map headers.
2026-11-16 21:45:56 +01:00

510 lines
20 KiB
C++

/**
* RoomView — top-down "3D" flythrough of NetDeck's demo map.
*
* Target: T-Deck emulator (320x240, ABGR8888 framebuffer).
*
* Contract with the emulator host (src/main.cpp):
* - implement setup() — called once at launch
* - implement loop() — called once per frame (host paces at ~60 fps)
* - write pixels into emuGfx::fb[] (320x240, ABGR8888 uint32)
* - set emuGfx::dirty = true each frame you want presented
* - read keys from emu::keyboard (ASCII queue, filled from SDL events)
*
* The world is NetDeck's real demo floorplan: the hardcoded 3-room
* 40x24-tile Breach & Board map from src/netdeck/nd_demomap.h, consumed
* through the generic MapSource interface (tiles, rooms, doors, network
* graph, entity spawn list). Nothing about the map is duplicated here —
* edit the demo map in the firmware tree and this view follows it.
*
* Rendering (all software, no GPU):
* - a true 3D orbiting camera: position + look-at basis, full
* perspective divide, looking down at the deck from above
* - walls / crates / doors / terminals as solid shaded boxes with
* backface culling, painter's-algorithm depth sorting, lambert
* lighting from above and distance fog
* - floor tiles as flat lit quads with a subtle checker
* - the network graph drawn as glowing pylons with link lines and
* data packets traveling along the edges
* - entities from the demo spawn list walking their patrol routes
*
* The camera drifts on its own (slow orbit + breathing radius/height);
* keys adjust: a/d orbit speed, w/s zoom, r/f altitude, space pause,
* q/ESC quit.
*/
#include "shim.h"
#include "nd_layout.h"
#include "nd_mapsource.h"
#include "nd_demomap.h"
extern uint32_t emuGfx::fb[320 * 240];
extern bool emuGfx::dirty;
extern std::deque<uint8_t> emu::keyboard;
static constexpr int W = 320;
static constexpr int H = 240;
static constexpr float TILEF = 1.0f; // one map tile = one world unit
// --- Palette (ABGR8888: 0xAABBGGRR) -----------------------------------------
static const uint32_t COL_FLOOR_A = 0xFF2E1F15; // near-black blue floor
static const uint32_t COL_FLOOR_B = 0xFF3A2A1C; // checker variant
static const uint32_t COL_WALL = 0xFFD8B090; // steel blue-gray hull
static const uint32_t COL_CRATE = 0xFF4A5A66; // industrial brown-gray
static const uint32_t COL_DOOR = 0xFF00A0FF; // amber blast door
static const uint32_t COL_TERMINAL = 0xFF40E060; // green terminal glow
static const uint32_t COL_AIRLOCK = 0xFFFFFF00; // cyan airlock ring
static const uint32_t COL_MARINE = 0xFFFFFF00; // cyan squad
static const uint32_t COL_DROID = 0xFF00A0FF; // orange droid
static const uint32_t COL_HEAVY = 0xFF0000FF; // red heavy
static const uint32_t COL_TURRET = 0xFFFF00FF; // magenta turret
static const uint32_t COL_LINK = 0xFFCF8B2B; // teal net link (dim)
static const uint32_t COL_PACKET = 0xFFBF0707; // cyan packet
// --- Drawing helpers (from the template sketch toolbox) ----------------------
static inline void putPixel(int x, int y, uint32_t c) {
if (x < 0 || x >= W || y < 0 || y >= H) return;
emuGfx::fb[y * W + x] = c;
}
static void drawLine(int x0, int y0, int x1, int y1, uint32_t color) {
int dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
int err = dx + dy, e2;
for (;;) {
putPixel(x0, y0, color);
if (x0 == x1 && y0 == y1) break;
e2 = 2 * err;
if (e2 >= dy) { err += dy; x0 += sx; }
if (e2 <= dx) { err += dx; y0 += sy; }
}
}
static void fillCircle(int cx, int cy, int r, uint32_t color) {
for (int y = -r; y <= r; y++)
for (int x = -r; x <= r; x++)
if (x * x + y * y <= r * r) putPixel(cx + x, cy + y, color);
}
// Scale an ABGR color's RGB channels by f (fog / shading).
static inline uint32_t dimColor(uint32_t c, float f) {
if (f < 0) f = 0;
if (f > 1) f = 1;
uint32_t r = (uint32_t)((c & 0xFF) * f);
uint32_t g = (uint32_t)(((c >> 8) & 0xFF) * f);
uint32_t b = (uint32_t)(((c >> 16) & 0xFF) * f);
return 0xFF000000u | (b << 16) | (g << 8) | r;
}
// Horizontal span with clipping.
static inline void hline(int y, int xa, int xb, uint32_t c) {
if (y < 0 || y >= H) return;
if (xa > xb) { int t = xa; xa = xb; xb = t; }
if (xb < 0 || xa >= W) return;
if (xa < 0) xa = 0;
if (xb >= W) xb = W - 1;
for (int x = xa; x <= xb; x++) emuGfx::fb[y * W + x] = c;
}
// Scanline triangle fill (float vertices, clips to screen).
static void fillTri(float x0, float y0, float x1, float y1, float x2, float y2, uint32_t c) {
if (y1 < y0) { float t; t = x0; x0 = x1; x1 = t; t = y0; y0 = y1; y1 = t; }
if (y2 < y0) { float t; t = x0; x0 = x2; x2 = t; t = y0; y0 = y2; y2 = t; }
if (y2 < y1) { float t; t = x1; x1 = x2; x2 = t; t = y1; y1 = y2; y2 = t; }
if (y2 - y0 < 0.5f) return;
int yA = (int)ceilf(y0), yB = (int)y2;
if (yA < 0) yA = 0;
if (yB > H - 1) yB = H - 1;
for (int y = yA; y <= yB; y++) {
float yc = (float)y + 0.5f;
float t = (yc - y0) / (y2 - y0);
if (t < 0) t = 0;
if (t > 1) t = 1;
float xa = x0 + (x2 - x0) * t;
float xb;
if (yc < y1) {
float t2 = (y1 - y0 < 0.5f) ? 1.0f : (yc - y0) / (y1 - y0);
if (t2 < 0) t2 = 0;
if (t2 > 1) t2 = 1;
xb = x0 + (x1 - x0) * t2;
} else {
float t2 = (y2 - y1 < 0.5f) ? 0.0f : (yc - y1) / (y2 - y1);
if (t2 < 0) t2 = 0;
if (t2 > 1) t2 = 1;
xb = x1 + (x2 - x1) * t2;
}
hline(y, (int)floorf(xa), (int)ceilf(xb), c);
}
}
static void fillQuad(float x0, float y0, float x1, float y1,
float x2, float y2, float x3, float y3, uint32_t c) {
fillTri(x0, y0, x1, y1, x2, y2, c);
fillTri(x0, y0, x2, y2, x3, y3, c);
}
// --- Camera ------------------------------------------------------------------
// Orbiting camera: position camPos, looking at lookAt, up = world +Z.
// Basis vectors are rebuilt each frame; project() does the perspective divide.
static float camPos[3] = { 20, -6, 30 };
static float lookAt[3] = { 20, 12, 0 };
static float camF[3], camR[3], camU[3];
static float FX = 235.0f; // focal length (zoom)
static const float FAR_D = 44.0f; // fog distance (camera units)
static void updateBasis() {
// forward = normalize(lookAt - camPos)
float f[3] = { lookAt[0] - camPos[0], lookAt[1] - camPos[1], lookAt[2] - camPos[2] };
float fl = sqrtf(f[0] * f[0] + f[1] * f[1] + f[2] * f[2]);
for (int i = 0; i < 3; i++) f[i] /= fl;
// right = normalize(cross(f, worldUp)); up = cross(right, f)
float r[3] = { f[1] * 1.0f - f[2] * 0.0f, f[2] * 0.0f - f[0] * 1.0f, f[0] * 0.0f - f[1] * 0.0f };
// cross(f, (0,0,1)) = (f.y*1 - f.z*0, f.z*0 - f.x*1, f.x*0 - f.y*0)
r[0] = f[1]; r[1] = -f[0]; r[2] = 0;
float rl = sqrtf(r[0] * r[0] + r[1] * r[1]);
if (rl < 1e-4f) { r[0] = 1; r[1] = 0; r[2] = 0; } else { r[0] /= rl; r[1] /= rl; }
float u[3] = {
r[1] * f[2] - r[2] * f[1],
r[2] * f[0] - r[0] * f[2],
r[0] * f[1] - r[1] * f[0]
};
for (int i = 0; i < 3; i++) { camF[i] = f[i]; camR[i] = r[i]; camU[i] = u[i]; }
}
// Project a world point (X = west-east, Y = south-north, Z = up).
// Returns false if behind the near plane.
static inline bool project(float X, float Y, float Z, int &sx, int &sy, float &depth) {
float d[3] = { X - camPos[0], Y - camPos[1], Z - camPos[2] };
float rz = d[0] * camF[0] + d[1] * camF[1] + d[2] * camF[2];
if (rz < 0.6f) return false;
float rx = d[0] * camR[0] + d[1] * camR[1] + d[2] * camR[2];
float ry = d[0] * camU[0] + d[1] * camU[1] + d[2] * camU[2];
sx = (int)(160.0f + rx * FX / rz);
sy = (int)(120.0f - ry * FX / rz);
depth = rz;
return true;
}
// Depth fog factor for a camera-space distance.
static inline float fogFor(float d) {
float f = 1.0f - d / FAR_D;
if (f < 0.60f) f = 0.60f;
if (f > 1.0f) f = 1.0f;
return f;
}
// --- Solid shaded box (painter's algorithm, backface culled) -----------------
struct Box {
float x, y; // center on the floor
float hx, hy; // half extents
float z0, z1; // base / top height
uint32_t col;
};
// Face corner indices into an 8-corner box, and world normals.
static const int FACES[6][4] = {
{0,1,2,3}, // top (+Z)
{4,5,6,7}, // bottom (-Z, rarely seen)
{0,1,5,4}, // -Y side
{2,3,7,6}, // +Y side
{1,2,6,5}, // +X side
{0,3,7,4}, // -X side
};
static const float NORMALS[6][3] = {
{0,0,1}, {0,0,-1}, {0,-1,0}, {0,1,0}, {1,0,0}, {-1,0,0},
};
static const float LIGHT[3] = { -0.35f, -0.25f, 0.90f }; // from above, slight SW
static void drawBox(const Box &b, float dist) {
// 8 corners: bottom 0-3 (CCW seen from above), top 4-7
static const float SIGN[8][3] = {
{-1,-1,0},{1,-1,0},{1,1,0},{-1,1,0},
{-1,-1,1},{1,-1,1},{1,1,1},{-1,1,1},
};
int px[8], py[8];
bool vis[8];
float fog = fogFor(dist);
int minX = W, maxX = -1, minY = H, maxY = -1;
for (int i = 0; i < 8; i++) {
float X = b.x + SIGN[i][0] * b.hx;
float Y = b.y + SIGN[i][1] * b.hy;
float Z = SIGN[i][2] ? b.z1 : b.z0;
float d;
vis[i] = project(X, Y, Z, px[i], py[i], d);
if (vis[i]) {
if (px[i] < minX) minX = px[i];
if (px[i] > maxX) maxX = px[i];
if (py[i] < minY) minY = py[i];
if (py[i] > maxY) maxY = py[i];
}
}
if (maxX < 0 || minX >= W || maxY < 0 || minY >= H) return; // offscreen
for (int f = 0; f < 6; f++) {
const int *q = FACES[f];
bool ok = true;
for (int k = 0; k < 4; k++) if (!vis[q[k]]) { ok = false; break; }
if (!ok) continue;
// backface cull: skip faces pointing away from the camera
float fcx = b.x + NORMALS[f][0] * b.hx;
float fcy = b.y + NORMALS[f][1] * b.hy;
float fcz = (NORMALS[f][2] > 0) ? b.z1 : (NORMALS[f][2] < 0 ? b.z0 : (b.z0 + b.z1) * 0.5f);
float toCam[3] = { camPos[0] - fcx, camPos[1] - fcy, camPos[2] - fcz };
float nd = NORMALS[f][0] * toCam[0] + NORMALS[f][1] * toCam[1] + NORMALS[f][2] * toCam[2];
if (nd <= 0.001f) continue;
float ndl = NORMALS[f][0] * LIGHT[0] + NORMALS[f][1] * LIGHT[1] + NORMALS[f][2] * LIGHT[2];
if (ndl < 0.55f) ndl = 0.55f;
uint32_t col = dimColor(b.col, ndl * fog);
fillQuad((float)px[q[0]], (float)py[q[0]],
(float)px[q[1]], (float)py[q[1]],
(float)px[q[2]], (float)py[q[2]],
(float)px[q[3]], (float)py[q[3]], col);
// bright rim on the top edges (f == 0 is the top face)
if (f == 0) {
uint32_t rim = dimColor(b.col, (0.55f + 0.45f * ndl) * fog);
drawLine(px[q[0]], py[q[0]], px[q[1]], py[q[1]], rim);
drawLine(px[q[1]], py[q[1]], px[q[2]], py[q[2]], rim);
drawLine(px[q[2]], py[q[2]], px[q[3]], py[q[3]], rim);
drawLine(px[q[3]], py[q[3]], px[q[0]], py[q[0]], rim);
}
}
}
// Distance from the camera to a box center (for fog + depth sort).
static inline float boxDist(const Box &b) {
float dx = b.x - camPos[0], dy = b.y - camPos[1];
float dz = (b.z0 + b.z1) * 0.5f - camPos[2];
return sqrtf(dx * dx + dy * dy + dz * dz);
}
// --- World state --------------------------------------------------------------
static nd::DemoMapSource mapSource;
struct Walker {
float ax, ay, bx, by; // patrol endpoints (world units, tile centers)
float t; // 0..1 along the route
float dir; // +1 or -1
float speed; // tiles per second
uint8_t kind;
};
static const int MAX_WALKERS = nd::MAX_UNITS > 20 ? nd::MAX_UNITS : 20;
static Walker walkers[MAX_WALKERS];
static int walkerCount = 0;
static void buildWalkers() {
walkerCount = 0;
for (int i = 0; i < mapSource.spawnCount() && walkerCount < MAX_WALKERS; i++) {
const nd::UnitSpawn &s = mapSource.spawn(i);
Walker &w = walkers[walkerCount];
w.ax = (s.tx % nd::TILE_COLS) + 0.5f;
w.ay = (s.tx / nd::TILE_COLS) + 0.5f;
if (s.patA >= 0 && s.patB >= 0) {
w.bx = (s.patA % nd::TILE_COLS) + 0.5f;
w.by = (s.patA / nd::TILE_COLS) + 0.5f;
} else {
w.bx = w.ax; w.by = w.ay; // stationary
}
w.t = 0;
w.dir = 1;
w.speed = (s.kind == 2) ? 0.0f : (s.kind == 3 ? 0.0f : 1.1f + (i % 3) * 0.15f);
w.kind = s.kind;
walkerCount++;
}
}
static inline float lerp(float a, float b, float t) { return a + (b - a) * t; }
// --- Setup --------------------------------------------------------------------
void setup() {
buildWalkers();
// initial camera pose: south of the map, looking north at the deck
camPos[0] = 20.0f; camPos[1] = 12.0f - 22.0f; camPos[2] = 30.0f;
}
// --- Loop ----------------------------------------------------------------------
void loop() {
// --- input ---
static float orbitSpeed = 0.10f; // rad/s
static bool paused = false;
while (!emu::keyboard.empty()) {
uint8_t k = emu::keyboard.front();
emu::keyboard.pop_front();
if (k == 'q' || k == 0x1b) { emu::quitRequested = true; }
if (k == 'a') { orbitSpeed += 0.03f; if (orbitSpeed > 0.60f) orbitSpeed = 0.60f; }
if (k == 'd') { orbitSpeed -= 0.03f; if (orbitSpeed < -0.60f) orbitSpeed = -0.60f; }
if (k == 'w') { FX += 18.0f; if (FX > 320.0f) FX = 320.0f; }
if (k == 's') { FX -= 18.0f; if (FX < 90.0f) FX = 90.0f; }
if (k == 'r') { camPos[2] += 2.0f; if (camPos[2] > 60.0f) camPos[2] = 60.0f; }
if (k == 'f') { camPos[2] -= 2.0f; if (camPos[2] < 14.0f) camPos[2] = 14.0f; }
if (k == ' ') paused = !paused;
}
// --- delta time ---
static unsigned long lastMs = 0;
unsigned long now = millis();
float dt = lastMs ? (now - lastMs) / 1000.0f : 1.0f / 60.0f;
lastMs = now;
if (dt > 0.1f) dt = 0.1f;
// --- camera drift: slow orbit + breathing radius/height ---
static float orbit = 0.0f; // angle around the map center
static float breathe = 0.0f;
if (!paused) {
orbit += orbitSpeed * dt;
breathe += dt * 0.35f;
}
float radius = 15.0f + 3.0f * sinf(breathe * 0.7f);
float height = 21.0f + 3.5f * sinf(breathe * 0.45f + 1.3f);
lookAt[0] = 20.0f + 1.5f * sinf(breathe * 0.5f);
lookAt[1] = 12.0f + 1.0f * cosf(breathe * 0.33f);
camPos[0] = lookAt[0] + cosf(orbit) * radius;
camPos[1] = lookAt[1] + sinf(orbit) * radius;
camPos[2] = height;
updateBasis();
// --- entities walk their patrol routes ---
if (!paused) {
for (int i = 0; i < walkerCount; i++) {
Walker &w = walkers[i];
if (w.speed <= 0) continue;
float len = sqrtf((w.bx - w.ax) * (w.bx - w.ax) + (w.by - w.ay) * (w.by - w.ay));
if (len < 0.01f) continue;
w.t += w.dir * w.speed * dt / len;
if (w.t > 1) { w.t = 1; w.dir = -1; }
if (w.t < 0) { w.t = 0; w.dir = 1; }
}
}
// --- clear framebuffer ---
for (int i = 0; i < W * H; i++) emuGfx::fb[i] = 0xFF080014;
// --- floor: flat lit quads for every non-wall tile, checker shaded ---
for (int ty = 0; ty < nd::TILE_ROWS; ty++) {
for (int tx = 0; tx < nd::TILE_COLS; tx++) {
char ch = mapSource.tileAt(tx, ty);
if (ch == '#') continue;
uint32_t base = ((tx + ty) & 1) ? COL_FLOOR_B : COL_FLOOR_A;
int px[4], py[4];
float d;
bool ok = true;
const float OFF[4][2] = { {0,0},{1,0},{1,1},{0,1} };
for (int k = 0; k < 4; k++)
if (!project((float)(tx + OFF[k][0]), (float)(ty + OFF[k][1]), 0.0f, px[k], py[k], d)) { ok = false; break; }
if (!ok) continue;
if (px[0] < -8 && px[1] < -8 && px[2] < -8 && px[3] < -8) continue;
if (px[0] > W + 8 && px[1] > W + 8 && px[2] > W + 8 && px[3] > W + 8) continue;
float cx = tx + 0.5f, cy = ty + 0.5f;
fillQuad((float)px[0], (float)py[0], (float)px[1], (float)py[1],
(float)px[2], (float)py[2], (float)px[3], (float)py[3],
dimColor(base, fogFor(sqrtf((cx - camPos[0]) * (cx - camPos[0]) +
(cy - camPos[1]) * (cy - camPos[1]) +
camPos[2] * camPos[2]))));
}
}
// --- collect solid geometry: walls, crates, door, terminal, node pylons ---
struct Solid { Box b; };
static Solid solids[1024];
int nSolids = 0;
for (int ty = 0; ty < nd::TILE_ROWS; ty++) {
for (int tx = 0; tx < nd::TILE_COLS; tx++) {
char ch = mapSource.tileAt(tx, ty);
if (ch == '.') continue;
Box b;
b.x = tx + 0.5f; b.y = ty + 0.5f;
b.z0 = 0.0f;
b.hx = b.hy = 0.5f;
switch (ch) {
case '#': b.z1 = 1.6f; b.col = COL_WALL; break;
case 'o': b.z1 = 0.9f; b.col = COL_CRATE; break;
case '+': b.z1 = 1.3f; b.col = COL_DOOR; break;
case 'T': b.z1 = 0.7f; b.col = COL_TERMINAL; break;
case 'A': b.z1 = 0.15f; b.col = COL_AIRLOCK; break;
default: continue;
}
solids[nSolids++].b = b;
}
}
// network nodes: glowing pylons at their pinned tiles
static Box nodeBoxes[nd::MAX_NODES];
for (int i = 0; i < mapSource.nodeCount(); i++) {
const nd::NetNodeDef &n = mapSource.node(i);
Box &b = nodeBoxes[i];
b.x = n.tx + 0.5f; b.y = n.ty + 0.5f;
b.hx = b.hy = 0.28f;
b.z0 = 0.0f;
b.z1 = 1.9f;
// RGB565 -> ABGR8888
uint32_t r5 = ((n.color >> 11) & 31) * 8;
uint32_t g6 = ((n.color >> 5) & 63) * 4;
uint32_t b5 = (n.color & 31) * 8;
b.col = 0xFF000000u | (b5 << 16) | (g6 << 8) | r5;
solids[nSolids++].b = b;
}
// --- entities as small glowing boxes ---
static Box entBoxes[MAX_WALKERS];
for (int i = 0; i < walkerCount; i++) {
const Walker &w = walkers[i];
Box &b = entBoxes[i];
b.x = lerp(w.ax, w.bx, w.t);
b.y = lerp(w.ay, w.by, w.t);
b.hx = b.hy = 0.30f;
b.z0 = 0.0f;
b.z1 = (w.kind == 3) ? 0.45f : (w.kind == 2 ? 0.85f : 0.65f);
b.col = (w.kind == 0) ? COL_MARINE : (w.kind == 1) ? COL_DROID
: (w.kind == 2) ? COL_HEAVY : COL_TURRET;
solids[nSolids++].b = b;
}
// --- depth sort far -> near (painter's algorithm) ---
static float dists[1024 + nd::MAX_NODES + MAX_WALKERS];
static int order[1024 + nd::MAX_NODES + MAX_WALKERS];
for (int i = 0; i < nSolids; i++) { dists[i] = boxDist(solids[i].b); order[i] = i; }
for (int a = 1; a < nSolids; a++) {
int v = order[a], j = a - 1;
while (j >= 0 && dists[order[j]] < dists[v]) { order[j + 1] = order[j]; j--; }
order[j + 1] = v;
}
for (int i = 0; i < nSolids; i++) drawBox(solids[order[i]].b, dists[order[i]]);
// --- network links + traveling packets (overhead lines between pylon tops)
for (int e = 0; e < mapSource.edgeCount(); e++) {
const nd::NetEdgeDef &ed = mapSource.edge(e);
const nd::NetNodeDef &na = mapSource.node(ed.a);
const nd::NetNodeDef &nb = mapSource.node(ed.b);
float ax = na.tx + 0.5f, ay = na.ty + 0.5f;
float bx = nb.tx + 0.5f, by = nb.ty + 0.5f;
int x0, y0, x1, y1;
float d0, d1;
if (!project(ax, ay, 1.9f, x0, y0, d0)) continue;
if (!project(bx, by, 1.9f, x1, y1, d1)) continue;
drawLine(x0, y0, x1, y1, dimColor(COL_LINK, fogFor((d0 + d1) * 0.5f)));
// packet: a small bright dot sweeping the edge
float ph = fmodf(now / 1000.0f * 0.35f + e * 0.37f, 1.0f);
int pkx, pky;
float pdd;
if (project(lerp(ax, bx, ph), lerp(ay, by, ph), 1.9f + 0.15f, pkx, pky, pdd)) {
int r = (int)(0.14f * FX / pdd);
if (r < 1) r = 1;
if (r > 4) r = 4;
fillCircle(pkx, pky, r, dimColor(COL_PACKET, fogFor(pdd)));
}
}
// --- pulsing halo over the airlock tile (squad entry marker) ---
{
int ax_, ay_;
float dd;
const nd::NetNodeDef &root = mapSource.node(mapSource.rootNode());
if (project(root.tx + 0.5f, root.ty + 0.5f, 0.2f, ax_, ay_, dd)) {
int r = (int)(0.55f * FX / dd) + (int)(2.0f * sinf(now / 1000.0f * 3.0f));
if (r > 2) fillCircle(ax_, ay_, r, (dimColor(COL_AIRLOCK, 0.35f) & 0x00FFFFFF) | 0x50000000);
}
}
emuGfx::dirty = true;
}