Revision 308
multiplayer serial structs
proj.c | ||
---|---|---|
60 | 60 |
sprite_t *sp_crosshair = NULL; |
61 | 61 |
|
62 | 62 |
static int (singleplayer)(void); |
63 |
//static int (multiplayer)(void); |
|
63 | 64 |
static int (chat)(void); |
64 | 65 |
int(proj_main_loop)(int argc, char *argv[]) { |
65 | 66 |
|
... | ... | |
179 | 180 |
return 0; |
180 | 181 |
} |
181 | 182 |
|
183 |
typedef struct __attribute__((packed)) { |
|
184 |
// player 1 |
|
185 |
double player1_x; |
|
186 |
double player1_y; |
|
187 |
double player1_health; |
|
188 |
double player1_current_health; |
|
189 |
|
|
190 |
// player 2 |
|
191 |
double player2_x; |
|
192 |
double player2_y; |
|
193 |
double player2_health; |
|
194 |
double player2_current_health; |
|
195 |
|
|
196 |
// bullets |
|
197 |
size_t no_bullets; |
|
198 |
double *bullets_x; |
|
199 |
double *bullets_y; |
|
200 |
double *bullets_vx; |
|
201 |
double *bullets_vy; |
|
202 |
bool *bullet_shooter; // 0 for player 1, otherwise 1 for player 2 |
|
203 |
} host_info; |
|
204 |
|
|
205 |
typedef struct __attribute__((packed)) { |
|
206 |
keys_t client_keys_pressed; |
|
207 |
int32_t client_mouse_x; |
|
208 |
int32_t client_mouse_y; |
|
209 |
size_t bullets_shot; |
|
210 |
double *bullets_x; |
|
211 |
double *bullets_y; |
|
212 |
} client_info; |
|
213 |
/* |
|
214 |
static void host_to_client_process(const uint8_t *p, const size_t sz) { |
|
215 |
|
|
216 |
} |
|
217 |
|
|
218 |
static void client_to_host_process(const uint8_t *p, const size_t sz) { |
|
219 |
} |
|
220 |
|
|
221 |
static int (multiplayer)(void) { |
|
222 |
|
|
223 |
//int r; |
|
224 |
|
|
225 |
ent_set_scale(DEFAULT_SCALE); |
|
226 |
//text_timer_t *in_game_timer = timer_ctor(consolas); |
|
227 |
|
|
228 |
list_t *shooter_list = list_ctor(); |
|
229 |
|
|
230 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n"); |
|
231 |
gunner_set_spawn(shooter1, 75, 75); |
|
232 |
|
|
233 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter2 == NULL) printf("Failed to get shooter2\n"); |
|
234 |
gunner_set_spawn(shooter2, 975, 75); |
|
235 |
|
|
236 |
list_insert(shooter_list, list_end(shooter_list), shooter1); |
|
237 |
list_insert(shooter_list, list_end(shooter_list), shooter2); |
|
238 |
|
|
239 |
do { |
|
240 |
get_random_spawn(map1, shooter1, shooter_list); |
|
241 |
get_random_spawn(map1, shooter2, shooter_list); |
|
242 |
} while (distance_gunners(shooter1, shooter2) < 700); |
|
243 |
|
|
244 |
list_t *bullet_list = list_ctor(); |
|
245 |
|
|
246 |
ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0, |
|
247 |
gunner_get_y(shooter1)-ent_get_YLength()/2.0); |
|
248 |
|
|
249 |
//uint32_t refresh_count_value = sys_hz() / REFRESH_RATE; |
|
250 |
uint8_t last_lb = 0; |
|
251 |
struct packet pp; |
|
252 |
keys_t *keys = get_key_presses(); |
|
253 |
|
|
254 |
/// loop stuff |
|
255 |
uint32_t int_vector = 0; |
|
256 |
int good = true; |
|
257 |
|
|
258 |
// incomplete |
|
259 |
|
|
260 |
return 0; |
|
261 |
}*/ |
|
262 |
|
|
182 | 263 |
static int (campaign)(void); |
183 | 264 |
static int (zombies)(void); |
184 | 265 |
static int (singleplayer)(void) { |
Also available in: Unified diff