summaryrefslogtreecommitdiffstats
path: root/phantasia
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-02-17 14:05:02 -0500
committerCameron Katri <me@cameronkatri.com>2021-02-22 09:20:17 -0500
commit08eca96e71d96ad1f8e9b888875ab5570f208d19 (patch)
tree9cace520fa50d9ef5bb77c2d7ebdde40e6b40f7f /phantasia
parent3f650c87c6ee6692ad6a558bb03ccf3364fe794a (diff)
downloadbsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.tar.gz
bsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.tar.zst
bsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.zip
Get all the games compiling for iOS
Diffstat (limited to 'phantasia')
-rw-r--r--phantasia/Makefile58
-rw-r--r--phantasia/main.c3
-rw-r--r--phantasia/map.c200
3 files changed, 130 insertions, 131 deletions
diff --git a/phantasia/Makefile b/phantasia/Makefile
index e9c53f23..3792164c 100644
--- a/phantasia/Makefile
+++ b/phantasia/Makefile
@@ -1,58 +1,48 @@
# $NetBSD: Makefile,v 1.37 2014/06/14 20:49:37 mrg Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
-.include <bsd.own.mk>
-
PROG= phantasia
SRCS= fight.c gamesupport.c interplayer.c io.c main.c misc.c phantglobs.c
-
-DPADD= ${LIBM} ${LIBCURSES} ${LIBTERMINFO}
-LDADD= -lm -lcurses -lterminfo
-HIDEGAME=hidegame
-SETGIDGAME=yes
-USETBL=
MAN= phantasia.6
FILESDIR=/var/games/phantasia
-FILESOWN=games
-FILESGRP=games
FILESMODE=0660
ALLFILES=gold lastdead mess monsters void motd characs scoreboard
FILES=gold lastdead mess monsters void motd
-# don't overwrite existing characters or scorefile
-.for file in characs scoreboard
-.if !exists(${DESTDIR}${FILESDIR}/${file})
-FILES+=${file}
-.endif
-.endfor
-CLEANFILES+=map mkdata setup.lo host_phantglobs.lo ${ALLFILES} files.stamp
+CLEANFILES+=map mkdata $(ALLFILES) files.stamp
-realall: ${FILES}
+all: $(PROG) $(FILES)
-${FILES}: files.stamp
+$(FILES): files.stamp
files.stamp: mkdata monsters.asc
- ${_MKMSG_CREATE} ${FILES}
- rm -f ${.TARGET}
- ./mkdata -m ${.CURDIR}/monsters.asc
- touch ${.TARGET}
-
-mkdata: host_phantglobs.lo setup.lo ${LIBM}
- ${_MKTARGET_LINK}
- ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC:M*.lo} -lm
+ rm -f files.stamp
+ ./mkdata -m monsters.asc
+ touch files.stamp
-BUILDSYMLINKS+= phantglobs.c host_phantglobs.c
-HOST_CPPFLAGS+= -I${.CURDIR}
+mkdata: phantglobs.c setup.c
+ clang -o mkdata phantglobs.c setup.c
# Make Phantasia map. Change the map commands reflect your installation.
# PLOTDEVICE is used for plotting the map. Change as appropriate.
map: map.c
- ${CC} -O ${.CURDIR}/map.c -lplot -o ${.TARGET}
+ clang -o map map.c -lplot
./map | plot > /dev/tty
-.include <bsd.prog.mk>
+$(PROG): $(SRCS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(SRCS) -lncursesw
+ $(STRIP) $(PROG)
+
+$(ALLFILES): $(FILES)
+
+install: $(PROG) $(MAN) $(ALLFILES)
+ $(GINSTALL) -Dm2755 $(PROG) $(DESTDIR)/usr/games/$(PROG)
+ $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/usr/share/man/man6/$(MAN)
+ $(GINSTALL) -d $(DESTDIR)$(FILESDIR)
+ $(GINSTALL) -Dm$(FILESMODE) $(ALLFILES) $(DESTDIR)$(FILESDIR)
+
+clean:
+ rm -f $(CLEANFILES) $(PROG)
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.misc.c+= -O0
-.endif
+.PHONY: all clean install
diff --git a/phantasia/main.c b/phantasia/main.c
index c8850da8..6fd3f727 100644
--- a/phantasia/main.c
+++ b/phantasia/main.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
#include "macros.h"
#include "phantdefs.h"
@@ -44,6 +45,8 @@
#include "phantglobs.h"
#include "pathnames.h"
+#define __unreachable() __builtin_unreachable()
+
#undef bool
#include <curses.h>
diff --git a/phantasia/map.c b/phantasia/map.c
index 7ac656db..d1bbca24 100644
--- a/phantasia/map.c
+++ b/phantasia/map.c
@@ -3,71 +3,79 @@
#define minusminus plusplus
#define minusplus plusminus
+#include <stdio.h>
+#include <stdlib.h>
+#include <plot.h>
+
+void plusminus(char *s, int x, int y);
+void plusplus(char *s, int x, int y);
+
+int
main()
{
/* Set up */
- openpl();
- space(-1400, -1000, 1200, 1200);
+ pl_openpl();
+ pl_space(-1400, -1000, 1200, 1200);
/* Big box */
- move(-1400, -1000);
- cont(-1400, 1000);
- cont(600, 1000);
- cont(600, -1000);
- cont(-1400, -1000);
+ pl_move(-1400, -1000);
+ pl_cont(-1400, 1000);
+ pl_cont(600, 1000);
+ pl_cont(600, -1000);
+ pl_cont(-1400, -1000);
/* Grid -- horizontal lines every 200 */
- linemod("dotted");
- line(600, -800, -1400, -800);
- line(-1400, -600, 600, -600);
- line(600, -400, -1400, -400);
- line(-1400, -200, 600, -200);
- linemod("solid");
- line(600, 0, -1400, 0);
- linemod("dotted");
- line(-1400, 200, 600, 200);
- line(600, 400, -1400, 400);
- line(-1400, 600, 600, 600);
- line(600, 800, -1400, 800);
+ pl_linemod("dotted");
+ pl_line(600, -800, -1400, -800);
+ pl_line(-1400, -600, 600, -600);
+ pl_line(600, -400, -1400, -400);
+ pl_line(-1400, -200, 600, -200);
+ pl_linemod("solid");
+ pl_line(600, 0, -1400, 0);
+ pl_linemod("dotted");
+ pl_line(-1400, 200, 600, 200);
+ pl_line(600, 400, -1400, 400);
+ pl_line(-1400, 600, 600, 600);
+ pl_line(600, 800, -1400, 800);
/* Grid -- vertical lines every 200 */
- line(-1200, 1000, -1200, -1000);
- line(-1000, 1000, -1000, -1000);
- line(-800, 1000, -800, -1000);
- line(-600, 1000, -600, -1000);
- linemod("solid");
- line(-400, 1000, -400, -1000);
- linemod("dotted");
- line(-200, 1000, -200, -1000);
- line(0, 1000, 0, -1000);
- line(200, 1000, 200, -1000);
- line(400, 1000, 400, -1000);
+ pl_line(-1200, 1000, -1200, -1000);
+ pl_line(-1000, 1000, -1000, -1000);
+ pl_line(-800, 1000, -800, -1000);
+ pl_line(-600, 1000, -600, -1000);
+ pl_linemod("solid");
+ pl_line(-400, 1000, -400, -1000);
+ pl_linemod("dotted");
+ pl_line(-200, 1000, -200, -1000);
+ pl_line(0, 1000, 0, -1000);
+ pl_line(200, 1000, 200, -1000);
+ pl_line(400, 1000, 400, -1000);
/* Circles radius +250 on "center" */
- linemod("solid");
- circle(-400, 0, 250);
- circle(-400, 0, 500);
- circle(-400, 0, 750);
- circle(-400, 0, 1000);
+ pl_linemod("solid");
+ pl_circle(-400, 0, 250);
+ pl_circle(-400, 0, 500);
+ pl_circle(-400, 0, 750);
+ pl_circle(-400, 0, 1000);
/* A few labels */
- move(-670, 1075);
- label("- THE PHANTASIA UNIVERSE -");
- line(-630, 1045, -115, 1045);
- move(-360, 80);
- label("Lorien");
- move(-385, -100);
- label("Ithilien");
- move(-560, 80);
- label("Rohan");
- move(-580, -100);
- label("Anorien");
+ pl_move(-670, 1075);
+ pl_label("- THE PHANTASIA UNIVERSE -");
+ pl_line(-630, 1045, -115, 1045);
+ pl_move(-360, 80);
+ pl_label("Lorien");
+ pl_move(-385, -100);
+ pl_label("Ithilien");
+ pl_move(-560, 80);
+ pl_label("Rohan");
+ pl_move(-580, -100);
+ pl_label("Anorien");
plusplus("Rovanion", -250, 320);
plusplus("The Iron Hills", -100, 560);
plusplus("Rhun", 250, 570);
@@ -80,82 +88,80 @@ main()
plusminus("Mordor", -180, -300);
plusminus("Khand", 0, -500);
plusminus("Near Harad", 40, -780);
- move(340, 900);
- label("The Moors");
- move(300, 840);
- label("Adventurous");
- move(340, -840);
- label("The Moors");
- move(300, -900);
- label("Adventurous");
- move(-1340, 900);
- label("The Moors");
- move(-1340, 840);
- label("Adventurous");
- move(-1340, -840);
- label("The Moors");
- move(-1340, -900);
- label("Adventurous");
- move(700, 1000);
- label("OUTER CIRCLES:");
- line(690, 970, 1000, 970);
- move(700, 900);
- label("> 9: The Outer Waste");
- move(700, 800);
- label("> 20: The Dead Marshes");
- move(700, 700);
- label("> 35: Kennaquhair");
- move(700, 600);
- label("> 55: Morannon");
- move(700, 300);
- label("(0,0): The Lord's Chamber");
-
- move(700, -400);
- label("Grid squares are 100 x 100");
- move(700, -800);
- label("Created by Ted Estes");
- move(700, -860);
- label("Plotted by Chris Robertson");
- move(700, -920);
- label(" c 1985");
- circle(723, -923, 20);
+ pl_move(340, 900);
+ pl_label("The Moors");
+ pl_move(300, 840);
+ pl_label("Adventurous");
+ pl_move(340, -840);
+ pl_label("The Moors");
+ pl_move(300, -900);
+ pl_label("Adventurous");
+ pl_move(-1340, 900);
+ pl_label("The Moors");
+ pl_move(-1340, 840);
+ pl_label("Adventurous");
+ pl_move(-1340, -840);
+ pl_label("The Moors");
+ pl_move(-1340, -900);
+ pl_label("Adventurous");
+ pl_move(700, 1000);
+ pl_label("OUTER CIRCLES:");
+ pl_line(690, 970, 1000, 970);
+ pl_move(700, 900);
+ pl_label("> 9: The Outer Waste");
+ pl_move(700, 800);
+ pl_label("> 20: The Dead Marshes");
+ pl_move(700, 700);
+ pl_label("> 35: Kennaquhair");
+ pl_move(700, 600);
+ pl_label("> 55: Morannon");
+ pl_move(700, 300);
+ pl_label("(0,0): The Lord's Chamber");
+
+ pl_move(700, -400);
+ pl_label("Grid squares are 100 x 100");
+ pl_move(700, -800);
+ pl_label("Created by Ted Estes");
+ pl_move(700, -860);
+ pl_label("Plotted by Chris Robertson");
+ pl_move(700, -920);
+ pl_label(" c 1985");
+ pl_circle(723, -923, 20);
/* Close down */
- move(-1380, 1180);
- closepl();
+ pl_move(-1380, 1180);
+ pl_closepl();
exit(0);
}
-plusplus(s, x, y) /* draw strings in plus plus quadrant */
-char *s;
-int x, y;
+void
+plusplus(char *s, int x, int y) /* draw strings in plus plus quadrant */
{
char s1[2];
while (*s)
{
- move(x, y);
+ pl_move(x, y);
s1[0] = *s++;
s1[1] = '\0';
- label(s1);
+ pl_label(s1);
x += 25;
y -= 30;
}
}
-plusminus(s, x, y) /* draw strings in plus minus quadrant */
-char *s;
-int x, y;
+void
+plusminus(char *s, int x, int y) /* draw strings in plus minus quadrant */
{
char s1[2];
while (*s)
{
- move(x, y);
+ pl_move(x, y);
s1[0] = *s++;
s1[1] = '\0';
- label(s1);
+ pl_label(s1);
x += 25;
y += 30;
}