Skip to content

Commit

Permalink
making more use of cx16's bigger screen, minor cplayer improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
steph72 committed Jan 11, 2020
1 parent b50c22e commit 8581bff
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 34 deletions.
Binary file modified disc/kkniffel.dsk
Binary file not shown.
3 changes: 3 additions & 0 deletions src/apple2/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "../io.h"
#include "../chargen.h"

const char *gTitle = " * kkniffel/apple2 * ";


const unsigned char colTable = 5;
const unsigned char colLegend = 14;

Expand Down
24 changes: 15 additions & 9 deletions src/c128/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
#include "../io.h"
#include "../chargen.h"

const char *gTitle = " * kkniffel/c128 * ";

const unsigned char colTable = 5;
const unsigned char colLegend = 14;

const unsigned char colBackground = 0;
const unsigned char colBorder = 0;
const unsigned char colText = 5;

const unsigned char colDice = COLOR_ORANGE;


const unsigned char colSplash = 4;
const unsigned char colSplashRed = 2;

Expand All @@ -40,15 +45,6 @@ void startup(void)
clrscr();
}

void initIO(void)
{
// TODO
}

void initDiceDisplay(void)
{
setDiceColor(COLOR_ORANGE);
}

void setDiceColor(unsigned char color)
{
Expand All @@ -62,6 +58,16 @@ void setDiceColor(unsigned char color)
}
}

void initIO(void)
{
// TODO
}

void initDiceDisplay(void)
{
setDiceColor(COLOR_ORANGE);
}

void __fastcall__ _plotDice(unsigned char value, unsigned char x, unsigned char y, char r)
{
register unsigned char c;
Expand Down
5 changes: 5 additions & 0 deletions src/c64/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#define screen (unsigned char *)51200u
#define screenP (unsigned char *)648u // screen pointer for kernel

const char *gTitle = " * kkniffel/c64 * ";

void installCharset(void);
void setDiceColor(unsigned char color);

Expand All @@ -24,6 +26,9 @@ const unsigned char colText = 5;
const unsigned char colSplash = 4;
const unsigned char colSplashRed = 2;

const unsigned char colDice = COLOR_ORANGE;


const unsigned char colTempValue = 11; // temporary roll:
const unsigned char colEvenValue = 5; // even row roll: green
const unsigned char colOddValue = 13; // odd row roll: light green
Expand Down
4 changes: 4 additions & 0 deletions src/cx16/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define screen 0
#define COLOR_RAM 2048

const char *gTitle = " * kkniffel/cx16 * ";

void installCharset(void);
void setDiceColor(unsigned char color);

Expand All @@ -18,6 +20,8 @@ const unsigned char colText = 5;
const unsigned char colSplash = COLOR_GREEN;
const unsigned char colSplashRed = COLOR_ORANGE;

const unsigned char colDice = COLOR_ORANGE;

const unsigned char colTempValue = COLOR_GRAY2; // temporary roll:
const unsigned char colEvenValue = COLOR_GREEN; // even row roll: green
const unsigned char colOddValue = COLOR_LIGHTGREEN; // odd row roll: light green
Expand Down
3 changes: 3 additions & 0 deletions src/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ void eraseDie(unsigned char nr);

void initDiceDisplay(void);

extern const char *gTitle;
extern const char dice[6][25];

extern const unsigned char colBackground;
extern const unsigned char colBorder;
extern const unsigned char colText;

extern const unsigned char colDice;

extern const unsigned char colSplash;
extern const unsigned char colSplashRed;

Expand Down
101 changes: 76 additions & 25 deletions src/kkniffel.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,20 @@ void doTurnRoll()
{
if (!benchmarkMode)

#ifndef __APPLE2__
j = getJiffies();
do {
#endif
#ifndef __APPLE2__
j = getJiffies();
do
{
#endif

for (i = 0; i < 20; ++i)
{
doSingleRoll();
}

#ifndef __APPLE2__
} while (getJiffies()-j<60);
#endif

#ifndef __APPLE2__
} while (getJiffies() - j < 60);
#endif
}
else
{
Expand Down Expand Up @@ -536,44 +536,95 @@ void startBenchmarkMode()
srand(seed);
}

void startgame()
void bannerDice()
{
char i;

textcolor(colSplash);
textcolor(colDice);

clrscr();
for (i = 0; i < 8; ++i)
{
_plotDice(1 + (rand() % 6), i * 5, 0, 0);
_plotDice(1 + (rand() % 6), i * 5, BOTTOMY - 4, 0);
}
}

void displayCredits()
{
bannerDice();
textcolor(colText);
revers(1);
centerLine(7, " * k k n i f f e l * ");
revers(0);
centerLine(9, "written by stephan kleinert");
centerLine(10, "at k-burg, bad honnef and");
centerLine(11, "at hundehaus im reinhardswald");
centerLine(12, "2019/20");
centerLine(14, "with very special thanks to");
centerLine(15, "frau k., buba k. candor k.");
centerLine(16, "and the seven turtles!");
centerLine(18, "-- key --");
cgetc();
}

void displayInstructions()
{
bannerDice();
textcolor(colText);
revers(1);
centerLine(6, " * k k n i f f e l * ");
centerLine(7, " * instructions * ");
revers(0);
centerLine(8, "- version 2.4 -");
centerLine(10, "written by stephan kleinert");
centerLine(11, "at k-burg, bad honnef, 2019-2020");
centerLine(12, "with special thanks to frau k.,");
centerLine(13, "buba k., candor k. and of course");
centerLine(14, "to the 7 turtles.");
textcolor(colLowerSum);
centerLine(16, "how many players (2-4)?");
centerLine(9, "game keys:");
centerLine(11, "<return> to roll or reroll the dice");
centerLine(13, "<1-6> to select dice to reroll");
centerLine(14, "<a-m> to choose category to score");
centerLine(16, "<s> to sort the dice");
centerLine(18, "-- key --");
cgetc();
}

void startgame()
{
char i;
char c;
char promptTopRow;

promptTopRow = (BOTTOMY / 2) - 5;

while (numPlayers < 2 || numPlayers > 4)
do
{
bannerDice();
textcolor(colText);

revers(1);
centerLine(promptTopRow, (char *)gTitle);
revers(0);
centerLine(promptTopRow + 2, "- version 2.32 -");
centerLine(promptTopRow + 3, "written by stephan kleinert");
textcolor(colBonus);
centerLine(promptTopRow + 8, "or type 'i' for instructions");
centerLine(promptTopRow + 9, "or 'c' for credits");
textcolor(colLowerSum);
centerLine(promptTopRow + 6, "how many players (2-4)?");

cursor(1);
numPlayers = cgetc() - '0';
c = cgetc();
numPlayers = c - '0';
cursor(0);
if (numPlayers == 18)
{ // 'b' typed
if (c == 'i')
{
displayInstructions();
}
else if (c == 'c')
{
displayCredits();
}
else if (c == '#')
{
startBenchmarkMode();
return;
}
}
} while (numPlayers < 2 || numPlayers > 4);

clrscr();

Expand Down
2 changes: 2 additions & 0 deletions src/pet/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "../io.h"
#include "../chargen.h"

const char *gTitle = " * kkniffel/pet * ";

const unsigned char colTable = 5;
const unsigned char colLegend = 14;

Expand Down
6 changes: 6 additions & 0 deletions src/plus4/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
#include "../io.h"
#include "../chargen.h"

const char *gTitle = " * kkniffel/ted * ";


const unsigned char colBackground = BCOLOR_BLACK;
const unsigned char colBorder = BCOLOR_BLACK;
const unsigned char colText = BCOLOR_BLUEGREEN + CATTR_LUMA4;

const unsigned char colSplash = BCOLOR_PURPLE + CATTR_LUMA3;
const unsigned char colSplashRed = BCOLOR_RED + CATTR_LUMA3;

const unsigned char colDice = COLOR_ORANGE;


const unsigned char colTable = BCOLOR_CYAN + CATTR_LUMA0;
const unsigned char colLegend = BCOLOR_LIGHTBLUE + CATTR_LUMA3;

Expand Down

0 comments on commit 8581bff

Please sign in to comment.