Skip to content

Commit 8581bff

Browse files
committed
making more use of cx16's bigger screen, minor cplayer improvements
1 parent b50c22e commit 8581bff

File tree

9 files changed

+114
-34
lines changed

9 files changed

+114
-34
lines changed

disc/kkniffel.dsk

0 Bytes
Binary file not shown.

src/apple2/io.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include "../io.h"
66
#include "../chargen.h"
77

8+
const char *gTitle = " * kkniffel/apple2 * ";
9+
10+
811
const unsigned char colTable = 5;
912
const unsigned char colLegend = 14;
1013

src/c128/io.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88
#include "../io.h"
99
#include "../chargen.h"
1010

11+
const char *gTitle = " * kkniffel/c128 * ";
12+
1113
const unsigned char colTable = 5;
1214
const unsigned char colLegend = 14;
1315

1416
const unsigned char colBackground = 0;
1517
const unsigned char colBorder = 0;
1618
const unsigned char colText = 5;
1719

20+
const unsigned char colDice = COLOR_ORANGE;
21+
22+
1823
const unsigned char colSplash = 4;
1924
const unsigned char colSplashRed = 2;
2025

@@ -40,15 +45,6 @@ void startup(void)
4045
clrscr();
4146
}
4247

43-
void initIO(void)
44-
{
45-
// TODO
46-
}
47-
48-
void initDiceDisplay(void)
49-
{
50-
setDiceColor(COLOR_ORANGE);
51-
}
5248

5349
void setDiceColor(unsigned char color)
5450
{
@@ -62,6 +58,16 @@ void setDiceColor(unsigned char color)
6258
}
6359
}
6460

61+
void initIO(void)
62+
{
63+
// TODO
64+
}
65+
66+
void initDiceDisplay(void)
67+
{
68+
setDiceColor(COLOR_ORANGE);
69+
}
70+
6571
void __fastcall__ _plotDice(unsigned char value, unsigned char x, unsigned char y, char r)
6672
{
6773
register unsigned char c;

src/c64/io.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#define screen (unsigned char *)51200u
1515
#define screenP (unsigned char *)648u // screen pointer for kernel
1616

17+
const char *gTitle = " * kkniffel/c64 * ";
18+
1719
void installCharset(void);
1820
void setDiceColor(unsigned char color);
1921

@@ -24,6 +26,9 @@ const unsigned char colText = 5;
2426
const unsigned char colSplash = 4;
2527
const unsigned char colSplashRed = 2;
2628

29+
const unsigned char colDice = COLOR_ORANGE;
30+
31+
2732
const unsigned char colTempValue = 11; // temporary roll:
2833
const unsigned char colEvenValue = 5; // even row roll: green
2934
const unsigned char colOddValue = 13; // odd row roll: light green

src/cx16/io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define screen 0
99
#define COLOR_RAM 2048
1010

11+
const char *gTitle = " * kkniffel/cx16 * ";
12+
1113
void installCharset(void);
1214
void setDiceColor(unsigned char color);
1315

@@ -18,6 +20,8 @@ const unsigned char colText = 5;
1820
const unsigned char colSplash = COLOR_GREEN;
1921
const unsigned char colSplashRed = COLOR_ORANGE;
2022

23+
const unsigned char colDice = COLOR_ORANGE;
24+
2125
const unsigned char colTempValue = COLOR_GRAY2; // temporary roll:
2226
const unsigned char colEvenValue = COLOR_GREEN; // even row roll: green
2327
const unsigned char colOddValue = COLOR_LIGHTGREEN; // odd row roll: light green

src/io.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ void eraseDie(unsigned char nr);
88

99
void initDiceDisplay(void);
1010

11+
extern const char *gTitle;
1112
extern const char dice[6][25];
1213

1314
extern const unsigned char colBackground;
1415
extern const unsigned char colBorder;
1516
extern const unsigned char colText;
1617

18+
extern const unsigned char colDice;
19+
1720
extern const unsigned char colSplash;
1821
extern const unsigned char colSplashRed;
1922

src/kkniffel.c

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,20 @@ void doTurnRoll()
224224
{
225225
if (!benchmarkMode)
226226

227-
#ifndef __APPLE2__
228-
j = getJiffies();
229-
do {
230-
#endif
227+
#ifndef __APPLE2__
228+
j = getJiffies();
229+
do
230+
{
231+
#endif
231232

232233
for (i = 0; i < 20; ++i)
233234
{
234235
doSingleRoll();
235236
}
236237

237-
#ifndef __APPLE2__
238-
} while (getJiffies()-j<60);
239-
#endif
240-
238+
#ifndef __APPLE2__
239+
} while (getJiffies() - j < 60);
240+
#endif
241241
}
242242
else
243243
{
@@ -536,44 +536,95 @@ void startBenchmarkMode()
536536
srand(seed);
537537
}
538538

539-
void startgame()
539+
void bannerDice()
540540
{
541541
char i;
542-
543-
textcolor(colSplash);
542+
textcolor(colDice);
544543

545544
clrscr();
546545
for (i = 0; i < 8; ++i)
547546
{
548547
_plotDice(1 + (rand() % 6), i * 5, 0, 0);
549548
_plotDice(1 + (rand() % 6), i * 5, BOTTOMY - 4, 0);
550549
}
550+
}
551551

552+
void displayCredits()
553+
{
554+
bannerDice();
552555
textcolor(colText);
556+
revers(1);
557+
centerLine(7, " * k k n i f f e l * ");
558+
revers(0);
559+
centerLine(9, "written by stephan kleinert");
560+
centerLine(10, "at k-burg, bad honnef and");
561+
centerLine(11, "at hundehaus im reinhardswald");
562+
centerLine(12, "2019/20");
563+
centerLine(14, "with very special thanks to");
564+
centerLine(15, "frau k., buba k. candor k.");
565+
centerLine(16, "and the seven turtles!");
566+
centerLine(18, "-- key --");
567+
cgetc();
568+
}
553569

570+
void displayInstructions()
571+
{
572+
bannerDice();
573+
textcolor(colText);
554574
revers(1);
555-
centerLine(6, " * k k n i f f e l * ");
575+
centerLine(7, " * instructions * ");
556576
revers(0);
557-
centerLine(8, "- version 2.4 -");
558-
centerLine(10, "written by stephan kleinert");
559-
centerLine(11, "at k-burg, bad honnef, 2019-2020");
560-
centerLine(12, "with special thanks to frau k.,");
561-
centerLine(13, "buba k., candor k. and of course");
562-
centerLine(14, "to the 7 turtles.");
563-
textcolor(colLowerSum);
564-
centerLine(16, "how many players (2-4)?");
577+
centerLine(9, "game keys:");
578+
centerLine(11, "<return> to roll or reroll the dice");
579+
centerLine(13, "<1-6> to select dice to reroll");
580+
centerLine(14, "<a-m> to choose category to score");
581+
centerLine(16, "<s> to sort the dice");
582+
centerLine(18, "-- key --");
583+
cgetc();
584+
}
585+
586+
void startgame()
587+
{
588+
char i;
589+
char c;
590+
char promptTopRow;
591+
592+
promptTopRow = (BOTTOMY / 2) - 5;
565593

566-
while (numPlayers < 2 || numPlayers > 4)
594+
do
567595
{
596+
bannerDice();
597+
textcolor(colText);
598+
599+
revers(1);
600+
centerLine(promptTopRow, (char *)gTitle);
601+
revers(0);
602+
centerLine(promptTopRow + 2, "- version 2.32 -");
603+
centerLine(promptTopRow + 3, "written by stephan kleinert");
604+
textcolor(colBonus);
605+
centerLine(promptTopRow + 8, "or type 'i' for instructions");
606+
centerLine(promptTopRow + 9, "or 'c' for credits");
607+
textcolor(colLowerSum);
608+
centerLine(promptTopRow + 6, "how many players (2-4)?");
609+
568610
cursor(1);
569-
numPlayers = cgetc() - '0';
611+
c = cgetc();
612+
numPlayers = c - '0';
570613
cursor(0);
571-
if (numPlayers == 18)
572-
{ // 'b' typed
614+
if (c == 'i')
615+
{
616+
displayInstructions();
617+
}
618+
else if (c == 'c')
619+
{
620+
displayCredits();
621+
}
622+
else if (c == '#')
623+
{
573624
startBenchmarkMode();
574625
return;
575626
}
576-
}
627+
} while (numPlayers < 2 || numPlayers > 4);
577628

578629
clrscr();
579630

src/pet/io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "../io.h"
66
#include "../chargen.h"
77

8+
const char *gTitle = " * kkniffel/pet * ";
9+
810
const unsigned char colTable = 5;
911
const unsigned char colLegend = 14;
1012

src/plus4/io.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
#include "../io.h"
88
#include "../chargen.h"
99

10+
const char *gTitle = " * kkniffel/ted * ";
11+
12+
1013
const unsigned char colBackground = BCOLOR_BLACK;
1114
const unsigned char colBorder = BCOLOR_BLACK;
1215
const unsigned char colText = BCOLOR_BLUEGREEN + CATTR_LUMA4;
1316

1417
const unsigned char colSplash = BCOLOR_PURPLE + CATTR_LUMA3;
1518
const unsigned char colSplashRed = BCOLOR_RED + CATTR_LUMA3;
1619

20+
const unsigned char colDice = COLOR_ORANGE;
21+
22+
1723
const unsigned char colTable = BCOLOR_CYAN + CATTR_LUMA0;
1824
const unsigned char colLegend = BCOLOR_LIGHTBLUE + CATTR_LUMA3;
1925

0 commit comments

Comments
 (0)