ECE2035 class project
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
globals.h@5:3f356592ee9c, 2014-11-17 (annotated)
- Committer:
- slin77
- Date:
- Mon Nov 17 21:23:02 2014 +0000
- Revision:
- 5:3f356592ee9c
- Parent:
- 2:d39a6a36e0c0
add big_shoot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arvahsu | 0:532cb55d6136 | 1 | /* Gatech ECE2035 2014 FALL missile command |
arvahsu | 0:532cb55d6136 | 2 | * Copyright (c) 2014 Gatech ECE2035 |
arvahsu | 0:532cb55d6136 | 3 | * |
arvahsu | 0:532cb55d6136 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
arvahsu | 0:532cb55d6136 | 5 | * of this software and associated documentation files (the "Software"), to deal |
arvahsu | 0:532cb55d6136 | 6 | * in the Software without restriction, including without limitation the rights |
arvahsu | 0:532cb55d6136 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
arvahsu | 0:532cb55d6136 | 8 | * copies of the Software, and to permit persons to whom the Software is |
arvahsu | 0:532cb55d6136 | 9 | * furnished to do so, subject to the following conditions: |
arvahsu | 0:532cb55d6136 | 10 | * |
arvahsu | 0:532cb55d6136 | 11 | * The above copyright notice and this permission notice shall be included in |
arvahsu | 0:532cb55d6136 | 12 | * all copies or substantial portions of the Software. |
arvahsu | 0:532cb55d6136 | 13 | * |
arvahsu | 0:532cb55d6136 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
arvahsu | 0:532cb55d6136 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
arvahsu | 0:532cb55d6136 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
arvahsu | 0:532cb55d6136 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
arvahsu | 0:532cb55d6136 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
arvahsu | 0:532cb55d6136 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
arvahsu | 0:532cb55d6136 | 20 | * SOFTWARE. |
arvahsu | 0:532cb55d6136 | 21 | */ |
arvahsu | 0:532cb55d6136 | 22 | #ifndef GLOBAL_H |
arvahsu | 0:532cb55d6136 | 23 | #define GLOBAL_H |
slin77 | 2:d39a6a36e0c0 | 24 | #include "missile_public.h" |
slin77 | 2:d39a6a36e0c0 | 25 | #include "player.h" |
slin77 | 2:d39a6a36e0c0 | 26 | #include "city_landscape_public.h" |
arvahsu | 0:532cb55d6136 | 27 | // === [global object] === |
arvahsu | 0:532cb55d6136 | 28 | extern uLCD_4DGL uLCD; |
slin77 | 2:d39a6a36e0c0 | 29 | extern PLAYER current_player; |
slin77 | 2:d39a6a36e0c0 | 30 | extern ANTIMISSILE am[5]; |
slin77 | 2:d39a6a36e0c0 | 31 | extern EXPLOSION ex[5]; |
slin77 | 2:d39a6a36e0c0 | 32 | extern MISSILE missile_record[MAX_NUM_MISSILE]; |
slin77 | 2:d39a6a36e0c0 | 33 | extern CITY city_record[MAX_NUM_CITY]; |
arvahsu | 0:532cb55d6136 | 34 | |
arvahsu | 0:532cb55d6136 | 35 | |
arvahsu | 0:532cb55d6136 | 36 | // === [global settings] === |
arvahsu | 0:532cb55d6136 | 37 | #define BACKGROUND_COLOR 0x000000 //black |
arvahsu | 0:532cb55d6136 | 38 | #define LANDSCAPE_HEIGHT 4 // number of pixel on the screen |
arvahsu | 0:532cb55d6136 | 39 | #define MAX_BUILDING_HEIGHT 10 // number of pixel on the screen |
arvahsu | 0:532cb55d6136 | 40 | |
arvahsu | 0:532cb55d6136 | 41 | |
arvahsu | 0:532cb55d6136 | 42 | // === [define the macro of error heandle function] === |
arvahsu | 0:532cb55d6136 | 43 | // when the condition (c) is not true, assert the program and show error code |
arvahsu | 0:532cb55d6136 | 44 | #define ASSERT_P(c,e) do { \ |
arvahsu | 0:532cb55d6136 | 45 | if(!(c)){ \ |
arvahsu | 0:532cb55d6136 | 46 | uLCD.printf("\nERROR:%d\n",e); \ |
arvahsu | 0:532cb55d6136 | 47 | while(1); \ |
arvahsu | 0:532cb55d6136 | 48 | } \ |
arvahsu | 0:532cb55d6136 | 49 | } while (0) |
arvahsu | 0:532cb55d6136 | 50 | |
arvahsu | 0:532cb55d6136 | 51 | |
arvahsu | 0:532cb55d6136 | 52 | // === [error code] === |
arvahsu | 0:532cb55d6136 | 53 | #define ERROR_MISSILE_INDEX_GET_INFO -1 // make sure your code give the valid index for missile_get_info() |
arvahsu | 0:532cb55d6136 | 54 | #define ERROR_MISSILE_INDEX_UPDATE_STATUS -2 // make sure your code give the valid index for missile_update_status() |
arvahsu | 0:532cb55d6136 | 55 | #define ERROR_MISSILE_SPEED -3 // missile speed has to be between 1 and 8 |
arvahsu | 0:532cb55d6136 | 56 | #define ERROR_MISSILE_INTERVAL -4 // missile interval has to be between 1 and 100 |
arvahsu | 0:532cb55d6136 | 57 | // other missile error code ... |
arvahsu | 0:532cb55d6136 | 58 | #define ERROR_CITY_NUMBER -11 // num_city in city_landscape_init() is larger than MAX_NUM_CITY |
arvahsu | 0:532cb55d6136 | 59 | #define ERROR_CITY_INDEX_GET_INFO -12 // make sure your code give the valid index for city_get_info() |
arvahsu | 1:3da29f1d84b4 | 60 | #define ERROR_CITY_INDEX_DESTROY -13 // make sure your code give the valid index for city_destroy() |
arvahsu | 0:532cb55d6136 | 61 | // other player-missile error code ... |
arvahsu | 0:532cb55d6136 | 62 | |
arvahsu | 0:532cb55d6136 | 63 | #endif //GLOBAL_H |