Compare commits

...
3 Commits
Author SHA1 Message Date
GuyPerfect 31b7403252 Correction for negative affine parallax 2026-05-21 16:23:23 -05:00
GuyPerfect 29ade46a0a Fix for affine parameter address resolution 2026-03-28 16:46:32 -05:00
GuyPerfect 534ce852f4 Adjust brightness values 2025-11-23 12:08:36 -06:00
+22 -16
View File
@@ -41,16 +41,17 @@ static const uint8_t BG_TEMPLATES[][64] = {
}; };
/* 8-bit color magnitude by brightness level */ /* 8-bit color magnitude by brightness level */
/* Generated as BRIGHT8[n] = round((n / 132) ** 1.6 * 255) */
static const uint8_t BRIGHT8[] = { static const uint8_t BRIGHT8[] = {
0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 28, 0, 12, 19, 24, 29, 33, 37, 41, 44, 48, 51, 54, 57, 60, 63, 65,
30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 57, 59, 68, 71, 73, 76, 78, 81, 83, 86, 88, 90, 92, 95, 97, 99,101,103,
61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 105,107,109,111,113,115,117,119,121,123,125,127,128,130,132,134,
92, 94, 96, 98,100,102,104,106,108,110,112,113,115,117,119,121, 136,137,139,141,142,144,146,148,149,151,153,154,156,157,159,161,
123,125,127,129,131,133,135,137,139,141,142,144,146,148,150,152, 162,164,165,167,168,170,172,173,175,176,178,179,181,182,184,185,
154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183, 186,188,189,191,192,194,195,197,198,199,201,202,203,205,206,208,
185,187,189,191,193,195,197,198,200,202,204,206,208,210,212,214, 209,210,212,213,214,216,217,218,220,221,222,224,225,226,228,229,
216,218,220,222,224,226,227,229,231,233,235,237,239,241,243,245, 230,231,233,234,235,236,238,239,240,242,243,244,245,246,248,249,
247,249,251,253,255 250,251,253,254,255
}; };
@@ -1004,7 +1005,7 @@ static void vipDrawAffine(VB *sim, World *world) {
Cell *cell; /* Source cell */ Cell *cell; /* Source cell */
uint8_t *col, *row; /* Output pixel */ uint8_t *col, *row; /* Output pixel */
uint8_t pixel; /* Character pixel value */ uint8_t pixel; /* Character pixel value */
uint8_t *param; /* World parameter memory */ uint32_t param; /* World parameter memory */
int32_t px, py; /* Pixel source coordinates */ int32_t px, py; /* Pixel source coordinates */
int32_t dx, dy, mp, mx, my; /* Affine parameters */ int32_t dx, dy, mp, mx, my; /* Affine parameters */
int32_t wx; /* Base world X coordinate */ int32_t wx; /* Base world X coordinate */
@@ -1051,21 +1052,26 @@ static void vipDrawAffine(VB *sim, World *world) {
wx = x1 - wx; wx = x1 - wx;
/* Process all visible rows */ /* Process all visible rows */
param = &sim->vip.ram[world->paramBase | (y1 - world->gy) << 4]; param = world->paramBase + ((y1 - world->gy) << 4);
row = &sim->vip.shadow[i][x1 * 224 + y1]; row = &sim->vip.shadow[i][x1 * 224 + y1];
for (y = y1; y < y2; y++, param += 16, row++) { for (y = y1; y < y2; y++, param += 16, row++) {
/* Parse line parameters */ /* Parse line parameters */
mx = (int32_t) busReadBuffer(param + 0, VB_S16) << 6; mx = (int32_t) busReadBuffer(&sim->vip.ram[param | 0], VB_S16) << 6;
mp = (int32_t) busReadBuffer(param + 2, VB_S16); mp = (int32_t) busReadBuffer(&sim->vip.ram[param | 2], VB_S16);
my = (int32_t) busReadBuffer(param + 4, VB_S16) << 6; my = (int32_t) busReadBuffer(&sim->vip.ram[param | 4], VB_S16) << 6;
dx = (int32_t) busReadBuffer(param + 6, VB_S16); dx = (int32_t) busReadBuffer(&sim->vip.ram[param | 6], VB_S16);
dy = (int32_t) busReadBuffer(param + 8, VB_S16); dy = (int32_t) busReadBuffer(&sim->vip.ram[param | 8], VB_S16);
/* Adjust left-edge parameters */ /* Adjust left-edge parameters */
if ((mp < 0) ^ i) { if ((mp < 0) ^ i) {
if (mp < 0) {
mx += dx * (wx - mp);
my += dy * (wx - mp);
} else {
mx += dx * (wx + mp); mx += dx * (wx + mp);
my += dy * (wx + mp); my += dy * (wx + mp);
}
} else { } else {
mx += dx * wx; mx += dx * wx;
my += dy * wx; my += dy * wx;