extern bool show_text; // Whether or not to show text
-
//
// Render the NAMCO screen
//
RenderScreenBuffer();
}
-
//
// Render tilemap
//
for(uint8_t sy=0; sy<29; sy++)
{
for(uint8_t sx=0; sx<37; sx++)
- {
-
DrawChar(sx, sy, ramBase, tileBase << 16, xAddress & 0x07, yAddress & 0x07, transparent);
- }
}
}
-
//
// Draw character on screen
//
}
}
-
//
// Copy sprites in sprite RAM from positions 4-9 to 10-15
-// (N.B.: This still doesn't solve the shifting signs on the walls problem...)
//
void CopySprites(void)
{
}
}
-
//
-// Draw sprites at priority level (new code)
+// Draw sprites at priority level
+// We read from the sprite copy RAM to render sprites, as that seems to be the
+// way the real H/W does it.
//
void DrawSprites(uint8_t priority)
{
//
// Offset Note
// ------ --------------------------------------------------------------------
-// 4 h.fb .nnn (f = horz. flip, h = horz. expand, b = sprite offset lo
+// 4 (10) h.fb .nnn (f = horz. flip, h = horz. expand, b = sprite offset lo
// bit, nnn = upper bits of sprite #)
-// 5 Lower 7 bits of sprite #
-// 6 Sprite color index (top 7 bits only), bottom bit is bit 8 of X
+// 5 (11) Lower 7 bits of sprite #
+// 6 (12) Sprite color index (top 7 bits only), bottom bit is bit 8 of X
// position
-// 7 Sprite X position (bits 0-7)
-// 8 Top two bits are sprite priority, bits 4 & 2 are sprite offset hi
+// 7 (13) Sprite X position (bits 0-7)
+// 8 (14) Top two bits are sprite priority, bits 4 & 2 are sprite offset hi
// bit, vert. expand
-// 9 Sprite Y position (192 - value)
+// 9 (15) Sprite Y position (192 - value)
- extern uint8_t gram1[]; // Game RAM space
+ extern uint8_t gram1[]; // Game RAM space
for(uint16_t i=0x5800; i<0x6000; i+=0x10)
{
- if ((gram1[i + 8 + 6] & 0xC0) == priority) // Check for correct layer...
- {
- spr_color_index = gram1[i + 6 + 6] >> 1; // Set color...
- uint16_t x = ((gram1[i + 6 + 6] & 0x01) << 8) | gram1[i + 7 + 6];
+ uint8_t * sprRAM = &gram1[i];
- if (x > 512 - 32)
- x -= 512; // Handle neg x values
+ // Skip sprite if it's not on the correct layer...
+ if ((sprRAM[14] & 0xC0) != priority)
+ continue;
- uint16_t y = 192 - gram1[i + 9 + 6];
- uint8_t flip = gram1[i + 4 + 6] & 0x20; // Horizontal flip
- uint32_t spr_num = ((gram1[i + 4 + 6] & 0x07) << 9)
- | ((gram1[i + 5 + 6] & 0x7F) << 2)
- | ((gram1[i + 4 + 6] & 0x10) >> 4)
- | ((gram1[i + 8 + 6] & 0x10) >> 3);
+ spr_color_index = sprRAM[12] >> 1; // Set color...
+ uint16_t x = ((sprRAM[12] & 0x01) << 8) | sprRAM[13];
- // Draw sprite...
- Sprite(spr_num, x, y, flip, gram1[i + 4 + 6] & 0x80, gram1[i + 8 + 6] & 0x04);
- }
+ if (x > 512 - 32)
+ x -= 512; // Handle neg x values
+
+ uint16_t y = 192 - sprRAM[15];
+ uint8_t horzFlip = sprRAM[10] & 0x20;
+ uint32_t spr_num = ((sprRAM[10] & 0x07) << 9)
+ | ((sprRAM[11] & 0x7F) << 2)
+ | ((sprRAM[10] & 0x10) >> 4)
+ | ((sprRAM[14] & 0x10) >> 3);
+
+ // Draw the sprite...
+ Sprite(spr_num, x, y, horzFlip, sprRAM[10] & 0x80, sprRAM[14] & 0x04);
}
}
-
static inline void DrawSpriteBlock(uint32_t & sprnum, uint16_t x, uint16_t y, uint16_t xStart, uint16_t xEnd, int16_t xInc)
{
extern uint8_t spr_rom[];
}
}
-
static inline void DrawSpriteBlock2(uint32_t & sprnum, uint16_t x, uint16_t y, uint16_t xStart, uint16_t xEnd, int16_t xInc)
{
extern uint8_t spr_rom[];
}
}
-
//
// Sprite handler
//
}
}
-
int FindPCXName(void)
{
static int pcxNum = -1; // This needs to go elsewhere... (or does it?)
return -1;
}
-
void SavePCXSnapshot(void)
{
char filename[30];
// Success!
fclose(fw);
}
-