Provided in PR 12072 by Ben Collver (collver@linuxfreemail.com). Ularn is a fantasy games in which your child has contracted a strange dis- ease, and none of your home remedies seem to have any effect. You set out to find a remedy in a limited amount of time, and to collect gold along the way of course! Ularn is based on larn, and adds the concept of character classes.
317 lines
5.6 KiB
Text
317 lines
5.6 KiB
Text
$NetBSD: patch-au,v 1.1.1.1 2001/04/27 15:27:31 agc Exp $
|
|
|
|
--- player.c.orig Fri Jun 19 13:55:34 1992
|
|
+++ player.c Sat Jan 13 21:54:50 2001
|
|
@@ -20,6 +20,7 @@
|
|
* to quit
|
|
*/
|
|
|
|
+#include <stdlib.h>
|
|
#include "header.h"
|
|
#include "player.h"
|
|
#include "monst.h"
|
|
@@ -36,7 +37,7 @@
|
|
* uses the skill[] array to find level boundarys
|
|
* uses c[EXPERIENCE] c[LEVEL]
|
|
*/
|
|
-raiselevel ()
|
|
+void raiselevel (void)
|
|
{
|
|
if (c[LEVEL] < MAXPLEVEL)
|
|
raiseexperience((long)(skill[c[LEVEL]]-c[EXPERIENCE]));
|
|
@@ -50,7 +51,7 @@
|
|
*
|
|
* subroutine to lower the players character level by one
|
|
*/
|
|
-loselevel ()
|
|
+void loselevel (void)
|
|
{
|
|
if (c[LEVEL] > 1)
|
|
loseexperience((long)(c[EXPERIENCE] - skill[c[LEVEL]-1] + 1));
|
|
@@ -64,7 +65,7 @@
|
|
*
|
|
* subroutine to increase experience points
|
|
*/
|
|
-raiseexperience (x)
|
|
+void raiseexperience (x)
|
|
long x;
|
|
{
|
|
int i,tmp;
|
|
@@ -115,9 +116,9 @@
|
|
for (i=0; i<SPNUM; i++)
|
|
spelknow[i]=1;
|
|
for (i=0; i<MAXSCROLL; i++)
|
|
- scrollname[i][0]=' ';
|
|
+ scrollknown[i]=1;
|
|
for (i=0; i<MAXPOTION; i++)
|
|
- potionname[i][0]=' ';
|
|
+ potionknown[i]=1;
|
|
}
|
|
break;
|
|
}
|
|
@@ -132,7 +133,7 @@
|
|
*
|
|
* subroutine to lose experience points
|
|
*/
|
|
-loseexperience (x)
|
|
+void loseexperience (x)
|
|
long x;
|
|
{
|
|
int i,tmp;
|
|
@@ -167,7 +168,7 @@
|
|
* subroutine to remove hit points from the player
|
|
* warning -- will kill player if hp goes to zero
|
|
*/
|
|
-losehp (x)
|
|
+void losehp (x)
|
|
int x;
|
|
{
|
|
if ((c[HP] -= x) <= 0) {
|
|
@@ -178,7 +179,7 @@
|
|
}
|
|
}
|
|
|
|
-losemhp (x)
|
|
+void losemhp (x)
|
|
int x;
|
|
{
|
|
c[HP] -= x;
|
|
@@ -198,14 +199,14 @@
|
|
*
|
|
* subroutine to gain maximum hit points
|
|
*/
|
|
-raisehp (x)
|
|
+void raisehp (x)
|
|
int x;
|
|
{
|
|
if ((c[HP] += x) > c[HPMAX])
|
|
c[HP] = c[HPMAX];
|
|
}
|
|
|
|
-raisemhp (x)
|
|
+void raisemhp (x)
|
|
int x;
|
|
{
|
|
c[HPMAX] += x;
|
|
@@ -221,14 +222,14 @@
|
|
*
|
|
* subroutine to gain maximum spells
|
|
*/
|
|
-raisespells (x)
|
|
+void raisespells (x)
|
|
int x;
|
|
{
|
|
if ((c[SPELLS] += x) > c[SPELLMAX])
|
|
c[SPELLS] = c[SPELLMAX];
|
|
}
|
|
|
|
-raisemspells (x)
|
|
+void raisemspells (x)
|
|
int x;
|
|
{
|
|
c[SPELLMAX]+=x;
|
|
@@ -244,14 +245,14 @@
|
|
*
|
|
* subroutine to lose maximum spells
|
|
*/
|
|
-losespells (x)
|
|
+void losespells (x)
|
|
int x;
|
|
{
|
|
if ((c[SPELLS] -= x) < 0)
|
|
c[SPELLS]=0;
|
|
}
|
|
|
|
-losemspells (x)
|
|
+void losemspells (x)
|
|
int x;
|
|
{
|
|
if ((c[SPELLMAX] -= x) < 0)
|
|
@@ -266,7 +267,7 @@
|
|
*
|
|
* function to be sure player is not in a wall
|
|
*/
|
|
-positionplayer ()
|
|
+void positionplayer ()
|
|
{
|
|
int try;
|
|
try = 2;
|
|
@@ -286,7 +287,7 @@
|
|
/*
|
|
* recalc() function to recalculate the armor class of the player
|
|
*/
|
|
-recalc ()
|
|
+void recalc ()
|
|
{
|
|
int i,j,k;
|
|
|
|
@@ -417,7 +418,7 @@
|
|
*
|
|
* subroutine to ask if the player really wants to quit
|
|
*/
|
|
-quit ()
|
|
+void quit (void)
|
|
{
|
|
int i;
|
|
|
|
@@ -427,7 +428,7 @@
|
|
while (1) {
|
|
i=getcharacter();
|
|
if (i == 'y') {
|
|
- clear();
|
|
+ ularn_clear();
|
|
lflush();
|
|
died(300);
|
|
return;
|
|
@@ -440,7 +441,7 @@
|
|
if (i == 's') {
|
|
lprcat(" save");
|
|
lflush();
|
|
- clear();
|
|
+ ularn_clear();
|
|
lprcat("Saving . . .");
|
|
lflush();
|
|
savegame(savefilename);
|
|
@@ -466,7 +467,7 @@
|
|
/*
|
|
* function to ask --more-- then the user must enter a space
|
|
*/
|
|
-more()
|
|
+void more(void)
|
|
{
|
|
char c;
|
|
|
|
@@ -481,7 +482,7 @@
|
|
* function to put something in the players inventory
|
|
* returns 0 if success, 1 if a failure
|
|
*/
|
|
-take (itm, arg)
|
|
+int take (itm, arg)
|
|
int itm, arg;
|
|
{
|
|
int i;
|
|
@@ -576,7 +577,7 @@
|
|
*
|
|
* k is index into iven list of object to drop
|
|
*/
|
|
-drop_object (k)
|
|
+int drop_object (k)
|
|
int k;
|
|
{
|
|
int itm, pitflag=0;
|
|
@@ -628,7 +629,7 @@
|
|
/*
|
|
* function to enchant armor player is currently wearing
|
|
*/
|
|
-enchantarmor ()
|
|
+void enchantarmor (void)
|
|
{
|
|
int tmp;
|
|
|
|
@@ -677,7 +678,7 @@
|
|
/*
|
|
* function to enchant a weapon presently being wielded
|
|
*/
|
|
-enchweapon ()
|
|
+void enchweapon (void)
|
|
{
|
|
int tmp;
|
|
|
|
@@ -716,7 +717,7 @@
|
|
* routine to tell if player can carry one more thing
|
|
* returns 1 if pockets are full, else 0
|
|
*/
|
|
-pocketfull ()
|
|
+int pocketfull (void)
|
|
{
|
|
int i,limit;
|
|
if ((limit = 15+(c[LEVEL]>>1)) > IVENSIZE)
|
|
@@ -730,7 +731,7 @@
|
|
/*
|
|
* function to return 1 if a monster is next to the player else returns 0
|
|
*/
|
|
-nearbymonst ()
|
|
+int nearbymonst (void)
|
|
{
|
|
int tmp,tmp2;
|
|
|
|
@@ -745,7 +746,7 @@
|
|
* function to steal an item from the players pockets
|
|
* returns 1 if steals something else returns 0
|
|
*/
|
|
-stealsomething (x,y)
|
|
+int stealsomething (x,y)
|
|
int x,y;
|
|
{
|
|
int i,n=100;
|
|
@@ -775,7 +776,7 @@
|
|
/*
|
|
* function to return 1 is player carrys nothing else return 0
|
|
*/
|
|
-emptyhanded ()
|
|
+int emptyhanded (void)
|
|
{
|
|
int i;
|
|
|
|
@@ -789,7 +790,7 @@
|
|
/*
|
|
* function to create a gem on a square near the player
|
|
*/
|
|
-creategem ()
|
|
+void creategem (void)
|
|
{
|
|
int i,j;
|
|
|
|
@@ -818,7 +819,7 @@
|
|
* function to change character levels as needed when dropping an object
|
|
* that affects these characteristics
|
|
*/
|
|
-adjustcvalues (itm, arg)
|
|
+void adjustcvalues (itm, arg)
|
|
int itm, arg;
|
|
{
|
|
int flag,i;
|
|
@@ -902,7 +903,7 @@
|
|
* function to read a string from token input "string"
|
|
* returns a pointer to the string
|
|
*/
|
|
-gettokstr (str)
|
|
+void gettokstr (str)
|
|
char *str;
|
|
{
|
|
int i,j;
|
|
@@ -929,14 +930,14 @@
|
|
* returns 1 if entered correctly, 0 if not
|
|
*/
|
|
|
|
-getpassword ()
|
|
+int getpassword (void)
|
|
{
|
|
char gpwbuf[BUFSIZ];
|
|
|
|
scbr();
|
|
lprcat("\nEnter Password: ");
|
|
lflush();
|
|
- gets(gpwbuf);
|
|
+ fgets(gpwbuf, BUFSIZ, stdin);
|
|
if (strcmp(gpwbuf,password) != 0) {
|
|
lprcat("\nSorry\n");
|
|
lflush();
|
|
@@ -949,7 +950,7 @@
|
|
* subroutine to get a yes or no response from the user
|
|
* returns y or n
|
|
*/
|
|
-getyn ()
|
|
+int getyn (void)
|
|
{
|
|
int i;
|
|
|
|
@@ -965,7 +966,7 @@
|
|
* function to calculate the pack weight of the player
|
|
* returns the number of pounds the player is carrying
|
|
*/
|
|
-packweight ()
|
|
+int packweight (void)
|
|
{
|
|
int i,j,k;
|
|
|