-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.h
181 lines (148 loc) · 3.87 KB
/
interfaces.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*******************************************************************************************
** Authors: Chris Spravka, Matthew Feidt
** Date: 16 OCT 2018
** Description: interfaces header file
1. a collection of all the interfacing structures and definitions in a more reasonable place
2. this ended up a lot worse than i envisioned
*******************************************************************************************/
#ifndef INTERFACES_H
#define INTERFACES_H
#include <stdlib.h>
#include <ncurses.h>
#include <string.h>
#define MAX_DISP_SUBSIZE 64
// reworking this
//#define REFRESH_RATE 50000
//#define REFRESH_RATE 225000
#define REFRESH_RATE 75000
// this provides good playability through putty
#define FRAME_RATE 12
// this is better suited to cygwin/linux
//#define FRAME_RATE 5
// this is only so high because you aren't cleaning them out as you go
#define MAX_EFFECTS 1024
#define MAX_EFFECT_DISPS 16
#define MAX_SPRITES 20480
#define MAX_SPRITE_DISPS 16
#define MAX_SPRITE_EFFECTS 16
#define MAX_LEVEL_DISPS 256
// oh gross
#define LEVEL_THREE_SCORE 70
#define EXTENDED_SCORE 160
// this is flip3
#define SERVER_IP_ADDR "128.193.36.41"
//#define SERVER_IP_ADDR "192.168.0.18"
#define SERVER_IP_PORT 57439
enum STYPE {
ship = 0, eny1, eny1a, eny2, openSpace1, openSpace2, openSpace3, openSpace4, missileRt, missileLt, laser,
asteroid1, asteroid2, asteroid3, sky1, sky2, gnd1, ammoM, ammoPC
};
enum ETYPE {
rtThrust = 0, ltThrust, upThrust1, upThrust2, dwThrust1, dwThrust2, shipEx1, shipEx2, shipEx3,
laserEffect, ammo1
};
int getRand(int, int);
/** SPRITES **/
struct sprite {
int type; // 0 for player, 1 for enemy ship, 2 for projectile, 3 for non-interacting background, 4 for indestructible
// x,y location will indicate the top left of the sprite by convention
float xLoc;
float yLoc;
// physics here or it's own struct?
float xVel;
float yVel;
float xAcc;
float yAcc;
// collision detection, center of mass & radius
float xCoM;
float yCoM;
float radius;
// color? color by character, probably?
// overall size (for collision detection)?
// thruster/effects locations?
int numDisps;
struct dispPair *dispArr[MAX_SPRITE_DISPS];
int effectIDs[MAX_SPRITE_EFFECTS];
int numEffects;
int markedForDeath;
int AI;
float errLast;
float isShooter;
int wpnSelect;
};
struct spriteList {
int numSprites;
struct sprite *spriteArr[MAX_SPRITES];
};
/** EFFECTS **/
struct effect {
int ID;
float start;
float ttl;
// x,y location will indicate the top left of the effect by convention
float xLoc;
float yLoc;
// think about how you really want to do this, once you get it working
// corresponding arrays of arrays of colors and characters?
int numDisps;
struct dispPair *dispArr[MAX_EFFECT_DISPS];
int parentID;
int xSize;
int ySize;
};
struct effectList {
int numEffects;
struct effect *effectArr[MAX_EFFECTS];
};
/** GAME STRUCTURES **/
struct gameState {
struct spriteList * allSprites;
struct effectList * allEffects;
float time;
float timeLast;
float timeWait;
int score;
int deltaKills;
float scoreTimeLast;
// are we going to need this to adjudicate between the minimum console
// size of all participants?
int maxX;
int maxY;
int titleSize;
int gndHeight;
int skyReady;
int playFlag;
int vertCtrl;
int deathScreen;
char playerName[11];
float timeKilled;
};
struct library {
struct spriteList * allSprites;
struct effectList * allEffects;
};
struct dispPair {
int colorPair;
char disp[MAX_DISP_SUBSIZE];
//char * disp;
int attr;
};
struct levelData {
int currLevel;
int numEnemies;
int maxNumEnemies;
int spawnOK;
int AIlevel;
int skyRate;
int skyLimit;
int groundVel;
int groundOK;
float maxHeight;
// float groundHeight;
int pctAmmo;
// maybe you want levels to have single char disps?
// that might be easier to procedurally generate
// int numDisps;
// struct dispPair *dispArr[MAX_LEVEL_DISPS];
};
#endif