view srogue/rgdata.c @ 245:e7aab31362af

Rogue V[345], Super-Rogue: Fix violet fungi/venus flytraps. Violet fungi (renamed venus flytraps in Rogue V5) do an increasing amount of damage each time they hit. If they miss, you still suffer the same number of HP. This worked by keeping a counter and printing new damage strings into monsters[5].m_stats.s_dmg, which is the "prototype" of that particular monster. Each individual monster has its own damage string. Apparently these were once char *, pointing to the same string as the prototype. When the s_dmg member was changed to be an internal char array, changing the prototype's damage string no longer had any effect on actual monsters. As a result, flytraps did no damage on a hit, or only one point in V5. The mechanism for doing damage on a miss continued to work. This has been fixed by overwriting the individual monster's damage string instead of the prototype's. It is now no longer necessary to reset the damage string when the flytrap is killed. The method for resetting it when the hero teleports away had to be modified. Comments referencing the long-unused xstr have been removed.
author John "Elwin" Edwards
date Sun, 01 May 2016 19:39:56 -0400
parents 2128c7dc8a40
children
line wrap: on
line source

/*
 * Super-Rogue
 * Copyright (C) 1984 Robert D. Kindelberger
 * All rights reserved.
 *
 * See the file LICENSE.TXT for full copyright and licensing information.
 */

#include "global.c"

main(argc,argv)
char **argv;
int argc;
{
	char *ptr;
	int i, j, k;
	struct magic_item *mi;
	struct init_weps *wp;
	struct init_armor *ar;
	struct monster *mo;
	FILE *fo;

	/*
	 * write to desired output file
	 */
	if (argc > 1) {
		fo = fopen(argv[1], "w");
		if (fo == NULL) {
		printf("%s: %s not writable\n",argv[0],argv[1]);
		exit(1);
		}
	}
	else
		fo = stdout;

	/*
	 * print total chances for armor, weapons, food, scrolls, etc
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t	ITEM GENERAL INFO\n\n\n");
	fprintf(fo,"NAME\t\tCHANCE\t\tWEIGHT\n\n");
	for (mi = &things[0]; mi < &things[NUMTHINGS]; mi++) {
		fprintf(fo,"%s\t\t",mi->mi_name);
		i = mi->mi_prob / 10;
		j = mi->mi_prob % 10;
		fprintf(fo,"%2d.%1d %%\t\t",i,j);
		i = mi->mi_wght / 10;
		j = mi->mi_wght % 10;
		if (i == 0 && j == 0)
			fprintf(fo,"%3s\n","*");
		else
			fprintf(fo,"%3d.%1d lbs\n",i,j);
	}
	fprintf(fo,"\n\n\n\n\n\n\nNOTES - * means that weight depends on which one of that item type\n");
	fprintf(fo,"	  - All items weigh 20%% more when cursed\n");

	/*
	 * print stuff about potions
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t  POTION INFO\n\n\n");
	fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
	for (mi = &p_magic[0]; mi < &p_magic[MAXPOTIONS]; mi++) {
		fprintf(fo,"%s\t",mi->mi_name);
		k = strlen(mi->mi_name);
		if (k < 8)
			ptr = "\t\t\t";
		else if (k >= 16)
			ptr = "\t";
		else
			ptr = "\t\t";
		fprintf(fo,"%s", ptr);
		i = mi->mi_prob / 10;
		j = mi->mi_prob % 10;
		fprintf(fo,"%2d.%1d %%\t\t",i,j);
		fprintf(fo,"%3d\n",mi->mi_worth);
	}
	fprintf(fo,"\n\n\n\n\nNOTE - All potions weigh 0.5 lbs\n");
	

	/*
	 * print stuff about scrolls
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t  SCROLL INFO\n\n\n");
	fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
	for (mi = &s_magic[0]; mi < &s_magic[MAXSCROLLS]; mi++) {
		fprintf(fo,"%s\t",mi->mi_name);
		k = strlen(mi->mi_name);
		if (k < 8)
			ptr = "\t\t\t";
		else if (k >= 16)
			ptr = "\t";
		else
			ptr = "\t\t";
		fprintf(fo,"%s", ptr);
		i = mi->mi_prob / 10;
		j = mi->mi_prob % 10;
		fprintf(fo,"%2d.%1d %%\t\t",i,j);
		fprintf(fo,"%3d\n",mi->mi_worth);
	}
	fprintf(fo,"\n\n\n\n\nNOTE - All scrolls weigh 3.0 lbs\n");


	/*
	 * print stuff about rings
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t  RING INFO\n\n\n");
	fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
	for (mi = &r_magic[0]; mi < &r_magic[MAXRINGS]; mi++) {
		fprintf(fo,"%s\t",mi->mi_name);
		k = strlen(mi->mi_name);
		if (k < 8)
			ptr = "\t\t\t";
		else if (k >= 16)
			ptr = "\t";
		else
			ptr = "\t\t";
		fprintf(fo,"%s", ptr);
		i = mi->mi_prob / 10;
		j = mi->mi_prob % 10;
		fprintf(fo,"%2d.%1d %%\t\t",i,j);
		fprintf(fo,"%3d\n",mi->mi_worth);
	}
	fprintf(fo,"\n\n\n\n\nNOTE - All rings weigh 0.5 lbs\n");


	/*
	 * print stuff about sticks
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t  STAFF/WAND INFO\n\n\n");
	fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
	for (mi = &ws_magic[0]; mi < &ws_magic[MAXSTICKS]; mi++) {
		fprintf(fo,"%s\t",mi->mi_name);
		k = strlen(mi->mi_name);
		if (k < 8)
			ptr = "\t\t\t";
		else if (k >= 16)
			ptr = "\t";
		else
			ptr = "\t\t";
		fprintf(fo,"%s", ptr);
		i = mi->mi_prob / 10;
		j = mi->mi_prob % 10;
		fprintf(fo,"%2d.%1d %%\t\t",i,j);
		fprintf(fo,"%3d\n",mi->mi_worth);
	}
	fprintf(fo,"\n\n\n\n\nNOTES - All wands weigh 6.0 lbs\n");
	fprintf(fo,"	  - All staffs weigh 10.0 lbs\n");
	fprintf(fo,"	  - Wands contain from 4 to 8 charges\n");
	fprintf(fo,"	  - Staffs contain from 5 to 12 charges\n");
	fprintf(fo,"	  - Sticks of light have an additional 7 to 15 charges\n");


	/*
	 * print armor info
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t\t\tARMOR INFO\n\n\n");
	fprintf(fo,"NAME\t\t\t\tAC\tCHANCE\t\tWORTH\t\tWEIGHT\n\n");
	for (ar = &armors[0]; ar < &armors[MAXARMORS]; ar++) {
		fprintf(fo,"%s\t",ar->a_name);
		k = strlen(ar->a_name);
		if (k < 8)
			ptr = "\t\t\t";
		else if (k >= 16)
			ptr = "\t";
		else
			ptr = "\t\t";
		fprintf(fo,"%s", ptr);
		fprintf(fo,"%2d\t",ar->a_class);
		fprintf(fo,"%2d %%\t\t",ar->a_prob);
		fprintf(fo,"%3d\t\t",ar->a_worth);
		fprintf(fo,"%2d lbs\n",ar->a_wght / 10);
	}
	fprintf(fo,"\n\n\n\n\nNOTE - All armor becomes 50%% lighter when blessed\n");


	/*
	 * print stuff about weapons
	 */
	fprintf(fo,"\n\n\n\n\n\n");
	fprintf(fo,"\t\t\t\t\tWEAPON INFO\n\n\n");
	fprintf(fo,
	   "NAME\t\t\tHIT DAMAGE\tHURL DAMAGE\tWORTH\t\tWEIGHT\n\n");
	for (wp = &weaps[0]; wp < &weaps[MAXWEAPONS]; wp++) {
		fprintf(fo,"%s\t",wp->w_name);
		k = strlen(wp->w_name);
		if (k < 8)
			ptr = "\t\t";
		else if (k >= 16)
			ptr = "";
		else
			ptr = "\t";
		fprintf(fo,"%s", ptr);
		ptr = wp->w_dam;
		i = *ptr - '0';
		j = 0;
		ptr += 2;
		while (*ptr != NULL) {
			j = j * 10 + (*ptr - '0');
			++ptr;
		}
		j *= i;
		fprintf(fo,"  %d to %d\t",i,j);
		ptr = wp->w_hrl;
		i = *ptr - '0';
		j = 0;
		ptr += 2;
		while (*ptr != NULL) {
			j = j * 10 + (*ptr - '0');
			++ptr;
		}
		j *= i;
		fprintf(fo,"  %d to %d\t",i,j);
		fprintf(fo,"%4d\t\t",wp->w_worth);
		i = wp->w_wght / 10;
		j = wp->w_wght % 10;
		fprintf(fo,"%2d.%1d lbs\n",i,j);
	}
	fprintf(fo,"\n\n\n\n\nNOTE - All weapons become 50%% lighter when blessed\n");


	/*
	 * print stuff about the monsters
	 */
}