comparison srogue/weapons.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 2128c7dc8a40
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
216:b24545357d2e 217:94a0d9dd5ce1
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * See the file LICENSE.TXT for full copyright and licensing information. 14 * See the file LICENSE.TXT for full copyright and licensing information.
15 */ 15 */
16 16
17 #include <string.h>
17 #include <ctype.h> 18 #include <ctype.h>
18 #include "rogue.h" 19 #include "rogue.h"
19 #include "rogue.ext" 20 #include "rogue.ext"
20 21
21 /* 22 /*
22 * missile: 23 * missile:
23 * Fire a missile in a given direction 24 * Fire a missile in a given direction
24 */ 25 */
25 missile(ydelta, xdelta) 26 void
26 int ydelta, xdelta; 27 missile(int ydelta, int xdelta)
27 { 28 {
28 reg struct object *obj, *nowwield; 29 reg struct object *obj, *nowwield;
29 reg struct linked_list *item, *nitem; 30 reg struct linked_list *item, *nitem;
30 31
31 /* 32 /*
81 82
82 /* 83 /*
83 * do the actual motion on the screen done by an object traveling 84 * do the actual motion on the screen done by an object traveling
84 * across the room 85 * across the room
85 */ 86 */
86 do_motion(obj, ydelta, xdelta) 87 void
87 struct object *obj; 88 do_motion(struct object *obj, int ydelta, int xdelta)
88 int ydelta, xdelta;
89 { 89 {
90 reg int ch, y, x; 90 reg int ch, y, x;
91 91
92 obj->o_pos = hero; 92 obj->o_pos = hero;
93 while (1) { 93 while (1) {
118 /* 118 /*
119 * fall: 119 * fall:
120 * Drop an item someplace around here. 120 * Drop an item someplace around here.
121 */ 121 */
122 122
123 fall(item, pr) 123 void
124 struct linked_list *item; 124 fall(struct linked_list *item, bool pr)
125 bool pr;
126 { 125 {
127 reg struct object *obj; 126 reg struct object *obj;
128 reg struct room *rp; 127 reg struct room *rp;
129 static struct coord fpos; 128 static struct coord fpos;
130 129
153 /* 152 /*
154 * init_weapon: 153 * init_weapon:
155 * Set up the initial goodies for a weapon 154 * Set up the initial goodies for a weapon
156 */ 155 */
157 156
158 init_weapon(weap, type) 157 void
159 struct object *weap; 158 init_weapon(struct object *weap, int type)
160 int type;
161 { 159 {
162 reg struct init_weps *iwp; 160 reg struct init_weps *iwp;
163 161
164 weap->o_type = WEAPON; 162 weap->o_type = WEAPON;
165 weap->o_which = type; 163 weap->o_which = type;
180 178
181 /* 179 /*
182 * hit_monster: 180 * hit_monster:
183 * Does the missile hit the monster 181 * Does the missile hit the monster
184 */ 182 */
185 hit_monster(mp, obj) 183 bool
186 struct coord *mp; 184 hit_monster(struct coord *mp, struct object *obj)
187 struct object *obj;
188 { 185 {
189 return fight(mp, obj, TRUE); 186 return fight(mp, obj, TRUE);
190 } 187 }
191 188
192 /* 189 /*
193 * num: 190 * num:
194 * Figure out the plus number for armor/weapons 191 * Figure out the plus number for armor/weapons
195 */ 192 */
196 char * 193 char *
197 num(n1, n2) 194 num(int n1, int n2)
198 int n1, n2;
199 { 195 {
200 static char numbuf[LINLEN]; 196 static char numbuf[LINLEN];
201 197
202 if (n1 == 0 && n2 == 0) 198 if (n1 == 0 && n2 == 0)
203 return "+0"; 199 return "+0";
210 206
211 /* 207 /*
212 * wield: 208 * wield:
213 * Pull out a certain weapon 209 * Pull out a certain weapon
214 */ 210 */
215 wield() 211 void
212 wield(void)
216 { 213 {
217 reg struct linked_list *item; 214 reg struct linked_list *item;
218 reg struct object *obj, *oweapon; 215 reg struct object *obj, *oweapon;
219 216
220 oweapon = cur_weapon; 217 oweapon = cur_weapon;
236 233
237 /* 234 /*
238 * fallpos: 235 * fallpos:
239 * Pick a random position around the give (y, x) coordinates 236 * Pick a random position around the give (y, x) coordinates
240 */ 237 */
241 fallpos(pos, newpos, passages) 238 bool
242 struct coord *pos, *newpos; 239 fallpos(struct coord *pos, struct coord *newpos, bool passages)
243 bool passages;
244 { 240 {
245 reg int y, x, ch; 241 reg int y, x, ch;
246 242
247 for (y = pos->y - 1; y <= pos->y + 1; y++) { 243 for (y = pos->y - 1; y <= pos->y + 1; y++) {
248 for (x = pos->x - 1; x <= pos->x + 1; x++) { 244 for (x = pos->x - 1; x <= pos->x + 1; x++) {