Project

General

Profile

Revision 296

a few more changes

View differences:

proj.c
57 57
map_t                *map1          = NULL;
58 58
sprite_t             *sp_crosshair  = NULL;
59 59

  
60
static int (game)(void);
60
int (game)(void);
61
int (chat)(void);
61 62

  
62 63
int(proj_main_loop)(int argc, char *argv[]) {
63 64

  
......
100 101

  
101 102
    #ifndef DIOGO
102 103
        menu_t *main_menu = menu_ctor(consolas);
104
        menu_add_item(main_menu, "Play");
105
        menu_add_item(main_menu, "Chat");
106
        menu_add_item(main_menu, "Exit");
103 107
    #endif
104 108

  
105 109
    #ifndef DIOGO
......
120 124
    #ifndef DIOGO
121 125
        int click = 0;
122 126
    #endif
123
    #ifdef DIOGO
124
        char *s = NULL;
125
    #endif
126 127

  
127 128
    int good = true;
128 129

  
......
146 147
                                switch(menu_update_state(main_menu, click)){
147 148
                                    case -1: break;
148 149
                                    case  0: game(); break;
149
                                    case  1: good = false; break;
150
                                    case  1: chat(); break;
150 151
                                    case  2: good = false; break;
151 152
                                }
152 153
                                menu_draw(main_menu);
......
229 230
    return 0;
230 231
}
231 232

  
232
static int (game)(void){
233
int (game)(void){
233 234

  
234 235
    int r;
235 236

  
......
262 263
    /// loop stuff
263 264
    int ipc_status;
264 265
    message msg;
265
    int game_state = GAME;
266
    int good = true;
266 267

  
267
    while (game_state == GAME) {
268
    while (good) {
268 269
       /* Get a request message. */
269 270
       if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
270 271
           printf("driver_receive failed with %d", r);
......
305 306
                               break;
306 307
                           case KBC_IRQ:
307 308
                               if ((scancode[0]) == ESC_BREAK_CODE) {
308
                                   game_state = MENU;
309
                                   good = false;
309 310
                                   // reset game
310 311
                                   while(list_size(bullet_list) > 0){
311 312
                                       bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
......
344 345
       }
345 346
    }
346 347

  
347
    #ifdef DIOGO
348
        free(s);
349
    #endif
350

  
351 348
    while(list_size(shooter_list) > 0){
352 349
        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
353 350
        gunner_dtor(p);
354 351
    }
352
    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
355 353

  
356 354
    while(list_size(bullet_list) > 0){
357 355
        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
358 356
        bullet_dtor(p);
359 357
    }
360
    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
361 358
    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
362 359

  
363 360
    timer_dtor(in_game_timer); in_game_timer = NULL;
364 361

  
365 362
    return SUCCESS;
366 363
}
364

  
365
int (chat)(void){
366
    return SUCCESS;
367
}

Also available in: Unified diff