byte SplinterControlPaddle() { // Look for 'p' to pause the game *CoCoMiscKeyboardScanOutput = 0xfe; byte pausePressed = ((*CoCoMiscKeyboardScanInput & 0x4) == 0x0); if (pausePressed) SplinterPauseGame(); // Look for the 'break' to quit the game *CoCoMiscKeyboardScanOutput = 0xfb; byte breakPressed = ((*CoCoMiscKeyboardScanInput & 0x40) == 0x0); if (breakPressed && SplinterQuitGame()) return TRUE; // Look for up arrow *CoCoMiscKeyboardScanOutput = 0xf7; byte upPressed = ((*CoCoMiscKeyboardScanInput & 0x8) == 0x0); // Look for down arrow *CoCoMiscKeyboardScanOutput = 0xef; byte downPressed = ((*CoCoMiscKeyboardScanInput & 0x8) == 0x0); // Figure out the direction if (upPressed && downPressed) { if (SplinterFirstDirection == SplinterLastDirectionUp) SplinterLastDirection = SplinterLastDirectionDown; else if (SplinterFirstDirection == SplinterLastDirectionDown) SplinterLastDirection = SplinterLastDirectionUp; else SplinterLastDirection = SplinterLastDirectionNone; } else if (upPressed) { SplinterLastDirection = SplinterLastDirectionUp; SplinterFirstDirection = SplinterLastDirectionUp; } else if (downPressed) { SplinterLastDirection = SplinterLastDirectionDown; SplinterFirstDirection = SplinterLastDirectionDown; } else { SplinterLastDirection = SplinterLastDirectionNone; SplinterFirstDirection = SplinterLastDirectionNone; } // Move the paddle if (SplinterLastDirection == SplinterLastDirectionUp) { if (splinterPaddlePosition > 0) { BlitterFillRectangle(8, splinterPaddlePosition + 36, 4, 3, 0); splinterPaddlePosition -= 3; } } else if (SplinterLastDirection == SplinterLastDirectionDown) { if (splinterPaddlePosition < 148) { BlitterFillRectangle(8, splinterPaddlePosition, 4, 3, 0); splinterPaddlePosition += 3; } } // Draw the paddle BlitterDrawGraphics(GrafxDataPaddleData, 4, splinterPaddlePosition); return FALSE; }
void BricksRefresh() { for (byte ii=0; ii<brickXPositionsSz; ii++) { byte xpos = 2 * brickXPositions[ii]; byte color = brickColors[ii]; byte *brickYPositions = lineBrickYPositions[ii]; for (byte jj=0; jj<brickYPositionsSz; jj++) { byte brickYPosition = brickYPositions[jj]; if (brickYPosition != 0xff) { BlitterFillRectangle(xpos, brickYPosition, 5, 10, 7); BlitterFillRectangle(xpos+1, brickYPosition+1, 3, 8, color); } } } }
void SplinterDrawDialogBox(unsigned ww, unsigned hh, byte f, byte b) { unsigned xx = (40 - ww)/2, yy = (24 - hh)/2; // Locations in pixel coordinates unsigned x = xx * 8, y = yy * 8; unsigned w = ww * 8 - 8, h = hh * 8 - 8; f = 14; b = 0; // White out the selected area BlitterFillRectangle(x, y, w + 8, h + 8, b); // Draw corners BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x, y, 0, "{"); BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x + w, y, 0, "}"); BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x, y + h, 0, "["); BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x + w, y + h, 0, "]"); // Draw Horizontal Edges for(unsigned ii = 8; ii < w; ii += 8) { BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, ii + x, y, 0, "_"); BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, ii + x, y + h, 0, "_"); } // Draw Vertical Edges for(byte ii=8; ii<h; ii+=8) { BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x, ii + y, 0, "~"); BlitterDrawText(FontDataFontIndex, FontDataFontData, 7, b, x + w, ii + y, 0, "~"); } }
void SplinterEraseDialogBox(unsigned ww, unsigned hh, byte b) { unsigned xx = (40 - ww)/2; unsigned yy = (24 - hh)/2; // Locations in pixel coordinates unsigned x = xx * 8; unsigned y = yy * 8; unsigned w = ww * 8; unsigned h = hh * 8; // White out the selected area BlitterFillRectangle(x, y, w, h, b); }
void SplinterShowTitleScreen() { BlitterClearScreen(0); // Draw the border byte b = 0, f = 14; SplinterDrawBorderedScreen(7, b); // Draw the title unsigned int x = 0, y = 0; BlitterDrawText2(FontDataFontIndex, FontDataFontData, 15, x + 120, y + 11, 2, "Splinter 1"); BlitterDrawText2(FontDataFontIndex, FontDataFontData, 2, x + 119, y + 10, 2, "Splinter 1"); y = 2; BlitterFillRectangle(60, y + 25, 200, 131, f); BlitterFillRectangle(61, y + 26, 198, 129, b); BlitterDrawGraphics(GrafxDataPaddleData, 33, (byte)y + 70); BlitterDrawGraphics(GrafxDataBallData, 53, (byte)y + 89); for(int ii=0; ii<128; ii += 8) { int yy = y + 27 + ii; BlitterFillRectangle(156, yy, 4, 7, 7); BlitterFillRectangle(156 + 1, yy + 1, 2, 5, 1); BlitterFillRectangle(171, yy, 4, 7, 7); BlitterFillRectangle(171 + 1, yy + 1, 2, 5, 3); BlitterFillRectangle(186, yy, 4, 7, 7); BlitterFillRectangle(186 + 1, yy + 1, 2, 5, 9); BlitterFillRectangle(201, yy, 4, 7, 7); BlitterFillRectangle(201 + 1, yy + 1, 2, 5, 5); BlitterFillRectangle(216, yy, 4, 7, 7); BlitterFillRectangle(216 + 1, yy + 1, 2, 5, 14); BlitterFillRectangle(231, yy, 4, 7, 7); BlitterFillRectangle(231 + 1, yy + 1, 2, 5, 14); BlitterFillRectangle(246, yy, 4, 7, 7); BlitterFillRectangle(246 + 1, yy + 1, 2, 5, 10); } BlitterDrawText(FontDataFontIndex, FontDataFontData, f, b, 74, 168, 1, "Press Any Key to Play"); CoCoMiscFadeIn(splinterRGBColorPalette, splinterCMPColorPalette, SPLINTER_FADE_DELAY, 0); waitkey(0); CoCoMiscFadeOut(splinterRGBColorPalette, splinterCMPColorPalette, SPLINTER_FADE_DELAY, b); }