forked from muspellsson/omega-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.c
119 lines (109 loc) · 2.64 KB
/
stats.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988, 1989 */
/* stats.c */
/* this file contains one function, editstats(), that allows the player
* (if in cheat mode) to alter their stats, HP, mana, gold, etc.
*
* a later version may add options to set other things like guild
* membership, alignment, and so on
*/
#ifndef MSDOS_SUPPORTED_ANTIQUE
#include <unistd.h>
#include <ctype.h>
#endif
#include "glob.h"
void editstats(void)
{
int slot = 1, to, done = FALSE;
int response, num;
clearmsg();
menuclear();
display_stats();
move_slot(1,1,NUMSTATS);
do {
print1("Currently selected stat is preceded by highlit >>");
print2("Move selected option with '>' and '<', ' ' to change value, ESCAPE to quit");
response = mcigetc();
switch(response) {
case 'j':
case '>':
#ifdef KEY_DOWN
case KEY_DOWN:
#endif
to = slot + 1;
slot = move_slot(slot,to,NUMSTATS+1);
break;
case 'k':
case '<':
#ifdef KEY_UP
case KEY_UP:
#endif
to = slot - 1;
if (to > 0)
slot = move_slot(slot,to, NUMSTATS+1);
break;
case ESCAPE:
done = TRUE;
break;
case ' ':
print1("enter new value:");
num = (int) parsenum("");
if ((slot < 7) && ((num > 32) || (num < 1)))
{
print1("You don't really think I'll let you get away with that, do you?");
morewait();
break;
}
switch(slot)
{
case 1:
Player.str = Player.maxstr = num;
break;
case 2:
Player.con = Player.maxcon = num;
break;
case 3:
Player.dex = Player.maxdex = num;
break;
case 4:
Player.agi = Player.maxagi = num;
break;
case 5:
Player.iq = Player.maxiq = num;
break;
case 6:
Player.pow = Player.maxpow = num;
break;
case 7:
Player.hp = num;
break;
case 8:
Player.maxhp = num;
break;
case 9:
Player.mana = num;
break;
case 10:
Player.maxmana = num;
break;
case 11:
Player.cash = num;
break;
}
calc_melee();
break;
default:
print3("That response is meaningless for this option.");
break;
}
print1("Currently selected stat is preceded by highlit >>");
display_stat_slot(slot/*,slot,NUMSTATS+1 WDT HACK! */);
move_slot(slot,slot,NUMSTATS+1);
} while (! done);
if (optionp(SHOW_COLOUR))
colour_on();
else
colour_off();
#if !defined(MSDOS_SUPPORTED_ANTIQUE) && !defined(AMIGA)
xredraw();
#endif
}