-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsphere.h
137 lines (128 loc) · 3.05 KB
/
sphere.h
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* =============================================================================
* PROGRAM: ularn
* FILENAME: sphere.h
*
* DESCRIPTION:
* This module contains functions for maintaining & moving the spheres of
* annihilation.
*
* =============================================================================
* EXPORTED VARIABLES
*
* None
*
* =============================================================================
* EXPORTED FUNCTIONS
*
* rmsphere : Remove a sphere from a location on the map
* newsphere : Create a new sphere
* movsphere : Move a sphere
* free_spheres : Free all allocated spheres
* write_spheres : Write the spheres to the save file
* read_spheres : Read the spheres from the save file
*
* =============================================================================
*/
#ifndef __SPHERE_H
# define __SPHERE_H
# include <stdio.h>
/* =============================================================================
* FUNCTION: rmsphere
*
* DESCRIPTION:
* Function to delete a sphere of annihilation from list.
*
* PARAMETERS:
*
* x : The map x coordinate from which the sphere is to be deleted
*
* y : The map y coordinate from which the sphere is to be deleted
*
* RETURN VALUE:
*
* None.
*/
void rmsphere(int x, int y);
/* =============================================================================
* FUNCTION: newsphere
*
* DESCRIPTION:
* Function to create a new sphere of annihilation.
*
* PARAMETERS:
*
* x : The x coordinate of the new sphere
*
* y : The y coordinate of the new sphere
*
* dir : The initial direction of travel for the sphere in diroff format
*
* lifetime : The number of turns the sphere is last.
*
* RETURN VALUE:
*
* None.
*/
void newsphere(int x, int y, int dir, int life);
/* =============================================================================
* FUNCTION: movsphere
*
* DESCRIPTION:
* Function to look for and move spheres of annihilation.
*
* PARAMETERS:
*
* None.
*
* RETURN VALUE:
*
* None.
*/
void movsphere(void);
/* =============================================================================
* FUNCTION: free_spheres
*
* DESCRIPTION:
* Function to free all spheres of annihilation.
* This needs to be called before exitting the game.
*
* PARAMETERS:
*
* None.
*
* RETURN VALUE:
*
* None.
*/
void free_spheres(void);
/* =============================================================================
* FUNCTION: write_spheres
*
* DESCRIPTION:
* Function to write the spheres of annihilation to the save file.
*
* PARAMETERS:
*
* fp : A pointer to the save file being written.
*
* RETURN VALUE:
*
* None.
*/
void write_spheres(FILE *fp);
/* =============================================================================
* FUNCTION: read_spheres
*
* DESCRIPTION:
* Function to read the spheres of annihilation from the save file.
*
* PARAMETERS:
*
* fp : A pointer to the save file currently being read.
*
* RETURN VALUE:
*
* None.
*/
void read_spheres(FILE *fp);
#endif