aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/nimdraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/avalanche/nimdraw.cpp')
-rw-r--r--engines/avalanche/nimdraw.cpp181
1 files changed, 103 insertions, 78 deletions
diff --git a/engines/avalanche/nimdraw.cpp b/engines/avalanche/nimdraw.cpp
index a81d69fd24..9464d64d8e 100644
--- a/engines/avalanche/nimdraw.cpp
+++ b/engines/avalanche/nimdraw.cpp
@@ -11,7 +11,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
@@ -29,93 +29,118 @@
namespace Avalanche {
-const string header = string("Datafile for Avalot, copyright (c) 1992.")+'\32';
+const string header = string("Datafile for Avalot, copyright (c) 1992.") + '\32';
-integer gd,gm,x,y;
+integer gd, gm, x, y;
untyped_file f;
byte bit;
-void plot(char ch, byte x)
-{;
- setcolor(blue); outtextxy(x*80+4,0,ch); outtextxy(x*80+10,0,ch);
- setcolor(lightblue); outtextxy(x*80+5,0,ch); outtextxy(x*80+9,0,ch);
- setcolor(darkgray); outtextxy(x*80+6,0,ch); outtextxy(x*80+8,0,ch);
- setcolor(yellow); outtextxy(x*80+7,0,ch);
+void plot(char ch, byte x) {
+ ;
+ setcolor(blue);
+ outtextxy(x * 80 + 4, 0, ch);
+ outtextxy(x * 80 + 10, 0, ch);
+ setcolor(lightblue);
+ outtextxy(x * 80 + 5, 0, ch);
+ outtextxy(x * 80 + 9, 0, ch);
+ setcolor(darkgray);
+ outtextxy(x * 80 + 6, 0, ch);
+ outtextxy(x * 80 + 8, 0, ch);
+ setcolor(yellow);
+ outtextxy(x * 80 + 7, 0, ch);
}
-void load()
-{
- byte z;
- array<1,4,pointer> a;
- varying_string<12> check;
- untyped_file f; word s;
-;
- assign(f,"c:\\avalot\\nimstone.avd"); reset(f,1);
- seek(f,85); z=3;
- s=imagesize(0,0,getmaxx(),75);
- getmem(a[z],s);
- blockread(f,a[z],s);
- putimage(0,7,a[z],0);
- freemem(a[z],s); close(f);
+void load() {
+ byte z;
+ array<1, 4, pointer> a;
+ varying_string<12> check;
+ untyped_file f;
+ word s;
+ ;
+ assign(f, "c:\\avalot\\nimstone.avd");
+ reset(f, 1);
+ seek(f, 85);
+ z = 3;
+ s = imagesize(0, 0, getmaxx(), 75);
+ getmem(a[z], s);
+ blockread(f, a[z], s);
+ putimage(0, 7, a[z], 0);
+ freemem(a[z], s);
+ close(f);
}
-void spludge(integer x,integer y, string z)
-{
- shortint dx,dy;
-;
- setcolor(15);
- for( dx=-1; dx <= 1; dx ++)
- for( dy=-1; dy <= 1; dy ++)
- outtextxy(x+dx,y+dy,z);
- setcolor(0);
- outtextxy(x,y,z);
+void spludge(integer x, integer y, string z) {
+ shortint dx, dy;
+ ;
+ setcolor(15);
+ for (dx = -1; dx <= 1; dx ++)
+ for (dy = -1; dy <= 1; dy ++)
+ outtextxy(x + dx, y + dy, z);
+ setcolor(0);
+ outtextxy(x, y, z);
}
-int main(int argc, const char* argv[])
-{pio_initialize(argc, argv);
-;
- gd=3; gm=0; initgraph(gd,gm,"");
- load();
- settextstyle(4,0,0); setusercharsize(2,1,1,1);
- plot('A',1);
- plot('B',2);
- plot('C',3);
-/* rectangle(gd*80,7,56+gd*80,29); */
-
- setfillstyle(1,1); setcolor(9);
- fillellipse( 97,104,6,4); fillellipse(321,104,6,4);
- fillellipse( 97,131,6,4); fillellipse(321,131,6,4);
- bar(97,100,321,134);
- bar(92,104,326,131);
- setfillstyle(1,9);
- bar(91,103, 91,131); bar(327,104,327,131);
- bar(98, 99,321, 99); bar( 97,135,321,135);
-
- settextstyle(2,0,0); setusercharsize(20,10,11,10);
- spludge( 99,100,"The Ancient Game of");
- settextstyle(1,0,0); setusercharsize(40,10,10,10);
- spludge( 99,105,"NIM");
-
- /* now save it all! */
-
- assign(f,"c:\\avalot\\nim.avd");
- rewrite(f,1);
- blockwrite(f,header[1],length(header));
- for( gd=0; gd <= 3; gd ++)
- for( gm=7; gm <= 29; gm ++)
- for( bit=0; bit <= 3; bit ++)
- {;
- port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit;
- blockwrite(f,mem[0xa000*gd*10+gm*80],7);
- }
- for( gm=99; gm <= 135; gm ++)
- for( bit=0; bit <= 3; bit ++)
- {;
- port[0x3c4]=2; port[0x3ce]=4; port[0x3c5]=1 << bit; port[0x3cf]=bit;
- blockwrite(f,mem[0xa000*11+gm*80],30);
- }
- close(f);
-return EXIT_SUCCESS;
+int main(int argc, const char *argv[]) {
+ pio_initialize(argc, argv);
+ ;
+ gd = 3;
+ gm = 0;
+ initgraph(gd, gm, "");
+ load();
+ settextstyle(4, 0, 0);
+ setusercharsize(2, 1, 1, 1);
+ plot('A', 1);
+ plot('B', 2);
+ plot('C', 3);
+ /* rectangle(gd*80,7,56+gd*80,29); */
+
+ setfillstyle(1, 1);
+ setcolor(9);
+ fillellipse(97, 104, 6, 4);
+ fillellipse(321, 104, 6, 4);
+ fillellipse(97, 131, 6, 4);
+ fillellipse(321, 131, 6, 4);
+ bar(97, 100, 321, 134);
+ bar(92, 104, 326, 131);
+ setfillstyle(1, 9);
+ bar(91, 103, 91, 131);
+ bar(327, 104, 327, 131);
+ bar(98, 99, 321, 99);
+ bar(97, 135, 321, 135);
+
+ settextstyle(2, 0, 0);
+ setusercharsize(20, 10, 11, 10);
+ spludge(99, 100, "The Ancient Game of");
+ settextstyle(1, 0, 0);
+ setusercharsize(40, 10, 10, 10);
+ spludge(99, 105, "NIM");
+
+ /* now save it all! */
+
+ assign(f, "c:\\avalot\\nim.avd");
+ rewrite(f, 1);
+ blockwrite(f, header[1], length(header));
+ for (gd = 0; gd <= 3; gd ++)
+ for (gm = 7; gm <= 29; gm ++)
+ for (bit = 0; bit <= 3; bit ++) {
+ ;
+ port[0x3c4] = 2;
+ port[0x3ce] = 4;
+ port[0x3c5] = 1 << bit;
+ port[0x3cf] = bit;
+ blockwrite(f, mem[0xa000 * gd * 10 + gm * 80], 7);
+ }
+ for (gm = 99; gm <= 135; gm ++)
+ for (bit = 0; bit <= 3; bit ++) {
+ ;
+ port[0x3c4] = 2;
+ port[0x3ce] = 4;
+ port[0x3c5] = 1 << bit;
+ port[0x3cf] = bit;
+ blockwrite(f, mem[0xa000 * 11 + gm * 80], 30);
+ }
+ close(f);
+ return EXIT_SUCCESS;
}
} // End of namespace Avalanche. \ No newline at end of file